Mercurial > mm7
diff Outdoor.cpp @ 2085:52abdea20b9e
Door_switch_animation
author | Ritor1 |
---|---|
date | Wed, 11 Dec 2013 23:12:54 +0600 |
parents | a290d9fbdc95 |
children | 3920278a2905 |
line wrap: on
line diff
--- a/Outdoor.cpp Tue Dec 03 16:35:57 2013 +0600 +++ b/Outdoor.cpp Wed Dec 11 23:12:54 2013 +0600 @@ -3152,12 +3152,11 @@ int v24; // eax@36 signed int v25; // ecx@38 int result; // eax@42 - signed int v27; // ecx@43 + signed int current_floor_level; // ecx@43 int v28; // edi@44 signed int v29; // edx@44 int v30; // esi@45 int v31; // eax@45 - ODMFace *v32; // eax@57 int v33; // ecx@59 int v36; // [sp+14h] [bp-2Ch]@24 int v38; // [sp+1Ch] [bp-24h]@2 @@ -3168,7 +3167,7 @@ bool next_vertices_Y; // [sp+34h] [bp-Ch]@24 signed int v46; // [sp+3Ch] [bp-4h]@1 signed int number_hits; // [sp+58h] [bp+18h]@22 - signed int v49; // [sp+58h] [bp+18h]@43 + signed int next_floor_level; // [sp+58h] [bp+18h]@43 v46 = 1; dword_721160[0] = -1; @@ -3187,23 +3186,24 @@ for ( pFaceNum = 0; pFaceNum < pBModel->uNumFaces; ++pFaceNum ) { pFace = &pBModel->pFaces[pFaceNum]; + if ( pFace->Ethereal() ) + continue; if ( (pFace->uPolygonType == POLYGON_Floor || pFace->uPolygonType == POLYGON_InBetweenFloorAndWall) - && !(pFace->uAttributes & 0x20000000) && X <= pFace->pBoundingBox.x2 && X >= pFace->pBoundingBox.x1 && Y <= pFace->pBoundingBox.y2 && Y >= pFace->pBoundingBox.y1 ) { for ( uint i = 0; i < pFace->uNumVertices; ++i) { - FloorFaceVertCoord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; - FloorFaceVertCoord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; - FloorFaceVertCoord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; - FloorFaceVertCoord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; + odm_floor_face_vert_coord_X[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].x; + odm_floor_face_vert_coord_Y[2 * i] = pFace->pXInterceptDisplacements[i] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i]].y; + odm_floor_face_vert_coord_X[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].x; + odm_floor_face_vert_coord_Y[2 * i + 1] = pFace->pXInterceptDisplacements[i + 1] + pBModel->pVertices.pVertices[pFace->pVertexIDs[i + 1]].y; } - FloorFaceVertCoord_X[2 * pFace->uNumVertices] = FloorFaceVertCoord_X[0]; - FloorFaceVertCoord_Y[2 * pFace->uNumVertices] = FloorFaceVertCoord_Y[0]; - - current_vertices_Y = FloorFaceVertCoord_Y[0] >= Y; + odm_floor_face_vert_coord_X[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_X[0]; + odm_floor_face_vert_coord_Y[2 * pFace->uNumVertices] = odm_floor_face_vert_coord_Y[0]; + + current_vertices_Y = odm_floor_face_vert_coord_Y[0] >= Y; number_hits = 0; if ( 2 * pFace->uNumVertices > 0 ) { @@ -3211,21 +3211,22 @@ { if ( number_hits >= 2 ) break; - v36 = FloorFaceVertCoord_Y[i + 1]; - next_vertices_Y = FloorFaceVertCoord_Y[i + 1] >= Y; + //v36 = odm_floor_face_vert_coord_Y[i + 1]; + next_vertices_Y = odm_floor_face_vert_coord_Y[i + 1] >= Y; if ( current_vertices_Y != next_vertices_Y )//проверка по Y { - v18 = FloorFaceVertCoord_X[i + 1] >= X ? 0 : 2; - v19 = v18 | (FloorFaceVertCoord_X[i] < X); + v18 = odm_floor_face_vert_coord_X[i + 1] >= X ? 0 : 2; + v19 = v18 | (odm_floor_face_vert_coord_X[i] < X); if ( v19 != 3 ) { if ( !v19 ) ++number_hits; else { - LODWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) << 16; - HIDWORD(v23) = (Y - FloorFaceVertCoord_Y[i]) >> 16; - v22 = ((((FloorFaceVertCoord_X[i + 1] - FloorFaceVertCoord_X[i]) * v23 / (v36 - FloorFaceVertCoord_Y[i])) >> 16) + FloorFaceVertCoord_X[i]); + LODWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) << 16; + HIDWORD(v23) = (Y - odm_floor_face_vert_coord_Y[i]) >> 16; + v22 = ((((odm_floor_face_vert_coord_X[i + 1] - odm_floor_face_vert_coord_X[i]) * v23 / (odm_floor_face_vert_coord_Y[i + 1] + - odm_floor_face_vert_coord_Y[i])) >> 16) + odm_floor_face_vert_coord_X[i]); if ( v22 >= X) ++number_hits; } @@ -3259,51 +3260,43 @@ *bmodel_pid = 0; return odm_floor_level[0]; } - v27 = 0; + current_floor_level = 0; + v29 = 0; if ( v46 <= 1 ) *bmodel_pid = 0; else { - //v29 = 1; - for ( v49 = 1; v49 < v46; ++v49 ) + current_floor_level = odm_floor_level[0]; + for ( uint i = 1; i < v46; ++i ) { - if ( odm_floor_level[v49] == odm_floor_level[0] ) - { - v27 = v49; - //++v29; - break; - } - if ( odm_floor_level[0] > Z + 5 ) + next_floor_level = odm_floor_level[i]; + if ( current_floor_level <= Z + 5 ) { - if ( odm_floor_level[v49] >= odm_floor_level[0] ) + if ( next_floor_level > current_floor_level && next_floor_level <= Z + 5 ) { - //++v29; - break; + current_floor_level = next_floor_level; + v29 = i; } - v27 = v49; - //++v29; - break; } - if ( odm_floor_level[v49] > odm_floor_level[0] && odm_floor_level[v49] <= Z + 5 ) + else if ( next_floor_level < current_floor_level ) { - v27 = v49; - //++v29; + current_floor_level = next_floor_level; + v29 = i; } } - if ( !v27 ) + if ( !v29 ) *bmodel_pid = 0; else - *bmodel_pid = dword_721110[v27] | (dword_721160[v27] << 6); + *bmodel_pid = dword_721110[v29] | (dword_721160[v29] << 6); } - if ( v27 ) + if ( v29 ) { - v32 = &pOutdoor->pBModels[dword_721160[v27]].pFaces[dword_721110[v27]]; *pIsOnWater = false; - if ( v32->Fluid()) + if ( pOutdoor->pBModels[dword_721160[v29]].pFaces[dword_721110[v29]].Fluid()) *pIsOnWater = true; } - if ( odm_floor_level[v27] >= odm_floor_level[0] ) - odm_floor_level[0] = odm_floor_level[v27]; + if ( odm_floor_level[v29] >= odm_floor_level[0] ) + odm_floor_level[0] = odm_floor_level[v29]; return odm_floor_level[0]; } @@ -3652,7 +3645,7 @@ { int v1; // edi@1 int v2; // ebx@1 - int v3; // eax@14 + int floor_level; // eax@14 int v6; // esi@45 ODMFace *face; // ecx@45 signed int v33; // eax@143 @@ -3670,28 +3663,16 @@ BSPModel *pModel; // eax@203 ODMFace *pODMFace; // esi@203 int v48; // eax@203 - char v49; // zf@203 - char v50; // sf@203 - unsigned __int8 v51; // of@203 - int v52; // eax@203 BSPModel *v54; // eax@215 int v55; // eax@217 - signed int v56; // ebx@228 - int v57; // eax@228 BSPModel *v58; // eax@228 unsigned __int64 v59; // qax@228 BSPModel *v60; // eax@228 unsigned __int64 v61; // qax@228 int v62; // eax@241 - unsigned int v65; // ebx@263 unsigned int v66; // esi@263 - int v67; // eax@263 signed int v68; // ecx@263 int v69; // eax@263 - int v70; // ebx@271 - int v71; // esi@271 - int v72; // edi@271 - int v73; // eax@271 unsigned int v76; // edi@293 bool v77; // edx@297 bool v78; // ecx@303 @@ -3717,7 +3698,7 @@ bool bFeatherFall; // [sp+28h] [bp-6Ch]@4 int v105; // [sp+2Ch] [bp-68h]@24 bool bWaterWalk; // [sp+30h] [bp-64h]@1 - int v109; // [sp+3Ch] [bp-58h]@28 + int ceiling_height; // [sp+3Ch] [bp-58h]@28 int v110; // [sp+40h] [bp-54h]@180 int v111; // [sp+44h] [bp-50h]@14 bool hovering; // [sp+48h] [bp-4Ch]@1 @@ -3732,7 +3713,6 @@ int pZ; // [sp+74h] [bp-20h]@1 bool party_walking_flag; // [sp+78h] [bp-1Ch]@1 int _angle_y; // [sp+7Ch] [bp-18h]@48 - int v126; // [sp+80h] [bp-14h]@48 int v128; // [sp+88h] [bp-Ch]@1 int v129; // [sp+8Ch] [bp-8h]@92 @@ -3780,15 +3760,16 @@ int bmodel_standing_on_pid; int is_on_water = false; - v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); + floor_level = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, bWaterWalk); int is_not_on_bmodel = bmodel_standing_on_pid == 0; - v111 = v3; + v111 = floor_level; if ( bFeatherFall ) - pParty->uFallStartY = v3; + pParty->uFallStartY = floor_level; else - v3 = pParty->uFallStartY; - if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) + floor_level = pParty->uFallStartY; + + if ( floor_level - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 )//падение на 3D Model { if (pParty->uFlags & PARTY_FLAGS_1_LANDING) { @@ -3803,18 +3784,17 @@ 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; + + ceiling_height = -1; if ( pParty->bFlying ) - v109 = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); + ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка //v107 = bmodel_standing_on_pid == 0; v105 = v111 + 1; if ( pZ <= v111 + 1 ) { - v109 = -1; + ceiling_height = -1; pParty->bFlying = false; } else @@ -3849,7 +3829,7 @@ if ( BYTE3(face[v6].uAttributes) & 4 ) { pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); - v103 = face[v6].sCogTriggeredID; + v103 = face[v6].sCogTriggeredID; // } } } @@ -3859,7 +3839,7 @@ _walk_speed = pParty->uWalkSpeed; _angle_y = pParty->sRotationY; _angle_x = pParty->sRotationX; - v126 = pEventTimer->dt_in_some_format; + //v126 = pEventTimer->dt_in_some_format; /*v119 = (Player **)((unsigned __int64)(pEventTimer->dt_in_some_format * (signed __int64)((signed int)(pParty->field_20_prolly_turn_speed * stru_5C6E00->uIntegerPi) @@ -3894,16 +3874,16 @@ v2 = 0; pParty->uFallSpeed = 0; *(float *)&v128 = 0.0; - if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 )//сверить с ида(ошибка) + if ( v102 && pZ < ceiling_height && (signed int)(pParty->uPartyHeight + pZ) >= ceiling_height )//столкновение с потолком(ошибка) { pParty->field_6E0 = 0; pParty->field_6E4 = 0; pPartyActionQueue->uNumActions = 0; pParty->uFlags |= PARTY_FLAGS_1_LANDING; - pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; + pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 31; pParty->field_6F0 = pZ; pParty->bFlying = false; - pZ = v109 - pParty->uPartyHeight - 31; + pZ = ceiling_height - pParty->uPartyHeight - 31; v113 = pParty->field_6F0; } pParty->uFallSpeed = 0; @@ -4136,7 +4116,7 @@ case PARTY_Jump: if ( (!partyAtHighSlope || bmodel_standing_on_pid) && !hovering && pParty->field_24 && !(pParty->uFlags & 4) && !(BYTE1(pParty->uFlags) & 2) ) { - v126 = pParty->field_24 << 6; + //v126 = pParty->field_24 << 6; hovering = true; pParty->uFallSpeed = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)pParty->uFallSpeed); } @@ -4159,15 +4139,14 @@ } } -//LABEL_123: pParty->sRotationY = _angle_y; pParty->sRotationX = _angle_x; if ( pZ < v111 || pParty->bFlying) { if ( pParty->bFlying ) { - v126 = stru_5C6E00->Cos(GetTickCount()); - v129 = (unsigned __int64)(4i64 * v126) >> 16; + //v126 = stru_5C6E00->Cos(GetTickCount()); + v129 = (unsigned __int64)(4i64 * stru_5C6E00->Cos(GetTickCount())) >> 16; pZ = v113 + v129; if ( pModel ) pZ = v113; @@ -4244,45 +4223,45 @@ } } 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 ( uint i = 0; i < 100; i++ ) { stru_721530.position.x = pX; + stru_721530.position.y = pY; + stru_721530.position.z = stru_721530.height + pZ + 1; + stru_721530.normal.x = pX; - stru_721530.velocity.x = v2; - stru_721530.position.y = pY; stru_721530.normal.y = pY; stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; - stru_721530.position.z = stru_721530.height + pZ + 1; + + stru_721530.velocity.x = v2; stru_721530.velocity.y = v128; stru_721530.velocity.z = pParty->uFallSpeed; - v36 = 0; + stru_721530.uSectorID = 0; - if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->turn_stage == 3 ) + v36 = 0; + if ( pParty->bTurnBasedModeOn == true && pTurnEngine->turn_stage == 3 ) 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); - _46ED8A_collide_against_sprite_objects(4u); + _46ED8A_collide_against_sprite_objects(4); for ( i = 0; i < (signed int)uNumActors; ++i ) Actor::_46DF1A_collide_against_actor(i, 0); if ( stru_721530.field_7C >= stru_721530.field_6C ) @@ -4305,43 +4284,43 @@ pModel = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); v42 = IsTerrainSlopeTooHigh(pX, _angle_y); is_not_on_bmodel = false; - v118 = v42; + //v118 = v42; if ( !v97 && !v110 && !bmodel_standing_on_pid ) is_not_on_bmodel = true; v43 = 1; v44 = 1; if ( bUnderwater || !is_not_on_bmodel ) - { - pX = _angle_x; - if ( v43 ) - pY = _angle_y; - } - else - { - if ( pModel && v129 > pZ ) - v44 = 0; - if ( v118 && v119 > pZ ) - v43 = 0; - if ( v44 ) - { - pX = _angle_x; - if ( v43 ) - pY = _angle_y; - } - else if ( v43 ) - pY = _angle_y; - else - { - pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); - if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ ) - { - v43 = 1; - pX = _angle_x; - if ( v43 ) - pY = _angle_y; - } - } - } + { + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + else + { + if ( pModel && v129 > pZ ) + v44 = 0; + if ( v42 && v119 > pZ ) + v43 = 0; + if ( v44 ) + { + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + else if ( v43 ) + pY = _angle_y; + else + { + pModel = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &is_on_water, &bmodel_standing_on_pid, 0); + if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)pModel <= pZ ) + { + v43 = 1; + pX = _angle_x; + if ( v43 ) + pY = _angle_y; + } + } + } if ( stru_721530.field_7C >= stru_721530.field_6C ) { if ( !is_not_on_bmodel ) @@ -4363,29 +4342,22 @@ pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); viewparams->bRedrawGameUI = true; - 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; - continue; - } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + pModel = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; + pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; + continue; + } if ( PID_TYPE(stru_721530.uFaceID) == OBJECT_Decoration) { - v56 = integer_sqrt(v2 * v2 + v128 * v128); - v118 = v56; - v57 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, + //v118 = integer_sqrt(v2 * v2 + v128 * v128); + v129 = stru_5C6E00->Atan2(_angle_x - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.x, _angle_y - pLevelDecorations[(signed int)stru_721530.uFaceID >> 3].vPosition.y); - v129 = v57; - v58 = (BSPModel *)stru_5C6E00->Cos(v57); - pModel = v58; - v59 = (signed int)v58 * (signed __int64)v56; + v59 = (signed int)stru_5C6E00->Cos(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128); v122 = v59 >> 16; v2 = v59 >> 16; - v60 = (BSPModel *)stru_5C6E00->Sin(v129); - pModel = v60; - v61 = (signed int)v60 * (signed __int64)v118; + v61 = (signed int)stru_5C6E00->Sin(v129) * (signed __int64)integer_sqrt(v2 * v2 + v128 * v128); v122 = v61 >> 16; v128 = v61 >> 16; } @@ -4395,15 +4367,10 @@ { pParty->bFlying = false; pModel = &pOutdoor->pBModels[(signed int)stru_721530.uFaceID >> 9]; - //v127 = v46; pODMFace = &pModel->pFaces[((signed int)stru_721530.uFaceID >> 3) & 0x3F]; v48 = pODMFace->pBoundingBox.z2 - pODMFace->pBoundingBox.z1; - v51 = __OFSUB__(v48, 32); - v49 = v48 == 32; - v50 = v48 - 32 < 0; - v52 = pODMFace->pFacePlane.vNormal.z; - v129 = (unsigned __int8)(v50 ^ v51 | v49); - v119 = v52 < 46378; + v129 = v48 <= 32; + v119 = pODMFace->pFacePlane.vNormal.z < 46378; if ( bUnderwater == 1 ) v119 = 0; if ( pODMFace->uPolygonType == POLYGON_Floor ) @@ -4419,33 +4386,27 @@ if ( pParty->floor_face_pid != v45 && (pODMFace->uAttributes & FACE_PRESSURE_PLATE)) { pParty->floor_face_pid = v45; - v103 = pODMFace->sCogTriggeredID; + v103 = pODMFace->sCogTriggeredID; // } 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; continue; } if ( !v129 && (pODMFace->uPolygonType != POLYGON_InBetweenFloorAndWall || v119) )// упёрся в столб { - v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; + v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z + + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; if ((stru_721530.speed >> 3) > v118 ) v118 = stru_721530.speed >> 3; - v129 = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16; - _walk_speed = (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16; + v2 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.x) >> 16; + v128 += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.y) >> 16; v54 = 0; if ( !v119 ) - { - pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.z; - pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16); - v54 = pModel; - } - pParty->uFallSpeed += (int)v54; - v128 += _walk_speed; - v2 += v129; + pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.z) >> 16; v55 = stru_721530.prolly_normal_d - ((signed int)(pODMFace->pFacePlane.dist + v122 * pODMFace->pFacePlane.vNormal.z @@ -4458,72 +4419,62 @@ 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 ) - { - pParty->floor_face_pid = v45; - v103 = pODMFace->sCogTriggeredID; - } - 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; - continue; + if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 ) + { + pParty->floor_face_pid = stru_721530.uFaceID; + v103 = pODMFace->sCogTriggeredID; // + } + v2 = (unsigned __int64)(58500i64 * v2) >> 16; + pModel = (BSPModel *)58500; + v128 = (unsigned __int64)(58500i64 * v128) >> 16; + v122 = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; + pParty->uFallSpeed = (unsigned __int64)(58500i64 * pParty->uFallSpeed) >> 16; + continue; } - v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + pParty->uFallSpeed * v52 + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; + v118 = abs(v128 * pODMFace->pFacePlane.vNormal.y + + pParty->uFallSpeed * pODMFace->pFacePlane.vNormal.z + v2 * pODMFace->pFacePlane.vNormal.x) >> 16; if ((stru_721530.speed >> 3) > v118 ) v118 = stru_721530.speed >> 3; - v122 = pODMFace->pFacePlane.vNormal.x; - v122 = (unsigned __int64)(v118 * (signed __int64)(signed int)v122) >> 16; - pModel = (BSPModel *)pODMFace->pFacePlane.vNormal.y; - pModel = (BSPModel *)((unsigned __int64)(v118 * (signed __int64)(signed int)pModel) >> 16); - v129 = pODMFace->pFacePlane.vNormal.z; - v129 = (unsigned __int64)(v118 * (signed __int64)v129) >> 16; - pParty->uFallSpeed += v129; - v2 += v122; - v128 += (int)pModel; + v2 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.x) >> 16; + v128 += (unsigned __int64)(v118 * (signed __int64)(signed int)pODMFace->pFacePlane.vNormal.y) >> 16; + pParty->uFallSpeed += (unsigned __int64)(v118 * (signed __int64)pODMFace->pFacePlane.vNormal.z) >> 16; if ( v2 * v2 + v128 * v128 >= 400 ) - { - v45 = stru_721530.uFaceID; - if ( pParty->floor_face_pid != v45 && BYTE3(pODMFace->uAttributes) & 4 ) - { - pParty->floor_face_pid = v45; - v103 = pODMFace->sCogTriggeredID; - } - 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; - continue; - } + { + if ( pParty->floor_face_pid != stru_721530.uFaceID && BYTE3(pODMFace->uAttributes) & 4 ) + { + pParty->floor_face_pid = stru_721530.uFaceID; + v103 = pODMFace->sCogTriggeredID; // + } + 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; + continue; + } v2 = 0; pParty->uFallSpeed = 0; *(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); + uint pY_ = abs(pParty->vPosition.y - pY); + v62 = abs(pParty->vPosition.z - pZ); if ( bWalkSound && pParty->walk_sound_timer <= 0 ) { - v122 = abs(pParty->vPosition.x - pX); - v126 = abs(pParty->vPosition.y - pY); - v62 = abs(pParty->vPosition.z - pZ); - if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) >= 8 ) + pAudioPlayer->_4AA258(804);//stop sound + if ( party_running_flag && (!hovering || high_fall_flag) ) { - if ( party_running_flag && (!hovering || !high_fall_flag) ) + if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 16 ) { if ( !is_not_on_bmodel && !(BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20) ) @@ -4533,8 +4484,12 @@ 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;//таймер для бега } - else if ( party_walking_flag && (!hovering || !high_fall_flag) ) + } + else if( party_walking_flag && (!hovering || high_fall_flag) ) + { + if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) >= 8 ) { if ( is_not_on_bmodel || BYTE1(pOutdoor->pBModels[pParty->floor_face_pid >> 9].pFaces[(pParty->floor_face_pid >> 3) & 0x3F].uAttributes) & 0x20 ) @@ -4544,60 +4499,52 @@ } else pAudioPlayer->PlaySound(SOUND_WalkAlong3DModel, 804, 1, -1, 0, 0, 0, 0);// хождение на 3D Modelи + pParty->walk_sound_timer = 144;//таймер для ходьбы } } - else - { - pAudioPlayer->_4AA258(804); - pParty->walk_sound_timer = 64; - } } - + if ( integer_sqrt(v122 * v122 + pY_ * pY_ + v62 * v62) < 8 )//отключить звук ходьбы при остановке + pAudioPlayer->_4AA258(804); +//------------------------------------------------------------------------ if ( !hovering || !high_fall_flag ) pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; else pParty->uFlags |= PARTY_FLAGS_1_FALLING; - v126 = WorldPosToGridCellX(pParty->vPosition.x); - v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; + int pMap_X = WorldPosToGridCellX(pParty->vPosition.x); + int pMap_Y = WorldPosToGridCellZ(pParty->vPosition.y) - 1; unsigned int v114_a = WorldPosToGridCellX(pX); v66 = WorldPosToGridCellZ(pY) - 1; - pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); - v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, v65) >> 1) & 1; - v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); + pModel = (BSPModel *)((~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, pMap_Y) >> 1) & 1); + v122 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(v114_a, pMap_Y) >> 1) & 1; v68 = 0; - v69 = (~(unsigned int)v67 >> 1) & 1; - if ( v114_a == v126 && v66 == v65 && v122 && v69 ) + v69 = (~(unsigned int)pOutdoor->ActuallyGetSomeOtherTileInfo(pMap_X, v66) >> 1) & 1; + if ( v114_a == pMap_X && v66 == pMap_Y && v122 && v69 ) v68 = 1; if ( !is_not_on_bmodel ) v68 = 1; if ( v68 ) { - v70 = pZ; - v71 = pX; - v72 = pY; - //pParty->uFallSpeed = v121; - v73 = pZ; pParty->vPosition.x = pX; pParty->vPosition.y = pY; pParty->vPosition.z = pZ; pParty->field_6F0 = v113; if ( pZ > 8160 ) { - v73 = 8160; + pZ = 8160; pParty->uFallStartY = 8160; pParty->vPosition.z = 8160; } - if ( !v103 - || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v71) - && pParty->vPosition.y == v72 - && (v73 = pParty->vPosition.z, pParty->vPosition.z == v70) ) + if ( !v103 //падение на землю + || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) + && pParty->vPosition.y == pY + && pParty->vPosition.z == pZ ) { - if ( v73 < v111 ) + if ( pParty->vPosition.z < v111 ) { pParty->uFallSpeed = 0; - v73 = v105; + //v73 = v105; pParty->vPosition.z = v105; - if ( pParty->uFallStartY - v70 > 512 && !bFeatherFall && v70 <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты) + if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты) { if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) { @@ -4608,22 +4555,22 @@ for ( uint i = 1; i <= 4; ++i ) { v110 = pPlayers[i]->GetMaxHealth(); - pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v70) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, + pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(signed __int64)((double)v110 * 0.1)) / 256, DMGT_PHISYCAL); v110 = 20 - pPlayers[i]->GetParameterBonus(pPlayers[i]->GetActualEndurance()); pPlayers[i]->SetRecoveryTime((signed __int64)((double)v110 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); } - v73 = pParty->vPosition.z; + //v73 = pParty->vPosition.z; } } - pParty->uFallStartY = v70; + pParty->uFallStartY = pZ; } - if ( v102 && v73 < v109 ) + if ( v102 && pParty->vPosition.z < ceiling_height ) { - if ( (signed int)(pParty->uPartyHeight + v73) >= v109 ) + if ( (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) { - pParty->vPosition.z = v109 - pParty->uPartyHeight - 1; - pParty->field_6F0 = v109 - pParty->uPartyHeight - 1; + pParty->vPosition.z = ceiling_height - pParty->uPartyHeight - 1; + pParty->field_6F0 = ceiling_height - pParty->uPartyHeight - 1; } } pParty->uFlags &= ~0x204; @@ -4639,26 +4586,21 @@ if ( !pParty->bFlying && high_fall_flag && !bWaterWalk ) { if ( pModel ) + v78 = v69 != 0; + else { - v78 = v69 != 0; + party_drowning_flag = true; + v78 = true; } - else - { - party_drowning_flag = true; - v78 = 1; - } } else - v78 = 1; -//LABEL_306: + v78 = true; + if ( v77 ) - { pParty->vPosition.x = pX; - } if ( v78 ) - { pParty->vPosition.y = pY; - } + if ( v78 || v77) { if ( bWaterWalk ) @@ -4684,7 +4626,7 @@ pAudioPlayer->_4AA258(804); pParty->walk_sound_timer = 64; } -//LABEL_318: + v81 = pZ; v82 = pZ; pParty->vPosition.z = pZ; @@ -4703,12 +4645,13 @@ if ( pParty->vPosition.z <= pTerrainHeight + 1 )//положение группы всегда +1 pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; } - if ( !v103 + + if ( !v103//падение на воду || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) && pParty->vPosition.y == pY && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) { - if ( v82 < v111 ) + if ( pParty->vPosition.z < v111 ) { v82 = v105; pParty->uFallSpeed = 0; @@ -4734,10 +4677,10 @@ } pParty->uFallStartY = v81; } - if ( v102 && v82 < v109 && (signed int)(pParty->uPartyHeight + v82) >= v109 ) + if ( v102 && v82 < ceiling_height && (signed int)(pParty->uPartyHeight + v82) >= ceiling_height ) { - pParty->vPosition.z = v82 + pParty->uPartyHeight - v109 + 1; - pParty->field_6F0 = v82 + pParty->uPartyHeight - v109 + 1; + pParty->vPosition.z = v82 + pParty->uPartyHeight - ceiling_height + 1; + pParty->field_6F0 = v82 + pParty->uPartyHeight - ceiling_height + 1; } } }