changeset 2140:4c0c475917dd

drawing items in the dragon's cave and GetFloorLevel for BModels
author Ritor1
date Thu, 02 Jan 2014 17:56:55 +0600
parents f9b55be70c1b
children 1283eedcc028
files AudioPlayer.cpp Indoor.cpp Outdoor.cpp mm7_data.cpp mm7_data.h
diffstat 5 files changed, 21 insertions(+), 17 deletions(-) [+]
line wrap: on
line diff
--- a/AudioPlayer.cpp	Thu Jan 02 09:11:28 2014 +0600
+++ b/AudioPlayer.cpp	Thu Jan 02 17:56:55 2014 +0600
@@ -1952,7 +1952,7 @@
 
       case OBJECT_Item:
       {
-        assert(source_id < uNumSpriteObjects);
+        //assert(source_id < uNumSpriteObjects); // Ritor1:в ида до и после перехода одинаково
 
         //source_x = pSpriteObjects[source_id].vPosition.x;
         //source_y = pSpriteObjects[source_id].vPosition.y;
--- a/Indoor.cpp	Thu Jan 02 09:11:28 2014 +0600
+++ b/Indoor.cpp	Thu Jan 02 17:56:55 2014 +0600
@@ -2204,7 +2204,7 @@
  
     if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100))
     {
-      pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID - 1].uSpriteID;
+      pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID].uSpriteID;
 
       uint uObjectID = 0;
       for (uint j = 0; j < pObjectList->uNumObjects; ++j)
--- a/Outdoor.cpp	Thu Jan 02 09:11:28 2014 +0600
+++ b/Outdoor.cpp	Thu Jan 02 17:56:55 2014 +0600
@@ -3150,8 +3150,8 @@
   signed int next_floor_level; // [sp+58h] [bp+18h]@43
 
   v46 = 1;
-  dword_721160[0] = -1;
-  dword_721110[0] = -1;
+  current_BModel_id[0] = -1;
+  current_Face_id[0] = -1;
   odm_floor_level[0] = GetTerrainHeightsAroundParty2(X, Y, pIsOnWater, bWaterWalk);
   
   for ( pBModelNum = 0; pBModelNum < pOutdoor->uNumBModels; ++pBModelNum )
@@ -3176,9 +3176,9 @@
               for ( uint i = 0; i < pFace->uNumVertices; ++i)
               {
                 odm_floor_face_vert_coord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x;
-                odm_floor_face_vert_coord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
-                odm_floor_face_vert_coord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
-                odm_floor_face_vert_coord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
+                odm_floor_face_vert_coord_Y[2 * i] = pFace->pYInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y;
+                odm_floor_face_vert_coord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x;
+                odm_floor_face_vert_coord_Y[2 * i + 1] = pFace->pYInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y;
               }
             odm_floor_face_vert_coord_X[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_X[0];
             odm_floor_face_vert_coord_Y[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_Y[0];
@@ -3221,12 +3221,16 @@
                 if ( pFace->uPolygonType == POLYGON_Floor )
                   v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
                 else
-                  v24 = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16) + ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16)
-                + HIWORD(pFace->zCalc3);
+                {
+                  int a = ((unsigned __int64)(pFace->zCalc1 * (signed __int64)X) >> 16);
+                  int b = ((unsigned __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16);
+                  int c = ((unsigned __int64)pFace->zCalc3 >> 16);
+                  v24 = a + b + c;
+                }
                 v25 = v46++;
                 odm_floor_level[v25] = v24;
-                dword_721160[v25] = pBModelNum;
-                dword_721110[v25] = pFaceNum;
+                current_BModel_id[v25] = pBModelNum;
+                current_Face_id[v25] = pFaceNum;
               }
             }
           }
@@ -3267,12 +3271,12 @@
     if ( !v29 )
       *bmodel_pid = 0;
     else
-      *bmodel_pid = dword_721110[v29] | (dword_721160[v29] << 6);
+      *bmodel_pid = current_Face_id[v29] | (current_BModel_id[v29] << 6);
   }
   if ( v29 )
   {
     *pIsOnWater = false;
-    if ( pOutdoor->pBModels[dword_721160[v29]].pFaces[dword_721110[v29]].Fluid())
+    if ( pOutdoor->pBModels[current_BModel_id[v29]].pFaces[current_Face_id[v29]].Fluid())
       *pIsOnWater = true;
   }
   if ( odm_floor_level[v29] >= odm_floor_level[0] )
--- a/mm7_data.cpp	Thu Jan 02 09:11:28 2014 +0600
+++ b/mm7_data.cpp	Thu Jan 02 17:56:55 2014 +0600
@@ -1259,8 +1259,8 @@
 std::array<int, 20> ceiling_height_level;
 std::array<__int16, 104> odm_floor_face_vert_coord_Y; // word_720F70
 std::array<__int16, 104> odm_floor_face_vert_coord_X; // word_721040
-std::array<int, 777> dword_721110; // idb
-std::array<int, 777> dword_721160; // idb
+std::array<int, 20> current_Face_id; // dword_721110
+std::array<int, 20> current_BModel_id; // dword_721160
 std::array<int, 20> odm_floor_level; // idb
 int blv_prev_party_x; // weak
 int blv_prev_party_z; // weak
--- a/mm7_data.h	Thu Jan 02 09:11:28 2014 +0600
+++ b/mm7_data.h	Thu Jan 02 17:56:55 2014 +0600
@@ -909,8 +909,8 @@
 extern std::array<int, 20> ceiling_height_level;
 extern std::array<__int16, 104> odm_floor_face_vert_coord_Y; // word_720F70
 extern std::array<__int16, 104> odm_floor_face_vert_coord_X; // word_721040
-extern std::array<int, 777> dword_721110; // idb
-extern std::array<int, 777> dword_721160; // idb
+extern std::array<int, 20> current_Face_id; // dword_721110
+extern std::array<int, 20> current_BModel_id; // dword_721160
 extern std::array<int, 20> odm_floor_level; // idb dword_7211B0
 extern int blv_prev_party_x; // weak
 extern int blv_prev_party_z; // weak