diff mm7_5.cpp @ 216:1609e46161fd

Слияние
author Ritor1
date Sun, 17 Feb 2013 01:24:46 +0600
parents e6e348d66a75
children 66db86fa4ed2
line wrap: on
line diff
--- a/mm7_5.cpp	Sun Feb 17 01:24:34 2013 +0600
+++ b/mm7_5.cpp	Sun Feb 17 01:24:46 2013 +0600
@@ -2962,7 +2962,7 @@
         case UIMSG_4E:
           if ( dword_50654C && byte_506550 )
           {
-            v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage].pName;
+            v173 = pSpellStats->pInfos[dword_50654C + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage].pName;
             v157 = pGlobalTXT_LocalizationStrings[483];
 _sprintex_2args_draw_status_and_continue:
             sprintf(pTmpBuf, v157, v173);
@@ -3019,7 +3019,7 @@
             v127 = 203;
             goto _play_sound_and_continue;
           }
-          v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->pNumSpellBookPage;
+          v99 = dword_50654C + 11 * pPlayers[uActiveCharacter]->lastOpenedSpellbookPage;
           pPlayers[uActiveCharacter]->uQuickSpell = v99;
           stru_A750F8[uActiveCharacter + 3]._494836(v99, uActiveCharacter);
           if ( uActiveCharacter )
@@ -3038,7 +3038,7 @@
           {
             if ( *(short *)thisl )
             {
-              if ( pPlayer3->pNumSpellBookPage == v101 )
+              if ( pPlayer3->lastOpenedSpellbookPage == v101 )
                 uAction = (int)pNPCData4;
               v102 = (int)pNPCData4;
               pNPCData4 = (NPCData *)((char *)pNPCData4 + 1);
@@ -3073,7 +3073,7 @@
               uAction = 0;
           }
           sub_41140B();
-          pPlayers[uActiveCharacter]->pNumSpellBookPage = LOBYTE(v217[uAction]);
+          pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = LOBYTE(v217[uAction]);
           pGUIWindow_CurrentMenu->OpenSpellBook();
           v165 = 0;
           v151 = 0;
@@ -3085,10 +3085,10 @@
           v127 = rand() % 2 + 204;
           goto _play_sound_and_continue;
         case UIMSG_57:
-          if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->pNumSpellBookPage )
+          if ( pTurnEngine->field_4 == 3 || !uActiveCharacter || uMessageParam == pPlayers[uActiveCharacter]->lastOpenedSpellbookPage )
             continue;
           sub_41140B();
-          pPlayers[uActiveCharacter]->pNumSpellBookPage = uMessageParam;
+          pPlayers[uActiveCharacter]->lastOpenedSpellbookPage = uMessageParam;
           pGUIWindow_CurrentMenu->OpenSpellBook();
           v165 = 0;
           v151 = 0;
@@ -12738,7 +12738,7 @@
 
   v1 = pPlayers[uActiveCharacter];
   v10 = _this;
-  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->pNumSpellBookPage) + 1];
+  v2 = &pSpellStats->pInfos[(signed int)((char *)_this + 11 * v1->lastOpenedSpellbookPage) + 1];
   if ( pMouse->GetCursorPos(&a2)->y <= 250 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
   else
@@ -12797,14 +12797,14 @@
   a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2, 0, 0, 0);
   a1.uFrameWidth = 108;
   a1.uFrameZ = a1.uFrameX + 107;
-  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->pNumSpellBookPage + 12], 3u);
+  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v1->lastOpenedSpellbookPage + 12], 3u);
   sprintf(
     pTmpBuf,
     "%s\n%d",
     pGlobalTXT_LocalizationStrings[522],
     *(&pSpellDatas[0].field_12 //temp_fix field_14
-    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->pNumSpellBookPage + 12]) >> 6)
-    + 10 * (int)((char *)v10 + 11 * v1->pNumSpellBookPage)));
+    + ((unsigned int)LOBYTE(v1->pActiveSkills[v1->lastOpenedSpellbookPage + 12]) >> 6)
+    + 10 * (int)((char *)v10 + 11 * v1->lastOpenedSpellbookPage)));
   a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf, 3u);
   dword_507B00_spell_info_to_draw_in_popup = 0;
 }
@@ -13130,56 +13130,44 @@
 // 4E1D3A: using guessed type __int16 word_4E1D3A[];
 
 //----- (00411300) --------------------------------------------------------
