diff mm7_5.cpp @ 60:30ec77bbd018

Merge
author Nomad
date Fri, 26 Oct 2012 02:42:38 +0200
parents 5159d2e6f559 6b3a5283b107
children 476145dc3441
line wrap: on
line diff
--- a/mm7_5.cpp	Fri Oct 26 02:38:26 2012 +0200
+++ b/mm7_5.cpp	Fri Oct 26 02:42:38 2012 +0200
@@ -2671,7 +2671,7 @@
         case 0x4E:
           if ( dword_50654C && byte_506550 )
           {
-            v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->field_1A4E].pName;
+            v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage].pName;
             v157 = pGlobalTXT_LocalizationStrings[483];
 _sprintex_2args_draw_status_and_continue:
             sprintf(pTmpBuf, v157, v173);
@@ -2727,7 +2727,7 @@
             v127 = 203;
             goto _play_sound_and_continue;
           }
-          v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->field_1A4E;
+          v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage;
           pPlayers[uActiveCharacter]->uQuickSpell = v99;
           stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter);
           if ( uActiveCharacter )
@@ -2746,7 +2746,7 @@
           {
             if ( *(short *)thisl )
             {
-              if ( v100->field_1A4E == v101 )
+              if ( v100->pNumSpellBookPage == v101 )
                 uAction = (int)v195;
               v102 = (int)v195;
               v195 = (NPCData *)((char *)v195 + 1);
@@ -2771,13 +2771,13 @@
               uAction = 0;
           }
           sub_41140B();
-          pPlayers[uActiveCharacter]->field_1A4E = LOBYTE(v217[uAction]);
+          pPlayers[uActiveCharacter]->pNumSpellBookPage = LOBYTE(v217[uAction]);
           goto LABEL_661;
         case UIMSG_SaveGame|0x4:
-          if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->field_1A4E )
+          if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->pNumSpellBookPage )
             goto _continue;
           sub_41140B();
-          pPlayers[uActiveCharacter]->field_1A4E = uMessageParam;
+          pPlayers[uActiveCharacter]->pNumSpellBookPage = uMessageParam;
 LABEL_661:
           pGUIWindow_CurrentMenu->_411621();
 LABEL_662:
@@ -3417,7 +3417,7 @@
   int v42; // [sp-10h] [bp-20h]@36
   int v43; // [sp-10h] [bp-20h]@56
   int uNum; // [sp+4h] [bp-Ch]@3
-  UIMessageType v45; // [sp+8h] [bp-8h]@3
+  UIMessageType pUIMessageType; // [sp+8h] [bp-8h]@3
   int v46; // [sp+Ch] [bp-4h]@3
   Player *pPlayer;
 
