diff mm7_1.cpp @ 521:663c4f618f56

Awards tab corrrection
author Gloval
date Sat, 02 Mar 2013 01:42:05 +0400
parents 35f28d4c0ff9
children 5196a51cc9ec
line wrap: on
line diff
--- a/mm7_1.cpp	Fri Mar 01 23:43:21 2013 +0400
+++ b/mm7_1.cpp	Sat Mar 02 01:42:05 2013 +0400
@@ -612,11 +612,11 @@
 }
 
 //----- (0041A000) --------------------------------------------------------
-unsigned int __fastcall CharacterUI_AwardsTab_Draw(unsigned int uPlayerID)
-{
+void CharacterUI_AwardsTab_Draw( unsigned int uPlayerID )
+    {
   //unsigned int v1; // esi@1
   unsigned int v2; // ebx@1
-  unsigned int v3; // eax@1
+  unsigned int award_texture_id; // eax@1
   unsigned int result; // eax@1
   int v5; // eax@15
   char *v6; // ebx@15
@@ -637,15 +637,15 @@
   int v21; // [sp+C8h] [bp-8h]@14
   int v22; // [sp+CCh] [bp-4h]@40
 
-  auto player = pParty->pPlayers + uPlayerID - 1;
+  auto player = &pParty->pPlayers[uPlayerID - 1];
   //v1 = uPlayerID;
   v2 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  v3 = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
-  pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(v3 != -1 ? &pIcons_LOD->pTextures[v3] : 0));
-  sprintfex(pTmpBuf, "%s\xC" "%05d", pGlobalTXT_LocalizationStrings[23], v2);
-  sprintfex(Source, pGlobalTXT_LocalizationStrings[429], player->pName, pClassNames[player->classType]);
+  award_texture_id = pIcons_LOD->LoadTexture("fr_award", TEXTURE_16BIT_PALETTE);
+  pRenderer->DrawTextureIndexed(8u, 8u, (Texture *)(award_texture_id != -1 ? &pIcons_LOD->pTextures[award_texture_id] : 0));
+  sprintfex(pTmpBuf, "%s \f%05d", pGlobalTXT_LocalizationStrings[LOCSTR_AVARDS_FOR], v2);
+  sprintfex(Source, pGlobalTXT_LocalizationStrings[LOCSTR_S_THE_S], player->pName, pClassNames[player->classType]);
   strcat(pTmpBuf, Source);
-  strcat(pTmpBuf, "\xC" "00000");
+  strcat(pTmpBuf, "\f00000");
   pGUIWindow_CurrentMenu->DrawText(pFontArrus, 24, 18, 0, pTmpBuf, 0, 0, 0);
   result = dword_506528;
   a1.uFrameX = 12;
@@ -654,7 +654,7 @@
   a1.uFrameHeight = 290;
   a1.uFrameZ = 435;
   a1.uFrameW = 337;
-  if ( dword_506544 && dword_506520 + dword_506528 < dword_506524 )
+  if ( dword_506544 && awards_count + dword_506528 < awards_count2 )
     result = dword_506528++ + 1;
   if ( dword_506548 && result )
   {
@@ -663,16 +663,16 @@
   }
   if ( dword_50651C < 0 )
   {
-    result += dword_506520;
+    result += awards_count;
     dword_506528 = result;
-    if ( (signed int)(dword_506520 + result) <= dword_506524 )
+    if ( (signed int)(awards_count + result) <= awards_count2 )
       goto LABEL_14;
-    result = dword_506524 - dword_506520;
+    result = awards_count2 - awards_count;
     goto LABEL_13;
   }
   if ( dword_50651C > 0 )
   {
-    result -= dword_506520;
+    result -= awards_count;
     dword_506528 = result;
     if ( (result & 0x80000000u) != 0 )
     {
@@ -685,16 +685,16 @@
 LABEL_14:
   dword_506544 = 0;
   dword_506548 = 0;
-  dword_506520 = 0;
+  awards_count = 0;
   dword_50651C = 0;
   v21 = result;
-  if ( (signed int)result < dword_506524 )
+  if ( (signed int)result < awards_count2 )
   {
     while ( 1 )
     {
-      v5 = pStru179.field_0[v21];
-      v20 = 8 * pStru179.field_0[v21];
-      v6 = (char *)pAwards[(v20-1)/8].pText;//(char *)dword_723E80_award_related[v20 / 4];
+      v5 = achievedAwardsIndex[v21];
+      v20 = achievedAwardsIndex[v21];
+      v6 = (char *)pAwards[v20].pText;//(char *)dword_723E80_award_related[v20 / 4];
       if ( v5 != 1 )
         break;
       v17 = pParty->uFine;
@@ -702,8 +702,8 @@
       sprintf(pTmpBuf, v6, v17);
       v6 = pTmpBuf;
 LABEL_43:
-	  v14 = pAwards[v20/8-1].uSort;//dword_723E84[v20 / 4];
-      ++dword_506520;
+	  v14 = pAwards[v20].uSort;//dword_723E84[v20 / 4];
+      ++awards_count;
       v15 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
               pAwardsTextColors[3 * v14 % 6],
               pAwardsTextColors[3 * v14 % 6 + 1],
@@ -716,10 +716,10 @@
         ++v21;
         a1.uFrameY = result;
         result = v21;
-        if ( v21 < dword_506524 )
+        if ( v21 < awards_count2 )
           continue;
       }
-      return result;
+      return;
     }
     if ( (v5 < 85 || v5 > 91) && (v5 < 103 || v5 > 104) )
       goto LABEL_43;
@@ -786,7 +786,7 @@
     v17 = v22;
     goto LABEL_42;
   }
-  return result;
+  return;
 }
 // 50651C: using guessed type int dword_50651C;
 // 506520: using guessed type int dword_506520;
@@ -4791,7 +4791,7 @@
   pWindow->CreateButton(0x124u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 3u, 0x33u, "", 0);
   pWindow->CreateButton(0x197u, 0x1A8u, 0x1Fu, 0, 2, 94, 0x6Eu, 4u, 0x34u, "", 0);
   pWindow->CreateButton(0, 0, 0, 0, 1, 0, 0xB0u, 0, 9u, "", 0);
-  sub_419100();
+  FillAwardsData();
   return pWindow;
 }
 
@@ -5014,7 +5014,7 @@
       viewparams->bRedrawGameUI = true;
       uActiveCharacter = uPlayerID;
       if ( pWindowList_at_506F50_minus1_indexing_buttons____and_an_int_[0] == 102 )
-        sub_419100();
+        FillAwardsData();
       return;
     }
     //goto LABEL_23;