changeset 84:b39bdc150e90

Some inventory stuff
author Nomad
date Mon, 29 Oct 2012 01:36:20 +0200
parents 2d5d13376e91
children c0cf9393af64 ecbd9b6ccf52 9a2fa2f2cce0
files GUIWindow.cpp Texture.cpp Texture.h mm7_5.cpp mm7_data.cpp mm7_data.h
diffstat 6 files changed, 105 insertions(+), 68 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Oct 29 00:49:33 2012 +0200
+++ b/GUIWindow.cpp	Mon Oct 29 01:36:20 2012 +0200
@@ -1096,8 +1096,8 @@
 //----- (0041192C) --------------------------------------------------------
 void __cdecl InitializeBookTextures()
 {
-  signed int v0; // ebp@3
-  Texture **v1; // ebx@3
+  //signed int v0; // ebp@3
+  //Texture **v1; // ebx@3
 
   pAudioPlayer->StopChannels(-1, -1);
   ++pIcons_LOD->uTexturePacksCount;
@@ -1109,21 +1109,24 @@
   pTexture_506448   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ib-m5-u", TEXTURE_16BIT_PALETTE)];
   ptr_506440        = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ib-m5-d", TEXTURE_16BIT_PALETTE)];
   pTexture_50643C   = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ib-m6-u",TEXTURE_16BIT_PALETTE)];
-  v0 = 1;
-  v1 = (Texture **)&pTextures_tabs[0][0].pName[4];
-  pTexture_506444 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture("ib-m6-d",TEXTURE_16BIT_PALETTE)];
-  do
+  //v0 = 1;
+
+  static const char *texNames[9] =
   {
-    *(&pTexture_pagemask + v0) = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(
-                                                         (const char *)pLloydsBeacons_SomeYs[v0 + 4],
-                                                         TEXTURE_16BIT_PALETTE)];
-    sprintf(pTmpBuf, "tab%da", v0);
-    *(v1 - 1) = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)];
-    sprintf(pTmpBuf, "tab%db", v0++);
-    *v1 = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)];
-    v1 += 2;
+    "SBFB00", "SBAB00", "SBWB00", "SBEB00",
+    "SBSB00", "SBMB00", "SBBB00", "SBLB00",
+  };
+
+  pTexture_506444 = pIcons_LOD->LoadTexturePtr("ib-m6-d",TEXTURE_16BIT_PALETTE);
+  for (uint i = 0; i < 8; ++i)
+  {
+    pTextures_5064A0[i] = pIcons_LOD->LoadTexturePtr(texNames[i], TEXTURE_16BIT_PALETTE);
+
+    sprintf(pTmpBuf, "tab%da", i);
+    pTextures_tabs[i][0] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
+    sprintf(pTmpBuf, "tab%db", i);
+    pTextures_tabs[i][1] = pIcons_LOD->LoadTexturePtr(pTmpBuf, TEXTURE_16BIT_PALETTE);
   }
-  while ( (signed int)v1 <= (signed int)&unk_506494 );
 }
 
 //----- (00411AAA) --------------------------------------------------------
@@ -1184,6 +1187,8 @@
   int a2; // [sp+10h] [bp-8h]@1
   int v7; // [sp+14h] [bp-4h]@1
 
+  __debugbreak();
+
   v1 = pPlayers[uActiveCharacter];
   v2 = this;
   LoadSpellbook(v1->pNumSpellBookPage);
--- a/Texture.cpp	Mon Oct 29 00:49:33 2012 +0200
+++ b/Texture.cpp	Mon Oct 29 01:36:20 2012 +0200
@@ -55,7 +55,7 @@
 Texture *ptr_506440;
 Texture *pTexture_506444;
 Texture *pTexture_506448; // idb
-Texture pTextures_tabs[8][2];
+Texture *pTextures_tabs[8][2];
 Texture *pTexture_mapbordr; // idb
 Texture *pTexture_pagemask; // idb
 Texture *pTextures_5064A0[14];
