changeset 566:fcbb3c281217

QuickRef reputation string fix
author Nomad
date Tue, 05 Mar 2013 03:42:21 +0200
parents e429ad557cda
children f51373466911
files GUIWindow.cpp GUIWindow.h Party.cpp mm7_1.cpp mm7_4.cpp mm7_data.h
diffstat 6 files changed, 36 insertions(+), 63 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Tue Mar 05 01:45:43 2013 +0200
+++ b/GUIWindow.cpp	Tue Mar 05 03:42:21 2013 +0200
@@ -1578,7 +1578,7 @@
     }
     while ( (signed int)Str1a < (signed int)pNumLen );
   }
-  pTmpBuf[Str1a + 1999] = 0;
+  pTmpBuf2[Str1a - 1] = 0;
   pNumLen = strlen(pTmpBuf2);
   v28 = pFont->GetLineWidth(pTmpBuf2);
   if ( a8 )
--- a/GUIWindow.h	Tue Mar 05 01:45:43 2013 +0200
+++ b/GUIWindow.h	Tue Mar 05 03:42:21 2013 +0200
@@ -408,4 +408,11 @@
 
 extern int pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[]; // idb
 extern struct GUIWindow *pWindow_MainMenu;
-extern struct GUIWindow pWindowList[20];
\ No newline at end of file
+extern struct GUIWindow pWindowList[20];
+
+
+
+
+
+
+void QuickRefDraw();
\ No newline at end of file
--- a/Party.cpp	Tue Mar 05 01:45:43 2013 +0200
+++ b/Party.cpp	Tue Mar 05 03:42:21 2013 +0200
@@ -256,21 +256,10 @@
 //----- (0049135E) --------------------------------------------------------
 unsigned int Party::GetPartyFame()
 {
-  signed int v1; // eax@1
-  Player *v2; // ecx@1
-  signed int v3; // edx@1
-
-  v1 = 0;
-  v2 = this->pPlayers;//[0].uExperience;
-  v3 = 4;                                       // (E exp) / 1000
-  do
-  {
-	v1 += (int)v2->uExperience; // needs review
-    ++v2;
-    --v3;
-  }
-  while ( v3 );
-  return v1 / 1000;
+  unsigned __int64 total_exp = 0;
+  for (uint i = 0; i < 4; ++i)
+    total_exp += pPlayers[i].uExperience;
+  return total_exp / 1000;
 }
 
 //----- (0049137D) --------------------------------------------------------
--- a/mm7_1.cpp	Tue Mar 05 01:45:43 2013 +0200
+++ b/mm7_1.cpp	Tue Mar 05 03:42:21 2013 +0200
@@ -985,24 +985,18 @@
   }
   while ( uCellID < 126 );
 }
-// 4E28F8: using guessed type int pCurrentScreen;
-// 507958: using guessed type int uTextureID_507958;
-// 50C9A8: using guessed type int dword_50C9A8;
 
 //----- (0041A556) --------------------------------------------------------
 void __cdecl draw_leather()
 {
-  pRenderer->DrawTextureIndexed(
-    8u,
-    8u,
-    (Texture *)(uTextureID_Leather != -1 ? (int)&pIcons_LOD->pTextures[uTextureID_Leather] : 0));
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->GetTexture(uTextureID_Leather));
 }
 
 //----- (0041A57E) --------------------------------------------------------
-char __cdecl QuickRefDraw()
+void QuickRefDraw()
 {
   unsigned int v0; // ebx@1
-  unsigned int v1; // eax@1
+  //unsigned int v1; // eax@1
   Player *pPlayer; // ebp@2
   int v3; // eax@6
   int v4; // edi@6
@@ -1049,14 +1043,14 @@
   unsigned int v46; // [sp+1Ch] [bp-10h]@1
   unsigned int v47; // [sp+20h] [bp-Ch]@1
   unsigned int v48; // [sp+24h] [bp-8h]@33
-  unsigned int v49; // [sp+28h] [bp-4h]@1
+  //unsigned int v49; // [sp+28h] [bp-4h]@1
 
   v0 = 0;
   v47 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
+  //v49 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0, 0);
   v46 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
-  v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
-  pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v1 != -1 ? &pIcons_LOD->pTextures[v1] : 0));
+  //v1 = pIcons_LOD->LoadTexture("quikref", TEXTURE_16BIT_PALETTE);
+  pRenderer->DrawTextureIndexed(8, 8, pIcons_LOD->LoadTexturePtr("quikref", TEXTURE_16BIT_PALETTE));
   v43 = 0;
   v45 = LOBYTE(pFontArrus->uFontHeight) + 1;
   do
