changeset 155:2cc68f234b29

Слияние
author Ritor1
date Tue, 27 Nov 2012 23:07:29 +0600
parents d1ea5dda614d (current diff) a8f4a158e284 (diff)
children 6386d105011a
files Party.cpp
diffstat 2 files changed, 40 insertions(+), 36 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Tue Nov 27 23:07:10 2012 +0600
+++ b/Party.cpp	Tue Nov 27 23:07:29 2012 +0600
@@ -285,12 +285,12 @@
   int pResMagicBase; // ecx@1
   Player *pCharacter; // esi@3
   signed int uSpellBookPageCount; // edx@5
-  int v7; // eax@5
+  int pMagicSkills; // eax@5
   int uSkillIdx; // eax@11
-  unsigned __int8 v9; // zf@37
-  char v10; // sf@37
-  unsigned __int8 v11; // of@37
-  char *v12; // eax@38
+  //unsigned __int8 v9; // zf@37
+  //char v10; // sf@37
+  //unsigned __int8 v11; // of@37
+  char *pAttributes; // eax@38
   signed int v13; // ecx@38
   int uMaxSP; // eax@42
   unsigned int v15; // [sp-4h] [bp-44h]@14
@@ -368,31 +368,36 @@
   pParty->pPlayers[3].pActiveSkills[12] = 1;        // fire
   pParty->pPlayers[3].pActiveSkills[0] = 1;         // staff
   pCharacter = &pParty->pPlayers[0];
-  uNumPlayers = 4;
-  while ( 1 )
+  //uNumPlayers = 4;
+  //while ( 1 )
+  for (uNumPlayers = 0; uNumPlayers < 4; uNumPlayers++)
   {
     if ( !pCharacter->uClass )
-      *(short *)pResMagicBase = v3;
+      *(short *)pResMagicBase = v3; //player[i].pResMagicBase
     uSpellBookPageCount = 0;
-    v7 = pResMagicBase - 5726;// pSpellBookPageFlags
-    while ( !*(short *)v7 )
+    //pMagicSkills = pPlayers[uNumPlayers].pActiveSkills[12];// Skills
+    //while ( !*(short *)pMagicSkills )         //player[i].skillFire
+	for (int i = 0; i < 9; i++)
     {
-      ++uSpellBookPageCount;
-      v7 += 2;
-      if ( uSpellBookPageCount >= 9 )
-        goto LABEL_10;
+      //++uSpellBookPageCount;
+      //pMagicSkills++;
+      //if ( uSpellBookPageCount >= 9 )
+        //goto LABEL_10;
+	    if (pPlayers[uNumPlayers].pActiveSkills[12+i])
+			++uSpellBookPageCount;
     }
     pCharacter->pNumSpellBookPage = uSpellBookPageCount;
-LABEL_10:
+//LABEL_10:
     pCharacter->uExpressionTimePassed = 0;
     Dst.Reset();
     if ( bGiveItems )
     {
       pItemsTable->GenerateItem(2, 40, &Dst);
       pCharacter->AddItem2(-1, &Dst);
-      uSkillIdx = 0;
-      v18 = 0;
-      do
+      //uSkillIdx = 0;
+      //v18 = 0;
+      //do
+	  for (uSkillIdx = 0; uSkillIdx < 36; uSkillIdx++)
       {
         if ( pCharacter->pActiveSkills[uSkillIdx] )
         {
@@ -402,7 +407,7 @@
               v15 = ITEM_STAFF_1;
               goto wear_item;
             case PLAYER_SKILL_SWORD:
-              v15 = 1;
+              v15 = ITEM_LONGSWORD_1;
               goto wear_item;
             case PLAYER_SKILL_DAGGER:
               v15 = ITEM_DAGGER_1;
@@ -462,7 +467,7 @@
             case PLAYER_SKILL_TRAP_DISARM:
             case PLAYER_SKILL_LEARNING:
               pCharacter->AddItem(-1, ITEM_POTION_BOTTLE);
-              v16 = 5 * ((rand() % 3) + 40);      // simple reagent
+              v16 = 5 * (rand() % 3 + 40);      // simple reagent
               goto add_item;
             case PLAYER_SKILL_DODGE:
               v16 = ITEM_BOOTS_1;
@@ -476,20 +481,19 @@
               break;
           }
         }
-        uSkillIdx = v18 + 1;
-        v11 = uSkillIdx > 36;
-        v9 = v18 == 35;
-        v10 = uSkillIdx - 35 < 0;
+        //uSkillIdx = v18 + 1;
+        //v11 = uSkillIdx > 36;
+        //v9 = v18 == 35;
+        //v10 = uSkillIdx - 35 < 0;
       }
-      while ( (unsigned __int8)(v10 ^ v11) | v9 );
-      v12 = (char *)&pCharacter->pInventoryItems[0].uAttributes;
+      //while (uSkillIdx < 36);
+      pAttributes = (char *)&pCharacter->pInventoryItems[0].uAttributes;
       //v13 = 138;
-	  for (v13 = 138; v13 > 0; --v13)
-      //do
+      for (v13 = 138; v13 > 0; --v13)
       {
-        if ( *((int *)v12 - 5) )
-          *(int *)v12 |= 1u;
-        v12 += 36;
+        if ( *((int *)pAttributes - 5) )
+          *(int *)pAttributes |= 1;
+        pAttributes += 36;
         //--v13;
       }
       //while ( v13 );
@@ -497,9 +501,9 @@
     pCharacter->sHealth = pCharacter->GetMaxHealth();
     pCharacter->sMana = pCharacter->GetMaxMana();
     pCharacter++;
-    v9 = uNumPlayers-- == 1;
-    if ( v9 )
-      break;
+    //uNumPlayers--;
+    //if (!uNumPlayers)
+      //break;
     pResMagicBase = (int)pCharacter;
     v3 = 10;
   }
--- a/Render.cpp	Tue Nov 27 23:07:10 2012 +0600
+++ b/Render.cpp	Tue Nov 27 23:07:29 2012 +0600
@@ -1850,11 +1850,11 @@
                v13 = v8->vWorldPosition.y + 6.755399441055744e15,
                sY = LODWORD(v13),
                thisd = (v10->vWorldPosition.x + v8->vWorldPosition.x) * 0.5,
-               v14 = WorldPosToGridCellX(COERCE_UNSIGNED_INT64(thisd + 6.755399441055744e15)),
+               v14 = WorldPosToGridCellX(floorf(thisd + 0.5f)),
                v15 = v9->vWorldPosition.y + v8->vWorldPosition.y,
                v89 = v14,
                thise = v15 * 0.5,
-               _this = (LightmapBuilder *)WorldPosToGridCellZ(COERCE_UNSIGNED_INT64(thise + 6.755399441055744e15)),
+               _this = (LightmapBuilder *)WorldPosToGridCellZ(floorf(thisd + 0.5f)),
                WorldPosToGridCellX(sX),
                WorldPosToGridCellZ(sY),
                !byte_4D864C)