diff Party.cpp @ 87:c0cf9393af64

Слияние
author Ritor1
date Mon, 29 Oct 2012 09:28:08 +0600
parents 30ec77bbd018
children acf7f12714a7 dac041fc74e8
line wrap: on
line diff
--- a/Party.cpp	Mon Oct 22 09:20:49 2012 +0600
+++ b/Party.cpp	Mon Oct 29 09:28:08 2012 +0600
@@ -280,11 +280,11 @@
 //----- (0049137D) --------------------------------------------------------
 void Party::CreateDefaultParty(char bGiveItems)
 {
-  Party *v2; // esi@1
+  Party *pParty; // esi@1
   signed __int16 v3; // ax@1
-  int v4; // ecx@1
-  Player *v5; // esi@3
-  signed int v6; // edx@5
+  int pResMagicBase; // ecx@1
+  Player *pCharacter; // esi@3
+  signed int uSpellBookPageCount; // edx@5
   int v7; // eax@5
   int uSkillIdx; // eax@11
   unsigned __int8 v9; // zf@37
@@ -292,110 +292,109 @@
   unsigned __int8 v11; // of@37
   char *v12; // eax@38
   signed int v13; // ecx@38
-  int v14; // eax@42
+  int uMaxSP; // eax@42
   unsigned int v15; // [sp-4h] [bp-44h]@14
   unsigned int v16; // [sp-4h] [bp-44h]@26
   int v17; // [sp+10h] [bp-30h]@1
   int v18; // [sp+14h] [bp-2Ch]@11
-  signed int v19; // [sp+18h] [bp-28h]@1
+  signed int uNumPlayers; // [sp+18h] [bp-28h]@1
   ItemGen Dst; // [sp+1Ch] [bp-24h]@10
 
-  v2 = this;
-  strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]);
-  v2->pPlayers[0].field_1928 = 17;
-  v2->pPlayers[0].uFace = 17;
-  v2->pPlayers[0].field_1924 = 17;
-  v2->pPlayers[0].uVoiceID = 17;
-  v2->pPlayers[0].uMight = 30;
-  v2->pPlayers[0].uIntelligence = 5;
-  v2->pPlayers[0].uWillpower = 5;
-  v2->pPlayers[0].uEndurance = 13;
-  v2->pPlayers[0].uAccuracy = 13;
-  v2->pPlayers[0].uSpeed = 14;
-  v2->pPlayers[0].uLuck = 7;
-  v2->pPlayers[0].pActiveSkills[9] = 1;         // leather
-  v2->pPlayers[0].pActiveSkills[33] = 1;        // armsmaster
-  v2->pPlayers[0].pActiveSkills[5] = 1;         // bow
-  v2->pPlayers[0].pActiveSkills[1] = 1;         // sword
-  v2->pPlayers[1].field_1928 = 3;
-  v2->pPlayers[1].uFace = 3;
-  v2->pPlayers[1].field_1924 = 3;
-  v2->pPlayers[1].uVoiceID = 3;
-  strcpy(v2->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]);
-  v2->pPlayers[1].uMight = 13;
-  v2->pPlayers[1].uIntelligence = 9;
-  v2->pPlayers[1].uWillpower = 9;
-  v2->pPlayers[1].uEndurance = 13;
-  v2->pPlayers[1].uAccuracy = 13;
-  v2->pPlayers[1].uSpeed = 13;
-  v2->pPlayers[1].uLuck = 13;
-  v2->pPlayers[1].pActiveSkills[9] = 1;         // leather
-  v2->pPlayers[1].pActiveSkills[34] = 1;        // stealing
-  v2->pPlayers[1].pActiveSkills[2] = 1;         // dagger
-  v2->pPlayers[1].pActiveSkills[29] = 1;        // disarm trap
-  v2->pPlayers[2].field_1928 = 14;
-  v2->pPlayers[2].uFace = 14;
-  v2->pPlayers[2].field_1924 = 14;
-  v2->pPlayers[2].uVoiceID = 14;
-  strcpy(v2->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]);
-  v2->pPlayers[2].uMight = 12;
-  v2->pPlayers[2].uIntelligence = 9;
-  v2->pPlayers[2].uWillpower = 20;
-  v2->pPlayers[2].uEndurance = 22;
-  v2->pPlayers[2].uAccuracy = 7;
-  v2->pPlayers[2].uSpeed = 13;
-  v2->pPlayers[2].uLuck = 7;
-  v2->pPlayers[2].pActiveSkills[35] = 1;        // alchemy
-  v2->pPlayers[2].pActiveSkills[9] = 1;         // leather
-  v2->pPlayers[2].pActiveSkills[18] = 1;        // body
-  v2->pPlayers[2].pActiveSkills[6] = 1;         // mace
-  strcpy(v2->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]);
+  pParty = this;
+  strcpy(this->pPlayers[0].pName, pGlobalTXT_LocalizationStrings[509]); //Zoltan
+  pParty->pPlayers[0].field_1928 = 17;
+  pParty->pPlayers[0].uFace = 17;
+  pParty->pPlayers[0].field_1924 = 17;
+  pParty->pPlayers[0].uVoiceID = 17;
+  pParty->pPlayers[0].uMight = 30;
+  pParty->pPlayers[0].uIntelligence = 5;
+  pParty->pPlayers[0].uWillpower = 5;
+  pParty->pPlayers[0].uEndurance = 13;
+  pParty->pPlayers[0].uAccuracy = 13;
+  pParty->pPlayers[0].uSpeed = 14;
+  pParty->pPlayers[0].uLuck = 7;
+  pParty->pPlayers[0].pActiveSkills[9] = 1;         // leather
+  pParty->pPlayers[0].pActiveSkills[33] = 1;        // armsmaster
+  pParty->pPlayers[0].pActiveSkills[5] = 1;         // bow
+  pParty->pPlayers[0].pActiveSkills[1] = 1;         // sword
+  pParty->pPlayers[1].field_1928 = 3;
+  pParty->pPlayers[1].uFace = 3;
+  pParty->pPlayers[1].field_1924 = 3;
+  pParty->pPlayers[1].uVoiceID = 3;
+  strcpy(pParty->pPlayers[1].pName, pGlobalTXT_LocalizationStrings[506]); //Roderic
+  pParty->pPlayers[1].uMight = 13;
+  pParty->pPlayers[1].uIntelligence = 9;
+  pParty->pPlayers[1].uWillpower = 9;
+  pParty->pPlayers[1].uEndurance = 13;
+  pParty->pPlayers[1].uAccuracy = 13;
+  pParty->pPlayers[1].uSpeed = 13;
+  pParty->pPlayers[1].uLuck = 13;
+  pParty->pPlayers[1].pActiveSkills[9] = 1;         // leather
+  pParty->pPlayers[1].pActiveSkills[34] = 1;        // stealing
+  pParty->pPlayers[1].pActiveSkills[2] = 1;         // dagger
+  pParty->pPlayers[1].pActiveSkills[29] = 1;        // disarm trap
+  pParty->pPlayers[2].field_1928 = 14;
+  pParty->pPlayers[2].uFace = 14;
+  pParty->pPlayers[2].field_1924 = 14;
+  pParty->pPlayers[2].uVoiceID = 14;
+  strcpy(pParty->pPlayers[2].pName, pGlobalTXT_LocalizationStrings[508]); // Serena
+  pParty->pPlayers[2].uMight = 12;
+  pParty->pPlayers[2].uIntelligence = 9;
+  pParty->pPlayers[2].uWillpower = 20;
+  pParty->pPlayers[2].uEndurance = 22;
+  pParty->pPlayers[2].uAccuracy = 7;
+  pParty->pPlayers[2].uSpeed = 13;
+  pParty->pPlayers[2].uLuck = 7;
+  pParty->pPlayers[2].pActiveSkills[35] = 1;        // alchemy
+  pParty->pPlayers[2].pActiveSkills[9] = 1;         // leather
+  pParty->pPlayers[2].pActiveSkills[18] = 1;        // body
+  pParty->pPlayers[2].pActiveSkills[6] = 1;         // mace
+  strcpy(pParty->pPlayers[3].pName, pGlobalTXT_LocalizationStrings[507]); // Alexis
   v3 = 10;
