changeset 41:fd64b06a39a8

19.10.12 PartyCreation Window complete
author Ritor1
date Fri, 19 Oct 2012 23:28:34 +0600
parents 001b45e84aaa
children 7071e4688db6
files Party.cpp Player.cpp Time.cpp mm7_4.cpp
diffstat 4 files changed, 102 insertions(+), 111 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Thu Oct 18 09:12:15 2012 +0600
+++ b/Party.cpp	Fri Oct 19 23:28:34 2012 +0600
@@ -544,9 +544,9 @@
     ::pPlayers[i + 1] = &pPlayers[i];
 
   pPlayers[0].Reset(0);
-  pPlayers[0].Reset(4);
-  pPlayers[0].Reset(24);
-  pPlayers[0].Reset(32);
+  pPlayers[1].Reset(4);
+  pPlayers[2].Reset(24);
+  pPlayers[3].Reset(32);
   pPlayers[0].uFace = 17;
   pPlayers[0].field_1924 = 17;
   pPlayers[0].uVoiceID = 17;
--- a/Player.cpp	Thu Oct 18 09:12:15 2012 +0600
+++ b/Player.cpp	Fri Oct 19 23:28:34 2012 +0600
@@ -6879,33 +6879,44 @@
 __int16 Player::GetStatColor(unsigned int uStat)
 {
   Player *v2; // edi@1
-  __int16 v3; // si@1
-  int v4; // eax@1
+  __int16 uWhite; // si@1
+//  int uStartingHP; // eax@1
   int v5; // edx@1
-  unsigned __int8 v6; // zf@1
-  char v7; // sf@1
+ // unsigned __int8 v6; // zf@1
+ // char v7; // sf@1
   unsigned __int8 v8; // of@1
   __int16 result; // ax@2
-  __int16 v10; // [sp+8h] [bp-8h]@1
-  __int16 v11; // [sp+Ch] [bp-4h]@1
+  __int16 uGreen; // [sp+8h] [bp-8h]@1
+  __int16 uRed; // [sp+Ch] [bp-4h]@1
 
   v2 = this;
-  v11 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0);
-  v10 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
-  v3 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
-  v4 = stru_4ED7B0.race[0].attr[uStat + 7 * GetRace()].uBaseValue;
-  v8 = __OFSUB__(v5, v4);
-  v6 = v5 == v4;
-  v7 = v5 - v4 < 0;
-  if ( v5 >= v4 )
-  {
-    result = v10;
-    if ( (unsigned __int8)(v7 ^ v8) | v6 )
-      result = v3;
+  uRed = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0x23u, 0);
+  uGreen = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xFFu, 0);
+  uWhite = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xFFu, 0xFFu, 0xFFu);
+  v8 = stru_4ED7B0.race[GetRace()].attr[uStat].uBaseValue;
+
+  int attribute_value = 0;
+  switch (uStat)
+  {
+    case 0:  attribute_value = uMight;        break;
+    case 1:  attribute_value = uIntelligence; break;
+    case 2:  attribute_value = uWillpower;    break;
+    case 3:  attribute_value = uEndurance;    break;
+    case 4:  attribute_value = uSpeed;        break;
+    case 5:  attribute_value = uAccuracy;     break;
+    case 6:  attribute_value = uLuck;         break;
+  };
+
+  v5 = attribute_value;
+  if ( v5 >= v8 )
+  {
+    result = uGreen;
+    if ( v5 == v8 )
+      result = uWhite;
   }
   else
   {
-    result = v11;
+    result = uRed;
   }
   return result;
 }
--- a/Time.cpp	Thu Oct 18 09:12:15 2012 +0600
+++ b/Time.cpp	Fri Oct 19 23:28:34 2012 +0600
@@ -9,7 +9,7 @@
 
 
 
-Timer *pMiscTimer;
+Timer *pMiscTimer = new Timer;
 Timer *pEventTimer;
 
 
