diff mm7_3.cpp @ 717:d5473972234d

m
author Ritor1
date Mon, 18 Mar 2013 01:50:50 +0600
parents c0bfb386b15f
children a5ee769b02c6
line wrap: on
line diff
--- a/mm7_3.cpp	Sat Mar 16 17:42:59 2013 +0600
+++ b/mm7_3.cpp	Mon Mar 18 01:50:50 2013 +0600
@@ -56,18 +56,18 @@
 //----- (0046E44E) --------------------------------------------------------
 int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1)
 {
-  BLVSector *v1; // edi@1
+  BLVSector *pSector; // edi@1
   signed int v2; // ebx@1
-  BLVFace *v3; // esi@2
-  __int16 v4; // si@10
-  int v5; // ecx@12
+  BLVFace *pFace; // esi@2
+  __int16 pNextSector; // si@10
+  int pArrayNum; // ecx@12
   unsigned __int8 v6; // sf@12
   unsigned __int8 v7; // of@12
   int result; // eax@14
-  BLVSector *v9; // ebx@15
+  //BLVSector *v9; // ebx@15
   int v10; // ecx@15
-  int v11; // eax@16
-  BLVFace *v12; // ebp@16
+  int pFloor; // eax@16
+  //BLVFace *v12; // ebp@16
   int v13; // eax@24
   int v14; // esi@24
   int v15; // eax@24
@@ -88,31 +88,31 @@
   int v30; // [sp+24h] [bp-34h]@35
   int v31; // [sp+28h] [bp-30h]@24
   int v32; // [sp+2Ch] [bp-2Ch]@15
-  int v33[10]; // [sp+30h] [bp-28h]@1
-
-  v1 = &pIndoor->pSectors[stru_721530.uSectorID];
+  int pSectorsArray[10]; // [sp+30h] [bp-28h]@1
+
+  pSector = &pIndoor->pSectors[stru_721530.uSectorID];
   v2 = 0;
   a10 = b1;
-  v33[0] = stru_721530.uSectorID;
-  for ( i = 1; v2 < v1->uNumPortals; ++v2 )
-  {
-    v3 = &pIndoor->pFaces[v1->pPortals[v2]];
-    if ( stru_721530.sMaxX <= v3->pBounding.x2
-      && stru_721530.sMinX >= v3->pBounding.x1
-      && stru_721530.sMaxY <= v3->pBounding.y2
-      && stru_721530.sMinY >= v3->pBounding.y1
-      && stru_721530.sMaxZ <= v3->pBounding.z2
-      && stru_721530.sMinZ >= v3->pBounding.z1
-      && abs((v3->pFacePlane_old.dist
-            + stru_721530.normal.x * v3->pFacePlane_old.vNormal.x
-            + stru_721530.normal.y * v3->pFacePlane_old.vNormal.y
-            + stru_721530.normal.z * v3->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
-    {
-      v4 = v3->uSectorID == stru_721530.uSectorID ? v3->uBackSectorID : v3->uSectorID;
-      v5 = i++;
-      v7 = __OFSUB__(i, 10);
+  pSectorsArray[0] = stru_721530.uSectorID;
+  for ( i = 1; v2 < pSector->uNumPortals; ++v2 )
+  {
+    pFace = &pIndoor->pFaces[pSector->pPortals[v2]];
+    if ( stru_721530.sMaxX <= pFace->pBounding.x2
+      && stru_721530.sMinX >= pFace->pBounding.x1
+      && stru_721530.sMaxY <= pFace->pBounding.y2
+      && stru_721530.sMinY >= pFace->pBounding.y1
+      && stru_721530.sMaxZ <= pFace->pBounding.z2
+      && stru_721530.sMinZ >= pFace->pBounding.z1
+      && abs((pFace->pFacePlane_old.dist
+            + stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x
+            + stru_721530.normal.y * pFace->pFacePlane_old.vNormal.y
+            + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16) <= stru_721530.field_6C + 16 )
+    {
+      pNextSector = pFace->uSectorID == stru_721530.uSectorID ? pFace->uBackSectorID : pFace->uSectorID;//FrontSectorID
+      pArrayNum = i++;
+      v7 = i < 10;
       v6 = i - 10 < 0;
-      v33[v5] = v4;
+      pSectorsArray[pArrayNum] = pNextSector;
       if ( !(v6 ^ v7) )
         break;
     }
@@ -123,9 +123,9 @@
   {
     while ( 1 )
     {
-      v9 = &pIndoor->pSectors[v33[result]];
+      pSector = &pIndoor->pSectors[pSectorsArray[result]];
       v10 = 0;
-      v32 = v9->uNumFloors + v9->uNumWalls + v9->uNumCeilings;
+      v32 = pSector->uNumFloors + pSector->uNumWalls + pSector->uNumCeilings;
       v26 = 0;
       if ( v32 > 0 )
         break;
@@ -136,53 +136,40 @@
     }
     while ( 1 )
     {
-      v11 = v9->pFloors[v10];
-      v12 = &pIndoor->pFaces[v11];
-      if ( v12->Portal()
-        || stru_721530.sMaxX > v12->pBounding.x2
-        || stru_721530.sMinX < v12->pBounding.x1
-        || stru_721530.sMaxY > v12->pBounding.y2
-        || stru_721530.sMinY < v12->pBounding.y1
-        || stru_721530.sMaxZ > v12->pBounding.z2
-        || stru_721530.sMinZ < v12->pBounding.z1
-        || v11 == stru_721530.field_84 )
+      pFloor = pSector->pFloors[v10];
+      pFace = &pIndoor->pFaces[pFloor];
+      if ( pFace->Portal()
+        || stru_721530.sMaxX > pFace->pBounding.x2
+        || stru_721530.sMinX < pFace->pBounding.x1
+        || stru_721530.sMaxY > pFace->pBounding.y2
+        || stru_721530.sMinY < pFace->pBounding.y1
+        || stru_721530.sMaxZ > pFace->pBounding.z2
+        || stru_721530.sMinZ < pFace->pBounding.z1
+        || pFloor == stru_721530.field_84 )
         goto LABEL_45;
-      v13 = v12->pFacePlane_old.vNormal.y;
-      v14 = v12->pFacePlane_old.dist;
+      v13 = pFace->pFacePlane_old.vNormal.y;
+      v14 = pFace->pFacePlane_old.dist;
       v31 = v13;
-      v15 = (stru_721530.normal.x * v12->pFacePlane_old.vNormal.x
-           + v14
-           + stru_721530.normal.y * v13
-           + stru_721530.normal.z * v12->pFacePlane_old.vNormal.z) >> 16;
+      v15 = (stru_721530.normal.x * pFace->pFacePlane_old.vNormal.x + v14 + stru_721530.normal.y * v13
+           + stru_721530.normal.z * pFace->pFacePlane_old.vNormal.z) >> 16;
       if ( v15 > 0 )
       {
-        v16 = (stru_721530.normal2.y * v31
-             + v12->pFacePlane_old.dist
-             + stru_721530.normal2.z * v12->pFacePlane_old.vNormal.z
-             + stru_721530.normal2.x * v12->pFacePlane_old.vNormal.x) >> 16;
+        v16 = (stru_721530.normal2.y * v31 + pFace->pFacePlane_old.dist + stru_721530.normal2.z * pFace->pFacePlane_old.vNormal.z
+             + stru_721530.normal2.x * pFace->pFacePlane_old.vNormal.x) >> 16;
         if ( v15 <= stru_721530.prolly_normal_d || v16 <= stru_721530.prolly_normal_d )
         {
           if ( v16 <= v15 )
           {
             a3 = stru_721530.field_6C;
-            if ( sub_47531C(
-                   stru_721530.prolly_normal_d,
-                   &a3,
-                   stru_721530.normal.x,
-                   stru_721530.normal.y,
-                   stru_721530.normal.z,
-                   stru_721530.field_58.x,
-                   stru_721530.field_58.y,
-                   stru_721530.field_58.z,
-                   v12,
-                   a10) )
+            if ( sub_47531C(stru_721530.prolly_normal_d, &a3, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z,
+                   stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
             {
               v17 = a3;
             }
             else
             {
               a3 = stru_721530.field_6C + stru_721530.prolly_normal_d;
-              if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, v12) )
+              if ( !sub_475D85(&stru_721530.normal, &stru_721530.field_58, &a3, pFace) )
                 goto LABEL_34;
               v17 = a3 - stru_721530.prolly_normal_d;
               a3 -= stru_721530.prolly_normal_d;
@@ -190,7 +177,7 @@
             if ( v17 < stru_721530.field_7C )
             {
               stru_721530.field_7C = v17;
-              v18 = 8 * v9->pFloors[v26];
+              v18 = 8 * pSector->pFloors[v26];
               LOBYTE(v18) = v18 | 6;
               stru_721530.uFaceID = v18;
             }
@@ -199,40 +186,27 @@
       }
 LABEL_34:
       if ( !(stru_721530.field_0 & 1)
-        || (v19 = v12->pFacePlane_old.vNormal.x,
-            v20 = v12->pFacePlane_old.vNormal.y,
+        || (v19 = pFace->pFacePlane_old.vNormal.x,
+            v20 = pFace->pFacePlane_old.vNormal.y,
             v30 = v19,
-            v21 = (stru_721530.field_34.x * v19
-                 + v12->pFacePlane_old.dist
-                 + stru_721530.field_34.y * v20
-                 + stru_721530.field_34.z * v12->pFacePlane_old.vNormal.z) >> 16,
+            v21 = (stru_721530.field_34.x * v19 + pFace->pFacePlane_old.dist + stru_721530.field_34.y * v20
+                 + stru_721530.field_34.z * pFace->pFacePlane_old.vNormal.z) >> 16,
             v21 <= 0)
-        || (v22 = (stru_721530.field_4C * v30
-                 + v12->pFacePlane_old.dist
-                 + stru_721530.field_50 * v20
-                 + stru_721530.field_54 * v12->pFacePlane_old.vNormal.z) >> 16,
+        || (v22 = (stru_721530.field_4C * v30 + pFace->pFacePlane_old.dist + stru_721530.field_50 * v20
+                 + stru_721530.field_54 * pFace->pFacePlane_old.vNormal.z) >> 16,
             v21 > stru_721530.prolly_normal_d)
         && v22 > stru_721530.prolly_normal_d
         || v22 > v21 )
         goto LABEL_45;
       a3 = stru_721530.field_6C;
-      if ( sub_47531C(
-             stru_721530.field_8,
-             &a3,
-             stru_721530.field_34.x,
-             stru_721530.field_34.y,
-             stru_721530.field_34.z,
-             stru_721530.field_58.x,
-             stru_721530.field_58.y,
-             stru_721530.field_58.z,
-             v12,
-             a10) )
+      if ( sub_47531C(stru_721530.field_8, &a3, stru_721530.field_34.x, stru_721530.field_34.y, stru_721530.field_34.z,
+             stru_721530.field_58.x, stru_721530.field_58.y, stru_721530.field_58.z, pFace, a10) )
       {
         v23 = a3;
         goto LABEL_43;
       }
       a3 = stru_721530.field_6C + stru_721530.field_8;
-      if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, v12) )
+      if ( sub_475D85(&stru_721530.field_34, &stru_721530.field_58, &a3, pFace) )
       {
         v23 = a3 - stru_721530.prolly_normal_d;
         a3 -= stru_721530.prolly_normal_d;
@@ -240,7 +214,7 @@
         if ( v23 < stru_721530.field_7C )
         {
           stru_721530.field_7C = v23;
-          v24 = 8 * v9->pFloors[v26];
+          v24 = 8 * pSector->pFloors[v26];
           LOBYTE(v24) = v24 | 6;
           stru_721530.uFaceID = v24;
         }
@@ -1631,15 +1605,15 @@
   int new_party_y; // [sp+48h] [bp-18h]@1
   int new_party_x; // [sp+4Ch] [bp-14h]@1
   int party_z; // [sp+50h] [bp-10h]@1
-  int v89; // [sp+58h] [bp-8h]@1
+  //int v89; // [sp+58h] [bp-8h]@1
   int angle; // [sp+5Ch] [bp-4h]@47
 
   uFaceEvent = 0;
-  v89 = pParty->uFallSpeed;
+  //v89 = pParty->uFallSpeed;
   v1 = 0;
-  new_party_y = pParty->vPosition.y;
   v2 = 0;
   new_party_x = pParty->vPosition.x;
+  new_party_y = pParty->vPosition.y;
   party_z = pParty->vPosition.z;
   uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
   v72 = 0;
@@ -1730,7 +1704,6 @@
     pParty->field_6F8 -= pEventTimer->uTimeElapsed;
   if ( party_z > v80 + 1 )
   {
-LABEL_43:
     if ( bJumping )
       goto LABEL_45;
     goto LABEL_44;
@@ -1745,7 +1718,9 @@
     if (pFace->uAttributes & 0x04000000 )
     {
       uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
-      goto LABEL_43;
+      if ( bJumping )
+        goto LABEL_45;
+      goto LABEL_44;
     }
   }
 LABEL_44:
@@ -1770,13 +1745,22 @@
         if ( uTurnSpeed )
           goto LABEL_58;
         v13 = (double)v82 * fTurnSpeedMultiplier;
-        goto LABEL_51;
+        v14 = angle + (unsigned __int64)(signed __int64)v13;
+        angle = stru_5C6E00->uDoublePiMask & v14;
+        goto LABEL_87;
       case PARTY_TurnRight:
         LODWORD(v15) = uTurnSpeed;
         if ( uTurnSpeed )
-          goto LABEL_56;
+        {
+          angle = stru_5C6E00->uDoublePiMask & (angle - v15);
+          goto LABEL_87;
+        }
         v16 = (double)v82 * fTurnSpeedMultiplier;
-        goto LABEL_55;
+        //{
+        v15 = (signed __int64)v16;
+        angle = stru_5C6E00->uDoublePiMask & (angle - v15);
+        goto LABEL_87;
+        //}
       case PARTY_FastTurnLeft:
         v12 = uTurnSpeed;
         if ( uTurnSpeed )
@@ -1787,7 +1771,6 @@
         else
         {
           v13 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-LABEL_51:
           v14 = angle + (unsigned __int64)(signed __int64)v13;
         }
         angle = stru_5C6E00->uDoublePiMask & v14;
@@ -1797,13 +1780,11 @@
         if ( !uTurnSpeed )
         {
           v16 = (fTurnSpeedMultiplier + fTurnSpeedMultiplier) * (double)v82;
-LABEL_55:
           v15 = (signed __int64)v16;
         }
-LABEL_56:
         angle = stru_5C6E00->uDoublePiMask & (angle - v15);
         goto LABEL_87;
-      case PARTY_StrafeLeft:
+      case PARTY_StrafeLeft://Ctrl + <-
         __debugbreak();
         v17 = stru_5C6E00->Sin(angle);
         v18 = (double)v81;
@@ -1812,7 +1793,9 @@
         v2 -= v78;
         v19 = stru_5C6E00->Cos(angle);
         v78 = (unsigned __int64)(v19 * (signed __int64)((signed int)(signed __int64)(v18 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        goto LABEL_63;
+        v1 += v78;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_StrafeRight:
         __debugbreak();
         v20 = stru_5C6E00->Sin(angle);
@@ -1822,7 +1805,10 @@
         v2 += v78;
         v22 = stru_5C6E00->Cos(angle);
         v78 = (unsigned __int64)(v22 * (signed __int64)((signed int)(signed __int64)(v21 * fWalkSpeedMultiplier) >> 1)) >> 16;
-        goto LABEL_68;
+        //goto LABEL_68;
+        v1 -= v78;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_WalkForward:
         __debugbreak();
         v23 = stru_5C6E00->Cos(angle);
@@ -1832,9 +1818,9 @@
         v2 += v78;
         v25 = stru_5C6E00->Sin(angle);
         v78 = (unsigned __int64)(v25 * (signed __int64)(signed int)(signed __int64)(v24 * fWalkSpeedMultiplier)) >> 16;
-LABEL_63:
         v1 += v78;
-        goto LABEL_64;
+        v78 = 1;
+        goto LABEL_87;
       case PARTY_WalkBackward:
         __debugbreak();
         v26 = stru_5C6E00->Cos(angle);
@@ -1844,9 +1830,7 @@
         v2 -= v78;
         v28 = stru_5C6E00->Sin(angle);
         v78 = (unsigned __int64)(v28 * (signed __int64)(signed int)(signed __int64)(v27 * fBackwardWalkSpeedMultiplier)) >> 16;
-LABEL_68:
         v1 -= v78;
-LABEL_64:
         v78 = 1;
         goto LABEL_87;
       case PARTY_RunForward:
@@ -1865,7 +1849,6 @@
         v2 -= (unsigned __int64)(stru_5C6E00->Cos(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
         //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
         v1 -= (unsigned __int64)(stru_5C6E00->Sin(angle) * (signed __int64)(signed int)(signed __int64)((double)v81 * fBackwardWalkSpeedMultiplier)) >> 16;
-//LABEL_70:
         v72 = 1;
         goto LABEL_87;
       case PARTY_LookUp:
@@ -1875,30 +1858,24 @@
         v35 = uActiveCharacter;
         if ( !uActiveCharacter )
           goto LABEL_87;
-        v65 = 0;
-        v63 = SPEECH_63;
-        goto LABEL_76;
+        pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_63, 0);
+        break;
       case PARTY_LookDown:
         _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
         if ( _view_angle < -128 )
           _view_angle = -128;
         v35 = uActiveCharacter;
         if ( uActiveCharacter )
-        {
-          v65 = 0;
-          v63 = SPEECH_64;
-LABEL_76:
-          pPlayers[v35]->PlaySound((PlayerSpeech)v63, v65);
-        }
+          pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
         break;
       case PARTY_CenterView:
         _view_angle = 0;
         break;
       case PARTY_Jump:
-        if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 )
+        if ( (!bJumping || party_z <= v80 + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
         {
           bJumping = 1;
-          v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89);
+          pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
         }
         break;
       default:
@@ -1910,22 +1887,22 @@
   pParty->sRotationX = _view_angle;
   if ( bJumping )
   {
-    v89 += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
+    pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
   }
   else
   {
     if ( pIndoor->pFaces[v68].pFacePlane_old.vNormal.z < 32768 )
     {
-      v89 -= pEventTimer->uTimeElapsed * GetGravityStrength();
+      pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
       goto LABEL_92;
     }
     if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
       goto LABEL_92;
-    v89 = 0;
-  }
-  if ( bJumping != v36 && v89 <= v36 )
-  {
-    if ( v89 < -500 && !pParty->bFlying )
+    pParty->uFallSpeed = 0;
+  }
+  if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
+  {
+    if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
     {
       v41 = &pPlayers[1];
       do
@@ -1964,7 +1941,7 @@
     stru_721530.field_20 = v1;
     stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
     stru_721530.field_34.z = stru_721530.field_C + party_z + 1;
-    stru_721530.field_24 = v89;
+    stru_721530.field_24 = pParty->uFallSpeed;
     stru_721530.uSectorID = uSectorID;
     v38 = 0;
     if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 )
@@ -2023,8 +2000,7 @@
     {
       v53 = integer_sqrt(v2 * v2 + v1 * v1);
       v80 = v53;
-      v54 = stru_5C6E00->Atan2(
-              new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
+      v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
               new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
       v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)v53) >> 16;
       v55 = stru_5C6E00->Sin(v54);
@@ -2038,8 +2014,8 @@
         v45 = v44->uPolygonType;
         if ( v45 == 3 )
         {
-          if ( v89 < 0 )
-            v89 = 0;
+          if ( pParty->uFallSpeed < 0 )
+            pParty->uFallSpeed = 0;
           v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
           if ( pParty->uFallStartY - v87 < 512 )
             pParty->uFallStartY = v87;
@@ -2048,9 +2024,11 @@
             v1 = 0;
             v2 = 0;
           }
-          goto LABEL_143;
-        }
-        v46 = v89 * v44->pFacePlane_old.vNormal.z;
+          if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+          goto LABEL_152;
+        }
+        v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
         v47 = v45 == 4;
         v48 = v44->pFacePlane_old.vNormal.x;
         if ( !v47 )
@@ -2064,7 +2042,7 @@
           v82 = v44->pFacePlane_old.vNormal.z;
           v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
           v2 += v50;
-          v89 += v82;
+          pParty->uFallSpeed += v82;
           v74 = v44->pFacePlane_old.vNormal.z;
           v51 = v44->pFacePlane_old.vNormal.y;
           v69 = v44->pFacePlane_old.vNormal.x;
@@ -2077,9 +2055,7 @@
             new_party_y += v52 * v80 >> 16;
             v87 += v52 * v74 >> 16;
           }
-LABEL_142:
           v43 = stru_721530.uFaceID;
-LABEL_143:
           if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
             uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
           goto LABEL_152;
@@ -2094,19 +2070,24 @@
         v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
         v2 += v49;
         v1 += v81;
-        v89 += v82;
+        pParty->uFallSpeed += v82;
         if ( v2 * v2 + v1 * v1 >= 400 )
-          goto LABEL_142;
+        {
+          v43 = stru_721530.uFaceID;
+          if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 )
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+          goto LABEL_152;
+        }
         v2 = 0;
         v1 = 0;
-        v89 = 0;
+        pParty->uFallSpeed = 0;
       }
     }
 LABEL_152:
     v2 = (unsigned __int64)(58500i64 * v2) >> 16;
     v1 = (unsigned __int64)(58500i64 * v1) >> 16;
     ++v83;
-    v89 = (unsigned __int64)(58500i64 * v89) >> 16;
+    pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
     if ( v83 >= 100 )
     {
       new_party_z = v87;
@@ -2116,9 +2097,8 @@
   if ( bWalkSound && pParty->field_6F8 <= 0 )
   {
     if ( integer_sqrt((pParty->vPosition.x - new_party_x) * (pParty->vPosition.x - new_party_x) + (pParty->vPosition.y - new_party_y)
-                                                                            * (pParty->vPosition.y - new_party_y)
-                                                                            + (pParty->vPosition.z - new_party_z)
-                                                                            * (pParty->vPosition.z - new_party_z)) <= 16 )
+         * (pParty->vPosition.y - new_party_y) + (pParty->vPosition.z - new_party_z)
+         * (pParty->vPosition.z - new_party_z)) <= 16 )
       goto LABEL_188;
     if ( v72 && (!bJumping || bFeatherFall) )
     {
@@ -2139,7 +2119,6 @@
         goto LABEL_175;
       }
       v57 = (SoundID)63;
-LABEL_174:
       v56 = pAudioPlayer;
       goto LABEL_175;
     }
@@ -2155,7 +2134,8 @@
       if ( v71 )
       {
         v57 = (SoundID)102;
-        goto LABEL_174;
+        v56 = pAudioPlayer;
+        goto LABEL_175;
       }
       v56 = pAudioPlayer;
       if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
@@ -2180,7 +2160,7 @@
   pParty->vPosition.x = new_party_x;
   pParty->vPosition.z = new_party_z;
   pParty->vPosition.y = new_party_y;
-  pParty->uFallSpeed = v89;
+  //pParty->uFallSpeed = v89;
   if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
     pParty->uFlags |= 0x200;
   if (uFaceEvent)