diff GUIWindow.cpp @ 82:f9a33f75bae3

Qick Record
author Nomad
date Mon, 29 Oct 2012 00:41:51 +0200
parents 30ec77bbd018
children 2d5d13376e91
line wrap: on
line diff
--- a/GUIWindow.cpp	Sun Oct 28 18:51:52 2012 +0200
+++ b/GUIWindow.cpp	Mon Oct 29 00:41:51 2012 +0200
@@ -145,13 +145,9 @@
 
 
 //----- (0041D3B7) --------------------------------------------------------
-char GUIWindow::_41D3B7()
+char GUIWindow::DrawQuickCharRecord()
 {
-  GUIWindow *v1; // edi@1
   Player *pPlayer; // esi@1
-  int v3; // ecx@1
-  SpellBuff *v4; // eax@1
-  signed int v5; // ebx@1
   int v6; // eax@5
   int v7; // ebx@5
   unsigned int v8; // ecx@5
@@ -163,76 +159,44 @@
   unsigned int v14; // eax@12
   PlayerFrame *v15; // eax@12
   unsigned int v16; // eax@15
-  signed int v17; // ST28_4@15
-  int v18; // ST24_4@15
-  signed int v19; // eax@15
   unsigned int v20; // eax@15
-  int v21; // ST28_4@15
-  int v22; // ST24_4@15
-  int v23; // eax@15
   unsigned int v24; // eax@15
   unsigned int v25; // eax@15
-  char *v26; // ST28_4@15
-  signed int v27; // eax@15
   unsigned __int8 v28; // al@15
   char *v29; // eax@16
-  unsigned int v30; // esi@18
-  SpellBuff *v31; // edx@18
-  char *v32; // edi@18
-  signed int v33; // ecx@19
-  unsigned int v34; // eax@19
   __int64 v35; // ST38_8@22
   int v36; // esi@22
-  const char *v37; // ST1C_4@22
   unsigned int v38; // eax@22
   char *v39; // eax@24
-  SpellBuff *v41; // [sp+14h] [bp-14h]@1
-  GUIFont *a2; // [sp+18h] [bp-10h]@1
-  GUIWindow *a1; // [sp+1Ch] [bp-Ch]@1
   signed int uFramesetID; // [sp+20h] [bp-8h]@9
   int uFramesetIDa; // [sp+20h] [bp-8h]@18
-  const char **v46; // [sp+24h] [bp-4h]@18
+
+  pPlayer = &pParty->pPlayers[(unsigned int)ptr_1C];
+
+  uint numActivePlayerBuffs = 0;
+
+  for (uint i = 0; i < 24; ++i)
+    if (pPlayer->pPlayerBuffs[i].uExpireTime > 0)
+      ++numActivePlayerBuffs;
 
-  v1 = this;
-  a2 = pFontComic;
-  pPlayer = &pParty->pPlayers[(unsigned int)this->ptr_1C];
-  a1 = this;
-  v3 = 0;
-  v4 = pPlayer->pPlayerBuffs;
-  v5 = 24;
-  v41 = pPlayer->pPlayerBuffs;
-  do
-  {
-    if ( (signed __int64)v4->uExpireTime > 0 )
-      ++v3;
-    ++v4;
-    --v5;
-  }
-  while ( v5 );
-  v6 = LOBYTE(pFontArrus->uFontHeight) + 162;
-  v1->uFrameHeight = v6;
-  v7 = (v3 - 1) * LOBYTE(pFontArrus->uFontHeight);
-  v8 = v1->uFrameX;
+  v6 = pFontArrus->uFontHeight + 162;
+  uFrameHeight = v6;
+  v7 = (numActivePlayerBuffs - 1) * pFontArrus->uFontHeight;
+  v8 = uFrameX;
   v9 = v6 + v7;
-  v10 = v1->uFrameWidth;
-  v1->uFrameHeight = v9;
+  v10 = uFrameWidth;
+  uFrameHeight = v9;
   v11 = v10 + v8 - 1;
-  v12 = v1->uFrameY;
-  v1->uFrameZ = v11;
-  v1->uFrameW = v9 + v12 - 1;
-  v1->DrawMessageBox(0);
-  if ( pPlayer->pConditions[16] )
-  {
+  v12 = uFrameY;
+  uFrameZ = v11;
+  uFrameW = v9 + v12 - 1;
+  DrawMessageBox(0);
+  if (pPlayer->Eradicated())
     v13 = pTexture_PlayerFaceEradicated;
-  }
+  else if (pPlayer->Dead())
+    v13 = pTexture_PlayerFaceDead;
   else
   {
-    if ( pPlayer->pConditions[14] )
-    {
-      v13 = pTexture_PlayerFaceDead;
-    }
-    else
-    {
       uFramesetID = pPlayerFrameTable->GetFrameIdBy_field0(pPlayer->uExpressionID);
       if ( !uFramesetID )
         uFramesetID = 1;
@@ -249,74 +213,58 @@
         v15 = pPlayerFrameTable->GetFrameBy_x(uFramesetID, v14);
       }
       pPlayer->field_1AA2 = v15->uTextureID - 1;
-      v13 = (Texture *)A74CEC_player_faces_minus1_indexing[v15->uTextureID + 56 * (unsigned int)v1->ptr_1C];
-    }
+      v13 = pTextures_PlayerFaces[(unsigned int)ptr_1C][v15->uTextureID];
   }
