Mercurial > mm7
changeset 2148:af349bd395ff
ODM_ProcessPartyActions continue
author | Ritor1 |
---|---|
date | Tue, 07 Jan 2014 22:15:45 +0600 |
parents | 4393b60cd9e2 |
children | d4f00d622889 |
files | Outdoor.cpp mm7_3.cpp |
diffstat | 2 files changed, 102 insertions(+), 87 deletions(-) [+] |
line wrap: on
line diff
--- a/Outdoor.cpp Mon Jan 06 22:46:11 2014 +0600 +++ b/Outdoor.cpp Tue Jan 07 22:15:45 2014 +0600 @@ -3662,8 +3662,8 @@ bool v78; // ecx@303 int v79; // ecx@314 __int16 v80; // dx@317 - int v81; // ebx@318 - int v82; // ecx@318 + //int v81; // ebx@318 + //int v82; // ecx@318 int pTerrainHeight; // eax@321 int v86; // [sp-20h] [bp-B4h]@246 int v87; // [sp-20h] [bp-B4h]@248 @@ -3678,9 +3678,10 @@ Vec3_int_ v98; bool high_fall_flag; // [sp+1Ch] [bp-78h]@33 int v102; // [sp+20h] [bp-74h]@1 - int v103; // [sp+24h] [bp-70h]@1 + int trigger_id; // [sp+24h] [bp-70h]@1 bool bFeatherFall; // [sp+28h] [bp-6Ch]@4 - int v105; // [sp+2Ch] [bp-68h]@24 + int bonus; + int on_ground; // [sp+2Ch] [bp-68h]@24 bool bWaterWalk; // [sp+30h] [bp-64h]@1 int ceiling_height; // [sp+3Ch] [bp-58h]@28 int v110; // [sp+40h] [bp-54h]@180 @@ -3701,7 +3702,7 @@ int v129; // [sp+8Ch] [bp-8h]@92 v1 = 0; - v103 = 0; + trigger_id = 0; v2 = 0; //*(float *)&v128 = 0.0; v128 = 0; @@ -3765,8 +3766,8 @@ { pParty->pPlayers[i].ReceiveDamage( (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(pParty->pPlayers[i].GetMaxHealth() / 10)) / 256, DMGT_PHISYCAL); - v105 = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); - pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); + bonus = 20 - pParty->pPlayers[i].GetParameterBonus(pParty->pPlayers[i].GetActualEndurance()); + pParty->pPlayers[i].SetRecoveryTime((signed __int64)((double)bonus * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); } } } @@ -3775,8 +3776,8 @@ if ( pParty->bFlying ) ceiling_height = GetCeilingHeight(pX, pY, pZ + pParty->uPartyHeight, (int)&v102);//высота потолка //v107 = bmodel_standing_on_pid == 0; - v105 = v111 + 1; - if ( pZ <= v111 + 1 ) + on_ground = v111 + 1; + if ( pZ <= on_ground )//полёт: посадка { ceiling_height = -1; pParty->bFlying = false; @@ -3793,9 +3794,10 @@ pParty->walk_sound_timer = 0; } - if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0) + if (!bUnderwater && pParty->pPartyBuffs[PARTY_BUFF_FLY].uExpireTime <= 0)// конец действия полёта pParty->bFlying = false; - if (!hovering) + + if (!hovering)// { if ( pParty->floor_face_pid != PID(OBJECT_BModel, bmodel_standing_on_pid) ) { @@ -3813,13 +3815,14 @@ if ( face[v6].uAttributes & FACE_PRESSURE_PLATE ) { pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); - v103 = face[v6].sCogTriggeredID; // + trigger_id = face[v6].sCogTriggeredID; // } } } } pParty->floor_face_pid = PID(OBJECT_BModel, bmodel_standing_on_pid); } + _walk_speed = pParty->uWalkSpeed; _angle_y = pParty->sRotationY; _angle_x = pParty->sRotationX; @@ -4135,7 +4138,7 @@ if ( pModel ) pZ = v113; if (pParty->FlyActive()) - stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFEu; + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] &= 0xFE; pParty->uFallStartY = pZ; } else @@ -4147,16 +4150,16 @@ pParty->uFallStartY = v111; v113 = pZ; if (pParty->FlyActive()) - stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; } } else { - v113 = pZ; - if (pParty->FlyActive()) - stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1u; + v113 = pZ; + if (pParty->FlyActive()) + stru_5E4C90_MapPersistVars._decor_events[20 * pParty->pPartyBuffs[PARTY_BUFF_FLY].uOverlayID + 119] |= 1; } -//LABEL_141: + if (hovering && !pParty->bFlying)//расчёт скорости падения { v33 = -(pEventTimer->uTimeElapsed * GetGravityStrength()); @@ -4168,25 +4171,24 @@ else if (!hovering) { if ( !bmodel_standing_on_pid ) - { + { // rolling down the hill // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air // and falling to the gravity, gradually sliding downwards. nice trick pZ = v111; ODM_GetTerrainNormalAt(pX, pY, &v98); - v35 = pParty->uFallSpeed + (8 * -((pEventTimer->uTimeElapsed - 4) * GetGravityStrength())); + v35 = pParty->uFallSpeed + (8 * -(pEventTimer->uTimeElapsed * GetGravityStrength())); v129 = abs(v2 * v98.x + v1 * v98.y + v35 * v98.z) >> 16; v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); v128 = v1; pParty->uFallSpeed = v34; - } + } } else - v34 = pParty->uFallSpeed; - -//LABEL_164: + v34 = pParty->uFallSpeed; + if ( hovering ) { if ( !bUnderwater && v34 <= 0) @@ -4365,7 +4367,7 @@ if ( pParty->floor_face_pid != v45 && pODMFace->Pressure_Plate() ) { pParty->floor_face_pid = v45; - v103 = pODMFace->sCogTriggeredID; // + trigger_id = pODMFace->sCogTriggeredID; // } v2 = (unsigned __int64)(58500i64 * v2) >> 16; pModel = (BSPModel *)58500; @@ -4401,7 +4403,7 @@ if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) { pParty->floor_face_pid = stru_721530.uFaceID; - v103 = pODMFace->sCogTriggeredID; // + trigger_id = pODMFace->sCogTriggeredID; // } v2 = (unsigned __int64)(58500i64 * v2) >> 16; pModel = (BSPModel *)58500; @@ -4422,7 +4424,7 @@ if ( pParty->floor_face_pid != stru_721530.uFaceID && pODMFace->Pressure_Plate() ) { pParty->floor_face_pid = stru_721530.uFaceID; - v103 = pODMFace->sCogTriggeredID; // + trigger_id = pODMFace->sCogTriggeredID; // } v2 = (unsigned __int64)(58500i64 * v2) >> 16; pModel = (BSPModel *)58500; @@ -4513,8 +4515,9 @@ pParty->uFallStartY = 8160; pParty->vPosition.z = 8160; } - if ( !v103 //падение на землю - || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) + if ( !trigger_id //падение на землю + || (EventProcessor(trigger_id, 0, 1), + pParty->vPosition.x == pX) && pParty->vPosition.y == pY && pParty->vPosition.z == pZ ) { @@ -4522,8 +4525,8 @@ { pParty->uFallSpeed = 0; //v73 = v105; - pParty->vPosition.z = v105; - if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= v105 && !bUnderwater )//Fall to the ground(падение на землю с высоты) + pParty->vPosition.z = on_ground; + if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the ground(падение на землю с высоты) { if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) { @@ -4606,12 +4609,12 @@ pParty->walk_sound_timer = 64; } - v81 = pZ; - v82 = pZ; + //v81 = pZ; + //v82 = pZ; pParty->vPosition.z = pZ; if ( pZ > 8160 ) { - v82 = 8160; + //v82 = 8160; pParty->uFallStartY = 8160; pParty->vPosition.z = 8160; } @@ -4625,17 +4628,18 @@ pParty->uFlags |= PARTY_FLAGS_1_WATER_DAMAGE; } - if ( !v103//падение на воду - || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) + if ( !trigger_id//падение на воду + || (EventProcessor(trigger_id, 0, 1), + pParty->vPosition.x == pX) && pParty->vPosition.y == pY - && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) + && pParty->vPosition.z == pZ ) { if ( pParty->vPosition.z < v111 ) { - v82 = v105; + //v82 = on_ground; pParty->uFallSpeed = 0; - pParty->vPosition.z = v105; - if ( pParty->uFallStartY - v81 > 512 && !bFeatherFall && v81 <= v105 && !bUnderwater )//Fall to the water(падение на воду с высоты) + pParty->vPosition.z = on_ground; + if ( pParty->uFallStartY - pZ > 512 && !bFeatherFall && pZ <= on_ground && !bUnderwater )//Fall to the water(падение на воду с высоты) { if ( pParty->uFlags & PARTY_FLAGS_1_LANDING ) { @@ -4646,20 +4650,20 @@ for ( uint i = 1; i <= 4; ++i ) { v110 = pPlayers[i]->GetMaxHealth(); - pPlayers[i]->ReceiveDamage((signed int)((pParty->uFallStartY - v81) * (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)); } - v82 = pParty->vPosition.z; + //v82 = pParty->vPosition.z; } } - pParty->uFallStartY = v81; + pParty->uFallStartY = pZ; } - if ( v102 && v82 < ceiling_height && (signed int)(pParty->uPartyHeight + v82) >= ceiling_height ) + if ( v102 && pParty->vPosition.z < ceiling_height && (signed int)(pParty->uPartyHeight + pParty->vPosition.z) >= ceiling_height ) { - pParty->vPosition.z = v82 + pParty->uPartyHeight - ceiling_height + 1; - pParty->field_6F0 = v82 + pParty->uPartyHeight - ceiling_height + 1; + pParty->vPosition.z = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; + pParty->field_6F0 = pParty->vPosition.z + pParty->uPartyHeight - ceiling_height + 1; } } }
--- a/mm7_3.cpp Mon Jan 06 22:46:11 2014 +0600 +++ b/mm7_3.cpp Tue Jan 07 22:15:45 2014 +0600 @@ -194,7 +194,7 @@ int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0) { int result; // eax@1 - int v3; // ebx@9 + //int v3; // ebx@9 int v8; // eax@19 int v9; // ecx@20 int v10; // eax@24 @@ -204,48 +204,59 @@ unsigned int v17; // eax@36 int v21; // eax@42 unsigned int v22; // eax@43 - int a11; // [sp+70h] [bp-18h]@1 - int a10; // [sp+80h] [bp-8h]@1 + //int a11; // [sp+70h] [bp-18h]@1 + //int a10; // [sp+80h] [bp-8h]@1 int a2; // [sp+84h] [bp-4h]@23 - a11 = ecx0; + //a11 = ecx0; BLVFace face; // [sp+Ch] [bp-7Ch]@1 result = 0; - for ( a10 = 0; a10 < (signed int)pOutdoor->uNumBModels; ++a10 ) + for ( uint i = 0; i < (signed int)pOutdoor->uNumBModels; ++i ) { - if ( stru_721530.sMaxX <= pOutdoor->pBModels[a10].sMaxX && stru_721530.sMinX >= pOutdoor->pBModels[a10].sMinX - && stru_721530.sMaxY <= pOutdoor->pBModels[a10].sMaxY && stru_721530.sMinY >= pOutdoor->pBModels[a10].sMinY - && stru_721530.sMaxZ <= pOutdoor->pBModels[a10].sMaxZ && stru_721530.sMinZ >= pOutdoor->pBModels[a10].sMinZ ) + if ( stru_721530.sMaxX <= pOutdoor->pBModels[i].sMaxX && stru_721530.sMinX >= pOutdoor->pBModels[i].sMinX + && stru_721530.sMaxY <= pOutdoor->pBModels[i].sMaxY && stru_721530.sMinY >= pOutdoor->pBModels[i].sMinY + && stru_721530.sMaxZ <= pOutdoor->pBModels[i].sMaxZ && stru_721530.sMinZ >= pOutdoor->pBModels[i].sMinZ ) { - for ( v3 = 0; v3 < pOutdoor->pBModels[a10].uNumFaces; ++v3 ) + for ( uint j = 0; j < pOutdoor->pBModels[i].uNumFaces; ++j ) { - if ( stru_721530.sMaxX <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x2 && stru_721530.sMinX >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x1 - && stru_721530.sMaxY <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y2 && stru_721530.sMinY >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y1 - && stru_721530.sMaxZ <= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z2 && stru_721530.sMinZ >= pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z1 ) + if ( stru_721530.sMaxX <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2 && stru_721530.sMinX >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1 + && stru_721530.sMaxY <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2 && stru_721530.sMinY >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1 + && stru_721530.sMaxZ <= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z2 && stru_721530.sMinZ >= pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z1 ) { - face.pFacePlane_old.vNormal.x = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.x; - face.pFacePlane_old.vNormal.y = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.y; - face.pFacePlane_old.vNormal.z = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.vNormal.z; - face.pFacePlane_old.dist = pOutdoor->pBModels[a10].pFaces[v3].pFacePlane.dist; - face.uAttributes = pOutdoor->pBModels[a10].pFaces[v3].uAttributes; - face.pBounding.x1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x1; - face.pBounding.y1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y1; - face.pBounding.z1 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z1; - face.pBounding.x2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.x2; - face.pBounding.y2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.y2; - face.pBounding.z2 = pOutdoor->pBModels[a10].pFaces[v3].pBoundingBox.z2; - face.zCalc1 = pOutdoor->pBModels[a10].pFaces[v3].zCalc1; - face.zCalc2 = pOutdoor->pBModels[a10].pFaces[v3].zCalc2; - face.zCalc3 = pOutdoor->pBModels[a10].pFaces[v3].zCalc3; - face.pXInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pXInterceptDisplacements; - face.pYInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pYInterceptDisplacements; - face.pZInterceptDisplacements = pOutdoor->pBModels[a10].pFaces[v3].pZInterceptDisplacements; - face.uPolygonType = (PolygonType)pOutdoor->pBModels[a10].pFaces[v3].uPolygonType; - face.uNumVertices = pOutdoor->pBModels[a10].pFaces[v3].uNumVertices; - face.uBitmapID = pOutdoor->pBModels[a10].pFaces[v3].uTextureID; - face.pVertexIDs = pOutdoor->pBModels[a10].pFaces[v3].pVertexIDs; + face.pFacePlane_old.vNormal.x = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.x; + face.pFacePlane_old.vNormal.y = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.y; + face.pFacePlane_old.vNormal.z = pOutdoor->pBModels[i].pFaces[j].pFacePlane.vNormal.z; + + face.pFacePlane_old.dist = pOutdoor->pBModels[i].pFaces[j].pFacePlane.dist; //incorrect + + face.uAttributes = pOutdoor->pBModels[i].pFaces[j].uAttributes; + + face.pBounding.x1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x1; + face.pBounding.y1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y1; + face.pBounding.z1 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z1; + + face.pBounding.x2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.x2; + face.pBounding.y2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.y2; + face.pBounding.z2 = pOutdoor->pBModels[i].pFaces[j].pBoundingBox.z2; + + face.zCalc1 = pOutdoor->pBModels[i].pFaces[j].zCalc1; + face.zCalc2 = pOutdoor->pBModels[i].pFaces[j].zCalc2; + face.zCalc3 = pOutdoor->pBModels[i].pFaces[j].zCalc3; + + face.pXInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pXInterceptDisplacements; + face.pYInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pYInterceptDisplacements; + face.pZInterceptDisplacements = pOutdoor->pBModels[i].pFaces[j].pZInterceptDisplacements; + + face.uPolygonType = (PolygonType)pOutdoor->pBModels[i].pFaces[j].uPolygonType; + + face.uNumVertices = pOutdoor->pBModels[i].pFaces[j].uNumVertices; + + face.uBitmapID = pOutdoor->pBModels[i].pFaces[j].uTextureID; + + face.pVertexIDs = pOutdoor->pBModels[i].pFaces[j].pVertexIDs; + if ( !face.Ethereal() && !face.Portal() ) { v8 = (face.pFacePlane_old.dist + face.pFacePlane_old.vNormal.x * stru_721530.normal.x @@ -262,7 +273,7 @@ { a2 = stru_721530.field_6C; if ( sub_4754BF(stru_721530.prolly_normal_d, &a2, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, - stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, a10, a11) ) + stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, i, ecx0) ) { v10 = a2; } @@ -270,7 +281,7 @@ { a2 = stru_721530.prolly_normal_d + stru_721530.field_6C; if ( !sub_475F30( &a2, &face, stru_721530.normal.x, stru_721530.normal.y, stru_721530.normal.z, - stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, a10) ) + stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, i) ) goto LABEL_29; v10 = a2 - stru_721530.prolly_normal_d; a2 -= stru_721530.prolly_normal_d; @@ -278,7 +289,7 @@ if ( v10 < stru_721530.field_7C ) { stru_721530.field_7C = v10; - v14 = 8 * (v3 | (a10 << 6)); + v14 = 8 * (j | (i << 6)); LOBYTE(v14) = v14 | 6; stru_721530.uFaceID = v14; } @@ -302,12 +313,12 @@ { a2 = stru_721530.field_6C; if ( sub_4754BF(stru_721530.field_8_radius, &a2, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, - stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, a10, a11) ) + stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, &face, i, ecx0) ) { if ( a2 < stru_721530.field_7C ) { stru_721530.field_7C = a2; - v17 = 8 * (v3 | (a10 << 6)); + v17 = 8 * (j | (i << 6)); LOBYTE(v17) = v17 | 6; stru_721530.uFaceID = v17; } @@ -316,14 +327,14 @@ { a2 = stru_721530.field_6C + stru_721530.field_8_radius; if ( sub_475F30(&a2, &face, stru_721530.position.x, stru_721530.position.y, stru_721530.position.z, - stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, a10) ) + stru_721530.direction.x, stru_721530.direction.y, stru_721530.direction.z, i) ) { v21 = a2 - stru_721530.prolly_normal_d; a2 -= stru_721530.prolly_normal_d; if ( a2 < stru_721530.field_7C ) { stru_721530.field_7C = v21; - v22 = 8 * (v3 | (a10 << 6)); + v22 = 8 * (j | (i << 6)); LOBYTE(v22) = v22 | 6; stru_721530.uFaceID = v22; } @@ -337,7 +348,7 @@ } } } - result = a10; + result = i; } return result; }