--- a/mm7_4.cpp	Thu Oct 18 09:12:15 2012 +0600
+++ b/mm7_4.cpp	Fri Oct 19 23:28:34 2012 +0600
@@ -5334,13 +5334,13 @@
 void __cdecl PlayerCreationUI_Draw()
 {
   Texture *v0; // edi@1
-  const char *v1; // ST10_4@3
+  const char *uTitleText; // ST10_4@3
   int v2; // eax@3
   IconFrame *v3; // eax@3
   int v4; // ecx@7
-  GUIButton *v5; // edi@12
+  GUIButton *uPosActiveItem; // edi@12
   int v6; // esi@14
-  int v7; // eax@14
+  int uNumLet; // eax@14
   char v8; // al@17
   int v9; // ecx@17
   char v10; // sf@17
@@ -5351,12 +5351,12 @@
   char *v15; // ST14_4@24
   size_t v16; // eax@28
   int v17; // eax@33
-  enum CHARACTER_RACE v18; // eax@35
+  enum CHARACTER_RACE uNumRace; // eax@35
   int v19; // eax@36
   int v20; // eax@37
   int v21; // ST0C_4@44
   int v22; // eax@44
-  int v23; // eax@44
+  int uNumMight; // eax@44
   unsigned int v24; // eax@44
   int v25; // eax@44
   unsigned int v26; // eax@44
@@ -5449,7 +5449,7 @@
   signed int v113; // edi@82
   int v114; // ST0C_4@82
   int v115; // eax@82
-  const char *v116; // [sp+0h] [bp-170h]@39
+  const char *uRaceName; // [sp+0h] [bp-170h]@39
   char Str1[200]; // [sp+10h] [bp-160h]@14
   GUIWindow v118; // [sp+D8h] [bp-98h]@83
   int v119; // [sp+12Ch] [bp-44h]@18
@@ -5468,7 +5468,7 @@
   int uX; // [sp+160h] [bp-10h]@18
   unsigned int v133; // [sp+164h] [bp-Ch]@25
   int v134; // [sp+168h] [bp-8h]@14
-  char *Str; // [sp+16Ch] [bp-4h]@18
+  Player *pPlayer;
 
   uColor1 = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0xD1u, 0xBBu, 0x61u);
   uColorTeal = GenerateColorAsCloseAsPossibleToR8G8B8InTargetFormat(0, 0xF7u, 0xF7u);
@@ -5482,11 +5482,11 @@
   if ( (signed int)uPlayerCreationUI_SkySliderPos > 640 )
     uPlayerCreationUI_SkySliderPos = 0;
   pRenderer->DrawTextureTransparent(0, 0, pTexture_MAKETOP);
-  v1 = pGlobalTXT_LocalizationStrings[51];
+  uTitleText = pGlobalTXT_LocalizationStrings[51];
   uPlayerCreationUI_SelectedCharacter = (pGUIWindow_CurrentMenu->field_2C_focus_id - pGUIWindow_CurrentMenu->field_38)
                                       / 7;
-  v2 = pFontCChar->AlignText_Center(0x280u, pGlobalTXT_LocalizationStrings[51]);
-  pGUIWindow_CurrentMenu->DrawText(pFontCChar, v2 + 1, 0, 0, v1, 0, 0, 0);
+  v2 = pFontCChar->AlignText_Center(640u, pGlobalTXT_LocalizationStrings[51]);
+  pGUIWindow_CurrentMenu->DrawText(pFontCChar, v2 + 1, 0, 0, uTitleText, 0, 0, 0);
   pRenderer->DrawTextureTransparent(17u, 35u, pPlayerPortraits[(char)pParty->pPlayers[0].uFace]);
   pRenderer->DrawTextureTransparent(176u, 35u, pPlayerPortraits[(char)pParty->pPlayers[1].uFace]);
   pRenderer->DrawTextureTransparent(335u, 35u, pPlayerPortraits[(char)pParty->pPlayers[2].uFace]);
@@ -5514,28 +5514,28 @@
   {
     v4 = 12;
   }
