changeset 554:9caf59edb1ee

Cave and Temple load and even doesn't crash (for a while).
author Nomad
date Mon, 04 Mar 2013 22:44:41 +0200
parents bee46636df95
children a09757c2c5e1
files GUIWindow.cpp Indoor.cpp Indoor.h Player.cpp Player.h mm7_2.cpp mm7_3.cpp mm7_4.cpp mm7_5.cpp
diffstat 9 files changed, 45 insertions(+), 45 deletions(-) [+]
line wrap: on
line diff
--- a/GUIWindow.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/GUIWindow.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -203,10 +203,7 @@
         uFramesetID = 1;
       if ( pPlayer->expression == CHARACTER_EXPRESSION_21)
       {
-        v15 = pPlayerFrameTable->GetFrameBy_y(
-                &pPlayer->field_1AA8,
-                &pPlayer->field_1AA4,
-                pMiscTimer->uTimeElapsed);
+        v15 = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed);
       }
       else
       {
--- a/Indoor.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/Indoor.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -2679,28 +2679,28 @@
     j += pSector->uNumFloors;
 
     pSector->pWalls = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_C;
+    j += pSector->uNumWalls;
 
     pSector->pCeilings = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_14;
+    j += pSector->uNumCeilings;
 
     pSector->pFluids = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_1C;
+    j += pSector->uNumFluids;
 
     pSector->pPortals = ptr_0002B0_sector_rdata + j;
     j += pSector->uNumPortals;
 
     pSector->pFaceIDs = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_2C;
+    j += pSector->uNumFaces;
 
     pSector->pCogs = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_3C;
+    j += pSector->uNumCogs;
 
     pSector->pDecorationIDs = ptr_0002B0_sector_rdata + j;
     j += pSector->uNumDecorations;
 
     pSector->pMarkers = ptr_0002B0_sector_rdata + j;
-    j += pSector->field_4C;
+    j += pSector->uNumMarkers;
 
 
     //do
@@ -2758,8 +2758,8 @@
 
   for (uint i = 0, j = 0; i < uNumSectors; ++i)
   {
-    pSectors->pLights = (unsigned __int16 *)(ptr_0002B8_sector_lrdata + j);
-    j += pSectors->uNumLights;
+    pSectors[i].pLights = ptr_0002B8_sector_lrdata + j;
+    j += pSectors[i].uNumLights;
   }
 
   pGameLoadingUI_ProgressBar->Progress();
@@ -3712,8 +3712,7 @@
             v25 = abs(v15->pFacePlane_old.vNormal.z);
             //v26 = v87;
             if ( v24 > v25 )
-              Abortf(
-                "Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]",
+              Abortf("Door Error\ndoor id: %i\nfacet no: %i\n\nOverflow dividing facet->d [%i] by facet->nz [%i]",
                 door->uDoorID,
                 door->pFaceIDs[v88],
                 v15->pFacePlane_old.dist,
@@ -3886,7 +3885,9 @@
           }
           //v2 = v87;
         }
-        LOWORD(v39) = v84 + ((signed __int16)v39 != -1 ? pBitmaps_LOD->pTextures[(signed __int16)v39].uTextureWidth : 24);
+        LOWORD(v39) = v84;
+        if (v15->uBitmapID != -1)
+          LOWORD(v39) += pBitmaps_LOD->pTextures[v15->uBitmapID].uTextureWidth;
 LABEL_50:
         v28->sTextureDeltaU -= v39;
         goto LABEL_51;
--- a/Indoor.h	Mon Mar 04 20:29:31 2013 +0200
+++ b/Indoor.h	Mon Mar 04 22:44:41 2013 +0200
@@ -347,34 +347,34 @@
   unsigned __int16 uNumFloors;
   __int16 field_6;
   unsigned __int16 *pFloors;
-  __int16 field_C;
+  unsigned __int16 uNumWalls;
   __int16 field_E;
   unsigned __int16 *pWalls;
-  __int16 field_14;
+  unsigned __int16 uNumCeilings;
   __int16 field_16;
   unsigned __int16 *pCeilings;
-  __int16 field_1C;
+  unsigned __int16 uNumFluids;
   __int16 field_1E;
   unsigned __int16 *pFluids;
   __int16 uNumPortals;
   __int16 field_26;
   unsigned __int16 *pPortals;
-  __int16 field_2C;
-  __int16 uNumNonBSPFaces;
+  unsigned __int16 uNumFaces;
+  unsigned __int16 uNumNonBSPFaces;
   unsigned __int16 *pFaceIDs;
-  __int16 uNumCylinderFaces;
+  unsigned __int16 uNumCylinderFaces;
   __int16 field_36;
   int pCylinderFaces;
-  __int16 field_3C;
+  unsigned __int16 uNumCogs;
   __int16 field_3E;
   unsigned __int16 *pCogs;
   unsigned __int16 uNumDecorations;
   __int16 field_46;
   unsigned __int16 *pDecorationIDs;
-  __int16 field_4C;
+  unsigned __int16 uNumMarkers;
   __int16 field_4E;
   unsigned __int16 *pMarkers;
-  __int16 uNumLights;
+  unsigned __int16 uNumLights;
   __int16 field_56;
   unsigned __int16 *pLights;
   __int16 uWaterLevel;
--- a/Player.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/Player.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -2298,6 +2298,9 @@
   field_100 = 0;
   field_104 = 0;
 
+  _expression21_animtime = 0;
+  _expression21_frameset = 0;
+
   lastOpenedSpellbookPage = 0;
 }
 
