diff mm7_5.cpp @ 916:897b10712a1a

UIShop_Buy_Identify_Repair little clean and rename
author Ritor1
date Thu, 25 Apr 2013 17:37:00 +0600
parents 8cd0b155bebe
children 34ed2d5e7cfb
line wrap: on
line diff
--- a/mm7_5.cpp	Tue Apr 23 09:18:22 2013 +0600
+++ b/mm7_5.cpp	Thu Apr 25 17:37:00 2013 +0600
@@ -56,8 +56,8 @@
   //NPCData *pNPCData0; // eax@18
   //int v6; // edx@20
   //int v7; // ecx@29
-  unsigned int v8; // edx@59
-  unsigned int v9; // ecx@60
+  //unsigned int v8; // edx@59
+  //unsigned int v9; // ecx@60
   unsigned int v10; // ecx@73
   //unsigned int v11; // eax@75
   unsigned __int8 v12; // sf@75
@@ -127,8 +127,8 @@
   int v76; // esi@535
   int v77; // eax@537
   Player *pPlayer2; // ecx@549
-  int v79; // ecx@550
-  unsigned int v80; // edx@550
+  //int v79; // ecx@550
+  //unsigned int v80; // edx@550
   signed int v81; // eax@552
   POINT *pPoint2; // eax@553
   signed int v83; // ecx@554
@@ -137,14 +137,14 @@
   unsigned int v86; // eax@583
   const char *v87; // ecx@595
   const char *v88; // ecx@596
-  unsigned int v89; // eax@598
+  //unsigned int v89; // eax@598
   unsigned int v90; // eax@602
   int v91; // edx@605
   int v92; // eax@605
   int v93; // edx@605
   int pPlayerNum; // edx@611
   int v95; // eax@611
-  const char *v96; // ecx@621
+  //const char *v96; // ecx@621
   unsigned int v97; // eax@624
   int v98; // eax@636
   unsigned __int8 v99; // al@643
@@ -178,42 +178,42 @@
   int v127; // [sp-1Ch] [bp-618h]@107
   unsigned int v128; // [sp-1Ch] [bp-618h]@711
   int v129; // [sp-18h] [bp-614h]@86
-  signed int v130; // [sp-18h] [bp-614h]@107
+  //signed int v130; // [sp-18h] [bp-614h]@107
   int v131; // [sp-14h] [bp-610h]@86
-  unsigned int v132; // [sp-14h] [bp-610h]@107
-  unsigned int v133; // [sp-10h] [bp-60Ch]@60
+  //unsigned int v132; // [sp-14h] [bp-610h]@107
+  //unsigned int v133; // [sp-10h] [bp-60Ch]@60
   unsigned int v134; // [sp-10h] [bp-60Ch]@86
-  signed int v135; // [sp-10h] [bp-60Ch]@107
+  //signed int v135; // [sp-10h] [bp-60Ch]@107
   unsigned int v136; // [sp-10h] [bp-60Ch]@121
-  unsigned int v137; // [sp-Ch] [bp-608h]@60
+  //unsigned int v137; // [sp-Ch] [bp-608h]@60
   unsigned int v138; // [sp-Ch] [bp-608h]@86
-  signed int v139; // [sp-Ch] [bp-608h]@107
+  //signed int v139; // [sp-Ch] [bp-608h]@107
   unsigned int v140; // [sp-Ch] [bp-608h]@121
   enum WindowType pWindowType; // [sp-8h] [bp-604h]@56
-  enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60
+  //enum WindowType pWindowType1; // [sp-8h] [bp-604h]@60
   unsigned __int8 v143; // [sp-8h] [bp-604h]@86
-  int v144; // [sp-8h] [bp-604h]@107
+  //int v144; // [sp-8h] [bp-604h]@107
   enum WindowType pWindowType2; // [sp-8h] [bp-604h]@121
