Mercurial > mm7
comparison mm7_3.cpp @ 723:256211e8243a
ODM_GetFloorLevel & BLV_GetFloorLevel
author | Ritor1 |
---|---|
date | Thu, 21 Mar 2013 16:09:44 +0600 |
parents | 70c5a87a1307 |
children | 737d7fec67f0 |
comparison
equal
deleted
inserted
replaced
722:70c5a87a1307 | 723:256211e8243a |
---|---|
496 | 496 |
497 //----- (0046ED1B) -------------------------------------------------------- | 497 //----- (0046ED1B) -------------------------------------------------------- |
498 int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) | 498 int _46ED1B_collide_against_floor(int x, int y, int z, unsigned int *pSectorID, unsigned int *pFaceID) |
499 { | 499 { |
500 uint uFaceID = -1; | 500 uint uFaceID = -1; |
501 int floor_level = _46CEC3_get_floor_level(x, y, z, *pSectorID, &uFaceID); | 501 int floor_level = BLV_GetFloorLevel(x, y, z, *pSectorID, &uFaceID); |
502 | 502 |
503 if (floor_level != -30000 && floor_level <= z + 50) | 503 if (floor_level != -30000 && floor_level <= z + 50) |
504 { | 504 { |
505 *pFaceID = uFaceID; | 505 *pFaceID = uFaceID; |
506 return floor_level; | 506 return floor_level; |
507 } | 507 } |
508 | 508 |
509 uint uSectorID = pIndoor->GetSector(x, y, z); | 509 uint uSectorID = pIndoor->GetSector(x, y, z); |
510 *pSectorID = uSectorID; | 510 *pSectorID = uSectorID; |
511 | 511 |
512 floor_level = _46CEC3_get_floor_level(x, y, z, uSectorID, &uFaceID); | 512 floor_level = BLV_GetFloorLevel(x, y, z, uSectorID, &uFaceID); |
513 if (uSectorID && floor_level != -30000) | 513 if (uSectorID && floor_level != -30000) |
514 *pFaceID = uFaceID; | 514 *pFaceID = uFaceID; |
515 else return -30000; | 515 else return -30000; |
516 return floor_level; | 516 return floor_level; |
517 } | 517 } |
969 v0->uSectorID = 0; | 969 v0->uSectorID = 0; |
970 v74 = v4; | 970 v74 = v4; |
971 if ( !v0->CanAct() ) | 971 if ( !v0->CanAct() ) |
972 v74 = 0; | 972 v74 = 0; |
973 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); | 973 v70 = IsTerrainSlopeTooHigh(v0->vPosition.x, v0->vPosition.y); |
974 v5 = sub_46D49E_prolly_get_world_y_under_party( | 974 v5 = ODM_GetFloorLevel( |
975 v0->vPosition.x, | 975 v0->vPosition.x, |
976 v0->vPosition.y, | 976 v0->vPosition.y, |
977 v0->vPosition.z, | 977 v0->vPosition.z, |
978 v0->uActorHeight, | 978 v0->uActorHeight, |
979 &v76, | 979 &v76, |
1146 v71 = i > 1; | 1146 v71 = i > 1; |
1147 if ( stru_721530.field_7C < stru_721530.field_6C ) | 1147 if ( stru_721530.field_7C < stru_721530.field_6C ) |
1148 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; | 1148 v70 = (unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16; |
1149 v34 = 0; | 1149 v34 = 0; |
1150 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | 1150 v35 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
1151 v36 = sub_46D49E_prolly_get_world_y_under_party( | 1151 v36 = ODM_GetFloorLevel( |
1152 stru_721530.normal2.x, | 1152 stru_721530.normal2.x, |
1153 stru_721530.normal2.y, | 1153 stru_721530.normal2.y, |
1154 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, | 1154 stru_721530.normal2.z - stru_721530.prolly_normal_d - 1, |
1155 v0->uActorHeight, | 1155 v0->uActorHeight, |
1156 (int *)&v63, | 1156 (int *)&v63, |
2286 int v111; // [sp+44h] [bp-50h]@14 | 2286 int v111; // [sp+44h] [bp-50h]@14 |
2287 int bJumping; // [sp+48h] [bp-4Ch]@1 | 2287 int bJumping; // [sp+48h] [bp-4Ch]@1 |
2288 int v113; // [sp+4Ch] [bp-48h]@1 | 2288 int v113; // [sp+4Ch] [bp-48h]@1 |
2289 unsigned int v114; // [sp+50h] [bp-44h]@1 | 2289 unsigned int v114; // [sp+50h] [bp-44h]@1 |
2290 int _walk_speed; // [sp+54h] [bp-40h]@48 | 2290 int _walk_speed; // [sp+54h] [bp-40h]@48 |
2291 int v116; // [sp+58h] [bp-3Ch]@1 | 2291 int pX; // [sp+58h] [bp-3Ch]@1 |
2292 int v117; // [sp+5Ch] [bp-38h]@1 | 2292 int pY; // [sp+5Ch] [bp-38h]@1 |
2293 int v118; // [sp+60h] [bp-34h]@1 | 2293 int v118; // [sp+60h] [bp-34h]@1 |
2294 //Player **v119; // [sp+64h] [bp-30h]@4 | 2294 //Player **v119; // [sp+64h] [bp-30h]@4 |
2295 int _angle_x; // [sp+68h] [bp-2Ch]@48 | 2295 int _angle_x; // [sp+68h] [bp-2Ch]@48 |
2296 int v121; // [sp+6Ch] [bp-28h]@1 | 2296 int v121; // [sp+6Ch] [bp-28h]@1 |
2297 unsigned int v122; // [sp+70h] [bp-24h]@180 | 2297 unsigned int v122; // [sp+70h] [bp-24h]@180 |
2298 int v123; // [sp+74h] [bp-20h]@1 | 2298 int pZ; // [sp+74h] [bp-20h]@1 |
2299 int v124; // [sp+78h] [bp-1Ch]@1 | 2299 int v124; // [sp+78h] [bp-1Ch]@1 |
2300 int _angle_y; // [sp+7Ch] [bp-18h]@48 | 2300 int _angle_y; // [sp+7Ch] [bp-18h]@48 |
2301 int v126; // [sp+80h] [bp-14h]@48 | 2301 int v126; // [sp+80h] [bp-14h]@48 |
2302 BSPModel *v127; // [sp+84h] [bp-10h]@1 | 2302 BSPModel *v127; // [sp+84h] [bp-10h]@1 |
2303 int v128; // [sp+88h] [bp-Ch]@1 | 2303 int v128; // [sp+88h] [bp-Ch]@1 |
2304 int v129; // [sp+8Ch] [bp-8h]@92 | 2304 int v129; // [sp+8Ch] [bp-8h]@92 |
2305 int v130; // [sp+90h] [bp-4h]@14 | 2305 int v130; // [sp+90h] [bp-4h]@14 |
2306 | 2306 |
2307 v121 = pParty->uFallSpeed; | 2307 v121 = pParty->uFallSpeed; |
2308 v123 = pParty->vPosition.z; | 2308 pZ = pParty->vPosition.z; |
2309 v1 = 0; | 2309 v1 = 0; |
2310 v103 = 0; | 2310 v103 = 0; |
2311 v2 = 0; | 2311 v2 = 0; |
2312 *(float *)&v128 = 0.0; | 2312 *(float *)&v128 = 0.0; |
2313 v116 = pParty->vPosition.x; | 2313 pX = pParty->vPosition.x; |
2314 v117 = pParty->vPosition.y; | 2314 pY = pParty->vPosition.y; |
2315 v113 = pParty->field_6F0; | 2315 v113 = pParty->field_6F0; |
2316 bJumping = 0; | 2316 bJumping = 0; |
2317 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); | 2317 auto partyAtHighSlope = IsTerrainSlopeTooHigh(pParty->vPosition.x, pParty->vPosition.y); |
2318 v114 = 0; | 2318 v114 = 0; |
2319 v124 = 0; | 2319 v124 = 0; |
2351 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && | 2351 if (!(pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uFlags & 1) && |
2352 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 ) | 2352 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_WATER_WALK].uCaster-1].sMana <= 0 ) |
2353 //*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) | 2353 //*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[18].uCaster + 10] <= 0 ) |
2354 bWaterWalk = 0; | 2354 bWaterWalk = 0; |
2355 } | 2355 } |
2356 v3 = sub_46D49E_prolly_get_world_y_under_party(v116, v117, v123, pParty->uPartyHeight, &v130, &v108, bWaterWalk); | 2356 v3 = ODM_GetFloorLevel(pX, pY, pZ, pParty->uPartyHeight, &v130, &v108, bWaterWalk); |
2357 v111 = v3; | 2357 v111 = v3; |
2358 if ( bFeatherFall ) | 2358 if ( bFeatherFall ) |
2359 pParty->uFallStartY = v3; | 2359 pParty->uFallStartY = v3; |
2360 else | 2360 else |
2361 v3 = pParty->uFallStartY; | 2361 v3 = pParty->uFallStartY; |
2362 if ( v3 - v123 > 512 && !bFeatherFall && v123 <= v111 + 1 ) | 2362 if ( v3 - pZ > 512 && !bFeatherFall && pZ <= v111 + 1 ) |
2363 { | 2363 { |
2364 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) | 2364 if (pParty->uFlags & PARTY_FLAGS_1_LANDING) |
2365 { | 2365 { |
2366 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; | 2366 pParty->uFlags &= ~PARTY_FLAGS_1_LANDING; |
2367 } | 2367 } |
2370 auto player = pParty->pPlayers + _i; | 2370 auto player = pParty->pPlayers + _i; |
2371 | 2371 |
2372 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) ) | 2372 if ( !player->HasEnchantedItemEquipped(72) && !player->WearsItem(529, 8) ) |
2373 { | 2373 { |
2374 player->ReceiveDamage( | 2374 player->ReceiveDamage( |
2375 (signed int)((pParty->uFallStartY - v123) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, | 2375 (signed int)((pParty->uFallStartY - pZ) * (unsigned __int64)(player->GetMaxHealth() / 10)) / 256, |
2376 4); | 2376 4); |
2377 v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance()); | 2377 v105 = 20 - player->_48EA1B_get_static_effect(player->GetActualEndurance()); |
2378 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); | 2378 player->SetRecoveryTime((signed __int64)((double)v105 * flt_6BE3A4_debug_recmod1 * 2.133333333333333)); |
2379 } | 2379 } |
2380 //} | 2380 //} |
2381 //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); | 2381 //while ( (signed int)v4 <= (signed int)&pPlayers[4] ); |
2382 } | 2382 } |
2383 } | 2383 } |
2384 v109 = -1; | 2384 v109 = -1; |
2385 if ( pParty->bFlying ) | 2385 if ( pParty->bFlying ) |
2386 v109 = sub_46D8E3(v116, v117, v123 + pParty->uPartyHeight, (int)&v102); | 2386 v109 = sub_46D8E3(pX, pY, pZ + pParty->uPartyHeight, (int)&v102); |
2387 v107 = v108 == 0; | 2387 v107 = v108 == 0; |
2388 v105 = v111 + 1; | 2388 v105 = v111 + 1; |
2389 if ( v123 <= v111 + 1 ) | 2389 if ( pZ <= v111 + 1 ) |
2390 { | 2390 { |
2391 v109 = -1; | 2391 v109 = -1; |
2392 pParty->bFlying = false; | 2392 pParty->bFlying = false; |
2393 } | 2393 } |
2394 else | 2394 else |
2395 { | 2395 { |
2396 bJumping = 1; | 2396 bJumping = 1; |
2397 } | 2397 } |
2398 v101 = v123 - v111 <= 32; | 2398 v101 = pZ - v111 <= 32; |
2399 if ( bWalkSound && pParty->field_6F8 > 0 ) | 2399 if ( bWalkSound && pParty->field_6F8 > 0 ) |
2400 pParty->field_6F8 -= pEventTimer->uTimeElapsed; | 2400 pParty->field_6F8 -= pEventTimer->uTimeElapsed; |
2401 if (!bUnderwater | 2401 if (!bUnderwater |
2402 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0 | 2402 && SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0 |
2403 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) ) | 2403 && (SHIDWORD(pParty->pPartyBuffs[7].uExpireTime) < 0 || LODWORD(pParty->pPartyBuffs[7].uExpireTime) <= 0) ) |
2450 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || | 2450 pParty->pPartyBuffs[PARTY_BUFF_FLY].uFlags & 1 || |
2451 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) | 2451 pParty->pPlayers[pParty->pPartyBuffs[PARTY_BUFF_FLY].uCaster - 1].sMana > 0 ) |
2452 { | 2452 { |
2453 if ( pParty->vPosition.z < 4000 || bJumping ) | 2453 if ( pParty->vPosition.z < 4000 || bJumping ) |
2454 { | 2454 { |
2455 v123 += 30; | 2455 pZ += 30; |
2456 v113 += 30; | 2456 v113 += 30; |
2457 pParty->bFlying = 1; | 2457 pParty->bFlying = 1; |
2458 if ( v123 > 4000 ) | 2458 if ( pZ > 4000 ) |
2459 { | 2459 { |
2460 v123 = 4000; | 2460 pZ = 4000; |
2461 v113 = 4000; | 2461 v113 = 4000; |
2462 } | 2462 } |
2463 v1 = 0; | 2463 v1 = 0; |
2464 v2 = 0; | 2464 v2 = 0; |
2465 v121 = 0; | 2465 v121 = 0; |
2466 *(float *)&v128 = 0.0; | 2466 *(float *)&v128 = 0.0; |
2467 if ( v102 && v123 < v109 && (signed int)(pParty->uPartyHeight + v123) >= v109 ) | 2467 if ( v102 && pZ < v109 && (signed int)(pParty->uPartyHeight + pZ) >= v109 ) |
2468 { | 2468 { |
2469 pParty->field_6E0 = 0; | 2469 pParty->field_6E0 = 0; |
2470 pParty->field_6E4 = 0; | 2470 pParty->field_6E4 = 0; |
2471 pPartyActionQueue->uNumActions = 0; | 2471 pPartyActionQueue->uNumActions = 0; |
2472 pParty->uFlags |= PARTY_FLAGS_1_LANDING; | 2472 pParty->uFlags |= PARTY_FLAGS_1_LANDING; |
2473 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; | 2473 pParty->vPosition.z = v109 - pParty->uPartyHeight - 31; |
2474 pParty->field_6F0 = v123; | 2474 pParty->field_6F0 = pZ; |
2475 pParty->bFlying = 0; | 2475 pParty->bFlying = 0; |
2476 v123 = v109 - pParty->uPartyHeight - 31; | 2476 pZ = v109 - pParty->uPartyHeight - 31; |
2477 v113 = pParty->field_6F0; | 2477 v113 = pParty->field_6F0; |
2478 } | 2478 } |
2479 pParty->uFallSpeed = 0; | 2479 pParty->uFallSpeed = 0; |
2480 v127 = (BSPModel *)1; | 2480 v127 = (BSPModel *)1; |
2481 } | 2481 } |
2489 pParty->bFlying = 0; | 2489 pParty->bFlying = 0; |
2490 if ( bUnderwater | 2490 if ( bUnderwater |
2491 || pParty->pPartyBuffs[7].uFlags & 1 | 2491 || pParty->pPartyBuffs[7].uFlags & 1 |
2492 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) | 2492 || pParty->pPlayers[pParty->pPartyBuffs[7].uCaster - 1].sMana > 0 )//*(int *)&pParty->pArtifactsFound[6972 * pParty->pPartyBuffs[7].uCaster + 10] > 0 ) |
2493 { | 2493 { |
2494 v123 -= 30; | 2494 pZ -= 30; |
2495 v113 -= 30; | 2495 v113 -= 30; |
2496 pParty->uFallSpeed = 0; | 2496 pParty->uFallSpeed = 0; |
2497 v121 = 0; | 2497 v121 = 0; |
2498 pParty->bFlying = 1; | 2498 pParty->bFlying = 1; |
2499 v127 = (BSPModel *)1; | 2499 v127 = (BSPModel *)1; |
2500 if ( v123 <= v111 ) | 2500 if ( pZ <= v111 ) |
2501 { | 2501 { |
2502 pParty->bFlying = 0; | 2502 pParty->bFlying = 0; |
2503 pPartyActionQueue->uNumActions = 0; | 2503 pPartyActionQueue->uNumActions = 0; |
2504 } | 2504 } |
2505 } | 2505 } |
2721 } | 2721 } |
2722 | 2722 |
2723 LABEL_123: | 2723 LABEL_123: |
2724 pParty->sRotationY = _angle_y; | 2724 pParty->sRotationY = _angle_y; |
2725 pParty->sRotationX = _angle_x; | 2725 pParty->sRotationX = _angle_x; |
2726 if ( v123 < v111 ) | 2726 if ( pZ < v111 ) |
2727 { | 2727 { |
2728 if ( pParty->bFlying ) | 2728 if ( pParty->bFlying ) |
2729 { | 2729 { |
2730 LABEL_130: | 2730 LABEL_130: |
2731 v31 = GetTickCount(); | 2731 v31 = GetTickCount(); |
2732 v126 = stru_5C6E00->Cos(v31); | 2732 v126 = stru_5C6E00->Cos(v31); |
2733 v129 = (unsigned __int64)(4i64 * v126) >> 16; | 2733 v129 = (unsigned __int64)(4i64 * v126) >> 16; |
2734 v123 = v113 + v129; | 2734 pZ = v113 + v129; |
2735 if ( v127 ) | 2735 if ( v127 ) |
2736 v123 = v113; | 2736 pZ = v113; |
2737 if (pParty->FlyActive()) | 2737 if (pParty->FlyActive()) |
2738 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; | 2738 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] &= 0xFEu; |
2739 pParty->uFallStartY = v123; | 2739 pParty->uFallStartY = pZ; |
2740 goto LABEL_141; | 2740 goto LABEL_141; |
2741 } | 2741 } |
2742 if ( v130 && v121 ) | 2742 if ( v130 && v121 ) |
2743 sub_42F960_create_object(v116, v117, v111); | 2743 sub_42F960_create_object(pX, pY, v111); |
2744 v121 = 0; | 2744 v121 = 0; |
2745 v123 = v111; | 2745 pZ = v111; |
2746 pParty->uFallStartY = v111; | 2746 pParty->uFallStartY = v111; |
2747 } | 2747 } |
2748 if ( pParty->bFlying ) | 2748 if ( pParty->bFlying ) |
2749 goto LABEL_130; | 2749 goto LABEL_130; |
2750 v113 = v123; | 2750 v113 = pZ; |
2751 if (pParty->FlyActive()) | 2751 if (pParty->FlyActive()) |
2752 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; | 2752 stru_5E4C90._decor_events[20 * pParty->pPartyBuffs[7].uOverlayID + 119] |= 1u; |
2753 | 2753 |
2754 LABEL_141: | 2754 LABEL_141: |
2755 if (bJumping && !pParty->bFlying) | 2755 if (bJumping && !pParty->bFlying) |
2772 goto LABEL_150; | 2772 goto LABEL_150; |
2773 | 2773 |
2774 // rolling down the hill | 2774 // rolling down the hill |
2775 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air | 2775 // how it's done: you get a little bit pushed in the air along terrain normal, getting in the air |
2776 // and falling to the gravity, gradually sliding downwards. nice trick | 2776 // and falling to the gravity, gradually sliding downwards. nice trick |
2777 v123 = v111; | 2777 pZ = v111; |
2778 ODM_GetTerrainNormalAt(v116, v117, &v98); | 2778 ODM_GetTerrainNormalAt(pX, pY, &v98); |
2779 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); | 2779 v35 = v121 + -8 * pEventTimer->uTimeElapsed * GetGravityStrength(); |
2780 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; | 2780 v129 = abs((signed __int64)v2 * v98.x + (signed __int64)v1 * v98.y + (signed __int64)v35 * v98.z) >> 16; |
2781 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; | 2781 v2 += (unsigned __int64)(v129 * (signed __int64)v98.x) >> 16; |
2782 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; | 2782 v1 += (unsigned __int64)(v129 * (signed __int64)v98.y) >> 16; |
2783 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); | 2783 v34 = v35 + ((unsigned __int64)(v129 * (signed __int64)v98.z) >> 16); |
2806 } | 2806 } |
2807 } | 2807 } |
2808 else | 2808 else |
2809 { | 2809 { |
2810 LABEL_150: | 2810 LABEL_150: |
2811 pParty->uFallStartY = v123; | 2811 pParty->uFallStartY = pZ; |
2812 } | 2812 } |
2813 | 2813 |
2814 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) | 2814 if ( v2 * v2 + v1 * v1 < 400 && !partyAtHighSlope ) |
2815 { | 2815 { |
2816 *(float *)&v128 = 0.0; | 2816 *(float *)&v128 = 0.0; |
2823 v126 = 0; | 2823 v126 = 0; |
2824 stru_721530.field_0 = 1; | 2824 stru_721530.field_0 = 1; |
2825 stru_721530.field_C = pParty->uPartyHeight - 32; | 2825 stru_721530.field_C = pParty->uPartyHeight - 32; |
2826 do | 2826 do |
2827 { | 2827 { |
2828 stru_721530.field_34.x = v116; | 2828 stru_721530.field_34.x = pX; |
2829 stru_721530.normal.x = v116; | 2829 stru_721530.normal.x = pX; |
2830 stru_721530.field_1C = v2; | 2830 stru_721530.field_1C = v2; |
2831 stru_721530.field_34.y = v117; | 2831 stru_721530.field_34.y = pY; |
2832 stru_721530.normal.y = v117; | 2832 stru_721530.normal.y = pY; |
2833 stru_721530.normal.z = stru_721530.prolly_normal_d + v123 + 1; | 2833 stru_721530.normal.z = stru_721530.prolly_normal_d + pZ + 1; |
2834 stru_721530.field_34.z = stru_721530.field_C + v123 + 1; | 2834 stru_721530.field_34.z = stru_721530.field_C + pZ + 1; |
2835 stru_721530.field_20 = v128; | 2835 stru_721530.field_20 = v128; |
2836 stru_721530.field_24 = v121; | 2836 stru_721530.field_24 = v121; |
2837 v36 = 0; | 2837 v36 = 0; |
2838 stru_721530.uSectorID = 0; | 2838 stru_721530.uSectorID = 0; |
2839 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) | 2839 if ( pParty->bTurnBasedModeOn == 1 && pTurnEngine->field_4 == 3 ) |
2853 _angle_y = stru_721530.normal2.y; | 2853 _angle_y = stru_721530.normal2.y; |
2854 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | 2854 v40 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
2855 } | 2855 } |
2856 else | 2856 else |
2857 { | 2857 { |
2858 _angle_x = v116 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); | 2858 _angle_x = pX + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.x) >> 16); |
2859 _angle_y = v117 + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); | 2859 _angle_y = pY + ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.y) >> 16); |
2860 v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); | 2860 v127 = (BSPModel *)((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16); |
2861 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + v123; | 2861 v40 = ((unsigned __int64)(stru_721530.field_7C * (signed __int64)stru_721530.field_58.z) >> 16) + pZ; |
2862 } | 2862 } |
2863 v122 = v40; | 2863 v122 = v40; |
2864 sub_46D49E_prolly_get_world_y_under_party(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); | 2864 ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); |
2865 v129 = sub_46D49E_prolly_get_world_y_under_party(_angle_x, v117, v40, pParty->uPartyHeight, &v130, &v97, 0); | 2865 v129 = ODM_GetFloorLevel(_angle_x, pY, v40, pParty->uPartyHeight, &v130, &v97, 0); |
2866 auto v119 = sub_46D49E_prolly_get_world_y_under_party( | 2866 auto v119 = ODM_GetFloorLevel(pX, _angle_y, v40, pParty->uPartyHeight, &v130, &v110, 0); |
2867 v116, | 2867 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, pY); |
2868 _angle_y, | 2868 v42 = IsTerrainSlopeTooHigh(pX, _angle_y); |
2869 v40, | |
2870 pParty->uPartyHeight, | |
2871 &v130, | |
2872 &v110, | |
2873 0); | |
2874 v127 = (BSPModel *)IsTerrainSlopeTooHigh(_angle_x, v117); | |
2875 v42 = IsTerrainSlopeTooHigh(v116, _angle_y); | |
2876 v107 = 0; | 2869 v107 = 0; |
2877 v118 = v42; | 2870 v118 = v42; |
2878 if ( !v97 && !v110 && !v108 ) | 2871 if ( !v97 && !v110 && !v108 ) |
2879 v107 = 1; | 2872 v107 = 1; |
2880 v43 = 1; | 2873 v43 = 1; |
2881 v44 = 1; | 2874 v44 = 1; |
2882 if ( bUnderwater || !v107 ) | 2875 if ( bUnderwater || !v107 ) |
2883 goto LABEL_197; | 2876 goto LABEL_197; |
2884 if ( v127 && v129 > v123 ) | 2877 if ( v127 && v129 > pZ ) |
2885 v44 = 0; | 2878 v44 = 0; |
2886 if ( v118 && v119 > v123 ) | 2879 if ( v118 && v119 > pZ ) |
2887 v43 = 0; | 2880 v43 = 0; |
2888 if ( v44 ) | 2881 if ( v44 ) |
2889 goto LABEL_197; | 2882 goto LABEL_197; |
2890 if ( v43 ) | 2883 if ( v43 ) |
2891 goto LABEL_198; | 2884 goto LABEL_198; |
2892 v127 = (BSPModel *)sub_46D49E_prolly_get_world_y_under_party( | 2885 v127 = (BSPModel *)ODM_GetFloorLevel(_angle_x, _angle_y, v40, pParty->uPartyHeight, &v130, &v108, 0); |
2893 _angle_x, | 2886 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= pZ ) |
2894 _angle_y, | |
2895 v40, | |
2896 pParty->uPartyHeight, | |
2897 &v130, | |
2898 &v108, | |
2899 0); | |
2900 if ( IsTerrainSlopeTooHigh(_angle_x, _angle_y) && (signed int)v127 <= v123 ) | |
2901 { | 2887 { |
2902 v43 = 1; | 2888 v43 = 1; |
2903 LABEL_197: | 2889 LABEL_197: |
2904 v116 = _angle_x; | 2890 pX = _angle_x; |
2905 if ( !v43 ) | 2891 if ( !v43 ) |
2906 goto LABEL_199; | 2892 goto LABEL_199; |
2907 LABEL_198: | 2893 LABEL_198: |
2908 v117 = _angle_y; | 2894 pY = _angle_y; |
2909 } | 2895 } |
2910 LABEL_199: | 2896 LABEL_199: |
2911 if ( stru_721530.field_7C >= stru_721530.field_6C ) | 2897 if ( stru_721530.field_7C >= stru_721530.field_6C ) |
2912 { | 2898 { |
2913 if ( !v107 ) | 2899 if ( !v107 ) |
2914 { | 2900 { |
2915 v116 = stru_721530.normal2.x; | 2901 pX = stru_721530.normal2.x; |
2916 v117 = stru_721530.normal2.y; | 2902 pY = stru_721530.normal2.y; |
2917 } | 2903 } |
2918 v123 = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; | 2904 pZ = stru_721530.normal2.z - stru_721530.prolly_normal_d - 1; |
2919 break; | 2905 break; |
2920 } | 2906 } |
2921 stru_721530.field_70 += stru_721530.field_7C; | 2907 stru_721530.field_70 += stru_721530.field_7C; |
2922 v116 = _angle_x; | 2908 pX = _angle_x; |
2923 v117 = _angle_y; | 2909 pY = _angle_y; |
2924 v45 = stru_721530.uFaceID; | 2910 v45 = stru_721530.uFaceID; |
2925 v123 = v40; | 2911 pZ = v40; |
2926 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) | 2912 if ( (stru_721530.uFaceID & 7) == OBJECT_Actor) |
2927 { | 2913 { |
2928 if (pParty->Invisible()) | 2914 if (pParty->Invisible()) |
2929 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); | 2915 pParty->pPartyBuffs[PARTY_BUFF_INVISIBILITY].Reset(); |
2930 | 2916 |
2970 v53 = v47->uPolygonType; | 2956 v53 = v47->uPolygonType; |
2971 if ( v53 == 3 ) | 2957 if ( v53 == 3 ) |
2972 { | 2958 { |
2973 if ( v121 < 0 ) | 2959 if ( v121 < 0 ) |
2974 v121 = 0; | 2960 v121 = 0; |
2975 v123 = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; | 2961 pZ = v127->pVertices.pVertices[v47->pVertexIDs[0]].z + 1; |
2976 if ( v2 * v2 + v128 * v128 < 400 ) | 2962 if ( v2 * v2 + v128 * v128 < 400 ) |
2977 { | 2963 { |
2978 v2 = 0; | 2964 v2 = 0; |
2979 *(float *)&v128 = 0.0; | 2965 *(float *)&v128 = 0.0; |
2980 } | 2966 } |
3004 + v122 * v47->pFacePlane.vNormal.z | 2990 + v122 * v47->pFacePlane.vNormal.z |
3005 + _angle_y * v47->pFacePlane.vNormal.y | 2991 + _angle_y * v47->pFacePlane.vNormal.y |
3006 + _angle_x * v47->pFacePlane.vNormal.x) >> 16); | 2992 + _angle_x * v47->pFacePlane.vNormal.x) >> 16); |
3007 if ( v55 > 0 ) | 2993 if ( v55 > 0 ) |
3008 { | 2994 { |
3009 v116 = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); | 2995 pX = _angle_x + (v47->pFacePlane.vNormal.x * v55 >> 16); |
3010 v117 = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); | 2996 pY = _angle_y + (v47->pFacePlane.vNormal.y * v55 >> 16); |
3011 if ( !v119 ) | 2997 if ( !v119 ) |
3012 v123 = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); | 2998 pZ = v122 + (v47->pFacePlane.vNormal.z * v55 >> 16); |
3013 } | 2999 } |
3014 LABEL_220: | 3000 LABEL_220: |
3015 v45 = stru_721530.uFaceID; | 3001 v45 = stru_721530.uFaceID; |
3016 LABEL_221: | 3002 LABEL_221: |
3017 if ( pParty->field_6F4_packedid != v45 && BYTE3(v47->uAttributes) & 4 ) | 3003 if ( pParty->field_6F4_packedid != v45 && BYTE3(v47->uAttributes) & 4 ) |
3049 v121 = (unsigned __int64)(58500i64 * v121) >> 16; | 3035 v121 = (unsigned __int64)(58500i64 * v121) >> 16; |
3050 } | 3036 } |
3051 while ( v126 < 100 ); | 3037 while ( v126 < 100 ); |
3052 if ( bWalkSound && pParty->field_6F8 <= 0 ) | 3038 if ( bWalkSound && pParty->field_6F8 <= 0 ) |
3053 { | 3039 { |
3054 v122 = abs(pParty->vPosition.x - v116); | 3040 v122 = abs(pParty->vPosition.x - pX); |
3055 v126 = abs(pParty->vPosition.y - v117); | 3041 v126 = abs(pParty->vPosition.y - pY); |
3056 v62 = abs(pParty->vPosition.z - v123); | 3042 v62 = abs(pParty->vPosition.z - pZ); |
3057 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) | 3043 if ( integer_sqrt(v122 * v122 + v126 * v126 + v62 * v62) < 8 ) |
3058 goto LABEL_344; | 3044 goto LABEL_344; |
3059 if ( v114 && (!bJumping || v101) ) | 3045 if ( v114 && (!bJumping || v101) ) |
3060 { | 3046 { |
3061 if ( !v107 | 3047 if ( !v107 |
3122 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; | 3108 pParty->uFlags &= ~PARTY_FLAGS_1_FALLING; |
3123 else | 3109 else |
3124 pParty->uFlags |= PARTY_FLAGS_1_FALLING; | 3110 pParty->uFlags |= PARTY_FLAGS_1_FALLING; |
3125 v126 = WorldPosToGridCellX(pParty->vPosition.x); | 3111 v126 = WorldPosToGridCellX(pParty->vPosition.x); |
3126 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; | 3112 v65 = WorldPosToGridCellZ(pParty->vPosition.y) - 1; |
3127 v114 = WorldPosToGridCellX(v116); | 3113 v114 = WorldPosToGridCellX(pX); |
3128 v66 = WorldPosToGridCellZ(v117) - 1; | 3114 v66 = WorldPosToGridCellZ(pY) - 1; |
3129 v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); | 3115 v127 = (BSPModel *)(((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v65) >> 1) & 1); |
3130 v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; | 3116 v122 = ((unsigned int)~pOutdoor->ActuallyGetSomeOtherTileInfo(v114, v65) >> 1) & 1; |
3131 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); | 3117 v67 = pOutdoor->ActuallyGetSomeOtherTileInfo(v126, v66); |
3132 v68 = 0; | 3118 v68 = 0; |
3133 v69 = ((unsigned int)~v67 >> 1) & 1; | 3119 v69 = ((unsigned int)~v67 >> 1) & 1; |
3135 v68 = 1; | 3121 v68 = 1; |
3136 if ( !v107 ) | 3122 if ( !v107 ) |
3137 v68 = 1; | 3123 v68 = 1; |
3138 if ( v68 ) | 3124 if ( v68 ) |
3139 { | 3125 { |
3140 v70 = v123; | 3126 v70 = pZ; |
3141 v71 = v116; | 3127 v71 = pX; |
3142 v72 = v117; | 3128 v72 = pY; |
3143 pParty->uFallSpeed = v121; | 3129 pParty->uFallSpeed = v121; |
3144 v73 = v123; | 3130 v73 = pZ; |
3145 pParty->vPosition.x = v116; | 3131 pParty->vPosition.x = pX; |
3146 pParty->vPosition.y = v117; | 3132 pParty->vPosition.y = pY; |
3147 pParty->vPosition.z = v123; | 3133 pParty->vPosition.z = pZ; |
3148 pParty->field_6F0 = v113; | 3134 pParty->field_6F0 = v113; |
3149 if ( v123 > 8160 ) | 3135 if ( pZ > 8160 ) |
3150 { | 3136 { |
3151 v73 = 8160; | 3137 v73 = 8160; |
3152 pParty->uFallStartY = 8160; | 3138 pParty->uFallStartY = 8160; |
3153 pParty->vPosition.z = 8160; | 3139 pParty->vPosition.z = 8160; |
3154 } | 3140 } |
3218 } | 3204 } |
3219 v78 = 1; | 3205 v78 = 1; |
3220 LABEL_306: | 3206 LABEL_306: |
3221 if ( v77 ) | 3207 if ( v77 ) |
3222 { | 3208 { |
3223 pParty->vPosition.x = v116; | 3209 pParty->vPosition.x = pX; |
3224 if ( !v78 ) | 3210 if ( !v78 ) |
3225 goto LABEL_313; | 3211 goto LABEL_313; |
3226 goto LABEL_312; | 3212 goto LABEL_312; |
3227 } | 3213 } |
3228 if ( v78 ) | 3214 if ( v78 ) |
3229 { | 3215 { |
3230 LABEL_312: | 3216 LABEL_312: |
3231 pParty->vPosition.y = v117; | 3217 pParty->vPosition.y = pY; |
3232 LABEL_313: | 3218 LABEL_313: |
3233 if ( bWaterWalk ) | 3219 if ( bWaterWalk ) |
3234 { | 3220 { |
3235 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; | 3221 pParty->uFlags &= ~PARTY_FLAGS_1_STANDING_ON_WATER; |
3236 //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178; | 3222 //v79 = 20 * pParty->pPartyBuffs[18].uOverlayID + 6180178; |
3253 { | 3239 { |
3254 pAudioPlayer->_4AA258(804); | 3240 pAudioPlayer->_4AA258(804); |
3255 pParty->field_6F8 = 64; | 3241 pParty->field_6F8 = 64; |
3256 } | 3242 } |
3257 LABEL_318: | 3243 LABEL_318: |
3258 v81 = v123; | 3244 v81 = pZ; |
3259 v82 = v123; | 3245 v82 = pZ; |
3260 pParty->vPosition.z = v123; | 3246 pParty->vPosition.z = pZ; |
3261 if ( v123 > 8160 ) | 3247 if ( pZ > 8160 ) |
3262 { | 3248 { |
3263 v82 = 8160; | 3249 v82 = 8160; |
3264 pParty->uFallStartY = 8160; | 3250 pParty->uFallStartY = 8160; |
3265 pParty->vPosition.z = 8160; | 3251 pParty->vPosition.z = 8160; |
3266 } | 3252 } |
3273 v82 = pParty->vPosition.z; | 3259 v82 = pParty->vPosition.z; |
3274 if ( pParty->vPosition.z <= v83 ) | 3260 if ( pParty->vPosition.z <= v83 ) |
3275 pParty->uFlags |= 4u; | 3261 pParty->uFlags |= 4u; |
3276 } | 3262 } |
3277 if ( !v103 | 3263 if ( !v103 |
3278 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == v116) | 3264 || (EventProcessor(v103, 0, 1), pParty->vPosition.x == pX) |
3279 && pParty->vPosition.y == v117 | 3265 && pParty->vPosition.y == pY |
3280 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) | 3266 && (v82 = pParty->vPosition.z, pParty->vPosition.z == v81) ) |
3281 { | 3267 { |
3282 if ( v82 < v111 ) | 3268 if ( v82 < v111 ) |
3283 { | 3269 { |
3284 v82 = v105; | 3270 v82 = v105; |