--- a/Texture.h	Mon Oct 29 00:49:33 2012 +0200
+++ b/Texture.h	Mon Oct 29 01:36:20 2012 +0200
@@ -157,7 +157,7 @@
 extern Texture *ptr_506440;
 extern Texture *pTexture_506444;
 extern Texture *pTexture_506448; // idb
-extern Texture pTextures_tabs[8][2];
+extern Texture *pTextures_tabs[8][2];
 extern Texture *pTexture_mapbordr; // idb
 extern Texture *pTexture_pagemask; // idb
 extern Texture *pTextures_5064A0[14];
--- a/mm7_5.cpp	Mon Oct 29 00:49:33 2012 +0200
+++ b/mm7_5.cpp	Mon Oct 29 01:36:20 2012 +0200
@@ -6351,7 +6351,7 @@
     v15->field_C = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
     _43C91D_FormItemTextureFilename(pContainer, 544, v14, 0);
     v15->field_10 = pIcons_LOD->LoadTexture(pContainer, TEXTURE_16BIT_PALETTE);
-    if ( sub_43ED6F_get_some_race_sex_relation(1u) )
+    if ( _43ED6F_check_party_races(true) )
       papredoll_dbrds[11] = pIcons_LOD->LoadTexture("item092v3", TEXTURE_16BIT_PALETTE);
     v35 += 28;
     ++v14;
@@ -6508,9 +6508,11 @@
   int v8; // [sp-4h] [bp-10h]@61
   signed int v9; // [sp-4h] [bp-10h]@69
 