-  const char *v146; // [sp-8h] [bp-604h]@449
-  unsigned int v147; // [sp-8h] [bp-604h]@550
+  //const char *v146; // [sp-8h] [bp-604h]@449
+  //unsigned int v147; // [sp-8h] [bp-604h]@550
   //int v148; // [sp-4h] [bp-600h]@56
   GUIButton *pButton2; // [sp-4h] [bp-600h]@59
   const char *v150; // [sp-4h] [bp-600h]@86
-  unsigned int v151; // [sp-4h] [bp-600h]@107
+  //unsigned int v151; // [sp-4h] [bp-600h]@107
   int v152; // [sp-4h] [bp-600h]@121
   int v153; // [sp-4h] [bp-600h]@135
   int v154; // [sp-4h] [bp-600h]@149
   int v155; // [sp-4h] [bp-600h]@165
   int v156; // [sp-4h] [bp-600h]@204
-  const char *v157; // [sp-4h] [bp-600h]@444
+  //const char *v157; // [sp-4h] [bp-600h]@444
   unsigned int v158; // [sp-4h] [bp-600h]@449
-  __int16 v159; // [sp-4h] [bp-600h]@550
+  //__int16 v159; // [sp-4h] [bp-600h]@550
   int v160; // [sp-4h] [bp-600h]@599
   const char *v161; // [sp-4h] [bp-600h]@637
   //int v162; // [sp+0h] [bp-5FCh]@56
-  int v163; // [sp+0h] [bp-5FCh]@59
+  //int v163; // [sp+0h] [bp-5FCh]@59
   Texture *pTexture; // [sp+0h] [bp-5FCh]@86
-  int v165; // [sp+0h] [bp-5FCh]@107
+  //int v165; // [sp+0h] [bp-5FCh]@107
   int v166; // [sp+0h] [bp-5FCh]@121
   int v167; // [sp+0h] [bp-5FCh]@135
   int v168; // [sp+0h] [bp-5FCh]@149
@@ -223,7 +223,7 @@
   KeyToggleType pKeyToggleType; // [sp+0h] [bp-5FCh]@287
   char *v173; // [sp+0h] [bp-5FCh]@444
   char *v174; // [sp+0h] [bp-5FCh]@449
-  int v175; // [sp+0h] [bp-5FCh]@550
+  //int v175; // [sp+0h] [bp-5FCh]@550
   int v176; // [sp+0h] [bp-5FCh]@599
   const char *v177; // [sp+0h] [bp-5FCh]@629
   char *v178; // [sp+0h] [bp-5FCh]@637
@@ -1248,7 +1248,7 @@
                         }
                       }
                       break;
-                    case SCREEN_REST:
+                    case SCREEN_REST://close rest screen
                       if ( dword_506F14 )
                       {
                         Rest(_506F18_num_hours_to_sleep);
@@ -1749,10 +1749,8 @@
           if ( v45 == 3 )
           {
             v47 = pActors[v46].uAIState == Dead;
-            //goto LABEL_400;
             if ( !v47 )
               continue;
-            //goto LABEL_415;
             v51 = pGUIWindow_Settings->ptr_1C;
             *((char *)v51 + 8) &= 0xBFu;
             *((short *)v51 + 2) = uMessageParam;
@@ -1770,10 +1768,8 @@
           if ( v45 == 2 )
           {
             v47 = (pObjectList->pObjects[pSpriteObjects[v46].uObjectDescID].uFlags & 0x10) == 0;
-//LABEL_400:
             if ( !v47 )
               continue;
-            //goto LABEL_415;
             v51 = pGUIWindow_Settings->ptr_1C;
             *((char *)v51 + 8) &= 0xBFu;
             *((short *)v51 + 2) = uMessageParam;
@@ -1924,16 +1920,11 @@
         continue;
 
         case UIMSG_B2:
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
+			__debugbreak;//UIMSG_B2 -???
           bRecallingBeacon = uMessageParam;
-          v135 = -1;
-          v132 = 0;
-          v130 = 0;
           v127 = uMessageParam + 204;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_B4:
           if ( !pGUIWindow_CurrentMenu )
             continue;
@@ -1944,8 +1935,9 @@
             if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) )
               continue;
             v173 = pMapStats->pInfos[sub_410D99_get_map_index(HIWORD(pPlayer->pInstalledBeacons[uMessageParam].field_18))].pName;
-            v157 = pGlobalTXT_LocalizationStrings[474];// "Recall to %s"
-            goto _sprintex_2args_draw_status_and_continue;
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[474], v173);// "Recall to %s"
+            sub_41C0B8_set_status_string(pTmpBuf);
+            continue;
           }
           v59 = pMapStats->GetMapInfo(pCurrentMapName);
           thise = "Not in Map Stats";