@@ -1167,23 +1161,24 @@
     ++v43;
   }
   while ( v43 < 4 );
+
   v38 = GetPartyReputation();
   if ( v38 >= 0 )
   {
-    v39 = v49;
     if ( v38 <= 5 )
-      v39 = 65535;
+      v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0xFF, 0xFF);
+    else
+    v39 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFF, 0, 0);
   }
   else
-  {
     v39 = v46;
-  }
+
   v40 = GetReputationString(v38);
-  sprintf(pTmpBuf, "%s: ", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
+  sprintf(pTmpBuf, "%s: \xC" "%05d%s\xC" "00000", pGlobalTXT_LocalizationStrings[180], v39, v40);//Reputation
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 22, 323, 0, pTmpBuf, 0, 0, 0);
   v41 = pParty->GetPartyFame();
   sprintf(pTmpBuf, "\r261%s: %d", pGlobalTXT_LocalizationStrings[84], v41);// Fame Слава
-  return pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
+  pGUIWindow_CurrentMenu->DrawText(pFontArrus, 0, 323, 0, pTmpBuf, 0, 0, 0);
 }
 
 //----- (0041ABFD) --------------------------------------------------------
--- a/mm7_4.cpp	Tue Mar 05 01:45:43 2013 +0200
+++ b/mm7_4.cpp	Tue Mar 05 03:42:21 2013 +0200
@@ -4806,33 +4806,16 @@
 //----- (00495430) --------------------------------------------------------
 char *__fastcall GetReputationString(signed int a1)
 {
-  char *result; // eax@2
-
-  if ( a1 < 25 )
-  {
-    if ( a1 < 6 )
-    {
-      if ( a1 < -5 )
-      {
-        result = pGlobalTXT_LocalizationStrings[402];
-        if ( a1 < -24 )
-          result = pGlobalTXT_LocalizationStrings[434];
-      }
-      else
-      {
-        result = pGlobalTXT_LocalizationStrings[399];
-      }
-    }
-    else
-    {
-      result = pGlobalTXT_LocalizationStrings[392];
-    }
-  }
+  if (a1 >= 25)
+    return pGlobalTXT_LocalizationStrings[379]; // Hated
+  else if (a1 >= 6)
+    return pGlobalTXT_LocalizationStrings[392]; // Unfriendly
+  else if (a1 >= -5)
+    return pGlobalTXT_LocalizationStrings[399]; // Neutral;
+  else if (a1 >= -24)
+    return pGlobalTXT_LocalizationStrings[402]; // Friendly
   else
-  {
-    result = pGlobalTXT_LocalizationStrings[379];
-  }
-  return result;
+    return pGlobalTXT_LocalizationStrings[434]; // Respected;
 }
 
 //----- (00495461) --------------------------------------------------------
--- a/mm7_data.h	Tue Mar 05 01:45:43 2013 +0200
+++ b/mm7_data.h	Tue Mar 05 03:42:21 2013 +0200
@@ -1879,7 +1879,6 @@
 unsigned int __fastcall GetSizeInInventorySlots(unsigned int uNumPixels);
 void __fastcall CharacterUI_InventoryTab_Draw(unsigned int uPlayerID, char a2);
 void __cdecl draw_leather();
-char __cdecl QuickRefDraw();
 void __thiscall CharacterUI_CharacterScreen_Draw(unsigned int uPlayerIdx); // idb
 void __cdecl GameUI_DrawRightPanelItems();
 void __cdecl GameUI_DrawFoodAndGold();