Mercurial > mm7
comparison Indoor.cpp @ 2085:52abdea20b9e
Door_switch_animation
author | Ritor1 |
---|---|
date | Wed, 11 Dec 2013 23:12:54 +0600 |
parents | b2a434d65344 |
children | 3920278a2905 |
comparison
equal
deleted
inserted
replaced
2068:a290d9fbdc95 | 2085:52abdea20b9e |
---|---|
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; |
3978 //signed int v35; // esi@56 | 3978 //signed int v35; // esi@56 |
3979 //int result; // eax@57 | 3979 //int result; // eax@57 |
3980 int v38; // edx@62 | 3980 int v38; // edx@62 |
3981 //int v44; // [sp+20h] [bp-20h]@10 | 3981 //int v44; // [sp+20h] [bp-20h]@10 |
3982 bool v47; // [sp+24h] [bp-1Ch]@43 | 3982 bool v47; // [sp+24h] [bp-1Ch]@43 |
3983 bool v48; // [sp+28h] [bp-18h]@10 | 3983 bool current_vertices_Y; // [sp+28h] [bp-18h]@10 |
3984 bool v49; // [sp+28h] [bp-18h]@41 | 3984 bool v49; // [sp+28h] [bp-18h]@41 |
3985 bool v50; // [sp+2Ch] [bp-14h]@12 | 3985 bool next_vertices_Y; // [sp+2Ch] [bp-14h]@12 |
3986 signed int v53; // [sp+30h] [bp-10h]@10 | 3986 signed int number_hits; // [sp+30h] [bp-10h]@10 |
3987 signed int v54; // [sp+30h] [bp-10h]@41 | 3987 signed int v54; // [sp+30h] [bp-10h]@41 |
3988 signed int v55; // [sp+34h] [bp-Ch]@1 | 3988 signed int v55; // [sp+34h] [bp-Ch]@1 |
3989 | 3989 |
3990 //LOG_DECOMPILATION_WARNING(); | 3990 //LOG_DECOMPILATION_WARNING(); |
3991 | 3991 |
3992 static int blv_floor_id[50]; // 00721200 | 3992 static int blv_floor_id[50]; // 00721200 |
3993 static int blv_floor_level[50]; // 007212C8 | 3993 static int blv_floor_level[50]; // 007212C8 |
3994 | 3994 |
3995 static __int16 word_721390_ys[104]; // idb | 3995 static __int16 blv_floor_face_vert_coord_Y[104]; // word_721390_ys |
3996 static __int16 word_721460_xs[104]; // idb | 3996 static __int16 blv_floor_face_vert_coord_X[104]; // word_721460_xs |
3997 | 3997 |
3998 BLVSector* pSector = &pIndoor->pSectors[uSectorID]; | 3998 BLVSector* pSector = &pIndoor->pSectors[uSectorID]; |
3999 v55 = 0; | 3999 v55 = 0; |
4000 for (uint i = 0; i < pSector->uNumFloors; ++i) | 4000 for (uint i = 0; i < pSector->uNumFloors; ++i) |
4001 { | 4001 { |
4007 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && | 4007 if (x <= pFloor->pBounding.x2 && x >= pFloor->pBounding.x1 && |
4008 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) | 4008 y <= pFloor->pBounding.y2 && y >= pFloor->pBounding.y1) |
4009 { | 4009 { |
4010 for (uint j = 0; j < pFloor->uNumVertices; ++j) | 4010 for (uint j = 0; j < pFloor->uNumVertices; ++j) |
4011 { | 4011 { |
4012 word_721460_xs[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; | 4012 blv_floor_face_vert_coord_X[2 * j] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].x; |
4013 word_721460_xs[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; | 4013 blv_floor_face_vert_coord_X[2 * j + 1] = pFloor->pXInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].x; |
4014 word_721390_ys[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; | 4014 blv_floor_face_vert_coord_Y[2 * j] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j]].y; |
4015 word_721390_ys[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; | 4015 blv_floor_face_vert_coord_Y[2 * j + 1] = pFloor->pYInterceptDisplacements[j] + pIndoor->pVertices[pFloor->pVertexIDs[j + 1]].y; |
4016 } | 4016 } |
4017 word_721460_xs[2 * pFloor->uNumVertices] = word_721460_xs[0]; | 4017 blv_floor_face_vert_coord_X[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_X[0]; |
4018 word_721390_ys[2 * pFloor->uNumVertices] = word_721390_ys[0]; | 4018 blv_floor_face_vert_coord_Y[2 * pFloor->uNumVertices] = blv_floor_face_vert_coord_Y[0]; |
4019 | 4019 |
4020 v50 = word_721390_ys[0] >= y; | 4020 next_vertices_Y = blv_floor_face_vert_coord_Y[0] >= y; |
4021 v53 = 0; | 4021 number_hits = 0; |
4022 | 4022 |
4023 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) | 4023 for (uint j = 0; j < 2 * pFloor->uNumVertices; ++j) |
4024 { | 4024 { |
4025 if (v53 >= 2) | 4025 if (number_hits >= 2) |
4026 break; | 4026 break; |
4027 | 4027 |
4028 v48 = v50; | 4028 current_vertices_Y = next_vertices_Y; |
4029 v50 = word_721390_ys[j + 1] >= y; | 4029 next_vertices_Y = blv_floor_face_vert_coord_Y[j + 1] >= y; |
4030 | 4030 |
4031 v13 = i; | 4031 v13 = i; |
4032 if (v48 == v50) | 4032 if (current_vertices_Y == next_vertices_Y) |
4033 continue; | 4033 continue; |
4034 | 4034 |
4035 v14 = word_721460_xs[j + 1] >= x ? 0 : 2; | 4035 v14 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2; |
4036 v15 = v14 | (word_721460_xs[j] < x); | 4036 v15 = v14 | (blv_floor_face_vert_coord_X[j] < x); |
4037 | 4037 |
4038 if (v15 == 3) | 4038 if (v15 == 3) |
4039 continue; | 4039 continue; |
4040 else if (!v15) | 4040 else if (!v15) |
4041 ++v53; | 4041 ++number_hits; |
4042 else | 4042 else |
4043 { | 4043 { |
4044 long long a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); | 4044 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]); |
4045 long long res = fixpoint_mul((signed int)word_721460_xs[j + 1] - (signed int)word_721460_xs[j], a_div_b); | 4045 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); |
4046 | 4046 |
4047 if (res + word_721460_xs[j] >= x) | 4047 if (res + blv_floor_face_vert_coord_X[j] >= x) |
4048 ++v53; | 4048 ++number_hits; |
4049 } | 4049 } |
4050 } | 4050 } |
4051 | 4051 |
4052 | 4052 |
4053 if ( v53 == 1 ) | 4053 if ( number_hits == 1 ) |
4054 { | 4054 { |
4055 if ( v55 >= 50 ) | 4055 if ( v55 >= 50 ) |
4056 break; | 4056 break; |
4057 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) | 4057 if ( pFloor->uPolygonType == POLYGON_Floor || pFloor->uPolygonType == POLYGON_Ceiling ) |
4058 { | 4058 { |
4084 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && | 4084 if (x <= portal->pBounding.x2 && x >= portal->pBounding.x1 && |
4085 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) | 4085 y <= portal->pBounding.y2 && y >= portal->pBounding.y1 ) |
4086 { | 4086 { |
4087 for (uint j = 0; j < portal->uNumVertices; ++j) | 4087 for (uint j = 0; j < portal->uNumVertices; ++j) |
4088 { | 4088 { |
4089 word_721460_xs[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; | 4089 blv_floor_face_vert_coord_X[2 * j] = portal->pXInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].x; |
4090 word_721460_xs[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; | 4090 blv_floor_face_vert_coord_X[2 * j + 1] = portal->pXInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].x; |
4091 word_721390_ys[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; | 4091 blv_floor_face_vert_coord_Y[2 * j] = portal->pYInterceptDisplacements[j] + pIndoor->pVertices[portal->pVertexIDs[j]].y; |
4092 word_721390_ys[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; | 4092 blv_floor_face_vert_coord_Y[2 * j + 1] = portal->pYInterceptDisplacements[j + 1] + pIndoor->pVertices[portal->pVertexIDs[j + 1]].y; |
4093 } | 4093 } |
4094 word_721460_xs[2 * portal->uNumVertices] = word_721460_xs[0]; | 4094 blv_floor_face_vert_coord_X[2 * portal->uNumVertices] = blv_floor_face_vert_coord_X[0]; |
4095 word_721390_ys[2 * portal->uNumVertices] = word_721390_ys[0]; | 4095 blv_floor_face_vert_coord_Y[2 * portal->uNumVertices] = blv_floor_face_vert_coord_Y[0]; |
4096 v54 = 0; | 4096 v54 = 0; |
4097 v47 = word_721390_ys[0] >= y; | 4097 v47 = blv_floor_face_vert_coord_Y[0] >= y; |
4098 | 4098 |
4099 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) | 4099 for (uint j = 0; j < 2 * portal->uNumVertices; ++j) |
4100 { | 4100 { |
4101 v49 = v47; | 4101 v49 = v47; |
4102 if ( v54 >= 2 ) | 4102 if ( v54 >= 2 ) |
4103 break; | 4103 break; |
4104 v47 = word_721390_ys[j + 1] >= y; | 4104 v47 = blv_floor_face_vert_coord_Y[j + 1] >= y; |
4105 if ( v49 != v47 ) | 4105 if ( v49 != v47 ) |
4106 { | 4106 { |
4107 v28 = word_721460_xs[j + 1] >= x ? 0 : 2; | 4107 v28 = blv_floor_face_vert_coord_X[j + 1] >= x ? 0 : 2; |
4108 v29 = v28 | (word_721460_xs[j] < x); | 4108 v29 = v28 | (blv_floor_face_vert_coord_X[j] < x); |
4109 if ( v29 != 3 ) | 4109 if ( v29 != 3 ) |
4110 { | 4110 { |
4111 if ( !v29 ) | 4111 if ( !v29 ) |
4112 ++v54; | 4112 ++v54; |
4113 else | 4113 else |
4114 { | 4114 { |
4115 long long a_div_b = fixpoint_div(y - word_721390_ys[j], word_721390_ys[j + 1] - word_721390_ys[j]); | 4115 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]); |
4116 long long res = fixpoint_mul(word_721460_xs[j + 1] - word_721460_xs[j], a_div_b); | 4116 long long res = fixpoint_mul(blv_floor_face_vert_coord_X[j + 1] - blv_floor_face_vert_coord_X[j], a_div_b); |
4117 if (res + word_721460_xs[j] >= x) | 4117 if (res + blv_floor_face_vert_coord_X[j] >= x) |
4118 ++v54; | 4118 ++v54; |
4119 } | 4119 } |
4120 } | 4120 } |
4121 } | 4121 } |
4122 } | 4122 } |
6892 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; | 6892 a1->vWorldViewPosition.y = v14 * pBLVRenderParams->fSineY + v12 * pBLVRenderParams->fCosineY; |
6893 }*/ | 6893 }*/ |
6894 } | 6894 } |
6895 return 0; | 6895 return 0; |
6896 } | 6896 } |
6897 //----- (00472866) -------------------------------------------------------- | |
6898 void BLV_ProcessPartyActions() | |
6899 { | |
6900 int v1; // ebx@1 | |
6901 int v2; // edi@1 | |
6902 double v10; // st7@27 | |
6903 unsigned int v12; // eax@49 | |
6904 double v13; // st7@50 | |
6905 int v17; // eax@62 | |
6906 double v18; // st7@62 | |
6907 int v19; // ST40_4@62 | |
6908 int v20; // eax@65 | |
6909 double v21; // st7@65 | |
6910 int v22; // ST40_4@65 | |
6911 int v23; // eax@66 | |
6912 double v24; // st7@66 | |
6913 int v25; // ST40_4@66 | |
6914 int v26; // eax@67 | |
6915 double v27; // st7@67 | |
6916 int v28; // ST40_4@67 | |
6917 int new_party_z; // esi@96 | |
6918 int v38; // eax@96 | |
6919 int v39; // ecx@106 | |
6920 int v40; // eax@106 | |
6921 int v42; // eax@120 | |
6922 BLVFace *pFace; // esi@126 | |
6923 int v46; // ecx@133 | |
6924 int v52; // eax@140 | |
6925 int v54; // ebx@146 | |
6926 int v63; // [sp-8h] [bp-68h]@75 | |
6927 int v65; // [sp-4h] [bp-64h]@75 | |
6928 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 | |
6929 bool party_running_flag; // [sp+1Ch] [bp-44h]@1 | |
6930 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 | |
6931 unsigned int uSectorID; // [sp+28h] [bp-38h]@1 | |
6932 bool party_walking_flag; // [sp+2Ch] [bp-34h]@1 | |
6933 unsigned int uFaceID; // [sp+30h] [bp-30h]@1 | |
6934 int v80; // [sp+34h] [bp-2Ch]@1 | |
6935 int v82; // [sp+3Ch] [bp-24h]@47 | |
6936 int _view_angle; // [sp+40h] [bp-20h]@47 | |
6937 int bJumping; // [sp+44h] [bp-1Ch]@1 | |
6938 int new_party_y; // [sp+48h] [bp-18h]@1 | |
6939 int new_party_x; // [sp+4Ch] [bp-14h]@1 | |
6940 int party_z; // [sp+50h] [bp-10h]@1 | |
6941 int angle; // [sp+5Ch] [bp-4h]@47 | |
6942 | |
6943 uFaceEvent = 0; | |
6944 //v89 = pParty->uFallSpeed; | |
6945 v1 = 0; | |
6946 v2 = 0; | |
6947 new_party_x = pParty->vPosition.x; | |
6948 new_party_y = pParty->vPosition.y; | |
6949 party_z = pParty->vPosition.z; | |
6950 uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); | |
6951 party_running_flag = false; | |
6952 party_walking_flag = false; | |
6953 bJumping = false; | |
6954 | |
6955 uFaceID = -1; | |
6956 int floor_level = collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); | |
6957 | |
6958 if ( pParty->bFlying ) | |
6959 { | |
6960 pParty->bFlying = false; | |
6961 if (pParty->FlyActive()) | |
6962 pOtherOverlayList->pOverlays[pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID - 1].field_E |= 1; | |
6963 } | |
6964 | |
6965 if ( floor_level == -30000 || uFaceID == -1) | |
6966 { | |
6967 floor_level = collide_against_floor_approximate(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); | |
6968 if ( floor_level == -30000 || uFaceID == -1) | |
6969 { | |
6970 __debugbreak(); // level built with errors | |
6971 pParty->vPosition.x = blv_prev_party_x; | |
6972 pParty->vPosition.y = blv_prev_party_z; | |
6973 pParty->vPosition.z = blv_prev_party_y; | |
6974 pParty->uFallStartY = blv_prev_party_y; | |
6975 return; | |
6976 } | |
6977 } | |
6978 | |
6979 blv_prev_party_x = pParty->vPosition.x; | |
6980 blv_prev_party_z = pParty->vPosition.y; | |
6981 blv_prev_party_y = pParty->vPosition.z; | |
6982 if (!pParty->bTurnBasedModeOn) | |
6983 { | |
6984 int v67 = GetTickCount() / 500; | |
6985 if (dword_720CDC != v67 ) | |
6986 { | |
6987 dword_4F8580[3 * dword_4F8580[1]] = pParty->vPosition.x; | |
6988 dword_4F8580[3 * dword_4F8580[2]] = pParty->vPosition.y; | |
6989 dword_4F8580[3 * dword_4F8580[3]] = pParty->vPosition.z; | |
6990 if ( dword_4F8580[0] > 60 ) | |
6991 dword_4F8580[0] = 1; | |
6992 } | |
6993 dword_720CDC = v67; | |
6994 } | |
6995 | |
6996 uint fall_start; | |
6997 if (!pParty->FeatherFallActive()) | |
6998 { | |
6999 bFeatherFall = false; | |
7000 if (!pParty->pPlayers[0].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && // grants feather fall | |
7001 !pParty->pPlayers[1].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
7002 !pParty->pPlayers[2].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT) && | |
7003 !pParty->pPlayers[3].WearsItemAnyWhere(ITEM_ARTIFACT_LADYS_ESCORT)) | |
7004 { | |
7005 fall_start = pParty->uFallStartY; | |
7006 } | |
7007 } | |
7008 else | |
7009 { | |
7010 fall_start = floor_level; | |
7011 bFeatherFall = true; | |
7012 pParty->uFallStartY = floor_level; | |
7013 } | |
7014 | |
7015 | |
7016 if (fall_start - party_z > 512 && !bFeatherFall && party_z <= floor_level + 1) | |
7017 { | |
7018 assert(~pParty->uFlags & PARTY_FLAGS_1_LANDING); // why land in indoor? | |
7019 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) | |
7020 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | |
7021 else for (uint i = 0; i < 4; ++i) | |
7022 { // receive falling damage | |
7023 if (!pParty->pPlayers[i].HasEnchantedItemEquipped(72) && !pParty->pPlayers[i].WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS)) | |
7024 { | |
7025 pParty->pPlayers[i].ReceiveDamage((pParty->uFallStartY - party_z) * (0.1f * pParty->pPlayers[i].GetMaxHealth()) / 256, DMGT_PHISYCAL); | |
7026 v10 = (double)(20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance())) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; | |
7027 pParty->pPlayers[i].SetRecoveryTime((signed __int64)v10); | |
7028 } | |
7029 } | |
7030 } | |
7031 | |
7032 if ( party_z > floor_level + 1 ) | |
7033 bJumping = 1; | |
7034 | |
7035 bool jumping_up = false; | |
7036 | |
7037 if ( party_z - floor_level <= 32 ) | |
7038 { | |
7039 pParty->uFallStartY = party_z; | |
7040 jumping_up = true; | |
7041 } | |
7042 | |
7043 if (bWalkSound && pParty->walk_sound_timer) | |
7044 { | |
7045 if (pParty->walk_sound_timer > pEventTimer->uTimeElapsed) | |
7046 pParty->walk_sound_timer -= pEventTimer->uTimeElapsed; | |
7047 else pParty->walk_sound_timer = 0; | |
7048 } | |
7049 | |
7050 | |
7051 if (party_z <= floor_level + 1) | |
7052 { | |
7053 party_z = floor_level + 1; | |
7054 pParty->uFallStartY = floor_level + 1; | |
7055 | |
7056 if (!bJumping && pParty->floor_face_pid != uFaceID) | |
7057 { | |
7058 if (pIndoor->pFaces[uFaceID].uAttributes & FACE_PRESSURE_PLATE) | |
7059 uFaceEvent = pIndoor->pFaceExtras[pIndoor->pFaces[uFaceID].uFaceExtraID].uEventID; | |
7060 } | |
7061 } | |
7062 if (!bJumping) | |
7063 pParty->floor_face_pid = uFaceID; | |
7064 | |
7065 bool on_water = false; | |
7066 if ( pIndoor->pFaces[uFaceID].Fluid()) | |
7067 on_water = true; | |
7068 | |
7069 //v81 = pParty->uWalkSpeed; | |
7070 angle = pParty->sRotationY; | |
7071 _view_angle = pParty->sRotationX; | |
7072 v82 = (unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->y_rotation_speed * stru_5C6E00->uIntegerPi) | |
7073 / 180)) >> 16; | |
7074 while ( pPartyActionQueue->uNumActions ) | |
7075 { | |
7076 switch ( pPartyActionQueue->Next() ) | |
7077 { | |
7078 case PARTY_TurnLeft: | |
7079 if (uTurnSpeed) | |
7080 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
7081 else | |
7082 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(v82 * fTurnSpeedMultiplier)); | |
7083 break; | |
7084 case PARTY_TurnRight: | |
7085 if (uTurnSpeed) | |
7086 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); | |
7087 else | |
7088 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(v82 * fTurnSpeedMultiplier)); | |
7089 break; | |
7090 | |
7091 case PARTY_FastTurnLeft: | |
7092 if (uTurnSpeed) | |
7093 angle = stru_5C6E00->uDoublePiMask & (angle + uTurnSpeed); | |
7094 else | |
7095 angle = stru_5C6E00->uDoublePiMask & (angle + (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); | |
7096 break; | |
7097 | |
7098 case PARTY_FastTurnRight: | |
7099 if (uTurnSpeed) | |
7100 angle = stru_5C6E00->uDoublePiMask & (angle - uTurnSpeed); | |
7101 else | |
7102 angle = stru_5C6E00->uDoublePiMask & (angle - (int)(2.0f * fTurnSpeedMultiplier * (double)v82)); | |
7103 break; | |
7104 | |
7105 case PARTY_StrafeLeft: | |
7106 v2 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2); | |
7107 v1 += fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2); | |
7108 party_walking_flag = true; | |
7109 break; | |
7110 case PARTY_StrafeRight: | |
7111 v2 += fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2); | |
7112 v1 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fWalkSpeedMultiplier / 2); | |
7113 party_walking_flag = true; | |
7114 break; | |
7115 case PARTY_WalkForward: | |
7116 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 5 * pParty->uWalkSpeed * fWalkSpeedMultiplier); | |
7117 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 5 * pParty->uWalkSpeed * fWalkSpeedMultiplier); | |
7118 party_walking_flag = true; | |
7119 break; | |
7120 case PARTY_WalkBackward: | |
7121 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier); | |
7122 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier); | |
7123 party_walking_flag = true; | |
7124 break; | |
7125 case PARTY_RunForward: | |
7126 v2 += fixpoint_mul(stru_5C6E00->Cos(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier); | |
7127 v1 += fixpoint_mul(stru_5C6E00->Sin(angle), 2 * pParty->uWalkSpeed * fWalkSpeedMultiplier); | |
7128 party_running_flag = true; | |
7129 break; | |
7130 case PARTY_RunBackward: | |
7131 //v32 = stru_5C6E00->SinCos(angle); | |
7132 //v33 = (double)v81; | |
7133 //v88 = (double)v81; | |
7134 v2 -= fixpoint_mul(stru_5C6E00->Cos(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier); | |
7135 //v34 = stru_5C6E00->SinCos(angle - stru_5C6E00->uIntegerHalfPi); | |
7136 v1 -= fixpoint_mul(stru_5C6E00->Sin(angle), pParty->uWalkSpeed * fBackwardWalkSpeedMultiplier); | |
7137 party_running_flag = true; | |
7138 break; | |
7139 case PARTY_LookUp: | |
7140 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * 25.0); | |
7141 if ( _view_angle > 128 ) | |
7142 _view_angle = 128; | |
7143 if ( uActiveCharacter ) | |
7144 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_63, 0); | |
7145 break; | |
7146 case PARTY_LookDown: | |
7147 _view_angle += (signed __int64)(flt_6BE150_look_up_down_dangle * -25.0); | |
7148 if ( _view_angle < -128 ) | |
7149 _view_angle = -128; | |
7150 if ( uActiveCharacter ) | |
7151 pPlayers[uActiveCharacter]->PlaySound((PlayerSpeech)SPEECH_64, 0); | |
7152 break; | |
7153 case PARTY_CenterView: | |
7154 _view_angle = 0; | |
7155 break; | |
7156 case PARTY_Jump: | |
7157 if ( (!bJumping || party_z <= floor_level + 6 && pParty->uFallSpeed <= 0) && pParty->field_24 ) | |
7158 { | |
7159 bJumping = 1; | |
7160 pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); | |
7161 } | |
7162 break; | |
7163 default: | |
7164 break; | |
7165 } | |
7166 } | |
7167 pParty->sRotationY = angle; | |
7168 pParty->sRotationX = _view_angle; | |
7169 if ( bJumping ) | |
7170 { | |
7171 pParty->uFallSpeed += -2 * pEventTimer->uTimeElapsed * GetGravityStrength(); | |
7172 if ( bJumping && pParty->uFallSpeed <= 0 ) | |
7173 { | |
7174 if ( pParty->uFallSpeed < -500 && !pParty->bFlying ) | |
7175 { | |
7176 for ( uint pl = 1; pl <= 4; pl++ ) | |
7177 { | |
7178 if ( !pPlayers[pl]->HasEnchantedItemEquipped(72) | |
7179 && !pPlayers[pl]->WearsItem(ITEM_ARTIFACT_HERMES_SANDALS, EQUIP_BOOTS) ) //was 8 | |
7180 pPlayers[pl]->PlayEmotion(CHARACTER_EXPRESSION_SCARED, 0); | |
7181 } | |
7182 } | |
7183 } | |
7184 else | |
7185 pParty->uFallStartY = party_z; | |
7186 } | |
7187 else | |
7188 { | |
7189 if ( pIndoor->pFaces[uFaceID].pFacePlane_old.vNormal.z < 32768 ) | |
7190 { | |
7191 pParty->uFallSpeed -= pEventTimer->uTimeElapsed * GetGravityStrength(); | |
7192 pParty->uFallStartY = party_z; | |
7193 } | |
7194 else | |
7195 { | |
7196 if (! (pParty->uFlags & PARTY_FLAGS_1_LANDING) ) | |
7197 pParty->uFallSpeed = 0; | |
7198 pParty->uFallStartY = party_z; | |
7199 } | |
7200 } | |
7201 if ( v2 * v2 + v1 * v1 < 400 ) | |
7202 { | |
7203 v1 = 0; | |
7204 v2 = 0; | |
7205 } | |
7206 | |
7207 stru_721530.field_84 = -1; | |
7208 stru_721530.field_70 = 0; | |
7209 stru_721530.prolly_normal_d = pParty->field_14_radius; | |
7210 stru_721530.field_8_radius = pParty->field_14_radius / 2; | |
7211 stru_721530.field_0 = 1; | |
7212 stru_721530.height = pParty->uPartyHeight - 32; | |
7213 for ( uint i = 0; i < 100; i++ ) | |
7214 { | |
7215 new_party_z = party_z; | |
7216 stru_721530.position.x = new_party_x; | |
7217 stru_721530.position.y = new_party_y; | |
7218 stru_721530.position.z = stru_721530.height + party_z + 1; | |
7219 | |
7220 stru_721530.normal.x = new_party_x; | |
7221 stru_721530.normal.y = new_party_y; | |
7222 stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; | |
7223 | |
7224 stru_721530.velocity.x = v2; | |
7225 stru_721530.velocity.y = v1; | |
7226 stru_721530.velocity.z = pParty->uFallSpeed; | |
7227 | |
7228 stru_721530.uSectorID = uSectorID; | |
7229 v38 = 0; | |
7230 if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == 3 ) | |
7231 v38 = 13312; | |
7232 if ( stru_721530._47050A(v38) ) | |
7233 break; | |
7234 for ( uint j = 0; j < 100; ++j ) | |
7235 { | |
7236 _46E44E_collide_against_faces_and_portals(1); | |
7237 _46E0B2_collide_against_decorations(); | |
7238 for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 ) | |
7239 Actor::_46DF1A_collide_against_actor(v80, 0); | |
7240 if ( _46F04E_collide_against_portals() ) | |
7241 break; | |
7242 } | |
7243 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
7244 { | |
7245 v39 = stru_721530.normal2.x; | |
7246 uSectorID = stru_721530.normal2.y; | |
7247 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
7248 } | |
7249 else | |
7250 { | |
7251 v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16) + new_party_x; | |
7252 uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16); | |
7253 v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16); | |
7254 } | |
7255 v42 = collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID); | |
7256 if ( v42 == -30000 || v42 - new_party_z > 128 ) | |
7257 return; | |
7258 if ( stru_721530.field_7C >= stru_721530.field_6C ) | |
7259 { | |
7260 new_party_x = stru_721530.normal2.x; | |
7261 new_party_y = stru_721530.normal2.y; | |
7262 new_party_z = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | |
7263 break; | |
7264 } | |
7265 new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.x) >> 16; | |
7266 new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.y) >> 16; | |
7267 uSectorID = stru_721530.uSectorID; | |
7268 stru_721530.field_70 += stru_721530.field_7C; | |
7269 unsigned long long v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.direction.z) >> 16) + new_party_z; | |
7270 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Actor) | |
7271 { | |
7272 if ( SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) >= 0 | |
7273 && (SHIDWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime) > 0 || LODWORD(pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].uExpireTime)) ) | |
7274 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | |
7275 viewparams->bRedrawGameUI = true; | |
7276 } | |
7277 else if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) | |
7278 { | |
7279 v54 = stru_5C6E00->Atan2(new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, | |
7280 new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); | |
7281 v2 = (unsigned __int64)(stru_5C6E00->Cos(v54) * (signed __int64)integer_sqrt(v2 * v2 + v1 * v1)) >> 16; | |
7282 v1 = (unsigned __int64)(stru_5C6E00->Sin(v54) * (signed __int64)integer_sqrt(v2 * v2 + v1 * v1)) >> 16; | |
7283 } | |
7284 else | |
7285 { | |
7286 if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_BModel) | |
7287 { | |
7288 pFace = &pIndoor->pFaces[(signed int)stru_721530.uFaceID >> 3]; | |
7289 if ( pFace->uPolygonType == POLYGON_Floor ) | |
7290 { | |
7291 if ( pParty->uFallSpeed < 0 ) | |
7292 pParty->uFallSpeed = 0; | |
7293 v87 = pIndoor->pVertices[*pFace->pVertexIDs].z + 1; | |
7294 if ( pParty->uFallStartY - v87 < 512 ) | |
7295 pParty->uFallStartY = v87; | |
7296 if ( v2 * v2 + v1 * v1 < 400 ) | |
7297 { | |
7298 v1 = 0; | |
7299 v2 = 0; | |
7300 } | |
7301 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 ) | |
7302 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
7303 } | |
7304 else | |
7305 { | |
7306 v46 = pParty->uFallSpeed * pFace->pFacePlane_old.vNormal.z; | |
7307 if ( pFace->uPolygonType != POLYGON_InBetweenFloorAndWall ) | |
7308 { | |
7309 v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16; | |
7310 if ((stru_721530.speed >> 3) > v80 ) | |
7311 v80 = stru_721530.speed >> 3; | |
7312 v2 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.x) >> 16; | |
7313 v1 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.y) >> 16; | |
7314 pParty->uFallSpeed += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.z) >> 16; | |
7315 //v80 = pFace->pFacePlane_old.vNormal.y; | |
7316 v52 = stru_721530.prolly_normal_d - ((pFace->pFacePlane_old.dist | |
7317 + v87 * pFace->pFacePlane_old.vNormal.z | |
7318 + new_party_y * pFace->pFacePlane_old.vNormal.y | |
7319 + new_party_x * pFace->pFacePlane_old.vNormal.x) >> 16); | |
7320 if ( v52 > 0 ) | |
7321 { | |
7322 new_party_x += v52 * pFace->pFacePlane_old.vNormal.x >> 16; | |
7323 new_party_y += v52 * pFace->pFacePlane_old.vNormal.y >> 16; | |
7324 v87 += v52 * pFace->pFacePlane_old.vNormal.z >> 16; | |
7325 } | |
7326 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 ) | |
7327 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
7328 } | |
7329 if ( pFace->uPolygonType == POLYGON_InBetweenFloorAndWall ) | |
7330 { | |
7331 v80 = abs(v1 * pFace->pFacePlane_old.vNormal.y + v46 + v2 * pFace->pFacePlane_old.vNormal.x) >> 16; | |
7332 if ((stru_721530.speed >> 3) > v80 ) | |
7333 v80 = stru_721530.speed >> 3; | |
7334 v2 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.x) >> 16; | |
7335 v1 += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.y) >> 16; | |
7336 pParty->uFallSpeed += (unsigned __int64)(v80 * (signed __int64)pFace->pFacePlane_old.vNormal.z) >> 16; | |
7337 if ( v2 * v2 + v1 * v1 >= 400 ) | |
7338 { | |
7339 if ( pParty->floor_face_pid != PID_ID(stru_721530.uFaceID) && BYTE3(pFace->uAttributes) & 4 ) | |
7340 uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; | |
7341 } | |
7342 else | |
7343 { | |
7344 v2 = 0; | |
7345 v1 = 0; | |
7346 pParty->uFallSpeed = 0; | |
7347 } | |
7348 } | |
7349 } | |
7350 } | |
7351 } | |
7352 v2 = (unsigned __int64)(58500i64 * v2) >> 16; | |
7353 v1 = (unsigned __int64)(58500i64 * v1) >> 16; | |
7354 //++v83; | |
7355 pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; | |
7356 //if ( v83 >= 100 ) | |
7357 //{ | |
7358 //new_party_z = v87; | |
7359 //break; | |
7360 //} | |
7361 } | |
7362 | |
7363 // //Воспроизведение звуков ходьбы/бега------------------------- | |
7364 uint pX_ = pParty->vPosition.x - new_party_x; | |
7365 uint pY_ = pParty->vPosition.y - new_party_y; | |
7366 uint pZ_ = pParty->vPosition.z - new_party_z; | |
7367 if ( bWalkSound && pParty->walk_sound_timer <= 0 ) | |
7368 { | |
7369 pAudioPlayer->_4AA258(804);//stop sound | |
7370 if ( party_running_flag && (!bJumping || jumping_up) ) //для бега | |
7371 { | |
7372 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 16 ) | |
7373 { | |
7374 if ( on_water ) | |
7375 pAudioPlayer->PlaySound(SOUND_RunAlongWater, 804, 1, -1, 0, 0, 0, 0); | |
7376 else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
7377 pAudioPlayer->PlaySound((SoundID)50, 804, 1, -1, 0, 0, 0, 0); | |
7378 else | |
7379 pAudioPlayer->PlaySound(SOUND_RunAlong3DModel, 804, 1, -1, 0, 0, 0, 0); | |
7380 pParty->walk_sound_timer = 64; | |
7381 } | |
7382 } | |
7383 else if ( party_walking_flag && (!bJumping || jumping_up) )//для ходьбы | |
7384 { | |
7385 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) >= 8 ) | |
7386 { | |
7387 if ( on_water ) | |
7388 pAudioPlayer->PlaySound(SOUND_WalkAlongWater, 804, 1, -1, 0, 0, 0, 0); | |
7389 else if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) | |
7390 pAudioPlayer->PlaySound((SoundID)89, 804, 1, -1, 0, 0, 0, 0); | |
7391 else | |
7392 pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0); | |
7393 pParty->walk_sound_timer = 64; | |
7394 } | |
7395 } | |
7396 } | |
7397 if ( integer_sqrt(pX_ * pX_ + pY_ * pY_ + pZ_ * pZ_) < 8 )//отключить звук ходьбы при остановке | |
7398 pAudioPlayer->_4AA258(804); | |
7399 //------------------------------------------------------------- | |
7400 if ( !bJumping || jumping_up ) | |
7401 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; | |
7402 else | |
7403 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | |
7404 pParty->uFlags &= ~0x200; | |
7405 pParty->vPosition.x = new_party_x; | |
7406 pParty->vPosition.z = new_party_z; | |
7407 pParty->vPosition.y = new_party_y; | |
7408 //pParty->uFallSpeed = v89; | |
7409 if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) | |
7410 pParty->uFlags |= 0x200; | |
7411 if (uFaceEvent) | |
7412 EventProcessor(uFaceEvent, 0, 1); | |
7413 } |