@@ -1953,18 +1945,17 @@
             thise = pMapStats->pInfos[v59].pName;
           if ( !*((int *)&pSavegameThumbnails->pPixels + 10 * uMessageParam) || !v59 )
           {
-            v173 = thise;
-            v157 = pGlobalTXT_LocalizationStrings[476];// "Set to %s"
-            goto _sprintex_2args_draw_status_and_continue;
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[476], thise);// "Set to %s"
+            sub_41C0B8_set_status_string(pTmpBuf);
+            continue;
           }
           v174 = pMapStats->pInfos[sub_410D99_get_map_index(*(short *)(uNumSeconds + 26))].pName;
           v158 = (unsigned int)thise;
-          v146 = pGlobalTXT_LocalizationStrings[475];// "Set %s over %s"
-//_sprintex_draw_status_and_continue:
-          sprintf(pTmpBuf, v146, v158, v174);
+          sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[475], v158, v174);// "Set %s over %s"
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
         case UIMSG_B5:
+			__debugbreak;//UIMSG_B5 - ???
           dword_50CDC8 = v0;
           //goto LABEL_453;
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
@@ -2179,9 +2170,9 @@
                     default:
                     if ( uMessageParam != 5 )
                     {
-                      v173 = v200;
-                      v157 = pGlobalTXT_LocalizationStrings[35];
-                      goto _sprintex_2args_draw_status_and_continue;
+                      sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200);
+                      sub_41C0B8_set_status_string(pTmpBuf);
+                      continue;
                     }
                     v69 = pMapStats->pInfos[8].pName;
                     break;
@@ -2191,10 +2182,9 @@
                 {
                   v69 = pMapStats->pInfos[21].pName;
                 }
-                v200 = v69;
-                v173 = v200;
-                v157 = pGlobalTXT_LocalizationStrings[35];
-                goto _sprintex_2args_draw_status_and_continue;
+                sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69);
+                sub_41C0B8_set_status_string(pTmpBuf);
+                continue;
               }
               v68 = 210;
               break;
@@ -2230,9 +2220,9 @@
                 if ( uMessageParam != 5 )
                   //goto LABEL_519;
                   {
-                   v173 = v200;
-                   v157 = pGlobalTXT_LocalizationStrings[35];
-                   goto _sprintex_2args_draw_status_and_continue;
+                    sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v200);
+                    sub_41C0B8_set_status_string(pTmpBuf);
+                    continue;
                   }
                 v69 = pMapStats->pInfos[8].pName;
                 break;
@@ -2242,11 +2232,9 @@
           {
             v69 = pMapStats->pInfos[21].pName;
           }
