changeset 2231:8673f3aedfb9

sub_4B1523 to sub_4B1523_showSpellbookInfo, changed input type, some vars renamed
author Grumpy7
date Sat, 22 Feb 2014 19:44:49 +0100
parents afca92154795
children 829760bc6ca6
files Build/Visual Studio 2012/World of Might and Magic.sln Build/Visual Studio 2012/World of Might and Magic.vcxproj UI/UIShops.cpp mm7_4.cpp mm7_unsorted_subs.h
diffstat 5 files changed, 22 insertions(+), 19 deletions(-) [+]
line wrap: on
line diff
--- a/Build/Visual Studio 2012/World of Might and Magic.sln	Sat Feb 22 18:25:53 2014 +0100
+++ b/Build/Visual Studio 2012/World of Might and Magic.sln	Sat Feb 22 19:44:49 2014 +0100
@@ -1,4 +1,3 @@
-
 Microsoft Visual Studio Solution File, Format Version 12.00
 # Visual Studio 2012
 Project("{8BC9CEB8-8B4A-11D0-8D11-00A0C91BC942}") = "World of Might and Magic", "World of Might and Magic.vcxproj", "{5DA49362-EF43-4753-85DC-88CC41F26764}"
--- a/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Sat Feb 22 18:25:53 2014 +0100
+++ b/Build/Visual Studio 2012/World of Might and Magic.vcxproj	Sat Feb 22 19:44:49 2014 +0100
@@ -42,11 +42,12 @@
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">
     <LinkIncremental>true</LinkIncremental>
     <IntDir>$(Configuration)\</IntDir>
-    <OutDir>$(WoMM_MM7_INSTALL_DIR)\</OutDir>
+    <OutDir>D:\Program Files (x86)\GOG.com\Might and Magic VII\</OutDir>
     <GenerateManifest>false</GenerateManifest>
     <CustomBuildBeforeTargets>
     </CustomBuildBeforeTargets>
     <IncludePath>$(SolutionDirectory)../../;$(IncludePath)</IncludePath>
+    <PostBuildEventUseInBuild>false</PostBuildEventUseInBuild>
   </PropertyGroup>
   <PropertyGroup Condition="'$(Configuration)|$(Platform)'=='Release|Win32'">
     <LinkIncremental>false</LinkIncremental>
--- a/UI/UIShops.cpp	Sat Feb 22 18:25:53 2014 +0100
+++ b/UI/UIShops.cpp	Sat Feb 22 19:44:49 2014 +0100
@@ -1789,7 +1789,10 @@
     pMouse->GetCursorPos(&cursor);
     v3 = pRenderer->pActiveZBuffer[cursor.x + pSRZBufferLineOffsets[cursor.y]] & 0xFFFF;
     if ( v3 )
-      sub_4B1523((int *)&pParty->pPlayers[1].uExpressionTimeLength + 9 * (v3 + 12 * (unsigned int)window_SpeakInHouse->ptr_1C));
+    {
+      unsigned int guildId = (unsigned int)window_SpeakInHouse->ptr_1C - 139;
+      sub_4B1523_showSpellbookInfo(pParty->SpellBooksInGuilds[guildId][v3].uItemID);
+    }
   }
 }
 //----- (004B1D27) --------------------------------------------------------
--- a/mm7_4.cpp	Sat Feb 22 18:25:53 2014 +0100
+++ b/mm7_4.cpp	Sat Feb 22 19:44:49 2014 +0100
@@ -1731,10 +1731,10 @@
 }
 
 //----- (004B1523) --------------------------------------------------------
