comparison Indoor.cpp @ 2091:75edfa36c4de

Слияние
author Ritor1
date Thu, 12 Dec 2013 09:28:05 +0600
parents e3d70131fb8b
children a869b0376b48
comparison
equal deleted inserted replaced
2090:2e2c7a4edb1d 2091:75edfa36c4de
39 #include "ParticleEngine.h" 39 #include "ParticleEngine.h"
40 #include "Outdoor_stuff.h" 40 #include "Outdoor_stuff.h"
41 #include "texts.h" 41 #include "texts.h"
42 #include "GUIWindow.h" 42 #include "GUIWindow.h"
43 #include "Level/Decoration.h" 43 #include "Level/Decoration.h"
44 44 #include "Overlays.h"
45 45
46 46
47 47
48 48
49 IndoorLocation *pIndoor = new IndoorLocation; 49 IndoorLocation *pIndoor = new IndoorLocation;
934 faces[num_faces].uFaceID = uFaceID; 934 faces[num_faces].uFaceID = uFaceID;
935 faces[num_faces++].uNodeID = node_id; 935 faces[num_faces++].uNodeID = node_id;
936 } 936 }
937 } 937 }
938 } 938 }
939
940 939
941 //----- (004AE5BA) -------------------------------------------------------- 940 //----- (004AE5BA) --------------------------------------------------------
942 Texture *BLVFace::GetTexture() 941 Texture *BLVFace::GetTexture()
943 { 942 {
944 unsigned int v1; // ecx@2 943 unsigned int v1; // ecx@2
3930 //signed int v35; // esi@56 3929 //signed int v35; // esi@56
3931 //int result; // eax@57 3930 //int result; // eax@57
3932 int v38; // edx@62 3931 int v38; // edx@62
3933 //int v44; // [sp+20h] [bp-20h]@10 3932 //int v44; // [sp+20h] [bp-20h]@10
3934 bool v47; // [sp+24h] [bp-1Ch]@43 3933 bool v47; // [sp+24h] [bp-1Ch]@43
3935 bool v48; // [sp+28h] [bp-18h]@10 3934 bool current_vertices_Y; // [sp+28h] [bp-18h]@10
3936 bool v49; // [sp+28h] [bp-18h]@41 3935 bool v49; // [sp+28h] [bp-18h]@41
3937 bool v50; // [sp+2Ch] [bp-14h]@12 3936 bool next_vertices_Y; // [sp+2Ch] [bp-14h]@12
3938 signed int v53; // [sp+30h] [bp-10h]@10 3937 signed int number_hits; // [sp+30h] [bp-10h]@10
3939 signed int v54; // [sp+30h] [bp-10h]@41 3938 signed int v54; // [sp+30h] [bp-10h]@41
3940 signed int v55; // [sp+34h] [bp-Ch]@1 3939 signed int v55; // [sp+34h] [bp-Ch]@1
3941 3940
3942 //LOG_DECOMPILATION_WARNING(); 3941 //LOG_DECOMPILATION_WARNING();
3943 3942
3967 blv_floor_face_vert_coord_Y[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; 3966 blv_floor_face_vert_coord_Y[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y;
3968 } 3967 }
3969 blv_floor_face_vert_coord_X[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_X[0]; 3968 blv_floor_face_vert_coord_X[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_X[0];
3970 blv_floor_face_vert_coord_Y[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_Y[0]; 3969 blv_floor_face_vert_coord_Y[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_Y[0];
3971 3970
3972 v50 = blv_floor_face_vert_coord_Y[0] >= y; 3971 next_vertices_Y = blv_floor_face_vert_coord_Y[0] >= y;
3973 v53 = 0; 3972 number_hits = 0;
3974 3973
3975 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) 3974 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j)
3976 { 3975 {
3977 if (v53 >= 2) 3976 if (number_hits >= 2)
3978 break; 3977 break;
3979 3978
3980 v48 = v50; 3979 current_vertices_Y = next_vertices_Y;
3981 v50 = blv_floor_face_vert_coord_Y[j + 1] >= y; 3980 next_vertices_Y = blv_floor_face_vert_coord_Y[j + 1] >= y;
3982 3981
3983 v13 = i; 3982 v13 = i;
3984 if (v48 == v50) 3983 if (current_vertices_Y == next_vertices_Y)
3985 continue; 3984 continue;
3986 3985
3987 v14 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2; 3986 v14 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2;
3988 v15 = v14 | (blv_floor_face_vert_coord_X[j] < x); 3987 v15 = v14 | (blv_floor_face_vert_coord_X[j] < x);
3989 3988
3990 if (v15 == 3) 3989 if (v15 == 3)
3991 continue; 3990 continue;
3992 else if (!v15) 3991 else if (!v15)
3993 ++v53; 3992 ++number_hits;
3994 else 3993 else
3995 { 3994 {
3996 long long a_div_b = fixpoint_div(y - blv_floor_face_vert_coord_Y[j], blv_floor_face_vert_coord_Y[j + 1] - blv_floor_face_vert_coord_Y[j]); 3995 long long a_div_b = fixpoint_div(y - blv_floor_face_vert_coord_Y[j], blv_floor_face_vert_coord_Y[j + 1] - blv_floor_face_vert_coord_Y[j]);
3997 long long res = fixpoint_mul((signed int)blv_floor_face_vert_coord_X[j + 1] - (signed int)blv_floor_face_vert_coord_X[j], a_div_b); 3996 long long res = fixpoint_mul((signed int)blv_floor_face_vert_coord_X[j + 1] - (signed int)blv_floor_face_vert_coord_X[j], a_div_b);
3998 3997
3999 if (res + blv_floor_face_vert_coord_X[j] >= x) 3998 if (res + blv_floor_face_vert_coord_X[j] >= x)
4000 ++v53; 3999 ++number_hits;
4001 } 4000 }
4002 } 4001 }
4003 4002
4004 4003
4005 if ( v53 == 1 ) 4004 if ( number_hits == 1 )
4006 { 4005 {
4007 if ( v55 >= 50 ) 4006 if ( v55 >= 50 )
4008 break; 4007 break;
4009 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) 4008 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling )
4010 { 4009 {
6844 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; 6843 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY;
6845 }*/ 6844 }*/
6846 } 6845 }
6847 return 0; 6846 return 0;
6848 } 6847 }
6848 //----- (00472866) --------------------------------------------------------
6849 void BLV_ProcessPartyActions()
6850 {
6851 int v1; // ebx@1
6852 int v2; // edi@1
6853 double v10; // st7@27
6854 unsigned int v12; // eax@49
6855 double v13; // st7@50
6856 int v17; // eax@62
6857 double v18; // st7@62
6858 int v19; // ST40_4@62
6859 int v20; // eax@65
6860 double v21; // st7@65
6861 int v22; // ST40_4@65
6862 int v23; // eax@66
6863 double v24; // st7@66
6864 int v25; // ST40_4@66
6865 int v26; // eax@67
6866 double v27; // st7@67
6867 int v28; // ST40_4@67
6868 int new_party_z; // esi@96
6869 int v38; // eax@96
6870 int v39; // ecx@106
6871 int v40; // eax@106
6872 int v42; // eax@120
6873 BLVFace *pFace; // esi@126
6874 int v46; // ecx@133
6875 int v52; // eax@140
6876 int v54; // ebx@146
6877 int v63; // [sp-8h] [bp-68h]@75
6878 int v65; // [sp-4h] [bp-64h]@75
6879 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1
6880 bool party_running_flag; // [sp+1Ch] [bp-44h]@1
6881 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15
6882 unsigned int uSectorID; // [sp+28h] [bp-38h]@1
6883 bool party_walking_flag; // [sp+2Ch] [bp-34h]@1
6884 unsigned int uFaceID; // [sp+30h] [bp-30h]@1
6885 int v80; // [sp+34h] [bp-2Ch]@1
6886 int v82; // [sp+3Ch] [bp-24h]@47
6887 int _view_angle; // [sp+40h] [bp-20h]@47
6888 int bJumping; // [sp+44h] [bp-1Ch]@1
6889 int new_party_y; // [sp+48h] [bp-18h]@1
6890 int new_party_x; // [sp+4Ch] [bp-14h]@1
6891 int party_z; // [sp+50h] [bp-10h]@1
6892 int angle; // [sp+5Ch] [bp-4h]@47
6893
6894 uFaceEvent = 0;
6895 //v89 = pParty->uFallSpeed;
6896 v1 = 0;
6897 v2 = 0;
6898 new_party_x = pParty->vPosition.x;
6899 new_party_y = pParty->vPosition.y;
6900 party_z = pParty->vPosition.z;
6901 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z);
6902 party_running_flag = false;
6903 party_walking_flag = false;
6904 bJumping = false;
6905
6906 uFaceID = -1;
6907 int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
6908
6909 if ( pParty->bFlying )
6910 {
6911 pParty->bFlying = false;
6912 if (pParty->FlyActive())
6913 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1;
6914 }
6915
6916 if ( floor_level == -30000 || uFaceID == -1)
6917 {
6918 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID);
6919 if ( floor_level == -30000 || uFaceID == -1)
6920 {
6921 __debugbreak(); // level built with errors
6922 pParty->vPosition.x = blv_prev_party_x;
6923 pParty->vPosition.y = blv_prev_party_z;
6924 pParty->vPosition.z = blv_prev_party_y;
6925 pParty->uFallStartY = blv_prev_party_y;
6926 return;
6927 }
6928 }
6929
6930 blv_prev_party_x = pParty->vPosition.x;
6931 blv_prev_party_z = pParty->vPosition.y;
6932 blv_prev_party_y = pParty->vPosition.z;
6933 if (!pParty->bTurnBasedModeOn)
6934 {
6935 int v67 = GetTickCount() / 500;
6936 if (dword_720CDC != v67 )
6937 {
6938 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x;
6939 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y;
6940 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z;
6941 if ( dword_4F8580[0] > 60 )
6942 dword_4F8580[0] = 1;
6943 }
6944 dword_720CDC = v67;
6945 }
6946
6947 uint fall_start;
6948 if (!pParty->FeatherFallActive())
6949 {
6950 bFeatherFall = false;
6951 if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && // grants feather fall
6952 !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
6953 !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) &&
6954 !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT))
6955 {
6956 fall_start = pParty->uFallStartY;
6957 }
6958 }
6959 else
6960 {
6961 fall_start = floor_level;
6962 bFeatherFall = true;
6963 pParty->uFallStartY = floor_level;
6964 }
6965
6966
6967 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1)
6968 {
6969 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor?
6970 if (pParty->uFlags & PARTY_FLAGS_1_LANDING)
6971 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING;
6972 else for (uint i = 0; i < 4; ++i)
6973 { // receive falling damage
6974 if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS))
6975 {
6976 pParty->pPlayers[i].ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * pParty->pPlayers[i].GetMaxHealth()) / 256, DMGT_PHISYCAL);
6977 v10 = (double)(20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333;
6978 pParty->pPlayers[i].SetRecoveryTime((signed __int64)v10);
6979 }
6980 }
6981 }
6982
6983 if ( party_z > floor_level + 1 )
6984 bJumping = 1;
6985
6986 bool jumping_up = false;
6987
6988 if ( party_z - floor_level <= 32 )
6989 {
6990 pParty->uFallStartY = party_z;
6991 jumping_up = true;
6992 }
6993
6994 if (bWalkSound && pParty->walk_sound_timer)
6995 {
6996 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed)
6997 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed;
6998 else pParty->walk_sound_timer = 0;
6999 }
7000
7001
7002 if (party_z <= floor_level + 1)
7003 {
7004 party_z = floor_level + 1;
7005 pParty->uFallStartY = floor_level + 1;
7006
7007 if (!bJumping && pParty->floor_face_pid != uFaceID)
7008 {
7009 if (pIndoor->pFaces[uFaceID].uAttributes & FACE_PRESSURE_PLATE)
7010 uFaceEvent = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].uEventID;
7011 }
7012 }
7013 if (!bJumping)
7014 pParty->floor_face_pid = uFaceID;
7015
7016 bool on_water = false;
7017 if ( pIndoor->pFaces[uFaceID].Fluid())
7018 on_water = true;
7019
7020 //v81 = pParty->uWalkSpeed;
7021 angle = pParty->sRotationY;
7022 _view_angle = pParty->sRotationX;
7023 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi)
7024 / 180)) >> 16;
7025 while ( pPartyActionQueue->uNumActions )
7026 {
7027 switch ( pPartyActionQueue->Next() )
7028 {
7029 case PARTY_TurnLeft:
7030 if (uTurnSpeed)
7031 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
7032 else
7033 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier));
7034 break;
7035 case PARTY_TurnRight:
7036 if (uTurnSpeed)
7037 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
7038 else
7039 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier));
7040 break;
7041
7042 case PARTY_FastTurnLeft:
7043 if (uTurnSpeed)
7044 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed);
7045 else
7046 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
7047 break;
7048
7049 case PARTY_FastTurnRight:
7050 if (uTurnSpeed)
7051 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed);
7052 else
7053 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82));
7054 break;
7055
7056 case PARTY_StrafeLeft:
7057 v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2);
7058 v1 += fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2);
7059 party_walking_flag = true;
7060 break;
7061 case PARTY_StrafeRight:
7062 v2 += fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2);
7063 v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2);
7064 party_walking_flag = true;
7065 break;
7066 case PARTY_WalkForward:
7067 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
7068 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
7069 party_walking_flag = true;
7070 break;
7071 case PARTY_WalkBackward:
7072 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier);
7073 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier);
7074 party_walking_flag = true;
7075 break;
7076 case PARTY_RunForward:
7077 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
7078 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier);
7079 party_running_flag = true;
7080 break;
7081 case PARTY_RunBackward:
7082 //v32 = stru_5C6E00->SinCos(angle);
7083 //v33 = (double)v81;
7084 //v88 = (double)v81;
7085 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier);
7086 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi);
7087 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier);
7088 party_running_flag = true;
7089 break;
7090 case PARTY_LookUp:
7091 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0);
7092 if ( _view_angle > 128 )
7093 _view_angle = 128;
7094 if ( uActiveCharacter )
7095 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_63, 0);
7096 break;
7097 case PARTY_LookDown:
7098 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0);
7099 if ( _view_angle < -128 )
7100 _view_angle = -128;
7101 if ( uActiveCharacter )
7102 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_64, 0);
7103 break;
7104 case PARTY_CenterView:
7105 _view_angle = 0;
7106 break;
7107 case PARTY_Jump:
7108 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 )
7109 {
7110 bJumping = 1;
7111 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed);
7112 }
7113 break;
7114 default:
7115 break;
7116 }
7117 }
7118 pParty->sRotationY = angle;
7119 pParty->sRotationX = _view_angle;
7120 if ( bJumping )
7121 {
7122 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength();
7123 if ( bJumping && pParty->uFallSpeed <= 0 )
7124 {
7125 if ( pParty->uFallSpeed < -500 && !pParty->bFlying )
7126 {
7127 for ( uint pl = 1; pl <= 4; pl++ )
7128 {
7129 if ( !pPlayers[pl]->HasEnchantedItemEquipped(72)
7130 && !pPlayers[pl]->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8
7131 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0);
7132 }
7133 }
7134 }
7135 else
7136 pParty->uFallStartY = party_z;
7137 }
7138 else
7139 {
7140 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 )
7141 {
7142 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength();
7143 pParty->uFallStartY = party_z;
7144 }
7145 else
7146 {
7147 if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) )
7148 pParty->uFallSpeed = 0;
7149 pParty->uFallStartY = party_z;
7150 }
7151 }
7152 if ( v2 * v2 + v1 * v1 < 400 )
7153 {
7154 v1 = 0;
7155 v2 = 0;
7156 }
7157
7158 stru_721530.field_84 = -1;
7159 stru_721530.field_70 = 0;
7160 stru_721530.prolly_normal_d = pParty->field_14_radius;
7161 stru_721530.field_8_radius = pParty->field_14_radius / 2;
7162 stru_721530.field_0 = 1;
7163 stru_721530.height = pParty->uPartyHeight - 32;
7164 for ( uint i = 0; i < 100; i++ )
7165 {
7166 new_party_z = party_z;
7167 stru_721530.position.x = new_party_x;
7168 stru_721530.position.y = new_party_y;
7169 stru_721530.position.z = stru_721530.height + party_z + 1;
7170
7171 stru_721530.normal.x = new_party_x;
7172 stru_721530.normal.y = new_party_y;
7173 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1;
7174
7175 stru_721530.velocity.x = v2;
7176 stru_721530.velocity.y = v1;
7177 stru_721530.velocity.z = pParty->uFallSpeed;
7178
7179 stru_721530.uSectorID = uSectorID;
7180 v38 = 0;
7181 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == 3 )
7182 v38 = 13312;
7183 if ( stru_721530._47050A(v38) )
7184 break;
7185 for ( uint j = 0; j < 100; ++j )
7186 {
7187 _46E44E_collide_against_faces_and_portals(1);
7188 _46E0B2_collide_against_decorations();
7189 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 )
7190 Actor::_46DF1A_collide_against_actor(v80, 0);
7191 if ( _46F04E_collide_against_portals() )
7192 break;
7193 }
7194 if ( stru_721530.field_7C >= stru_721530.field_6C )
7195 {
7196 v39 = stru_721530.normal2.x;
7197 uSectorID = stru_721530.normal2.y;
7198 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
7199 }
7200 else
7201 {
7202 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x;
7203 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16);
7204 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16);
7205 }
7206 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID);
7207 if ( v42 == -30000 || v42 - new_party_z > 128 )
7208 return;
7209 if ( stru_721530.field_7C >= stru_721530.field_6C )
7210 {
7211 new_party_x = stru_721530.normal2.x;
7212 new_party_y = stru_721530.normal2.y;
7213 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1;
7214 break;
7215 }
7216 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16;
7217 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16;
7218 uSectorID = stru_721530.uSectorID;
7219 stru_721530.field_70 += stru_721530.field_7C;
7220 unsigned long long v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z;
7221 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor)
7222 {
7223 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0
7224 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) )
7225 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset();
7226 viewparams->bRedrawGameUI = true;
7227 }
7228 else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration)
7229 {
7230 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x,
7231 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y);
7232 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)integer_sqrt(v2 * v2 + v1 * v1)) >> 16;
7233 v1 = (unsigned __int64)(stru_5C6E00->Sin(v54) * (signed __int64)integer_sqrt(v2 * v2 + v1 * v1)) >> 16;
7234 }
7235 else
7236 {
7237 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel)
7238 {
7239 pFace = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3];
7240 if ( pFace->uPolygonType == POLYGON_Floor )
7241 {
7242 if ( pParty->uFallSpeed < 0 )
7243 pParty->uFallSpeed = 0;
7244 v87 = pIndoor->pVertices[*pFace->pVertexIDs].z + 1;
7245 if ( pParty->uFallStartY - v87 < 512 )
7246 pParty->uFallStartY = v87;
7247 if ( v2 * v2 + v1 * v1 < 400 )
7248 {
7249 v1 = 0;
7250 v2 = 0;
7251 }
7252 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 )
7253 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
7254 }
7255 else
7256 {
7257 v46 = pParty->uFallSpeed * pFace->pFacePlane_old.vNormal.z;
7258 if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall )
7259 {
7260 v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
7261 if ((stru_721530.speed >> 3) > v80 )
7262 v80 = stru_721530.speed >> 3;
7263 v2 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.x) >> 16;
7264 v1 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.y) >> 16;
7265 pParty->uFallSpeed += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.z) >> 16;
7266 //v80 = pFace->pFacePlane_old.vNormal.y;
7267 v52 = stru_721530.prolly_normal_d - ((pFace->pFacePlane_old.dist
7268 + v87 * pFace->pFacePlane_old.vNormal.z
7269 + new_party_y * pFace->pFacePlane_old.vNormal.y
7270 + new_party_x * pFace->pFacePlane_old.vNormal.x) >> 16);
7271 if ( v52 > 0 )
7272 {
7273 new_party_x += v52 * pFace->pFacePlane_old.vNormal.x >> 16;
7274 new_party_y += v52 * pFace->pFacePlane_old.vNormal.y >> 16;
7275 v87 += v52 * pFace->pFacePlane_old.vNormal.z >> 16;
7276 }
7277 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 )
7278 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
7279 }
7280 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall )
7281 {
7282 v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16;
7283 if ((stru_721530.speed >> 3) > v80 )
7284 v80 = stru_721530.speed >> 3;
7285 v2 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.x) >> 16;
7286 v1 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.y) >> 16;
7287 pParty->uFallSpeed += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.z) >> 16;
7288 if ( v2 * v2 + v1 * v1 >= 400 )
7289 {
7290 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 )
7291 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID;
7292 }
7293 else
7294 {
7295 v2 = 0;
7296 v1 = 0;
7297 pParty->uFallSpeed = 0;
7298 }
7299 }
7300 }
7301 }
7302 }
7303 v2 = (unsigned __int64)(58500i64 * v2) >> 16;
7304 v1 = (unsigned __int64)(58500i64 * v1) >> 16;
7305 //++v83;
7306 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16;
7307 //if ( v83 >= 100 )
7308 //{
7309 //new_party_z = v87;
7310 //break;
7311 //}
7312 }
7313
7314 // // /-------------------------
7315 uint pX_ = pParty->vPosition.x - new_party_x;
7316 uint pY_ = pParty->vPosition.y - new_party_y;
7317 uint pZ_ = pParty->vPosition.z - new_party_z;
7318 if ( bWalkSound && pParty->walk_sound_timer <= 0 )
7319 {
7320 pAudioPlayer->_4AA258(804);//stop sound
7321 if ( party_running_flag && (!bJumping || jumping_up) ) //
7322 {
7323 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 )
7324 {
7325 if ( on_water )
7326 pAudioPlayer->PlaySound(SOUND_RunAlongWater, 804, 1, -1, 0, 0, 0, 0);
7327 else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
7328 pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0);
7329 else
7330 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
7331 pParty->walk_sound_timer = 64;
7332 }
7333 }
7334 else if ( party_walking_flag && (!bJumping || jumping_up) )//
7335 {
7336 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 )
7337 {
7338 if ( on_water )
7339 pAudioPlayer->PlaySound(SOUND_WalkAlongWater, 804, 1, -1, 0, 0, 0, 0);
7340 else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 )
7341 pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0);
7342 else
7343 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);
7344 pParty->walk_sound_timer = 64;
7345 }
7346 }
7347 }
7348 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//
7349 pAudioPlayer->_4AA258(804);
7350 //-------------------------------------------------------------
7351 if ( !bJumping || jumping_up )
7352 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING;
7353 else
7354 pParty->uFlags |= PARTY_FLAGS_1_FALLING;
7355 pParty->uFlags &= ~0x200;
7356 pParty->vPosition.x = new_party_x;
7357 pParty->vPosition.z = new_party_z;
7358 pParty->vPosition.y = new_party_y;
7359 //pParty->uFallSpeed = v89;
7360 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 )
7361 pParty->uFlags |= 0x200;
7362 if (uFaceEvent)
7363 EventProcessor(uFaceEvent, 0, 1);
7364 }