--- a/Player.h	Mon Mar 04 20:29:31 2013 +0200
+++ b/Player.h	Mon Mar 04 22:44:41 2013 +0200
@@ -717,8 +717,8 @@
   unsigned __int16 uExpressionTimePassed;
   unsigned __int16 uExpressionTimeLength;
   __int16 field_1AA2;
-  int field_1AA4;
-  int field_1AA8;
+  int _expression21_animtime;
+  int _expression21_frameset;
   LloydBeacon pInstalledBeacons[5];
   char uNumDivineInterventionCastsThisDay;
   char uNumArmageddonCasts;
--- a/mm7_2.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/mm7_2.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -13349,7 +13349,7 @@
   assert(sizeof(GUIProgressBar) == 0x1B8);
   assert(sizeof(GUIFont) == 0x1020);
   assert(sizeof(stru262_TurnBased) == 0x40);
-  assert(sizeof(ArcomageGame) == 0xFA);
+  assert(sizeof(ArcomageGame) == 0xFB);
   assert(sizeof(stru277) == 0x14);
   assert(sizeof(ArcomageCard) == 0x6C);
   assert(sizeof(stru320) == 0x3FC);
--- a/mm7_3.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/mm7_3.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -125,7 +125,7 @@
     {
       v9 = &pIndoor->pSectors[v33[result]];
       v10 = 0;
-      v32 = v9->uNumFloors + v9->field_C + v9->field_14;
+      v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings;
       v26 = 0;
       if ( v32 > 0 )
         break;
@@ -1526,7 +1526,6 @@
   int v7; // [sp+10h] [bp-8h]@1
   signed int v8; // [sp+14h] [bp-4h]@1
 
-  __debugbreak();
   v5 = x - 2;
   v7 = x;
   v8 = y;
@@ -1650,10 +1649,10 @@
   v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
   if ( pParty->bFlying )
   {
-    pParty->bFlying = 0;
-    __debugbreak();
+    pParty->bFlying = false;
     if (pParty->FlyActive())
-      stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing]
+      pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
+      //stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing]
   }
   if ( v80 == -30000 )
   {
--- a/mm7_4.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/mm7_4.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -3210,7 +3210,7 @@
     if ( v7 == 0 )
       v7 = 1;
     if (pPlayer->expression == CHARACTER_EXPRESSION_21)
-      pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->field_1AA8, &pPlayer->field_1AA4, pMiscTimer->uTimeElapsed);
+      pFrame = pPlayerFrameTable->GetFrameBy_y(&pPlayer->_expression21_frameset, &pPlayer->_expression21_animtime, pMiscTimer->uTimeElapsed);
     else
       pFrame = pPlayerFrameTable->GetFrameBy_x(v7, pPlayer->uExpressionTimePassed);
     if (pPlayer->field_1AA2 != pFrame->uTextureID - 1 || v22 )
@@ -4335,25 +4335,25 @@
 }
 
 //----- (00494B5E) --------------------------------------------------------
-PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *a2, int *a3, int a4)
+PlayerFrame *PlayerFrameTable::GetFrameBy_y(int *pFramesetID, int *pAnimTime, int a4)
 {
   PlayerFrameTable *v4; // edi@1
   int v5; // esi@1
   int v6; // eax@2
 
   v4 = this;
-  v5 = a4 + *a3;
-  if ( v5 < 8 * this->pFrames[*a2].uAnimTime )
-  {
-    *a3 = v5;
+  v5 = a4 + *pAnimTime;
+  if ( v5 < 8 * this->pFrames[*pFramesetID].uAnimTime )
+  {
+    *pAnimTime = v5;
   }
   else
   {
     v6 = rand() % 4 + 21;
-    *a2 = v6;
-    *a3 = 8 * v5 % v4->pFrames[v6].uAnimTime;
-  }
-  return &v4->pFrames[*a2];
+    *pFramesetID = v6;
+    *pAnimTime = 8 * v5 % v4->pFrames[v6].uAnimTime;
+  }
+  return &v4->pFrames[*pFramesetID];
 }
 
 //----- (00494BC3) --------------------------------------------------------
--- a/mm7_5.cpp	Mon Mar 04 20:29:31 2013 +0200
+++ b/mm7_5.cpp	Mon Mar 04 22:44:41 2013 +0200
@@ -11561,7 +11561,7 @@
       v61 = 116 * v59;
       sDepthb = 0;
       for ( i = 116 * v59;
-            sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->field_C + v61)
+            sDepthb < *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v61)
                     + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v61);
             ++sDepthb )
       {
@@ -11715,7 +11715,7 @@
       v89 = 116 * v87;
       v162 = 0;
       v112 = v89;
-      if ( *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89)
+      if ( *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89)
          + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) > 0 )
         break;
 LABEL_148:
@@ -11795,7 +11795,7 @@
 LABEL_145:
       v88 = pIndoor->pSectors;
       ++v162;
-      if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->field_C + v89)
+      if ( v162 >= *(__int16 *)((char *)&pIndoor->pSectors->uNumWalls + v89)
                  + 2 * *(__int16 *)((char *)&pIndoor->pSectors->uNumFloors + v89) )
         goto LABEL_148;
     }