@@ -3428,8 +3428,8 @@
 	pPlayer = pParty->pPlayers;
     do
     {
-      pMessageQueue_50CBD0->PopMessage(&v45, &uNum, &v46);
-      switch (v45)
+      pMessageQueue_50CBD0->PopMessage(&pUIMessageType, &uNum, &v46);
+      switch (pUIMessageType)
       {
         case UIMSG_MainMenu_ShowPartyCreationWnd:
         {
@@ -3470,15 +3470,14 @@
       }
 
 
-      switch (v45)
+      switch (pUIMessageType)
       {
         case UIMSG_A5:   // WINDOW_5A
         {
             //main menu save/load wnd   clicking on savegame lines
           if (pGUIWindow_CurrentMenu->field_40 == 1)
             pKeyActionMap->_459ED1(0);
-          if ( pCurrentScreen != 11
-              || uLoadGameUI_SelectedSlot != uNum + dword_6A0C9C )
+          if ( pCurrentScreen != 11 || uLoadGameUI_SelectedSlot != uNum + dword_6A0C9C )
           {
             //load clicked line
               v26 = uNum + dword_6A0C9C;
@@ -3505,18 +3504,17 @@
 
         case UIMSG_A4:
         {
-          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241,
-                            pGUIWindow_CurrentMenu->uFrameY + 302,
+          GUIWindow::Create(pGUIWindow_CurrentMenu->uFrameX + 241, pGUIWindow_CurrentMenu->uFrameY + 302,
                             61, 28, WINDOW_5E, (int)ptr_69BD64, 0);
         }
         continue;
       }
 
-      if ( (signed int)v45 > 75 )
-      {
-        if ( v45 > UIMSG_A3 )
-        {
-          if ( v45 == UIMSG_A6 )
+      if ( (signed int)pUIMessageType > 75 )
+      {
+        if ( pUIMessageType > UIMSG_A3 )
+        {
+          if ( pUIMessageType == UIMSG_A6 )
           {
             v43 = 0;
             v39 = (int)ptr_69BD60;
@@ -3528,7 +3526,7 @@
             GUIWindow::Create(v18, v8, v33, v35, v37, v39, v43);
             continue;
           }
-          if ( v45 == UIMSG_AB ) // sellect face -1
+          if ( pUIMessageType == UIMSG_SelectFacePlayerBack )
           {
             pPlayer = &pParty->pPlayers[uNum];
             v12 = (char)((int)pPlayer->uFace - 1) < 0;
@@ -3540,26 +3538,19 @@
             pPlayer->SetSexByVoice();
             pPlayer->RandomizeName();
             v25 = uNum;
-            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem
-                                                       - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
-                                                      % 7
-                                                      + pGUIWindow_CurrentMenu->pStartingPosActiveItem
-                                                      + 7 * uNum;
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                                                      % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
             uPlayerCreationUI_SelectedCharacter = v25;
-            GUIWindow::Create(
-              pCreationUI_BtnPressLeft[v25]->uX,
-              pCreationUI_BtnPressLeft[v25]->uY,
-              0,
-              0,
-              (enum WindowType)92,
-              (int)pCreationUI_BtnPressLeft[v25],
-              1);
+            GUIWindow::Create(pCreationUI_BtnPressLeft[v25]->uX, pCreationUI_BtnPressLeft[v25]->uY, 0, 0,
+              (enum WindowType)92, (int)pCreationUI_BtnPressLeft[v25], 1);
             //v0 = pAudioPlayer;
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0.0, 0);
             v22 = pPlayer;
-            goto LABEL_117;
-          }
-          if ( v45 == UIMSG_AC ) //sellect face +1
+            v22->PlaySound(102, 0);
+            v1 = (char *)pParty->pPlayers;
+            continue;
+          }
+          if ( pUIMessageType == UIMSG_SelectFacePlayerForward )
           {
             pPlayer = &pParty->pPlayers[uNum];
 			v20 = (char)((int)pPlayer->uFace + 1) % 20;
@@ -3569,60 +3560,35 @@
             pPlayer->SetSexByVoice();
             pPlayer->RandomizeName();
             v21 = uNum;
-            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem
-                                                       - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
-                                                      % 7
-                                                      + pGUIWindow_CurrentMenu->pStartingPosActiveItem
-                                                      + 7 * uNum;
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                                                      % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
             uPlayerCreationUI_SelectedCharacter = v21;
-            GUIWindow::Create(
-              pCreationUI_BtnPressRight[v21]->uX,
-              pCreationUI_BtnPressRight[v21]->uY,
-              0,
-              0,
-              (enum WindowType)92,
-              (int)pCreationUI_BtnPressRight[v21],
-              1);
+            GUIWindow::Create(pCreationUI_BtnPressRight[v21]->uX, pCreationUI_BtnPressRight[v21]->uY, 0, 0, (enum WindowType)92,
+			  (int)pCreationUI_BtnPressRight[v21], 1);
             //v0 = pAudioPlayer;
             pAudioPlayer->PlaySound((SoundID)66, 0, 0, -1, 0, 0, 0, 0);
             v22 = pPlayer;
-LABEL_117:
             v22->PlaySound(102, 0);
             v1 = (char *)pParty->pPlayers;
             continue;
           }
-          if ( v45 == UIMSG_AD )
-          {
-            GUIWindow::Create(
-              pMainMenu_BtnNew->uX,
-              pMainMenu_BtnNew->uY,
-              0,
-              0,
-              (enum WindowType)90,
-              (int)pMainMenu_BtnNew,
-              0);
+          if ( pUIMessageType == UIMSG_AD )
+          {
+            GUIWindow::Create(pMainMenu_BtnNew->uX, pMainMenu_BtnNew->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnNew, 0);
           SetCurrentMenuID(MENU_LOAD);
           continue;
           }
-          if ( v45 != 174 )
+          if ( pUIMessageType != UIMSG_AE )
             continue;
-          GUIWindow::Create(
-            pMainMenu_BtnExit->uX,
-            pMainMenu_BtnExit->uY,
-            0,
-            0,
-            (enum WindowType)90,
-            (int)pMainMenu_BtnExit,
-            0);
+          GUIWindow::Create(pMainMenu_BtnExit->uX, pMainMenu_BtnExit->uY, 0, 0, (enum WindowType)90, (int)pMainMenu_BtnExit, 0);
 LABEL_114:
           v40 = 10;
 LABEL_89:
           v2 = v40;
-LABEL_90:
           SetCurrentMenuID((MENU_STATE)v2);
           continue;
         }
-        if ( v45 == UIMSG_A3 )
+        if ( pUIMessageType == UIMSG_A3 )
         {
           ++dword_6A0C9C;
           if ( dword_6A0C9C >= uNum )
@@ -3635,7 +3601,7 @@
           v8 = pGUIWindow_CurrentMenu->uFrameY + 323;
           goto LABEL_105;
         }
-        if ( v45 == 107 )
+        if ( pUIMessageType == UIMSG_6B )
         {
           if ( pCurrentScreen )
           {
@@ -3650,7 +3616,7 @@
           pMessageQueue_50CBD0->pMessages[pMessageQueue_50CBD0->uNumMessages].eType = (UIMessageType)113;
           goto LABEL_93;
         }
-        if ( v45 == UIMSG_CloseBook )
+        if ( pUIMessageType == UIMSG_CloseBook )
         {
           if ( ptr_507BDC )
           {
@@ -3692,8 +3658,7 @@
           }
           v16 = GetCurrentMenuID() == 8;
           v17 = pCurrentScreen;
-          if ( v16
-            && !pCurrentScreen )
+          if ( v16 && !pCurrentScreen )
             goto LABEL_83;
           if ( pCurrentScreen == 12 )
           {
@@ -3725,15 +3690,11 @@
         }
         else
         {
-          if ( v45 == 118 )
-          {
-            v14 = uNum;
-            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem
-                                                       - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
-                                                      % 7
-                                                      + pGUIWindow_CurrentMenu->pStartingPosActiveItem
-                                                      + 7 * uNum;
-            uPlayerCreationUI_SelectedCharacter = v14;
+          if ( pUIMessageType == UIMSG_PlayerCreationSelectQuality )
+          {
+            pGUIWindow_CurrentMenu->pCurrentPosActiveItem = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem)
+                                                      % 7 + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
+            uPlayerCreationUI_SelectedCharacter = uNum;
 LABEL_36:
             v42 = 0;
             v38 = 0;
@@ -3747,7 +3708,7 @@
             pAudioPlayer->PlaySound(pSoundID, v30, v31, v32, v34, v36, v38, v42);
             continue;
           }
-          if ( v45 == 144 )
+          if ( pUIMessageType == UIMSG_PlayerCreationVoiceBack )
           {
             v9 = &pPlayer[uNum];
             v46 = v9->GetSexByVoice();
@@ -3762,7 +3723,7 @@
             v11 = pCreationUI_BtnPressLeft2[uNum];
             goto LABEL_60;
           }
-          if ( v45 == 145 )
+          if ( pUIMessageType == UIMSG_PlayerCreationVoiceForward )
           {
             v9 = &pPlayer[uNum];
             v46 = v9->GetSexByVoice();
@@ -3779,7 +3740,7 @@
             v9->PlaySound(102, 0);
             continue;
           }
-          if ( v45 == UIMSG_A2 )
+          if ( pUIMessageType == UIMSG_A2 )
           {
             --dword_6A0C9C;
             if ( dword_6A0C9C < 0 )
@@ -3789,30 +3750,25 @@
             v39 = (int)ptr_69BD5C;
             v8 = pGUIWindow_CurrentMenu->uFrameY + 197;
 LABEL_105:
-            v37 = (WindowType)90;
-            v35 = 0;
-            v33 = 0;
-            v18 = v7->uFrameX + 215;
-            GUIWindow::Create(v18, v8, v33, v35, v37, v39, v43);
+            GUIWindow::Create(v7->uFrameX + 215, v8, 0, 0, (WindowType)90, v39, v43);
             continue;
           }
         }
       }
       else
       {
-        if ( v45 == 75 )
+        if ( pUIMessageType == UIMSG_PlayerCreationRemoveDownSkill )
         {
           uPlayerCreationUI_SelectedCharacter = uNum;
           v41 = 3;
           v1 = (char *)pParty->pPlayers;
           v5 = (pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem) % 7
-             + pGUIWindow_CurrentMenu->pStartingPosActiveItem
-             + 7 * uNum;
+             + pGUIWindow_CurrentMenu->pStartingPosActiveItem + 7 * uNum;
           goto LABEL_44;
         }
-        if ( (signed int)v45 > 60 )
-        {
-          if ( v45 == 62 ) //click +
+        if ( (signed int)pUIMessageType > UIMSG_3C )
+        {
+          if ( pUIMessageType == UIMSG_PlayerCreationClickPlus )
           {
             GUIWindow::Create(613, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnPlus, 1);
             (&pPlayer[uPlayerCreationUI_SelectedCharacter])->IncreaseAttribute(
@@ -3827,7 +3783,7 @@
             pSoundID = (SoundID)20;
             goto LABEL_40;
           }
-          if ( v45 == 63 ) // click -
+          if ( pUIMessageType == UIMSG_PlayerCreationClickMinus )
           {
             GUIWindow::Create(523, 393, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnMinus, 1);
             (&pPlayer[uPlayerCreationUI_SelectedCharacter])->DecreaseAttribute(
@@ -3842,7 +3798,7 @@
             pSoundID = (SoundID)23;
             goto LABEL_40;
           }
-          if ( v45 == 64 ) // sellect active skill
+          if ( pUIMessageType == UIMSG_PlayerCreationSelectActiveSkill )
           {
             auto _t = &pPlayer[uPlayerCreationUI_SelectedCharacter];
             v6 = _t->GetSkillIdxByOrder(uNum + 4);
@@ -3858,34 +3814,34 @@
             pSoundID = (SoundID)24;
             goto LABEL_40;
           }
-          if ( v45 == 65 )
+          if ( pUIMessageType == UIMSG_41 )
           {
             (&pPlayer[uPlayerCreationUI_SelectedCharacter])->Reset(0);
             goto LABEL_36;
           }
-          if ( v45 == 66 ) // click ok
-          {
-            GUIWindow::Create(0x244u, 0x1AFu, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0);
+          if ( pUIMessageType == UIMSG_PlayerCreationClickOK )
+          {
+            GUIWindow::Create(580, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnOK, 0);
             if ( PlayerCreation_ComputeAttributeBonus() || !sub_4908DE() )
               GameUI_StatusBar_TimedStringTimeLeft = GetTickCount() + 4000;
             else
               uGameState = 6;
             continue;
           }
-          if ( v45 == 67 ) // click reset
-          {
-            GUIWindow::Create(0x20Fu, 0x1AFu, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0);
+          if ( pUIMessageType == UIMSG_PlayerCreationClickReset ) 
+          {
+            GUIWindow::Create(527, 431, 0, 0, (enum WindowType)90, (int)pPlayerCreationUI_BtnReset, 0);
             pParty->Reset();
           }
           else
           {
-            if ( v45 == 74 )
+            if ( pUIMessageType == UIMSG_PlayerCreationRemoveUpSkill )
             {
               uPlayerCreationUI_SelectedCharacter = uNum;
               v4 = pGUIWindow_CurrentMenu->pCurrentPosActiveItem - pGUIWindow_CurrentMenu->pStartingPosActiveItem;
               v46 = pGUIWindow_CurrentMenu->pStartingPosActiveItem;
               v41 = 2;
-              v5 = (v4 % 7) + v46 + 7 * uNum;
+              v5 = v4 % 7 + v46 + 7 * uNum;
 LABEL_44:
               pGUIWindow_CurrentMenu->pCurrentPosActiveItem = v5;
               pParty->pPlayers[0].pActiveSkills[(&pPlayer[uPlayerCreationUI_SelectedCharacter])->GetSkillIdxByOrder(v41)
@@ -3896,7 +3852,7 @@
         }
         else
         {
-          switch ( v45 )
+          switch ( pUIMessageType )
           {
             case 60:
               pAudioPlayer->PlaySound((SoundID)24, 0, 0, -1, 0, 0, 0, 0);
@@ -3912,7 +3868,7 @@
               pMouse->SetCursorBitmap("MICON2");
               break;
             default:
-              if ( v45 == 58 )
+              if ( pUIMessageType == 58 )
                 goto LABEL_114;
               break;
           }
@@ -12563,7 +12519,7 @@
 
   v1 = pPlayers[uActiveCharacter];
   v10 = _this;
-  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->field_1A4E) + 1];
+  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->pNumSpellBookPage) + 1];
   if ( pMouse->GetCursorPos(&a2)->y <= 250 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -12622,14 +12578,14 @@
   a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
   a1.uFrameWidth = 108;
   a1.uFrameZ = a1.uFrameX + 107;
-  a1.DrawText2(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->field_1A4E + 12], 3u);
+  a1.DrawText2(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->pNumSpellBookPage + 12], 3u);
   sprintfex(
     pTmpBuf,
     "%s\n%d",
     pGlobalTXT_LocalizationStrings[522],
     *(&pSpellDatas[0].field_14
-    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->field_1A4E + 12]) >> 6)
-    + 10 * (int)((char *)v10 + 11 * v1->field_1A4E)));
+    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->pNumSpellBookPage + 12]) >> 6)
+    + 10 * (int)((char *)v10 + 11 * v1->pNumSpellBookPage)));
   a1.DrawText2(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u);
   dword_507B00_spell_info_to_draw_in_popup = 0;
 }
@@ -13141,7 +13097,7 @@
 
   sub_412AF9();
   v0 = pPlayers[uActiveCharacter];
-  v1 = 11 * v0->field_1A4E;
+  v1 = 11 * v0->pNumSpellBookPage;
   v2 = pIcons_LOD->FindTextureByName("Pending");
   v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
   pRenderer->ClearZBuffer(0, 479);
@@ -13167,14 +13123,14 @@
           }
           if ( v6->pLevelOfDetail0 )
           {
-            v7 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v4));
+            v7 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage + v4]));
             v19 = pViewport->uViewportY + dword_4E20D0[v7 + 1];
             v17 = pViewport->uViewportX + dword_4E20D0[v7];
             if ( BYTE1(v6->pBits) & 2 )
               pRenderer->DrawTextureTransparent(v17, v19, v6);
             else
               pRenderer->DrawTextureIndexed(v17, v19, v6);
-            v8 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v4));
+            v8 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v4));
             pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], (Texture *)v23[0], v4);
           }
         }
@@ -13191,7 +13147,7 @@
     if ( v11->pLevelOfDetail0 )
     {
       v21 = dword_5063D8[v10];
-      v12 = 2 * (12 * v0->field_1A4E + (unsigned __int8)*(&byte_4E2430[12 * v0->field_1A4E] + v10));
+      v12 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v10));
       v20 = pViewport->uViewportY + dword_4E20D0[v12 + 1];
       v18 = pViewport->uViewportX + dword_4E20D0[v12];
       if ( BYTE1(v11->pBits) & 2 )
@@ -13209,7 +13165,7 @@
   {
     if ( *(short *)a2.x )
     {
-      if ( v0->field_1A4E == v13 )
+      if ( v0->pNumSpellBookPage == v13 )
       {
         v16 = *(Texture **)&pTextures_tabs[0][0].pName[8 * v13 + 4];
         switch ( v13 )