Mercurial > might-and-magic-trilogy
diff mm7_3.cpp @ 76:75994455e457
BLV collisions
author | Nomad |
---|---|
date | Sat, 27 Oct 2012 22:25:38 +0200 |
parents | 8453114181af |
children | 8b0c4d626477 |
line wrap: on
line diff
--- a/mm7_3.cpp Sun Oct 28 00:49:10 2012 +0600 +++ b/mm7_3.cpp Sat Oct 27 22:25:38 2012 +0200 @@ -518,27 +518,25 @@ //----- (0046ED1B) -------------------------------------------------------- -int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, unsigned int *pFaceID) -{ - unsigned int *v5; // edi@1 - int result; // eax@1 - int v7; // eax@3 - int v8; // [sp+Ch] [bp-8h]@1 - int v9; // [sp+10h] [bp-4h]@1 - - __debugbreak(); - uint _pSectorID; - v5 = pSectorID; - v9 = a2; - v8 = a1; - result = _46CEC3_get_floor_level(a1, a2, a3, *pSectorID, &_pSectorID); - if ( result != -30000 && result <= a3 + 50 - || (v7 = pIndoor->GetSector(v8, v9, a3), (*v5 = v7) != 0) - && (result = _46CEC3_get_floor_level(v8, v9, a3, v7, &_pSectorID), result != -30000) ) - *pFaceID = _pSectorID; - else - result = -30000; - return result; +int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) +{ + uint uFaceID = -1; + int floor_level = _46CEC3_get_floor_level(x, y, z, *pSectorID, &uFaceID); + + if (floor_level != -30000 && floor_level <= z + 50) + { + *pFaceID = uFaceID; + return floor_level; + } + + uint uSectorID = pIndoor->GetSector(x, y, z); + *pSectorID = uSectorID; + + floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID); + if (uSectorID && floor_level != -30000) + *pFaceID = uFaceID; + else return -30000; + return floor_level; } //----- (0046ED8A) -------------------------------------------------------- @@ -2354,18 +2352,12 @@ //----- (00472866) -------------------------------------------------------- void BLV_ProcessPartyActions() { - int v0; // esi@1 int v1; // ebx@1 int v2; // edi@1 - int v3; // esi@1 - //float v4; // ST40_4@8 - //Player **v5; // esi@15 int v6; // eax@18 - //Player **v7; // esi@24 signed __int64 v8; // qax@27 int v9; // eax@27 double v10; // st7@27 - //BLVFace *v11; // edx@41 unsigned int v12; // eax@49 double v13; // st7@50 int v14; // eax@51 @@ -2383,12 +2375,6 @@ int v26; // eax@67 double v27; // st7@67 int v28; // ST40_4@67 - //int v29; // eax@69 - //double v30; // st7@69 - //int v31; // ST3C_4@69 - //int v32; // eax@71 - //double v33; // st7@71 - //int v34; // ST3C_4@71 unsigned int v35; // eax@74 int v36; // ecx@88 int new_party_z; // esi@96 @@ -2421,7 +2407,6 @@ unsigned int v64; // [sp-8h] [bp-68h]@161 int v65; // [sp-4h] [bp-64h]@75 int v66; // [sp-4h] [bp-64h]@161 - //double v67; // [sp+Ch] [bp-54h]@8 int v68; // [sp+10h] [bp-50h]@45 int v69; // [sp+10h] [bp-50h]@140 unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 @@ -2430,8 +2415,7 @@ signed int v73; // [sp+20h] [bp-40h]@100 int v74; // [sp+20h] [bp-40h]@140 bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 - //bool bFeatherFalla; // [sp+24h] [bp-3Ch]@33 - unsigned int v77; // [sp+28h] [bp-38h]@1 + unsigned int uSectorID; // [sp+28h] [bp-38h]@1 int v78; // [sp+2Ch] [bp-34h]@1 unsigned int uFaceID; // [sp+30h] [bp-30h]@1 int v80; // [sp+34h] [bp-2Ch]@1 @@ -2442,24 +2426,21 @@ int new_party_y; // [sp+48h] [bp-18h]@1 int new_party_x; // [sp+4Ch] [bp-14h]@1 int party_z; // [sp+50h] [bp-10h]@1 - //float v88; // [sp+54h] [bp-Ch]@62 int v89; // [sp+58h] [bp-8h]@1 int angle; // [sp+5Ch] [bp-4h]@47 - v0 = pParty->vPosition.z; v89 = pParty->uFallSpeed; v1 = 0; new_party_y = pParty->vPosition.y; v2 = 0; new_party_x = pParty->vPosition.x; party_z = pParty->vPosition.z; - v77 = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); + uSectorID = pIndoor->GetSector(pParty->vPosition.x, pParty->vPosition.y, pParty->vPosition.z); v72 = 0; v78 = 0; v71 = 0; bJumping = 0; - v3 = v0 + 40; - v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, v3, &v77, &uFaceID); + v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); if ( pParty->bFlying ) { pParty->bFlying = 0; @@ -2469,7 +2450,7 @@ } if ( v80 == -30000 ) { - v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, v3, &v77, &uFaceID); + v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, party_z + 40, &uSectorID, &uFaceID); if ( v80 == -30000 ) { pParty->vPosition.x = blv_prev_party_x; @@ -2789,7 +2770,7 @@ stru_721530.normal.z = stru_721530.prolly_normal_d + party_z + 1; stru_721530.field_34.z = stru_721530.field_C + party_z + 1; stru_721530.field_24 = v89; - stru_721530.uSectorID = v77; + stru_721530.uSectorID = uSectorID; v38 = 0; if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) v38 = 13312; @@ -2810,16 +2791,16 @@ if ( stru_721530.field_7C >= stru_721530.field_6C ) { v39 = stru_721530.normal2.x; - v77 = stru_721530.normal2.y; + uSectorID = stru_721530.normal2.y; v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; } else { v39 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16) + new_party_x; - v77 = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); + uSectorID = new_party_y + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); v40 = new_party_z + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); } - v42 = _46ED1B_collide_against_floor(v39, v77, v40 + 40, &stru_721530.uSectorID, &uFaceID); + v42 = _46ED1B_collide_against_floor(v39, uSectorID, v40 + 40, &stru_721530.uSectorID, &uFaceID); if ( v42 == -30000 || v42 - new_party_z > 128 ) return; if ( stru_721530.field_7C >= stru_721530.field_6C ) @@ -2832,7 +2813,7 @@ new_party_x += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16; new_party_y += (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16; v43 = stru_721530.uFaceID; - v77 = stru_721530.uSectorID; + uSectorID = stru_721530.uSectorID; stru_721530.field_70 += stru_721530.field_7C; auto v87 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + new_party_z; if ( (stru_721530.uFaceID & 7) == 3 )