-  v2->pPlayers[3].field_1928 = 10;
-  v2->pPlayers[3].uFace = 10;
-  v4 = (int)&v2->pPlayers[0].sResMagicBase;
-  v2->pPlayers[3].uEndurance = 13;
-  v2->pPlayers[3].uAccuracy = 13;
-  v2->pPlayers[3].uSpeed = 13;
-  v2->pPlayers[3].field_1924 = 10;
-  v2->pPlayers[3].uVoiceID = 10;
-  v2->pPlayers[3].uMight = 5;
-  v2->pPlayers[3].uIntelligence = 30;
-  v2->pPlayers[3].uWillpower = 9;
-  v2->pPlayers[3].uLuck = 7;
-  v2->pPlayers[3].pActiveSkills[9] = 1;         // leather
-  v2->pPlayers[3].pActiveSkills[13] = 1;        // air
-  v2->pPlayers[3].pActiveSkills[12] = 1;        // fire
-  v2->pPlayers[3].pActiveSkills[0] = 1;         // staff
-  v17 = (int)&v2->pPlayers[0].sResMagicBase;
-  v19 = 4;
+  pParty->pPlayers[3].field_1928 = 10;
+  pParty->pPlayers[3].uFace = 10;
+  pResMagicBase = (int)&pParty->pPlayers[0].sResMagicBase;
+  pParty->pPlayers[3].uEndurance = 13;
+  pParty->pPlayers[3].uAccuracy = 13;
+  pParty->pPlayers[3].uSpeed = 13;
+  pParty->pPlayers[3].field_1924 = 10;
+  pParty->pPlayers[3].uVoiceID = 10;
+  pParty->pPlayers[3].uMight = 5;
+  pParty->pPlayers[3].uIntelligence = 30;
+  pParty->pPlayers[3].uWillpower = 9;
+  pParty->pPlayers[3].uLuck = 7;
+  pParty->pPlayers[3].pActiveSkills[9] = 1;         // leather
+  pParty->pPlayers[3].pActiveSkills[13] = 1;        // air
+  pParty->pPlayers[3].pActiveSkills[12] = 1;        // fire
+  pParty->pPlayers[3].pActiveSkills[0] = 1;         // staff
+  pCharacter = &pParty->pPlayers[0];
+  uNumPlayers = 4;
   while ( 1 )
   {
-    v5 = (Player *)(v4 - 6014);
-    if ( !*(char *)(v4 - 5829) )
-      *(short *)v4 = v3;
-    v6 = 0;
-    v7 = v4 - 5726;
+    if ( !pCharacter->uClass )
+      *(short *)pResMagicBase = v3;
+    uSpellBookPageCount = 0;
+    v7 = pResMagicBase - 5726;// Skills
     while ( !*(short *)v7 )
     {
-      ++v6;
+      ++uSpellBookPageCount;
       v7 += 2;
-      if ( v6 >= 9 )
+      if ( uSpellBookPageCount >= 9 )
         goto LABEL_10;
     }
-    v5->field_1A4E = v6;
+    pCharacter->pNumSpellBookPage = uSpellBookPageCount;
 LABEL_10:
-    v5->uExpressionTimePassed = 0;
+    pCharacter->uExpressionTimePassed = 0;
     Dst.Reset();
     if ( bGiveItems )
     {
       pItemsTable->GenerateItem(2, 40, &Dst);
-      v5->AddItem2(0xFFFFFFFFu, &Dst);
+      pCharacter->AddItem2(-1, &Dst);
       uSkillIdx = 0;
       v18 = 0;
       do
       {
-        if ( v5->pActiveSkills[uSkillIdx] )
+        if ( pCharacter->pActiveSkills[uSkillIdx] )
         {
           switch ( uSkillIdx )
           {
@@ -432,7 +431,7 @@
             case PLAYER_SKILL_PLATE:
               v15 = ITEM_PLATE_1;
 wear_item:
-              v5->WearItem(v15);
+              pCharacter->WearItem(v15);
               break;
             case PLAYER_SKILL_FIRE:
               v16 = ITEM_SPELLBOOK_FIRE_STRIKE;
@@ -462,7 +461,7 @@
             case PLAYER_SKILL_DIPLOMACY:
             case PLAYER_SKILL_TRAP_DISARM:
             case PLAYER_SKILL_LEARNING:
-              v5->AddItem(0xFFFFFFFFu, ITEM_POTION_BOTTLE);
+              pCharacter->AddItem(-1, ITEM_POTION_BOTTLE);
               v16 = 5 * (rand() % 3 + 40);      // simple reagent
               goto add_item;
             case PLAYER_SKILL_DODGE:
@@ -471,7 +470,7 @@
             case PLAYER_SKILL_UNARMED:
               v16 = ITEM_GAUNTLETS_1;
 add_item:
-              v5->AddItem(0xFFFFFFFFu, v16);
+              pCharacter->AddItem(-1, v16);
               break;
             default:
               break;
@@ -483,7 +482,7 @@
         v10 = v18++ - 35 < 0;
       }
       while ( (unsigned __int8)(v10 ^ v11) | v9 );
-      v12 = (char *)&v5->pInventoryItems[0].uAttributes;
+      v12 = (char *)&pCharacter->pInventoryItems[0].uAttributes;
       v13 = 138;
       do
       {
@@ -494,14 +493,13 @@
       }
       while ( v13 );
     }
-    v5->sHealth = v5->GetMaxHealth();
-    v14 = v5->GetMaxMana();
-    v17 += 6972;
-    v9 = v19-- == 1;
-    v5->sMana = v14;
+    pCharacter->sHealth = pCharacter->GetMaxHealth();
+    pCharacter->sMana = pCharacter->GetMaxMana();
+    pCharacter++;
+    v9 = uNumPlayers-- == 1;
     if ( v9 )
       break;
-    v4 = v17;
+    pResMagicBase = (int)pCharacter;
     v3 = 10;
   }
 }
@@ -777,8 +775,8 @@
         if ( ((Actor *)((char *)v0 - 59))->Actor::CanAct() && *((char *)v0 + 2) != 4 && *(char *)v0 != 5 )
         {
           v1 = abs(*(short *)((char *)v0 + 83) - pParty->vPosition.x);
-          v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.z);
-          v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.y);
+          v2 = abs(*(short *)((char *)v0 + 85) - pParty->vPosition.y);
+          v3 = abs(*(short *)((char *)v0 + 87) - pParty->vPosition.z);
           if ( (double)sub_4621DA(v1, v2, v3) < 512.0 )
             Actor::_402968(v4, 4, 0, 0);
         }