-          v200 = v69;
-//LABEL_519:
-          v173 = v200;
-          v157 = pGlobalTXT_LocalizationStrings[35];
-          goto _sprintex_2args_draw_status_and_continue;
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[35], v69);
+          sub_41C0B8_set_status_string(pTmpBuf);
+          continue;
         case UIMSG_ShowFinalWindow:
           sprintf(pFinalMessage, "%s\n \n%s\n \n%s", pGlobalTXT_LocalizationStrings[151],// "Congratulations Adventurer."
             pGlobalTXT_LocalizationStrings[118],// "We hope that you've enjoyed playing Might and Magic VII as much as we did making it. We have saved this screen as MM7_WIN.PCX in your MM7 directory. You can print it out as proof of your accomplishment."
@@ -2255,10 +2243,12 @@
           uGameState = GAME_STATE_FINAL_WINDOW;
           continue;
         case UIMSG_C4:
+			__debugbreak;
           uGameState = 0;
           strcpy((char *)pKeyActionMap->pPressedKeysBuffer, "2");
           goto LABEL_524;
         case UIMSG_DD:
+          __debugbreak;
 LABEL_524:
           sprintf(pTmpBuf, "%s", pKeyActionMap->pPressedKeysBuffer);
           memcpy(&v216, txt_file_frametable_parser((const char *)pKeyActionMap->pPressedKeysBuffer, &v218), sizeof(v216));
@@ -2499,24 +2489,12 @@
             _42ECB5_PlayerAttacksActor();
           continue;
         case UIMSG_ExitRest:
-          v163 = (int)pGlobalTXT_LocalizationStrings[81];// "Exit Rest"
-          pButton = pButton_RestUI_Exit;
-          pButton2 = pButton_RestUI_Exit;
-          pWindowType1 = (WindowType)96;
-          //goto LABEL_731;
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(pButton_RestUI_Exit->uX, pButton_RestUI_Exit->uY, 0, 0, (WindowType)96, (int)pButton_RestUI_Exit, (int)pGlobalTXT_LocalizationStrings[81]);// "Exit Rest"
           continue;
         case UIMSG_Wait5Minutes:
           if ( dword_506F14 == 2 )
-            //goto LABEL_621;
-          {
-            v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            ShowStatusBarString(v96, 2);
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
@@ -2527,10 +2505,8 @@
           continue;
         case UIMSG_Wait1Hour:
           if ( dword_506F14 == 2 )
-            //goto LABEL_621;
-          {
-            v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            ShowStatusBarString(v96, 2);
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
@@ -2546,7 +2522,6 @@
           _506F18_num_hours_to_sleep = v86;
           if ( uMessageParam == 111 || uMessageParam == 114 || uMessageParam == 116 )
             _506F18_num_hours_to_sleep = v86 + 720;
-          //goto LABEL_615;
           dword_506F14 = 2;
           pParty->RestAndHeal();
           pParty->days_played_without_rest = 0;
@@ -2561,34 +2536,28 @@
           if ( pCurrentScreen )
             continue;
           if ( sub_42F4DA() )
-            //goto LABEL_594;
           {
             if ( pParty->bTurnBasedModeOn == v0 )
             {
-              v87 = pGlobalTXT_LocalizationStrings[478];// "You can't rest in turn-based mode!"
-              ShowStatusBarString(v87, 2u);
+              ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
               continue;
             }
             v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
             if ( pParty->uFlags & 0x88 )
               v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
-            ShowStatusBarString(v88, 2u);
-            v89 = uActiveCharacter;
+            ShowStatusBarString(v88, 2);
             if ( !uActiveCharacter )
             {
               v1 = "";
               v0 = 1;
               continue;
             }
-            v176 = 0;
-            v160 = 13;
-            goto LABEL_619;
+            pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
+            continue;
           }
           if ( pParty->bTurnBasedModeOn == v0 )
-            //goto LABEL_595;
-          {
-            v87 = pGlobalTXT_LocalizationStrings[478];// "You can't rest in turn-based mode!"
-            ShowStatusBarString(v87, 2u);
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
             continue;
           }
           if ( !(pParty->uFlags & 0x88) )
@@ -2596,36 +2565,27 @@
             RestUI_Initialize();
             continue;
           }
-//LABEL_594:
           if ( pParty->bTurnBasedModeOn == v0 )
           {
-//LABEL_595:
-            v87 = pGlobalTXT_LocalizationStrings[478];// "You can't rest in turn-based mode!"
-            //goto _draw_status_string_and_continue;
-            ShowStatusBarString(v87, 2u);
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[478], 2);// "You can't rest in turn-based mode!"
             continue;
           }
           v88 = pGlobalTXT_LocalizationStrings[480];// "There are hostile enemies near!"
           if ( pParty->uFlags & 0x88 )
             v88 = pGlobalTXT_LocalizationStrings[479];// "You can't rest here!"
           ShowStatusBarString(v88, 2u);
-          v89 = uActiveCharacter;
           if ( !uActiveCharacter )
-            //goto LABEL_90;
           {
             v1 = "";
             v0 = 1;
             continue;
           }
-          v176 = 0;
-          v160 = 13;
-          goto LABEL_619;
+          pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)13, 0);
+          continue;
         case UIMSG_Rest8Hour:
           if ( dword_506F14 )