-Texture *__fastcall LoadSpellbook(unsigned int uID)
-{
-  unsigned int v1; // esi@1
+void LoadSpellbook(unsigned int school)
+{
+  //unsigned int v1; // esi@1
   Player *pPlayer; // ecx@1
   char v3; // al@1
-  int v4; // edi@5
-  Texture *result; // eax@6
-  char *v6; // edi@7
-  unsigned int v7; // eax@7
-  unsigned __int8 v8; // sf@8
-  unsigned __int8 v9; // of@8
+  //int v4; // edi@5
+  //Texture *result; // eax@6
+  //unsigned char *v6; // edi@7
+  //unsigned int v7; // eax@7
+  //unsigned __int8 v8; // sf@8
+  //unsigned __int8 v9; // of@8
   char pContainer[20]; // [sp+Ch] [bp-1Ch]@7
   Texture *v11; // [sp+20h] [bp-8h]@5
-  int v12; // [sp+24h] [bp-4h]@5
+  //int v12; // [sp+24h] [bp-4h]@5
 
   byte_506550 = 0;
-  v1 = uID;
+  //v1 = uID;
   pPlayer = pPlayers[uActiveCharacter];
   v3 = pPlayer->uQuickSpell;
-  if ( v3 && (unsigned __int8)v3 / 11 == v1 )
-    dword_50654C = (unsigned __int8)v3 - 11 * v1;
+  if ( v3 && (unsigned __int8)v3 / 11 == school )
+    dword_50654C = (unsigned __int8)v3 - 11 * school;
   else
     dword_50654C = 0;
-  v4 = 1;
-  v12 = 1;
-  v11 = (Texture *)&pPlayer->field_152[11 * v1 + 63];
-  do
-  {
-    result = v11;
-    if ( v11->pName[v4] )
-    {
-      v6 = &byte_4E2430[12 * v1] + v4;
-      sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
-      v7 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-      dword_506408[v12] = &pIcons_LOD->pTextures[v7];
-      sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[v1], (unsigned __int8)*v6);
-      result = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE)];
-      dword_5063D8[v12] = result;
-    }
-    v4 = v12 + 1;
-    v9 = v12++ > 12;//v9 = __OFSUB__(v12 + 1, 12);
-    v8 = v12++ - 11 < 0;
-  }
-  while ( v8 ^ v9 );
-  return result;
-}
-// 4E1D18: using guessed type char *spellbook_texture_filename_suffices[8];
-// 506408: using guessed type int dword_506408[];
-// 50654C: using guessed type int dword_50654C;
-// 506550: using guessed type char byte_506550;
+
+  v11 = (Texture *)&pPlayer->field_152[11 * school + 63];
+
+  for (uint i = 1; i < 12; ++i)
+  {
+    if ( v11->pName[i] )
+    {
+      sprintf(pContainer, "SB%sS%02d", spellbook_texture_filename_suffices[school], pSpellbookSpellIndices[school][i]);
+      dword_506408[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
+
+      sprintf(pContainer, "SB%sC%02d", spellbook_texture_filename_suffices[school], pSpellbookSpellIndices[school][i]);
+      dword_5063D8[i] = pIcons_LOD->LoadTexturePtr(pContainer, TEXTURE_16BIT_PALETTE);
+    }
+  }
+}
 
 //----- (0041140B) --------------------------------------------------------
 GUIWindow *__cdecl sub_41140B()
@@ -13279,7 +13267,7 @@
 
   v0 = 0;
   if ( uActiveCharacter )
-	  v0 = pParty->pPlayers[uActiveCharacter-1].pNumSpellBookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2);
+	  v0 = pParty->pPlayers[uActiveCharacter-1].lastOpenedSpellbookPage;//*((char *)&pParty->pPartyBuffs[5].uExpireTime + 6972 * uActiveCharacter + 2);
   pRenderer->DrawTextureIndexed(8u, 8u, pTextures_5064A0[v0]);
   pRenderer->DrawTextureIndexed(0x1DCu, 0x1C2u, pTexture_50643C);
   pRenderer->DrawTextureIndexed(0x231u, 0x1C2u, pTexture_506448);
@@ -13318,7 +13306,7 @@
 
   sub_412AF9();
   v0 = pPlayers[uActiveCharacter];
-  v1 = 11 * v0->pNumSpellBookPage;
+  v1 = 11 * v0->lastOpenedSpellbookPage;
   v2 = pIcons_LOD->FindTextureByName("Pending");
   v3 = (Texture *)(v2 != -1 ? (int)&pIcons_LOD->pTextures[v2] : 0);
   pRenderer->ClearZBuffer(0, 479);
@@ -13344,14 +13332,14 @@
           }
           if ( v6->pLevelOfDetail0 )
           {
-            v7 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage + v4]));
+            v7 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][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->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v4));
+            v8 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v4]);
             pRenderer->_4A612A(dword_4E20D0[v8], dword_4E20D0[v8 + 1], v23, v4);
           }
         }
@@ -13368,7 +13356,7 @@
     if ( v11->pLevelOfDetail0 )
     {
       v21 = dword_5063D8[v10];
-      v12 = 2 * (12 * v0->pNumSpellBookPage + (unsigned __int8)*(&byte_4E2430[12 * v0->pNumSpellBookPage] + v10));
+      v12 = 2 * (12 * v0->lastOpenedSpellbookPage + pSpellbookSpellIndices[v0->lastOpenedSpellbookPage][v10]);
       v20 = pViewport->uViewportY + dword_4E20D0[v12 + 1];
       v18 = pViewport->uViewportX + dword_4E20D0[v12];
       if ( BYTE1(v11->pBits) & 2 )
@@ -13386,7 +13374,7 @@
   {
     if ( *(short *)a2.x )
     {
-      if ( v0->pNumSpellBookPage == v13 )
+      if ( v0->lastOpenedSpellbookPage == v13 )
       {
         pPageTexture = pTextures_tabs[v13][1];
         switch ( v13 )