changeset 151:a8f4a158e284

ActiveSkill
author Ritor1
date Tue, 27 Nov 2012 17:31:15 +0600
parents 20c034b5a6e2
children e27e846bc996 2cc68f234b29
files Party.cpp Render.cpp
diffstat 2 files changed, 25 insertions(+), 21 deletions(-) [+]
line wrap: on
line diff
--- a/Party.cpp	Mon Nov 26 09:35:24 2012 +0600
+++ b/Party.cpp	Tue Nov 27 17:31:15 2012 +0600
@@ -285,7 +285,7 @@
   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
@@ -368,32 +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; //player[i].pResMagicBase
     uSpellBookPageCount = 0;
-    v7 = pResMagicBase - 5726;// Skills
-    while ( !*(short *)v7 )         //player[i].skillFire  or
-                                    //player[i].pActiveSkills[12]
+    //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] )
         {
@@ -477,12 +481,12 @@
               break;
           }
         }
-        uSkillIdx = v18 + 1;
+        //uSkillIdx = v18 + 1;
         //v11 = uSkillIdx > 36;
         //v9 = v18 == 35;
         //v10 = uSkillIdx - 35 < 0;
       }
-      while (uSkillIdx < 36);
+      //while (uSkillIdx < 36);
       pAttributes = (char *)&pCharacter->pInventoryItems[0].uAttributes;
       //v13 = 138;
       for (v13 = 138; v13 > 0; --v13)
@@ -497,9 +501,9 @@
     pCharacter->sHealth = pCharacter->GetMaxHealth();
     pCharacter->sMana = pCharacter->GetMaxMana();
     pCharacter++;
-    uNumPlayers--;
-    if (!uNumPlayers)
-      break;
+    //uNumPlayers--;
+    //if (!uNumPlayers)
+      //break;
     pResMagicBase = (int)pCharacter;
     v3 = 10;
   }
--- a/Render.cpp	Mon Nov 26 09:35:24 2012 +0600
+++ b/Render.cpp	Tue Nov 27 17:31:15 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)