-            //goto LABEL_621;
-          {
-            v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            ShowStatusBarString(v96, 2);
+          {
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
@@ -2633,13 +2593,7 @@
           {
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[482], 2u);// "You don't have enough food to rest"
             if ( uActiveCharacter && pPlayers[uActiveCharacter]->CanAct() )
-            {
-              v89 = uActiveCharacter;
-              v176 = 0;
-              v160 = SPEECH_108;
-LABEL_619:
-              pPlayers[v89]->PlaySound((PlayerSpeech)v160, v176);
-            }
+              pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_108, 0);
           }
           else
           {
@@ -2679,21 +2633,13 @@
                   ++pMessageQueue_50CBD0->uNumMessages;
                 }*/
                 pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
-                ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2u);// "Encounter!"
-                v165 = 0;
-                v151 = 0;
-                v144 = 0;
-                v139 = 0;
-                v135 = -1;
-                v132 = 0;
-                v130 = 0;
-                v127 = 227;
-                goto _play_sound_and_continue;
+                ShowStatusBarString(pGlobalTXT_LocalizationStrings[481], 2);// "Encounter!"
+                pAudioPlayer->PlaySound((SoundID)227, 0, 0, -1, 0, 0, 0, 0);
+                continue;
               }
             }
             Party::TakeFood(uRestUI_FoodRequiredToRest);
             _506F18_num_hours_to_sleep = 480;
-//LABEL_615:
             dword_506F14 = 2;
             pParty->RestAndHeal();
             pParty->days_played_without_rest = 0;
@@ -2706,9 +2652,7 @@
         case UIMSG_AlreadyResting:
           if ( dword_506F14 == 2 )
           {
-//LABEL_621:
-            v96 = pGlobalTXT_LocalizationStrings[477];// "You are already resting!"
-            ShowStatusBarString(v96, 2);
+            ShowStatusBarString(pGlobalTXT_LocalizationStrings[477], 2);// "You are already resting!"
             pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
             continue;
           }
@@ -2719,12 +2663,11 @@
           _506F18_num_hours_to_sleep = 60 * v97 - pParty->uCurrentMinute;
           continue;
         case UIMSG_4E:
+			__debugbreak;//UIMSG_4E -???
           if ( quick_spell_at_page && byte_506550 )
           {
             v173 = pSpellStats->pInfos[quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
-            v157 = pGlobalTXT_LocalizationStrings[483];
-_sprintex_2args_draw_status_and_continue:
-            sprintfex(pTmpBuf, v157, v173);
+            sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[483], v173);
           }
           else
           {
@@ -2734,7 +2677,6 @@
               v177 = pGlobalTXT_LocalizationStrings[484];// "Select a spell then click here to set a QuickSpell"
             strcpy(pTmpBuf, v177);
           }
-//_set_status_string_pTmpBuf_and_continue:
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
         case UIMSG_SPellbook_ShowHightlightedSpellInfo:
@@ -2756,27 +2698,20 @@
           }
           sprintfex(pTmpBuf, v161, v178);
           sub_41C0B8_set_status_string(pTmpBuf);
-          //goto LABEL_91;
           v0 = 1;
           continue;
         case UIMSG_58:
+			__debugbreak;//UIMSG_58 - ???
           GUIWindow::Create(pBtn_InstallRemoveSpell->uX, pBtn_InstallRemoveSpell->uY, 0, 0, WINDOW_5A, (int)pBtn_InstallRemoveSpell, 0);
           if ( !uActiveCharacter )
             continue;
           pPlayer10 = pPlayers[uActiveCharacter];
           if ( !byte_506550 || !quick_spell_at_page )
           {
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
             pPlayer10->uQuickSpell = 0;
-            v130 = 0;
             quick_spell_at_page = 0;
-            v127 = 203;
-            goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)203, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           v99 = quick_spell_at_page + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
           pPlayers[uActiveCharacter]->uQuickSpell = v99;
@@ -2786,6 +2721,7 @@
           byte_506550 = 0;
           continue;
         case UIMSG_33:
+			__debugbreak;//UIMSG_33 - ???
           if ( !uActiveCharacter )
             continue;
           pPlayer3 = pPlayers[uActiveCharacter];
@@ -2809,15 +2745,9 @@
           while ( v101 < 9 );
           if ( !pNPCData4 )
           {
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = 0;
             v127 = rand() % 2 + 204;
-            goto _play_sound_and_continue;
+            pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
+            continue;
           }
           if ( GetAsyncKeyState(16) )
           {
@@ -2834,30 +2764,18 @@
           sub_41140B();
           pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
           pGUIWindow_CurrentMenu->OpenSpellBook();
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = 0;
           v127 = rand() % 2 + 204;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_OpenSpellbookPage:
           if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
             continue;
           sub_41140B();
           pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
           pGUIWindow_CurrentMenu->OpenSpellBook();
-          v165 = 0;
-          v151 = 0;
-          v144 = 0;
-          v139 = 0;
-          v135 = -1;
-          v132 = 0;
-          v130 = 0;
           v127 = rand() % 2 + 204;
-          goto _play_sound_and_continue;
+          pAudioPlayer->PlaySound((SoundID)v127, 0, 0, -1, 0, 0, 0, 0);
+          continue;
         case UIMSG_SelectSpell:
         {
           if (pTurnEngine->field_4 == 3)
@@ -2901,17 +2819,9 @@
         continue;
 
         case UIMSG_92:
+			__debugbreak;//UIMSG_92 - ???
           if ( pTurnEngine->field_4 != 3 )
-          {
-            v175 = 0;
-            v159 = v0;
-            v147 = 133;
-//LABEL_678:
-            v80 = v199;
-            v79 = uMessageParam;
-//LABEL_679:
-            _42777D_CastSpell_UseWand_ShootArrow(v79, v80, v147, v159, v175);
-          }
+            _42777D_CastSpell_UseWand_ShootArrow(uMessageParam, v199, 133, v0, 0);
           continue;
         case UIMSG_SpellBookWindow:
           if ( pTurnEngine->field_4 == 3 )
@@ -2919,16 +2829,7 @@
           if ( bUnderwater == 1 )
           {
             ShowStatusBarString(pGlobalTXT_LocalizationStrings[652], 2);// "You can not do that while you are underwater!"
-            v165 = 0;
-            v151 = 0;
-            v144 = 0;
-            v139 = 0;
-            v135 = -1;
-            v132 = 0;
-            v130 = 0;
-            v127 = 27;
-_play_sound_and_continue:
-            pAudioPlayer->PlaySound((SoundID)v127, v130, v132, v135, v139, v144, v151, v165);
+            pAudioPlayer->PlaySound((SoundID)27, 0, 0, -1, 0, 0, 0, 0);
           }
           else
           {
@@ -2953,7 +2854,6 @@
                  || pCurrentScreen > SCREEN_67) )
               {
                 pGUIWindow_CurrentMenu->Release();
-//LABEL_693:
                 GUIWindow::Create(0x1DCu, 0x1C2u, 0, 0, WINDOW_5A, (int)pBtn_CastSpell, 0);
                 pCurrentScreen = SCREEN_SPELL_BOOK;
                 pEventTimer->Pause();
@@ -3010,18 +2910,19 @@
           pMessageQueue_50CBD0->AddMessage(UIMSG_Escape, 0, 0);
           continue;
         case UIMSG_C0:
+			__debugbreak;//UIMSG_C0 - ???
           dword_50651C = v0;
           if ( pMouse->GetCursorPos(&v211)->y > 178 )
             dword_50651C = -1;
           continue;
         case UIMSG_A9:
+			__debugbreak;
           GUIWindow::Create(pBtn_Up->uX, pBtn_Up->uY, 0, 0, WINDOW_5B, (int)pBtn_Up, 0);
-//LABEL_707:
           dword_506548 = v0;
           continue;
         case UIMSG_AA:
+			__debugbreak;
           GUIWindow::Create(pBtn_Down->uX, pBtn_Down->uY, 0, 0, WINDOW_5B, (int)pBtn_Down, 0);
-//LABEL_709:
           dword_506544 = v0;
           continue;
         case UIMSG_ChangeDetaliz:
@@ -3052,37 +2953,19 @@
           OnPaperdollLeftClick();
           continue;
         case UIMSG_73:
+			__debugbreak;
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 100;
           sub_4196A0();
           sub_419379();
-          pButton = pCharacterScreen_StatsBtn;
-          //goto LABEL_716;
-          v163 = 0;
-          pButton2 = pButton;
-          pWindowType1 = (WindowType)91;
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(pCharacterScreen_StatsBtn->uX, pCharacterScreen_StatsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_StatsBtn, 0);
           continue;
         case UIMSG_72:
+			__debugbreak;
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 101;
           sub_4196A0();
           sub_419379();
           CharacterUI_SkillScreen_Draw();
-          pButton = pCharacterScreen_SkillsBtn;
-          //goto LABEL_716;
-          v163 = 0;
-          pButton2 = pButton;
-          pWindowType1 = (WindowType)91;
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(pCharacterScreen_SkillsBtn->uX, pCharacterScreen_SkillsBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_SkillsBtn, 0);
           continue;
         case UIMSG_SkillUp:
           pPlayer4 = pPlayers[uActiveCharacter];
@@ -3100,52 +2983,26 @@
               *(short *)v105 = uNumSeconds + 1;
               pPlayer4->uSkillPoints -= pPlayer4->pActiveSkills[uMessageParam] & 0x3F;
               pPlayer4->PlaySound(SPEECH_14, 0);
-              v165 = 0;
-              v151 = 0;
-              v144 = 0;
-              v139 = 0;
-              v135 = -1;
-              v132 = 0;
-              v130 = 0;
-              v127 = 20001;
-              goto _play_sound_and_continue;
+              pAudioPlayer->PlaySound((SoundID)20001, 0, 0, -1, 0, 0, 0, 0);
+              continue;
             }
             v87 = pGlobalTXT_LocalizationStrings[487];// "You have already mastered this skill!"
           }