-void  sub_4B1523(int *_this)
+void sub_4B1523_showSpellbookInfo(int spellItemId)
 {
-  int v1; // esi@1
-  int v2; // edx@1
+  int spellId; // esi@1
+  int spellLevel; // edx@1
   unsigned int v3; // eax@2
   int v4; // eax@4
   LONG v5; // ecx@4
@@ -1742,14 +1742,14 @@
   char *v7; // ST44_4@12
   unsigned __int16 v8; // ax@12
   GUIWindow a1; // [sp+Ch] [bp-68h]@4
-  unsigned int v11; // [sp+60h] [bp-14h]@1
+  unsigned int spellSchool; // [sp+60h] [bp-14h]@1
   POINT a2; // [sp+64h] [bp-10h]@1
   int v13; // [sp+6Ch] [bp-8h]@4
   int v14; // [sp+70h] [bp-4h]@4
 
-  v1 = *_this - 399;
-  v2 = (*_this - 400) % 11 + 1;
-  v11 = 4 * (*_this - 400) / 11;
+  spellId = spellItemId - 399;
+  spellLevel = (spellItemId - 400) % 11 + 1;
+  spellSchool = 4 * (spellItemId - 400) / 11;
  // sprintf(pTmpBuf.data(), "%s%03d", spellbook_texture_filename_suffices[v11 / 4], v2); not used
   if ( pMouse->GetCursorPos(&a2)->y <= 320 )
     v3 = pMouse->GetCursorPos(&a2)->y + 30;
@@ -1774,11 +1774,11 @@
   if ( v4 > v5 )
     v5 = v4;
   sprintf(pTmpBuf2.data(), "%s\n\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s\t000\n%s\t%03d:\t%03d%s",
-    pSpellStats->pInfos[v1].pDescription, pGlobalTXT_LocalizationStrings[431],        // "Normal"
-    v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433],        // "Expert"
-    v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432],        // "Master"
-    v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96],         // "Grand"
-    v5 + 3, v5 + 10, pSpellStats->pInfos[v1].pGrandmasterSkillDesc);
+    pSpellStats->pInfos[spellId].pDescription, pGlobalTXT_LocalizationStrings[431],        // "Normal"
+    v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pBasicSkillDesc, pGlobalTXT_LocalizationStrings[433],        // "Expert"
+    v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pExpertSkillDesc, pGlobalTXT_LocalizationStrings[432],        // "Master"
+    v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pMasterSkillDesc, pGlobalTXT_LocalizationStrings[96],         // "Grand"
+    v5 + 3, v5 + 10, pSpellStats->pInfos[spellId].pGrandmasterSkillDesc);
   v6 = pFontSmallnum->CalcTextHeight(pTmpBuf2.data(), &a1, 0, 0);
   a1.uFrameHeight += v6;
   if ( (signed int)a1.uFrameHeight < 150 )
@@ -1787,7 +1787,7 @@
   a1.DrawMessageBox(0);
   a1.uFrameWidth -= 12;
   a1.uFrameHeight -= 12;
-  v7 = pSpellStats->pInfos[v1].pName;
+  v7 = pSpellStats->pInfos[spellId].pName;
   a1.uFrameZ = a1.uFrameX + a1.uFrameWidth - 1;
   a1.uFrameW = a1.uFrameHeight + a1.uFrameY - 1;
   v8 = Color16(0xFFu, 0xFFu, 0x9Bu);
@@ -1795,8 +1795,8 @@
   a1.DrawText(pFontSmallnum, 120, 44, 0, pTmpBuf2.data(), 0, 0, 0);
   a1.uFrameZ = a1.uFrameX + 107;
   a1.uFrameWidth = 108;
-  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[v11 / 4 + 12], 3u);
-  sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * v1));
+  a1.DrawTitleText(pFontComic, 0xCu, 0x4Bu, 0, pSkillNames[spellSchool / 4 + 12], 3u);
+  sprintfex(pTmpBuf.data(), "%s\n%d", pGlobalTXT_LocalizationStrings[522], *(&pSpellDatas[0].uNormalLevelMana + 10 * spellId));
   a1.DrawTitleText(pFontComic, 0xCu, a1.uFrameHeight - LOBYTE(pFontComic->uFontHeight) - 16, 0, pTmpBuf.data(), 3);
 }
 
--- a/mm7_unsorted_subs.h	Sat Feb 22 18:25:53 2014 +0100
+++ b/mm7_unsorted_subs.h	Sat Feb 22 19:44:49 2014 +0100
@@ -220,7 +220,7 @@
 void PlayLevelMusic();
 unsigned int __fastcall sub_4B0E07(unsigned int uFaceID); // idb
 void sub_4B1447_party_fine(int a1, int a2, int a3);
-void sub_4B1523(int *_this);
+void sub_4B1523_showSpellbookInfo(int spellId);
 void ShowPopupShopItem();
 void RestAndHeal(__int64 uNumMinutes); // idb
 void GetHouseGoodbyeSpeech();