-  pRenderer->DrawTextureTransparent(v1->uFrameX + 24, v1->uFrameY + 24, v13);
+
+  pRenderer->DrawTextureTransparent(uFrameX + 24, uFrameY + 24, v13);
   v16 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0x9Bu);
-  sprintfex(pTmpBuf, "\xC" "00000\n", v16);
-  sprintfex(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->uClass]);
+  sprintf(pTmpBuf, "\xC%05d", v16);
+  sprintf(pTmpBuf2, pGlobalTXT_LocalizationStrings[429], pPlayer->pName, pClassNames[pPlayer->uClass]);
   strcat(pTmpBuf, pTmpBuf2);
   strcat(pTmpBuf, "\xC" "00000\n");
-  v17 = pPlayer->GetMaxHealth();
-  v18 = pPlayer->sHealth;
-  v19 = pPlayer->GetMaxHealth();
-  v20 = sub_4178FE(pPlayer->sHealth, v19);
-  sprintfex(pTmpBuf2, "%s : ", pGlobalTXT_LocalizationStrings[108], v20, v18, v17);
+  v20 = UI_GetHealthManaStringColor(pPlayer->sHealth, pPlayer->GetMaxHealth());
+  sprintf(pTmpBuf2, "%s : \x0C" "%05u%d\x0C" "00000 / %d\n", pGlobalTXT_LocalizationStrings[108],
+          v20, pPlayer->sHealth, pPlayer->GetMaxHealth());
   strcat(pTmpBuf, pTmpBuf2);
-  v21 = pPlayer->GetMaxMana();
-  v22 = pPlayer->sMana;
-  v23 = pPlayer->GetMaxMana();
-  v24 = sub_4178FE(pPlayer->sMana, v23);
-  sprintfex(pTmpBuf2, "%s : ", pGlobalTXT_LocalizationStrings[212], v24, v22, v21);
+  v24 = UI_GetHealthManaStringColor(pPlayer->sMana, pPlayer->GetMaxMana());
+  sprintf(pTmpBuf2, "%s : \x0C" "%05u%d\x0C" "00000 / %d\n", pGlobalTXT_LocalizationStrings[212],
+          v24, pPlayer->sMana, pPlayer->GetMaxMana());
   strcat(pTmpBuf, pTmpBuf2);
   v25 = pPlayer->GetMajorConditionIdx();
