From 771113de21b631a98c255f1a27561c8f6f997d2c Mon Sep 17 00:00:00 2001 From: Unnunu Date: Sun, 16 Apr 2023 04:21:08 +0300 Subject: [PATCH] npc_do_player_collision (#1017) --- include/common_structs.h | 2 +- src/23680.c | 10 +- src/25AF0.c | 8 +- src/common/SetNpcCollision32.inc.c | 2 +- src/encounter.c | 10 +- src/evt/npc_api.c | 4 +- src/evt/player_api.c | 4 +- src/npc.c | 166 ++++++------ src/world/area_kkj/common/Searchlights.inc.c | 4 +- src/world/area_mac/mac_05/mac_05_4_npc.c | 2 +- src/world/area_omo/omo_14/omo_14_3_npc.c | 4 +- src/world/area_pra/pra_09/pra_09_3_npc.c | 2 +- src/world/area_pra/pra_19/pra_19_3_npc.c | 2 +- src/world/area_sam/sam_11/sam_11_6_pond.c | 2 +- src/world/area_tik/common/DripVolumes.inc.c | 4 +- src/world/common/enemy/StoneChomp.inc.c | 14 +- src/world/common/enemy/ai/AvoidPlayerAI.inc.c | 6 +- src/world/common/enemy/ai/CleftAI.inc.c | 6 +- src/world/common/enemy/ai/FireBarAI.inc.c | 6 +- .../common/enemy/ai/FlyingMagikoopaAI.inc.c | 2 +- src/world/common/enemy/ai/HoppingAI.inc.c | 6 +- .../common/enemy/ai/MagikoopaSpellAI.inc.c | 6 +- src/world/common/enemy/ai/MontyMoleAI.inc.c | 26 +- .../common/enemy/ai/PiranhaPlantAI.inc.c | 20 +- .../common/enemy/ai/ProjectileHitbox.inc.c | 4 +- src/world/common/enemy/ai/SpinyAI.inc.c | 2 +- .../common/enemy/ai/States_TackleAI.inc.c | 2 +- src/world/common/enemy/ai/SwooperAI.inc.c | 4 +- .../todo/CheckDripCollisionWithNPC.inc.c | 4 +- src/world/partner/bombette.c | 14 +- src/world/partner/bow.c | 2 +- src/world/partner/goombaria.c | 2 +- src/world/partner/goombario.c | 2 +- src/world/partner/goompa.c | 2 +- src/world/partner/kooper.c | 20 +- src/world/partner/lakilester.c | 22 +- src/world/partner/parakarry.c | 24 +- src/world/partner/sushie.c | 28 +- src/world/partner/twink.c | 2 +- src/world/partner/watt.c | 4 +- src/world/partners.c | 22 +- .../npc/npc_do_player_collision.s | 255 ------------------ .../npc/npc_do_player_collision.s | 253 ----------------- .../npc/npc_do_player_collision.s | 253 ----------------- 44 files changed, 236 insertions(+), 1003 deletions(-) delete mode 100644 ver/ique/asm/nonmatchings/npc/npc_do_player_collision.s delete mode 100644 ver/jp/asm/nonmatchings/npc/npc_do_player_collision.s delete mode 100644 ver/us/asm/nonmatchings/npc/npc_do_player_collision.s diff --git a/include/common_structs.h b/include/common_structs.h index 0a0776737e..672b105b9a 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -259,7 +259,7 @@ typedef struct Npc { /* 0x0A2 */ u16 foldFlags; /* 0x0A4 */ s8 npcID; /* 0x0A5 */ char unk_A5; - /* 0x0A6 */ s16 collisionRadius; + /* 0x0A6 */ s16 collisionDiameter; /* 0x0A8 */ s16 collisionHeight; /* 0x0AA */ s8 renderMode; /* 0x0AB */ s8 verticalRenderOffset; diff --git a/src/23680.c b/src/23680.c index e8f73140a3..9b85b7e661 100644 --- a/src/23680.c +++ b/src/23680.c @@ -589,7 +589,7 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum y = npc->pos.y; z = npc->pos.z; yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionRadius)) { + if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->yaw = yaw; ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp34); @@ -629,7 +629,7 @@ void basic_ai_wander(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 2.0 * npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { + if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 2.0 * npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { yaw = clamp_angle(atan2(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z)); enemy->aiFlags &= ~ENEMY_AI_FLAG_40; ai_check_fwd_collisions(npc, 5.0f, &yaw, NULL, NULL, NULL); @@ -686,7 +686,7 @@ void basic_ai_loiter(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolum y = npc->pos.y; z = npc->pos.z; yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionRadius)) { + if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, aiSettings->chaseSpeed, yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->yaw = yaw; ai_enemy_play_sound(npc, SOUND_2F4, SOUND_PARAM_MORE_QUIET); fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); @@ -758,7 +758,7 @@ void basic_ai_chase_init(Evt* script, MobileAISettings* npcAISettings, EnemyDete if ((gPlayerStatusPtr->actionState == ACTION_STATE_JUMP || gPlayerStatusPtr->actionState == ACTION_STATE_BOUNCE || gPlayerStatusPtr->actionState == ACTION_STATE_HOP || gPlayerStatusPtr->actionState == ACTION_STATE_FALLING) && - (f64)dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) < npc->collisionRadius) + (f64)dist2D(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) < npc->collisionDiameter) { skipTurnAround = TRUE; } @@ -805,7 +805,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { + if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &sp28); npc->currentAnim = enemy->animList[ENEMY_ANIM_INDEX_IDLE]; npc->duration = 15; diff --git a/src/25AF0.c b/src/25AF0.c index 153eb7ed6a..d057e9d8ed 100644 --- a/src/25AF0.c +++ b/src/25AF0.c @@ -39,8 +39,8 @@ s32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f3 npc->moveSpeed * time, yaw, npc->collisionHeight, - npc->collisionRadius); - + npc->collisionDiameter); + if (fwdHit != 0) { fwdHitDist = dist2D(npc->pos.x, npc->pos.z, x1, z1); @@ -51,7 +51,7 @@ s32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f3 &x2, &y2, &z2, npc->moveSpeed * time, clamp_angle(yaw + 35.0f), npc->collisionHeight, - npc->collisionRadius) != 0) { + npc->collisionDiameter) != 0) { cwHitDist = dist2D(npc->pos.x, npc->pos.z, x2, z2); } @@ -63,7 +63,7 @@ s32 ai_check_fwd_collisions(Npc* npc, f32 time, f32* outYaw, f32* outDistFwd, f3 npc->moveSpeed * time, clamp_angle(yaw - 35.0f), npc->collisionHeight, - npc->collisionRadius) != 0) { + npc->collisionDiameter) != 0) { ccwHitDist = dist2D(npc->pos.x, npc->pos.z, x3, z3); } diff --git a/src/common/SetNpcCollision32.inc.c b/src/common/SetNpcCollision32.inc.c index 1f42a84348..0fb9a9c7db 100644 --- a/src/common/SetNpcCollision32.inc.c +++ b/src/common/SetNpcCollision32.inc.c @@ -4,6 +4,6 @@ API_CALLABLE(N(SetNpcCollision32)) { Npc* npc = get_npc_unsafe(100); npc->collisionHeight = 32; - npc->collisionRadius = 32; + npc->collisionDiameter = 32; return ApiStatus_DONE2; } diff --git a/src/encounter.c b/src/encounter.c index e66008a3ca..9b86a7ad05 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -683,7 +683,7 @@ void update_encounters_neutral(void) { npcZ = npc->pos.z; npcYaw = npc->yaw; colHeight = npc->collisionHeight; - colRadius = npc->collisionRadius / 2; + colRadius = npc->collisionDiameter / 2; if (enemy->unk_DC != 0) { npcYaw = npc->yawCamOffset; @@ -2324,7 +2324,7 @@ s32 check_conversation_trigger(void) { deltaX = npcX - playerX; deltaZ = npcZ - playerZ; npcCollisionHeight = encounterNpc->collisionHeight; - npcCollisionRadius = encounterNpc->collisionRadius; + npcCollisionRadius = encounterNpc->collisionDiameter; length = sqrtf(SQ(deltaX) + SQ(deltaZ)); if ((playerColliderRadius + npcCollisionRadius <= length) || @@ -2543,7 +2543,7 @@ void create_encounters(void) { newNpc = get_npc_by_index(newNpcIndex); newNpc->npcID = npcData->id; - newNpc->collisionRadius = npcSettings->radius; + newNpc->collisionDiameter = npcSettings->radius; newNpc->collisionHeight = npcSettings->height; enemy->spawnPos[0] = newNpc->pos.x = npcData->pos.x; enemy->spawnPos[1] = newNpc->pos.y = npcData->pos.y; @@ -2555,8 +2555,8 @@ void create_encounters(void) { newNpc->homePos.z = newNpc->pos.z; set_npc_yaw(newNpc, npcData->yaw); enemy->savedNpcYaw = 12345; - if (newNpc->collisionRadius >= 24.0) { - newNpc->shadowScale = newNpc->collisionRadius / 24.0; + if (newNpc->collisionDiameter >= 24.0) { + newNpc->shadowScale = newNpc->collisionDiameter / 24.0; } else { newNpc->shadowScale = 1.0f; } diff --git a/src/evt/npc_api.c b/src/evt/npc_api.c index f612f8fcb9..ffc8af7cad 100644 --- a/src/evt/npc_api.c +++ b/src/evt/npc_api.c @@ -152,7 +152,7 @@ ApiStatus SetNpcCollisionSize(Evt* script, s32 isInitialCall) { } npc->collisionHeight = height; - npc->collisionRadius = radius; + npc->collisionDiameter = radius; return ApiStatus_DONE2; } @@ -813,7 +813,7 @@ s32 BringPartnerOut(Evt* script, s32 isInitialCall) { wExtraPartnerNpcID = create_basic_npc(bpPointer); npc = get_npc_by_index(wExtraPartnerNpcID); - npc->collisionRadius = 10; + npc->collisionDiameter = 10; npc->collisionHeight = 10; npc->npcID = NPC_PARTNER; npc->scale.x = 0.0f; diff --git a/src/evt/player_api.c b/src/evt/player_api.c index e947d28c2d..18066778b0 100644 --- a/src/evt/player_api.c +++ b/src/evt/player_api.c @@ -82,10 +82,10 @@ ApiStatus SetPlayerCollisionSize(Evt* script, s32 isInitialCall) { s32 radius = evt_get_variable(script, *args++); playerNpc->collisionHeight = height; - playerNpc->collisionRadius = radius; + playerNpc->collisionDiameter = radius; playerStatus->colliderHeight = playerNpc->collisionHeight; - playerStatus->colliderDiameter = playerNpc->collisionRadius; + playerStatus->colliderDiameter = playerNpc->collisionDiameter; return ApiStatus_DONE2; } diff --git a/src/npc.c b/src/npc.c index 023fe810a6..a93d11512e 100644 --- a/src/npc.c +++ b/src/npc.c @@ -109,7 +109,7 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->flags |= NPC_FLAG_NO_ANIMS_LOADED; } - npc->collisionRadius = 32; + npc->collisionDiameter = 32; npc->collisionHeight = 64; npc->renderMode = 13; npc->blur.any = NULL; @@ -300,9 +300,9 @@ void npc_do_world_collision(Npc* npc) { testZ = npc->pos.z; if (!(npc->flags & NPC_FLAG_PARTNER)) { - hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } else { - hit = npc_test_move_complex_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_complex_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } if (hit) { @@ -320,9 +320,9 @@ void npc_do_world_collision(Npc* npc) { testZ = npc->pos.z; if (!(npc->flags & NPC_FLAG_PARTNER)) { - hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } else { - hit = npc_test_move_taller_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_taller_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } if (hit) { @@ -338,9 +338,9 @@ void npc_do_world_collision(Npc* npc) { testY = npc->pos.y; testZ = npc->pos.z; if (!(npc->flags & NPC_FLAG_PARTNER)) { - hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } else { - hit = npc_test_move_taller_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionRadius); + hit = npc_test_move_taller_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, npc->collisionDiameter); } if (hit != 0) { @@ -357,7 +357,7 @@ void npc_do_world_collision(Npc* npc) { testY = npc->pos.y; testZ = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, - npc->collisionRadius) != 0) { + npc->collisionDiameter) != 0) { npc->flags |= NPC_FLAG_COLLDING_WITH_WORLD; npc->pos.x = testX; npc->pos.z = testZ; @@ -370,7 +370,7 @@ void npc_do_world_collision(Npc* npc) { testY = npc->pos.y; testZ = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &testX, &testY, &testZ, 0, testAngle, npc->collisionHeight, - npc->collisionRadius) != 0) { + npc->collisionDiameter) != 0) { npc->flags |= NPC_FLAG_COLLDING_WITH_WORLD; npc->pos.x = testX; npc->pos.z = testZ; @@ -395,7 +395,7 @@ void npc_do_other_npc_collision(Npc* npc) { if (!(npc->flags & NPC_FLAG_IGNORE_PLAYER_COLLISION)) { npc->flags &= ~NPC_FLAG_COLLIDING_WITH_NPC; - thisBuf = npc->collisionRadius * 0.5f; + thisBuf = npc->collisionDiameter * 0.5f; thisX = npc->pos.x; thisY = npc->pos.y; thisZ = npc->pos.z; @@ -411,7 +411,7 @@ void npc_do_other_npc_collision(Npc* npc) { xDiff = otherX - thisX; otherZ = otherNpc->pos.z; zDiff = otherZ - thisZ; - otherBuf = otherNpc->collisionRadius * 0.5f; + otherBuf = otherNpc->collisionDiameter * 0.5f; dist = sqrtf(SQ(xDiff) + SQ(zDiff)); if (!(thisBuf + otherBuf <= dist)) { @@ -443,31 +443,20 @@ void npc_do_other_npc_collision(Npc* npc) { } } -// float regalloc -#ifdef NON_MATCHING s32 npc_do_player_collision(Npc* npc) { - f32 sp10; PlayerStatus* playerStatus = &gPlayerStatus; - f32 xDiff, zDiff; - f32 xDiff2, zDiff2; - f32 npcColliderX, npcColliderZ; f32 playerX, playerZ; - - f32 theta; - f32 dist; - f32 temp_f24_2; - f32 targetYaw; - f32 new_var; - f32 xSub; - f32 zSub; - f32 collRad, collDiam; - int new_var2; + f32 playerYaw, yaw; + f32 npcX, npcZ; + f32 dist, colDist, distToNpc; + f32 npcColRadius, playerColRadius; + f32 deltaX, deltaZ; if (npc->flags & NPC_FLAG_IGNORE_PLAYER_COLLISION) { return FALSE; } - if (npc->flags & PS_FLAG_CAMERA_DOESNT_FOLLOW) { + if (npc->flags & NPC_FLAG_PARTNER) { return FALSE; } @@ -485,55 +474,63 @@ s32 npc_do_player_collision(Npc* npc) { playerX = playerStatus->position.x; playerZ = playerStatus->position.z; - xDiff = playerX - npc->pos.x; - zDiff = playerZ - npc->pos.z; - sp10 = (npc->collisionRadius / 2) + (f32)(playerStatus->colliderDiameter / 2); - npcColliderZ = zDiff; - temp_f24_2 = xDiff; - dist = sqrtf(SQ(temp_f24_2) + SQ(npcColliderZ)); - if (sp10 < dist) { + npcColRadius = npc->collisionDiameter / 2; + playerColRadius = playerStatus->colliderDiameter / 2; + + npcX = npc->pos.x; + npcZ = npc->pos.z; + + deltaX = playerX - npcX; + deltaZ = playerZ - npcZ; + + distToNpc = sqrtf(SQ(deltaX) + SQ(deltaZ)); + colDist = npcColRadius + playerColRadius; + if (colDist < distToNpc) { return FALSE; } - playerStatus->animFlags |= 0x8000; - npcColliderX = npc->colliderPos.x; - npcColliderZ = npc->colliderPos.z; - zSub = sp10; - xDiff = playerX - npcColliderX; - zDiff = playerZ - npcColliderZ; + playerStatus->animFlags |= PA_FLAG_NPC_COLLIDED; - dist = xSub = sqrtf(SQ(xDiff) + SQ(zDiff)); + npcX = npc->colliderPos.x; + npcZ = npc->colliderPos.z; - theta = atan2(playerX, playerZ, npcColliderX, npcColliderZ); - targetYaw = playerStatus->targetYaw; + deltaX = playerX - npcX; + deltaZ = playerZ - npcZ; - temp_f24_2 = zSub - dist; + dist = sqrtf(SQ(deltaX) + SQ(deltaZ)); + yaw = atan2(playerX, playerZ, npcX, npcZ); + + playerYaw = playerStatus->targetYaw; + dist = colDist - dist; + deltaX = dist * sin_rad(DEG_TO_RAD(yaw)); + deltaZ = -dist * cos_rad(DEG_TO_RAD(yaw)); - xSub = temp_f24_2 * sin_rad(DEG_TO_RAD(theta)); - zSub = -temp_f24_2 * cos_rad(DEG_TO_RAD(theta)); if (playerStatus->animFlags & PA_FLAG_RIDING_PARTNER) { - if (fabsf(get_clamped_angle_diff(theta, targetYaw)) < 45.0f) { - playerStatus->position.x -= xSub; - playerStatus->position.z -= zSub; - wPartnerNpc->pos.x -= xSub; - wPartnerNpc->pos.z -= zSub; + if (fabsf(get_clamped_angle_diff(yaw, playerYaw)) < 45.0f) { + playerStatus->position.x -= deltaX; + playerStatus->position.z -= deltaZ; + wPartnerNpc->pos.x -= deltaX; + wPartnerNpc->pos.z -= deltaZ; } else { - playerStatus->position.x -= xSub * 0.5f; - playerStatus->position.z -= zSub * 0.5f; - wPartnerNpc->pos.x -= xSub * 0.5f; - wPartnerNpc->pos.z -= zSub * 0.5f; + playerStatus->position.x -= deltaX * 0.5f; + playerStatus->position.z -= deltaZ * 0.5f; + wPartnerNpc->pos.x -= deltaX * 0.5f; + wPartnerNpc->pos.z -= deltaZ * 0.5f; } } else { if (playerStatus->flags & (PS_FLAG_JUMPING | PS_FLAG_FALLING)) { - playerStatus->position.x -= xSub * 0.4f; - playerStatus->position.z -= zSub * 0.4f; - } else if (fabsf(get_clamped_angle_diff(theta, targetYaw)) < 45.0f) { - playerStatus->position.x -= xSub; - playerStatus->position.z -= zSub; + playerStatus->position.x -= deltaX * 0.4f; + playerStatus->position.z -= deltaZ * 0.4f; } else { - playerStatus->position.x -= xSub * 0.5f; - playerStatus->position.z -= zSub * 0.5f; + dist = get_clamped_angle_diff(yaw, playerYaw); // required to match + if (fabsf(dist) < 45.0f) { + playerStatus->position.x -= deltaX; + playerStatus->position.z -= deltaZ; + } else { + playerStatus->position.x -= deltaX * 0.5f; + playerStatus->position.z -= deltaZ * 0.5f; + } } } npc->pos.x = npc->colliderPos.x; @@ -541,9 +538,6 @@ s32 npc_do_player_collision(Npc* npc) { npc->pos.z = npc->colliderPos.z; return TRUE; } -#else -INCLUDE_ASM(s32, "npc", npc_do_player_collision, Npc* npc); -#endif // update NPC position using gravitational acceleration = 1.0 // if the NPC is within 16 units of the floor, they are snapped to it @@ -573,7 +567,7 @@ void npc_try_apply_gravity(Npc* npc) { if (!(npc->flags & NPC_FLAG_PARTNER)) { hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length); } else { - hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius); + hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionDiameter); } if (hitID && length <= testLength) { @@ -609,7 +603,7 @@ s32 npc_try_snap_to_ground(Npc* npc, f32 velocity) { if (!(npc->flags & NPC_FLAG_PARTNER)) { hitID = npc_raycast_down_sides(npc->collisionChannel, &x, &y, &z, &length); } else { - hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionRadius); + hitID = npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &length, npc->yaw, npc->collisionDiameter); } if (hitID != 0 && length <= testLength) { @@ -706,7 +700,7 @@ void update_npcs(void) { z = npc->pos.z; hitLength = 1000.0f; entity_raycast_down(&x, &y, &z, &hitYaw, &hitPitch, &hitLength); - set_npc_shadow_scale(shadow, hitLength, npc->collisionRadius); + set_npc_shadow_scale(shadow, hitLength, npc->collisionDiameter); shadow->position.x = x; shadow->position.y = y; shadow->position.z = z; @@ -1823,7 +1817,7 @@ void npc_update_decoration_bowser_aura(Npc* npc, s32 idx) { data->posA.x = npc->pos.x; data->posA.y = npc->pos.y; data->posA.z = npc->pos.z; - data->scale.x = (npc->scale.x * npc->collisionRadius) * 0.01; + data->scale.x = (npc->scale.x * npc->collisionDiameter) * 0.01; data->scale.y = (npc->scale.y * npc->collisionHeight) * 0.01; data->renderYaw = npc->renderYaw; } @@ -2227,12 +2221,12 @@ void spawn_default_surface_effects(Npc* npc, SurfaceInteractMode mode) { D_80077C14 = 0; if (!mapIsStarWay) { sin_cos_rad(DEG_TO_RAD(clamp_angle(-npc->yaw)), &sinTheta, &cosTheta); - fx_walking_dust(0, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), npc->pos.y + 1.5f, - npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f), sinTheta, cosTheta); + fx_walking_dust(0, npc->pos.x + (npc->collisionDiameter * sinTheta * 0.2f), npc->pos.y + 1.5f, + npc->pos.z + (npc->collisionDiameter * cosTheta * 0.2f), sinTheta, cosTheta); } else { sin_cos_rad(DEG_TO_RAD(clamp_angle(npc->yaw)), &sinTheta, &cosTheta); - fx_misc_particles(3, npc->pos.x + (npc->collisionRadius * sinTheta), npc->pos.y + 1.5f, - npc->pos.z + (npc->collisionRadius * cosTheta), 5.0f, 10.0f, 1.0f, 5, 30); + fx_misc_particles(3, npc->pos.x + (npc->collisionDiameter * sinTheta), npc->pos.y + 1.5f, + npc->pos.z + (npc->collisionDiameter * cosTheta), 5.0f, 10.0f, 1.0f, 5, 30); } } } @@ -2266,8 +2260,8 @@ void spawn_flower_surface_effects(Npc* npc, SurfaceInteractMode mode) { sinTheta = sin_rad(theta); cosTheta = cos_rad(theta); - x = npc->pos.x + (npc->collisionRadius * sinTheta * -0.4f); - z = npc->pos.z + (npc->collisionRadius * cosTheta * -0.4f); + x = npc->pos.x + (npc->collisionDiameter * sinTheta * -0.4f); + z = npc->pos.z + (npc->collisionDiameter * cosTheta * -0.4f); y = npc->pos.y + 15.5f; fx_flower_trail(1, x, y, z, -npc->yaw + rand_int(10) - 5.0f, D_80077C20); @@ -2303,9 +2297,9 @@ void spawn_cloud_surface_effects(Npc* npc, SurfaceInteractMode mode) { fx_cloud_trail( 1, - npc->pos.x + (npc->collisionRadius * sinTheta * -0.3f) + xTemp, + npc->pos.x + (npc->collisionDiameter * sinTheta * -0.3f) + xTemp, npc->pos.y + 15.5f + yTemp, - npc->pos.z + (npc->collisionRadius * cosTheta * -0.3f) + zTemp + npc->pos.z + (npc->collisionDiameter * cosTheta * -0.3f) + zTemp ); } } else { @@ -2320,9 +2314,9 @@ void spawn_cloud_surface_effects(Npc* npc, SurfaceInteractMode mode) { cosTheta = cos_rad(theta); fx_cloud_trail( 1, - npc->pos.x + (npc->collisionRadius * sinTheta * -0.3f) + xTemp2, + npc->pos.x + (npc->collisionDiameter * sinTheta * -0.3f) + xTemp2, npc->pos.y + 15.5f + yTemp2, - npc->pos.z + (npc->collisionRadius * cosTheta * -0.3f) + zTemp2 + npc->pos.z + (npc->collisionDiameter * cosTheta * -0.3f) + zTemp2 ); } } @@ -2337,8 +2331,8 @@ void spawn_snow_surface_effects(Npc* npc, SurfaceInteractMode mode) { temp_f20 = DEG_TO_RAD(clamp_angle(-npc->yaw)); x = sin_rad(temp_f20); z = cos_rad(temp_f20); - fx_footprint(npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 1.5f, - npc->pos.z + (npc->collisionRadius * z * 0.2f), -npc->yaw, D_80077C34); + fx_footprint(npc->pos.x + (npc->collisionDiameter * x * 0.2f), npc->pos.y + 1.5f, + npc->pos.z + (npc->collisionDiameter * z * 0.2f), -npc->yaw, D_80077C34); D_80077C34 = !D_80077C34; } } @@ -2353,8 +2347,8 @@ void spawn_hedge_surface_effects(Npc* npc, SurfaceInteractMode mode) { theta = DEG_TO_RAD(clamp_angle(-npc->yaw)); sinTheta = sin_rad(theta); cosTheta = cos_rad(theta); - fx_falling_leaves(1, npc->pos.x + (npc->collisionRadius * sinTheta * 0.2f), - 40.0f, npc->pos.z + (npc->collisionRadius * cosTheta * 0.2f)); + fx_falling_leaves(1, npc->pos.x + (npc->collisionDiameter * sinTheta * 0.2f), + 40.0f, npc->pos.z + (npc->collisionDiameter * cosTheta * 0.2f)); } } @@ -2368,8 +2362,8 @@ void spawn_water_surface_effects(Npc* npc, SurfaceInteractMode mode) { temp_f20 = DEG_TO_RAD(clamp_angle(-npc->yaw)); x = sin_rad(temp_f20); z = cos_rad(temp_f20); - fx_rising_bubble(0, npc->pos.x + (npc->collisionRadius * x * 0.2f), npc->pos.y + 0.0f, - npc->pos.z + (npc->collisionRadius * z * 0.2f), 0.0f); + fx_rising_bubble(0, npc->pos.x + (npc->collisionDiameter * x * 0.2f), npc->pos.y + 0.0f, + npc->pos.z + (npc->collisionDiameter * z * 0.2f), 0.0f); } } diff --git a/src/world/area_kkj/common/Searchlights.inc.c b/src/world/area_kkj/common/Searchlights.inc.c index 996b4449e1..ade865e072 100644 --- a/src/world/area_kkj/common/Searchlights.inc.c +++ b/src/world/area_kkj/common/Searchlights.inc.c @@ -46,7 +46,7 @@ API_CALLABLE(N(UnkPhysicsFunc)) { channel = COLLISION_IGNORE_ENTITIES | COLLISION_CHANNEL_20000 | COLLISION_CHANNEL_10000 | COLLISION_CHANNEL_8000; if (npc_test_move_taller_with_slipping(channel, &x, &y, &z, r, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), - npc->collisionRadius, npc->collisionHeight)) + npc->collisionDiameter, npc->collisionHeight)) { outVal = FALSE; } @@ -125,7 +125,7 @@ API_CALLABLE(N(UpdateSearchlight)) { dist = dist2D(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); if (npc_test_move_taller_with_slipping(0, &x, &y, &z, dist, atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z), - npc->collisionRadius, npc->collisionHeight)) { + npc->collisionDiameter, npc->collisionHeight)) { outVal = 0; } } diff --git a/src/world/area_mac/mac_05/mac_05_4_npc.c b/src/world/area_mac/mac_05/mac_05_4_npc.c index 2e91035956..58932770bc 100644 --- a/src/world/area_mac/mac_05/mac_05_4_npc.c +++ b/src/world/area_mac/mac_05/mac_05_4_npc.c @@ -698,7 +698,7 @@ API_CALLABLE(N(func_802430B4_855224)) { f32 z = npc->pos.z; temp = 12.0f; - if (npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &temp, npc->yaw, npc->collisionRadius) && + if (npc_raycast_down_around(npc->collisionChannel, &x, &y, &z, &temp, npc->yaw, npc->collisionDiameter) && temp <= 12.0f) { outVal = NpcHitQueryColliderID; diff --git a/src/world/area_omo/omo_14/omo_14_3_npc.c b/src/world/area_omo/omo_14/omo_14_3_npc.c index 723e5fd2b1..00a11b90a2 100644 --- a/src/world/area_omo/omo_14/omo_14_3_npc.c +++ b/src/world/area_omo/omo_14/omo_14_3_npc.c @@ -5,9 +5,9 @@ API_CALLABLE(N(SurroundPlayer)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc* npc = get_npc_unsafe(script->owner1.enemy->npcID); f32 goalPosX = playerStatus->position.x + - ((playerStatus->colliderDiameter + npc->collisionRadius) * 0.5f * sin_deg((npc->npcID * 360.0f) / 10.0f)); + ((playerStatus->colliderDiameter + npc->collisionDiameter) * 0.5f * sin_deg((npc->npcID * 360.0f) / 10.0f)); f32 goalPosZ = playerStatus->position.z - - ((playerStatus->colliderDiameter + npc->collisionRadius) * 0.5f * cos_deg((npc->npcID * 360.0f) / 10.0f)); + ((playerStatus->colliderDiameter + npc->collisionDiameter) * 0.5f * cos_deg((npc->npcID * 360.0f) / 10.0f)); f32 dist = dist2D(npc->pos.x, npc->pos.z, goalPosX, goalPosZ); if (npc->moveSpeed < dist) { diff --git a/src/world/area_pra/pra_09/pra_09_3_npc.c b/src/world/area_pra/pra_09/pra_09_3_npc.c index 358a3a1fd6..c03ea1f29a 100644 --- a/src/world/area_pra/pra_09/pra_09_3_npc.c +++ b/src/world/area_pra/pra_09/pra_09_3_npc.c @@ -89,7 +89,7 @@ API_CALLABLE(N(ChangeNpcCollisionRadius)) { Npc* npc1 = resolve_npc(script, script->varTable[3]); Npc* npc2 = resolve_npc(script, script->varTable[4]); - npc1->collisionRadius = npc2->collisionRadius; + npc1->collisionDiameter = npc2->collisionDiameter; npc1->collisionHeight = npc2->collisionHeight; return ApiStatus_DONE2; } diff --git a/src/world/area_pra/pra_19/pra_19_3_npc.c b/src/world/area_pra/pra_19/pra_19_3_npc.c index 49617a592f..03471e19df 100644 --- a/src/world/area_pra/pra_19/pra_19_3_npc.c +++ b/src/world/area_pra/pra_19/pra_19_3_npc.c @@ -128,7 +128,7 @@ API_CALLABLE(N(ChangeNpcCollisionRadius)) { Npc* npc1 = resolve_npc(script, script->varTable[3]); Npc* npc2 = resolve_npc(script, script->varTable[4]); - npc1->collisionRadius = npc2->collisionRadius; + npc1->collisionDiameter = npc2->collisionDiameter; npc1->collisionHeight = npc2->collisionHeight; return ApiStatus_DONE2; } diff --git a/src/world/area_sam/sam_11/sam_11_6_pond.c b/src/world/area_sam/sam_11/sam_11_6_pond.c index 5a684c0840..0751099b3b 100644 --- a/src/world/area_sam/sam_11/sam_11_6_pond.c +++ b/src/world/area_sam/sam_11/sam_11_6_pond.c @@ -76,7 +76,7 @@ API_CALLABLE(N(GetBombetteExplodeGround)) { depth = 12.0f; if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &depth, - partner->yaw, partner->collisionRadius) && depth <= 12.0f) + partner->yaw, partner->collisionDiameter) && depth <= 12.0f) { colliderID = NpcHitQueryColliderID; } diff --git a/src/world/area_tik/common/DripVolumes.inc.c b/src/world/area_tik/common/DripVolumes.inc.c index 67f76b490c..eb394efa56 100644 --- a/src/world/area_tik/common/DripVolumes.inc.c +++ b/src/world/area_tik/common/DripVolumes.inc.c @@ -27,7 +27,7 @@ API_CALLABLE(N(CheckDripCollisionWithNPC)) { yVal = partner->pos.y + partner->collisionHeight - 1.5f - model->center.y; sqrtTemp = sqrtf(SQ(xDiff) + SQ(zDiff)); - if (yVal > 0.0f && yVal < partner->collisionHeight && sqrtTemp < partner->collisionRadius * 0.5f) { + if (yVal > 0.0f && yVal < partner->collisionHeight && sqrtTemp < partner->collisionDiameter * 0.5f) { script->varTable[2] = 1; } @@ -40,7 +40,7 @@ API_CALLABLE(N(CheckDripCollisionWithNPC)) { yVal = npc->pos.y + npc->collisionHeight - 1.5f - model->center.y; sqrtTemp = sqrtf(SQ(xDiff) + SQ(zDiff)); - if (yVal > 0.0f && yVal < npc->collisionHeight && sqrtTemp < npc->collisionRadius * 0.5f) { + if (yVal > 0.0f && yVal < npc->collisionHeight && sqrtTemp < npc->collisionDiameter * 0.5f) { script->varTable[2] = 1; break; } diff --git a/src/world/common/enemy/StoneChomp.inc.c b/src/world/common/enemy/StoneChomp.inc.c index f4f39061fb..cc96a2accd 100644 --- a/src/world/common/enemy/StoneChomp.inc.c +++ b/src/world/common/enemy/StoneChomp.inc.c @@ -52,8 +52,8 @@ API_CALLABLE(N(StoneChompFXB)) { posX = ownerNpc->pos.x; posY = ownerNpc->pos.y + (ownerNpc->collisionHeight * 0.2f); posZ = ownerNpc->pos.z; - add_vec2D_polar(&posX, &posZ, ownerNpc->collisionRadius * 0.3f, clamp_angle(ownerNpc->renderYaw + 180.0f)); - + add_vec2D_polar(&posX, &posZ, ownerNpc->collisionDiameter * 0.3f, clamp_angle(ownerNpc->renderYaw + 180.0f)); + if (ownerNpc->flags & NPC_FLAG_INVISIBLE) { for (i = 0; i < 8; i++, blurData++) { childNpc = blurData->npc; @@ -63,7 +63,7 @@ API_CALLABLE(N(StoneChompFXB)) { } return ApiStatus_BLOCK; } - + for (i = 0; i < 8; i++, blurData++) { childNpc = blurData->npc; if (dist3D(childNpc->pos.x, childNpc->pos.y, childNpc->pos.z, posX, posY, posZ) >= 10.0) { @@ -78,11 +78,11 @@ API_CALLABLE(N(StoneChompFXB)) { blurData->offset.x = (nextX - childNpc->pos.x) * 0.7f; blurData->offset.y = (nextY - childNpc->pos.y) * 0.7f; blurData->offset.z = (nextZ - childNpc->pos.z) * 0.7f; - + childNpc->pos.x = nextX; childNpc->pos.y = nextY; childNpc->pos.z = nextZ; - + if (blurData->offset.y > 10.0f) { blurData->offset.y = 10.0f; } @@ -92,7 +92,7 @@ API_CALLABLE(N(StoneChompFXB)) { childNpc->pos.x += blurData->offset.x; childNpc->pos.z += blurData->offset.z; } - + blurData->offset.y -= 1.0f; if (blurData->offset.y < -10.0f) { blurData->offset.y = -10.0f; @@ -115,7 +115,7 @@ API_CALLABLE(N(StoneChompFXB)) { API_CALLABLE(N(StoneChompFXC)) { NpcChompBlur* blurData = get_npc_safe(script->owner2.npcID)->blur.chomp; s32 i; - + for (i = 0; i < 8; i++, blurData++) { free_npc(blurData->npc); } diff --git a/src/world/common/enemy/ai/AvoidPlayerAI.inc.c b/src/world/common/enemy/ai/AvoidPlayerAI.inc.c index 94daed002d..86d97139bd 100644 --- a/src/world/common/enemy/ai/AvoidPlayerAI.inc.c +++ b/src/world/common/enemy/ai/AvoidPlayerAI.inc.c @@ -54,7 +54,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En if (npc_test_move_simple_without_slipping(npc->collisionChannel, &posXFwd, &posYFwd, &posZFwd, npc->moveSpeed * 4.5, - yawFwd, npc->collisionHeight, npc->collisionRadius)) { + yawFwd, npc->collisionHeight, npc->collisionDiameter)) { distFwd = dist2D(npc->pos.x, npc->pos.z, posXFwd, posZFwd); // check 'whisker' 35 degrees CW @@ -63,7 +63,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En posZCW = npc->pos.z; if (npc_test_move_simple_without_slipping(npc->collisionChannel, &posXCW, &posYCW, &posZCW, npc->moveSpeed * 4.5, - clamp_angle(yawFwd + 35.0f), npc->collisionHeight, npc->collisionRadius)) { + clamp_angle(yawFwd + 35.0f), npc->collisionHeight, npc->collisionDiameter)) { distCW = dist2D(npc->pos.x, npc->pos.z, posXCW, posZCW); } @@ -73,7 +73,7 @@ void N(AvoidPlayerAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, En posZCCW = npc->pos.z; if (npc_test_move_simple_without_slipping(npc->collisionChannel, &posXCCW, &posYCCW, &posZCCW, npc->moveSpeed * 4.5, - clamp_angle(yawFwd - 35.0f), npc->collisionHeight, npc->collisionRadius)) { + clamp_angle(yawFwd - 35.0f), npc->collisionHeight, npc->collisionDiameter)) { distCCW = dist2D(npc->pos.x, npc->pos.z, posXCCW, posZCCW); } diff --git a/src/world/common/enemy/ai/CleftAI.inc.c b/src/world/common/enemy/ai/CleftAI.inc.c index 2d795185bc..9e4bc3efc1 100644 --- a/src/world/common/enemy/ai/CleftAI.inc.c +++ b/src/world/common/enemy/ai/CleftAI.inc.c @@ -59,7 +59,7 @@ void N(CleftAI_HidingInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec disable_npc_shadow(npc); npc->collisionHeight = 22; - npc->collisionRadius = 24; + npc->collisionDiameter = 24; script->functionTemp[1] = 0; npc->duration = 0; npc->currentAnim = enemy->animList[8]; @@ -106,7 +106,7 @@ void N(CleftAI_Ambush)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol if (npc->duration <= 0) { npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); npc->collisionHeight = 26; - npc->collisionRadius = 24; + npc->collisionDiameter = 24; script->AI_TEMP_STATE = AI_STATE_CLEFT_FIND_PLAYER_INIT; } } @@ -200,7 +200,7 @@ void N(CleftAI_Tackle)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol posZ = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &posX, &posY, &posZ, - 1.0f, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { + 1.0f, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { phi_s1 = TRUE; } diff --git a/src/world/common/enemy/ai/FireBarAI.inc.c b/src/world/common/enemy/ai/FireBarAI.inc.c index 1c1292d4b8..52914e959e 100644 --- a/src/world/common/enemy/ai/FireBarAI.inc.c +++ b/src/world/common/enemy/ai/FireBarAI.inc.c @@ -59,7 +59,7 @@ API_CALLABLE(N(FireBarAI_Main)) { for (i = 0; i < data->npcCount; i++) { npc = get_npc_unsafe(data->firstNpc + i); if (!(data->flags & 1)) { - f32 radius = (i * npc->collisionRadius) * npc->scale.x; + f32 radius = (i * npc->collisionDiameter) * npc->scale.x; dX = radius * sin_deg(data->yaw); dZ = -radius * cos_deg(data->yaw); npc->pos.x = data->centerPos.x + dX; @@ -79,7 +79,7 @@ API_CALLABLE(N(FireBarAI_Main)) { dX = playerStatus->position.x - npc->pos.x; dZ = playerStatus->position.z - npc->pos.z; if ((fabsf(dY) < (npc->collisionHeight * 0.8f)) - && (sqrtf(SQ(dX) + SQ(dZ)) <= ((npc->collisionRadius * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f)))) { + && (sqrtf(SQ(dX) + SQ(dZ)) <= ((npc->collisionDiameter * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f)))) { hitDetected = 1; } } @@ -95,7 +95,7 @@ API_CALLABLE(N(FireBarAI_Main)) { } distToPlayer = dist2D(data->centerPos.x, data->centerPos.z, playerStatus->position.x, playerStatus->position.z); distToNpc = dist2D(data->centerPos.x, data->centerPos.z, npc->pos.x, npc->pos.z) - + (npc->collisionRadius * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f); + + (npc->collisionDiameter * 0.5f * npc->scale.x * 0.5f) + (playerStatus->colliderDiameter * 0.5f * 0.5f); tempPlayerDist = distToPlayer; // needed to match angleToPlayer = atan2(data->centerPos.x, data->centerPos.z, playerStatus->position.x, playerStatus->position.z); angleToNpc = atan2(data->centerPos.x, data->centerPos.z, npc->pos.x, npc->pos.z); diff --git a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c index 65f2e8d4a2..2ae635282e 100644 --- a/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c +++ b/src/world/common/enemy/ai/FlyingMagikoopaAI.inc.c @@ -84,7 +84,7 @@ void N(FlyingMagikoopaAI_15)(Evt* arg0, MobileAISettings* arg1, EnemyDetectVolum posY = npc->pos.y; posZ = npc->pos.z; if (npc_test_move_taller_with_slipping(0, &posX, &posY, &posZ, - randomDist, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { + randomDist, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { moveDist = dist2D(npc->pos.x, npc->pos.z, posX, posZ); distToHit = moveDist; if (distToHit > 160.0) { diff --git a/src/world/common/enemy/ai/HoppingAI.inc.c b/src/world/common/enemy/ai/HoppingAI.inc.c index ef3b98abd3..46edd44037 100644 --- a/src/world/common/enemy/ai/HoppingAI.inc.c +++ b/src/world/common/enemy/ai/HoppingAI.inc.c @@ -27,7 +27,7 @@ void N(HoppingAI_HopInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect for (i = 0; i < 6; i++) { if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 25.0f, - npc->yaw, npc->collisionHeight, npc->collisionRadius)) + npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->yaw += 30.0; } else { @@ -71,7 +71,7 @@ void N(HoppingAI_Hop)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolu posZ = npc->pos.z; moveSpeed = npc->moveSpeed; collHeight = npc->collisionHeight; - collRadius = npc->collisionRadius; + collRadius = npc->collisionDiameter; if (!npc_test_move_simple_with_slipping(npc->collisionChannel, &posX, &posY, &posZ, @@ -171,7 +171,7 @@ void N(HoppingAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVo posY = npc->pos.y; posZ = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &posX, &posY, &posZ, npc->moveSpeed, npc->yaw, - npc->collisionHeight, npc->collisionRadius)) + npc->collisionHeight, npc->collisionDiameter)) { npc->moveSpeed = 0.0f; } else { diff --git a/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c b/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c index 8aee0d4b5d..9eb3f2bfe4 100644 --- a/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c +++ b/src/world/common/enemy/ai/MagikoopaSpellAI.inc.c @@ -64,7 +64,7 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) { switch (script->functionTemp[0]) { case 0: enemy->varTable[3] = NULL; - npc1->collisionRadius = 20; + npc1->collisionDiameter = 20; npc1->collisionHeight = 20; npc1->pos.x = NPC_DISPOSE_POS_X; npc1->pos.y = NPC_DISPOSE_POS_Y; @@ -131,13 +131,13 @@ API_CALLABLE(N(MagikoopaAI_SpellMain)) { npc1->duration++; if (npc1->duration < 7) { npc1->pos.y -= 3.5; - npc1->collisionRadius = ((f32) npc1->duration * 7.0) + 20.0; + npc1->collisionDiameter = ((f32) npc1->duration * 7.0) + 20.0; npc1->collisionHeight = ((f32) npc1->duration * 7.0) + 20.0; } else if (npc1->duration == 7) { npc1->pos.x = NPC_DISPOSE_POS_X; npc1->pos.y = NPC_DISPOSE_POS_Y; npc1->pos.z = NPC_DISPOSE_POS_Z; - npc1->collisionRadius = 20; + npc1->collisionDiameter = 20; npc1->collisionHeight = 20; } else if (npc1->duration >= 16) { enemy->varTable[0] = 0; diff --git a/src/world/common/enemy/ai/MontyMoleAI.inc.c b/src/world/common/enemy/ai/MontyMoleAI.inc.c index b7e656e887..01edac65d3 100644 --- a/src/world/common/enemy/ai/MontyMoleAI.inc.c +++ b/src/world/common/enemy/ai/MontyMoleAI.inc.c @@ -49,7 +49,7 @@ static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f retVal = FALSE; } // check for overlap with player - if (get_xz_dist_to_player(npc->pos.x, npc->pos.z) < gPlayerStatusPtr->colliderDiameter + npc->collisionRadius) { + if (get_xz_dist_to_player(npc->pos.x, npc->pos.z) < gPlayerStatusPtr->colliderDiameter + npc->collisionDiameter) { retVal = FALSE; } // check player elevation difference @@ -66,7 +66,7 @@ static s32 N(MontyMoleAI_CanAttack)(Evt* script, EnemyDetectVolume* territory, f static void N(MontyMoleAI_Init)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - + npc->duration = (aiSettings->moveTime / 2) + rand_int((aiSettings->moveTime / 2) + 1); npc->yaw = clamp_angle((npc->yaw + rand_int(60)) - 30.0f); if (enemy->territory->wander.moveSpeedOverride < 0) { @@ -85,8 +85,8 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene Npc* npc = get_npc_unsafe(enemy->npcID); Npc dummyNpc; f32 hitDepth; - - if (is_point_within_region(enemy->territory->wander.wanderShape, + + if (is_point_within_region(enemy->territory->wander.wanderShape, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z, npc->pos.x, npc->pos.z, enemy->territory->wander.wanderSize.x, enemy->territory->wander.wanderSize.z)) { @@ -95,7 +95,7 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene dummyNpc.pos.x = npc->pos.x; dummyNpc.pos.y = npc->pos.y + 1.0f; dummyNpc.pos.z = npc->pos.z; - npc_move_heading(&dummyNpc, npc->moveSpeed + npc->collisionRadius, npc->yaw); + npc_move_heading(&dummyNpc, npc->moveSpeed + npc->collisionDiameter, npc->yaw); hitDepth = 1000.0f; if (npc_raycast_down_sides(0, &dummyNpc.pos.x, &dummyNpc.pos.y, &dummyNpc.pos.z, &hitDepth) && (hitDepth < 5.0f)) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); @@ -127,7 +127,7 @@ static void N(MontyMoleAI_Wander)(Evt* script, MobileAISettings* aiSettings, Ene static void N(MontyMoleAI_PreSurface)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - + npc->flags &= ~NPC_FLAG_INVISIBLE; ai_enemy_play_sound(npc, SOUND_BURROW_SURFACE, 0); npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); @@ -139,7 +139,7 @@ static void N(MontyMoleAI_PreSurface)(Evt* script, MobileAISettings* aiSettings, static void N(MontyMoleAI_Surface)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - + npc->duration--; if (npc->duration == 2) { enemy->flags &= ~MONTY_MOLE_UNK_NPC_FLAGS; @@ -155,7 +155,7 @@ static void N(MontyMoleAI_DrawRock)(Evt* script, MobileAISettings* aiSettings, E Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); s32 emoteOut; - + npc->duration--; if ((npc->duration) <= 0) { if (!N(MontyMoleAI_CanAttack)(script, territory, aiSettings->alertRadius * 1.1, aiSettings->alertOffsetDist)) { @@ -201,7 +201,7 @@ static void N(MontyMoleAI_ThrowRock)(Evt* script, MobileAISettings* aiSettings, static void N(MontyMoleAI_PreBurrow)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - + npc->duration--; if (npc->duration <= 0) { ai_enemy_play_sound(npc, SOUND_BURROW_DIG, 0); @@ -214,7 +214,7 @@ static void N(MontyMoleAI_PreBurrow)(Evt* script, MobileAISettings* aiSettings, static void N(MontyMoleAI_Burrow)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - + npc->duration--; if (npc->duration == 3) { enemy->flags |= MONTY_MOLE_UNK_NPC_FLAGS; @@ -232,7 +232,7 @@ API_CALLABLE(N(MontyMoleAI_Main)) { EnemyDetectVolume territory; EnemyDetectVolume* territoryPtr = &territory; MobileAISettings* aiSettings = (MobileAISettings*)evt_get_variable(script, *args++); - + territory.skipPlayerDetectChance = 0; territory.shape = enemy->territory->wander.detectShape; territory.pointX = enemy->territory->wander.detectPos.x; @@ -240,7 +240,7 @@ API_CALLABLE(N(MontyMoleAI_Main)) { territory.sizeX = enemy->territory->wander.detectSize.x; territory.sizeZ = enemy->territory->wander.detectSize.z; territory.halfHeight = 65.0f; - territory.detectFlags = 0; + territory.detectFlags = 0; if (isInitialCall) { script->AI_TEMP_STATE = AI_STATE_MOLE_INIT; @@ -248,7 +248,7 @@ API_CALLABLE(N(MontyMoleAI_Main)) { npc->flags &= ~NPC_FLAG_JUMPING; enemy->aiFlags |= (ENEMY_AI_FLAG_8 | ENEMY_AI_FLAG_10); } - + if (enemy->aiFlags & ENEMY_AI_FLAG_SUSPEND) { if (enemy->aiSuspendTime == 0) { enemy->aiFlags &= ~ENEMY_AI_FLAG_SUSPEND; diff --git a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c index 2bbcf2d24e..47b7da4cb3 100644 --- a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c +++ b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c @@ -91,8 +91,8 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->pos.x = gPlayerStatusPtr->position.x; npc->pos.z = gPlayerStatusPtr->position.z; - add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionRadius, yaw); - npc_move_heading(npc, moveSpeed + npc->collisionRadius, yaw2); + add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); + npc_move_heading(npc, moveSpeed + npc->collisionDiameter, yaw2); if (enemy->varTable[7] == 0) { if (npc->pos.x > 380.0) { @@ -125,11 +125,11 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect sp20 = gPlayerStatusPtr->position.x; sp24 = gPlayerStatusPtr->position.y + 18.0; sp28 = gPlayerStatusPtr->position.z; - if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius)) { + if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter)) { sp20 = gPlayerStatusPtr->position.x; sp24 = gPlayerStatusPtr->position.y + 45.0; sp28 = gPlayerStatusPtr->position.z; - cond1 = npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius); + cond1 = npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter); sp2C = npc->pos.x; sp30 = npc->pos.y + 100.0; sp34 = npc->pos.z; @@ -141,12 +141,12 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect sp20 = gPlayerStatusPtr->position.x; sp24 = gPlayerStatusPtr->position.y + 10.0; sp28 = gPlayerStatusPtr->position.z; - npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius); + npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter); posRadius = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, sp20, sp28); npc->pos.x = gPlayerStatusPtr->position.x; npc->pos.z = gPlayerStatusPtr->position.z; - add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionRadius, yaw); - npc_move_heading(npc, posRadius + npc->collisionRadius, yaw2); + add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); + npc_move_heading(npc, posRadius + npc->collisionDiameter, yaw2); phi_s7 = TRUE; } } @@ -154,12 +154,12 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect sp20 = gPlayerStatusPtr->position.x; sp24 = gPlayerStatusPtr->position.y + 18.0; sp28 = gPlayerStatusPtr->position.z; - if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionRadius)) { + if (npc_test_move_simple_with_slipping(npc->collisionChannel, &sp20, &sp24, &sp28, moveSpeed, yaw2, npc->collisionHeight, npc->collisionDiameter)) { posRadius = dist2D(gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z, sp20, sp28); npc->pos.x = gPlayerStatusPtr->position.x; npc->pos.z = gPlayerStatusPtr->position.z; - add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionRadius, yaw); - npc_move_heading(npc, posRadius + npc->collisionRadius, yaw2); + add_vec2D_polar(&npc->pos.x, &npc->pos.z, npc->collisionDiameter, yaw); + npc_move_heading(npc, posRadius + npc->collisionDiameter, yaw2); } } } diff --git a/src/world/common/enemy/ai/ProjectileHitbox.inc.c b/src/world/common/enemy/ai/ProjectileHitbox.inc.c index b754eb846f..9ef28ebb6b 100644 --- a/src/world/common/enemy/ai/ProjectileHitbox.inc.c +++ b/src/world/common/enemy/ai/ProjectileHitbox.inc.c @@ -213,7 +213,7 @@ API_CALLABLE(N(ProjectileAI_Main)) { y = npc->pos.y + (npc->collisionHeight * 0.5); z = npc->pos.z; if (npc_test_move_taller_with_slipping( - 0, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionRadius, npc->collisionHeight) != 0) + 0, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionDiameter, npc->collisionHeight) != 0) { phi_s6 = 1; } @@ -318,7 +318,7 @@ API_CALLABLE(N(ProjectileAI_Reflect)) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_simple_with_slipping(0, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionRadius, + if (npc_test_move_simple_with_slipping(0, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionDiameter, npc->collisionHeight) == 0) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); diff --git a/src/world/common/enemy/ai/SpinyAI.inc.c b/src/world/common/enemy/ai/SpinyAI.inc.c index ba1e791c52..c14f45d138 100644 --- a/src/world/common/enemy/ai/SpinyAI.inc.c +++ b/src/world/common/enemy/ai/SpinyAI.inc.c @@ -150,7 +150,7 @@ API_CALLABLE(N(SpinyAI_Main)) { y2 = npc->pos.y; z2 = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x2, &y2, &z2, npc->moveSpeed, npc->yaw, npc->collisionHeight, - npc->collisionRadius) == 0) { + npc->collisionDiameter) == 0) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); } else { npc->moveSpeed = 0.0f; diff --git a/src/world/common/enemy/ai/States_TackleAI.inc.c b/src/world/common/enemy/ai/States_TackleAI.inc.c index 89440854b9..9645ee2d13 100644 --- a/src/world/common/enemy/ai/States_TackleAI.inc.c +++ b/src/world/common/enemy/ai/States_TackleAI.inc.c @@ -59,7 +59,7 @@ void N(UnkNpcAIFunc12)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol f2 = npc->pos.y; f3 = npc->pos.z; - temp = npc_test_move_simple_with_slipping(npc->collisionChannel, &f1, &f2, &f3, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius); + temp = npc_test_move_simple_with_slipping(npc->collisionChannel, &f1, &f2, &f3, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionDiameter); if (temp == 0) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); } diff --git a/src/world/common/enemy/ai/SwooperAI.inc.c b/src/world/common/enemy/ai/SwooperAI.inc.c index 68319f5af9..48cb74f305 100644 --- a/src/world/common/enemy/ai/SwooperAI.inc.c +++ b/src/world/common/enemy/ai/SwooperAI.inc.c @@ -85,7 +85,7 @@ API_CALLABLE(N(SwooperAI_Main)) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { + if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, npc->collisionHeight, npc->collisionDiameter)) { npc->moveSpeed = 0.0f; } npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); @@ -138,7 +138,7 @@ API_CALLABLE(N(SwooperAI_Main)) { y = npc->pos.y; z = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, npc->moveSpeed, npc->yaw, - npc->collisionHeight, npc->collisionRadius) != 0) + npc->collisionHeight, npc->collisionDiameter) != 0) { npc->moveSpeed = 0.0f; } else if (npc->jumpVelocity < -2.5) { diff --git a/src/world/common/todo/CheckDripCollisionWithNPC.inc.c b/src/world/common/todo/CheckDripCollisionWithNPC.inc.c index 49b9435a22..4f51bf029e 100644 --- a/src/world/common/todo/CheckDripCollisionWithNPC.inc.c +++ b/src/world/common/todo/CheckDripCollisionWithNPC.inc.c @@ -27,7 +27,7 @@ API_CALLABLE(N(CheckDripCollisionWithNPC)) { yVal = partner->pos.y + partner->collisionHeight - 1.5f - model->center.y; sqrtTemp = sqrtf(SQ(xDiff) + SQ(zDiff)); - if (yVal > 0.0f && yVal < partner->collisionHeight && sqrtTemp < partner->collisionRadius * 0.5f) { + if (yVal > 0.0f && yVal < partner->collisionHeight && sqrtTemp < partner->collisionDiameter * 0.5f) { script->varTable[2] = 1; } @@ -40,7 +40,7 @@ API_CALLABLE(N(CheckDripCollisionWithNPC)) { yVal = npc->pos.y + npc->collisionHeight - 1.5f - model->center.y; sqrtTemp = sqrtf(SQ(xDiff) + SQ(zDiff)); - if (yVal > 0.0f && yVal < npc->collisionHeight && sqrtTemp < npc->collisionRadius * 0.5f) { + if (yVal > 0.0f && yVal < npc->collisionHeight && sqrtTemp < npc->collisionDiameter * 0.5f) { script->varTable[2] = 1; break; } diff --git a/src/world/partner/bombette.c b/src/world/partner/bombette.c index ac40ef7f57..0368c3f96b 100644 --- a/src/world/partner/bombette.c +++ b/src/world/partner/bombette.c @@ -27,7 +27,7 @@ void N(blast_affect_entities)(Npc* npc) { z = npc->pos.z; if (npc_test_move_taller_with_slipping(COLLISION_ONLY_ENTITIES, &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), - npc->collisionHeight, npc->collisionRadius) + npc->collisionHeight, npc->collisionDiameter) ) { break; } @@ -44,7 +44,7 @@ void N(blast_affect_entities)(Npc* npc) { z = npc->pos.z; if (npc_test_move_taller_with_slipping(COLLISION_IGNORE_ENTITIES, &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), - npc->collisionHeight, npc->collisionRadius) + npc->collisionHeight, npc->collisionDiameter) ) { break; } @@ -55,7 +55,7 @@ void N(blast_affect_entities)(Npc* npc) { return; } } - + // handle entity interaction if there was a collision if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT)) { entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); @@ -64,7 +64,7 @@ void N(blast_affect_entities)(Npc* npc) { void N(init)(Npc* bombette) { bombette->collisionHeight = 28; - bombette->collisionRadius = 24; + bombette->collisionDiameter = 24; N(IsBlasting) = FALSE; N(PlayingFuseSound) = FALSE; } @@ -344,8 +344,8 @@ API_CALLABLE(N(UseAbility)) { y = npc->pos.y + 14.0f; z = npc->pos.z; hitDepth = 16.0f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, npc->yaw, npc->collisionRadius)) { - s32 surfaceType = get_collider_flags(NpcHitQueryColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, npc->yaw, npc->collisionDiameter)) { + s32 surfaceType = get_collider_flags(NpcHitQueryColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { if (playerStatus->actionState == ACTION_STATE_IDLE) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); @@ -616,7 +616,7 @@ s32 N(test_first_strike)(Npc* bombette, Npc* enemy) { y = enemy->pos.y + (f32)(enemy->collisionHeight * 0.5) - bombette->pos.y; z = enemyZ - bombetteZ; - enemyRadius = enemy->collisionRadius * 0.55; + enemyRadius = enemy->collisionDiameter * 0.55; blastRadius = 35.0f; dist = sqrtf(SQ(x) + SQ(y) + SQ(z)); enemyHit = FALSE; diff --git a/src/world/partner/bow.c b/src/world/partner/bow.c index 3f7850078d..38739d865a 100644 --- a/src/world/partner/bow.c +++ b/src/world/partner/bow.c @@ -17,7 +17,7 @@ s32 N(check_for_treadmill_overlaps)(void); void N(init)(Npc* bow) { bow->collisionHeight = 26; - bow->collisionRadius = 24; + bow->collisionDiameter = 24; bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; N(LockingPlayerInput) = FALSE; N(IsHiding) = FALSE; diff --git a/src/world/partner/goombaria.c b/src/world/partner/goombaria.c index 986991d2b6..32a3242c74 100644 --- a/src/world/partner/goombaria.c +++ b/src/world/partner/goombaria.c @@ -6,7 +6,7 @@ void N(init)(Npc* goombaria) { goombaria->collisionHeight = 24; - goombaria->collisionRadius = 20; + goombaria->collisionDiameter = 20; } API_CALLABLE(N(TakeOut)) { diff --git a/src/world/partner/goombario.c b/src/world/partner/goombario.c index e7079a3d18..7dc774913d 100644 --- a/src/world/partner/goombario.c +++ b/src/world/partner/goombario.c @@ -77,7 +77,7 @@ s32 N(get_trigger_tattle)(s32 tattleColliderID) { void N(init)(Npc* goombario) { goombario->collisionHeight = 24; - goombario->collisionRadius = 20; + goombario->collisionDiameter = 20; } API_CALLABLE(N(TakeOut)) { diff --git a/src/world/partner/goompa.c b/src/world/partner/goompa.c index c4992643b7..8201882f51 100644 --- a/src/world/partner/goompa.c +++ b/src/world/partner/goompa.c @@ -6,7 +6,7 @@ void N(init)(Npc* partner) { partner->collisionHeight = 24; - partner->collisionRadius = 20; + partner->collisionDiameter = 20; } API_CALLABLE(N(TakeOut)) { diff --git a/src/world/partner/kooper.c b/src/world/partner/kooper.c index 9f6d539edd..7586198a2c 100644 --- a/src/world/partner/kooper.c +++ b/src/world/partner/kooper.c @@ -56,7 +56,7 @@ void N(vertical_hit_interactable_entity)(Npc* kooper) { } s32 N(check_for_item_collision)(Npc* kooper) { - N(HeldItemIdx) = test_item_entity_position(kooper->pos.x, kooper->pos.y, kooper->pos.z, kooper->collisionRadius); + N(HeldItemIdx) = test_item_entity_position(kooper->pos.x, kooper->pos.y, kooper->pos.z, kooper->collisionDiameter); if (N(HeldItemIdx) < 0) { return FALSE; @@ -70,7 +70,7 @@ s32 N(check_for_item_collision)(Npc* kooper) { void N(init)(Npc* kooper) { kooper->collisionHeight = 37; - kooper->collisionRadius = 24; + kooper->collisionDiameter = 24; kooper->collisionChannel = COLLISION_CHANNEL_10000; N(TriggeredBattle) = FALSE; } @@ -415,7 +415,7 @@ API_CALLABLE(N(UseAbility)) { posZ = kooper->pos.z, \ npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000, \ &posX, &posY, &posZ, kooper->moveSpeed, testAngle, \ - kooper->collisionHeight, kooper->collisionRadius / 2) \ + kooper->collisionHeight, kooper->collisionDiameter / 2) \ ) if (TEST_COLLISION_AT_ANGLE(kooper->yaw - 20.0f)) { @@ -453,7 +453,7 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE = SHELL_TOSS_STATE_RETURN; break; } - + kooper->pos.x = posX; kooper->pos.y = posY; kooper->pos.z = posZ; @@ -508,7 +508,7 @@ API_CALLABLE(N(UseAbility)) { kooper->planarFlyDist += 1.0; } } - } + } break; case SHELL_TOSS_STATE_PICKUP: @@ -518,8 +518,8 @@ API_CALLABLE(N(UseAbility)) { npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000, &posX, &posY, &posZ, kooper->moveSpeed, kooper->yaw, - kooper->collisionHeight, ( kooper->collisionRadius / 2)); - + kooper->collisionHeight, ( kooper->collisionDiameter / 2)); + kooper->pos.x = posX; kooper->pos.y = posY; kooper->pos.z = posZ; @@ -576,7 +576,7 @@ API_CALLABLE(N(UseAbility)) { if (npc_test_move_taller_with_slipping(COLLISION_CHANNEL_8000, &posX, &posY, &posZ, kooper->moveSpeed, clamp_angle(kooper->yaw + 180.0f), - kooper->collisionHeight, kooper->collisionRadius) + kooper->collisionHeight, kooper->collisionDiameter) ) { kooper->pos.x = posX; kooper->pos.y = posY; @@ -688,10 +688,10 @@ s32 N(test_first_strike)(Npc* kooper, Npc* enemy) { kooperZ = kooper->pos.z; enemyCollHeight = enemy->collisionHeight; - enemyCollRadius = enemy->collisionRadius * 0.55; + enemyCollRadius = enemy->collisionDiameter * 0.55; kooperCollHeight = kooper->collisionHeight; - kooperCollRadius = kooper->collisionRadius * 0.8; + kooperCollRadius = kooper->collisionDiameter * 0.8; angleToEnemy = atan2(enemyX, enemyZ, kooperX, kooperZ); distToEnemy = dist2D(enemyX, enemyZ, kooperX, kooperZ); diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index 1cc2cfc3ba..c0ef3e801a 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -75,7 +75,7 @@ void N(sync_player_position)(void) { void N(init)(Npc* lakilester) { lakilester->collisionHeight = 38; - lakilester->collisionRadius = 36; + lakilester->collisionDiameter = 36; lakilester->collisionChannel = COLLISION_CHANNEL_10000; N(PlayerBounceOffset) = 0; N(LockingPlayerInput) = FALSE; @@ -307,7 +307,7 @@ s32 N(test_mounting_height_adjustment)(Npc* lakilester, f32 height, f32 dist) { } void N(apply_riding_static_collisions)(Npc* lakilester) { - f32 radius = lakilester->collisionRadius * 0.8f; + f32 radius = lakilester->collisionDiameter * 0.8f; f32 x, y, z, yaw; // combine testing boilerplate @@ -414,7 +414,7 @@ void N(update_riding_physics)(Npc* lakilester) { z = lakilester->pos.z; if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, - lakilester->collisionRadius, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionRadius)) + lakilester->collisionDiameter, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionDiameter)) { collisionStatus->currentInspect = (partnerStatus->pressedButtons & BUTTON_A) ? NpcHitQueryColliderID : NO_COLLIDER; } @@ -425,7 +425,7 @@ void N(update_riding_physics)(Npc* lakilester) { y = lakilester->moveToPos.y; z = lakilester->pos.z; if (npc_test_move_complex_with_slipping(lakilester->collisionChannel, &x, &y, &z, - lakilester->moveSpeed, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionRadius)) + lakilester->moveSpeed, lakilester->yaw, lakilester->collisionHeight, lakilester->collisionDiameter)) { if (N(UpdatePushingWall)) { collisionStatus->pushingAgainstWall = NpcHitQueryColliderID; @@ -444,7 +444,7 @@ void N(update_riding_physics)(Npc* lakilester) { y = lakilester->moveToPos.y; z = lakilester->pos.z; if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, - lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionRadius)) + lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter)) { lakilester->pos.x += (x - lakilester->pos.x) / 5.0f; lakilester->pos.z += (z - lakilester->pos.z) / 5.0f; @@ -455,7 +455,7 @@ void N(update_riding_physics)(Npc* lakilester) { y = lakilester->moveToPos.y; z = lakilester->pos.z; if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, - lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionRadius)) + lakilester->moveSpeed, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter)) { lakilester->pos.x += (x - lakilester->pos.x) / 5.0f; lakilester->pos.z += (z - lakilester->pos.z) / 5.0f; @@ -469,7 +469,7 @@ void N(update_riding_physics)(Npc* lakilester) { y = lakilester->moveToPos.y; z = lakilester->pos.z; if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, - 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionRadius)) + 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter)) { lakilester->pos.x += (x - lakilester->pos.x) / 5.0f; lakilester->pos.z += (z - lakilester->pos.z) / 5.0f; @@ -480,7 +480,7 @@ void N(update_riding_physics)(Npc* lakilester) { y = lakilester->moveToPos.y; z = lakilester->pos.z; if (npc_test_move_taller_with_slipping(lakilester->collisionChannel, &x, &y, &z, - 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionRadius)) + 4.0f, moveAngle, lakilester->collisionHeight, lakilester->collisionDiameter)) { lakilester->pos.x += (x - lakilester->pos.x) / 5.0f; lakilester->pos.z += (z - lakilester->pos.z) / 5.0f; @@ -709,7 +709,7 @@ API_CALLABLE(N(UseAbility)) { y = lakilester->moveToPos.y; z = lakilester->moveToPos.z; npc_test_move_simple_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, lakilester->moveSpeed, - yaw, lakilester->collisionHeight, lakilester->collisionRadius); + yaw, lakilester->collisionHeight, lakilester->collisionDiameter); lakilester->moveToPos.x = x; lakilester->moveToPos.y = y; lakilester->moveToPos.z = z; @@ -917,7 +917,7 @@ API_CALLABLE(N(UseAbility)) { N(AbilityState) = RIDE_STATE_FINISH_2; return ApiStatus_BLOCK; } - + if (N(AbilityState) == RIDE_STATE_FINISH_2) { lakilester->flags &= ~(NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_TOUCHES_GROUND | NPC_FLAG_8); partnerStatus->actingPartner = PARTNER_NONE; @@ -1005,7 +1005,7 @@ API_CALLABLE(N(PutAway)) { sp28 = playerStatus->position.z; sp2C = playerStatus->colliderHeight; if (npc_raycast_down_around(0, &sp20, &sp24, &sp28, &sp2C, - lakilester->yaw, lakilester->collisionRadius)) { + lakilester->yaw, lakilester->collisionDiameter)) { N(PutAwayState) = PUT_AWAY_FINISH_1; playerStatus->position.y = sp24; diff --git a/src/world/partner/parakarry.c b/src/world/partner/parakarry.c index 5166317e3b..15637f6e14 100644 --- a/src/world/partner/parakarry.c +++ b/src/world/partner/parakarry.c @@ -29,7 +29,7 @@ enum { void N(init)(Npc* parakarry) { parakarry->collisionHeight = 37; - parakarry->collisionRadius = 40; + parakarry->collisionDiameter = 40; N(UsingAbility) = FALSE; N(AbilityState) = AIR_LIFT_NONE; N(LockingPlayerInput) = FALSE; @@ -270,7 +270,7 @@ API_CALLABLE(N(UseAbility)) { if (playerStatus->actionState == ACTION_STATE_HIT_FIRE || playerStatus->actionState == ACTION_STATE_HIT_LAVA || playerStatus->actionState == ACTION_STATE_KNOCKBACK - || playerStatus->actionState == ACTION_STATE_JUMP + || playerStatus->actionState == ACTION_STATE_JUMP || playerStatus->actionState == ACTION_STATE_HOP ) { disable_npc_blur(parakarry); @@ -372,20 +372,20 @@ API_CALLABLE(N(UseAbility)) { x = parakarry->pos.x; y = parakarry->pos.y; z = parakarry->pos.z; - hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionRadius); + hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionDiameter); if (hitCount > 1) { playerDeltaX = (x - playerStatus->position.x) / 8.0f; playerDeltaZ = (z - playerStatus->position.z) / 8.0f; parakarryDeltaX = (x - parakarry->pos.x) / 8.0f; parakarryDeltaZ = (z - parakarry->pos.z) / 8.0f; - + x = parakarry->pos.x + parakarryDeltaX; z = parakarry->pos.z + parakarryDeltaZ; - + x = parakarry->pos.x; y = parakarry->pos.y; z = parakarry->pos.z; - hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionRadius); + hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionDiameter); if (hitCount == 0) { playerStatus->position.x += playerDeltaX; playerStatus->position.z += playerDeltaZ; @@ -404,7 +404,7 @@ API_CALLABLE(N(UseAbility)) { y = playerStatus->position.y + playerStatus->colliderHeight / 2.0f; z = playerStatus->position.z; length = playerStatus->colliderHeight / 2.0f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionRadius)) { + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionDiameter)) { s32 surfaceType = get_collider_flags(NpcHitQueryColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { playerStatus->hazardType = HAZARD_TYPE_SPIKES; @@ -436,7 +436,7 @@ API_CALLABLE(N(UseAbility)) { parakarry->animationSpeed = 1.8f; gCollisionStatus.currentFloor = NO_COLLIDER; N(AbilityState)++; // AIR_LIFT_CARRY - } + } break; case AIR_LIFT_CARRY: gCollisionStatus.currentFloor = N(update_current_floor)(); @@ -447,7 +447,7 @@ API_CALLABLE(N(UseAbility)) { N(AbilityState) = AIR_LIFT_DROP; break; } - + suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); if (playerStatus->flags & PS_FLAG_HIT_FIRE) { N(AbilityState) = AIR_LIFT_JUMP; @@ -510,7 +510,7 @@ API_CALLABLE(N(UseAbility)) { z = parakarry->pos.z; if (!npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, - parakarry->collisionHeight, parakarry->collisionRadius) + parakarry->collisionHeight, parakarry->collisionDiameter) ) { hitAbove = FALSE; x = parakarry->pos.x; @@ -529,7 +529,7 @@ API_CALLABLE(N(UseAbility)) { z = playerStatus->position.z; length = playerStatus->colliderHeight / 2.0f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionRadius)) { + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &length, parakarry->yaw, parakarry->collisionDiameter)) { playerStatus->position.y += (y - playerStatus->position.y) / 4.0f; parakarry->pos.y = playerStatus->position.y + 32.0f; y = parakarry->pos.y; @@ -605,7 +605,7 @@ API_CALLABLE(N(UseAbility)) { } return ApiStatus_DONE2; } - + return ApiStatus_BLOCK; } diff --git a/src/world/partner/sushie.c b/src/world/partner/sushie.c index 8a20729485..0711794e93 100644 --- a/src/world/partner/sushie.c +++ b/src/world/partner/sushie.c @@ -192,7 +192,7 @@ void N(update_riding_physics)(Npc* sushie) { y = sushie->moveToPos.y + -6.0f; depth = (sushie->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f); if (npc_test_move_taller_with_slipping(sushie->collisionChannel, &x, &y, &z, - sushie->moveSpeed, moveAngle, depth, sushie->collisionRadius)) + sushie->moveSpeed, moveAngle, depth, sushie->collisionDiameter)) { collisionStatus->pushingAgainstWall = NpcHitQueryColliderID; if ((get_collider_flags(NpcHitQueryColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK) == SURFACE_TYPE_DOCK_WALL) { @@ -213,7 +213,7 @@ void N(update_riding_physics)(Npc* sushie) { y = sushie->moveToPos.y + -6.0f; depth = (sushie->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f); if (npc_test_move_taller_with_slipping(sushie->collisionChannel, &x, &y, &z, - moveSpeed, moveAngle, depth, sushie->collisionRadius)) + moveSpeed, moveAngle, depth, sushie->collisionDiameter)) { sushie->pos.x += (x - sushie->pos.x) / 5.0f; sushie->pos.z += (z - sushie->pos.z) / 5.0f; @@ -224,7 +224,7 @@ void N(update_riding_physics)(Npc* sushie) { y = sushie->moveToPos.y + -6.0f; depth = (sushie->collisionHeight * 0.5f) + (playerStatus->colliderHeight * 0.8f); if (npc_test_move_taller_with_slipping(sushie->collisionChannel, &x, &y, &z, - moveSpeed, moveAngle, depth, sushie->collisionRadius)) + moveSpeed, moveAngle, depth, sushie->collisionDiameter)) { sushie->pos.x += (x - sushie->pos.x) / 5.0f; sushie->pos.z += (z - sushie->pos.z) / 5.0f; @@ -236,7 +236,7 @@ void N(update_riding_physics)(Npc* sushie) { if (N(DiveState) == DIVE_STATE_NONE) { N(test_for_water_level)(sushie->collisionChannel, sushie->pos.x, sushie->pos.y, sushie->pos.z, - sushie->yaw, sushie->collisionRadius * 0.5f); + sushie->yaw, sushie->collisionDiameter * 0.5f); if (N(DiveState) == DIVE_STATE_NONE) { sushie->moveSpeed = 3.0f; sushie->moveToPos.y = N(WaterSurfaceY) - (sushie->collisionHeight * 0.5f); @@ -260,7 +260,7 @@ void N(update_riding_physics)(Npc* sushie) { y = sushie->pos.y; z = sushie->pos.z; depth = sushie->collisionHeight; - if (npc_raycast_down_around(sushie->collisionChannel, &x, &y, &z, &depth, sushie->yaw, sushie->collisionRadius)) { + if (npc_raycast_down_around(sushie->collisionChannel, &x, &y, &z, &depth, sushie->yaw, sushie->collisionDiameter)) { moveSpeedDamping = ((N(WaterSurfaceY) - (playerStatus->colliderHeight * 2)) - sushie->moveToPos.y) * 0.1f; sushie->moveToPos.y += moveSpeedDamping; if (sushie->moveToPos.y < y + 5.0f) { @@ -297,7 +297,7 @@ void N(update_riding_physics)(Npc* sushie) { y = sushie->moveToPos.y; z = sushie->pos.z; depth = (sushie->collisionHeight * 0.5f) + playerStatus->colliderHeight; - if (npc_raycast_up_corners(sushie->collisionChannel, &x, &y, &z, &depth, sushie->yaw, sushie->collisionRadius * 0.3f) >= 0) { + if (npc_raycast_up_corners(sushie->collisionChannel, &x, &y, &z, &depth, sushie->yaw, sushie->collisionDiameter * 0.3f) >= 0) { sushie->moveToPos.y += (((sushie->moveToPos.y - y) + depth) - ((sushie->collisionHeight * 0.5f) + playerStatus->colliderHeight)) * 0.2f; if (N(DiveTime) % 9 == 0) { fx_rising_bubble(0, sushie->pos.x, sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), sushie->pos.z, @@ -463,7 +463,7 @@ API_CALLABLE(N(UseAbility)) { z = sushie->moveToPos.z; dist = 100.0f; collider = npc_raycast_down_around(sushie->collisionChannel, &x, &y, &z, &dist, - sushie->yaw, sushie->collisionRadius); + sushie->yaw, sushie->collisionDiameter); sushie->currentAnim = ANIM_WorldSushie_Run; sushie->duration = 12; sushie->moveToPos.y = y - (sushie->collisionHeight * 0.5f); @@ -501,7 +501,7 @@ API_CALLABLE(N(UseAbility)) { script->USE_STATE++; // SWIM_STATE_EMBARK_1 fx_rising_bubble(0, sushie->pos.x, sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), sushie->pos.z, 0.0f); break; - + case SWIM_STATE_EMBARK_2: fx_rising_bubble(0, sushie->pos.x, sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), sushie->pos.z, 0.0f); // fallthrough @@ -542,7 +542,7 @@ API_CALLABLE(N(UseAbility)) { script->functionTemp[2] = 0; script->USE_STATE = SWIM_STATE_RIDING; break; - + case SWIM_STATE_RIDING: playerStatus->animFlags |= PA_FLAG_RIDING_PARTNER; N(update_riding_physics)(sushie); @@ -579,8 +579,8 @@ API_CALLABLE(N(UseAbility)) { if (N(DiveState) == DIVE_STATE_DELAY) { if (!(gGameStatusPtr->frameCounter % 19)) { fx_rising_bubble(0, - sushie->pos.x, - sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), + sushie->pos.x, + sushie->moveToPos.y + (sushie->collisionHeight * 0.5f), sushie->pos.z, N(WaterSurfaceY) - sushie->pos.y); } @@ -606,7 +606,7 @@ API_CALLABLE(N(UseAbility)) { z = sushie->pos.z; if (npc_test_move_taller_with_slipping(sushie->collisionChannel, &x, &y, &z, 10.0f, - sushie->yaw, sushie->collisionHeight, sushie->collisionRadius) + sushie->yaw, sushie->collisionHeight, sushie->collisionDiameter) ) { collisionStatus->pushingAgainstWall = sushie->currentWall = NpcHitQueryColliderID; } else { @@ -740,7 +740,7 @@ EvtScript EVS_WorldSushie_UseAbility = { void N(init)(Npc* sushie) { sushie->collisionHeight = 24; - sushie->collisionRadius = 36; + sushie->collisionDiameter = 36; sushie->collisionChannel = COLLISION_CHANNEL_10000; N(IsRiding) = FALSE; N(DiveState) = DIVE_STATE_NONE; @@ -926,7 +926,7 @@ API_CALLABLE(N(EnterMap)) { partnerNPC->pos.z = playerStatus->position.z; partnerNPC->pos.y = playerStatus->position.y; N(test_for_water_level)(partnerNPC->collisionChannel, partnerNPC->pos.x, partnerNPC->pos.y, partnerNPC->pos.z, - partnerNPC->yaw, partnerNPC->collisionRadius * 0.5f); + partnerNPC->yaw, partnerNPC->collisionDiameter * 0.5f); partnerNPC->pos.y = N(WaterSurfaceY) - (partnerNPC->collisionHeight * 0.5f); partnerNPC->yaw = atan2(partnerNPC->pos.x, partnerNPC->pos.z, script->varTable[1], script->varTable[3]); partnerNPC->currentAnim = ANIM_WorldSushie_Ride; diff --git a/src/world/partner/twink.c b/src/world/partner/twink.c index ce7fd9491a..776ecdf135 100644 --- a/src/world/partner/twink.c +++ b/src/world/partner/twink.c @@ -6,7 +6,7 @@ void N(init)(Npc* twink) { twink->collisionHeight = 20; - twink->collisionRadius = 20; + twink->collisionDiameter = 20; } API_CALLABLE(N(TakeOut)) { diff --git a/src/world/partner/watt.c b/src/world/partner/watt.c index 6d1eea2cf9..bfd2dcd8f5 100644 --- a/src/world/partner/watt.c +++ b/src/world/partner/watt.c @@ -64,7 +64,7 @@ void N(reset_static_effect)(s32 type) { void N(init)(Npc* npc) { npc->collisionHeight = 24; - npc->collisionRadius = 24; + npc->collisionDiameter = 24; N(D_802BE308) = FALSE; N(D_802BE300) = FALSE; N(IsPlayerHolding) = FALSE; @@ -355,7 +355,7 @@ API_CALLABLE(N(UseAbility)) { } // allow stop-holding input actionState = playerStatus->actionState; - if ((actionState == ACTION_STATE_IDLE + if ((actionState == ACTION_STATE_IDLE || actionState == ACTION_STATE_WALK || actionState == ACTION_STATE_RUN || actionState == ACTION_STATE_LAND) diff --git a/src/world/partners.c b/src/world/partners.c index f2cda19470..b1298bb66a 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -597,7 +597,7 @@ void create_partner_npc(void) { { Npc* npc = *partnerNpcPtr; npc->npcID = NPC_PARTNER; - npc->collisionRadius = 10; + npc->collisionDiameter = 10; npc->collisionHeight = 10; } @@ -1420,7 +1420,7 @@ void partner_walking_follow_player(Npc* partner) { x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; - if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionRadius) != 0) { + if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) { if (distance <= fabsf(partner->jumpVelocity) + 22.0f) { partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].fly; partner->flags &= ~NPC_FLAG_JUMPING; @@ -1508,7 +1508,7 @@ void partner_walking_follow_player(Npc* partner) { x = partner->pos.x; z = partner->pos.z; y = partner->pos.y + partner->collisionHeight; - if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionRadius) != 0) { + if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) { s32 surfaceType = get_collider_flags(NpcHitQueryColliderID); if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { partner->yaw = clamp_angle(yaw + 180.0f); @@ -1610,7 +1610,7 @@ void partner_walking_follow_player(Npc* partner) { x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; - if ((npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionRadius) != 0) && (distance <= (fabsf(partner->jumpVelocity) + 22.0f))) { + if ((npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) && (distance <= (fabsf(partner->jumpVelocity) + 22.0f))) { partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[partner->moveSpeed >= 4.0 ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; partner->jumpScale = 0.0f; partner->jumpVelocity = 0.0f; @@ -1677,7 +1677,7 @@ void partner_walking_follow_player(Npc* partner) { x = partner->pos.x; y = partner->pos.y + distance; z = partner->pos.z; - if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionRadius) != 0) { + if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) != 0) { partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].idle; partner->flags &= ~NPC_FLAG_JUMPING; partner->jumpVelocity = 0.0f; @@ -1811,7 +1811,7 @@ void partner_flying_update_motion(Npc* partner) { y = partner->pos.y; z = partner->pos.z; hitDepth = 1000.0f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionRadius) == 0) { + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionDiameter) == 0) { y = playerStatus->position.y; } @@ -2124,7 +2124,7 @@ void partner_flying_follow_player(Npc* partner) { z = partner->pos.z; distance = partner->collisionHeight + 1; wPartnerMoveTime--; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &distance, partner->yaw, partner->collisionRadius) == 0) { + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &distance, partner->yaw, partner->collisionDiameter) == 0) { if (partner->collisionHeight + 5 < fabs((partner->pos.y - playerStatus->position.y))) { partner->pos.y += (playerStatus->position.y - partner->pos.y) / 10.0f; } @@ -2136,7 +2136,7 @@ void partner_flying_follow_player(Npc* partner) { x = partner->pos.x; y = partner->pos.y; z = partner->pos.z; - if (npc_test_move_taller_with_slipping(0, &x, &y, &z, partner->moveSpeed, partner->yaw, partner->collisionHeight, partner->collisionRadius)) { + if (npc_test_move_taller_with_slipping(0, &x, &y, &z, partner->moveSpeed, partner->yaw, partner->collisionHeight, partner->collisionDiameter)) { partner->pos.x += (x - partner->pos.x) / 5.0f; partner->pos.z += (z - partner->pos.z) / 5.0f; } else { @@ -2280,7 +2280,7 @@ s32 partner_get_out(Npc* partner) { z = moveToZ; add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); hitDepth = 1000.0f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionRadius)) { + if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionDiameter)) { // @bug? collider flags not properly masked with COLLIDER_FLAG_SURFACE_TYPE s32 surfaceType = get_collider_flags(NpcHitQueryColliderID); @@ -2503,7 +2503,7 @@ void partner_do_player_collision(Npc* partner) { playerScreenX = fabsf(playerScreenX - partnerScreenX); playerScreenY = fabsf(playerScreenY - partnerScreenY); playerScreenZ = fabsf(playerScreenZ - partnerScreenZ); - if (playerScreenX <= (partner->collisionRadius + playerStatus->colliderDiameter) * 0.9f && + if (playerScreenX <= (partner->collisionDiameter + playerStatus->colliderDiameter) * 0.9f && playerScreenY <= partner->collisionHeight + playerStatus->colliderHeight && playerScreenZ <= 4.0) { npc_move_heading(partner, 1.0f, @@ -2552,7 +2552,7 @@ void partner_move_to_goal(Npc* partner, s32 isFlying) { z = partner->pos.z; if (npc_raycast_down_around(partner->collisionChannel, &x, &y, &z, &temp, - partner->yaw, partner->collisionRadius) && + partner->yaw, partner->collisionDiameter) && (temp <= fabsf(partner->jumpVelocity) + 22.0f)) { partner->currentAnim = gPartnerAnimations[wCurrentPartnerId].anims[ diff --git a/ver/ique/asm/nonmatchings/npc/npc_do_player_collision.s b/ver/ique/asm/nonmatchings/npc/npc_do_player_collision.s deleted file mode 100644 index f58dc1fad2..0000000000 --- a/ver/ique/asm/nonmatchings/npc/npc_do_player_collision.s +++ /dev/null @@ -1,255 +0,0 @@ -.set noat /* allow manual use of $at */ -.set noreorder /* don't insert nops after branches */ - -/* Generated by spimdisasm 1.11.1 */ - -glabel npc_do_player_collision -/* 13D88 80038988 27BDFFA8 */ addiu $sp, $sp, -0x58 -/* 13D8C 8003898C AFB1001C */ sw $s1, 0x1C($sp) -/* 13D90 80038990 0080882D */ daddu $s1, $a0, $zero -/* 13D94 80038994 AFBF0020 */ sw $ra, 0x20($sp) -/* 13D98 80038998 AFB00018 */ sw $s0, 0x18($sp) -/* 13D9C 8003899C F7BE0050 */ sdc1 $f30, 0x50($sp) -/* 13DA0 800389A0 F7BC0048 */ sdc1 $f28, 0x48($sp) -/* 13DA4 800389A4 F7BA0040 */ sdc1 $f26, 0x40($sp) -/* 13DA8 800389A8 F7B80038 */ sdc1 $f24, 0x38($sp) -/* 13DAC 800389AC F7B60030 */ sdc1 $f22, 0x30($sp) -/* 13DB0 800389B0 F7B40028 */ sdc1 $f20, 0x28($sp) -/* 13DB4 800389B4 8E230000 */ lw $v1, 0x0($s1) -/* 13DB8 800389B8 3C108011 */ lui $s0, %hi(gPlayerStatus) -/* 13DBC 800389BC 2610D3A8 */ addiu $s0, $s0, %lo(gPlayerStatus) -/* 13DC0 800389C0 30620100 */ andi $v0, $v1, 0x100 -/* 13DC4 800389C4 144000D1 */ bnez $v0, .LIQUE_80038D0C -/* 13DC8 800389C8 0000102D */ daddu $v0, $zero, $zero -/* 13DCC 800389CC 3C020400 */ lui $v0, (0x4000000 >> 16) -/* 13DD0 800389D0 00621024 */ and $v0, $v1, $v0 -/* 13DD4 800389D4 10400003 */ beqz $v0, .LIQUE_800389E4 -/* 13DD8 800389D8 00000000 */ nop -.LIQUE_800389DC: -/* 13DDC 800389DC 0800E343 */ j .LIQUE_80038D0C -/* 13DE0 800389E0 0000102D */ daddu $v0, $zero, $zero -.LIQUE_800389E4: -/* 13DE4 800389E4 3C02800A */ lui $v0, %hi(gNpcPlayerCollisionsEnabled) -/* 13DE8 800389E8 8042D5A4 */ lb $v0, %lo(gNpcPlayerCollisionsEnabled)($v0) -/* 13DEC 800389EC 504000C7 */ beql $v0, $zero, .LIQUE_80038D0C -/* 13DF0 800389F0 0000102D */ daddu $v0, $zero, $zero -/* 13DF4 800389F4 860200B0 */ lh $v0, 0xB0($s0) -/* 13DF8 800389F8 C604002C */ lwc1 $f4, 0x2C($s0) -/* 13DFC 800389FC 44820000 */ mtc1 $v0, $f0 -/* 13E00 80038A00 00000000 */ nop -/* 13E04 80038A04 46800020 */ cvt.s.w $f0, $f0 -/* 13E08 80038A08 46002000 */ add.s $f0, $f4, $f0 -/* 13E0C 80038A0C C622003C */ lwc1 $f2, 0x3C($s1) -/* 13E10 80038A10 4602003C */ c.lt.s $f0, $f2 -/* 13E14 80038A14 00000000 */ nop -/* 13E18 80038A18 450100BC */ bc1t .LIQUE_80038D0C -/* 13E1C 80038A1C 0000102D */ daddu $v0, $zero, $zero -/* 13E20 80038A20 862200A8 */ lh $v0, 0xA8($s1) -/* 13E24 80038A24 44820000 */ mtc1 $v0, $f0 -/* 13E28 80038A28 00000000 */ nop -/* 13E2C 80038A2C 46800020 */ cvt.s.w $f0, $f0 -/* 13E30 80038A30 46001000 */ add.s $f0, $f2, $f0 -/* 13E34 80038A34 4604003C */ c.lt.s $f0, $f4 -/* 13E38 80038A38 00000000 */ nop -/* 13E3C 80038A3C 450100B3 */ bc1t .LIQUE_80038D0C -/* 13E40 80038A40 0000102D */ daddu $v0, $zero, $zero -/* 13E44 80038A44 C63A0038 */ lwc1 $f26, 0x38($s1) -/* 13E48 80038A48 C61E0028 */ lwc1 $f30, 0x28($s0) -/* 13E4C 80038A4C C61C0030 */ lwc1 $f28, 0x30($s0) -/* 13E50 80038A50 962200A6 */ lhu $v0, 0xA6($s1) -/* 13E54 80038A54 461AF581 */ sub.s $f22, $f30, $f26 -/* 13E58 80038A58 960300B2 */ lhu $v1, 0xB2($s0) -/* 13E5C 80038A5C 00021400 */ sll $v0, $v0, 16 -/* 13E60 80038A60 4616B082 */ mul.s $f2, $f22, $f22 -/* 13E64 80038A64 00000000 */ nop -/* 13E68 80038A68 00022403 */ sra $a0, $v0, 16 -/* 13E6C 80038A6C 000217C2 */ srl $v0, $v0, 31 -/* 13E70 80038A70 C6360040 */ lwc1 $f22, 0x40($s1) -/* 13E74 80038A74 00822021 */ addu $a0, $a0, $v0 -/* 13E78 80038A78 4616E501 */ sub.s $f20, $f28, $f22 -/* 13E7C 80038A7C 00042043 */ sra $a0, $a0, 1 -/* 13E80 80038A80 00031C00 */ sll $v1, $v1, 16 -/* 13E84 80038A84 4614A002 */ mul.s $f0, $f20, $f20 -/* 13E88 80038A88 00000000 */ nop -/* 13E8C 80038A8C 00031403 */ sra $v0, $v1, 16 -/* 13E90 80038A90 00031FC2 */ srl $v1, $v1, 31 -/* 13E94 80038A94 00431021 */ addu $v0, $v0, $v1 -/* 13E98 80038A98 00021043 */ sra $v0, $v0, 1 -/* 13E9C 80038A9C 46001300 */ add.s $f12, $f2, $f0 -/* 13EA0 80038AA0 4484B000 */ mtc1 $a0, $f22 -/* 13EA4 80038AA4 00000000 */ nop -/* 13EA8 80038AA8 4680B5A0 */ cvt.s.w $f22, $f22 -/* 13EAC 80038AAC 4482A000 */ mtc1 $v0, $f20 -/* 13EB0 80038AB0 00000000 */ nop -/* 13EB4 80038AB4 4680A520 */ cvt.s.w $f20, $f20 -/* 13EB8 80038AB8 46006004 */ sqrt.s $f0, $f12 -/* 13EBC 80038ABC 46000032 */ c.eq.s $f0, $f0 -/* 13EC0 80038AC0 00000000 */ nop -/* 13EC4 80038AC4 45010003 */ bc1t .LIQUE_80038AD4 -/* 13EC8 80038AC8 4614B580 */ add.s $f22, $f22, $f20 -/* 13ECC 80038ACC 0C0183A0 */ jal sqrtf -/* 13ED0 80038AD0 00000000 */ nop -.LIQUE_80038AD4: -/* 13ED4 80038AD4 4600B03C */ c.lt.s $f22, $f0 -/* 13ED8 80038AD8 00000000 */ nop -/* 13EDC 80038ADC 4501FFBF */ bc1t .LIQUE_800389DC -/* 13EE0 80038AE0 E7B60010 */ swc1 $f22, 0x10($sp) -/* 13EE4 80038AE4 8E020004 */ lw $v0, 0x4($s0) -/* 13EE8 80038AE8 34428000 */ ori $v0, $v0, 0x8000 -/* 13EEC 80038AEC AE020004 */ sw $v0, 0x4($s0) -/* 13EF0 80038AF0 C63A006C */ lwc1 $f26, 0x6C($s1) -/* 13EF4 80038AF4 461AF581 */ sub.s $f22, $f30, $f26 -/* 13EF8 80038AF8 4616B082 */ mul.s $f2, $f22, $f22 -/* 13EFC 80038AFC 00000000 */ nop -/* 13F00 80038B00 C6360074 */ lwc1 $f22, 0x74($s1) -/* 13F04 80038B04 4616E501 */ sub.s $f20, $f28, $f22 -/* 13F08 80038B08 4614A002 */ mul.s $f0, $f20, $f20 -/* 13F0C 80038B0C 00000000 */ nop -/* 13F10 80038B10 46001300 */ add.s $f12, $f2, $f0 -/* 13F14 80038B14 46006004 */ sqrt.s $f0, $f12 -/* 13F18 80038B18 46000032 */ c.eq.s $f0, $f0 -/* 13F1C 80038B1C 00000000 */ nop -/* 13F20 80038B20 45010004 */ bc1t .LIQUE_80038B34 -/* 13F24 80038B24 46000606 */ mov.s $f24, $f0 -/* 13F28 80038B28 0C0183A0 */ jal sqrtf -/* 13F2C 80038B2C 00000000 */ nop -/* 13F30 80038B30 46000606 */ mov.s $f24, $f0 -.LIQUE_80038B34: -/* 13F34 80038B34 4600F306 */ mov.s $f12, $f30 -/* 13F38 80038B38 4406D000 */ mfc1 $a2, $f26 -/* 13F3C 80038B3C 4407B000 */ mfc1 $a3, $f22 -/* 13F40 80038B40 0C00A654 */ jal atan2 -/* 13F44 80038B44 4600E386 */ mov.s $f14, $f28 -/* 13F48 80038B48 3C0140C9 */ lui $at, (0x40C90FD0 >> 16) -/* 13F4C 80038B4C 34210FD0 */ ori $at, $at, (0x40C90FD0 & 0xFFFF) -/* 13F50 80038B50 4481A000 */ mtc1 $at, $f20 -/* 13F54 80038B54 46000686 */ mov.s $f26, $f0 -/* 13F58 80038B58 4614D502 */ mul.s $f20, $f26, $f20 -/* 13F5C 80038B5C 00000000 */ nop -/* 13F60 80038B60 3C0143B4 */ lui $at, (0x43B40000 >> 16) -/* 13F64 80038B64 44810000 */ mtc1 $at, $f0 -/* 13F68 80038B68 C7A80010 */ lwc1 $f8, 0x10($sp) -/* 13F6C 80038B6C C61C0080 */ lwc1 $f28, 0x80($s0) -/* 13F70 80038B70 46184601 */ sub.s $f24, $f8, $f24 -/* 13F74 80038B74 4600A503 */ div.s $f20, $f20, $f0 -/* 13F78 80038B78 0C00A78F */ jal sin_rad -/* 13F7C 80038B7C 4600A306 */ mov.s $f12, $f20 -/* 13F80 80038B80 4600C582 */ mul.s $f22, $f24, $f0 -/* 13F84 80038B84 00000000 */ nop -/* 13F88 80038B88 0C00A7A8 */ jal cos_rad -/* 13F8C 80038B8C 4600A306 */ mov.s $f12, $f20 -/* 13F90 80038B90 3C030040 */ lui $v1, (0x400000 >> 16) -/* 13F94 80038B94 8E020004 */ lw $v0, 0x4($s0) -/* 13F98 80038B98 4600C087 */ neg.s $f2, $f24 -/* 13F9C 80038B9C 46001502 */ mul.s $f20, $f2, $f0 -/* 13FA0 80038BA0 00000000 */ nop -/* 13FA4 80038BA4 00431024 */ and $v0, $v0, $v1 -/* 13FA8 80038BA8 1040002D */ beqz $v0, .LIQUE_80038C60 -/* 13FAC 80038BAC 4600D306 */ mov.s $f12, $f26 -/* 13FB0 80038BB0 0C00A63E */ jal get_clamped_angle_diff -/* 13FB4 80038BB4 4600E386 */ mov.s $f14, $f28 -/* 13FB8 80038BB8 3C014234 */ lui $at, (0x42340000 >> 16) -/* 13FBC 80038BBC 44811000 */ mtc1 $at, $f2 -/* 13FC0 80038BC0 46000005 */ abs.s $f0, $f0 -/* 13FC4 80038BC4 4602003C */ c.lt.s $f0, $f2 -/* 13FC8 80038BC8 00000000 */ nop -/* 13FCC 80038BCC 4500000E */ bc1f .LIQUE_80038C08 -/* 13FD0 80038BD0 00000000 */ nop -/* 13FD4 80038BD4 C6020028 */ lwc1 $f2, 0x28($s0) -/* 13FD8 80038BD8 46161081 */ sub.s $f2, $f2, $f22 -/* 13FDC 80038BDC C6000030 */ lwc1 $f0, 0x30($s0) -/* 13FE0 80038BE0 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 13FE4 80038BE4 8C42AD10 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 13FE8 80038BE8 46140001 */ sub.s $f0, $f0, $f20 -/* 13FEC 80038BEC E6020028 */ swc1 $f2, 0x28($s0) -/* 13FF0 80038BF0 E6000030 */ swc1 $f0, 0x30($s0) -/* 13FF4 80038BF4 C4420038 */ lwc1 $f2, 0x38($v0) -/* 13FF8 80038BF8 46161081 */ sub.s $f2, $f2, $f22 -/* 13FFC 80038BFC C4400040 */ lwc1 $f0, 0x40($v0) -/* 14000 80038C00 0800E315 */ j .LIQUE_80038C54 -/* 14004 80038C04 46140001 */ sub.s $f0, $f0, $f20 -.LIQUE_80038C08: -/* 14008 80038C08 3C013F00 */ lui $at, (0x3F000000 >> 16) -/* 1400C 80038C0C 44812000 */ mtc1 $at, $f4 -/* 14010 80038C10 00000000 */ nop -/* 14014 80038C14 4604B182 */ mul.s $f6, $f22, $f4 -/* 14018 80038C18 00000000 */ nop -/* 1401C 80038C1C 4604A102 */ mul.s $f4, $f20, $f4 -/* 14020 80038C20 00000000 */ nop -/* 14024 80038C24 C6020028 */ lwc1 $f2, 0x28($s0) -/* 14028 80038C28 46061081 */ sub.s $f2, $f2, $f6 -/* 1402C 80038C2C C6000030 */ lwc1 $f0, 0x30($s0) -/* 14030 80038C30 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 14034 80038C34 8C42AD10 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 14038 80038C38 46040001 */ sub.s $f0, $f0, $f4 -/* 1403C 80038C3C E6020028 */ swc1 $f2, 0x28($s0) -/* 14040 80038C40 E6000030 */ swc1 $f0, 0x30($s0) -/* 14044 80038C44 C4420038 */ lwc1 $f2, 0x38($v0) -/* 14048 80038C48 46061081 */ sub.s $f2, $f2, $f6 -/* 1404C 80038C4C C4400040 */ lwc1 $f0, 0x40($v0) -/* 14050 80038C50 46040001 */ sub.s $f0, $f0, $f4 -.LIQUE_80038C54: -/* 14054 80038C54 E4420038 */ swc1 $f2, 0x38($v0) -/* 14058 80038C58 0800E33C */ j .LIQUE_80038CF0 -/* 1405C 80038C5C E4400040 */ swc1 $f0, 0x40($v0) -.LIQUE_80038C60: -/* 14060 80038C60 8E020000 */ lw $v0, 0x0($s0) -/* 14064 80038C64 30420006 */ andi $v0, $v0, 0x6 -/* 14068 80038C68 10400006 */ beqz $v0, .LIQUE_80038C84 -/* 1406C 80038C6C 00000000 */ nop -/* 14070 80038C70 3C013ECC */ lui $at, (0x3ECCCCCD >> 16) -/* 14074 80038C74 3421CCCD */ ori $at, $at, (0x3ECCCCCD & 0xFFFF) -/* 14078 80038C78 44812000 */ mtc1 $at, $f4 -/* 1407C 80038C7C 0800E332 */ j .LIQUE_80038CC8 -/* 14080 80038C80 00000000 */ nop -.LIQUE_80038C84: -/* 14084 80038C84 0C00A63E */ jal get_clamped_angle_diff -/* 14088 80038C88 4600E386 */ mov.s $f14, $f28 -/* 1408C 80038C8C 3C014234 */ lui $at, (0x42340000 >> 16) -/* 14090 80038C90 44811000 */ mtc1 $at, $f2 -/* 14094 80038C94 46000005 */ abs.s $f0, $f0 -/* 14098 80038C98 4602003C */ c.lt.s $f0, $f2 -/* 1409C 80038C9C 00000000 */ nop -/* 140A0 80038CA0 45000006 */ bc1f .LIQUE_80038CBC -/* 140A4 80038CA4 00000000 */ nop -/* 140A8 80038CA8 C6020028 */ lwc1 $f2, 0x28($s0) -/* 140AC 80038CAC 46161081 */ sub.s $f2, $f2, $f22 -/* 140B0 80038CB0 C6000030 */ lwc1 $f0, 0x30($s0) -/* 140B4 80038CB4 0800E33A */ j .LIQUE_80038CE8 -/* 140B8 80038CB8 46140001 */ sub.s $f0, $f0, $f20 -.LIQUE_80038CBC: -/* 140BC 80038CBC 3C013F00 */ lui $at, (0x3F000000 >> 16) -/* 140C0 80038CC0 44812000 */ mtc1 $at, $f4 -/* 140C4 80038CC4 00000000 */ nop -.LIQUE_80038CC8: -/* 140C8 80038CC8 4604B002 */ mul.s $f0, $f22, $f4 -/* 140CC 80038CCC 00000000 */ nop -/* 140D0 80038CD0 4604A102 */ mul.s $f4, $f20, $f4 -/* 140D4 80038CD4 00000000 */ nop -/* 140D8 80038CD8 C6020028 */ lwc1 $f2, 0x28($s0) -/* 140DC 80038CDC 46001081 */ sub.s $f2, $f2, $f0 -/* 140E0 80038CE0 C6000030 */ lwc1 $f0, 0x30($s0) -/* 140E4 80038CE4 46040001 */ sub.s $f0, $f0, $f4 -.LIQUE_80038CE8: -/* 140E8 80038CE8 E6020028 */ swc1 $f2, 0x28($s0) -/* 140EC 80038CEC E6000030 */ swc1 $f0, 0x30($s0) -.LIQUE_80038CF0: -/* 140F0 80038CF0 C620006C */ lwc1 $f0, 0x6C($s1) -/* 140F4 80038CF4 C6220070 */ lwc1 $f2, 0x70($s1) -/* 140F8 80038CF8 C6240074 */ lwc1 $f4, 0x74($s1) -/* 140FC 80038CFC 24020001 */ addiu $v0, $zero, 0x1 -/* 14100 80038D00 E6200038 */ swc1 $f0, 0x38($s1) -/* 14104 80038D04 E622003C */ swc1 $f2, 0x3C($s1) -/* 14108 80038D08 E6240040 */ swc1 $f4, 0x40($s1) -.LIQUE_80038D0C: -/* 1410C 80038D0C 8FBF0020 */ lw $ra, 0x20($sp) -/* 14110 80038D10 8FB1001C */ lw $s1, 0x1C($sp) -/* 14114 80038D14 8FB00018 */ lw $s0, 0x18($sp) -/* 14118 80038D18 D7BE0050 */ ldc1 $f30, 0x50($sp) -/* 1411C 80038D1C D7BC0048 */ ldc1 $f28, 0x48($sp) -/* 14120 80038D20 D7BA0040 */ ldc1 $f26, 0x40($sp) -/* 14124 80038D24 D7B80038 */ ldc1 $f24, 0x38($sp) -/* 14128 80038D28 D7B60030 */ ldc1 $f22, 0x30($sp) -/* 1412C 80038D2C D7B40028 */ ldc1 $f20, 0x28($sp) -/* 14130 80038D30 03E00008 */ jr $ra -/* 14134 80038D34 27BD0058 */ addiu $sp, $sp, 0x58 diff --git a/ver/jp/asm/nonmatchings/npc/npc_do_player_collision.s b/ver/jp/asm/nonmatchings/npc/npc_do_player_collision.s deleted file mode 100644 index 7e92702b73..0000000000 --- a/ver/jp/asm/nonmatchings/npc/npc_do_player_collision.s +++ /dev/null @@ -1,253 +0,0 @@ -.set noat /* allow manual use of $at */ -.set noreorder /* don't insert nops after branches */ - -glabel npc_do_player_collision -/* 14398 80038F98 27BDFFA8 */ addiu $sp, $sp, -0x58 -/* 1439C 80038F9C AFB1001C */ sw $s1, 0x1C($sp) -/* 143A0 80038FA0 0080882D */ daddu $s1, $a0, $zero -/* 143A4 80038FA4 AFBF0020 */ sw $ra, 0x20($sp) -/* 143A8 80038FA8 AFB00018 */ sw $s0, 0x18($sp) -/* 143AC 80038FAC F7BE0050 */ sdc1 $f30, 0x50($sp) -/* 143B0 80038FB0 F7BC0048 */ sdc1 $f28, 0x48($sp) -/* 143B4 80038FB4 F7BA0040 */ sdc1 $f26, 0x40($sp) -/* 143B8 80038FB8 F7B80038 */ sdc1 $f24, 0x38($sp) -/* 143BC 80038FBC F7B60030 */ sdc1 $f22, 0x30($sp) -/* 143C0 80038FC0 F7B40028 */ sdc1 $f20, 0x28($sp) -/* 143C4 80038FC4 8E230000 */ lw $v1, 0x0($s1) -/* 143C8 80038FC8 3C108011 */ lui $s0, %hi(gPlayerStatus) -/* 143CC 80038FCC 2610F188 */ addiu $s0, $s0, %lo(gPlayerStatus) -/* 143D0 80038FD0 30620100 */ andi $v0, $v1, 0x100 -/* 143D4 80038FD4 144000D1 */ bnez $v0, .LJP_8003931C -/* 143D8 80038FD8 0000102D */ daddu $v0, $zero, $zero -/* 143DC 80038FDC 3C020400 */ lui $v0, (0x4000000 >> 16) -/* 143E0 80038FE0 00621024 */ and $v0, $v1, $v0 -/* 143E4 80038FE4 10400003 */ beqz $v0, .LJP_80038FF4 -/* 143E8 80038FE8 00000000 */ nop -.LJP_80038FEC: -/* 143EC 80038FEC 0800E4C7 */ j .LJP_8003931C -/* 143F0 80038FF0 0000102D */ daddu $v0, $zero, $zero -.LJP_80038FF4: -/* 143F4 80038FF4 3C02800A */ lui $v0, %hi(gNpcPlayerCollisionsEnabled) -/* 143F8 80038FF8 8042E9A4 */ lb $v0, %lo(gNpcPlayerCollisionsEnabled)($v0) -/* 143FC 80038FFC 504000C7 */ beql $v0, $zero, .LJP_8003931C -/* 14400 80039000 0000102D */ daddu $v0, $zero, $zero -/* 14404 80039004 860200B0 */ lh $v0, 0xB0($s0) -/* 14408 80039008 C604002C */ lwc1 $f4, 0x2C($s0) -/* 1440C 8003900C 44820000 */ mtc1 $v0, $f0 -/* 14410 80039010 00000000 */ nop -/* 14414 80039014 46800020 */ cvt.s.w $f0, $f0 -/* 14418 80039018 46002000 */ add.s $f0, $f4, $f0 -/* 1441C 8003901C C622003C */ lwc1 $f2, 0x3C($s1) -/* 14420 80039020 4602003C */ c.lt.s $f0, $f2 -/* 14424 80039024 00000000 */ nop -/* 14428 80039028 450100BC */ bc1t .LJP_8003931C -/* 1442C 8003902C 0000102D */ daddu $v0, $zero, $zero -/* 14430 80039030 862200A8 */ lh $v0, 0xA8($s1) -/* 14434 80039034 44820000 */ mtc1 $v0, $f0 -/* 14438 80039038 00000000 */ nop -/* 1443C 8003903C 46800020 */ cvt.s.w $f0, $f0 -/* 14440 80039040 46001000 */ add.s $f0, $f2, $f0 -/* 14444 80039044 4604003C */ c.lt.s $f0, $f4 -/* 14448 80039048 00000000 */ nop -/* 1444C 8003904C 450100B3 */ bc1t .LJP_8003931C -/* 14450 80039050 0000102D */ daddu $v0, $zero, $zero -/* 14454 80039054 C63A0038 */ lwc1 $f26, 0x38($s1) -/* 14458 80039058 C61E0028 */ lwc1 $f30, 0x28($s0) -/* 1445C 8003905C C61C0030 */ lwc1 $f28, 0x30($s0) -/* 14460 80039060 962200A6 */ lhu $v0, 0xA6($s1) -/* 14464 80039064 461AF581 */ sub.s $f22, $f30, $f26 -/* 14468 80039068 960300B2 */ lhu $v1, 0xB2($s0) -/* 1446C 8003906C 00021400 */ sll $v0, $v0, 16 -/* 14470 80039070 4616B082 */ mul.s $f2, $f22, $f22 -/* 14474 80039074 00000000 */ nop -/* 14478 80039078 00022403 */ sra $a0, $v0, 16 -/* 1447C 8003907C 000217C2 */ srl $v0, $v0, 31 -/* 14480 80039080 C6360040 */ lwc1 $f22, 0x40($s1) -/* 14484 80039084 00822021 */ addu $a0, $a0, $v0 -/* 14488 80039088 4616E501 */ sub.s $f20, $f28, $f22 -/* 1448C 8003908C 00042043 */ sra $a0, $a0, 1 -/* 14490 80039090 00031C00 */ sll $v1, $v1, 16 -/* 14494 80039094 4614A002 */ mul.s $f0, $f20, $f20 -/* 14498 80039098 00000000 */ nop -/* 1449C 8003909C 00031403 */ sra $v0, $v1, 16 -/* 144A0 800390A0 00031FC2 */ srl $v1, $v1, 31 -/* 144A4 800390A4 00431021 */ addu $v0, $v0, $v1 -/* 144A8 800390A8 00021043 */ sra $v0, $v0, 1 -/* 144AC 800390AC 46001300 */ add.s $f12, $f2, $f0 -/* 144B0 800390B0 4484B000 */ mtc1 $a0, $f22 -/* 144B4 800390B4 00000000 */ nop -/* 144B8 800390B8 4680B5A0 */ cvt.s.w $f22, $f22 -/* 144BC 800390BC 4482A000 */ mtc1 $v0, $f20 -/* 144C0 800390C0 00000000 */ nop -/* 144C4 800390C4 4680A520 */ cvt.s.w $f20, $f20 -/* 144C8 800390C8 46006004 */ sqrt.s $f0, $f12 -/* 144CC 800390CC 46000032 */ c.eq.s $f0, $f0 -/* 144D0 800390D0 00000000 */ nop -/* 144D4 800390D4 45010003 */ bc1t .LJP_800390E4 -/* 144D8 800390D8 4614B580 */ add.s $f22, $f22, $f20 -/* 144DC 800390DC 0C0187B0 */ jal sqrtf -/* 144E0 800390E0 00000000 */ nop -.LJP_800390E4: -/* 144E4 800390E4 4600B03C */ c.lt.s $f22, $f0 -/* 144E8 800390E8 00000000 */ nop -/* 144EC 800390EC 4501FFBF */ bc1t .LJP_80038FEC -/* 144F0 800390F0 E7B60010 */ swc1 $f22, 0x10($sp) -/* 144F4 800390F4 8E020004 */ lw $v0, 0x4($s0) -/* 144F8 800390F8 34428000 */ ori $v0, $v0, 0x8000 -/* 144FC 800390FC AE020004 */ sw $v0, 0x4($s0) -/* 14500 80039100 C63A006C */ lwc1 $f26, 0x6C($s1) -/* 14504 80039104 461AF581 */ sub.s $f22, $f30, $f26 -/* 14508 80039108 4616B082 */ mul.s $f2, $f22, $f22 -/* 1450C 8003910C 00000000 */ nop -/* 14510 80039110 C6360074 */ lwc1 $f22, 0x74($s1) -/* 14514 80039114 4616E501 */ sub.s $f20, $f28, $f22 -/* 14518 80039118 4614A002 */ mul.s $f0, $f20, $f20 -/* 1451C 8003911C 00000000 */ nop -/* 14520 80039120 46001300 */ add.s $f12, $f2, $f0 -/* 14524 80039124 46006004 */ sqrt.s $f0, $f12 -/* 14528 80039128 46000032 */ c.eq.s $f0, $f0 -/* 1452C 8003912C 00000000 */ nop -/* 14530 80039130 45010004 */ bc1t .LJP_80039144 -/* 14534 80039134 46000606 */ mov.s $f24, $f0 -/* 14538 80039138 0C0187B0 */ jal sqrtf -/* 1453C 8003913C 00000000 */ nop -/* 14540 80039140 46000606 */ mov.s $f24, $f0 -.LJP_80039144: -/* 14544 80039144 4600F306 */ mov.s $f12, $f30 -/* 14548 80039148 4406D000 */ mfc1 $a2, $f26 -/* 1454C 8003914C 4407B000 */ mfc1 $a3, $f22 -/* 14550 80039150 0C00A710 */ jal atan2 -/* 14554 80039154 4600E386 */ mov.s $f14, $f28 -/* 14558 80039158 3C0140C9 */ lui $at, (0x40C90FD0 >> 16) -/* 1455C 8003915C 34210FD0 */ ori $at, $at, (0x40C90FD0 & 0xFFFF) -/* 14560 80039160 4481A000 */ mtc1 $at, $f20 -/* 14564 80039164 46000686 */ mov.s $f26, $f0 -/* 14568 80039168 4614D502 */ mul.s $f20, $f26, $f20 -/* 1456C 8003916C 00000000 */ nop -/* 14570 80039170 3C0143B4 */ lui $at, (0x43B40000 >> 16) -/* 14574 80039174 44810000 */ mtc1 $at, $f0 -/* 14578 80039178 C7A80010 */ lwc1 $f8, 0x10($sp) -/* 1457C 8003917C C61C0080 */ lwc1 $f28, 0x80($s0) -/* 14580 80039180 46184601 */ sub.s $f24, $f8, $f24 -/* 14584 80039184 4600A503 */ div.s $f20, $f20, $f0 -/* 14588 80039188 0C00A84B */ jal sin_rad -/* 1458C 8003918C 4600A306 */ mov.s $f12, $f20 -/* 14590 80039190 4600C582 */ mul.s $f22, $f24, $f0 -/* 14594 80039194 00000000 */ nop -/* 14598 80039198 0C00A864 */ jal cos_rad -/* 1459C 8003919C 4600A306 */ mov.s $f12, $f20 -/* 145A0 800391A0 3C030040 */ lui $v1, (0x400000 >> 16) -/* 145A4 800391A4 8E020004 */ lw $v0, 0x4($s0) -/* 145A8 800391A8 4600C087 */ neg.s $f2, $f24 -/* 145AC 800391AC 46001502 */ mul.s $f20, $f2, $f0 -/* 145B0 800391B0 00000000 */ nop -/* 145B4 800391B4 00431024 */ and $v0, $v0, $v1 -/* 145B8 800391B8 1040002D */ beqz $v0, .LJP_80039270 -/* 145BC 800391BC 4600D306 */ mov.s $f12, $f26 -/* 145C0 800391C0 0C00A6FA */ jal get_clamped_angle_diff -/* 145C4 800391C4 4600E386 */ mov.s $f14, $f28 -/* 145C8 800391C8 3C014234 */ lui $at, (0x42340000 >> 16) -/* 145CC 800391CC 44811000 */ mtc1 $at, $f2 -/* 145D0 800391D0 46000005 */ abs.s $f0, $f0 -/* 145D4 800391D4 4602003C */ c.lt.s $f0, $f2 -/* 145D8 800391D8 00000000 */ nop -/* 145DC 800391DC 4500000E */ bc1f .LJP_80039218 -/* 145E0 800391E0 00000000 */ nop -/* 145E4 800391E4 C6020028 */ lwc1 $f2, 0x28($s0) -/* 145E8 800391E8 46161081 */ sub.s $f2, $f2, $f22 -/* 145EC 800391EC C6000030 */ lwc1 $f0, 0x30($s0) -/* 145F0 800391F0 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 145F4 800391F4 8C42CAF0 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 145F8 800391F8 46140001 */ sub.s $f0, $f0, $f20 -/* 145FC 800391FC E6020028 */ swc1 $f2, 0x28($s0) -/* 14600 80039200 E6000030 */ swc1 $f0, 0x30($s0) -/* 14604 80039204 C4420038 */ lwc1 $f2, 0x38($v0) -/* 14608 80039208 46161081 */ sub.s $f2, $f2, $f22 -/* 1460C 8003920C C4400040 */ lwc1 $f0, 0x40($v0) -/* 14610 80039210 0800E499 */ j .LJP_80039264 -/* 14614 80039214 46140001 */ sub.s $f0, $f0, $f20 -.LJP_80039218: -/* 14618 80039218 3C013F00 */ lui $at, (0x3F000000 >> 16) -/* 1461C 8003921C 44812000 */ mtc1 $at, $f4 -/* 14620 80039220 00000000 */ nop -/* 14624 80039224 4604B182 */ mul.s $f6, $f22, $f4 -/* 14628 80039228 00000000 */ nop -/* 1462C 8003922C 4604A102 */ mul.s $f4, $f20, $f4 -/* 14630 80039230 00000000 */ nop -/* 14634 80039234 C6020028 */ lwc1 $f2, 0x28($s0) -/* 14638 80039238 46061081 */ sub.s $f2, $f2, $f6 -/* 1463C 8003923C C6000030 */ lwc1 $f0, 0x30($s0) -/* 14640 80039240 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 14644 80039244 8C42CAF0 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 14648 80039248 46040001 */ sub.s $f0, $f0, $f4 -/* 1464C 8003924C E6020028 */ swc1 $f2, 0x28($s0) -/* 14650 80039250 E6000030 */ swc1 $f0, 0x30($s0) -/* 14654 80039254 C4420038 */ lwc1 $f2, 0x38($v0) -/* 14658 80039258 46061081 */ sub.s $f2, $f2, $f6 -/* 1465C 8003925C C4400040 */ lwc1 $f0, 0x40($v0) -/* 14660 80039260 46040001 */ sub.s $f0, $f0, $f4 -.LJP_80039264: -/* 14664 80039264 E4420038 */ swc1 $f2, 0x38($v0) -/* 14668 80039268 0800E4C0 */ j .LJP_80039300 -/* 1466C 8003926C E4400040 */ swc1 $f0, 0x40($v0) -.LJP_80039270: -/* 14670 80039270 8E020000 */ lw $v0, 0x0($s0) -/* 14674 80039274 30420006 */ andi $v0, $v0, 0x6 -/* 14678 80039278 10400006 */ beqz $v0, .LJP_80039294 -/* 1467C 8003927C 00000000 */ nop -/* 14680 80039280 3C013ECC */ lui $at, (0x3ECCCCCD >> 16) -/* 14684 80039284 3421CCCD */ ori $at, $at, (0x3ECCCCCD & 0xFFFF) -/* 14688 80039288 44812000 */ mtc1 $at, $f4 -/* 1468C 8003928C 0800E4B6 */ j .LJP_800392D8 -/* 14690 80039290 00000000 */ nop -.LJP_80039294: -/* 14694 80039294 0C00A6FA */ jal get_clamped_angle_diff -/* 14698 80039298 4600E386 */ mov.s $f14, $f28 -/* 1469C 8003929C 3C014234 */ lui $at, (0x42340000 >> 16) -/* 146A0 800392A0 44811000 */ mtc1 $at, $f2 -/* 146A4 800392A4 46000005 */ abs.s $f0, $f0 -/* 146A8 800392A8 4602003C */ c.lt.s $f0, $f2 -/* 146AC 800392AC 00000000 */ nop -/* 146B0 800392B0 45000006 */ bc1f .LJP_800392CC -/* 146B4 800392B4 00000000 */ nop -/* 146B8 800392B8 C6020028 */ lwc1 $f2, 0x28($s0) -/* 146BC 800392BC 46161081 */ sub.s $f2, $f2, $f22 -/* 146C0 800392C0 C6000030 */ lwc1 $f0, 0x30($s0) -/* 146C4 800392C4 0800E4BE */ j .LJP_800392F8 -/* 146C8 800392C8 46140001 */ sub.s $f0, $f0, $f20 -.LJP_800392CC: -/* 146CC 800392CC 3C013F00 */ lui $at, (0x3F000000 >> 16) -/* 146D0 800392D0 44812000 */ mtc1 $at, $f4 -/* 146D4 800392D4 00000000 */ nop -.LJP_800392D8: -/* 146D8 800392D8 4604B002 */ mul.s $f0, $f22, $f4 -/* 146DC 800392DC 00000000 */ nop -/* 146E0 800392E0 4604A102 */ mul.s $f4, $f20, $f4 -/* 146E4 800392E4 00000000 */ nop -/* 146E8 800392E8 C6020028 */ lwc1 $f2, 0x28($s0) -/* 146EC 800392EC 46001081 */ sub.s $f2, $f2, $f0 -/* 146F0 800392F0 C6000030 */ lwc1 $f0, 0x30($s0) -/* 146F4 800392F4 46040001 */ sub.s $f0, $f0, $f4 -.LJP_800392F8: -/* 146F8 800392F8 E6020028 */ swc1 $f2, 0x28($s0) -/* 146FC 800392FC E6000030 */ swc1 $f0, 0x30($s0) -.LJP_80039300: -/* 14700 80039300 C620006C */ lwc1 $f0, 0x6C($s1) -/* 14704 80039304 C6220070 */ lwc1 $f2, 0x70($s1) -/* 14708 80039308 C6240074 */ lwc1 $f4, 0x74($s1) -/* 1470C 8003930C 24020001 */ addiu $v0, $zero, 0x1 -/* 14710 80039310 E6200038 */ swc1 $f0, 0x38($s1) -/* 14714 80039314 E622003C */ swc1 $f2, 0x3C($s1) -/* 14718 80039318 E6240040 */ swc1 $f4, 0x40($s1) -.LJP_8003931C: -/* 1471C 8003931C 8FBF0020 */ lw $ra, 0x20($sp) -/* 14720 80039320 8FB1001C */ lw $s1, 0x1C($sp) -/* 14724 80039324 8FB00018 */ lw $s0, 0x18($sp) -/* 14728 80039328 D7BE0050 */ ldc1 $f30, 0x50($sp) -/* 1472C 8003932C D7BC0048 */ ldc1 $f28, 0x48($sp) -/* 14730 80039330 D7BA0040 */ ldc1 $f26, 0x40($sp) -/* 14734 80039334 D7B80038 */ ldc1 $f24, 0x38($sp) -/* 14738 80039338 D7B60030 */ ldc1 $f22, 0x30($sp) -/* 1473C 8003933C D7B40028 */ ldc1 $f20, 0x28($sp) -/* 14740 80039340 03E00008 */ jr $ra -/* 14744 80039344 27BD0058 */ addiu $sp, $sp, 0x58 diff --git a/ver/us/asm/nonmatchings/npc/npc_do_player_collision.s b/ver/us/asm/nonmatchings/npc/npc_do_player_collision.s deleted file mode 100644 index 39eeedba13..0000000000 --- a/ver/us/asm/nonmatchings/npc/npc_do_player_collision.s +++ /dev/null @@ -1,253 +0,0 @@ -.set noat # allow manual use of $at -.set noreorder # don't insert nops after branches - -glabel npc_do_player_collision -/* 146D8 800392D8 27BDFFA8 */ addiu $sp, $sp, -0x58 -/* 146DC 800392DC AFB1001C */ sw $s1, 0x1c($sp) -/* 146E0 800392E0 0080882D */ daddu $s1, $a0, $zero -/* 146E4 800392E4 AFBF0020 */ sw $ra, 0x20($sp) -/* 146E8 800392E8 AFB00018 */ sw $s0, 0x18($sp) -/* 146EC 800392EC F7BE0050 */ sdc1 $f30, 0x50($sp) -/* 146F0 800392F0 F7BC0048 */ sdc1 $f28, 0x48($sp) -/* 146F4 800392F4 F7BA0040 */ sdc1 $f26, 0x40($sp) -/* 146F8 800392F8 F7B80038 */ sdc1 $f24, 0x38($sp) -/* 146FC 800392FC F7B60030 */ sdc1 $f22, 0x30($sp) -/* 14700 80039300 F7B40028 */ sdc1 $f20, 0x28($sp) -/* 14704 80039304 8E230000 */ lw $v1, ($s1) -/* 14708 80039308 3C108011 */ lui $s0, %hi(gPlayerStatus) -/* 1470C 8003930C 2610EFC8 */ addiu $s0, $s0, %lo(gPlayerStatus) -/* 14710 80039310 30620100 */ andi $v0, $v1, 0x100 -/* 14714 80039314 144000D1 */ bnez $v0, .L8003965C -/* 14718 80039318 0000102D */ daddu $v0, $zero, $zero -/* 1471C 8003931C 3C020400 */ lui $v0, 0x400 -/* 14720 80039320 00621024 */ and $v0, $v1, $v0 -/* 14724 80039324 10400003 */ beqz $v0, .L80039334 -/* 14728 80039328 00000000 */ nop -.L8003932C: -/* 1472C 8003932C 0800E597 */ j .L8003965C -/* 14730 80039330 0000102D */ daddu $v0, $zero, $zero -.L80039334: -/* 14734 80039334 3C02800A */ lui $v0, %hi(gNpcPlayerCollisionsEnabled) -/* 14738 80039338 80420B94 */ lb $v0, %lo(gNpcPlayerCollisionsEnabled)($v0) -/* 1473C 8003933C 504000C7 */ beql $v0, $zero, .L8003965C -/* 14740 80039340 0000102D */ daddu $v0, $zero, $zero -/* 14744 80039344 860200B0 */ lh $v0, 0xb0($s0) -/* 14748 80039348 C604002C */ lwc1 $f4, 0x2c($s0) -/* 1474C 8003934C 44820000 */ mtc1 $v0, $f0 -/* 14750 80039350 00000000 */ nop -/* 14754 80039354 46800020 */ cvt.s.w $f0, $f0 -/* 14758 80039358 46002000 */ add.s $f0, $f4, $f0 -/* 1475C 8003935C C622003C */ lwc1 $f2, 0x3c($s1) -/* 14760 80039360 4602003C */ c.lt.s $f0, $f2 -/* 14764 80039364 00000000 */ nop -/* 14768 80039368 450100BC */ bc1t .L8003965C -/* 1476C 8003936C 0000102D */ daddu $v0, $zero, $zero -/* 14770 80039370 862200A8 */ lh $v0, 0xa8($s1) -/* 14774 80039374 44820000 */ mtc1 $v0, $f0 -/* 14778 80039378 00000000 */ nop -/* 1477C 8003937C 46800020 */ cvt.s.w $f0, $f0 -/* 14780 80039380 46001000 */ add.s $f0, $f2, $f0 -/* 14784 80039384 4604003C */ c.lt.s $f0, $f4 -/* 14788 80039388 00000000 */ nop -/* 1478C 8003938C 450100B3 */ bc1t .L8003965C -/* 14790 80039390 0000102D */ daddu $v0, $zero, $zero -/* 14794 80039394 C63A0038 */ lwc1 $f26, 0x38($s1) -/* 14798 80039398 C61E0028 */ lwc1 $f30, 0x28($s0) -/* 1479C 8003939C C61C0030 */ lwc1 $f28, 0x30($s0) -/* 147A0 800393A0 962200A6 */ lhu $v0, 0xa6($s1) -/* 147A4 800393A4 461AF581 */ sub.s $f22, $f30, $f26 -/* 147A8 800393A8 960300B2 */ lhu $v1, 0xb2($s0) -/* 147AC 800393AC 00021400 */ sll $v0, $v0, 0x10 -/* 147B0 800393B0 4616B082 */ mul.s $f2, $f22, $f22 -/* 147B4 800393B4 00000000 */ nop -/* 147B8 800393B8 00022403 */ sra $a0, $v0, 0x10 -/* 147BC 800393BC 000217C2 */ srl $v0, $v0, 0x1f -/* 147C0 800393C0 C6360040 */ lwc1 $f22, 0x40($s1) -/* 147C4 800393C4 00822021 */ addu $a0, $a0, $v0 -/* 147C8 800393C8 4616E501 */ sub.s $f20, $f28, $f22 -/* 147CC 800393CC 00042043 */ sra $a0, $a0, 1 -/* 147D0 800393D0 00031C00 */ sll $v1, $v1, 0x10 -/* 147D4 800393D4 4614A002 */ mul.s $f0, $f20, $f20 -/* 147D8 800393D8 00000000 */ nop -/* 147DC 800393DC 00031403 */ sra $v0, $v1, 0x10 -/* 147E0 800393E0 00031FC2 */ srl $v1, $v1, 0x1f -/* 147E4 800393E4 00431021 */ addu $v0, $v0, $v1 -/* 147E8 800393E8 00021043 */ sra $v0, $v0, 1 -/* 147EC 800393EC 46001300 */ add.s $f12, $f2, $f0 -/* 147F0 800393F0 4484B000 */ mtc1 $a0, $f22 -/* 147F4 800393F4 00000000 */ nop -/* 147F8 800393F8 4680B5A0 */ cvt.s.w $f22, $f22 -/* 147FC 800393FC 4482A000 */ mtc1 $v0, $f20 -/* 14800 80039400 00000000 */ nop -/* 14804 80039404 4680A520 */ cvt.s.w $f20, $f20 -/* 14808 80039408 46006004 */ sqrt.s $f0, $f12 -/* 1480C 8003940C 46000032 */ c.eq.s $f0, $f0 -/* 14810 80039410 00000000 */ nop -/* 14814 80039414 45010003 */ bc1t .L80039424 -/* 14818 80039418 4614B580 */ add.s $f22, $f22, $f20 -/* 1481C 8003941C 0C0187BC */ jal sqrtf -/* 14820 80039420 00000000 */ nop -.L80039424: -/* 14824 80039424 4600B03C */ c.lt.s $f22, $f0 -/* 14828 80039428 00000000 */ nop -/* 1482C 8003942C 4501FFBF */ bc1t .L8003932C -/* 14830 80039430 E7B60010 */ swc1 $f22, 0x10($sp) -/* 14834 80039434 8E020004 */ lw $v0, 4($s0) -/* 14838 80039438 34428000 */ ori $v0, $v0, 0x8000 -/* 1483C 8003943C AE020004 */ sw $v0, 4($s0) -/* 14840 80039440 C63A006C */ lwc1 $f26, 0x6c($s1) -/* 14844 80039444 461AF581 */ sub.s $f22, $f30, $f26 -/* 14848 80039448 4616B082 */ mul.s $f2, $f22, $f22 -/* 1484C 8003944C 00000000 */ nop -/* 14850 80039450 C6360074 */ lwc1 $f22, 0x74($s1) -/* 14854 80039454 4616E501 */ sub.s $f20, $f28, $f22 -/* 14858 80039458 4614A002 */ mul.s $f0, $f20, $f20 -/* 1485C 8003945C 00000000 */ nop -/* 14860 80039460 46001300 */ add.s $f12, $f2, $f0 -/* 14864 80039464 46006004 */ sqrt.s $f0, $f12 -/* 14868 80039468 46000032 */ c.eq.s $f0, $f0 -/* 1486C 8003946C 00000000 */ nop -/* 14870 80039470 45010004 */ bc1t .L80039484 -/* 14874 80039474 46000606 */ mov.s $f24, $f0 -/* 14878 80039478 0C0187BC */ jal sqrtf -/* 1487C 8003947C 00000000 */ nop -/* 14880 80039480 46000606 */ mov.s $f24, $f0 -.L80039484: -/* 14884 80039484 4600F306 */ mov.s $f12, $f30 -/* 14888 80039488 4406D000 */ mfc1 $a2, $f26 -/* 1488C 8003948C 4407B000 */ mfc1 $a3, $f22 -/* 14890 80039490 0C00A720 */ jal atan2 -/* 14894 80039494 4600E386 */ mov.s $f14, $f28 -/* 14898 80039498 3C0140C9 */ lui $at, 0x40c9 -/* 1489C 8003949C 34210FD0 */ ori $at, $at, 0xfd0 -/* 148A0 800394A0 4481A000 */ mtc1 $at, $f20 -/* 148A4 800394A4 46000686 */ mov.s $f26, $f0 -/* 148A8 800394A8 4614D502 */ mul.s $f20, $f26, $f20 -/* 148AC 800394AC 00000000 */ nop -/* 148B0 800394B0 3C0143B4 */ lui $at, 0x43b4 -/* 148B4 800394B4 44810000 */ mtc1 $at, $f0 -/* 148B8 800394B8 C7A80010 */ lwc1 $f8, 0x10($sp) -/* 148BC 800394BC C61C0080 */ lwc1 $f28, 0x80($s0) -/* 148C0 800394C0 46184601 */ sub.s $f24, $f8, $f24 -/* 148C4 800394C4 4600A503 */ div.s $f20, $f20, $f0 -/* 148C8 800394C8 0C00A85B */ jal sin_rad -/* 148CC 800394CC 4600A306 */ mov.s $f12, $f20 -/* 148D0 800394D0 4600C582 */ mul.s $f22, $f24, $f0 -/* 148D4 800394D4 00000000 */ nop -/* 148D8 800394D8 0C00A874 */ jal cos_rad -/* 148DC 800394DC 4600A306 */ mov.s $f12, $f20 -/* 148E0 800394E0 3C030040 */ lui $v1, 0x40 -/* 148E4 800394E4 8E020004 */ lw $v0, 4($s0) -/* 148E8 800394E8 4600C087 */ neg.s $f2, $f24 -/* 148EC 800394EC 46001502 */ mul.s $f20, $f2, $f0 -/* 148F0 800394F0 00000000 */ nop -/* 148F4 800394F4 00431024 */ and $v0, $v0, $v1 -/* 148F8 800394F8 1040002D */ beqz $v0, .L800395B0 -/* 148FC 800394FC 4600D306 */ mov.s $f12, $f26 -/* 14900 80039500 0C00A70A */ jal get_clamped_angle_diff -/* 14904 80039504 4600E386 */ mov.s $f14, $f28 -/* 14908 80039508 3C014234 */ lui $at, 0x4234 -/* 1490C 8003950C 44811000 */ mtc1 $at, $f2 -/* 14910 80039510 46000005 */ abs.s $f0, $f0 -/* 14914 80039514 4602003C */ c.lt.s $f0, $f2 -/* 14918 80039518 00000000 */ nop -/* 1491C 8003951C 4500000E */ bc1f .L80039558 -/* 14920 80039520 00000000 */ nop -/* 14924 80039524 C6020028 */ lwc1 $f2, 0x28($s0) -/* 14928 80039528 46161081 */ sub.s $f2, $f2, $f22 -/* 1492C 8003952C C6000030 */ lwc1 $f0, 0x30($s0) -/* 14930 80039530 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 14934 80039534 8C42C930 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 14938 80039538 46140001 */ sub.s $f0, $f0, $f20 -/* 1493C 8003953C E6020028 */ swc1 $f2, 0x28($s0) -/* 14940 80039540 E6000030 */ swc1 $f0, 0x30($s0) -/* 14944 80039544 C4420038 */ lwc1 $f2, 0x38($v0) -/* 14948 80039548 46161081 */ sub.s $f2, $f2, $f22 -/* 1494C 8003954C C4400040 */ lwc1 $f0, 0x40($v0) -/* 14950 80039550 0800E569 */ j .L800395A4 -/* 14954 80039554 46140001 */ sub.s $f0, $f0, $f20 -.L80039558: -/* 14958 80039558 3C013F00 */ lui $at, 0x3f00 -/* 1495C 8003955C 44812000 */ mtc1 $at, $f4 -/* 14960 80039560 00000000 */ nop -/* 14964 80039564 4604B182 */ mul.s $f6, $f22, $f4 -/* 14968 80039568 00000000 */ nop -/* 1496C 8003956C 4604A102 */ mul.s $f4, $f20, $f4 -/* 14970 80039570 00000000 */ nop -/* 14974 80039574 C6020028 */ lwc1 $f2, 0x28($s0) -/* 14978 80039578 46061081 */ sub.s $f2, $f2, $f6 -/* 1497C 8003957C C6000030 */ lwc1 $f0, 0x30($s0) -/* 14980 80039580 3C028011 */ lui $v0, %hi(wPartnerNpc) -/* 14984 80039584 8C42C930 */ lw $v0, %lo(wPartnerNpc)($v0) -/* 14988 80039588 46040001 */ sub.s $f0, $f0, $f4 -/* 1498C 8003958C E6020028 */ swc1 $f2, 0x28($s0) -/* 14990 80039590 E6000030 */ swc1 $f0, 0x30($s0) -/* 14994 80039594 C4420038 */ lwc1 $f2, 0x38($v0) -/* 14998 80039598 46061081 */ sub.s $f2, $f2, $f6 -/* 1499C 8003959C C4400040 */ lwc1 $f0, 0x40($v0) -/* 149A0 800395A0 46040001 */ sub.s $f0, $f0, $f4 -.L800395A4: -/* 149A4 800395A4 E4420038 */ swc1 $f2, 0x38($v0) -/* 149A8 800395A8 0800E590 */ j .L80039640 -/* 149AC 800395AC E4400040 */ swc1 $f0, 0x40($v0) -.L800395B0: -/* 149B0 800395B0 8E020000 */ lw $v0, ($s0) -/* 149B4 800395B4 30420006 */ andi $v0, $v0, 6 -/* 149B8 800395B8 10400006 */ beqz $v0, .L800395D4 -/* 149BC 800395BC 00000000 */ nop -/* 149C0 800395C0 3C013ECC */ lui $at, 0x3ecc -/* 149C4 800395C4 3421CCCD */ ori $at, $at, 0xcccd -/* 149C8 800395C8 44812000 */ mtc1 $at, $f4 -/* 149CC 800395CC 0800E586 */ j .L80039618 -/* 149D0 800395D0 00000000 */ nop -.L800395D4: -/* 149D4 800395D4 0C00A70A */ jal get_clamped_angle_diff -/* 149D8 800395D8 4600E386 */ mov.s $f14, $f28 -/* 149DC 800395DC 3C014234 */ lui $at, 0x4234 -/* 149E0 800395E0 44811000 */ mtc1 $at, $f2 -/* 149E4 800395E4 46000005 */ abs.s $f0, $f0 -/* 149E8 800395E8 4602003C */ c.lt.s $f0, $f2 -/* 149EC 800395EC 00000000 */ nop -/* 149F0 800395F0 45000006 */ bc1f .L8003960C -/* 149F4 800395F4 00000000 */ nop -/* 149F8 800395F8 C6020028 */ lwc1 $f2, 0x28($s0) -/* 149FC 800395FC 46161081 */ sub.s $f2, $f2, $f22 -/* 14A00 80039600 C6000030 */ lwc1 $f0, 0x30($s0) -/* 14A04 80039604 0800E58E */ j .L80039638 -/* 14A08 80039608 46140001 */ sub.s $f0, $f0, $f20 -.L8003960C: -/* 14A0C 8003960C 3C013F00 */ lui $at, 0x3f00 -/* 14A10 80039610 44812000 */ mtc1 $at, $f4 -/* 14A14 80039614 00000000 */ nop -.L80039618: -/* 14A18 80039618 4604B002 */ mul.s $f0, $f22, $f4 -/* 14A1C 8003961C 00000000 */ nop -/* 14A20 80039620 4604A102 */ mul.s $f4, $f20, $f4 -/* 14A24 80039624 00000000 */ nop -/* 14A28 80039628 C6020028 */ lwc1 $f2, 0x28($s0) -/* 14A2C 8003962C 46001081 */ sub.s $f2, $f2, $f0 -/* 14A30 80039630 C6000030 */ lwc1 $f0, 0x30($s0) -/* 14A34 80039634 46040001 */ sub.s $f0, $f0, $f4 -.L80039638: -/* 14A38 80039638 E6020028 */ swc1 $f2, 0x28($s0) -/* 14A3C 8003963C E6000030 */ swc1 $f0, 0x30($s0) -.L80039640: -/* 14A40 80039640 C620006C */ lwc1 $f0, 0x6c($s1) -/* 14A44 80039644 C6220070 */ lwc1 $f2, 0x70($s1) -/* 14A48 80039648 C6240074 */ lwc1 $f4, 0x74($s1) -/* 14A4C 8003964C 24020001 */ addiu $v0, $zero, 1 -/* 14A50 80039650 E6200038 */ swc1 $f0, 0x38($s1) -/* 14A54 80039654 E622003C */ swc1 $f2, 0x3c($s1) -/* 14A58 80039658 E6240040 */ swc1 $f4, 0x40($s1) -.L8003965C: -/* 14A5C 8003965C 8FBF0020 */ lw $ra, 0x20($sp) -/* 14A60 80039660 8FB1001C */ lw $s1, 0x1c($sp) -/* 14A64 80039664 8FB00018 */ lw $s0, 0x18($sp) -/* 14A68 80039668 D7BE0050 */ ldc1 $f30, 0x50($sp) -/* 14A6C 8003966C D7BC0048 */ ldc1 $f28, 0x48($sp) -/* 14A70 80039670 D7BA0040 */ ldc1 $f26, 0x40($sp) -/* 14A74 80039674 D7B80038 */ ldc1 $f24, 0x38($sp) -/* 14A78 80039678 D7B60030 */ ldc1 $f22, 0x30($sp) -/* 14A7C 8003967C D7B40028 */ ldc1 $f20, 0x28($sp) -/* 14A80 80039680 03E00008 */ jr $ra -/* 14A84 80039684 27BD0058 */ addiu $sp, $sp, 0x58