diff Indoor.cpp @ 2084:48b790721bdc

WalkSound
author Ritor1
date Sat, 07 Dec 2013 14:25:50 +0600
parents 0d535449c04f
children 3920278a2905 dbd8515924da
line wrap: on
line diff
--- a/Indoor.cpp	Fri Dec 06 23:35:50 2013 +0600
+++ b/Indoor.cpp	Sat Dec 07 14:25:50 2013 +0600
@@ -41,7 +41,7 @@
 #include "texts.h"
 #include "GUIWindow.h"
 #include "Level/Decoration.h"
-
+#include "Overlays.h"
 
 
 
@@ -6845,4 +6845,564 @@
     }*/
   }
   return 0;
+}
+//----- (00472866) --------------------------------------------------------
+void BLV_ProcessPartyActions()
+{
+  int v1; // ebx@1
+  int v2; // edi@1
+  double v10; // st7@27
+  unsigned int v12; // eax@49
+  double v13; // st7@50
+  int v17; // eax@62
+  double v18; // st7@62
+  int v19; // ST40_4@62
+  int v20; // eax@65
+  double v21; // st7@65
+  int v22; // ST40_4@65
+  int v23; // eax@66
+  double v24; // st7@66
+  int v25; // ST40_4@66
+  int v26; // eax@67
+  double v27; // st7@67
+  int v28; // ST40_4@67
+  unsigned int v35; // eax@74
+  int v36; // ecx@88
+  int new_party_z; // esi@96
+  int v38; // eax@96
+  int v39; // ecx@106
+  int v40; // eax@106
+  Player **v41; // esi@113
+  int v42; // eax@120
+  signed int v43; // ecx@123
+  BLVFace *v44; // esi@126
+  PolygonType v45; // al@126
+  int v46; // ecx@133
+  char v47; // zf@133
+  int v48; // eax@133
+  int v49; // ST40_4@136
+  int v50; // ST40_4@140
+  int v51; // eax@140
+  int v52; // eax@140
+  signed int v53; // edi@146
+  int v54; // ebx@146
+  int v55; // ST30_4@146
+  int v63; // [sp-8h] [bp-68h]@75
+  int v65; // [sp-4h] [bp-64h]@75
+  int v69; // [sp+10h] [bp-50h]@140
+  unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
+  bool party_running_flag; // [sp+1Ch] [bp-44h]@1
+  signed int v73; // [sp+20h] [bp-40h]@100
+  int v74; // [sp+20h] [bp-40h]@140
+  bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
+  unsigned int uSectorID; // [sp+28h] [bp-38h]@1
+  bool party_walking_flag; // [sp+2Ch] [bp-34h]@1
+  unsigned int uFaceID; // [sp+30h] [bp-30h]@1
+  int v80; // [sp+34h] [bp-2Ch]@1
+  int v81; // [sp+38h] [bp-28h]@47
+  int v82; // [sp+3Ch] [bp-24h]@47
+  int _view_angle; // [sp+40h] [bp-20h]@47
+  int bJumping; // [sp+44h] [bp-1Ch]@1
+  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 angle; // [sp+5Ch] [bp-4h]@47
+
+  uFaceEvent = 0;
+  //v89 = pParty->uFallSpeed;
+  v1 = 0;
+  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);
+  party_running_flag = false;
+  party_walking_flag = false;
+  bJumping = 0;
+
+  uFaceID = -1;
+  int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
+
+  if ( pParty->bFlying )
+  {
+    pParty->bFlying = false;
+    if (pParty->FlyActive())
+      pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
+  }
+
+  if ( floor_level == -30000  || uFaceID == -1)
+  {
+    floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
+    if ( floor_level == -30000 || uFaceID == -1)
+    {
+      __debugbreak(); // level built with errors 
+      pParty->vPosition.x = blv_prev_party_x;
+      pParty->vPosition.y = blv_prev_party_z;
+      pParty->vPosition.z = blv_prev_party_y;
+      pParty->uFallStartY = blv_prev_party_y;
+      return;
+    }
+  }
+
+  blv_prev_party_x = pParty->vPosition.x;
+  blv_prev_party_z = pParty->vPosition.y;
+  blv_prev_party_y = pParty->vPosition.z;
+  if (!pParty->bTurnBasedModeOn)
+  {
+    int v67 = GetTickCount() / 500;
+    if (dword_720CDC != v67 )
+    {
+      dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x;
+      dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y;
+      dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z;
+      if ( dword_4F8580[0] > 60 )
+        dword_4F8580[0] = 1;
+    }
+    dword_720CDC = v67;
+  }
+
+  uint fall_start;
+  if (!pParty->FeatherFallActive())
+  {
+    bFeatherFall = false;
+    if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&  // grants feather fall
+        !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
+        !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
+        !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT))
+    {
+      fall_start = pParty->uFallStartY;
+    }
+  }
+  else
+  {
+    fall_start = floor_level;
+    bFeatherFall = true;
+    pParty->uFallStartY = floor_level;
+  }
+
+
+  if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
+  {
+    assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
+    if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
+      pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
+    else for (uint i = 0; i < 4; ++i)
+    {                                      // receive falling damage
+      Player* player = &pParty->pPlayers[i];
+      if (!player->HasEnchantedItemEquipped(72) && !player->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS))
+      {
+        player->ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * player->GetMaxHealth()) / 256, DMGT_PHISYCAL);
+        v10 = (double)(20 - player->GetParameterBonus(player->GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
+        player->SetRecoveryTime((signed __int64)v10);
+      }
+    }
+  }
+
+  if ( party_z > floor_level + 1 )
+    bJumping = 1;
+
+  bool jumping_up = false;
+
+  if ( party_z - floor_level <= 32 )
+  {
+    pParty->uFallStartY = party_z;
+    jumping_up = true;
+  }
+
+  if (bWalkSound && pParty->walk_sound_timer)
+  {
+    if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
+      pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
+    else pParty->walk_sound_timer = 0;
+  }
+
+
+  if (party_z <= floor_level + 1)
+  {
+    party_z = floor_level + 1;
+    pParty->uFallStartY = floor_level + 1;
+
+    if (!bJumping && pParty->floor_face_pid != uFaceID)
+    {
+      BLVFace* pFace = &pIndoor->pFaces[uFaceID];
+      if (pFace->uAttributes & FACE_PRESSURE_PLATE)
+        uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
+    }
+  }
+  if (!bJumping)
+    pParty->floor_face_pid = uFaceID;
+
+  bool on_water = false;
+  if ( pIndoor->pFaces[uFaceID].Fluid())
+    on_water = true;
+
+  v81 = pParty->uWalkSpeed;
+  angle = pParty->sRotationY;
+  _view_angle = pParty->sRotationX;
+  v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
+                                          / 180)) >> 16;
+//LABEL_87:
+  while ( pPartyActionQueue->uNumActions )
+  {
+    switch ( pPartyActionQueue->Next() )
+    {
+      case PARTY_TurnLeft:
+        if (uTurnSpeed)
+          angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
+        else
+          angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier));
+        break;
+      case PARTY_TurnRight:
+        if (uTurnSpeed)
+          angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
+        else
+          angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier));
+        break;
+
+      case PARTY_FastTurnLeft:
+        if (uTurnSpeed)
+          angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
+        else
+          angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
+        break;
+
+      case PARTY_FastTurnRight:
+        if (uTurnSpeed)
+          angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
+        else
+          angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
+        break;
+
+      case PARTY_StrafeLeft:
+        v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 += fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
+        party_walking_flag = true;
+        break;
+      case PARTY_StrafeRight:
+        v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2);
+        v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2);
+        party_walking_flag = true;
+        break;
+      case PARTY_WalkForward:
+        v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier);
+        party_walking_flag = true;
+        break;
+      case PARTY_WalkBackward:
+        v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
+        v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
+        party_walking_flag = true;
+        break;
+      case PARTY_RunForward:
+        v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier);
+        v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier);
+        party_running_flag = true;
+        break;
+      case PARTY_RunBackward:
+        //v32 = stru_5C6E00->SinCos(angle);
+        //v33 = (double)v81;
+        //v88 = (double)v81;
+        v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier);
+        //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
+        v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier);
+        party_running_flag = true;
+        break;
+      case PARTY_LookUp:
+        _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
+        if ( _view_angle > 128 )
+          _view_angle = 128;
+        v35 = uActiveCharacter;
+        if ( uActiveCharacter )
+          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 )
+          pPlayers[v35]->PlaySound((PlayerSpeech)SPEECH_64, 0);
+        break;
+      case PARTY_CenterView:
+        _view_angle = 0;
+        break;
+      case PARTY_Jump:
+        if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
+        {
+          bJumping = 1;
+          pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
+        }
+        break;
+      default:
+        break;
+    }
+  }
+  v36 = 0;
+  pParty->sRotationY = angle;
+  pParty->sRotationX = _view_angle;
+  if ( bJumping )
+  {
+	pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
+	if ( bJumping != v36 && pParty->uFallSpeed <= v36 )
+	{
+		if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
+		{
+			v41 = &pPlayers[1];
+			do
+			{
+				if ( !(*v41)->HasEnchantedItemEquipped(72) && !(*v41)->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 
+					(*v41)->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
+				++v41;
+			}
+			while ( (signed int)v41 <= (signed int)&pPlayers[4] );
+		}
+	}
+	else
+		pParty->uFallStartY = party_z;
+  }
+  else
+  {
+    if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
+    {
+      pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
+      pParty->uFallStartY = party_z;
+    }
+	else
+	{
+		if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) )
+		  pParty->uFallSpeed = 0;
+		pParty->uFallStartY = party_z;
+	}
+  }
+  if ( v2 * v2 + v1 * v1 < 400 )
+  {
+    v1 = 0;
+    v2 = 0;
+  }
+  stru_721530.field_84 = -1;
+  stru_721530.field_70 = 0;
+  stru_721530.prolly_normal_d = pParty->field_14_radius;
+  stru_721530.field_8_radius = pParty->field_14_radius / 2;
+  int v83 = 0;
+  stru_721530.field_0 = 1;
+  stru_721530.height = pParty->uPartyHeight - 32;
+  while ( 1 )
+  {
+    new_party_z = party_z;
+    stru_721530.position.x = new_party_x;
+    stru_721530.normal.x = new_party_x;
+    stru_721530.velocity.x = v2;
+    stru_721530.position.y = new_party_y;
+    stru_721530.normal.y = new_party_y;
+    stru_721530.velocity.y = v1;
+    stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
+    stru_721530.position.z = stru_721530.height + party_z + 1;
+    stru_721530.velocity.z = pParty->uFallSpeed;
+    stru_721530.uSectorID = uSectorID;
+    v38 = 0;
+    if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 )
+      v38 = 13312;
+    if ( stru_721530._47050A(v38) )
+      break;
+    v73 = 0;
+    do
+    {
+      _46E44E_collide_against_faces_and_portals(1u);
+      _46E0B2_collide_against_decorations();
+      for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
+        Actor::_46DF1A_collide_against_actor(v80, 0);
+      if ( _46F04E_collide_against_portals() )
+        break;
+      ++v73;
+    }
+    while ( v73 < 100 );
+    if ( stru_721530.field_7C >= stru_721530.field_6C )
+    {
+      v39 = stru_721530.normal2.x;
+      uSectorID = stru_721530.normal2.y;
+      v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+    }
+    else
+    {
+      v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x;
+      uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
+      v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
+    }
+    v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
+    if ( v42 == -30000 || v42 - new_party_z > 128 )
+      return;
+    if ( stru_721530.field_7C >= stru_721530.field_6C )
+    {
+      new_party_x = stru_721530.normal2.x;
+      new_party_y = stru_721530.normal2.y;
+      new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
+      break;
+    }
+    new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
+    new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
+    v43 = stru_721530.uFaceID;
+    uSectorID = stru_721530.uSectorID;
+    stru_721530.field_70 += stru_721530.field_7C;
+    unsigned long long v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z;
+    if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
+    {
+      if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
+        && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) )
+        pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
+      viewparams->bRedrawGameUI = 1;
+    }
+	else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
+    {
+      v53 = integer_sqrt(v2 * v2 + v1 * v1);
+      v80 = v53;
+      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);
+      v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16;
+    }
+    else
+    {
+      if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
+      {
+        v44 = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
+        v45 = v44->uPolygonType;
+        if ( v45 == 3 )
+        {
+          if ( pParty->uFallSpeed < 0 )
+            pParty->uFallSpeed = 0;
+          v87 = pIndoor->pVertices[*v44->pVertexIDs].z + 1;
+          if ( pParty->uFallStartY - v87 < 512 )
+            pParty->uFallStartY = v87;
+          if ( v2 * v2 + v1 * v1 < 400 )
+          {
+            v1 = 0;
+            v2 = 0;
+          }
+          if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
+            uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+        }
+		else
+		{
+			v46 = pParty->uFallSpeed * v44->pFacePlane_old.vNormal.z;
+			v47 = v45 == 4;
+			v48 = v44->pFacePlane_old.vNormal.x;
+			if ( !v47 )
+			{
+			  v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
+			  if ((stru_721530.speed >> 3) > v80 )
+				v80 = stru_721530.speed >> 3;
+			  v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
+			  v81 = v44->pFacePlane_old.vNormal.y;
+			  v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
+			  v82 = v44->pFacePlane_old.vNormal.z;
+			  v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
+			  v2 += v50;
+			  pParty->uFallSpeed += v82;
+			  v74 = v44->pFacePlane_old.vNormal.z;
+			  v51 = v44->pFacePlane_old.vNormal.y;
+			  v69 = v44->pFacePlane_old.vNormal.x;
+			  v80 = v51;
+			  v1 += v81;
+			  v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16);
+			  if ( v52 > 0 )
+			  {
+				new_party_x += v52 * v69 >> 16;
+				new_party_y += v52 * v80 >> 16;
+				v87 += v52 * v74 >> 16;
+			  }
+			  v43 = stru_721530.uFaceID;
+			  if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
+				uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+			}
+			else
+			{
+				v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16;
+				if ((stru_721530.speed >> 3) > v80 )
+				  v80 = stru_721530.speed >> 3;
+				v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16;
+				v81 = v44->pFacePlane_old.vNormal.y;
+				v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16;
+				v82 = v44->pFacePlane_old.vNormal.z;
+				v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16;
+				v2 += v49;
+				v1 += v81;
+				pParty->uFallSpeed += v82;
+				if ( v2 * v2 + v1 * v1 >= 400 )
+				{
+				  v43 = stru_721530.uFaceID;
+				  if ( pParty->floor_face_pid != PID_ID(v43) && BYTE3(v44->uAttributes) & 4 )
+					uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID;
+				}
+				else
+				{
+					v2 = 0;
+					v1 = 0;
+					pParty->uFallSpeed = 0;
+				}
+			}
+		}
+      }
+    }
+    v2 = (unsigned __int64)(58500i64 * v2) >> 16;
+    v1 = (unsigned __int64)(58500i64 * v1) >> 16;
+    ++v83;
+    pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
+    if ( v83 >= 100 )
+    {
+      new_party_z = v87;
+      break;
+    }
+  }
+
+  //  //Воспроизведение звуков ходьбы/бега-------------------------
+  uint pX_ = pParty->vPosition.x - new_party_x;
+  uint pY_ = pParty->vPosition.y - new_party_y;
+  uint pZ_ = pParty->vPosition.z - new_party_z;
+  if ( bWalkSound && pParty->walk_sound_timer <= 0 )
+  {
+    pAudioPlayer->_4AA258(804);//stop sound
+    if ( party_running_flag && (!bJumping || jumping_up) ) //для бега
+    {
+      if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
+      {
+        if ( on_water )
+          pAudioPlayer->PlaySound(SOUND_RunAlongWater, 804, 1, -1, 0, 0, 0, 0);
+        else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
+          pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0);
+        else
+          pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
+        pParty->walk_sound_timer = 64;
+      }
+    }
+    else if ( party_walking_flag && (!bJumping || jumping_up) )//для ходьбы
+    {
+      if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
+      {
+        if ( on_water )
+          pAudioPlayer->PlaySound(SOUND_WalkAlongWater, 804, 1, -1, 0, 0, 0, 0);
+        else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
+          pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0);
+        else
+          pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
+        pParty->walk_sound_timer = 64;
+      }
+    }
+  }
+  if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//отключить  звук ходьбы при остановке
+    pAudioPlayer->_4AA258(804);
+  //-------------------------------------------------------------
+  if ( !bJumping || jumping_up )
+    pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
+  else
+    pParty->uFlags |= PARTY_FLAGS_1_FALLING;
+  pParty->uFlags &= ~0x200;
+  pParty->vPosition.x = new_party_x;
+  pParty->vPosition.z = new_party_z;
+  pParty->vPosition.y = new_party_y;
+  //pParty->uFallSpeed = v89;
+  if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
+    pParty->uFlags |= 0x200;
+  if (uFaceEvent)
+    EventProcessor(uFaceEvent, 0, 1);
 }
\ No newline at end of file