-  v26 = aCharacterConditionNames[v25];
-  v27 = GetConditionDrawColor(v25);
-  sprintfex(pTmpBuf2, "%s: ", pGlobalTXT_LocalizationStrings[47], v27, v26);
+  sprintf(pTmpBuf2, "%s: \x0C" "%05d%s\x0C" "00000\n", pGlobalTXT_LocalizationStrings[47],
+          GetConditionDrawColor(v25), aCharacterConditionNames[v25]);
   strcat(pTmpBuf, pTmpBuf2);
   v28 = pPlayer->uQuickSpell;
   if ( v28 )
     v29 = pSpellStats->pInfos[v28].pShortName;
   else
     v29 = pGlobalTXT_LocalizationStrings[153];
-  sprintfex(pTmpBuf2, "%s: %s", pGlobalTXT_LocalizationStrings[172], v29);
+  sprintf(pTmpBuf2, "%s: %s", pGlobalTXT_LocalizationStrings[172], v29);
   strcat(pTmpBuf, pTmpBuf2);
-  v30 = 0;
-  a1->DrawText(pFontArrus, 120, 22, 0, pTmpBuf, 0, 0, 0);
-  v31 = v41;
+  DrawText(pFontArrus, 120, 22, 0, pTmpBuf, 0, 0, 0);
+
   uFramesetIDa = 0;
-  v32 = &_4E2AD8_ui_colors[1];
-  v46 = (const char **)&aSpellNames[20];
-  do
+  for (uint i = 0; i < 24; ++i)
   {
-    v33 = HIDWORD(v31->uExpireTime);
-    v34 = LODWORD(v31->uExpireTime);
-    if ( v33 >= (signed int)v30 && (v33 > (signed int)v30 || v34 > v30) )
+    auto buff = pPlayer->pPlayerBuffs + i;
+    if (buff->uExpireTime > 0)
     {
-      v35 = __PAIR__(v33, v34) - pParty->uTimePlayed;
-      v36 = uFramesetIDa++ * LOBYTE(a2->uFontHeight) + 134;
-      v37 = *v46;
+      v35 = buff->uExpireTime - pParty->uTimePlayed;
+      v36 = uFramesetIDa++ * pFontComic->uFontHeight + 134;
       v38 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(
-              (unsigned __int8)*(v32 - 1),
-              (unsigned __int8)*v32,
-              (unsigned __int8)v32[1]);
-      a1->DrawText(a2, 52, v36, v38, v37, 0, 0, 0);
-      sub_41D20D_buff_remaining_time_string(v36, a1, v35, a2);
-      v31 = v41;
-      v30 = 0;
+              _4E2AD8_ui_colors[i * 3],
+              _4E2AD8_ui_colors[i * 3 + 1],
+              _4E2AD8_ui_colors[i * 3 + 2]);
+      DrawText(pFontComic, 52, v36, v38, aSpellNames[20 + i], 0, 0, 0);
+      sub_41D20D_buff_remaining_time_string(v36, this, v35, pFontComic);
     }
-    ++v46;
-    ++v31;
-    v32 += 3;
-    v41 = v31;
   }
-  while ( (signed int)v46 < (signed int)&dword_506978 );
+
   v39 = "";
-  if ( uFramesetIDa == v30 )
+  if ( uFramesetIDa == 0 )
     v39 = pGlobalTXT_LocalizationStrings[153];
-  sprintfex(pTmpBuf, pGlobalTXT_LocalizationStrings[450], v39);
-  return a1->DrawText(pFontArrus, 14, 114, v30, pTmpBuf, v30, v30, v30);
+  sprintf(pTmpBuf, pGlobalTXT_LocalizationStrings[450], v39);
+  return DrawText(pFontArrus, 14, 114, 0, pTmpBuf, 0, 0, 0);
 }
 
 //----- (0041D08F) --------------------------------------------------------