-//_draw_status_string_and_continue:
-          ShowStatusBarString(v87, 2u);
+          ShowStatusBarString(v87, 2);
           continue;
         case UIMSG_74:
+			__debugbreak;
           pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] = 103;
           sub_419379();
           sub_4196A0();
-          pButton = pCharacterScreen_InventoryBtn;
-//LABEL_716:
-          v163 = 0;
-          pButton2 = pButton;
-          pWindowType1 = (WindowType)91;
-          //goto LABEL_731;
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(pCharacterScreen_InventoryBtn->uX, pCharacterScreen_InventoryBtn->uY, 0, 0, (WindowType)91, (int)pCharacterScreen_InventoryBtn, 0);
           continue;
         case UIMSG_A8:
-          pButton = pCharacterScreen_ExitBtn;
-          v163 = 0;
-          pButton2 = pCharacterScreen_ExitBtn;
-          pWindowType1 = (WindowType)97;
-          //goto LABEL_731;
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+			__debugbreak;
+          GUIWindow::Create(pCharacterScreen_ExitBtn->uX, pCharacterScreen_ExitBtn->uY, 0, 0, (WindowType)97, (int)pCharacterScreen_ExitBtn, 0);
           continue;
         case UIMSG_75:
+			__debugbreak;
           sub_419379();
           sub_4196A0();
           sub_419220();
