# HG changeset patch # User Ritor1 # Date 1351363750 -21600 # Node ID ad87d8679e02967e23d5dbc163c7fd0e3f8013d9 # Parent 08ab7b5b85d8758c2b333ea2ab5fb01c37e937d3# Parent 8453114181af51dd06a2c3003b688ca553a7f0ec Слияние diff -r 08ab7b5b85d8 -r ad87d8679e02 Actor.cpp --- a/Actor.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/Actor.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -4129,7 +4129,7 @@ int result; // eax@13 Actor *v23; // eax@16 int v24; // [sp+Ch] [bp-1Ch]@1 - int v25; // [sp+10h] [bp-18h]@8 + unsigned int uFaceID; // [sp+10h] [bp-18h]@8 int v26; // [sp+14h] [bp-14h]@10 int v27; // [sp+18h] [bp-10h]@10 int v28; // [sp+1Ch] [bp-Ch]@8 @@ -4158,7 +4158,7 @@ } v6 = v2->vPosition.z; v28 = 0; - v25 = v6; + uFaceID = v6; if ( uCurrentlyLoadedLevelType == LEVEL_Indoor ) v28 = pIndoor->GetSector(v2->vPosition.x, v2->vPosition.y, v6); v7 = v4 - 1; @@ -4187,9 +4187,9 @@ v16 = stru_5C6E00->SinCos(v13 - stru_5C6E00->uIntegerHalfPi); v26 = v16; v29 = (unsigned __int64)(v16 * (signed __int64)v27) >> 16; - LOWORD(v16) = v25; + LOWORD(v16) = uFaceID; v17 = v29 + v30->vPosition.y; - v8->vInitialPosition.z = v25; + v8->vInitialPosition.z = uFaceID; v8->vPosition.z = v16; LOWORD(v16) = v28; v8->vInitialPosition.x = v15; @@ -4204,8 +4204,8 @@ LODWORD(v19) = v18->uAlly; if ( !(uint)v19 ) { - v25 = v18->pMonsterInfo.uID - 1; - v19 = (signed __int64)((double)v25 * 0.33333334); + uFaceID = v18->pMonsterInfo.uID - 1; + v19 = (signed __int64)((double)uFaceID * 0.33333334); v18 = v30; } v8->uAlly = v19; @@ -4220,7 +4220,7 @@ v27 = v30->vPosition.z, result = pIndoor->GetSector(v15, v17, v21), result == v28) - && (result = _46CEC3_get_floor_level(v15, v17, v27, result, &v25), result != -30000) + && (result = _46CEC3_get_floor_level(v15, v17, v27, result, &uFaceID), result != -30000) && (result = abs(result - v27), result <= 1024) ) { v23 = v30; diff -r 08ab7b5b85d8 -r ad87d8679e02 Indoor.cpp --- a/Indoor.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/Indoor.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -3967,12 +3967,12 @@ AIDirection v52; // [sp+0h] [bp-60h]@75 AIDirection v53; // [sp+1Ch] [bp-44h]@116 int v54; // [sp+38h] [bp-28h]@53 - int v55; // [sp+3Ch] [bp-24h]@6 + unsigned int uSectorID; // [sp+3Ch] [bp-24h]@6 int v56; // [sp+40h] [bp-20h]@6 unsigned int _this; // [sp+44h] [bp-1Ch]@51 int v58; // [sp+48h] [bp-18h]@51 int v59; // [sp+4Ch] [bp-14h]@8 - int v60; // [sp+50h] [bp-10h]@6 + unsigned int uFaceID; // [sp+50h] [bp-10h]@6 int v61; // [sp+54h] [bp-Ch]@14 int v62; // [sp+58h] [bp-8h]@6 unsigned int v63; // [sp+5Ch] [bp-4h]@1 @@ -3986,9 +3986,9 @@ v1 = v0->uAIState; if ( v1 == 11 || v1 == 19 || v1 == 17 || !v0->uMovementSpeed ) goto LABEL_123; - v55 = v0->uSectorID; - v2 = _46ED1B_collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, (unsigned int *)&v55, &v60); - v0->uSectorID = v55; + uSectorID = v0->uSectorID; + v2 = _46ED1B_collide_against_floor(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, &uSectorID, &uFaceID); + v0->uSectorID = uSectorID; v3 = v0->pMonsterInfo.uFlying; v56 = v2; v62 = v3; @@ -4003,7 +4003,7 @@ v5 = pIndoor->GetSector(v0->vPosition.x, v0->vPosition.y, v4); v0->uSectorID = v5; if ( !v5 - || (v56 = _46CEC3_get_floor_level(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &v60), v56 == -30000) ) + || (v56 = _46CEC3_get_floor_level(v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, v5, &uFaceID), v56 == -30000) ) goto LABEL_123; } if ( v0->uCurrentActionAnimation == 1 ) @@ -4033,18 +4033,18 @@ if ( v6 > 1000 ) v6 = 1000; v12 = stru_5C6E00->SinCos(v0->uYawAngle); - v55 = v12; + uSectorID = v12; v13 = v12 * (signed __int64)v6; v61 = v13 >> 16; v0->vVelocity.x = WORD1(v13); - v55 = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); - v61 = (unsigned __int64)(v55 * (signed __int64)v6) >> 16; + uSectorID = stru_5C6E00->SinCos(v0->uYawAngle - stru_5C6E00->uIntegerHalfPi); + v61 = (unsigned __int64)(uSectorID * (signed __int64)v6) >> 16; v7 = v62 == 0; - v0->vVelocity.y = (unsigned int)(v55 * v6) >> 16; + v0->vVelocity.y = (unsigned int)(uSectorID * v6) >> 16; if ( !v7 ) { v14 = stru_5C6E00->SinCos(v0->uPitchAngle - stru_5C6E00->uIntegerHalfPi); - v55 = v14; + uSectorID = v14; v15 = v14 * (signed __int64)v6; v61 = v15 >> 16; v0->vVelocity.z = WORD1(v15); @@ -4053,16 +4053,16 @@ else { v61 = v0->vVelocity.x; - v55 = 55000; + uSectorID = 55000; v61 = (unsigned __int64)(55000i64 * v61) >> 16; v0->vVelocity.x = v61; v61 = v0->vVelocity.y; - v61 = (unsigned __int64)(v55 * (signed __int64)v61) >> 16; + v61 = (unsigned __int64)(uSectorID * (signed __int64)v61) >> 16; v7 = v62 == 0; v0->vVelocity.y = v61; if ( !v7 ) { - v55 = 55000; + uSectorID = 55000; v61 = v0->vVelocity.z; v61 = (unsigned __int64)(55000i64 * v61) >> 16; v0->vVelocity.z = v61; @@ -4072,7 +4072,7 @@ v17 = pIndoor->pFaces; v51 = __OFSUB__(v16, v56); v8 = v16 - v56 < 0; - v18 = v60; + v18 = uFaceID; if ( v8 ^ v51 ) { v0->vPosition.z = v56 + 1; @@ -4112,7 +4112,7 @@ v21 = v0->uActorHeight; stru_721530.field_84 = -1; stru_721530.field_70 = 0; - v55 = 0; + uSectorID = 0; stru_721530.field_0 = 1; stru_721530.field_8 = v20; stru_721530.prolly_normal_d = v20; @@ -4189,8 +4189,8 @@ v58 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; v32 = v58 + v0->vPosition.z; } - v33 = _46ED1B_collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &v60); - v34 = pIndoor->pFaces[v60].uAttributes; + v33 = _46ED1B_collide_against_floor(v30, v31, v32, &stru_721530.uSectorID, &uFaceID); + v34 = pIndoor->pFaces[uFaceID].uAttributes; v35 = v34 & 0x400000; if (v35 && v0->uAIState == Dead) { @@ -4369,8 +4369,8 @@ } } LABEL_120: - ++v55; - if ( v55 >= 100 ) + ++uSectorID; + if ( uSectorID >= 100 ) goto LABEL_123; v20 = stru_721530.prolly_normal_d; } diff -r 08ab7b5b85d8 -r ad87d8679e02 Party.h --- a/Party.h Sun Oct 28 00:48:57 2012 +0600 +++ b/Party.h Sun Oct 28 00:49:10 2012 +0600 @@ -154,6 +154,7 @@ inline bool WaterWalkActive() {return pPartyBuffs[PARTY_BUFF_WATER_WALK].uExpireTime > 0;} inline bool ImmolationActive() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uExpireTime > 0;} inline bool ImmolationSkillLevel() {return pPartyBuffs[PARTY_BUFF_IMMOLATION].uSkill;} + inline bool FeatherFallActive() {return pPartyBuffs[PARTY_BUFF_FEATHER_FALL].uExpireTime > 0;} int field_0; diff -r 08ab7b5b85d8 -r ad87d8679e02 mm7_2.cpp --- a/mm7_2.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/mm7_2.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -7546,7 +7546,7 @@ char *v45; // [sp-4h] [bp-ECh]@9 char Str; // [sp+Ch] [bp-DCh]@60 char Str2; // [sp+2Ch] [bp-BCh]@29 - char v48; // [sp+A4h] [bp-44h]@52 + unsigned int uFaceID; // [sp+A4h] [bp-44h]@52 void *Src; // [sp+A8h] [bp-40h]@50 int v50; // [sp+ACh] [bp-3Ch]@47 char Source; // [sp+B0h] [bp-38h]@20 @@ -7768,7 +7768,7 @@ v37 = pIndoor->GetSector(v55, a4, v36); if ( v37 == v54 ) { - v38 = _46CEC3_get_floor_level(v55, a4, a3, v37, (int *)&v48); + v38 = _46CEC3_get_floor_level(v55, a4, a3, v37, &uFaceID); v39 = v38; if ( v38 != -30000 ) { @@ -7813,7 +7813,7 @@ const char *v15; // [sp-4h] [bp-24h]@2 unsigned __int16 v16; // [sp+0h] [bp-20h]@1 int v17; // [sp+4h] [bp-1Ch]@1 - int v18; // [sp+8h] [bp-18h]@16 + unsigned int uFaceID; // [sp+8h] [bp-18h]@16 int v19; // [sp+Ch] [bp-14h]@16 size_t v20; // [sp+10h] [bp-10h]@6 int v21; // [sp+14h] [bp-Ch]@14 @@ -7873,10 +7873,10 @@ v6->uMovementSpeed = v9; v10 = rand() % 2048; v11 = ((unsigned __int64)(stru_5C6E00->SinCos(v10) * (signed __int64)v19) >> 16) + pParty->vPosition.x; - v18 = stru_5C6E00->SinCos(v10 - stru_5C6E00->uIntegerHalfPi); - v23 = (unsigned __int64)(v18 * (signed __int64)v19) >> 16; + uFaceID = stru_5C6E00->SinCos(v10 - stru_5C6E00->uIntegerHalfPi); + v23 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; v12 = pParty->vPosition.y; - v13 = (unsigned __int64)(v18 * (signed __int64)v19) >> 16; + v13 = (unsigned __int64)(uFaceID * (signed __int64)v19) >> 16; v6->vInitialPosition.x = v11; v14 = v13 + v12; LOWORD(v12) = v22; @@ -7900,7 +7900,7 @@ || (v22 = pParty->vPosition.z, result = pIndoor->GetSector(v11, v14, pParty->vPosition.z), result == v21) - && (result = _46CEC3_get_floor_level(v11, v14, v22, result, &v18), result != -30000) + && (result = _46CEC3_get_floor_level(v11, v14, v22, result, &uFaceID), result != -30000) && (result = abs(result - v22), result <= 1024) ) { if ( v20 == uNumActors ) @@ -8368,7 +8368,7 @@ int v22; // [sp+2Ch] [bp-18h]@3 int v23; // [sp+30h] [bp-14h]@11 int v24; // [sp+34h] [bp-10h]@1 - int v25; // [sp+38h] [bp-Ch]@10 + unsigned int uFaceID; // [sp+38h] [bp-Ch]@10 int v26; // [sp+3Ch] [bp-8h]@11 int v27; // [sp+40h] [bp-4h]@11 @@ -8395,10 +8395,10 @@ if ( uCurrentlyLoadedLevelType == LEVEL_Outdoor ) { v22 = 0; - v25 = 0; + uFaceID = 0; while ( 1 ) { - ++v25; + ++uFaceID; v6 = rand() % 1024 + 512; v7 = rand() % (signed int)stru_5C6E00->uIntegerDoublePi; v20 = stru_5C6E00->SinCos(v7); @@ -8437,12 +8437,12 @@ v22 = 1; } LABEL_16: - v11 = v25 == 100; - if ( v25 >= 100 ) + v11 = uFaceID == 100; + if ( uFaceID >= 100 ) break; if ( v22 ) { - v11 = v25 == 100; + v11 = uFaceID == 100; break; } } @@ -8470,7 +8470,7 @@ v17 = pIndoor->GetSector(v19.vPosition.x, v23 + pParty->vPosition.y, pParty->vPosition.z); if ( v17 == v22 ) { - v18 = _46CEC3_get_floor_level(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &v25); + v18 = _46CEC3_get_floor_level(v19.vPosition.x, v19.vPosition.y, v19.vPosition.z, v17, &uFaceID); v19.vPosition.z = v18; if ( v18 != -30000 ) { diff -r 08ab7b5b85d8 -r ad87d8679e02 mm7_3.cpp --- a/mm7_3.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/mm7_3.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -518,7 +518,7 @@ //----- (0046ED1B) -------------------------------------------------------- -int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, int *a5) +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 @@ -526,14 +526,16 @@ 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, (int *)&pSectorID); + 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, (int *)&pSectorID), result != -30000) ) - *a5 = (int)pSectorID; + && (result = _46CEC3_get_floor_level(v8, v9, a3, v7, &_pSectorID), result != -30000) ) + *pFaceID = _pSectorID; else result = -30000; return result; @@ -1381,10 +1383,6 @@ } while ( (signed int)v75 < (signed int)uNumActors ); } -// 46DF1A: using guessed type int __fastcall 46DF1A_collide_against_actor(int, int); -// 47F44B: using guessed type int __stdcall WorldPosToGridCellX(int); -// 47F458: using guessed type int __stdcall WorldPosToGridCellZ(int); -// 4F75D8: using guessed type int ai_arrays_size; @@ -1428,7 +1426,7 @@ Particle_ Dst; // [sp+Ch] [bp-84h]@18 unsigned int uLayingItemID_; // [sp+74h] [bp-1Ch]@1 ObjectDesc *v37; // [sp+78h] [bp-18h]@1 - int v38; // [sp+7Ch] [bp-14h]@4 + unsigned int uFaceID; // [sp+7Ch] [bp-14h]@4 int v39; // [sp+80h] [bp-10h]@33 int v40; // [sp+84h] [bp-Ch]@28 int v41; // [sp+88h] [bp-8h]@34 @@ -1442,11 +1440,11 @@ if ( abs(v3) > 32767 || abs(v1->vPosition.y) > 32767 || abs(v1->vPosition.z) > 20000 - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &v38), + || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v1->uSectorID, &uFaceID), v42 <= -30000) && ((v4 = pIndoor->GetSector(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z), (v1->uSectorID = v4) == 0) - || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &v38), v42 == -30000)) ) + || (v42 = _46CEC3_get_floor_level(v1->vPosition.x, v1->vPosition.y, v1->vPosition.z, v4, &uFaceID), v42 == -30000)) ) { LayingItem::_42F933(uLayingItemID_); return; @@ -1458,7 +1456,7 @@ v8 = 0; LABEL_25: stru_721530.field_0 = v8; - v38 = v8; + uFaceID = v8; stru_721530.prolly_normal_d = v2->uRadius; v12 = v2->uHeight; stru_721530.field_84 = -1; @@ -1660,9 +1658,9 @@ v1->vVelocity.y = v41; v41 = v1->vVelocity.z; v41 = (unsigned __int64)(v40 * (signed __int64)v41) >> 16; - ++v38; - v28 = __OFSUB__(v38, 100); - v27 = v38 - 100 < 0; + ++uFaceID; + v28 = __OFSUB__(uFaceID, 100); + v27 = uFaceID - 100 < 0; v1->vVelocity.z = v41; if ( !(v27 ^ v28) ) return; @@ -1678,7 +1676,7 @@ { v6 = pIndoor->pFaces; v1->vPosition.z = v42 + 1; - v7 = &v6[v38]; + v7 = &v6[uFaceID]; if ( v7->uPolygonType == 3 ) { v8 = 0; @@ -1691,15 +1689,15 @@ v8 = 0; } v42 = v1->vVelocity.x; - v38 = 58500; + uFaceID = 58500; v42 = (unsigned __int64)(58500i64 * v42) >> 16; v1->vVelocity.x = v42; v42 = v1->vVelocity.y; - v42 = (unsigned __int64)(v38 * (signed __int64)v42) >> 16; - v38 = 58500; + v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; + uFaceID = 58500; v1->vVelocity.y = v42; v42 = v1->vVelocity.z; - v42 = (unsigned __int64)(v38 * (signed __int64)v42) >> 16; + v42 = (unsigned __int64)(uFaceID * (signed __int64)v42) >> 16; v9 = v1->vVelocity.x; v1->vVelocity.z = v42; if ( v9 * v9 + v1->vVelocity.y * v1->vVelocity.y < 400 ) @@ -2317,34 +2315,35 @@ } //----- (0047272C) -------------------------------------------------------- -int __fastcall _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, int *a5) +int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) { signed int v5; // ebx@1 int result; // eax@1 int v7; // [sp+10h] [bp-8h]@1 signed int v8; // [sp+14h] [bp-4h]@1 + __debugbreak(); v5 = x - 2; v7 = x; v8 = y; *pSectorID = pIndoor->GetSector(x - 2, y, z + 40); - result = _46ED1B_collide_against_floor(v5, v8, z + 40, pSectorID, a5); + result = _46ED1B_collide_against_floor(v5, v8, z + 40, pSectorID, pFaceID); if ( result == -30000 || !*pSectorID ) { *pSectorID = pIndoor->GetSector(v7 + 2, v8, z + 40); - result = _46ED1B_collide_against_floor(v7 + 2, v8, z + 40, pSectorID, a5); + result = _46ED1B_collide_against_floor(v7 + 2, v8, z + 40, pSectorID, pFaceID); if ( result == -30000 || !*pSectorID ) { *pSectorID = pIndoor->GetSector(v7, v8 - 2, z + 40); - result = _46ED1B_collide_against_floor(v7, v8 - 2, z + 40, pSectorID, a5); + result = _46ED1B_collide_against_floor(v7, v8 - 2, z + 40, pSectorID, pFaceID); if ( result == -30000 || !*pSectorID ) { *pSectorID = pIndoor->GetSector(v7, v8 + 2, z + 40); - result = _46ED1B_collide_against_floor(v7, v8 + 2, z + 40, pSectorID, a5); + result = _46ED1B_collide_against_floor(v7, v8 + 2, z + 40, pSectorID, pFaceID); if ( result == -30000 || !*pSectorID ) { *pSectorID = pIndoor->GetSector(v7, v8, z + 140); - result = _46ED1B_collide_against_floor(v7, v8, z + 140, pSectorID, a5); + result = _46ED1B_collide_against_floor(v7, v8, z + 140, pSectorID, pFaceID); } } } @@ -2353,20 +2352,20 @@ } //----- (00472866) -------------------------------------------------------- -void __cdecl BLV_ProcessPartyActions() +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 + //float v4; // ST40_4@8 + //Player **v5; // esi@15 int v6; // eax@18 - Player **v7; // esi@24 + //Player **v7; // esi@24 signed __int64 v8; // qax@27 int v9; // eax@27 double v10; // st7@27 - BLVFace *v11; // edx@41 + //BLVFace *v11; // edx@41 unsigned int v12; // eax@49 double v13; // st7@50 int v14; // eax@51 @@ -2422,20 +2421,20 @@ 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 + //double v67; // [sp+Ch] [bp-54h]@8 int v68; // [sp+10h] [bp-50h]@45 int v69; // [sp+10h] [bp-50h]@140 - int v70; // [sp+14h] [bp-4Ch]@1 + unsigned int uFaceEvent; // [sp+14h] [bp-4Ch]@1 signed int v71; // [sp+18h] [bp-48h]@1 signed int v72; // [sp+1Ch] [bp-44h]@1 signed int v73; // [sp+20h] [bp-40h]@100 int v74; // [sp+20h] [bp-40h]@140 - signed int bFeatherFall; // [sp+24h] [bp-3Ch]@15 - bool bFeatherFalla; // [sp+24h] [bp-3Ch]@33 + bool bFeatherFall; // [sp+24h] [bp-3Ch]@15 + //bool bFeatherFalla; // [sp+24h] [bp-3Ch]@33 unsigned int v77; // [sp+28h] [bp-38h]@1 int v78; // [sp+2Ch] [bp-34h]@1 - int v79; // [sp+30h] [bp-30h]@1 - int i; // [sp+34h] [bp-2Ch]@1 + unsigned int uFaceID; // [sp+30h] [bp-30h]@1 + int v80; // [sp+34h] [bp-2Ch]@1 int v81; // [sp+38h] [bp-28h]@47 int v82; // [sp+3Ch] [bp-24h]@47 int _view_angle; // [sp+40h] [bp-20h]@47 @@ -2451,7 +2450,6 @@ v89 = pParty->uFallSpeed; v1 = 0; new_party_y = pParty->vPosition.y; - v70 = 0; v2 = 0; new_party_x = pParty->vPosition.x; party_z = pParty->vPosition.z; @@ -2461,17 +2459,18 @@ v71 = 0; bJumping = 0; v3 = v0 + 40; - i = _46ED1B_collide_against_floor(new_party_x, new_party_y, v3, &v77, &v79); + v80 = _46ED1B_collide_against_floor(new_party_x, new_party_y, v3, &v77, &uFaceID); if ( pParty->bFlying ) { pParty->bFlying = 0; - if ( (signed __int64)pParty->pPartyBuffs[7].uExpireTime > 0 ) + __debugbreak(); + if (pParty->FlyActive()) stru_5E4C90.field_4B[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u;// 005E4D58 pOtherOverlayList [negindexing] } - if ( i == -30000 ) - { - i = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, v3, &v77, &v79); - if ( i == -30000 ) + if ( v80 == -30000 ) + { + v80 = _47272C_collide_agains_some_secotors_floors(new_party_x, new_party_y, v3, &v77, &uFaceID); + if ( v80 == -30000 ) { pParty->vPosition.x = blv_prev_party_x; pParty->vPosition.y = blv_prev_party_z; @@ -2485,93 +2484,89 @@ blv_prev_party_y = pParty->vPosition.z; if ( pParty->bTurnBasedModeOn != 1 ) { - v4 = (double)(GetTickCount() / 0x1F4); - v67 = v4 + 6.7553994e15; - if ( *(int *)&word_720C10_intercepts_xs[102] != LODWORD(v67) ) - { - dword_4F8584[3 * dword_4F8580[0]] = pParty->vPosition.x; - dword_4F8588[3 * dword_4F8580[0]] = pParty->vPosition.y; + __debugbreak(); + auto v67 = GetTickCount() / 500; + if (dword_720CDC != v67 ) + { + dword_4F8580[3 * dword_4F8580[0] + 1] = pParty->vPosition.x; + dword_4F8580[3 * dword_4F8580[0] + 2] = pParty->vPosition.y; dword_4F8580[3 * dword_4F8580[0]++ + 3] = pParty->vPosition.z; if ( dword_4F8580[0] > 60 ) dword_4F8580[0] = 1; } - *(int *)&word_720C10_intercepts_xs[102] = LODWORD(v67); - } - if ( SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) < 0 - || SHIDWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 && LODWORD(pParty->pPartyBuffs[5].uExpireTime) <= 0 ) - { - bFeatherFall = 0; - v5 = &pPlayers[1]; - while ( !(*v5)->WearsItem(536, 16) ) - { - ++v5; - if ( (signed int)v5 > (signed int)&pPlayers[4] ) - { - v6 = pParty->uFallStartY; - goto LABEL_20; - } - } - } - v6 = i; - bFeatherFall = 1; - pParty->uFallStartY = i; + dword_720CDC = v67; + } + if (!pParty->FeatherFallActive()) + { + bFeatherFall = false; + if (!pParty->pPlayers[0].WearsItem(536, 16) && + !pParty->pPlayers[1].WearsItem(536, 16) && + !pParty->pPlayers[2].WearsItem(536, 16) && + !pParty->pPlayers[3].WearsItem(536, 16)) + { + v6 = pParty->uFallStartY; + } + } + else + { + v6 = v80; + bFeatherFall = true; + pParty->uFallStartY = v80; + } LABEL_20: - if ( v6 - party_z > 512 && !bFeatherFall && party_z <= i + 1 ) + if ( v6 - party_z > 512 && !bFeatherFall && party_z <= v80 + 1 ) { if ( BYTE1(pParty->uFlags) & 1 ) { BYTE1(pParty->uFlags) &= 0xFEu; } - else - { - v7 = &pPlayers[1]; // receive falling damage - do - { - if ( !(*v7)->HasEnchantedItemEquipped(72) && !(*v7)->WearsItem(529, 8) ) - { - v8 = (signed __int64)((double)(*v7)->GetMaxHealth() * 0.1); - (*v7)->ReceiveDamage((pParty->uFallStartY - party_z) * (signed int)v8 / 256, 4); - v9 = (*v7)->GetActualEndurance(); - v10 = (double)(20 - (*v7)->_48EA1B_get_static_effect(v9)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; - (*v7)->SetRecoveryTime((signed __int64)v10); - } - ++v7; - } - while ( (signed int)v7 <= (signed int)&pPlayers[4] ); - } - } - if ( party_z > i + 1 ) + else for (uint i = 0; i < 4; ++i) + { // receive falling damage + auto pPlayer = pParty->pPlayers + i; + + if (!pPlayer->HasEnchantedItemEquipped(72) && + !pPlayer->WearsItem(529, 8)) + { + v8 = (signed __int64)((double)pPlayer->GetMaxHealth() * 0.1); + pPlayer->ReceiveDamage((pParty->uFallStartY - party_z) * (signed int)v8 / 256, 4); + v9 = pPlayer->GetActualEndurance(); + v10 = (double)(20 - pPlayer->_48EA1B_get_static_effect(v9)) * flt_6BE3A4_debug_recmod1 * 2.133333333333333; + pPlayer->SetRecoveryTime((signed __int64)v10); + } + } + } + if ( party_z > v80 + 1 ) bJumping = 1; - bFeatherFalla = party_z - i <= 32; - if ( party_z - i <= 32 ) + bFeatherFall = party_z - v80 <= 32; + if ( party_z - v80 <= 32 ) pParty->uFallStartY = party_z; if ( bWalkSound && pParty->field_6F8 > 0 ) pParty->field_6F8 -= pEventTimer->uTimeElapsed; - if ( party_z > i + 1 ) + if ( party_z > v80 + 1 ) { LABEL_43: if ( bJumping ) goto LABEL_45; goto LABEL_44; } - party_z = i + 1; - pParty->uFallStartY = i + 1; + party_z = v80 + 1; + pParty->uFallStartY = v80 + 1; if ( bJumping ) goto LABEL_45; - if ( pParty->field_6F4_packedid != v79 ) - { - v11 = &pIndoor->pFaces[v79]; - if ( BYTE3(v11->uAttributes) & 4 ) - { - v70 = pIndoor->pFaceExtras[v11->uFaceExtraID].uEventID; + if (pParty->field_6F4_packedid != uFaceID) + { + auto pFace = &pIndoor->pFaces[uFaceID]; + if (pFace->uAttributes & 0x04000000 ) + { + uFaceEvent = pIndoor->pFaceExtras[pFace->uFaceExtraID].uEventID; goto LABEL_43; } } LABEL_44: - pParty->field_6F4_packedid = v79; + pParty->field_6F4_packedid = uFaceID; LABEL_45: - v68 = v79; - if ( pIndoor->pFaces[v79].uAttributes & 0x10 ) + v68 = uFaceID; + if ( pIndoor->pFaces[uFaceID].uAttributes & 0x10 ) v71 = 1; v81 = pParty->uWalkSpeed; angle = pParty->sRotationY; @@ -2724,7 +2719,7 @@ break; case PARTY_Jump: __debugbreak(); - if ( (!bJumping || party_z <= i + 6 && v89 <= 0) && pParty->field_24 ) + if ( (!bJumping || party_z <= v80 + 6 && v89 <= 0) && pParty->field_24 ) { bJumping = 1; v89 = (signed __int64)((double)(pParty->field_24 << 6) * 1.5 + (double)v89); @@ -2805,8 +2800,8 @@ { _46E44E_collide_against_faces_and_portals(1u); _46E0B2_collide_against_decorations(); - for ( i = 0; i < (signed int)uNumActors; ++i ) - _46DF1A_collide_against_actor(i, 0); + for ( v80 = 0; v80 < (signed int)uNumActors; ++v80 ) + _46DF1A_collide_against_actor(v80, 0); if ( _46F04E_collide_against_portals() ) break; ++v73; @@ -2824,7 +2819,7 @@ v77 = 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, &v79); + v42 = _46ED1B_collide_against_floor(v39, v77, v40 + 40, &stru_721530.uSectorID, &uFaceID); if ( v42 == -30000 || v42 - new_party_z > 128 ) return; if ( stru_721530.field_7C >= stru_721530.field_6C ) @@ -2851,13 +2846,13 @@ if ( (stru_721530.uFaceID & 7) == 5 ) { v53 = sub_452A9E(v2 * v2 + v1 * v1); - i = v53; + v80 = v53; v54 = stru_5C6E00->Atan2( new_party_x - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.x, new_party_y - pLevelDecorations[stru_721530.uFaceID >> 3].vPosition.y); v2 = (unsigned __int64)(stru_5C6E00->SinCos(v54) * (signed __int64)v53) >> 16; v55 = stru_5C6E00->SinCos(v54 - stru_5C6E00->uIntegerHalfPi); - v1 = (unsigned __int64)(v55 * (signed __int64)i) >> 16; + v1 = (unsigned __int64)(v55 * (signed __int64)v80) >> 16; } else { @@ -2884,43 +2879,43 @@ v48 = v44->pFacePlane_old.vNormal.x; if ( !v47 ) { - i = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; - if ( stru_721530.field_64 >> 3 > i ) - i = stru_721530.field_64 >> 3; - v50 = (unsigned __int64)(i * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; + v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; + if ( stru_721530.field_64 >> 3 > v80 ) + v80 = stru_721530.field_64 >> 3; + v50 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; v81 = v44->pFacePlane_old.vNormal.y; - v81 = (unsigned __int64)(i * (signed __int64)v81) >> 16; + v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; v82 = v44->pFacePlane_old.vNormal.z; - v82 = (unsigned __int64)(i * (signed __int64)v82) >> 16; + v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; v2 += v50; v89 += v82; v74 = v44->pFacePlane_old.vNormal.z; v51 = v44->pFacePlane_old.vNormal.y; v69 = v44->pFacePlane_old.vNormal.x; - i = v51; + v80 = v51; v1 += v81; v52 = stru_721530.prolly_normal_d - ((v44->pFacePlane_old.dist + v87 * v74 + new_party_y * v51 + new_party_x * v69) >> 16); if ( v52 > 0 ) { new_party_x += v52 * v69 >> 16; - new_party_y += v52 * i >> 16; + new_party_y += v52 * v80 >> 16; v87 += v52 * v74 >> 16; } LABEL_142: v43 = stru_721530.uFaceID; LABEL_143: if ( pParty->field_6F4_packedid != v43 >> 3 && BYTE3(v44->uAttributes) & 4 ) - v70 = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; + uFaceEvent = pIndoor->pFaceExtras[v44->uFaceExtraID].uEventID; goto LABEL_152; } - i = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; - if ( stru_721530.field_64 >> 3 > i ) - i = stru_721530.field_64 >> 3; - v49 = (unsigned __int64)(i * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; + v80 = abs(v1 * v44->pFacePlane_old.vNormal.y + v46 + v2 * v48) >> 16; + if ( stru_721530.field_64 >> 3 > v80 ) + v80 = stru_721530.field_64 >> 3; + v49 = (unsigned __int64)(v80 * (signed __int64)v44->pFacePlane_old.vNormal.x) >> 16; v81 = v44->pFacePlane_old.vNormal.y; - v81 = (unsigned __int64)(i * (signed __int64)v81) >> 16; + v81 = (unsigned __int64)(v80 * (signed __int64)v81) >> 16; v82 = v44->pFacePlane_old.vNormal.z; - v82 = (unsigned __int64)(i * (signed __int64)v82) >> 16; + v82 = (unsigned __int64)(v80 * (signed __int64)v82) >> 16; v2 += v49; v1 += v81; v89 += v82; @@ -2949,7 +2944,7 @@ + (pParty->vPosition.z - new_party_z) * (pParty->vPosition.z - new_party_z)) <= 16 ) goto LABEL_188; - if ( v72 && (!bJumping || bFeatherFalla) ) + if ( v72 && (!bJumping || bFeatherFall) ) { v66 = 0; v64 = 0; @@ -2961,7 +2956,7 @@ if ( !v71 ) { v56 = pAudioPlayer; - if ( BYTE2(pIndoor->pFaces[v79].uAttributes) & 0x20 ) + if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) v57 = (SoundID)50; else v57 = (SoundID)64; @@ -2972,7 +2967,7 @@ v56 = pAudioPlayer; goto LABEL_175; } - if ( v78 && (!bJumping || bFeatherFalla) ) + if ( v78 && (!bJumping || bFeatherFall) ) { v66 = 0; v64 = 0; @@ -2987,7 +2982,7 @@ goto LABEL_174; } v56 = pAudioPlayer; - if ( BYTE2(pIndoor->pFaces[v79].uAttributes) & 0x20 ) + if ( BYTE2(pIndoor->pFaces[uFaceID].uAttributes) & 0x20 ) v57 = (SoundID)89; else v57 = (SoundID)103; @@ -3001,7 +2996,7 @@ pParty->field_6F8 = 64; } } - if ( !bJumping || bFeatherFalla ) + if ( !bJumping || bFeatherFall ) pParty->uFlags &= 0xFFFFFFF7u; else pParty->uFlags |= 8u; @@ -3010,10 +3005,10 @@ pParty->vPosition.z = new_party_z; pParty->vPosition.y = new_party_y; pParty->uFallSpeed = v89; - if ( !bJumping && BYTE3(pIndoor->pFaces[v79].uAttributes) & 0x40 ) + if ( !bJumping && BYTE3(pIndoor->pFaces[uFaceID].uAttributes) & 0x40 ) BYTE1(pParty->uFlags) |= 2u; - if ( v70 ) - EventProcessor(v70, 0, 1); + if (uFaceEvent) + EventProcessor(uFaceEvent, 0, 1); } diff -r 08ab7b5b85d8 -r ad87d8679e02 mm7_4.cpp --- a/mm7_4.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/mm7_4.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -234,7 +234,7 @@ // 6836C8: using guessed type int 6836C8_num_decorations_6807E8; //----- (0046CEC3) -------------------------------------------------------- -int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, int *a5) +int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, unsigned int *pFaceID) { BLVSector *v5; // edi@1 int v6; // ecx@1 @@ -481,12 +481,12 @@ v35 = 1; if ( v55 == 1 ) { - *a5 = dword_721200[0]; + *pFaceID = dword_721200[0]; return dword_7212C8[0]; } if ( !v55 ) return -30000; - *a5 = dword_721200[0]; + *pFaceID = dword_721200[0]; result = dword_7212C8[0]; if ( v55 > 1 ) { @@ -507,7 +507,7 @@ goto LABEL_68; LABEL_67: result = dword_7212C8[v35]; - *a5 = dword_721200[v35]; + *pFaceID = dword_721200[v35]; goto LABEL_68; } return result; diff -r 08ab7b5b85d8 -r ad87d8679e02 mm7_data.cpp --- a/mm7_data.cpp Sun Oct 28 00:48:57 2012 +0600 +++ b/mm7_data.cpp Sun Oct 28 00:49:10 2012 +0600 @@ -1915,9 +1915,7 @@ int ai_arrays_size; // weak int ai_array_4F75E0[500]; unsigned int ai_array_4F7DB0_actor_ids[500]; -int dword_4F8580[777]; // weak -int dword_4F8584[777]; // weak -int dword_4F8588[777]; // weak +int dword_4F8580[182]; // weak int dword_4FA9B0[777]; // weak int dword_4FA9B4[777]; // weak char byte_4FAA00; // weak @@ -2390,7 +2388,8 @@ __int16 word_7209A0_intercepts_ys_plus_ys[104]; __int16 word_720A70_intercepts_xs_plus_xs[104]; __int16 word_720B40_intercepts_zs[104]; -__int16 word_720C10_intercepts_xs[104]; +__int16 word_720C10_intercepts_xs[102]; +int dword_720CDC; __int16 word_720CE0_ys[777]; // idb __int16 word_720DB0_xs[777]; // idb int dword_720E80[20]; diff -r 08ab7b5b85d8 -r ad87d8679e02 mm7_data.h --- a/mm7_data.h Sun Oct 28 00:48:57 2012 +0600 +++ b/mm7_data.h Sun Oct 28 00:49:10 2012 +0600 @@ -1866,8 +1866,6 @@ extern int ai_array_4F75E0[500]; extern unsigned int ai_array_4F7DB0_actor_ids[500]; extern int dword_4F8580[]; // weak -extern int dword_4F8584[]; // weak -extern int dword_4F8588[]; // weak extern int dword_4FA9B0[]; // weak extern int dword_4FA9B4[]; // weak extern char byte_4FAA00; // weak @@ -2344,7 +2342,8 @@ extern __int16 word_7209A0_intercepts_ys_plus_ys[104]; extern __int16 word_720A70_intercepts_xs_plus_xs[104]; extern __int16 word_720B40_intercepts_zs[104]; -extern __int16 word_720C10_intercepts_xs[104]; +extern __int16 word_720C10_intercepts_xs[102]; +extern int dword_720CDC; extern __int16 word_720CE0_ys[]; // idb extern __int16 word_720DB0_xs[]; // idb extern int dword_720E80[20]; @@ -2940,7 +2939,7 @@ void __cdecl ODM_UpdateUserInputAndOther(); bool __fastcall _46BFFA_check_object_intercept(unsigned int uLayingItemID, signed int a2); void __cdecl _46CC4B_check_event_triggers(); -int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, int *a5); +int __fastcall _46CEC3_get_floor_level(signed int a1, signed int a2, int a3, unsigned int uSectorID, unsigned int *pFaceID); int __fastcall sub_46D49E_prolly_get_world_y_under_party(int a1, signed int a2, int a3, int a4, int *a5, int *a6, int a7); int __fastcall sub_46D8E3(int a1, signed int a2, int a3, int a4); signed __int64 __fastcall _46DCC8_get_gravity_direction_outdoor(int a1, int a2, Vec3_int_ *a3); @@ -2950,7 +2949,7 @@ void __fastcall _46E26D_collide_against_sprites(signed int a1, signed int a2); int __thiscall _46E44E_collide_against_faces_and_portals(unsigned int b1); // idb int __fastcall _46E889_collide_against_bmodels(unsigned int ecx0); -int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, int *a5); // idb +int __fastcall _46ED1B_collide_against_floor(signed int a1, signed int a2, int a3, unsigned int *pSectorID, unsigned int *pFaceID); // idb void __fastcall _46ED8A_collide_against_layingItems(unsigned int _this); int __thiscall _46EF01_collision_chech_player(int a1); // idb signed int __cdecl _46F04E_collide_against_portals(); @@ -2958,7 +2957,7 @@ void __cdecl UpdateActors_BLV(); void __cdecl UpdateActors_ODM(); void __cdecl UpdateObjects(); -int __fastcall _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, int *a5); // idb +int _47272C_collide_agains_some_secotors_floors(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID); // idb void __cdecl BLV_ProcessPartyActions(); void __cdecl ODM_ProcessPartyActions(); bool __fastcall sub_47531C(int a1, int *a2, int a3, int a4, int a5, int a6, int a7, int a8, BLVFace *a9, int a10);