-  pRenderer->DrawTextureTransparent(v4, 0x1Du, &pIcons_LOD->pTextures[v3->uTextureID]);
-  v5 = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->field_2C_focus_id);
-  pRenderer->DrawTextureTransparent(v5->uZ - 4, v5->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim + 1]);
-  pRenderer->DrawTextureTransparent(v5->uX - 12, v5->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim-- + 1]);
+  pRenderer->DrawTextureTransparent(v4, 29, &pIcons_LOD->pTextures[v3->uTextureID]);
+  uPosActiveItem = pGUIWindow_CurrentMenu->GetControl(pGUIWindow_CurrentMenu->field_2C_focus_id);
+  pRenderer->DrawTextureTransparent(uPosActiveItem->uZ - 4, uPosActiveItem->uY, pTextures_arrowl[uPlayerCreationUI_ArrowAnim + 1]);
+  pRenderer->DrawTextureTransparent(uPosActiveItem->uX - 12, uPosActiveItem->uY, pTextures_arrowr[uPlayerCreationUI_ArrowAnim-- + 1]);
   if ( uPlayerCreationUI_ArrowAnim < 0 )
     uPlayerCreationUI_ArrowAnim = 18;
   v6 = LOBYTE(pFontCreate->uFontHeight) - 2;
   v128 = LOBYTE(pFontCreate->uFontHeight) - 2;
   strcpy(Str1, pGlobalTXT_LocalizationStrings[205]);// "Skills"
-  v7 = strlen(Str1) - 1;
-  v134 = v7;
-  if ( v7 >= 0 )
+  uNumLet = strlen(Str1) - 1;
+  v134 = uNumLet;
+  if ( uNumLet >= 0 )
   {
     while ( 1 )
     {
-      v8 = toupper((unsigned __int8)Str1[v7]);
+      v8 = toupper((unsigned __int8)Str1[uNumLet]);
       v9 = v134;
       v10 = v134-- - 1 < 0;
       Str1[v9] = v8;
       if ( v10 )
         break;
-      v7 = v134;
+      uNumLet = v134;
     }
   }
   v134 = 18;
@@ -5545,7 +5545,7 @@
   v122 = 5 * v6 + 169;
   v123 = 3 * v6 + 311;
   v129 = 493;
-  Str = pParty->pPlayers[0].pName;
+  pPlayer = pParty->pPlayers;
   v119 = 6 * v6 + 169;
   do
   {
@@ -5554,14 +5554,14 @@
       v134 + 73,
       100,
       0,
-      pClassNames[(unsigned __int8)Str[17]],
+      pClassNames[(unsigned __int8)pPlayer->uClass],
       0,
       0,
       0);
     pRenderer->DrawTextureTransparent(
       v134 + 77,
       50u,
-      *(&pTexture_IC_KNIGHT + ((unsigned int)(unsigned __int8)Str[17] >> 2)));
+      *(&pTexture_IC_KNIGHT + ((unsigned int)(unsigned __int8)pPlayer->uClass >> 2)));
     v11 = pGUIWindow_CurrentMenu->field_40;
     if ( v11 && (v12 = pGUIWindow_CurrentMenu->ptr_1C, v12 == v124) )
     {
@@ -5599,7 +5599,7 @@
           if ( v120 && v126 != v120 )
             strcpy(Str, (const char *)pKeyActionMap->pPressedKeysBuffer);
           pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 0x7Cu, 0, Str, 130, 0);
-          *((short *)Str + 3323) = 1;
+          *((short *)pPlayer->pName + 3323) = 1;
         }
       }
       else
@@ -5620,104 +5620,84 @@
     }
     else
     {
-      pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 0x7Cu, 0, Str, 130, 0);
-    }
-    v18 = ((Player *)(Str - 168))->GetRace();
-    if ( v18 )
-    {
-      v19 = v18 - 1;
-      if ( v19 )
-      {
-        v20 = v19 - 1;
-        if ( v20 )
-        {
-          if ( v20 != 1 )
-            goto LABEL_44;
-          v116 = pGlobalTXT_LocalizationStrings[101];// "Dwarf"
-        }
-        else
-        {
-          v116 = pGlobalTXT_LocalizationStrings[106];// "Goblin"
-        }
-      }
-      else
-      {
-        v116 = pGlobalTXT_LocalizationStrings[103];// "Elf"
-      }
-    }
-    else
-    {
-      v116 = pGlobalTXT_LocalizationStrings[99];// "Human"
-    }
-    strcpy(pTmpBuf, v116);
-LABEL_44:
+      pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134, 0x7Cu, 0, pPlayer->pName, 130, 0);
+    }
+    uNumRace = pPlayer->GetRace();
+     switch (uNumRace)
+    {
+      case 0:  uRaceName = pGlobalTXT_LocalizationStrings[99]; break; // "Human"       
+      case 1:  uRaceName = pGlobalTXT_LocalizationStrings[101]; break; // "Dwarf"
+      case 2:  uRaceName = pGlobalTXT_LocalizationStrings[106]; break; // "Goblin"
+	  case 3:  uRaceName = pGlobalTXT_LocalizationStrings[103]; break; // "Elf"   
+    }; 
+	strcpy(pTmpBuf, uRaceName);
     pGUIWindow_CurrentMenu->DrawTextInRect(pFontCreate, v134 + 72, v128 + 12, 0, pTmpBuf, 130, 0);
     v21 = uColor1;
     v22 = pFontCreate->AlignText_Center(0x96u, Str1);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, v22 + uX - 24, 291, v21, Str1, 0, 0, 0);