@@ -3160,11 +3017,9 @@
             default:
               continue;
             case 11:
-              //goto LABEL_707;
               dword_506548 = v0;
               continue;
             case 10:
-              //goto LABEL_709;
               dword_506544 = v0;
               continue;
             case 0:
@@ -3208,16 +3063,7 @@
               dword_50652C = v0;
               break;
           }
-          v163 = v0;
-          pButton2 = pButton;
-          pWindowType1 = (WindowType)92;
-//LABEL_731:
-          v8 = pButton->uY;
-          v9 = pButton->uX;
-          //goto LABEL_732;
-          v137 = 0;
-          v133 = 0;
-          GUIWindow::Create(v9, v8, v133, v137, pWindowType1, (int)pButton2, v163);
+          GUIWindow::Create(pButton->uX, pButton->uY, 0, 0, (WindowType)92, (int)pButton, v0);
           continue;
         case UIMSG_SelectCharacter:
           if ( pMessageQueue_50CBD0->uNumMessages )
@@ -3227,9 +3073,7 @@
         case UIMSG_ShowStatus_Funds:
           v174 = (char *)pParty->uNumGoldInBank;
           v158 = pParty->uNumGold + pParty->uNumGoldInBank;
-          v146 = pGlobalTXT_LocalizationStrings[489];// "You have %d total gold, %d in the Bank""
-          //goto _sprintex_draw_status_and_continue;
-          sprintfex(pTmpBuf, v146, v158, v174);
+          sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[489], v158, v174);// "You have %d total gold, %d in the Bank"
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
         case UIMSG_ShowStatus_DateTime:
@@ -3275,6 +3119,7 @@
           sub_41C0B8_set_status_string(pTmpBuf);
           continue;
         case UIMSG_C:
+			__debugbreak;
           if ( pCurrentScreen == SCREEN_F )
           {
             sub_421EA6_OnInventoryLeftClick();
@@ -3286,8 +3131,8 @@
           sub_421EA6_OnInventoryLeftClick();
           continue;
         case UIMSG_A:
+			__debugbreak;
           if ( !pRenderer->pRenderD3D )
-            //goto LABEL_772;
           {
             if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
@@ -3337,11 +3182,13 @@
           }*/
           continue;
         case UIMSG_E:
+			__debugbreak;
           if ( pMessageQueue_50CBD0->uNumMessages )
             pMessageQueue_50CBD0->uNumMessages = pMessageQueue_50CBD0->pMessages[0].field_8 != 0;
           OnGameViewportClick();
           continue;
         case UIMSG_F:
+			__debugbreak;
           if ( pRenderer->pRenderD3D )
           {
             LOWORD(v116) = pGame->pVisInstance->get_picked_object_zbuf_val();
@@ -3356,6 +3203,7 @@
           GUIWindow::Create(0, 0, 0, 0, (WindowType)15, (int)pButton2, 0);
           continue;
         case UIMSG_54:
+			__debugbreak;
           pButton2 = (GUIButton *)uMessageParam;
           GUIWindow::Create(0, 0, 0, 0, (WindowType)22, (int)pButton2, 0);
           continue;
@@ -3365,6 +3213,7 @@
           OnPressSpace();
           continue;
         case UIMSG_16F:
+			__debugbreak;
           if ( pCurrentScreen )
             continue;
           pParty->uFlags |= 2u;
@@ -3388,6 +3237,7 @@
           viewparams->field_28 = 11;
           goto LABEL_788;
         case UIMSG_170:
+			__debugbreak;
           if ( pCurrentScreen )
             continue;
           pParty->uFlags |= 2u;