changeset 83:be45fc285970

random fixes
author zipi
date Mon, 04 Feb 2013 00:08:43 +0000
parents 1faa29fd4c2d
children 170259c8c71f
files Outdoor.cpp Party.cpp
diffstat 2 files changed, 55 insertions(+), 55 deletions(-) [+]
line wrap: on
line diff
--- a/Outdoor.cpp	Sun Feb 03 23:37:17 2013 +0000
+++ b/Outdoor.cpp	Mon Feb 04 00:08:43 2013 +0000
@@ -89,27 +89,27 @@
     if ( !pRenderer->pRenderD3D )
     {
       pRenderer->OnOutdoorRedrawSW();
-      goto LABEL_16;
     }
-    //goto LABEL_14;
-	pRenderer->DrawSkyD3D();
-    pRenderer->DrawBuildingsD3D();
-    pRenderer->DrawBezierTerrain();
-    goto LABEL_16;
+	else
+	{
+		pRenderer->DrawSkyD3D();
+		pRenderer->DrawBuildingsD3D();
+		pRenderer->DrawBezierTerrain();
+	}
   }
-  if ( pRenderer->pRenderD3D )
+  else if ( pRenderer->pRenderD3D )
   {
-//LABEL_14:
     pRenderer->DrawSkyD3D();
     pRenderer->DrawBuildingsD3D();
     pRenderer->DrawBezierTerrain();// Ritor1: sometimes crash
-    goto LABEL_16;
   }
-  pRenderer->DrawBuildingsSW();
-  pRenderer->DrawBezierTerrain();
-  sr_sub_486F92_MessWithEdgesAndSpans();
-  pOutdoorCamera->_487355();
-LABEL_16:
+  else
+  {
+	pRenderer->DrawBuildingsSW();
+	pRenderer->DrawBezierTerrain();
+	sr_sub_486F92_MessWithEdgesAndSpans();
+	pOutdoorCamera->_487355();
+  }
   pMobileLightsStack->uNumLightsActive = 0;
   pStationaryLightsStack->uNumLightsActive = 0;
   if ( !pRenderer->pRenderD3D )
