diff Outdoor.cpp @ 2094:dbd8515924da

m
author Ritor1
date Thu, 12 Dec 2013 21:42:18 +0600
parents 48b790721bdc
children 577c081b8019
line wrap: on
line diff
--- a/Outdoor.cpp	Sat Dec 07 14:25:50 2013 +0600
+++ b/Outdoor.cpp	Thu Dec 12 21:42:18 2013 +0600
@@ -3663,14 +3663,8 @@
   BSPModel *pModel; // eax@203
   ODMFace *pODMFace; // esi@203
   int v48; // eax@203
-  char v49; // zf@203
-  char v50; // sf@203
-  unsigned __int8 v51; // of@203
-  int v52; // eax@203
   BSPModel *v54; // eax@215
   int v55; // eax@217
-  signed int v56; // ebx@228
-  int v57; // eax@228
   BSPModel *v58; // eax@228
   unsigned __int64 v59; // qax@228
   BSPModel *v60; // eax@228
@@ -3840,7 +3834,7 @@
 		  if ( BYTE3(face[v6].uAttributes) & 4 )
           {
             pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid);
-            v103 = face[v6].sCogTriggeredID;
+            v103 = face[v6].sCogTriggeredID; //
           }
         }
       }
@@ -4299,37 +4293,37 @@
     v43 = 1;
     v44 = 1;
     if ( bUnderwater || !is_not_on_bmodel )
-	{
-		  pX = _angle_x;
-		  if ( v43 )
-			  pY = _angle_y;
-	}
-	else
-	{
-		if ( pModel && v129 > pZ )
-		  v44 = 0;
-		if ( v118 && v119 > pZ )
-		  v43 = 0;
-		if ( v44 )
-		{
-			  pX = _angle_x;
-			  if ( v43 )
-				  pY = _angle_y;
-		}
-		else if ( v43 )
-		  pY = _angle_y;
-		else
-		{
-			pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
-			if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
-			{
-			  v43 = 1;
-			  pX = _angle_x;
-			  if ( v43 )
-				  pY = _angle_y;
-			}
-		}
-	}
+    {
+      pX = _angle_x;
+      if ( v43 )
+        pY = _angle_y;
+    }
+    else
+    {
+      if ( pModel && v129 > pZ )
+        v44 = 0;
+      if ( v118 && v119 > pZ )
+        v43 = 0;
+      if ( v44 )
+      {
+        pX = _angle_x;
+        if ( v43 )
+          pY = _angle_y;
+      }
+      else if ( v43 )
+        pY = _angle_y;
+      else
+      {
+        pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0);
+        if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ )
+        {
+          v43 = 1;
+          pX = _angle_x;
+          if ( v43 )
+            pY = _angle_y;
+        }
+      }
+    }
     if ( stru_721530.field_7C >= stru_721530.field_6C )
     {
       if ( !is_not_on_bmodel )
@@ -4351,29 +4345,23 @@
         pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
 
       viewparams->bRedrawGameUI = true;
-		v2 = (unsigned __int64)(58500i64 * v2) >> 16;
-		pModel = (BSPModel *)58500;
-		v128 = (unsigned __int64)(58500i64 * v128) >> 16;
-		v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-		++v126;
-		pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-		continue;
-	}
+      v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+      pModel = (BSPModel *)58500;
+      v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+      v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+      ++v126;
+      pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+      continue;
+    }
     if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
     {
-      v56 = integer_sqrt(v2 * v2 + v128 * v128);
-      v118 = v56;
-      v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
+      v118 = integer_sqrt(v2 * v2 + v128 * v128);
+      v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x,
                                _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y);
-      v129 = v57;
-      v58 = (BSPModel *)stru_5C6E00->Cos(v57);
-      pModel = v58;
-      v59 = (signed int)v58 * (signed __int64)v56;
+      v59 = (signed int)stru_5C6E00->Cos(v129) * (signed __int64)v118;
       v122 = v59 >> 16;
       v2 = v59 >> 16;
-      v60 = (BSPModel *)stru_5C6E00->Sin(v129);
-      pModel = v60;
-      v61 = (signed int)v60 * (signed __int64)v118;
+      v61 = (signed int)stru_5C6E00->Sin(v129) * (signed __int64)v118;
       v122 = v61 >> 16;
       v128 = v61 >> 16;
     }
@@ -4386,12 +4374,12 @@
         //v127 = v46;
         pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F];
         v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1;
-        v51 = __OFSUB__(v48, 32);
-        v49 = v48 == 32;
-        v50 = v48 - 32 < 0;
-        v52 = pODMFace->pFacePlane.vNormal.z;
-        v129 = (unsigned __int8)(v50 ^ v51 | v49);
-        v119 = v52 < 46378;
+        //v51 = __OFSUB__(v48, 32);
+        //v49 = v48 == 32;
+        //v50 = v48 - 32 < 0;
+        //v52 = pODMFace->pFacePlane.vNormal.z;
+        v129 = v48 <= 32;
+        v119 = pODMFace->pFacePlane.vNormal.z < 46378;
         if ( bUnderwater == 1 )
           v119 = 0;
         if ( pODMFace->uPolygonType == POLYGON_Floor )