-    v23 = ((Player *)(Str - 168))->GetActualMight();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], v129, v23);// "Might"
-    LOWORD(v24) = ((Player *)(Str - 168))->GetStatColor(0);
+    uNumMight = pPlayer->GetActualMight();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[144], v129, uNumMight);// "Might"
+    LOWORD(v24) = pPlayer->GetStatColor(0);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 169, v24, pTmpBuf, 0, 0, 0);
-    v25 = ((Player *)(Str - 168))->GetActualIntelligence();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], v129, v25);// "Intellect"
-    LOWORD(v26) = ((Player *)(Str - 168))->GetStatColor(1u);
+    v25 = pPlayer->GetActualIntelligence();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[116], v129, v25);// "Intellect"
+    LOWORD(v26) = pPlayer->GetStatColor(1u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v128 + 169, v26, pTmpBuf, 0, 0, 0);
-    v27 = ((Player *)(Str - 168))->GetActualWillpower();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], v129, v27);// "Personality"
-    LOWORD(v28) = ((Player *)(Str - 168))->GetStatColor(2u);
+    v27 = pPlayer->GetActualWillpower();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[163], v129, v27);// "Personality"
+    LOWORD(v28) = pPlayer->GetStatColor(2u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 2 * v128 + 169, v28, pTmpBuf, 0, 0, 0);
-    v29 = ((Player *)(Str - 168))->GetActualEndurance();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], v129, v29);// "Endurance"
-    LOWORD(v30) = ((Player *)(Str - 168))->GetStatColor(3u);
+    v29 = pPlayer->GetActualEndurance();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[75], v129, v29);// "Endurance"
+    LOWORD(v30) = pPlayer->GetStatColor(3u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, uY, v30, pTmpBuf, 0, 0, 0);
-    v31 = ((Player *)(Str - 168))->GetActualAccuracy();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], v129, v31);// "Accuracy"
-    LOWORD(v32) = ((Player *)(Str - 168))->GetStatColor(4u);
+    v31 = pPlayer->GetActualAccuracy();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[1], v129, v31);// "Accuracy"
+    LOWORD(v32) = pPlayer->GetStatColor(4u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, 4 * v128 + 169, v32, pTmpBuf, 0, 0, 0);
-    v33 = ((Player *)(Str - 168))->GetActualSpeed();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], v129, v33);// "Speed"
-    LOWORD(v34) = ((Player *)(Str - 168))->GetStatColor(5u);
+    v33 = pPlayer->GetActualSpeed();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[211], v129, v33);// "Speed"
+    LOWORD(v34) = pPlayer->GetStatColor(5u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v122, v34, pTmpBuf, 0, 0, 0);
-    v35 = ((Player *)(Str - 168))->GetActualLuck();
-    sprintfex(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], v129, v35);// "Luck"
-    LOWORD(v36) = ((Player *)(Str - 168))->GetStatColor(6u);
+    v35 = pPlayer->GetActualLuck();
+    sprintf(pTmpBuf, "%s\r%03d%d", pGlobalTXT_LocalizationStrings[136], v129, v35);// "Luck"
+    LOWORD(v36) = pPlayer->GetStatColor(6u);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX, v119, v36, pTmpBuf, 0, 0, 0);
-    v37 = ((Player *)(Str - 168))->GetSkillIdxByOrder(0);
+    v37 = pPlayer->GetSkillIdxByOrder(0);
     v38 = pFontCreate->AlignText_Center(0x96u, pSkillNames[v37]);