+  result = 0; //BUG   fn is void
   if ( a2 <= 500 )
   {
-    v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
+    //v5 = *((char *)&pBloodsplatContainer->std__vector_pBloodsplats[62].field_20 + a2 + 2) == 0;
+    v5 = byte_5111C0[(a2 - 100) + 32 + 2] == 0;
 LABEL_21:
     if ( v5 )
       return result;
@@ -8644,37 +8646,26 @@
 
 
 //----- (0043ED6F) --------------------------------------------------------
-bool __thiscall sub_43ED6F_get_some_race_sex_relation(unsigned int a1)
-{
-  unsigned int v1; // ebp@1
-  Player **v2; // ebx@1
-  Player *v3; // esi@2
-  enum CHARACTER_RACE v4; // edi@2
-  bool result; // eax@2
-  char v6; // zf@5
-
-  v1 = a1;
-  v2 = &pPlayers[1];
-  while ( 1 )
-  {
-    v3 = *v2;
-    v4 = v3->GetRace();
-    result = v3->GetSexByVoice();
-    if ( v4 && v4 != CHARACTER_RACE_ELF && v4 != CHARACTER_RACE_GOBLIN )
-      v6 = v1 == 1;
+bool _43ED6F_check_party_races(bool a1)
+{
+  bool v6; // zf@5
+
+  for (uint i = 0; i < 4; ++i)
+  {
+    auto player = pParty->pPlayers + i;
+    auto race = player->GetRace();
+
+    if (race != CHARACTER_RACE_HUMAN &&
+        race != CHARACTER_RACE_ELF &&
+        race != CHARACTER_RACE_GOBLIN)
+      v6 = a1 == 1;
     else
-      v6 = v1 == 0;
-    if ( v6 )
-      break;
-    ++v2;
-    if ( (signed int)v2 >= (signed int)&qword_A750D8 )
-    {
-      LOBYTE(result) = 0;
-      return result;
-    }
-  }
-  LOBYTE(result) = 1;
-  return result;
+      v6 = !a1;
+
+    if (v6)
+      return true;
+  }
+  return false;
 }
 // A750D8: using guessed type __int64 qword_A750D8;
 
@@ -13000,7 +12991,7 @@
 //----- (00411473) --------------------------------------------------------
 void __cdecl sub_411473()
 {
-  char *v0; // esi@1
+  Texture **v0; // esi@1
   Texture **v1; // edi@1
   Texture *v2; // ecx@2
   Texture *v3; // ecx@2
@@ -13008,7 +12999,7 @@
   pTexture_pagemask->Release();
   pTexture_506448->Release();
   pTexture_50643C->Release();
-  v0 = &pTextures_tabs[0][0].pName[4];
+  v0 = &pTextures_tabs[0][1];
   v1 = pTextures_5064A0;
   do
   {
@@ -13167,7 +13158,7 @@
     {
       if ( v0->pNumSpellBookPage == v13 )
       {
-        v16 = *(Texture **)&pTextures_tabs[0][0].pName[8 * v13 + 4];
+        v16 = pTextures_tabs[v13][1];
         switch ( v13 )
         {
           case 0:
@@ -13207,7 +13198,7 @@
       }
       else
       {
-        v16 = *(Texture **)&pTextures_tabs[0][0].pName[8 * v13];
+        v16 = pTextures_tabs[v13][0];
         switch ( v13 )
         {
           case 0:
--- a/mm7_data.cpp	Mon Oct 29 00:49:33 2012 +0200
+++ b/mm7_data.cpp	Mon Oct 29 01:36:20 2012 +0200
@@ -390,10 +390,10 @@
 int dword_4E20D0[777]; // idb
 char byte_4E2430[777]; // weak
 char byte_4E2431[777]; // weak
-unsigned int pLloydsBeaconsPreviewXs[5];
-int pLloydsBeaconsPreviewYs[5];
-unsigned int pLloydsBeacons_SomeXs[5];
-int pLloydsBeacons_SomeYs[777]; // idb
+unsigned int pLloydsBeaconsPreviewXs[5] = {61, 281,  61, 281, 171};
+unsigned int pLloydsBeaconsPreviewYs[5] = {84,  84, 228, 228, 155};
+unsigned int pLloydsBeacons_SomeXs[5] = {59, 279, 59, 279, 169};
+unsigned int pLloydsBeacons_SomeYs[5] = {82, 82, 226, 226, 153};
 char aSbwb00[7]; // weak
 char aW[2]; // idb
 char aA[2]; // idb
@@ -1687,12 +1687,55 @@
   "pc21-", "pc22-", "pc23", "pc24-", "pc25-"
 };
 
-const char *dlad_texnames_by_face[25];
-const char *dlau_texnames_by_face[25];
-const char *dbod_texnames_by_face[25];
-const char *drh_texnames_by_face[25];
-const char *dlh_texnames_by_face[25];
-const char *dlhu_texnames_by_face[25];
+const char *dlad_texnames_by_face[25] =
+{
+  "pc01lad", "pc02lad", "pc03lad", "pc04lad", "pc05lad", "pc06lad",
+  "pc07lad", "pc08lad", "pc09lad", "pc10lad", "pc11lad", "pc12lad",
+  "pc13lad", "pc14lad", "pc15lad", "pc16lad", "pc17lad", "pc18lad",
+  "pc19lad", "pc20lad", "pc21lad", "pc22lad", "pc23lad", "pc24lad",
+  "pc25lad"
+};
+const char *dlau_texnames_by_face[25] =
+{
+  "pc01lau", "pc02lau", "pc03lau", "pc04lau", "pc05lau", "pc06lau",
+  "pc07lau", "pc08lau", "pc09lau", "pc10lau", "pc11lau", "pc12lau",
+  "pc13lau", "pc14lau", "pc15lau", "pc16lau", "pc17lau", "pc18lau",
+  "pc19lau", "pc20lau", "pc21lau", "pc22lau", "pc23lau", "pc24lau",
+  "pc25lau"
+};
+const char *dbod_texnames_by_face[25] =
+{
+  "pc01bod", "pc02bod", "pc03bod", "pc04bod", "pc05bod", "pc06bod",
+  "pc07bod", "pc08bod", "pc09bod", "pc10bod", "pc11bod", "pc12bod",
+  "pc13bod", "pc14bod", "pc15bod", "pc16bod", "pc17bod", "pc18bod",
+  "pc19bod", "pc20bod", "pc21bod", "pc22bod", "pc23bod", "pc24bod",
+  "pc25bod"
+};
+const char *drh_texnames_by_face[25] =
+{
+
+  "pc01rh", "pc02rh", "pc03rh", "pc04rh", "pc05rh", "pc06rh",
+  "pc07rh", "pc08rh", "pc09rh", "pc10rh", "pc11rh", "pc12rh",
+  "pc13rh", "pc14rh", "pc15rh", "pc16rh", "pc17rh", "pc18rh",
+  "pc19rh", "pc20rh", "pc21rh", "pc22rh", "pc23rh", "pc24rh",
+  "pc25rh"
+};
+const char *dlh_texnames_by_face[25] =
+{
+  "pc01lh", "pc02lh", "pc03lh", "pc04lh", "pc05lh", "pc06lh",
+  "pc07lh", "pc08lh", "pc09lh", "pc10lh", "pc11lh", "pc12lh",
+  "pc13lh", "pc14lh", "pc15lh", "pc16lh", "pc17lh", "pc18lh",
+  "pc19lh", "pc20lh", "pc21lh", "pc22lh", "pc23lh", "pc24lh",
+  "pc25lh"
+};
+const char *dlhu_texnames_by_face[25] =
+{
+  "pc01lhu", "pc02lhu", "pc03lhu", "pc04lhu", "pc05lhu", "pc06lhu",
+  "pc07lhu", "pc08lhu", "pc09lhu", "pc10lhu", "pc11lhu", "pc12lhu",
+  "pc13lhu", "pc14lhu", "pc15lhu", "pc16lhu", "pc17lhu", "pc18lhu",
+  "pc19lhu", "pc20lhu", "pc21lhu", "pc22lhu", "pc23lhu", "pc24lhu",
+  "pc25lhu"
+};
 _UNKNOWN unk_4ED3D8; // weak
 unsigned char byte_4ED498 = 15; // weak
 __int16 pPlayerPortraitsXCoords_For_PlayerBuffAnimsDrawing[4] = {34, 149, 264, 379};
@@ -1997,7 +2040,6 @@
 int dword_506408[777]; // weak
 int dword_50640C[777]; // weak
 unsigned int uTextureID_506438;
-_UNKNOWN unk_506494; // weak
 int dword_50651C; // weak
 int dword_506520; // weak
 int dword_506524; // weak
--- a/mm7_data.h	Mon Oct 29 00:49:33 2012 +0200
+++ b/mm7_data.h	Mon Oct 29 01:36:20 2012 +0200
@@ -377,9 +377,9 @@
 extern char byte_4E2430[]; // weak
 extern char byte_4E2431[]; // weak
 extern unsigned int pLloydsBeaconsPreviewXs[5];
-extern int pLloydsBeaconsPreviewYs[5];
+extern unsigned int pLloydsBeaconsPreviewYs[5];
 extern unsigned int pLloydsBeacons_SomeXs[5];
-extern int pLloydsBeacons_SomeYs[]; // idb
+extern unsigned int pLloydsBeacons_SomeYs[5]; // idb
 extern char aSbwb00[7]; // weak
 extern char aW[2]; // idb
 extern char aA[2]; // idb
@@ -1947,7 +1947,6 @@
 extern int dword_506408[]; // weak
 extern int dword_50640C[]; // weak
 extern unsigned int uTextureID_506438;
-extern _UNKNOWN unk_506494; // weak
 extern int dword_50651C; // weak
 extern int dword_506520; // weak
 extern int dword_506524; // weak
@@ -2753,7 +2752,7 @@
 int __fastcall _43C91D_FormItemTextureFilename(char *a1, signed int a2, int a3, int a4);
 void __fastcall CharacterUI_DrawPaperdoll(unsigned int uPlayerID); // idb
 void __fastcall CharacterUI_DrawPaperdollWithRingOverlay(unsigned int uPlayerID); // idb
-bool __thiscall sub_43ED6F_get_some_race_sex_relation(unsigned int a1);
+bool _43ED6F_check_party_races(bool b);
 bool __thiscall sub_43EDB9_get_some_race_sex_relation_2(unsigned int _this);
 bool __fastcall sub_43EE15_player_has_item(unsigned int uItemID, struct Player *pPlayer, char a3);
 bool __fastcall sub_43EE77_ProbablyIfUnderwaterSuitIsEquipped(signed int a1);