@@ -4407,33 +4395,35 @@
           if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE))
           {
             pParty->floor_face_pid = v45;
-            v103 = pODMFace->sCogTriggeredID;
+            v103 = pODMFace->sCogTriggeredID; //
           }
           v2 = (unsigned __int64)(58500i64 * v2) >> 16;
           pModel = (BSPModel *)58500;
           v128 = (unsigned __int64)(58500i64 * v128) >> 16;
           v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-          ++v126;
+          //++v126;
           pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
           continue;
         }
         if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб
         {
-          v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
+          v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y
+               + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z
+               + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
           if ((stru_721530.speed >> 3) > v118 )
             v118 = stru_721530.speed >> 3;
-          v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
-          _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
+          v2 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16;
+          v128 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16;
           v54 = 0;
           if ( !v119 )
           {
-            pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z;
-            pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
-            v54 = pModel;
+            //pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z;
+            pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.z) >> 16;
+            //v54 = pModel;
           }
-          pParty->uFallSpeed += (int)v54;
-          v128 += _walk_speed;
-          v2 += v129;
+          //pParty->uFallSpeed += (int)v54;
+          //v128 += _walk_speed;
+          //v2 += v129;
           v55 = stru_721530.prolly_normal_d
               - ((signed int)(pODMFace->pFacePlane.dist
                             + v122 * pODMFace->pFacePlane.vNormal.z
@@ -4446,48 +4436,49 @@
             if ( !v119 )
               pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16);
           }
-			v45 = stru_721530.uFaceID;
-			if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
-			{
-				pParty->floor_face_pid = v45;
-				v103 = pODMFace->sCogTriggeredID;
-			}
-			v2 = (unsigned __int64)(58500i64 * v2) >> 16;
-			pModel = (BSPModel *)58500;
-			v128 = (unsigned __int64)(58500i64 * v128) >> 16;
-			v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-			++v126;
-			pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-			continue;
+          //v45 = stru_721530.uFaceID;
+          if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 )
+          {
+            pParty->floor_face_pid = stru_721530.uFaceID;
+            v103 = pODMFace->sCogTriggeredID; //
+          }
+          v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+          pModel = (BSPModel *)58500;
+          v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+          v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+          //++v126;
+          pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+          continue;
         }
-        v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
+        v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y
+             + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16;
         if ((stru_721530.speed >> 3) > v118 )
           v118 = stru_721530.speed >> 3;
-        v122 = pODMFace->pFacePlane.vNormal.x;
-        v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16;
-        pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y;
-        pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16);
-        v129 = pODMFace->pFacePlane.vNormal.z;
-        v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16;
-        pParty->uFallSpeed += v129;
-        v2 += v122;
-        v128 += (int)pModel;
+        //v122 = pODMFace->pFacePlane.vNormal.x;
+        v2 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.x) >> 16;
+        //pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y;
+        v128 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.y) >> 16;
+        //v129 = pODMFace->pFacePlane.vNormal.z;
+        pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.z) >> 16;
+        //pParty->uFallSpeed += v129;
+        //v2 += v122;
+        //v128 += (int)pModel;
         if ( v2 * v2 + v128 * v128 >= 400 )
-		{
-			v45 = stru_721530.uFaceID;
-			if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 )
-			{
-				pParty->floor_face_pid = v45;
-				v103 = pODMFace->sCogTriggeredID;
-			}
-			v2 = (unsigned __int64)(58500i64 * v2) >> 16;
-			pModel = (BSPModel *)58500;
-			v128 = (unsigned __int64)(58500i64 * v128) >> 16;
-			v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-			++v126;
-			pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
-			continue;
-		}
+        {
+          //v45 = stru_721530.uFaceID;
+          if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 )
+          {
+            pParty->floor_face_pid = stru_721530.uFaceID;
+            v103 = pODMFace->sCogTriggeredID; //
+          }
+          v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+          pModel = (BSPModel *)58500;
+          v128 = (unsigned __int64)(58500i64 * v128) >> 16;
+          v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+          //++v126;
+          pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+          continue;
+        }
         v2 = 0;
         pParty->uFallSpeed = 0;
         *(float *)&v128 = 0.0;
@@ -4575,7 +4566,7 @@
       pParty->uFallStartY = 8160;
       pParty->vPosition.z = 8160;
     }
-    if ( !v103
+    if ( !v103 //
       || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71)
       && pParty->vPosition.y == v72
       && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) )
@@ -4693,7 +4684,7 @@
       pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE;
   }
 
-  if ( !v103
+  if ( !v103//
     || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX)
     && pParty->vPosition.y == pY
     && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) )