-    sprintfex(pTmpBuf, "\t%03u%s", v38);
+    sprintf(pTmpBuf, "\t%03u%s", v38);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 311, uColorWhite, pTmpBuf, 0, 0, 0);
-    v39 = ((Player *)(Str - 168))->GetSkillIdxByOrder(1);
+    v39 = pPlayer->GetSkillIdxByOrder(1);
     v40 = pFontCreate->AlignText_Center(0x96u, pSkillNames[v39]);
-    sprintfex(pTmpBuf, "\t%03u%s", v40);
+    sprintf(pTmpBuf, "\t%03u%s", v40);
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v128 + 311, uColorWhite, pTmpBuf, 0, 0, 0);
-    v41 = ((Player *)(Str - 168))->GetSkillIdxByOrder(2);
+    v41 = pPlayer->GetSkillIdxByOrder(2);
     v42 = pSkillNames[v41];
     v43 = pSkillNames[v41];
     v133 = v41;
     v44 = pFontCreate->AlignText_Center(150u, v42);
-    sprintfex(pTmpBuf, "\t%03u%s", v44, v43);
+    sprintf(pTmpBuf, "\t%03u%s", v44, v43);
     v45 = uColorGreen;
     if ( (signed int)v133 >= 37 )
       v45 = uColorTeal;
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, 2 * v128 + 311, v45, pTmpBuf, 0, 0, 0);
-    v46 = ((Player *)(Str - 168))->GetSkillIdxByOrder(3);
+    v46 = pPlayer->GetSkillIdxByOrder(3);
     v47 = pSkillNames[v46];
     v48 = pSkillNames[v46];
     v133 = v46;
     v49 = pFontCreate->AlignText_Center(150u, v47);
-    sprintfex(pTmpBuf, "\t%03u%s", v49, v48);
+    sprintf(pTmpBuf, "\t%03u%s", v49, v48);
     v50 = uColorGreen;
     if ( (signed int)v133 >= 37 )
       v50 = uColorTeal;
     pGUIWindow_CurrentMenu->DrawText(pFontCreate, uX - 24, v123, v50, pTmpBuf, 0, 0, 0);
-    Str += 6972;
+    pPlayer++;
     v124 = (char *)v124 + 1;
     v134 += 159;
     v129 -= 158;
     uX += 158;
   }
-  while ( (signed int)Str < (signed int)&pParty->pPickedItem.uNumCharges );
+  while ( (signed int)pPlayer->pName < (signed int)&pParty->pPickedItem.uNumCharges );
   strcpy(Str1, pGlobalTXT_LocalizationStrings[41]);// "Class"
   v51 = strlen(Str1) - 1;
   v134 = v51;
@@ -5859,7 +5839,7 @@
   v112 = pFontCreate->AlignText_Center(0x5Cu, pGlobalTXT_LocalizationStrings[30]);
   pGUIWindow_CurrentMenu->DrawText(pFontCreate, v112 + 533, 394, v111, v110, 0, 0, 0);
   v113 = PlayerCreation_ComputeAttributeBonus();
-  sprintfex(pTmpBuf, "%d", v113);
+  sprintf(pTmpBuf, "%d", v113);
   v114 = uColorWhite;
   v115 = pFontCreate->AlignText_Center(84u, pTmpBuf);
   pGUIWindow_CurrentMenu->DrawText(pFontCreate, v115 + 530, 410, v114, pTmpBuf, 0, 0, 0);
@@ -5938,9 +5918,9 @@
   uControlParam = 1;
   do
   {
-    sprintfex(pTmpBuf, "arrowl%d", uControlParam);
+    sprintf(pTmpBuf, "arrowl%d", uControlParam);
     pTextures_arrowl[uControlParam] = &pIcons_LOD->pTextures[pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE)];
-    sprintfex(pTmpBuf, "arrowr%d", uControlParam);
+    sprintf(pTmpBuf, "arrowr%d", uControlParam);
     v3 = pIcons_LOD->LoadTexture(pTmpBuf, TEXTURE_16BIT_PALETTE);
     v4 = uControlParam++;
     pTextures_arrowr[v4] = &pIcons_LOD->pTextures[v3];