changeset 25:2bbf33898c6b

c/p error in prev commit
author Nomad
date Mon, 15 Oct 2012 18:45:11 +0200
parents 74940016abc8
children 93bf1d5f6a6d 77da38f82079
files Party.cpp Player.cpp Player.h mm7_4.cpp
diffstat 4 files changed, 54 insertions(+), 62 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Mon Oct 15 18:28:43 2012 +0200
+++ b/Party.cpp	Mon Oct 15 18:45:11 2012 +0200
@@ -514,10 +514,10 @@
   //bool v3; // edx@1
   //Player **v4; // eax@1
   //Player *v5; // ecx@1
-  char v6; // cl@3
-  char v7; // al@6
-  char v8; // al@9
-  char v9; // cl@12
+  PLAYER_SEX v6; // cl@3
+  PLAYER_SEX v7; // al@6
+  PLAYER_SEX v8; // al@9
+  PLAYER_SEX v9; // cl@12
   Player **v10; // ebx@15
   signed int v11; // eax@16
   Player *v12; // edx@17
@@ -557,7 +557,7 @@
   pPlayers[0].field_1924 = 17;
   pPlayers[0].uVoiceID = 17;
   pPlayers[0].SetInitialStats();
-  v6 = 0;
+ 
   switch ( pPlayers[0].uVoiceID )
   {
     case 0u:
@@ -572,7 +572,8 @@
     case 0x11u:
     case 0x14u:
     case 0x17u:
-      v6 = 0;
+    default:
+      v6 = SEX_MALE;
       break;
     case 4u:
     case 5u:
@@ -586,19 +587,19 @@
     case 0x13u:
     case 0x15u:
     case 0x18u:
-      v6 = 1;
-      break;
-    default:
+      v6 = SEX_FEMALE;
       break;
   }
   pPlayers[0].uSex = v6;
   pPlayers[0].RandomizeName();
   strcpy(pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
+
+
   pPlayers[1].uFace = 3;
   pPlayers[1].field_1924 = 3;
   pPlayers[1].uVoiceID = 3;
   pPlayers[1].SetInitialStats();
-  v7 = 0;
+  v7 = SEX_MALE;
   switch (pPlayers[1].uVoiceID)
   {
     case 0u:
@@ -613,7 +614,7 @@
     case 0x11u:
     case 0x14u:
     case 0x17u:
-      v7 = 0;
+      v7 = SEX_MALE;
       break;
     case 4u:
     case 5u:
@@ -627,7 +628,7 @@
     case 0x13u:
     case 0x15u:
     case 0x18u:
-      v7 = 1;
+      v7 = SEX_FEMALE;
       break;
     default:
       break;
@@ -639,7 +640,7 @@
   pPlayers[2].field_1924 = 14;
   pPlayers[2].uVoiceID = 14;
   pPlayers[2].SetInitialStats();
-  v8 = 0;
+  v8 = SEX_MALE;
   switch (pPlayers[2].uVoiceID)
   {
     case 0u:
@@ -654,7 +655,7 @@
     case 0x11u:
     case 0x14u:
     case 0x17u:
-      v8 = 0;
+      v8 = SEX_MALE;
       break;
     case 4u:
     case 5u:
@@ -668,7 +669,7 @@
     case 0x13u:
     case 0x15u:
     case 0x18u:
-      v8 = 1;
+      v8 = SEX_FEMALE;
       break;
     default:
       break;
@@ -680,7 +681,7 @@
   pPlayers[3].field_1924 = 10;
   pPlayers[3].uVoiceID = 10;
   pPlayers[3].SetInitialStats();
-  v9 = 0;
+  v9 = SEX_MALE;
   switch (pPlayers[3].uVoiceID)
   {
     case 0u:
@@ -695,7 +696,7 @@
     case 0x11u:
     case 0x14u:
     case 0x17u:
-      v9 = 0;
+      v9 = SEX_MALE;
       break;
     case 4u:
     case 5u:
@@ -709,7 +710,7 @@
     case 0x13u:
     case 0x15u:
     case 0x18u:
-      v9 = 1;
+      v9 = SEX_FEMALE;
       break;
     default:
       break;
--- a/Player.cpp	Mon Oct 15 18:28:43 2012 +0200
+++ b/Player.cpp	Mon Oct 15 18:45:11 2012 +0200
@@ -4603,17 +4603,8 @@
 //----- (0048E9B7) --------------------------------------------------------
 void Player::RandomizeName()
 {
-  Player *v1; // edi@1
-  int v2; // esi@2
-  int v3; // eax@2
-
-  v1 = this;
-  if ( !this->uExpressionTimePassed )
-  {
-    v2 = this->uSex;
-    v3 = rand();
-    strcpy(v1->pName, pNPCStats->pNPCNames[0][v2 + 2 * v3 % (signed int)pNPCStats->uNumNPCNames[v2]]);
-  }
+  if (!uExpressionTimePassed)
+    strcpy(pName, pNPCStats->pNPCNames[rand() % pNPCStats->uNumNPCNames[uSex]][uSex]);
 }
 
 //----- (0048E9F4) --------------------------------------------------------
@@ -6367,39 +6358,34 @@
 //                     24   zombie female
 enum CHARACTER_RACE Player::GetRace()
 {
-  signed int v1; // ecx@1
-  enum CHARACTER_RACE result; // eax@1
-
-  v1 = this->uFace;
-  result = CHARACTER_RACE_HUMAN;
-  if ( v1 > 15 )
-  {
-    if ( v1 >= 16 && v1 <= 19 )
-      result = CHARACTER_RACE_GOBLIN;
+  if ( uFace > 15 )
+  {
+    if ( uFace >= 16 && uFace <= 19 )
+      return CHARACTER_RACE_GOBLIN;
   }
   else
   {
-    if ( v1 >= 12 )
-    {
-      result = CHARACTER_RACE_DWARF;
+    if ( uFace >= 12 )
+    {
+      return CHARACTER_RACE_DWARF;
     }
     else
     {
-      if ( v1 >= 0 )
-      {
-        if ( v1 <= 7 )
-        {
-          result = CHARACTER_RACE_HUMAN;
+      if ( uFace >= 0 )
+      {
+        if ( uFace <= 7 )
+        {
+          return CHARACTER_RACE_HUMAN;
         }
         else
         {
-          if ( v1 <= 11 )
-            result = (CHARACTER_RACE)1;
-        }
-      }
-    }
-  }
-  return result;
+          if ( uFace <= 11 )
+            return CHARACTER_RACE_ELF;
+        }
+      }
+    }
+  }
+  return CHARACTER_RACE_HUMAN;
 }
 
 //----- (00490141) --------------------------------------------------------
@@ -6447,10 +6433,7 @@
 //----- (00490188) --------------------------------------------------------
 void Player::SetInitialStats()
 {
-  enum CHARACTER_RACE v1; // eax@1
-  int v2; // edx@1
-
-  v1 = GetRace();
+  auto v1 = GetRace();
   uMight = stru_4ED7B0.race[v1].attr[0].uBaseValue;
   uIntelligence = stru_4ED7B0.race[v1].attr[1].uBaseValue;
   uWillpower = stru_4ED7B0.race[v1].attr[2].uBaseValue;
@@ -6499,7 +6482,7 @@
     default:
       break;
   }
-  this->uSex = BYTE4(v1);
+  this->uSex = (PLAYER_SEX)BYTE4(v1);
   return v1;
 }
 
@@ -8503,7 +8486,7 @@
           GameUI_DrawFoodAndGold();
           goto LABEL_124;
         case VAR_Sex:
-          this->uSex = a3;
+          this->uSex = (PLAYER_SEX)a3;
           goto LABEL_124;
         case VAR_Class:
           this->uClass = a3;
@@ -8911,7 +8894,7 @@
               GameUI_DrawFoodAndGold();
               goto _play_sound;
             case VAR_Sex:
-              Dst->uSex = val;
+              Dst->uSex = (PLAYER_SEX)val;
               goto _play_anim_and_exit;
             case VAR_Class:
               Dst->uClass = val;
--- a/Player.h	Mon Oct 15 18:28:43 2012 +0200
+++ b/Player.h	Mon Oct 15 18:45:11 2012 +0200
@@ -182,6 +182,14 @@
 
 
 
+
+
+enum PLAYER_SEX: unsigned __int8
+{
+  SEX_MALE = 0,
+  SEX_FEMALE = 1
+};
+
 #pragma pack(push, 1)
 struct Player
 {
@@ -312,7 +320,7 @@
   __int64 pConditions[20];
   unsigned __int64 uExperience;
   char pName[16];
-  unsigned __int8 uSex;
+  PLAYER_SEX uSex;
   unsigned __int8 uClass;
   unsigned __int8 uFace;
   char field_BB;
--- a/mm7_4.cpp	Mon Oct 15 18:28:43 2012 +0200
+++ b/mm7_4.cpp	Mon Oct 15 18:45:11 2012 +0200
@@ -7569,7 +7569,7 @@
           memcpy(pDst + y * Dst.lPitch / 2,
                  pSrc + y * 640, 8 * sizeof(__int16));
           memcpy(pDst + 8 + 460/*462*/ + y * Dst.lPitch / 2,
-                 pSrc + 8 + 460/*462*/ + y * Dst.lPitch / 2, 174/*172*/ * sizeof(__int16));
+                 pSrc + 8 + 460/*462*/ + y * 640, 174/*172*/ * sizeof(__int16));
         }
 
         for (uint y = 351/*352*/; y < 480; ++y)