changeset 2144:cfe04d858766

ODM_ProcessPartyActions continue
author Ritor1
date Mon, 06 Jan 2014 19:29:01 +0600
parents 1283eedcc028
children ad71de147333
files Events.cpp Indoor.cpp Outdoor.cpp mm7_3.cpp
diffstat 4 files changed, 72 insertions(+), 56 deletions(-) [+]
line wrap: on
line diff
--- a/Events.cpp	Thu Jan 02 17:57:09 2014 +0600
+++ b/Events.cpp	Mon Jan 06 19:29:01 2014 +0600
@@ -429,13 +429,13 @@
   v133 = 0;
   EvtTargetObj = targetObj;
   dword_5B65C4_cancelEventProcessing = 0;
-  if ( uEventID == 114 )
+  /*if ( uEventID == 114 )//чтобы проверить скрипт
   {
     if (!lua->DoFile("out01.lua"))
       Log::Warning(L"Error opening out01.lua\n");
     Log::Warning(L"being tested that well\n");
     return;
-  }
+  }	*/
   if ( !uEventID )
     {
     if ( !GameUI_Footer_TimeLeft )
--- a/Indoor.cpp	Thu Jan 02 17:57:09 2014 +0600
+++ b/Indoor.cpp	Mon Jan 06 19:29:01 2014 +0600
@@ -1703,7 +1703,7 @@
   header.pMagic[3] = 'i';
   header.uCompressedSize = 0;
   header.uDecompressedSize = 0;
-  fread(&header, sizeof(ODMHeader), 1u, File);
+  fread(&header, sizeof(ODMHeader), 1, File);
   if (header.uVersion != 91969 ||
       header.pMagic[0] != 'm'  ||
       header.pMagic[1] != 'v'  ||
@@ -1843,7 +1843,7 @@
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  memcpy(&uNumFaceExtras, pData, 4u);
+  memcpy(&uNumFaceExtras, pData, 4);
   memcpy(pFaceExtras, pData += 4, uNumFaceExtras * sizeof(BLVFaceExtra));
   pData += uNumFaceExtras * sizeof(BLVFaceExtra);
 
@@ -2038,7 +2038,7 @@
   void *pRawDLV = nullptr;
   strcpy(&pFilename[strlen(pFilename) - 4], ".dlv");
   File = pNew_LOD->FindContainer(pFilename, 1);
-  fread(&header, 0x10u, 1u, File);//(FILE *)v245);
+  fread(&header, 0x10u, 1, File);//(FILE *)v245);
   bool _v244 = false;
   if (header.uVersion != 91969 ||
       header.pMagic[0] != 'm'  ||
@@ -2121,12 +2121,12 @@
     {
       if ( v155 == Count )
       {
-        fread(Src, 1u, Count, File);
+        fread(Src, 1, Count, File);
       }
       else
       {
         void* _uSourceLen = malloc(v155);
-        fread(_uSourceLen, v155, 1u, File);
+        fread(_uSourceLen, v155, 1, File);
         zlib::MemUnzip(Src, &Count, _uSourceLen, v155);
         free(_uSourceLen);
       }
@@ -2198,19 +2198,17 @@
 
   pGameLoadingUI_ProgressBar->Progress();
 
-  for (uint i = 0; i < uNumSpriteObjects; ++i)
-  {
-    SpriteObject* pItem = &pSpriteObjects[i];
- 
-    if (pItem->stru_24.uItemID && !(pItem->uAttributes & 0x0100))
+  for ( uint i = 0; i < uNumSpriteObjects; ++i )
+  {
+    if (pSpriteObjects[i].stru_24.uItemID && !(pSpriteObjects[i].uAttributes & 0x0100))
     {
-      pItem->uType = pItemsTable->pItems[pItem->stru_24.uItemID].uSpriteID;
-
-      uint uObjectID = 0;
-      for (uint j = 0; j < pObjectList->uNumObjects; ++j)
-        if (pItem->uType == pObjectList->pObjects[j].uObjectID)
+      pSpriteObjects[i].uType = pItemsTable->pItems[pSpriteObjects[i].stru_24.uItemID].uSpriteID;
+
+      //uint uObjectID = 0;
+      for ( uint j = 0; j < pObjectList->uNumObjects; ++j )
+        if ( pSpriteObjects[i].uType == pObjectList->pObjects[j].uObjectID )
         {
-          pItem->uObjectDescID = j;
+          pSpriteObjects[i].uObjectDescID = j;
           break;
         }
     }
--- a/Outdoor.cpp	Thu Jan 02 17:57:09 2014 +0600
+++ b/Outdoor.cpp	Mon Jan 06 19:29:01 2014 +0600
@@ -3172,14 +3172,13 @@
             && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1
             && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 )
           {
-            
-              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->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;
-              }
+            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->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];
 
@@ -3222,9 +3221,9 @@
                   v24 = pBModel->pVertices.pVertices[pFace->pVertexIDs[0]].z;
                 else
                 {
-                  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);
+                  int a = ((signed __int64)(pFace->zCalc1 * (signed __int64)X) >> 16);
+                  int b = ((signed __int64)(pFace->zCalc2 * (signed __int64)Y) >> 16);
+                  int c = ((signed __int64)pFace->zCalc3 >> 16);
                   v24 = a + b + c;
                 }
                 v25 = v46++;
@@ -3309,12 +3308,13 @@
        dz = abs(grid_pos_z1 - pos_z);
   if (dz >= dx)
   {
-    side1_dy = (double)(x1z1_y - x1z2_y);
+    side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
+    side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2);  // bug?  z2 - z2 
     side2_dy = (double)(x2z2_y - x1z2_y);
-    side2_dx = (double)(grid_pos_x2 - grid_pos_x1);
-    side1_dx = (double)(grid_pos_x1 - grid_pos_x2);
-    side2_dz = 0.0;//(double)(grid_pos_z2 - grid_pos_z2);  // bug?  z2 - z2 
+
+    side1_dx = 0.0;//(double)(grid_pos_x1 - grid_pos_x1);
     side1_dz = (double)(grid_pos_z1 - grid_pos_z2);  //       z1 - z2 yes
+    side1_dy = (double)(x1z1_y - x1z2_y);
     //Log::Warning(L"%S %S %u\n", __FILE__, __FUNCTION__, __LINE__);
     /*       |\
        side1 |  \
@@ -3323,13 +3323,13 @@
   }
   else
   {
-    side1_dy = (double)(x2z2_y - x2z1_y);
+    side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
+    side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1);
     side2_dy = (double)(x1z1_y - x2z1_y);
-    side2_dx = (double)(grid_pos_x1 - grid_pos_x2);
-    side1_dx = (double)(grid_pos_x2 - grid_pos_x1);
-    side2_dz = 0.0;//(double)(grid_pos_z1 - grid_pos_z1); 
+
+    side1_dx = 0.0;//(double)(grid_pos_x2 - grid_pos_x1);
     side1_dz = (double)(grid_pos_z2 - grid_pos_z1);
-
+    side1_dy = (double)(x2z2_y - x2z1_y);
     /*   side 2
          _____
          \    |
@@ -4164,9 +4164,7 @@
     pParty->uFallSpeed += 2 * v33;
   }
   else if (!partyAtHighSlope)
-  {
     v34 = pParty->uFallSpeed;
-  }
   else if (!hovering)
   {
     if ( !bmodel_standing_on_pid )
@@ -4176,8 +4174,8 @@
 		// and falling to the gravity, gradually sliding downwards. nice trick
 		pZ = v111;
 		ODM_GetTerrainNormalAt(pX, pY, &v98);
-		v35 = pParty->uFallSpeed + -8 * pEventTimer->uTimeElapsed * GetGravityStrength();
-		v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16;
+		v35 = pParty->uFallSpeed + (8 * -((pEventTimer->uTimeElapsed - 4) * GetGravityStrength()));
+		v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16;
 		v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16;
 		v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16;
 		v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16);
--- a/mm7_3.cpp	Thu Jan 02 17:57:09 2014 +0600
+++ b/mm7_3.cpp	Mon Jan 06 19:29:01 2014 +0600
@@ -3110,7 +3110,7 @@
   //int v7; // ecx@6
   //int v8; // edx@6
   //int v9; // eax@6
-  //int v10; // esi@10
+  int y_min; // esi@10
   //int v11; // [sp+14h] [bp-8h]@1
   //int v12; // [sp+18h] [bp-4h]@1
 
@@ -3160,25 +3160,45 @@
                                     y3     */
   }
 
-  int y_min = min(y1, min(y2, y3)),
-      y_max = max(y1, max(y2, y3));
-  return (y_max - y_min) > 512;
-
-  /*if ( y1 >= y2 )
+  //int y_min = min(y1, min(y2, y3)),// не верно при подъёме на склон
+      //y_max = max(y1, max(y2, y3));
+  //return (y_max - y_min) > 512;
+
+  if ( y1 >= y2 )
   {
     y_min = y2;
     if ( y2 < y3 )
-      goto LABEL_13;
-LABEL_12:
+    {
+      if ( y1 <= y2 )
+      {
+        if ( y2 > y3 )
+          y3 = y2;
+      }
+      else
+      {
+        if ( y1 > y3 )
+          y3 = y1;
+      }
+      return y3 - y_min > 512;
+    }
     y_min = y3;
-    goto LABEL_13;
+    if ( y1 <= y2 )
+    {
+      if ( y2 > y3 )
+        y3 = y2;
+    }
+    else
+    {
+      if ( y1 > y3 )
+        y3 = y1;
+    }
+    return y3 - y_min > 512;
   }
   else if ( y1 >= y3 )
-    goto LABEL_12;
+    y_min = y3;
   else
-  y_min = y1;
-
-LABEL_13:
+    y_min = y1;
+
   if ( y1 <= y2 )
   {
     if ( y2 > y3 )
@@ -3189,7 +3209,7 @@
     if ( y1 > y3 )
       y3 = y1;
   }
-  return y3 - v10 > 512;*/
+  return y3 - y_min > 512;
 }
 
 //----- (0048257A) --------------------------------------------------------