@@ -2893,7 +2893,7 @@
 unsigned int OutdoorLocation::DrawActors()
 {
   unsigned int result; // eax@1
-  char *v1; // edi@2
+  Actor *v1; // edi@2
   __int16 v2; // ax@3
   int v3; // esi@5
   float v4; // ST48_4@8
@@ -2961,23 +2961,23 @@
   if ( (signed int)uNumActors > 0 )
   {
     v54 = 0;
-    v1 = (char *)&pActors[0].vPosition.z;
+    v1 = pActors;//[0].vPosition.z;
     do
     {
-      v2 = *((short *)v1 + 15);
-      *(int *)(v1 - 110) &= 0xFFFFFFF7u;
+	  v2 = v1->uAIState;
+	  v1->uAttributes &= 0xFFFFFFF7u;
       if ( v2 == 11 || v2 == 19 )
         goto LABEL_58;
-      v3 = *(short *)v1;
+	  v3 = v1->vPosition.z;
       v49 = 0;
-      x = *((short *)v1 - 2);
-      y = *((short *)v1 - 1);
-      v61 = *(short *)v1;
+	  x = v1->vPosition.x;
+	  y = v1->vPosition.y;
+	  v61 = v1->vPosition.z;
       if ( v2 == 17 )
       {
-        if ( (v1[666] & 7) != 3 || pActors[*(int *)(v1 + 666) >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 )
+		if ( (v1->uSummonerID & 7) != 3 || pActors[v1->uSummonerID >> 3].pMonsterInfo.uSpecialAbilityDamageDiceSides != 1 )
         {
-          v6 = (double)*((short *)v1 - 4) * 0.5;
+			v6 = (double)v1->uActorHeight * 0.5;
           v7 = v6 + 6.7553994e15;
           v3 += LODWORD(v7);
           v61 = v3;
@@ -2985,31 +2985,31 @@
         else
         {
           v49 = 1;
-          pGame->pStru6Instance->_4A7F74(*((short *)v1 - 2), *((short *)v1 - 1), v3);
+		  pGame->pStru6Instance->_4A7F74(v1->vPosition.x, v1->vPosition.y, v3);
           v4 = (1.0 - (double)*(signed int *)(v1 + 38) / (double)*((short *)v1 + 7))
-             * (double)(2 * (signed int)*((short *)v1 - 4));
+			  * (double)(2 * (signed int)v1->uActorHeight);
           v5 = v4 + 6.7553994e15;
           v3 -= LODWORD(v5);
           v61 = v3;
-          if ( v3 > *(short *)v1 )
+          if ( v3 > v1->vPosition.z )
           {
-            v61 = *(short *)v1;
-            v3 = *(short *)v1;
+            v61 = v1->vPosition.z;
+            v3 = v1->vPosition.z;
           }
         }
       }
       v8 = stru_5C6E00->Atan2(
-             *((short *)v1 - 2) - pIndoorCamera->pos.x,
-             *((short *)v1 - 1) - pIndoorCamera->pos.y);
-      LOWORD(v9) = *((short *)v1 + 4);
+             v1->vPosition.x - pIndoorCamera->pos.x,
+             v1->vPosition.y - pIndoorCamera->pos.y);
+	  LOWORD(v9) = v1->uYawAngle;
       v41 = ((signed int)(stru_5C6E00->uIntegerPi + ((signed int)stru_5C6E00->uIntegerPi >> 3) + v9 - v8) >> 8) & 7;
-      v10 = *((short *)v1 + 16);
+	  v10 = v1->uCurrentActionAnimation;
       if ( pParty->bTurnBasedModeOn )
       {
         if ( v10 != 1 )
         {
 LABEL_17:
-          v12 = *(int *)(v1 + 38);
+			v12 = v1->uCurrentActionTime;
           goto LABEL_18;
         }
         v11 = pMiscTimer->uTotalGameTimeElapsed;
@@ -3022,9 +3022,9 @@
       }
       v12 = v54 + v11;
 LABEL_18:
-      if ( *(_QWORD *)(v1 + 146) > 0i64 || *(_QWORD *)(v1 + 162) > 0i64 )
+      if ( (signed __int64)v1->pActorBuffs[5].uExpireTime > 0 || (signed __int64)v1->pActorBuffs[6].uExpireTime > 0 )
         v12 = 0;
-      v13 = *((short *)v1 + 15);
+	  v13 = v1->uAIState;
       if ( v13 == 17 && !v49 )
       {
         v40 = v12;
@@ -3034,7 +3034,7 @@
         goto LABEL_25;
       }
       v40 = v12;
-      v39 = *(short *)&v1[2 * v10 + 42];
+	  v39 = v1->pSpriteIDs[v10];
       if ( v13 != 16 )
         goto LABEL_24;
       v14 = pSpriteFrameTable->GetFrameBy_x(v39, v12);
@@ -3111,20 +3111,20 @@
           return result;
         ++uNumBillboardsToDraw;
         ++uNumSpritesDrawnThisFrame;
-        *(int *)(v1 - 110) |= 8u;
+		v1->uAttributes |= 8u;
         v28->uHwSpriteID = v15->pHwSpriteIDs[v41];
         v29 = v15->uPaletteIndex;
         v28->uIndoorSectorID = 0;
         v28->uPalette = v29;
         v28->field_0 = (unsigned __int64)(v15->scale * (signed __int64)v58) >> 16;
-        v30 = *(int *)(v1 + 118) == 0;
-        v31 = *(int *)(v1 + 118) < 0;
+        v30 = HIDWORD(v1->pActorBuffs[3].uExpireTime) == 0;
+        v31 = SHIDWORD(v1->pActorBuffs[3].uExpireTime) < 0;
         v28->field_4 = (unsigned __int64)(v15->scale * (signed __int64)v57) >> 16;
-        if ( v31 || v31 | v30 && *(int *)(v1 + 114) <= 0u )
+        if ( v31 || v31 | v30 && LODWORD(v1->pActorBuffs[3].uExpireTime) <= 0u )
         {
-          if ( *(_QWORD *)(v1 + 226) > 0i64 )
+          if ( (signed __int64)v1->pActorBuffs[10].uExpireTime > 0i64 )
           {
-            v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F((Actor *)(v1 - 146))
+            v52 = (unsigned __int64)(pGame->pStru6Instance->_4A806F(v1)
                                    * (signed __int64)v28->field_4) >> 16;
 LABEL_53:
             LOWORD(v27) = v43;
@@ -3133,10 +3133,10 @@
         }
         else
         {
-          v32 = *((short *)v1 + 61);
+          v32 = v1->pActorBuffs[3].uPower;
           if ( v32 )
           {
-            v33 = *((short *)v1 + 61);
+            v33 = v1->pActorBuffs[3].uPower;
             v28->field_0 = (unsigned __int64)(65536 / (unsigned __int16)v32 * (signed __int64)v28->field_0) >> 16;
             v52 = (unsigned __int64)(65536 / v33 * (signed __int64)v28->field_4) >> 16;
             goto LABEL_53;
@@ -3153,20 +3153,20 @@
         v28->sZValue = v34 + (8 * v59 | 3);
         v28->field_14 = v59;
         v35 = pMonsterList->pMonsters;
-        v36 = *((short *)v1 - 25);
-        v37 = *(int *)(v1 + 150) == 0;
-        v38 = *(int *)(v1 + 150) < 0;
+		v36 = v1->pMonsterInfo.uID;
+        v37 = HIDWORD(v1->pActorBuffs[5].uExpireTime) == 0;
+        v38 = SHIDWORD(v1->pActorBuffs[5].uExpireTime) < 0;
         v28->field_1E = v62 | 0x200;
         v28->pSpriteFrame = v15;
         v28->uTintColor = *((int *)&v35[v36] - 36);
-        if ( !v38 && (!(v38 | v37) || *(int *)(v1 + 146)) )
+        if ( !v38 && (!(v38 | v37) || LODWORD(v1->pActorBuffs[5].uExpireTime)) )
           v28->field_1E = v62 | 0x200;
       }
 LABEL_58:
       ++v59;
       v54 += 32;
       result = v59;
-      v1 += 836;
+      ++v1;
     }
     while ( v59 < (signed int)uNumActors );
   }
--- a/Party.cpp	Sun Feb 03 23:37:17 2013 +0000
+++ b/Party.cpp	Mon Feb 04 00:08:43 2013 +0000
@@ -889,7 +889,7 @@
     v11 = 4;
     do
     {
-      v2 = ((Player *)(v1 - 6812))->GetMajorConditionIdx();
+      v2 = v1->GetMajorConditionIdx();
       if ( v2 == 18 || v2 == 17 )
       {
         v1->uExpressionTimePassed += LOWORD(pMiscTimer->uTimeElapsed);
@@ -1111,7 +1111,7 @@
   SpellBuff *v4; // edi@4
   int v5; // eax@9
   char v6; // zf@9
-  char *v7; // eax@10
+  ItemGen *v7; // eax@10
   signed int v8; // ecx@10
   int v9; // eax@18
   int v10; // eax@25
@@ -1163,13 +1163,13 @@
     if ( v6 )
     {
       v14 = 0;
-      v7 = &v2->pInventoryItems[0].field_1A;
+      v7 = v2->pInventoryItems;//[0].field_1A;
       v8 = 138;
       do
       {
-        if ( *(int *)(v7 - 26) == 601 && (unsigned __int8)*v7 == v15 + 1 )
+		if ( v7->uItemID == 601 && (unsigned __int8)v7->field_1A== v15 + 1 )
           v14 = 1;
-        v7 += 36;
+        ++v7;
         --v8;
       }
       while ( v8 );