# HG changeset patch # User Ritor1 # Date 1386404750 -21600 # Node ID 48b790721bdc43eaafdffb3e4f78ff3e710917da # Parent 69af571f793b677f8165ac91975589c4e89d9ced WalkSound diff -r 69af571f793b -r 48b790721bdc AudioPlayer.h --- a/AudioPlayer.h Fri Dec 06 23:35:50 2013 +0600 +++ b/AudioPlayer.h Sat Dec 07 14:25:50 2013 +0600 @@ -79,6 +79,7 @@ SOUND_8 = 0x8, SOUND_24 = 24, SOUND_error = 27, + SOUND_RunAlongWater = 63, SOUND_RunAlong3DModel = 64, SOUND_Button = 66, SOUND_67 = 67, @@ -90,6 +91,7 @@ SOUND_83 = 83, SOUND_84 = 84, SOUND_85 = 85, + SOUND_WalkAlongWater = 102, SOUND_WalkAlong3DModel = 103, SOUND_Arcomage_LoseResources = 0x78, SOUND_Arcomage_AddResources = 0x79, diff -r 69af571f793b -r 48b790721bdc Indoor.cpp --- 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 diff -r 69af571f793b -r 48b790721bdc Outdoor.cpp --- a/Outdoor.cpp Fri Dec 06 23:35:50 2013 +0600 +++ b/Outdoor.cpp Sat Dec 07 14:25:50 2013 +0600 @@ -3796,8 +3796,6 @@ v105 = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); } - //} - //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); } } v109 = -1; @@ -4237,24 +4235,21 @@ } } else - { -//LABEL_150: - pParty->uFallStartY = pZ; - } + pParty->uFallStartY = pZ; if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) { *(float *)&v128 = 0.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 >> 1; - v126 = 0; stru_721530.field_0 = 1; stru_721530.height = pParty->uPartyHeight - 32; - do + for ( v126 = 0; v126 < 100; v126++ ) { stru_721530.position.x = pX; stru_721530.normal.x = pX; @@ -4271,7 +4266,7 @@ v36 = 13312; if ( stru_721530._47050A(v36) ) break; - _46E889_collide_against_bmodels(1u); + _46E889_collide_against_bmodels(1); v37 = WorldPosToGridCellZ(pParty->vPosition.y); v38 = WorldPosToGridCellX(pParty->vPosition.x); _46E26D_collide_against_sprites(v38, v37); @@ -4451,7 +4446,6 @@ if ( !v119 ) pZ = v122 + (pODMFace->pFacePlane.vNormal.z * v55 >> 16); } -//LABEL_220: v45 = stru_721530.uFaceID; if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) { @@ -4499,22 +4493,20 @@ *(float *)&v128 = 0.0; } } -//LABEL_234: 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; } - while ( v126 < 100 ); - + + //Воспроизведение звуков ходьбы/бега------------------------ + v122 = abs(pParty->vPosition.x - pX); + v126 = abs(pParty->vPosition.y - pY); + v62 = abs(pParty->vPosition.z - pZ); if ( bWalkSound && pParty->walk_sound_timer <= 0 ) { - pAudioPlayer->_4AA258(804); - v122 = abs(pParty->vPosition.x - pX); - v126 = abs(pParty->vPosition.y - pY); - v62 = abs(pParty->vPosition.z - pZ); + pAudioPlayer->_4AA258(804);//stop sound if ( party_running_flag && (!hovering || high_fall_flag) ) { if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) >= 16 ) @@ -4527,7 +4519,7 @@ v87 = pOutdoor->GetSoundIdByPosition(WorldPosToGridCellX(pParty->vPosition.x), WorldPosToGridCellZ(pParty->vPosition.y) - 1, 1); pAudioPlayer->PlaySound((SoundID)v87, 804, 1, -1, 0, 0, 0, 0);//бег по земле } - pParty->walk_sound_timer = 96; + pParty->walk_sound_timer = 96;//таймер для бега } } else if( party_walking_flag && (!hovering || high_fall_flag) ) @@ -4542,16 +4534,13 @@ } else pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи - pParty->walk_sound_timer = 64; + pParty->walk_sound_timer = 144;//таймер для ходьбы } } - //else - //{ - //pAudioPlayer->_4AA258(804); - //pParty->walk_sound_timer = 64; - //} } - + if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 )//отключить звук ходьбы при остановке + pAudioPlayer->_4AA258(804); +//------------------------------------------------------------------------ if ( !hovering || !high_fall_flag ) pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; else @@ -4649,7 +4638,7 @@ } else v78 = 1; -//LABEL_306: + if ( v77 ) { pParty->vPosition.x = pX; @@ -4658,6 +4647,7 @@ { pParty->vPosition.y = pY; } + if ( v78 || v77) { if ( bWaterWalk ) @@ -4683,7 +4673,7 @@ pAudioPlayer->_4AA258(804); pParty->walk_sound_timer = 64; } -//LABEL_318: + v81 = pZ; v82 = pZ; pParty->vPosition.z = pZ; @@ -4702,6 +4692,7 @@ if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; } + if ( !v103 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) && pParty->vPosition.y == pY diff -r 69af571f793b -r 48b790721bdc mm7_3.cpp --- a/mm7_3.cpp Fri Dec 06 23:35:50 2013 +0600 +++ b/mm7_3.cpp Sat Dec 07 14:25:50 2013 +0600 @@ -1451,611 +1451,6 @@ return result; } -//----- (00472866) -------------------------------------------------------- -void BLV_ProcessPartyActions() -{ - int v1; // ebx@1 - int v2; // edi@1 - //int v6; // eax@18 - //signed __int64 v8; // qax@27 - //int v9; // eax@27 - double v10; // st7@27 - unsigned int v12; // eax@49 - double v13; // st7@50 - //int v14; // eax@51 - //signed __int64 v15; // qax@53 - //double v16; // st7@54 - 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 - AudioPlayer *v56; // ecx@162 - SoundID v57; // [sp-20h] [bp-80h]@163 - signed int v58; // [sp-1Ch] [bp-7Ch]@161 - unsigned int v59; // [sp-18h] [bp-78h]@161 - signed int v60; // [sp-14h] [bp-74h]@161 - signed int v61; // [sp-10h] [bp-70h]@161 - int v62; // [sp-Ch] [bp-6Ch]@161 - int v63; // [sp-8h] [bp-68h]@75 - unsigned int v64; // [sp-8h] [bp-68h]@161 - int v65; // [sp-4h] [bp-64h]@75 - int v66; // [sp-4h] [bp-64h]@161 - //int v68; // [sp+10h] [bp-50h]@45 - int v69; // [sp+10h] [bp-50h]@140 - unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 - //signed int v71; // [sp+18h] [bp-48h]@1 - signed int v72; // [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 - int v78; // [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 v89; // [sp+58h] [bp-8h]@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); - v72 = 0; - v78 = 0; - 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); - v78 = 1; - break; - case PARTY_StrafeRight: - v2 += fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fWalkSpeedMultiplier / 2); - v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fWalkSpeedMultiplier / 2); - v78 = 1; - break; - case PARTY_WalkForward: - v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * v81 * fWalkSpeedMultiplier); - v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * v81 * fWalkSpeedMultiplier); - v78 = 1; - break; - case PARTY_WalkBackward: - v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), v81 * fBackwardWalkSpeedMultiplier); - v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), v81 * fBackwardWalkSpeedMultiplier); - v78 = 1; - break; - case PARTY_RunForward: - v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * v81 * fWalkSpeedMultiplier); - v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * v81 * fWalkSpeedMultiplier); - v72 = 1; - 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); - v72 = 1; - 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; - } - } - if ( bWalkSound && !pParty->walk_sound_timer) - { - 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 ) - { - pAudioPlayer->_4AA258(804); - pParty->walk_sound_timer = 64; - } - else if ( v72 && (!bJumping || jumping_up) ) - { - v66 = 0; - v64 = 0; - v62 = 0; - v61 = 0; - v60 = -1; - v59 = 1; - v58 = 804; - if ( !on_water ) - { - v56 = pAudioPlayer; - if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) - v57 = (SoundID)50; - else - v57 = (SoundID)64; - pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); - } - else - { - v57 = (SoundID)63; - v56 = pAudioPlayer; - pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); - } - } - else if ( v78 && (!bJumping || jumping_up) ) - { - v66 = 0; - v64 = 0; - v62 = 0; - v61 = 0; - v60 = -1; - v59 = 1; - v58 = 804; - if ( on_water ) - { - v57 = (SoundID)102; - v56 = pAudioPlayer; - } - else - { - v56 = pAudioPlayer; - if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) - v57 = (SoundID)89; - else - v57 = (SoundID)103; - } - pAudioPlayer->PlaySound(v57, v58, v59, v60, v61, v62, v64, v66); - } - else - { - pAudioPlayer->_4AA258(804); - pParty->walk_sound_timer = 64; - } - } - 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); -} - //----- (0047531C) -------------------------------------------------------- bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10) {