Mercurial > mm7
diff mm7_3.cpp @ 723:256211e8243a
ODM_GetFloorLevel & BLV_GetFloorLevel
author | Ritor1 |
---|---|
date | Thu, 21 Mar 2013 16:09:44 +0600 |
parents | 70c5a87a1307 |
children | 737d7fec67f0 |
line wrap: on
line diff
--- a/mm7_3.cpp Wed Mar 20 17:49:15 2013 +0600 +++ b/mm7_3.cpp Thu Mar 21 16:09:44 2013 +0600 @@ -498,7 +498,7 @@ 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); + int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); if (floor_level != -30000 && floor_level <= z + 50) { @@ -509,7 +509,7 @@ uint uSectorID = pIndoor->GetSector(x, y, z); *pSectorID = uSectorID; - floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID); + floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); if (uSectorID && floor_level != -30000) *pFaceID = uFaceID; else return -30000; @@ -971,7 +971,7 @@ if ( !v0->CanAct() ) v74 = 0; v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); - v5 = sub_46D49E_prolly_get_world_y_under_party( + v5 = ODM_GetFloorLevel( v0->vPosition.x, v0->vPosition.y, v0->vPosition.z, @@ -1148,7 +1148,7 @@ v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; v34 = 0; v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; - v36 = sub_46D49E_prolly_get_world_y_under_party( + v36 = ODM_GetFloorLevel( stru_721530.normal2.x, stru_721530.normal2.y, stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, @@ -2288,14 +2288,14 @@ int v113; // [sp+4Ch] [bp-48h]@1 unsigned int v114; // [sp+50h] [bp-44h]@1 int _walk_speed; // [sp+54h] [bp-40h]@48 - int v116; // [sp+58h] [bp-3Ch]@1 - int v117; // [sp+5Ch] [bp-38h]@1 + int pX; // [sp+58h] [bp-3Ch]@1 + int pY; // [sp+5Ch] [bp-38h]@1 int v118; // [sp+60h] [bp-34h]@1 //Player **v119; // [sp+64h] [bp-30h]@4 int _angle_x; // [sp+68h] [bp-2Ch]@48 int v121; // [sp+6Ch] [bp-28h]@1 unsigned int v122; // [sp+70h] [bp-24h]@180 - int v123; // [sp+74h] [bp-20h]@1 + int pZ; // [sp+74h] [bp-20h]@1 int v124; // [sp+78h] [bp-1Ch]@1 int _angle_y; // [sp+7Ch] [bp-18h]@48 int v126; // [sp+80h] [bp-14h]@48 @@ -2305,13 +2305,13 @@ int v130; // [sp+90h] [bp-4h]@14 v121 = pParty->uFallSpeed; - v123 = pParty->vPosition.z; + pZ = pParty->vPosition.z; v1 = 0; v103 = 0; v2 = 0; *(float *)&v128 = 0.0; - v116 = pParty->vPosition.x; - v117 = pParty->vPosition.y; + pX = pParty->vPosition.x; + pY = pParty->vPosition.y; v113 = pParty->field_6F0; bJumping = 0; auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); @@ -2353,13 +2353,13 @@ //*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) bWaterWalk = 0; } - v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk); + v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk); v111 = v3; if ( bFeatherFall ) pParty->uFallStartY = v3; else v3 = pParty->uFallStartY; - if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 ) + if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) { if (pParty->uFlags & PARTY_FLAGS_1_LANDING) { @@ -2372,7 +2372,7 @@ if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) ) { player->ReceiveDamage( - (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, + (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, 4); v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance()); player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); @@ -2383,10 +2383,10 @@ } v109 = -1; if ( pParty->bFlying ) - v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102); + v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); v107 = v108 == 0; v105 = v111 + 1; - if ( v123 <= v111 + 1 ) + if ( pZ <= v111 + 1 ) { v109 = -1; pParty->bFlying = false; @@ -2395,7 +2395,7 @@ { bJumping = 1; } - v101 = v123 - v111 <= 32; + v101 = pZ - v111 <= 32; if ( bWalkSound && pParty->field_6F8 > 0 ) pParty->field_6F8 -= pEventTimer->uTimeElapsed; if (!bUnderwater @@ -2452,28 +2452,28 @@ { if ( pParty->vPosition.z < 4000 || bJumping ) { - v123 += 30; + pZ += 30; v113 += 30; pParty->bFlying = 1; - if ( v123 > 4000 ) + if ( pZ > 4000 ) { - v123 = 4000; + pZ = 4000; v113 = 4000; } v1 = 0; v2 = 0; v121 = 0; *(float *)&v128 = 0.0; - if ( v102 && v123 < v109 && (signed int)(pParty->uPartyHeight + v123) >= v109 ) + if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 ) { 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->field_6F0 = v123; + pParty->field_6F0 = pZ; pParty->bFlying = 0; - v123 = v109 - pParty->uPartyHeight - 31; + pZ = v109 - pParty->uPartyHeight - 31; v113 = pParty->field_6F0; } pParty->uFallSpeed = 0; @@ -2491,13 +2491,13 @@ || pParty->pPartyBuffs[7].uFlags & 1 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) { - v123 -= 30; + pZ -= 30; v113 -= 30; pParty->uFallSpeed = 0; v121 = 0; pParty->bFlying = 1; v127 = (BSPModel *)1; - if ( v123 <= v111 ) + if ( pZ <= v111 ) { pParty->bFlying = 0; pPartyActionQueue->uNumActions = 0; @@ -2723,7 +2723,7 @@ LABEL_123: pParty->sRotationY = _angle_y; pParty->sRotationX = _angle_x; - if ( v123 < v111 ) + if ( pZ < v111 ) { if ( pParty->bFlying ) { @@ -2731,23 +2731,23 @@ v31 = GetTickCount(); v126 = stru_5C6E00->Cos(v31); v129 = (unsigned __int64)(4i64 * v126) >> 16; - v123 = v113 + v129; + pZ = v113 + v129; if ( v127 ) - v123 = v113; + pZ = v113; if (pParty->FlyActive()) stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; - pParty->uFallStartY = v123; + pParty->uFallStartY = pZ; goto LABEL_141; } if ( v130 && v121 ) - sub_42F960_create_object(v116, v117, v111); + sub_42F960_create_object(pX, pY, v111); v121 = 0; - v123 = v111; + pZ = v111; pParty->uFallStartY = v111; } if ( pParty->bFlying ) goto LABEL_130; - v113 = v123; + v113 = pZ; if (pParty->FlyActive()) stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; @@ -2774,8 +2774,8 @@ // 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 - v123 = v111; - ODM_GetTerrainNormalAt(v116, v117, &v98); + pZ = v111; + ODM_GetTerrainNormalAt(pX, pY, &v98); v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; @@ -2808,7 +2808,7 @@ else { LABEL_150: - pParty->uFallStartY = v123; + pParty->uFallStartY = pZ; } if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) @@ -2825,13 +2825,13 @@ stru_721530.field_C = pParty->uPartyHeight - 32; do { - stru_721530.field_34.x = v116; - stru_721530.normal.x = v116; + stru_721530.field_34.x = pX; + stru_721530.normal.x = pX; stru_721530.field_1C = v2; - stru_721530.field_34.y = v117; - stru_721530.normal.y = v117; - stru_721530.normal.z = stru_721530.prolly_normal_d + v123 + 1; - stru_721530.field_34.z = stru_721530.field_C + v123 + 1; + stru_721530.field_34.y = pY; + stru_721530.normal.y = pY; + stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; + stru_721530.field_34.z = stru_721530.field_C + pZ + 1; stru_721530.field_20 = v128; stru_721530.field_24 = v121; v36 = 0; @@ -2855,24 +2855,17 @@ } else { - _angle_x = v116 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); - _angle_y = v117 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); + _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); + _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); - v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v123; + v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ; } v122 = v40; - sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); - v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0); - auto v119 = sub_46D49E_prolly_get_world_y_under_party( - v116, - _angle_y, - v40, - pParty->uPartyHeight, - &v130, - &v110, - 0); - v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, v117); - v42 = IsTerrainSlopeTooHigh(v116, _angle_y); + ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); + v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &v130, &v97, 0); + auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &v130, &v110, 0); + v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); + v42 = IsTerrainSlopeTooHigh(pX, _angle_y); v107 = 0; v118 = v42; if ( !v97 && !v110 && !v108 ) @@ -2881,48 +2874,41 @@ v44 = 1; if ( bUnderwater || !v107 ) goto LABEL_197; - if ( v127 && v129 > v123 ) + if ( v127 && v129 > pZ ) v44 = 0; - if ( v118 && v119 > v123 ) + if ( v118 && v119 > pZ ) v43 = 0; if ( v44 ) goto LABEL_197; if ( v43 ) goto LABEL_198; - v127 = (BSPModel *)sub_46D49E_prolly_get_world_y_under_party( - _angle_x, - _angle_y, - v40, - pParty->uPartyHeight, - &v130, - &v108, - 0); - if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= v123 ) + v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); + if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) { v43 = 1; LABEL_197: - v116 = _angle_x; + pX = _angle_x; if ( !v43 ) goto LABEL_199; LABEL_198: - v117 = _angle_y; + pY = _angle_y; } LABEL_199: if ( stru_721530.field_7C >= stru_721530.field_6C ) { if ( !v107 ) { - v116 = stru_721530.normal2.x; - v117 = stru_721530.normal2.y; - } - v123 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; + pX = stru_721530.normal2.x; + pY = stru_721530.normal2.y; + } + pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; break; } stru_721530.field_70 += stru_721530.field_7C; - v116 = _angle_x; - v117 = _angle_y; + pX = _angle_x; + pY = _angle_y; v45 = stru_721530.uFaceID; - v123 = v40; + pZ = v40; if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) { if (pParty->Invisible()) @@ -2972,7 +2958,7 @@ { if ( v121 < 0 ) v121 = 0; - v123 = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; + pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; if ( v2 * v2 + v128 * v128 < 400 ) { v2 = 0; @@ -3006,10 +2992,10 @@ + _angle_x * v47->pFacePlane.vNormal.x) >> 16); if ( v55 > 0 ) { - v116 = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); - v117 = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); + pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); + pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); if ( !v119 ) - v123 = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); + pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); } LABEL_220: v45 = stru_721530.uFaceID; @@ -3051,9 +3037,9 @@ while ( v126 < 100 ); if ( bWalkSound && pParty->field_6F8 <= 0 ) { - v122 = abs(pParty->vPosition.x - v116); - v126 = abs(pParty->vPosition.y - v117); - v62 = abs(pParty->vPosition.z - v123); + 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 ) goto LABEL_344; if ( v114 && (!bJumping || v101) ) @@ -3124,8 +3110,8 @@ pParty->uFlags |= PARTY_FLAGS_1_FALLING; v126 = WorldPosToGridCellX(pParty->vPosition.x); v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; - v114 = WorldPosToGridCellX(v116); - v66 = WorldPosToGridCellZ(v117) - 1; + v114 = WorldPosToGridCellX(pX); + v66 = WorldPosToGridCellZ(pY) - 1; v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); @@ -3137,16 +3123,16 @@ v68 = 1; if ( v68 ) { - v70 = v123; - v71 = v116; - v72 = v117; + v70 = pZ; + v71 = pX; + v72 = pY; pParty->uFallSpeed = v121; - v73 = v123; - pParty->vPosition.x = v116; - pParty->vPosition.y = v117; - pParty->vPosition.z = v123; + v73 = pZ; + pParty->vPosition.x = pX; + pParty->vPosition.y = pY; + pParty->vPosition.z = pZ; pParty->field_6F0 = v113; - if ( v123 > 8160 ) + if ( pZ > 8160 ) { v73 = 8160; pParty->uFallStartY = 8160; @@ -3220,7 +3206,7 @@ LABEL_306: if ( v77 ) { - pParty->vPosition.x = v116; + pParty->vPosition.x = pX; if ( !v78 ) goto LABEL_313; goto LABEL_312; @@ -3228,7 +3214,7 @@ if ( v78 ) { LABEL_312: - pParty->vPosition.y = v117; + pParty->vPosition.y = pY; LABEL_313: if ( bWaterWalk ) { @@ -3255,10 +3241,10 @@ pParty->field_6F8 = 64; } LABEL_318: - v81 = v123; - v82 = v123; - pParty->vPosition.z = v123; - if ( v123 > 8160 ) + v81 = pZ; + v82 = pZ; + pParty->vPosition.z = pZ; + if ( pZ > 8160 ) { v82 = 8160; pParty->uFallStartY = 8160; @@ -3275,8 +3261,8 @@ pParty->uFlags |= 4u; } if ( !v103 - || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v116) - && pParty->vPosition.y == v117 + || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) + && pParty->vPosition.y == pY && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) { if ( v82 < v111 )