From c1d9bbbd2ab61f05559e3bdaf5aad4e008d214a3 Mon Sep 17 00:00:00 2001 From: HailSanta <53960937+HailSanta@users.noreply.github.com> Date: Tue, 14 Mar 2023 04:55:49 -0400 Subject: [PATCH] more world partners (#976) * wip * hm * update * bow * parakarry --------- Co-authored-by: HailSanta --- include/common_structs.h | 24 +- include/npc.h | 2 +- src/16F740.c | 2 +- src/19FAF0.c | 2 +- src/1A5830.c | 4 +- src/23680.c | 6 +- src/77480.c | 4 +- src/7E9D0.c | 8 +- src/7bb60_len_41b0.c | 2 +- src/7fd10_len_b40.c | 4 +- src/encounter.c | 8 +- src/entity/BlueWarpPipe.c | 2 +- src/evt/npc_api.c | 2 +- src/evt/player_api.c | 2 +- src/npc.c | 8 +- src/npc_collision.c | 2 + src/world/action/jump.c | 2 +- src/world/action/use_spinning_flower.c | 2 +- src/world/action/use_tweester.c | 51 +- src/world/common/atomic/WhaleGeyser.inc.c | 2 +- src/world/common/enemy/ai/ParatroopaAI.inc.c | 2 +- .../common/enemy/ai/PiranhaPlantAI.inc.c | 2 +- src/world/common/enemy/ai/SpearGuyAI.inc.c | 4 +- src/world/common/enemy/ai/WanderMeleeAI.inc.c | 2 +- src/world/partner/bombette.c | 538 +++++---- src/world/partner/bombette.h | 12 +- src/world/partner/bow.c | 313 ++--- src/world/partner/bow.h | 8 +- src/world/partner/goombaria.c | 28 +- src/world/partner/goombaria.h | 8 +- src/world/partner/goombario.c | 198 ++-- src/world/partner/goombario.h | 9 +- src/world/partner/goompa.c | 102 +- src/world/partner/goompa.h | 8 +- src/world/partner/kooper.c | 242 ++-- src/world/partner/kooper.h | 8 +- src/world/partner/lakilester.c | 43 +- src/world/partner/lakilester.h | 10 +- src/world/partner/parakarry.c | 1021 +++++++++-------- src/world/partner/parakarry.h | 8 +- src/world/partner/sushie.c | 32 +- src/world/partner/sushie.h | 10 +- src/world/partner/twink.c | 28 +- src/world/partner/twink.h | 8 +- src/world/partner/watt.c | 36 +- src/world/partner/watt.h | 10 +- src/world/partners.c | 100 +- ver/us/symbol_addrs.txt | 282 +++-- 48 files changed, 1650 insertions(+), 1561 deletions(-) diff --git a/include/common_structs.h b/include/common_structs.h index 5c393c4e65..f5465c7883 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -23,6 +23,9 @@ typedef void NoArgCallback(void*); #define IMG_BIN u8 #define PAL_BIN u16 +typedef s32 b32; +typedef s8 b8; + typedef u32 AnimID; typedef struct { @@ -1619,25 +1622,6 @@ typedef struct ColliderTriangle { /* 0x3E */ char unk_3E[2]; } ColliderTriangle; // size = 0x40 -typedef struct PartnerBlueprint { - /* 0x00 */ s32 dmaStart; - /* 0x04 */ s32 dmaEnd; - /* 0x08 */ s32 dmaDest; - /* 0x0C */ s32 isFlying; - /* 0x10 */ UNK_FUN_PTR(fpInit); - /* 0x14 */ EvtScript* spScriptA; - /* 0x18 */ EvtScript* spScriptB; - /* 0x1C */ EvtScript* spScriptC; - /* 0x20 */ EvtScript* spScriptD; - /* 0x24 */ s32 idleAnim; - /* 0x28 */ UNK_FUN_PTR(fpFuncA); - /* 0x2C */ UNK_FUN_PTR(fpFuncB); - /* 0x30 */ UNK_FUN_PTR(fpFuncC); - /* 0x34 */ UNK_FUN_PTR(fpFuncD); - /* 0x38 */ UNK_FUN_PTR(fpFuncE); - /* 0x3C */ EvtScript* spScriptX; -} PartnerBlueprint; // size = 0x40 - typedef struct FontRasterSet { /* 0x00 */ u8 sizeX; /* 0x01 */ u8 sizeY; @@ -2266,7 +2250,7 @@ typedef struct TweesterPhysics { typedef struct PartnerActionStatus { /* 0x000 */ s8 partnerActionState; - /* 0x001 */ s8 partnerAction_unk_1; + /* 0x001 */ b8 partnerAction_unk_1; /* 0x002 */ s8 partnerAction_unk_2; /* 0x003 */ s8 actingPartner; /* 0x004 */ s16 stickX; diff --git a/include/npc.h b/include/npc.h index ce739d47be..89d64b4486 100644 --- a/include/npc.h +++ b/include/npc.h @@ -380,7 +380,7 @@ typedef struct EncounterStatus { /* 0x008 */ s8 unk_08; /* 0x009 */ s8 battleOutcome; /* 0 = won, 1 = lost */ /* 0x00A */ s8 battleTriggerCooldown; ///< set to 15 after victory, 45 after fleeing - /* 0x00B */ s8 merleeCoinBonus; /* triple coins when != 0 */ + /* 0x00B */ b8 hasMerleeCoinBonus; /* triple coins when TRUE */ /* 0x00C */ u8 damageTaken; /* valid after battle */ /* 0x00D */ char unk_0D; /* 0x00E */ s16 coinsEarned; /* valid after battle */ diff --git a/src/16F740.c b/src/16F740.c index 31a7aa25e6..8c1ff6ae14 100644 --- a/src/16F740.c +++ b/src/16F740.c @@ -2104,7 +2104,7 @@ void btl_state_update_end_battle(void) { btl_delete_player_actor(battleStatus->playerActor); if (battleStatus->nextMerleeSpellType == MERLEE_SPELL_COIN_BOOST) { - encounterStatus->merleeCoinBonus = TRUE; + encounterStatus->hasMerleeCoinBonus = TRUE; battleStatus->nextMerleeSpellType = MERLEE_SPELL_0; } diff --git a/src/19FAF0.c b/src/19FAF0.c index a1b8ec3bed..3be4f6b304 100644 --- a/src/19FAF0.c +++ b/src/19FAF0.c @@ -1286,7 +1286,7 @@ ApiStatus PlayerFallToGoal(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -ApiStatus PlayerLandJump(Evt *script, s32 isInitialCall) { +ApiStatus PlayerLandJump(Evt* script, s32 isInitialCall) { Actor* player = gBattleStatus.playerActor; ActorState* walkMovement = &player->state; diff --git a/src/1A5830.c b/src/1A5830.c index 70b95c426c..5cf7ad878d 100644 --- a/src/1A5830.c +++ b/src/1A5830.c @@ -2820,7 +2820,7 @@ ApiStatus func_8027CC10(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } -ApiStatus EnemyDamageTarget(Evt *script, s32 isInitialCall) { +ApiStatus EnemyDamageTarget(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; BattleStatus* battleStatus = &gBattleStatus; s32 actorID = evt_get_variable(script, *args++); @@ -2929,7 +2929,7 @@ ApiStatus EnemyFollowupAfflictTarget(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } -ApiStatus EnemyTestTarget(Evt *script, s32 isInitialCall) { +ApiStatus EnemyTestTarget(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; BattleStatus* battleStatus = &gBattleStatus; s32 actorID = evt_get_variable(script, *args++); diff --git a/src/23680.c b/src/23680.c index 42a121929f..eaf077e7c4 100644 --- a/src/23680.c +++ b/src/23680.c @@ -261,8 +261,8 @@ void spawn_drops(Enemy* enemy) { dropCount += encounter->damageTaken / 2; encounter->damageTaken = 0; } - if (encounter->merleeCoinBonus != 0) { - encounter->merleeCoinBonus = 0; + if (encounter->hasMerleeCoinBonus) { + encounter->hasMerleeCoinBonus = FALSE; dropCount *= 3; } if (is_ability_active(ABILITY_MONEY_MONEY) != 0) { @@ -322,7 +322,7 @@ s32 get_coin_drop_amount(Enemy* enemy) { amt += currentEncounter->damageTaken / 2; } - if (currentEncounter->merleeCoinBonus) { + if (currentEncounter->hasMerleeCoinBonus) { amt *= 3; } diff --git a/src/77480.c b/src/77480.c index 7d2f03fa43..98ef5d360a 100644 --- a/src/77480.c +++ b/src/77480.c @@ -18,7 +18,7 @@ extern f32 D_800F7B48; extern s32 D_800F7B4C; extern s8 D_8015A57A; -extern s32 GoombarioTattleInteractionID; +extern s32 WorldTattleInteractionID; s32 player_raycast_down(f32*, f32*, f32*, f32*); s32 player_raycast_up_corner(f32* x, f32* y, f32* z, f32* length); @@ -693,7 +693,7 @@ void check_input_use_partner(void) { && actionState <= ACTION_STATE_RUN ) { if (playerData->currentPartner == PARTNER_GOOMBARIO) { - GoombarioTattleInteractionID = playerStatus->interactingWithID; + WorldTattleInteractionID = playerStatus->interactingWithID; } partner_use_ability(); } diff --git a/src/7E9D0.c b/src/7E9D0.c index 165d8f49b7..6d81a5789f 100644 --- a/src/7E9D0.c +++ b/src/7E9D0.c @@ -155,15 +155,15 @@ s32 phys_adjust_cam_on_landing(void) { s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_LAVA) { - gCameras[0].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; + gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; ret = 0; } else { - gCameras[0].moveFlags &= ~CAMERA_MOVE_IGNORE_PLAYER_Y; + gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_IGNORE_PLAYER_Y; } } else if (partnerActionStatus->partnerActionState != PARTNER_ACTION_NONE && partnerActionStatus->actingPartner == PARTNER_PARAKARRY) { - gCameras[0].moveFlags |= CAMERA_MOVE_FLAG_2; + gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAG_2; } else { - gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAG_2; + gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAG_2; } return ret; diff --git a/src/7bb60_len_41b0.c b/src/7bb60_len_41b0.c index 4d29e11649..a2580ecad8 100644 --- a/src/7bb60_len_41b0.c +++ b/src/7bb60_len_41b0.c @@ -92,7 +92,7 @@ s32 collision_main_above(void) { if (hitResult >= 0) { if (playerStatus->actionState != ACTION_STATE_FALLING && playerStatus->actionState != ACTION_STATE_STEP_DOWN - && collisionStatus->currentFloor < 0 + && collisionStatus->currentFloor <= NO_COLLIDER ) { if (sp2C <= fabsf(new_var + playerStatus->gravityIntegrator[0])) { do { diff --git a/src/7fd10_len_b40.c b/src/7fd10_len_b40.c index 5435cbe513..8b558cf75c 100644 --- a/src/7fd10_len_b40.c +++ b/src/7fd10_len_b40.c @@ -30,8 +30,8 @@ void func_800E6860(void) { if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE && gPartnerActionStatus.actingPartner == PARTNER_BOW) { Npc* partner = get_npc_unsafe(NPC_PARTNER); - func_802DDEE4(PLAYER_SPRITE_MAIN, -1, 7, 0, 0, 0, playerStatus->alpha1, 0); - func_8003D624(partner, 7, playerStatus->alpha1, 0, 0, 0, 0); + func_802DDEE4(PLAYER_SPRITE_MAIN, -1, FOLD_TYPE_7, 0, 0, 0, playerStatus->alpha1, 0); + func_8003D624(partner, FOLD_TYPE_7, playerStatus->alpha1, 0, 0, 0, 0); playerStatus->alpha2 = 0; } } diff --git a/src/encounter.c b/src/encounter.c index 6a54425b73..b5f56303e9 100644 --- a/src/encounter.c +++ b/src/encounter.c @@ -1400,7 +1400,7 @@ void update_encounters_pre_battle(void) { load_battle(encounter->battle); currentEncounter->unk_07 = 1; currentEncounter->unk_08 = 0; - currentEncounter->merleeCoinBonus = 0; + currentEncounter->hasMerleeCoinBonus = FALSE; currentEncounter->damageTaken = 0; currentEncounter->coinsEarned = 0; currentEncounter->fadeOutAccel = 0; @@ -1433,7 +1433,7 @@ void update_encounters_pre_battle(void) { currentEncounter->unk_08 = 1; currentEncounter->unk_07 = 1; currentEncounter->battleOutcome = OUTCOME_PLAYER_WON; - currentEncounter->merleeCoinBonus = 0; + currentEncounter->hasMerleeCoinBonus = FALSE; currentEncounter->damageTaken = 0; gEncounterState = ENCOUNTER_STATE_POST_BATTLE; currentEncounter->coinsEarned = 0; @@ -1638,7 +1638,7 @@ void update_encounters_post_battle(void) { } break; case ENCOUNTER_SUBSTATE_POST_BATTLE_WON_CHECK_MERLEE_BONUS: - if (currentEncounter->merleeCoinBonus != 0) { + if (currentEncounter->hasMerleeCoinBonus) { if (get_coin_drop_amount(currentEncounter->currentEnemy) != 0) { D_800A0BB0 = start_script(&D_80077C44, EVT_PRIORITY_A, 0); D_800A0BB0->groupFlags = 0; @@ -1651,7 +1651,7 @@ void update_encounters_post_battle(void) { gEncounterSubState = ENCOUNTER_SUBSTATE_POST_BATTLE_PLAY_NPC_DEFEAT; break; case ENCOUNTER_SUBSTATE_POST_BATTLE_PLAY_NPC_DEFEAT: - if ((currentEncounter->merleeCoinBonus != 0) && (get_coin_drop_amount(currentEncounter->currentEnemy) != 0)) { + if (currentEncounter->hasMerleeCoinBonus && (get_coin_drop_amount(currentEncounter->currentEnemy) != 0)) { currentEncounter->fadeOutAccel += 4; currentEncounter->fadeOutAmount -= currentEncounter->fadeOutAccel; if (currentEncounter->fadeOutAmount < 0) { diff --git a/src/entity/BlueWarpPipe.c b/src/entity/BlueWarpPipe.c index 1ddf9d6115..40b2b7fa76 100644 --- a/src/entity/BlueWarpPipe.c +++ b/src/entity/BlueWarpPipe.c @@ -42,7 +42,7 @@ void entity_BlueWarpPipe_wait_for_player_to_get_off(Entity* entity) { } break; case 1: - if (gCollisionStatus.currentFloor < 0) { + if (gCollisionStatus.currentFloor <= NO_COLLIDER) { pipeData->timer = 2; } break; diff --git a/src/evt/npc_api.c b/src/evt/npc_api.c index 50d88cae10..f615213932 100644 --- a/src/evt/npc_api.c +++ b/src/evt/npc_api.c @@ -780,7 +780,7 @@ ApiStatus func_802CF56C(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } -s32 BringPartnerOut(Evt *script, s32 isInitialCall) { +s32 BringPartnerOut(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; NpcBlueprint bp; NpcBlueprint* bpPointer = &bp; diff --git a/src/evt/player_api.c b/src/evt/player_api.c index a4c2eb1bd9..45fe234fb3 100644 --- a/src/evt/player_api.c +++ b/src/evt/player_api.c @@ -508,7 +508,7 @@ ApiStatus DisablePartner(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } -ApiStatus UseEntryHeading(Evt *script, s32 isInitialCall) { +ApiStatus UseEntryHeading(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; MapSettings* mapSettings = get_current_map_settings(); s32 var1 = evt_get_variable(script, *args++); diff --git a/src/npc.c b/src/npc.c index e8d3bfdeae..6c4bfde07c 100644 --- a/src/npc.c +++ b/src/npc.c @@ -146,8 +146,8 @@ s32 create_npc_impl(NpcBlueprint* blueprint, AnimID* animList, s32 isPeachNpc) { npc->isFacingAway = 0; npc->yawCamOffset = 0; npc->turnAroundYawAdjustment = 0; - npc->currentFloor = -1; - npc->currentWall = -1; + npc->currentFloor = NO_COLLIDER; + npc->currentWall = NO_COLLIDER; npc->palSwapType = 0; npc->palSwapPrevType = 0; npc->screenSpaceOffset2D[0] = 0.0f; @@ -644,8 +644,8 @@ void update_npcs(void) { npc->collisionChannel &= ~COLLISION_IGNORE_ENTITIES; } - npc->currentFloor = -1; - npc->currentWall = -1; + npc->currentFloor = NO_COLLIDER; + npc->currentWall = NO_COLLIDER; npc->flags &= ~(NPC_FLAG_COLLDING_FORWARD_WITH_WORLD | NPC_FLAG_COLLDING_WITH_WORLD); npc_do_world_collision(npc); diff --git a/src/npc_collision.c b/src/npc_collision.c index 7c61e494a9..a83e6cf7b1 100644 --- a/src/npc_collision.c +++ b/src/npc_collision.c @@ -615,6 +615,8 @@ s32 npc_test_move_simple_without_slipping(s32 ignoreFlags, f32* x, f32* y, f32* return hitID >= 0; } +// traces lateral collision at position +10, +15, +20, and one unit below height +// returns number of traces that hit s32 npc_test_move_complex_with_slipping(s32 ignoreFlags, f32* x, f32* y, f32* z, f32 length, f32 yaw, f32 height, f32 radius) { f32 startX; diff --git a/src/world/action/jump.c b/src/world/action/jump.c index 869be2495b..a38796e372 100644 --- a/src/world/action/jump.c +++ b/src/world/action/jump.c @@ -34,7 +34,7 @@ void initialize_jump(void) { suggest_player_anim_allow_backward(anim); collisionStatus->lastTouchedFloor = collisionStatus->currentFloor; - collisionStatus->currentFloor = -1; + collisionStatus->currentFloor = NO_COLLIDER; } void action_update_jump(void) { diff --git a/src/world/action/use_spinning_flower.c b/src/world/action/use_spinning_flower.c index 957052381e..7ddae457c4 100644 --- a/src/world/action/use_spinning_flower.c +++ b/src/world/action/use_spinning_flower.c @@ -135,7 +135,7 @@ void action_update_use_spinning_flower(void) { playerStatus->actionSubstate = SUBSTATE_SPIN_UP; playerStatus->currentStateTime = 30; D_802B6EE0 = 0.0f; - gCollisionStatus.currentFloor = -1; + gCollisionStatus.currentFloor = NO_COLLIDER; exec_entity_commandlist(get_entity_by_index(SpinningFlower_EntityIndex)); } break; diff --git a/src/world/action/use_tweester.c b/src/world/action/use_tweester.c index b114d15c99..c63812f637 100644 --- a/src/world/action/use_tweester.c +++ b/src/world/action/use_tweester.c @@ -2,9 +2,8 @@ #include "../partners.h" #include "npc.h" -BSS TweesterPhysics D_802B6370; - -TweesterPhysics* PlayerTweesterPhysics = &D_802B6370; +BSS TweesterPhysics PlayerTweesterPhysicsData; +TweesterPhysics* PlayerTweesterPhysicsPtr = &PlayerTweesterPhysicsData; enum { SUBSTATE_LAUNCH = 0, @@ -24,43 +23,43 @@ void action_update_use_tweester(void) { playerStatus->flags |= (PS_FLAG_ROTATION_LOCKED | PS_FLAG_FLYING); suggest_player_anim_allow_backward(ANIM_MarioW2_FlailArms); playerStatus->actionSubstate = SUBSTATE_LAUNCH; - mem_clear(PlayerTweesterPhysics, sizeof(*PlayerTweesterPhysics)); - PlayerTweesterPhysics->radius = fabsf(dist2D(playerStatus->position.x, playerStatus->position.z, entity->position.x, entity->position.z)); - PlayerTweesterPhysics->angle = atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z); - PlayerTweesterPhysics->angularVelocity = 6.0f; - PlayerTweesterPhysics->liftoffVelocityPhase = 50.0f; - PlayerTweesterPhysics->countdown = 120; + mem_clear(PlayerTweesterPhysicsPtr, sizeof(*PlayerTweesterPhysicsPtr)); + PlayerTweesterPhysicsPtr->radius = fabsf(dist2D(playerStatus->position.x, playerStatus->position.z, entity->position.x, entity->position.z)); + PlayerTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, playerStatus->position.x, playerStatus->position.z); + PlayerTweesterPhysicsPtr->angularVelocity = 6.0f; + PlayerTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; + PlayerTweesterPhysicsPtr->countdown = 120; sfx_play_sound_at_player(SOUND_TWEESTER_LAUNCH, SOUND_SPACE_MODE_0); } switch (playerStatus->actionSubstate) { case SUBSTATE_LAUNCH: - sin_cos_rad(DEG_TO_RAD(PlayerTweesterPhysics->angle), &sinAngle, &cosAngle); + sin_cos_rad(DEG_TO_RAD(PlayerTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysics->radius); - playerStatus->position.z = entity->position.z - (cosAngle * PlayerTweesterPhysics->radius); + playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysicsPtr->radius); + playerStatus->position.z = entity->position.z - (cosAngle * PlayerTweesterPhysicsPtr->radius); - PlayerTweesterPhysics->angle = clamp_angle(PlayerTweesterPhysics->angle - PlayerTweesterPhysics->angularVelocity); + PlayerTweesterPhysicsPtr->angle = clamp_angle(PlayerTweesterPhysicsPtr->angle - PlayerTweesterPhysicsPtr->angularVelocity); - if (PlayerTweesterPhysics->radius > 20.0f) { - PlayerTweesterPhysics->radius--; - } else if (PlayerTweesterPhysics->radius < 19.0f) { - PlayerTweesterPhysics->radius++; + if (PlayerTweesterPhysicsPtr->radius > 20.0f) { + PlayerTweesterPhysicsPtr->radius--; + } else if (PlayerTweesterPhysicsPtr->radius < 19.0f) { + PlayerTweesterPhysicsPtr->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(PlayerTweesterPhysics->liftoffVelocityPhase)) * 3.0f; - PlayerTweesterPhysics->liftoffVelocityPhase += 3.0f; - if (PlayerTweesterPhysics->liftoffVelocityPhase > 150.0f) { - PlayerTweesterPhysics->liftoffVelocityPhase = 150.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(PlayerTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; + PlayerTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + if (PlayerTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { + PlayerTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; } playerStatus->position.y += liftoffVelocity; - playerStatus->spriteFacingAngle = clamp_angle(360.0f - PlayerTweesterPhysics->angle); - PlayerTweesterPhysics->angularVelocity += 0.6; - if (PlayerTweesterPhysics->angularVelocity > 40.0f) { - PlayerTweesterPhysics->angularVelocity = 40.0f; + playerStatus->spriteFacingAngle = clamp_angle(360.0f - PlayerTweesterPhysicsPtr->angle); + PlayerTweesterPhysicsPtr->angularVelocity += 0.6; + if (PlayerTweesterPhysicsPtr->angularVelocity > 40.0f) { + PlayerTweesterPhysicsPtr->angularVelocity = 40.0f; } - if (--PlayerTweesterPhysics->countdown == 0) { + if (--PlayerTweesterPhysicsPtr->countdown == 0) { playerStatus->actionSubstate++; // SUBSTATE_DONE entity_start_script(entity); } diff --git a/src/world/common/atomic/WhaleGeyser.inc.c b/src/world/common/atomic/WhaleGeyser.inc.c index 25d6efb8e1..41da05169b 100644 --- a/src/world/common/atomic/WhaleGeyser.inc.c +++ b/src/world/common/atomic/WhaleGeyser.inc.c @@ -31,7 +31,7 @@ API_CALLABLE(N(SetWhaleGeyserPos)) { return ApiStatus_DONE2; } -ApiStatus N(DisposeWhaleGeyser)(Evt *script, s32 isInitialCall) { +ApiStatus N(DisposeWhaleGeyser)(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; EffectInstance* effect = (EffectInstance*) evt_get_variable(script, *args++); diff --git a/src/world/common/enemy/ai/ParatroopaAI.inc.c b/src/world/common/enemy/ai/ParatroopaAI.inc.c index b0af4fd981..0cedf06fb4 100644 --- a/src/world/common/enemy/ai/ParatroopaAI.inc.c +++ b/src/world/common/enemy/ai/ParatroopaAI.inc.c @@ -55,7 +55,7 @@ void N(ParatroopaAI_Dive)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } -void N(ParatroopaAI_Overshoot)(Evt *script, MobileAISettings *arg1, EnemyDetectVolume *arg2) +void N(ParatroopaAI_Overshoot)(Evt* script, MobileAISettings *arg1, EnemyDetectVolume *arg2) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); diff --git a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c index b1b2513351..51f599b3b2 100644 --- a/src/world/common/enemy/ai/PiranhaPlantAI.inc.c +++ b/src/world/common/enemy/ai/PiranhaPlantAI.inc.c @@ -266,7 +266,7 @@ void N(PiranhaPlantAI_13)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } -void N(PiranhaPlantAI_LosePlayer)(Evt *script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { +void N(PiranhaPlantAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); s32 retVal; diff --git a/src/world/common/enemy/ai/SpearGuyAI.inc.c b/src/world/common/enemy/ai/SpearGuyAI.inc.c index d6225242cd..777fa3f4ff 100644 --- a/src/world/common/enemy/ai/SpearGuyAI.inc.c +++ b/src/world/common/enemy/ai/SpearGuyAI.inc.c @@ -13,7 +13,7 @@ void N(SpearGuyAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDe script->AI_TEMP_STATE = AI_STATE_LOITER; } -void N(SpearGuyAI_Loiter)(Evt *script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { +void N(SpearGuyAI_Loiter)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume* territory) { Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); s32 d100; @@ -80,7 +80,7 @@ void N(SpearGuyAI_Loiter)(Evt *script, MobileAISettings* aiSettings, EnemyDetect // prerequisites #include "world/common/enemy/ai/WanderMeleeAI.inc.c" -ApiStatus N(SpearGuyAI_Main)(Evt *script, s32 isInitialCall) { +ApiStatus N(SpearGuyAI_Main)(Evt* script, s32 isInitialCall) { Enemy* enemy = script->owner1.enemy; Npc *npc = get_npc_unsafe(enemy->npcID); Bytecode* args = script->ptrReadPos; diff --git a/src/world/common/enemy/ai/WanderMeleeAI.inc.c b/src/world/common/enemy/ai/WanderMeleeAI.inc.c index 246de7350f..9b11ed34eb 100644 --- a/src/world/common/enemy/ai/WanderMeleeAI.inc.c +++ b/src/world/common/enemy/ai/WanderMeleeAI.inc.c @@ -13,7 +13,7 @@ // prerequisites #include "world/common/enemy/ai/MeleeHitbox.inc.c" -ApiStatus N(WanderMeleeAI_Main)(Evt *script, s32 isInitialCall) { +ApiStatus N(WanderMeleeAI_Main)(Evt* script, s32 isInitialCall) { Enemy* enemy = script->owner1.enemy; Npc *npc = get_npc_unsafe(enemy->npcID); Bytecode* args = script->ptrReadPos; diff --git a/src/world/partner/bombette.c b/src/world/partner/bombette.c index ecc050d14f..d3f13fab6e 100644 --- a/src/world/partner/bombette.c +++ b/src/world/partner/bombette.c @@ -3,34 +3,38 @@ #include "effects.h" #include "sprite/npc/WorldBombette.h" -BSS s32 D_802BE920; -BSS s32 D_802BE924; -BSS s32 D_802BE928; -BSS s32 D_802BE92C; -BSS s32 D_802BE930; -BSS s32 D_802BE934; -BSS s32 D_802BE938; -BSS s32 D_802BE93C; -BSS TweesterPhysics BombetteTweesterPhysics; +#define NAMESPACE world_bombette + +BSS b32 N(PlayerWasFacingLeft); +BSS b32 N(PlayingFuseSound); +BSS b32 N(IsBlasting); // TRUE for 3 frames while using ability +BSS b32 N(LockingPlayerInput); +BSS b32 N(MaintainPosAfterBlast); +BSS b32 N(TriggeredEarlyDetonation); +BSS b32 N(MovementBlocked); +BSS s32 N(D_802BE93C); // unused (padding?) void entity_try_partner_interaction_trigger(s32 arg0); -void func_802BD100_317E50(Npc* npc) { +void N(blast_affect_entities)(Npc* npc) { f32 x, y, z; f32 angle = 0.0f; + // first pass looking for entities while (angle < 360.0f) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_taller_with_slipping(0x100000, &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), - npc->collisionHeight, npc->collisionRadius) != 0) { + if (npc_test_move_taller_with_slipping(COLLISION_ONLY_ENTITIES, + &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), + npc->collisionHeight, npc->collisionRadius) + ) { break; - } else { - angle += 45.0f; } + angle += 45.0f; } + // second pass looking for everything but entities if (angle >= 360.0f) { angle = 0.0f; @@ -38,52 +42,57 @@ void func_802BD100_317E50(Npc* npc) { x = npc->pos.x; y = npc->pos.y; z = npc->pos.z; - if (npc_test_move_taller_with_slipping(0x40000, &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), - npc->collisionHeight, npc->collisionRadius) != 0) { + if (npc_test_move_taller_with_slipping(COLLISION_IGNORE_ENTITIES, + &x, &y, &z, 30.0f, clamp_angle(npc->yaw + angle), + npc->collisionHeight, npc->collisionRadius) + ) { break; - } else { - angle += 45.0f; } + angle += 45.0f; } - if (!(angle >= 360.0f)) { - if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) { - entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); - } - } - } else { - if (NpcHitQueryColliderID >= 0 && (NpcHitQueryColliderID & COLLISION_WITH_ENTITY_BIT) != 0) { - entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); + if (angle >= 360.0f) { + 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); + } } -void world_bombette_init(Npc* bombette) { +void N(init)(Npc* bombette) { bombette->collisionHeight = 28; bombette->collisionRadius = 24; - D_802BE928 = 0; - D_802BE924 = 0; + N(IsBlasting) = FALSE; + N(PlayingFuseSound) = FALSE; } -ApiStatus func_802BD300_318050(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(TakeOut)) { Npc* bombette = script->owner2.npc; if (isInitialCall) { partner_init_get_out(bombette); } - return partner_get_out(bombette) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_get_out(bombette)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_bombette_take_out = { - EVT_CALL(func_802BD300_318050) +EvtScript EVS_WorldBombette_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -TweesterPhysics* BombetteTweesterPhysicsPtr = &BombetteTweesterPhysics; +BSS TweesterPhysics N(TweesterPhysicsData); +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* bombette = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -91,7 +100,7 @@ ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) { if (isInitialCall) { partner_walking_enable(bombette, 1); - mem_clear(BombetteTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics)); TweesterTouchingPartner = NULL; } @@ -105,61 +114,61 @@ ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - switch (BombetteTweesterPhysicsPtr->state) { + switch (N(TweesterPhysicsPtr)->state) { case TWEESTER_PARTNER_INIT: - BombetteTweesterPhysicsPtr->state++; - BombetteTweesterPhysicsPtr->prevFlags = bombette->flags; - BombetteTweesterPhysicsPtr->radius = fabsf(dist2D(bombette->pos.x, bombette->pos.z, + N(TweesterPhysicsPtr)->state++; + N(TweesterPhysicsPtr)->prevFlags = bombette->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(bombette->pos.x, bombette->pos.z, entity->position.x, entity->position.z)); - BombetteTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, bombette->pos.x, bombette->pos.z); - BombetteTweesterPhysicsPtr->angularVelocity = 6.0f; - BombetteTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - BombetteTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; bombette->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; bombette->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: - sin_cos_rad(DEG_TO_RAD(BombetteTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - bombette->pos.x = entity->position.x + (sinAngle * BombetteTweesterPhysicsPtr->radius); - bombette->pos.z = entity->position.z - (cosAngle * BombetteTweesterPhysicsPtr->radius); - BombetteTweesterPhysicsPtr->angle = clamp_angle(BombetteTweesterPhysicsPtr->angle - BombetteTweesterPhysicsPtr->angularVelocity); + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); + bombette->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + bombette->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); - if (BombetteTweesterPhysicsPtr->radius > 20.0f) { - BombetteTweesterPhysicsPtr->radius--; - } else if (BombetteTweesterPhysicsPtr->radius < 19.0f) { - BombetteTweesterPhysicsPtr->radius++; + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius--; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(BombetteTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - BombetteTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (BombetteTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - BombetteTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } bombette->pos.y += liftoffVelocity; - bombette->renderYaw = clamp_angle(360.0f - BombetteTweesterPhysicsPtr->angle); - BombetteTweesterPhysicsPtr->angularVelocity += 0.8; + bombette->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (BombetteTweesterPhysicsPtr->angularVelocity > 40.0f) { - BombetteTweesterPhysicsPtr->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--BombetteTweesterPhysicsPtr->countdown == 0) { - BombetteTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case TWEESTER_PARTNER_HOLD: - bombette->flags = BombetteTweesterPhysicsPtr->prevFlags; - BombetteTweesterPhysicsPtr->countdown = 30; - BombetteTweesterPhysicsPtr->state++; + bombette->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case TWEESTER_PARTNER_RELEASE: partner_walking_update_player_tracking(bombette); partner_walking_update_motion(bombette); - if (--BombetteTweesterPhysicsPtr->countdown == 0) { - BombetteTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; @@ -167,91 +176,96 @@ ApiStatus func_802BD338_318088(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_bombette_update = { - EVT_CALL(func_802BD338_318088) +EvtScript EVS_WorldBombette_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -void func_802BD6DC_31842C(Npc* npc) { +void N(try_cancel_tweester)(Npc* npc) { if (TweesterTouchingPartner != NULL) { TweesterTouchingPartner = NULL; - npc->flags = BombetteTweesterPhysicsPtr->prevFlags; - BombetteTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + npc->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking(npc); } } -s32 world_bombette_can_use_ability(Npc* npc) { +s32 N(can_use_ability)(Npc* npc) { if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) { - D_802BE934 = 1; + N(TriggeredEarlyDetonation) = TRUE; return FALSE; } return TRUE; } -s32 world_bombette_can_player_pause(Npc* npc) { +s32 N(can_player_pause)(Npc* npc) { return gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE; } -ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall); - -ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { +API_CALLABLE(N(UseAbility)) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; Camera* camera = &gCameras[CAM_DEFAULT]; - Npc* npc = evt->owner2.npc; - u16 temp_ret = ApiStatus_BLOCK; - f32 x; - f32 y; - f32 z; + Npc* npc = script->owner2.npc; + u16 temp_ret; + f32 x, y, z; f32 hitDepth; - f32* zPtr; - f32* xPtr; f32 temp_f0; - f32 temp_f0_2; - f32 temp_f0_5; - s32 var_v0_5; - f32 temp1; + f32 angleToPlayer; + + #define USE_STATE functionTemp[0] + enum { + BLAST_STATE_BEGIN = 20, + BLAST_STATE_GATHER = 21, + BLAST_STATE_LIFT = 1, + BLAST_STATE_DEPLOY = 2, + BLAST_STATE_EXPLODE = 3, + BLAST_STATE_LIFTOFF = 4, + BLAST_STATE_FLY = 5, + BLAST_STATE_FALL = 6, + BLAST_STATE_CANCEL = 7, + BLAST_STATE_FINISH = 8, + }; if (gCurrentEncounter.unk_08 != 0) { return ApiStatus_BLOCK; } if (isInitialCall) { - func_802BD6DC_31842C(npc); - evt->functionTemp[0] = 20; + N(try_cancel_tweester)(npc); + script->USE_STATE = BLAST_STATE_BEGIN; } - switch (evt->functionTemp[0]) { - case 20: + switch (script->USE_STATE) { + case BLAST_STATE_BEGIN: if ((playerStatus->inputDisabledCount != 0) || (playerStatus->flags & PS_FLAG_JUMPING) || !(npc->flags & NPC_FLAG_GROUNDED)) { return ApiStatus_DONE2; } disable_player_input(); - evt->functionTemp[3] = playerStatus->inputDisabledCount; - D_802BE92C = 1; - D_802BE928 = 0; - D_802BE930 = 0; - D_802BE934 = 0; + script->functionTemp[3] = playerStatus->inputDisabledCount; + N(LockingPlayerInput) = TRUE; + N(IsBlasting) = FALSE; + N(MaintainPosAfterBlast) = FALSE; + N(TriggeredEarlyDetonation) = FALSE; npc->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8); partnerActionStatus->partnerActionState = PARTNER_ACTION_USE; partnerActionStatus->actingPartner = PARTNER_BOMBETTE; - D_802BE920 = partner_force_player_flip_done(); + N(PlayerWasFacingLeft) = partner_force_player_flip_done(); enable_npc_blur(npc); npc->duration = 4; npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - evt->functionTemp[0] = 21; - case 21: + script->USE_STATE = BLAST_STATE_GATHER; + case BLAST_STATE_GATHER: if (playerStatus->actionState == ACTION_STATE_HIT_FIRE || playerStatus->actionState == ACTION_STATE_KNOCKBACK) { disable_npc_blur(npc); - evt->functionTemp[0] = 7; + script->USE_STATE = BLAST_STATE_CANCEL; break; } if (playerStatus->flags & PS_FLAG_JUMPING) { - evt->functionTemp[0] = 7; + script->USE_STATE = BLAST_STATE_CANCEL; break; } npc->moveToPos.x = playerStatus->position.x; @@ -259,7 +273,7 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { npc->moveToPos.z = playerStatus->position.z; npc->currentAnim = ANIM_WorldBombette_Run; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 0.0f, playerStatus->targetYaw); - temp_f0 = clamp_angle(playerStatus->targetYaw + ((D_802BE920 != 0) ? (-90.0f) : (90.0f))); + temp_f0 = clamp_angle(playerStatus->targetYaw + (N(PlayerWasFacingLeft) ? -90.0f : 90.0f)); add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, playerStatus->colliderDiameter / 4, temp_f0); npc->pos.x += (npc->moveToPos.x - npc->pos.x) / npc->duration; npc->pos.y += (npc->moveToPos.y - npc->pos.y) / npc->duration; @@ -268,10 +282,11 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { if (npc->duration != 0) { break; } - if (evt->functionTemp[3] < playerStatus->inputDisabledCount) { + if (script->functionTemp[3] < playerStatus->inputDisabledCount) { disable_npc_blur(npc); + // TODO possible to remove float temp here? should be: evt->USE_STATE = BLAST_STATE_CANCEL temp_f0 = 0; - evt->functionTemp[(u8)temp_f0] = 7; + script->functionTemp[(u8)temp_f0] = BLAST_STATE_CANCEL; break; } npc->pos.x = npc->moveToPos.x; @@ -281,106 +296,118 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { suggest_player_anim_allow_backward(ANIM_MarioW1_Lift); npc->yaw = playerStatus->targetYaw; npc->currentAnim = ANIM_WorldBombette_Walk; - evt->functionTemp[0] = 1; - evt->functionTemp[1] = 10; - case 1: + script->USE_STATE = BLAST_STATE_LIFT; + script->functionTemp[1] = 10; + // fallthrough + case BLAST_STATE_LIFT: if (playerStatus->actionState == ACTION_STATE_HIT_FIRE || playerStatus->actionState == ACTION_STATE_KNOCKBACK) { - evt->functionTemp[0] = 7; + script->USE_STATE = BLAST_STATE_CANCEL; break; } npc->pos.y = playerStatus->position.y + playerStatus->colliderHeight; npc->yaw = playerStatus->targetYaw; - if (evt->functionTemp[1] == 1) { + if (script->functionTemp[1] == 1) { suggest_player_anim_allow_backward(ANIM_MarioW1_PlaceItem); } - if (evt->functionTemp[1] != 0) { - evt->functionTemp[1]--; + if (script->functionTemp[1] != 0) { + script->functionTemp[1]--; break; } sfx_play_sound_at_npc(SOUND_80000000, SOUND_SPACE_MODE_0, NPC_PARTNER); - D_802BE924 = 1; + N(PlayingFuseSound) = TRUE; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 0.0f, npc->yaw); npc->currentAnim = ANIM_WorldBombette_WalkLit; npc->jumpVelocity = 0.0f; - D_802BE938 = 0; + N(MovementBlocked) = FALSE; npc->flags |= NPC_FLAG_GRAVITY; npc->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; npc->moveSpeed = 1.0f; - evt->functionTemp[0] = 2; - evt->functionTemp[1] = 50; - case 2: + script->USE_STATE = BLAST_STATE_DEPLOY; + script->functionTemp[1] = 50; + // fallthrough + case BLAST_STATE_DEPLOY: if ((playerStatus->animFlags & PA_FLAG_INTERRUPT_USE_PARTNER) || (playerStatus->actionState == ACTION_STATE_HIT_FIRE || playerStatus->actionState == ACTION_STATE_KNOCKBACK)) { - evt->functionTemp[0] = 7; + script->USE_STATE = BLAST_STATE_CANCEL; break; } - if (evt->functionTemp[1] < 45) { - if (!(npc->flags & NPC_FLAG_COLLDING_WITH_WORLD) && (D_802BE938 == 0)) { + if (script->functionTemp[1] < 45) { + if (!(npc->flags & NPC_FLAG_COLLDING_WITH_WORLD) && !N(MovementBlocked)) { npc_move_heading(npc, npc->moveSpeed, npc->yaw); spawn_surface_effects(npc, SURFACE_INTERACT_WALK); } else { - D_802BE938 = 1; + N(MovementBlocked) = TRUE; } } + + // start explosion immediately when touching lava or spikes x = npc->pos.x; 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) != 0) && (((u32) ((get_collider_flags(NpcHitQueryColliderID) & 0xFF) - 2)) < 2U)) { - if (playerStatus->actionState == ACTION_STATE_IDLE) { - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - } - npc->currentAnim = ANIM_WorldBombette_AboutToExplode; - npc->flags &= ~NPC_FLAG_GRAVITY; - evt->functionTemp[1] = 2; - evt->functionTemp[0] = 3; - if (D_802BE92C != 0) { - D_802BE92C = 0; - enable_player_input(); - } - } else { - if (!(evt->functionTemp[1] & 3)) { - if (gGameStatusPtr->frameCounter & 1) { - sfx_play_sound_at_npc(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, NPC_PARTNER); - } else { - sfx_play_sound_at_npc(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, NPC_PARTNER); - } - } - if (evt->functionTemp[1] == 40) { + 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 (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { if (playerStatus->actionState == ACTION_STATE_IDLE) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } - enable_player_input(); - D_802BE92C = 0; - } - npc_do_other_npc_collision(npc); - if (npc->flags & NPC_FLAG_COLLIDING_WITH_NPC) { - if (D_802BE92C != 0) { - D_802BE92C = 0; + npc->currentAnim = ANIM_WorldBombette_AboutToExplode; + npc->flags &= ~NPC_FLAG_GRAVITY; + script->functionTemp[1] = 2; + script->USE_STATE = BLAST_STATE_EXPLODE; + if (N(LockingPlayerInput)) { + N(LockingPlayerInput) = FALSE; enable_player_input(); } - } else if (D_802BE934 == 0) { - if (evt->functionTemp[1] != 0) { - evt->functionTemp[1]--; - break; - } + break; } - npc->currentAnim = ANIM_WorldBombette_AboutToExplode; - evt->functionTemp[1] = 20; - evt->functionTemp[0] = 3; + } + + // play walking sounds + if (!(script->functionTemp[1] & 3)) { + if (gGameStatusPtr->frameCounter & 1) { + sfx_play_sound_at_npc(SOUND_STEP_NORMAL1, SOUND_SPACE_MODE_0, NPC_PARTNER); + } else { + sfx_play_sound_at_npc(SOUND_STEP_NORMAL2, SOUND_SPACE_MODE_0, NPC_PARTNER); + } + } + + // unlock player movement after 40 frames + if (script->functionTemp[1] == 40) { if (playerStatus->actionState == ACTION_STATE_IDLE) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } + enable_player_input(); + N(LockingPlayerInput) = FALSE; + } + + npc_do_other_npc_collision(npc); + if (npc->flags & NPC_FLAG_COLLIDING_WITH_NPC) { + if (N(LockingPlayerInput)) { + N(LockingPlayerInput) = FALSE; + enable_player_input(); + } + } else if (!N(TriggeredEarlyDetonation)) { + if (script->functionTemp[1] != 0) { + script->functionTemp[1]--; + break; + } + } + npc->currentAnim = ANIM_WorldBombette_AboutToExplode; + script->functionTemp[1] = 20; + script->USE_STATE = BLAST_STATE_EXPLODE; + if (playerStatus->actionState == ACTION_STATE_IDLE) { + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } } - switch (evt->functionTemp[0]) { - case 3: - if (evt->functionTemp[1] != 0) { - evt->functionTemp[1]--; + switch (script->USE_STATE) { + case BLAST_STATE_EXPLODE: + if (script->functionTemp[1] != 0) { + script->functionTemp[1]--; break; } - if (D_802BE924 != 0) { - D_802BE924 = 0; + if (N(PlayingFuseSound)) { + N(PlayingFuseSound) = FALSE; sfx_stop_sound(SOUND_80000000); } fx_explosion(gPlayerData.partners[gPlayerData.currentPartner].level, npc->pos.x, npc->pos.y + (npc->collisionHeight * 0.5f), npc->pos.z); @@ -401,19 +428,19 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { collisionStatus->bombetteExplosionPos.x = npc->pos.x; collisionStatus->bombetteExplosionPos.y = npc->pos.y; collisionStatus->bombetteExplosionPos.z = npc->pos.z; - func_802BD100_317E50(npc); - D_802BE928 = 1; + N(blast_affect_entities)(npc); + N(IsBlasting) = TRUE; partnerActionStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_2; - evt->functionTemp[1] = 3; - evt->functionTemp[0]++; + script->functionTemp[1] = 3; + script->USE_STATE++; break; - case 4: - if (evt->functionTemp[1] != 0) { - evt->functionTemp[1]--; + case BLAST_STATE_LIFTOFF: + if (script->functionTemp[1] != 0) { + script->functionTemp[1]--; break; } partnerActionStatus->partnerActionState = PARTNER_ACTION_BOMBETTE_3; - D_802BE928 = 0; + N(IsBlasting) = FALSE; npc->jumpVelocity = ((playerStatus->position.y - npc->pos.y) / 20.0f) + 30.0; npc->moveSpeed = 0.8f; npc->yaw = rand_int(360); @@ -425,25 +452,25 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { collisionStatus->bombetteExplosionPos.y = npc->pos.y; collisionStatus->bombetteExplosionPos.z = npc->pos.z; npc->currentAnim = ANIM_WorldBombette_Aftermath; - temp1 = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); - if (!(get_clamped_angle_diff(camera->currentYaw, temp1) < 0.0f)) { - evt->functionTemp[2] = 1; + angleToPlayer = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); + if (!(get_clamped_angle_diff(camera->currentYaw, angleToPlayer) < 0.0f)) { + script->functionTemp[2] = 1; } else { - evt->functionTemp[2] = -1; + script->functionTemp[2] = -1; } - evt->functionTemp[1] = 10; - evt->functionTemp[0] = 5; + script->functionTemp[1] = 10; + script->USE_STATE = BLAST_STATE_FLY; break; - case 5: + case BLAST_STATE_FLY: npc->pos.y += npc->jumpVelocity; npc->jumpVelocity -= npc->jumpScale; - npc->rotation.z -= (evt->functionTemp[2] * 79) / 2; - npc->rotation.x -= (evt->functionTemp[2] * 67) / 2; - if (evt->functionTemp[1] != 0) { - evt->functionTemp[1]--; + npc->rotation.z -= (script->functionTemp[2] * 79) / 2; + npc->rotation.x -= (script->functionTemp[2] * 67) / 2; + if (script->functionTemp[1] != 0) { + script->functionTemp[1]--; break; } - if (D_802BE930 == 0) { + if (!N(MaintainPosAfterBlast)) { npc->pos.x = playerStatus->position.x; npc->pos.z = playerStatus->position.z; } @@ -452,16 +479,16 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { npc->jumpVelocity = 0.0f; npc->currentAnim = ANIM_WorldBombette_Aftermath; npc->flags |= NPC_FLAG_JUMPING; - evt->functionTemp[0] = 6; + script->USE_STATE = BLAST_STATE_FALL; break; - case 6: + case BLAST_STATE_FALL: if (npc->pos.y + 10.0f < playerStatus->position.y + playerStatus->colliderHeight) { npc->flags &= ~NPC_FLAG_JUMPING; if (fabsf(playerStatus->position.y - npc->pos.y) < 500.0) { - evt->functionTemp[0] = 8; + script->USE_STATE = BLAST_STATE_FINISH; break; } else if (npc_try_snap_to_ground(npc, npc->jumpVelocity)) { - evt->functionTemp[0] = 7; + script->USE_STATE = BLAST_STATE_CANCEL; break; } } @@ -470,39 +497,41 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { if (npc->jumpVelocity < -8.0) { npc->jumpVelocity = -8.0f; } - npc->rotation.z -= (evt->functionTemp[2] * 79) / 2; - npc->rotation.x -= (evt->functionTemp[2] * 67) / 2; + npc->rotation.z -= (script->functionTemp[2] * 79) / 2; + npc->rotation.x -= (script->functionTemp[2] * 67) / 2; break; } - switch (evt->functionTemp[0]) { - case 7: + //TODO clean up this return + temp_ret = ApiStatus_BLOCK; + switch (script->USE_STATE) { + case BLAST_STATE_CANCEL: if (playerStatus->actionState == ACTION_STATE_IDLE) { suggest_player_anim_allow_backward(ANIM_Mario1_Idle); } - if (D_802BE92C != 0) { - D_802BE92C = 0; + if (N(LockingPlayerInput)) { + N(LockingPlayerInput) = FALSE; enable_player_input(); } partnerActionStatus->partnerActionState = ACTION_STATE_IDLE; partnerActionStatus->actingPartner = PARTNER_NONE; npc->jumpVelocity = 0.0f; - D_802BE928 = 0; - D_802BE934 = 0; + N(IsBlasting) = FALSE; + N(TriggeredEarlyDetonation) = FALSE; npc->pos.y = playerStatus->position.y; npc->rotation.x = 0.0f; npc->rotation.z = 0.0f; npc->currentAnim = ANIM_WorldBombette_Idle; partner_clear_player_tracking(npc); - if (D_802BE924 != 0) { - D_802BE924 = 0; + if (N(PlayingFuseSound)) { + N(PlayingFuseSound) = FALSE; sfx_stop_sound(SOUND_80000000); } temp_ret = ApiStatus_DONE2; return temp_ret; - case 8: - if (D_802BE92C != 0) { - D_802BE92C = 0; + case BLAST_STATE_FINISH: + if (N(LockingPlayerInput)) { + N(LockingPlayerInput) = FALSE; enable_player_input(); } partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; @@ -515,20 +544,18 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { npc->pos.x = playerStatus->position.x; npc->pos.y = playerStatus->position.y; npc->pos.z = playerStatus->position.z; - D_802BE928 = 0; - D_802BE934 = 0; - xPtr = &npc->pos.x; - zPtr = &npc->pos.z; - if (D_802BE920 == 0) { - add_vec2D_polar(xPtr, zPtr, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw + 90.0f)); + N(IsBlasting) = FALSE; + N(TriggeredEarlyDetonation) = FALSE; + if (!N(PlayerWasFacingLeft)) { + add_vec2D_polar(&npc->pos.x, &npc->pos.z, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw + 90.0f)); } else { - add_vec2D_polar(xPtr, zPtr, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw - 90.0f)); + add_vec2D_polar(&npc->pos.x, &npc->pos.z, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw - 90.0f)); } npc->jumpVelocity = 0.0f; partner_clear_player_tracking(npc); temp_ret = ApiStatus_DONE2; - if (D_802BE924 != 0) { - D_802BE924 = 0; + if (N(PlayingFuseSound)) { + N(PlayingFuseSound) = FALSE; sfx_stop_sound(SOUND_80000000); } temp_ret = ApiStatus_DONE2; @@ -540,87 +567,90 @@ ApiStatus func_802BD758_3184A8(Evt *evt, s32 isInitialCall) { return temp_ret; } -EvtScript world_bombette_use_ability = { - EVT_CALL(func_802BD758_3184A8) +EvtScript EVS_WorldBombette_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -ApiStatus func_802BE4E8_319238(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(PutAway)) { Npc* bombette = script->owner2.npc; if (isInitialCall) { partner_init_put_away(bombette); } - return partner_put_away(bombette) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_put_away(bombette)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_bombette_put_away = { - EVT_CALL(func_802BE4E8_319238) +EvtScript EVS_WorldBombette_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; -s32 world_bombette_test_first_strike(Npc* bombette, Npc* enemy) { - f32 adjustedDistanceX, adjustedDistanceY, adjustedDistanceZ; - f32 temp_f6, temp_f20, npcZPos, bombetteZPos, npcXPos, bombetteXPos; - s32 slippingResult; - f32 distance; - s32 ret; - f32 temp2; - f32 height; +s32 N(test_first_strike)(Npc* bombette, Npc* enemy) { + f32 bombetteX, bombetteZ; + f32 enemyX, enemyZ; + f32 x, y, z, dist; + f32 angle, distance; + f32 enemyRadius, blastRadius; + s32 hitResult; + s32 enemyHit; - if (D_802BE928 == 0) { + if (!N(IsBlasting)) { return FALSE; } - npcXPos = enemy->pos.x; - bombetteXPos = bombette->pos.x; - adjustedDistanceX = enemy->pos.x - bombette->pos.x; + enemyX = enemy->pos.x; + enemyZ = enemy->pos.z; - adjustedDistanceY = (enemy->pos.y + (f32)(enemy->collisionHeight * 0.5) - bombette->pos.y); + bombetteX = bombette->pos.x; + bombetteZ = bombette->pos.z; - npcZPos = enemy->pos.z; - bombetteZPos = bombette->pos.z; - adjustedDistanceZ = npcZPos - bombetteZPos; + x = enemyX - bombetteX; + y = enemy->pos.y + (f32)(enemy->collisionHeight * 0.5) - bombette->pos.y; + z = enemyZ - bombetteZ; - temp_f6 = enemy->collisionRadius * 0.55; - height = 35.0f; - temp2 = sqrtf(SQ(adjustedDistanceX) + SQ(adjustedDistanceY) + SQ(adjustedDistanceZ)); - ret = FALSE; + enemyRadius = enemy->collisionRadius * 0.55; + blastRadius = 35.0f; + dist = sqrtf(SQ(x) + SQ(y) + SQ(z)); + enemyHit = FALSE; - if (temp2 < (temp_f6 + height)) { - ret = TRUE; + if (dist < (enemyRadius + blastRadius)) { + enemyHit = TRUE; } - temp_f20 = atan2(npcXPos, npcZPos, bombetteXPos, bombetteZPos); - distance = dist2D(npcXPos, npcZPos, bombetteXPos, bombetteZPos); + angle = atan2(enemyX, enemyZ, bombetteX, bombetteZ); + distance = dist2D(enemyX, enemyZ, bombetteX, bombetteZ); - adjustedDistanceX = bombette->pos.x; - adjustedDistanceY = bombette->pos.y; - adjustedDistanceZ = bombette->pos.z; + // check whether the enemy is protected from the explosion + x = bombette->pos.x; + y = bombette->pos.y; + z = bombette->pos.z; + hitResult = npc_test_move_taller_with_slipping(0, &x, &y, &z, distance, angle, 35.0f, 2.0f); - slippingResult = npc_test_move_taller_with_slipping(0, &adjustedDistanceX, &adjustedDistanceY, &adjustedDistanceZ, - distance, temp_f20, height, 2.0f); - - if (slippingResult) { + if (hitResult) { return FALSE; } - return ret; + return enemyHit; } -void world_bombette_pre_battle(Npc* bombette) { +void N(pre_battle)(Npc* bombette) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* bombetteActionStatus = &gPartnerActionStatus; if (bombetteActionStatus->partnerActionState != PARTNER_ACTION_NONE) { - if (D_802BE92C) { + if (N(LockingPlayerInput)) { enable_player_input(); } - D_802BE928 = 0; + N(IsBlasting) = FALSE; playerStatus->flags &= ~PS_FLAG_JUMPING; bombette->jumpVelocity = 0.0f; bombette->flags &= ~NPC_FLAG_JUMPING; @@ -635,7 +665,7 @@ void world_bombette_pre_battle(Npc* bombette) { bombette->pos.y = playerStatus->position.y; bombette->pos.z = playerStatus->position.z; - if (D_802BE920 == 0) { + if (!N(PlayerWasFacingLeft)) { add_vec2D_polar(&bombette->pos.x, &bombette->pos.z, playerStatus->colliderDiameter / 4, clamp_angle(playerStatus->targetYaw + 90.0f)); } else { @@ -651,8 +681,8 @@ void world_bombette_pre_battle(Npc* bombette) { partner_clear_player_tracking(bombette); disable_npc_blur(bombette); - if (D_802BE924) { - D_802BE924 = 0; + if (N(PlayingFuseSound)) { + N(PlayingFuseSound) = FALSE; sfx_stop_sound(SOUND_80000000); } } diff --git a/src/world/partner/bombette.h b/src/world/partner/bombette.h index 18235e1eaa..d908ff5fb8 100644 --- a/src/world/partner/bombette.h +++ b/src/world/partner/bombette.h @@ -1,5 +1,5 @@ -#ifndef _WORLD_BOMBETTE_KOOPER_H_ -#define _WORLD_BOMBETTE_KOOPER_H_ +#ifndef _WORLD_BOMBETTE_H_ +#define _WORLD_BOMBETTE_H_ #include "common.h" #include "script_api/map.h" @@ -10,9 +10,9 @@ s32 world_bombette_can_use_ability(Npc* npc); s32 world_bombette_can_player_pause(Npc* ); void world_bombette_pre_battle(Npc*); -extern EvtScript world_bombette_take_out; -extern EvtScript world_bombette_update; -extern EvtScript world_bombette_use_ability; -extern EvtScript world_bombette_put_away; +extern EvtScript EVS_WorldBombette_TakeOut; +extern EvtScript EVS_WorldBombette_Update; +extern EvtScript EVS_WorldBombette_UseAbility; +extern EvtScript EVS_WorldBombette_PutAway; #endif diff --git a/src/world/partner/bow.c b/src/world/partner/bow.c index 5b5049a12c..8525106f52 100644 --- a/src/world/partner/bow.c +++ b/src/world/partner/bow.c @@ -3,43 +3,49 @@ #include "npc.h" #include "sprite/npc/WorldBow.h" -BSS s32 D_802BE0C0; -BSS s32 D_802BE0C4; // This seems to have something to do with input being disabled -BSS TweesterPhysics BowTweesterPhysics; -BSS s32 D_802BE0E4; -BSS s32 D_802BE0E8; -BSS s32 D_802BE0EC; +#define NAMESPACE world_bow -void func_802BDDF0_324740(Npc* partner); -s32 func_802BD540_323E90(void); +BSS b32 N(IsHiding); +BSS b32 N(LockingPlayerInput); +BSS TweesterPhysics N(TweesterPhysicsData); +BSS s32 N(OuttaSightPosX); +BSS s32 N(OuttaSightPosY); +BSS s32 N(OuttaSightPosZ); -void world_bow_init(Npc* bow) { +void N(end_outta_sight_cleanup)(Npc* partner); +s32 N(check_for_treadmill_overlaps)(void); + +void N(init)(Npc* bow) { bow->collisionHeight = 26; bow->collisionRadius = 24; bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; - D_802BE0C4 = FALSE; - D_802BE0C0 = FALSE; + N(LockingPlayerInput) = FALSE; + N(IsHiding) = FALSE; } -ApiStatus BowTakeOut(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(TakeOut)) { Npc* bow = script->owner2.npc; if (isInitialCall) { partner_init_get_out(bow); } - return partner_get_out(bow) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_get_out(bow)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_bow_take_out = { - EVT_CALL(BowTakeOut) +EvtScript EVS_WorldBow_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -TweesterPhysics* BowTweesterPhysicsPtr = &BowTweesterPhysics; +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -ApiStatus BowUpdate(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* bow = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -47,7 +53,7 @@ ApiStatus BowUpdate(Evt* script, s32 isInitialCall) { if (isInitialCall) { partner_flying_enable(bow, 1); - mem_clear(BowTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(*N(TweesterPhysicsPtr))); TweesterTouchingPartner = NULL; } @@ -57,93 +63,94 @@ ApiStatus BowUpdate(Evt* script, s32 isInitialCall) { if (entity == NULL) { partner_flying_update_player_tracking(bow); partner_flying_update_motion(bow); - return 0; + return ApiStatus_BLOCK; } - switch (BowTweesterPhysicsPtr->state){ + switch (N(TweesterPhysicsPtr)->state){ case TWEESTER_PARTNER_INIT: - BowTweesterPhysicsPtr->state++; - BowTweesterPhysicsPtr->prevFlags = bow->flags; - BowTweesterPhysicsPtr->radius = fabsf(dist2D(bow->pos.x, bow->pos.z, entity->position.x, entity->position.z)); - BowTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, bow->pos.x, bow->pos.z); - BowTweesterPhysicsPtr->angularVelocity = 6.0f; - BowTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - BowTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->state++; + N(TweesterPhysicsPtr)->prevFlags = bow->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(bow->pos.x, bow->pos.z, entity->position.x, entity->position.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, bow->pos.x, bow->pos.z); + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; bow->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; bow->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: - sin_cos_rad(DEG_TO_RAD(BowTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - bow->pos.x = entity->position.x + (sinAngle * BowTweesterPhysicsPtr->radius); - bow->pos.z = entity->position.z - (cosAngle * BowTweesterPhysicsPtr->radius); - BowTweesterPhysicsPtr->angle = clamp_angle(BowTweesterPhysicsPtr->angle - BowTweesterPhysicsPtr->angularVelocity); - if (BowTweesterPhysicsPtr->radius > 20.0f) { - BowTweesterPhysicsPtr->radius -= 1.0f; - } else if (BowTweesterPhysicsPtr->radius < 19.0f) { - BowTweesterPhysicsPtr->radius++; + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); + bow->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + bow->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius -= 1.0f; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(BowTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - BowTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (BowTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - BowTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } bow->pos.y += liftoffVelocity; - bow->renderYaw = clamp_angle(360.0f - BowTweesterPhysicsPtr->angle); - BowTweesterPhysicsPtr->angularVelocity += 0.8; + bow->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (BowTweesterPhysicsPtr->angularVelocity > 40.0f) { - BowTweesterPhysicsPtr->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--BowTweesterPhysicsPtr->countdown == 0) { - BowTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case TWEESTER_PARTNER_HOLD: - bow->flags = BowTweesterPhysicsPtr->prevFlags; - BowTweesterPhysicsPtr->countdown = 30; - BowTweesterPhysicsPtr->state++; + bow->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case TWEESTER_PARTNER_RELEASE: partner_flying_update_player_tracking(bow); partner_flying_update_motion(bow); - if (--BowTweesterPhysicsPtr->countdown == 0) { - BowTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; } - return 0; + return ApiStatus_BLOCK; } -EvtScript world_bow_update = { - EVT_CALL(BowUpdate) +EvtScript EVS_WorldBow_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -void func_802BD4FC_323E4C(Npc* bow) { +void N(try_cancel_tweester)(Npc* bow) { if (TweesterTouchingPartner != NULL) { TweesterTouchingPartner = NULL; - bow->flags = BowTweesterPhysicsPtr->prevFlags; - BowTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + bow->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking(bow); } } -s32 func_802BD540_323E90(void) { +// check whether the player would collide with an obstacle while on a treadmill in AREA_OMO +s32 N(check_for_treadmill_overlaps)(void) { + PlayerStatus* playerStatus = &gPlayerStatus; f32 x, y, z; f32 yaw; - PlayerStatus* playerStatus = &gPlayerStatus; if (gGameStatusPtr->areaID != AREA_OMO) { - return -1; + return NO_COLLIDER; } if (playerStatus->pushVelocity.x == 0.0f && playerStatus->pushVelocity.z == 0.0f) { - return -1; + return NO_COLLIDER; } yaw = atan2(0.0f, 0.0f, playerStatus->pushVelocity.x, playerStatus->pushVelocity.z); @@ -155,35 +162,42 @@ s32 func_802BD540_323E90(void) { return player_test_lateral_overlap(0, playerStatus, &x, &y, &z, playerStatus->colliderDiameter, yaw); } -ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(UseAbility)) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; CollisionStatus* collisionStatus = &gCollisionStatus; Npc* bow = script->owner2.npc; - f32 distance; + f32 stickInputMag; + + #define USE_STATE functionTemp[0] + enum { + // first two states lock input for a few frames, during which the ability can be canceled + OUTTA_SIGHT_INIT = 40, + OUTTA_SIGHT_DELAY = 41, + OUTTA_SIGHT_BEGIN = 20, + OUTTA_SIGHT_GATHER = 21, // move to player + OUTTA_SIGHT_VANISH = 1, // hide + OUTTA_SIGHT_IDLE = 2, // remain hidden + OUTTA_SIGHT_REAPPEAR = 3, + }; if (isInitialCall) { - func_802BD4FC_323E4C(bow); - if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { - if (func_800EA52C(PARTNER_BOW)) { - if (playerStatus->animFlags & PA_FLAG_PARTNER_USAGE_FORCED) { - playerStatus->animFlags &= ~PA_FLAG_PARTNER_USAGE_FORCED; - script->functionTemp[2] = disable_player_input(); - D_802BE0C4 = TRUE; - script->functionTemp[0] = 20; - } else { - script->functionTemp[0] = 40; - } - } else { - return ApiStatus_DONE2; - } - } else { + N(try_cancel_tweester)(bow); + if (playerStatus->animFlags & PA_FLAG_CHANGING_MAP || !func_800EA52C(PARTNER_BOW)) { return ApiStatus_DONE2; } + if (playerStatus->animFlags & PA_FLAG_PARTNER_USAGE_FORCED) { + playerStatus->animFlags &= ~PA_FLAG_PARTNER_USAGE_FORCED; + script->functionTemp[2] = disable_player_input(); + N(LockingPlayerInput) = TRUE; + script->USE_STATE = OUTTA_SIGHT_BEGIN; + } else { + script->USE_STATE = OUTTA_SIGHT_INIT; + } } - switch (script->functionTemp[0]) { - case 40: + switch (script->USE_STATE) { + case OUTTA_SIGHT_INIT: if (playerStatus->inputDisabledCount) { return ApiStatus_DONE2; } @@ -191,49 +205,49 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { playerStatus->flags |= PS_FLAG_PAUSE_DISABLED; script->functionTemp[1] = 3; script->functionTemp[2] = disable_player_input(); - D_802BE0C4 = TRUE; - script->functionTemp[0]++; + N(LockingPlayerInput) = TRUE; + script->USE_STATE++; // OUTTA_SIGHT_DELAY break; - case 41: - if ((!func_800EA52C(PARTNER_BOW) || is_starting_conversation()) && - script->functionTemp[2] < playerStatus->inputDisabledCount - && D_802BE0C4) { - + case OUTTA_SIGHT_DELAY: + if ((!func_800EA52C(PARTNER_BOW) || is_starting_conversation()) + && script->functionTemp[2] < playerStatus->inputDisabledCount + && N(LockingPlayerInput) + ) { enable_player_input(); - D_802BE0C4 = FALSE; + N(LockingPlayerInput) = FALSE; playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; return ApiStatus_DONE2; } script->functionTemp[1]--; if (script->functionTemp[1] == 0) { if (script->functionTemp[2] < playerStatus->inputDisabledCount) { - if (D_802BE0C4) { + if (N(LockingPlayerInput)) { enable_player_input(); - D_802BE0C4 = FALSE; + N(LockingPlayerInput) = FALSE; } playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; return ApiStatus_DONE2; } - script->functionTemp[0] = 20; + script->USE_STATE = OUTTA_SIGHT_BEGIN; } break; } - switch (script->functionTemp[0]) { - case 20: + switch (script->USE_STATE) { + case OUTTA_SIGHT_BEGIN: if (playerStatus->flags & PS_FLAG_HIT_FIRE) { playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; - if (D_802BE0C4) { + if (N(LockingPlayerInput)) { enable_player_input(); - D_802BE0C4 = FALSE; + N(LockingPlayerInput) = FALSE; } return ApiStatus_DONE2; } if (script->functionTemp[2] != 0) { - D_802BE0C4 = TRUE; + N(LockingPlayerInput) = TRUE; } - D_802BE0C0 = TRUE; + N(IsHiding) = TRUE; bow->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); partnerActionStatus->partnerActionState = 1; partnerActionStatus->actingPartner = 9; @@ -251,9 +265,10 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { bow->yaw = atan2(bow->pos.x, bow->pos.z, playerStatus->position.x, playerStatus->position.z); set_action_state(ACTION_STATE_RIDE); suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - script->functionTemp[0]++; + script->USE_STATE++; // OUTTA_SIGHT_GATHER break; - case 21: + + case OUTTA_SIGHT_GATHER: if (collisionStatus->currentFloor >= 0 && !(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { bow->moveToPos.x = playerStatus->position.x; bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); @@ -261,68 +276,74 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { bow->pos.x += ((bow->moveToPos.x - bow->pos.x) / bow->duration); bow->pos.y += ((bow->moveToPos.y - bow->pos.y) / bow->duration); bow->pos.z += ((bow->moveToPos.z - bow->pos.z) / bow->duration); - D_802BE0E4 = playerStatus->position.x - bow->pos.x; - D_802BE0E8 = playerStatus->position.y - bow->pos.y; - D_802BE0EC = playerStatus->position.z - bow->pos.z; + N(OuttaSightPosX) = playerStatus->position.x - bow->pos.x; + N(OuttaSightPosY) = playerStatus->position.y - bow->pos.y; + N(OuttaSightPosZ) = playerStatus->position.z - bow->pos.z; bow->duration--; if (bow->duration == 0) { bow->yaw = playerStatus->targetYaw; - func_8003D624(bow, 7, playerStatus->alpha1, 0, 0, 0, 0); + func_8003D624(bow, FOLD_TYPE_7, playerStatus->alpha1, 0, 0, 0, 0); suggest_player_anim_always_forward(ANIM_Mario1_Crouch); sfx_play_sound_at_npc(SOUND_BOW_VANISH, SOUND_SPACE_MODE_0, NPC_PARTNER); - script->functionTemp[0] = 1; + script->USE_STATE = OUTTA_SIGHT_VANISH; } break; } - func_802BDDF0_324740(bow); + N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE2; - case 1: + + case OUTTA_SIGHT_VANISH: if (collisionStatus->currentFloor >= 0) { playerStatus->alpha1 -= 8; if (playerStatus->alpha1 <= 128) { playerStatus->alpha1 = 128; bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER2; - script->functionTemp[0]++; + script->USE_STATE++; // OUTTA_SIGHT_IDLE playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; bow->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION; } get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->alpha1 >> 1; - func_8003D624(bow, 7, playerStatus->alpha1, 0, 0, 0, 0); - bow->pos.x = playerStatus->position.x - D_802BE0E4; - bow->pos.y = playerStatus->position.y - D_802BE0E8; - bow->pos.z = playerStatus->position.z - D_802BE0EC; + func_8003D624(bow, FOLD_TYPE_7, playerStatus->alpha1, 0, 0, 0, 0); + bow->pos.x = playerStatus->position.x - N(OuttaSightPosX); + bow->pos.y = playerStatus->position.y - N(OuttaSightPosY); + bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ); break; } - func_802BDDF0_324740(bow); + N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE2; - case 2: - if (collisionStatus->currentFloor < 0) { - func_802BDDF0_324740(bow); + + case OUTTA_SIGHT_IDLE: + if (collisionStatus->currentFloor <= NO_COLLIDER) { + N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE2; } - bow->pos.x = playerStatus->position.x - D_802BE0E4; - bow->pos.y = playerStatus->position.y - D_802BE0E8; - bow->pos.z = playerStatus->position.z - D_802BE0EC; + bow->pos.x = playerStatus->position.x - N(OuttaSightPosX); + bow->pos.y = playerStatus->position.y - N(OuttaSightPosY); + bow->pos.z = playerStatus->position.z - N(OuttaSightPosZ); - distance = dist2D(0.0f, 0.0f, partnerActionStatus->stickX, partnerActionStatus->stickY); - if ((collisionStatus->currentFloor < 0) || distance > 10.0f || - partnerActionStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN) || - playerStatus->flags & PS_FLAG_HIT_FIRE) { - if (func_802BD540_323E90() < 0) { - script->functionTemp[0]++; + stickInputMag = dist2D(0.0f, 0.0f, partnerActionStatus->stickX, partnerActionStatus->stickY); + if ((collisionStatus->currentFloor <= NO_COLLIDER) + || stickInputMag > 10.0f + || partnerActionStatus->pressedButtons & (BUTTON_B | BUTTON_C_DOWN) + || playerStatus->flags & PS_FLAG_HIT_FIRE + ) { + // prevent exiting from the ground while underneath a wall + if (N(check_for_treadmill_overlaps)() <= NO_COLLIDER) { + script->USE_STATE++; // OUTTA_SIGHT_REAPPEAR script->functionTemp[1] = 3; script->functionTemp[2] = playerStatus->inputDisabledCount; } } break; - case 3: + + case OUTTA_SIGHT_REAPPEAR: if (script->functionTemp[1] == 0) { if (script->functionTemp[2] < playerStatus->inputDisabledCount) { - script->functionTemp[0] = 2; + script->USE_STATE = OUTTA_SIGHT_IDLE; break; } } else { @@ -331,35 +352,35 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { } sfx_play_sound_at_npc(SOUND_BOW_APPEAR, SOUND_SPACE_MODE_0, NPC_PARTNER); - func_802BDDF0_324740(bow); + N(end_outta_sight_cleanup)(bow); return ApiStatus_DONE1; } return ApiStatus_BLOCK; } -EvtScript world_bow_use_ability = { - EVT_CALL(BowUseAbility) +EvtScript EVS_WorldBow_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -void func_802BDDF0_324740(Npc* bow) { +void N(end_outta_sight_cleanup)(Npc* bow) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; s32 actionState; playerStatus->alpha1 = 255; - func_8003D624(bow, 0, 0, 0, 0, 0, 0); + func_8003D624(bow, FOLD_TYPE_NONE, 0, 0, 0, 0, 0); bow->renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; get_shadow_by_index(bow->shadowIndex)->alpha = playerStatus->alpha1 >> 1; - if (D_802BE0C4) { + if (N(LockingPlayerInput)) { enable_player_input(); } playerStatus->flags &= ~(PS_FLAG_HAZARD_INVINCIBILITY | PS_FLAG_JUMPING); bow->flags &= ~(NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_INVISIBLE); - D_802BE0C4 = FALSE; + N(LockingPlayerInput) = FALSE; actionState = ACTION_STATE_IDLE; if (playerStatus->flags & PS_FLAG_HIT_FIRE) { @@ -371,39 +392,43 @@ void func_802BDDF0_324740(Npc* bow) { partnerActionStatus->actingPartner = 0; playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; partner_clear_player_tracking(bow); - D_802BE0C0 = FALSE; + N(IsHiding) = FALSE; } -ApiStatus func_802BDF08_324858(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(PutAway)) { Npc* bow = script->owner2.npc; if (isInitialCall) { partner_init_put_away(bow); - if (D_802BE0C0) { + if (N(IsHiding)) { sfx_play_sound_at_npc(SOUND_BOW_APPEAR, SOUND_SPACE_MODE_0, NPC_PARTNER); } - func_802BDDF0_324740(bow); + N(end_outta_sight_cleanup)(bow); } - return partner_put_away(bow) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_put_away(bow)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_bow_put_away = { - EVT_CALL(func_802BDF08_324858) +EvtScript EVS_WorldBow_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; -void world_bow_pre_battle(Npc* bow) { +void N(pre_battle)(Npc* bow) { PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; - if (D_802BE0C0) { + if (N(IsHiding)) { enable_player_input(); set_action_state(ACTION_STATE_IDLE); partner_clear_player_tracking(bow); - partnerActionStatus->partnerActionState = 0; - partnerActionStatus->actingPartner = 0; - D_802BE0C0 = FALSE; + partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; + partnerActionStatus->actingPartner = PARTNER_NONE; + N(IsHiding) = FALSE; bow->flags &= ~NPC_FLAG_INVISIBLE; } } diff --git a/src/world/partner/bow.h b/src/world/partner/bow.h index e538219b54..4c887d4e16 100644 --- a/src/world/partner/bow.h +++ b/src/world/partner/bow.h @@ -7,9 +7,9 @@ void world_bow_init(Npc*); void world_bow_pre_battle(Npc*); -extern EvtScript world_bow_take_out; -extern EvtScript world_bow_update; -extern EvtScript world_bow_use_ability; -extern EvtScript world_bow_put_away; +extern EvtScript EVS_WorldBow_TakeOut; +extern EvtScript EVS_WorldBow_Update; +extern EvtScript EVS_WorldBow_UseAbility; +extern EvtScript EVS_WorldBow_PutAway; #endif diff --git a/src/world/partner/goombaria.c b/src/world/partner/goombaria.c index 810eee0da9..986991d2b6 100644 --- a/src/world/partner/goombaria.c +++ b/src/world/partner/goombaria.c @@ -2,12 +2,14 @@ #include "goombaria.h" #include "../partners.h" -void world_goombaria_init(Npc* goombaria) { +#define NAMESPACE world_goombaria + +void N(init)(Npc* goombaria) { goombaria->collisionHeight = 24; goombaria->collisionRadius = 20; } -API_CALLABLE(GoombariaTakeOut) { +API_CALLABLE(N(TakeOut)) { Npc* goombaria = script->owner2.npc; if (isInitialCall) { @@ -17,7 +19,7 @@ API_CALLABLE(GoombariaTakeOut) { return partner_get_out(goombaria) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -API_CALLABLE(GoombariaUpdate) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* goombaria = script->owner2.npc; @@ -32,11 +34,11 @@ API_CALLABLE(GoombariaUpdate) { return ApiStatus_BLOCK; } -API_CALLABLE(GoombariaUseAbility) { +API_CALLABLE(N(UseAbility)) { return ApiStatus_DONE2; } -API_CALLABLE(GoombariaPutAway) { +API_CALLABLE(N(PutAway)) { Npc* goombaria = script->owner2.npc; if (isInitialCall) { @@ -46,26 +48,26 @@ API_CALLABLE(GoombariaPutAway) { return partner_put_away(goombaria) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -EvtScript EVS_WorldGoombariaTakeOut = { - EVT_CALL(GoombariaTakeOut) +EvtScript EVS_WorldGoombaria_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -EvtScript EVS_WorldGoombariaUpdate = { - EVT_CALL(GoombariaUpdate) +EvtScript EVS_WorldGoombaria_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -EvtScript EVS_WorldGoombariaUseAbility = { - EVT_CALL(GoombariaUseAbility) +EvtScript EVS_WorldGoombaria_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -EvtScript EVS_WorldGoombariaPutAway = { - EVT_CALL(GoombariaPutAway) +EvtScript EVS_WorldGoombaria_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; diff --git a/src/world/partner/goombaria.h b/src/world/partner/goombaria.h index 22fa42e618..d98a26ad0e 100644 --- a/src/world/partner/goombaria.h +++ b/src/world/partner/goombaria.h @@ -6,9 +6,9 @@ void world_goombaria_init(Npc* partner); -extern EvtScript EVS_WorldGoombariaTakeOut; -extern EvtScript EVS_WorldGoombariaUpdate; -extern EvtScript EVS_WorldGoombariaUseAbility; -extern EvtScript EVS_WorldGoombariaPutAway; +extern EvtScript EVS_WorldGoombaria_TakeOut; +extern EvtScript EVS_WorldGoombaria_Update; +extern EvtScript EVS_WorldGoombaria_UseAbility; +extern EvtScript EVS_WorldGoombaria_PutAway; #endif diff --git a/src/world/partner/goombario.c b/src/world/partner/goombario.c index 91d178b5e9..75aa886185 100644 --- a/src/world/partner/goombario.c +++ b/src/world/partner/goombario.c @@ -5,18 +5,20 @@ #include "message_ids.h" #include "entity.h" +#define NAMESPACE world_goombario + extern SpeechBubbleData* SpeechBubblePtr; -BSS s32 TattleHadSpeechPrompt; -BSS s32 TattleHadInteractPrompt; -BSS Npc* TattleInteractNpc; -BSS s32 D_802BDF3C; // unused (padding?) -BSS TweesterPhysics GoombarioTweesterPhysics; -BSS s32 D_802BDF5C; // unused (padding?) -BSS s32 GoombarioTattleInteractionID; -BSS s32 WorldGoombarioTattleActive; +BSS s32 N(HadSpeechPrompt); +BSS s32 N(HadInteractPrompt); +BSS Npc* N(InteractNpc); +BSS s32 N(D_802BDF3C); // unused (padding?) +BSS TweesterPhysics N(TweesterPhysicsData); +BSS s32 N(D_802BDF5C); // unused (padding?) +BSS s32 WorldTattleInteractionID; +BSS s32 N(IsTattleActive); -s32 EntityTattles[] = { +s32 N(EntityTattles)[] = { ENTITY_TYPE_HAMMER1_BLOCK, MSG_EntityTattle_HammerBlock1_CanBreak, ENTITY_TYPE_HAMMER1_BLOCK_TINY, MSG_EntityTattle_HammerBlock1_CanBreak, ENTITY_TYPE_HAMMER2_BLOCK, MSG_EntityTattle_HammerBlock2_CantBreak, @@ -57,7 +59,7 @@ s32 EntityTattles[] = { -1 }; -s32 world_goombario_get_trigger_tattle(s32 arg0) { +s32 N(get_trigger_tattle)(s32 tattleColliderID) { s32 i; for (i = 0; i < MAX_TRIGGERS; i++) { @@ -65,7 +67,7 @@ s32 world_goombario_get_trigger_tattle(s32 arg0) { if (trigger != NULL && trigger->flags.flags & TRIGGER_WALL_PRESS_A - && trigger->location.colliderID == arg0 + && trigger->location.colliderID == tattleColliderID ) { return trigger->tattleMsg; } @@ -73,14 +75,14 @@ s32 world_goombario_get_trigger_tattle(s32 arg0) { return 0; } -void world_goombario_init(Npc* goombario) { +void N(init)(Npc* goombario) { goombario->collisionHeight = 24; goombario->collisionRadius = 20; } -API_CALLABLE(WorldGoombarioTakeOut) { +API_CALLABLE(N(TakeOut)) { Npc* goombario = script->owner2.npc; - GoombarioTattleInteractionID = -1; + WorldTattleInteractionID = -1; if (isInitialCall) { partner_init_get_out(goombario); @@ -93,15 +95,15 @@ API_CALLABLE(WorldGoombarioTakeOut) { } } -EvtScript EVS_GoombarioTakeOut = { - EVT_CALL(WorldGoombarioTakeOut) +EvtScript EVS_WorldGoombario_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -TweesterPhysics* GoombarioTweesterPhysicsPtr = &GoombarioTweesterPhysics; +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -API_CALLABLE(WorldGoombarioUpdate) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* npc = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -109,7 +111,7 @@ API_CALLABLE(WorldGoombarioUpdate) { if (isInitialCall) { partner_walking_enable(npc, 1); - mem_clear(GoombarioTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics)); TweesterTouchingPartner = NULL; } @@ -122,61 +124,61 @@ API_CALLABLE(WorldGoombarioUpdate) { return 0; } - switch (GoombarioTweesterPhysicsPtr->state) { + switch (N(TweesterPhysicsPtr)->state) { case 0: - GoombarioTweesterPhysicsPtr->state = 1; - GoombarioTweesterPhysicsPtr->prevFlags = npc->flags; - GoombarioTweesterPhysicsPtr->radius = fabsf(dist2D(npc->pos.x, npc->pos.z, entity->position.x, entity->position.z)); - GoombarioTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, npc->pos.x, npc->pos.z); - GoombarioTweesterPhysicsPtr->angularVelocity = 6.0f; - GoombarioTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - GoombarioTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->state = 1; + N(TweesterPhysicsPtr)->prevFlags = npc->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(npc->pos.x, npc->pos.z, entity->position.x, entity->position.z)); + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, npc->pos.x, npc->pos.z); + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; npc->flags |= NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_CAMERA_FOR_YAW; npc->flags &= ~NPC_FLAG_GRAVITY; case 1: - sin_cos_rad(DEG_TO_RAD(GoombarioTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - npc->pos.x = entity->position.x + (sinAngle * GoombarioTweesterPhysicsPtr->radius); - npc->pos.z = entity->position.z - (cosAngle * GoombarioTweesterPhysicsPtr->radius); - GoombarioTweesterPhysicsPtr->angle = clamp_angle(GoombarioTweesterPhysicsPtr->angle - GoombarioTweesterPhysicsPtr->angularVelocity); + npc->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + npc->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); - if (GoombarioTweesterPhysicsPtr->radius > 20.0f) { - GoombarioTweesterPhysicsPtr->radius--; - } else if (GoombarioTweesterPhysicsPtr->radius < 19.0f) { - GoombarioTweesterPhysicsPtr->radius++; + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius--; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(GoombarioTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - GoombarioTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (GoombarioTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - GoombarioTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } npc->pos.y += liftoffVelocity; - npc->renderYaw = clamp_angle(360.0f - GoombarioTweesterPhysicsPtr->angle); - GoombarioTweesterPhysicsPtr->angularVelocity += 0.8; + npc->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (GoombarioTweesterPhysicsPtr->angularVelocity > 40.0f) { - GoombarioTweesterPhysicsPtr->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--GoombarioTweesterPhysicsPtr->countdown == 0) { - GoombarioTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case 2: - npc->flags = GoombarioTweesterPhysicsPtr->prevFlags; - GoombarioTweesterPhysicsPtr->countdown = 30; - GoombarioTweesterPhysicsPtr->state++; + npc->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case 3: partner_walking_update_player_tracking(npc); partner_walking_update_motion(npc); - if (--GoombarioTweesterPhysicsPtr->countdown == 0) { - GoombarioTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; @@ -184,22 +186,22 @@ API_CALLABLE(WorldGoombarioUpdate) { return 0; } -EvtScript EVS_GoombarioUpdate = { - EVT_CALL(WorldGoombarioUpdate) - EVT_RETURN - EVT_END -}; - -void goombario_try_cancel_tweester(Npc* goombario) { +void N(try_cancel_tweester)(Npc* goombario) { if (TweesterTouchingPartner) { TweesterTouchingPartner = NULL; - goombario->flags = GoombarioTweesterPhysicsPtr->prevFlags; - GoombarioTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + goombario->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking (goombario); } } -s32 world_goombario_can_pause(Npc* goombario) { +EvtScript EVS_WorldGoombario_Update = { + EVT_CALL(N(Update)) + EVT_RETURN + EVT_END +}; + +s32 N(can_pause)(Npc* goombario) { PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus; s32 new_var; @@ -215,13 +217,13 @@ s32 world_goombario_can_pause(Npc* goombario) { return TRUE; } -API_CALLABLE(WorldGoombarioSelectTattleMsg) { +API_CALLABLE(N(SelectTattleMsg)) { PlayerStatus* playerStatus = &gPlayerStatus; Npc* goombario = script->owner2.npc; s32 msgID; s32 temp; // TODO required to match (this temp needs to be used in two places for different things) s32 npcMsgID; - s32 v0; + s32 enemyTattleMsg; s32 i; #define USE_STATE functionTemp[0] @@ -237,16 +239,16 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { }; if (isInitialCall) { - goombario_try_cancel_tweester(goombario); - WorldGoombarioTattleActive = FALSE; - TattleHadSpeechPrompt = FALSE; - TattleHadInteractPrompt = FALSE; + N(try_cancel_tweester)(goombario); + N(IsTattleActive) = FALSE; + N(HadSpeechPrompt) = FALSE; + N(HadInteractPrompt) = FALSE; if (playerStatus->animFlags & PA_FLAG_SPEECH_PROMPT_AVAILABLE) { - TattleHadSpeechPrompt = TRUE; - TattleInteractNpc = SpeechBubblePtr->encounteredNPC; + N(HadSpeechPrompt) = TRUE; + N(InteractNpc) = SpeechBubblePtr->encounteredNPC; } if (playerStatus->animFlags & PA_FLAG_INTERACT_PROMPT_AVAILABLE) { - TattleHadInteractPrompt = TRUE; + N(HadInteractPrompt) = TRUE; } script->USE_STATE = USE_TATTLE_INIT; } @@ -259,7 +261,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { } script->functionTemp[1] = 3; disable_player_input(); - WorldGoombarioTattleActive = TRUE; + N(IsTattleActive) = TRUE; script->functionTemp[2] = playerStatus->inputDisabledCount; script->USE_STATE++; break; @@ -270,7 +272,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { if (script->functionTemp[2] < playerStatus->inputDisabledCount) { script->VAR_MSG = -1; enable_player_input(); - WorldGoombarioTattleActive = FALSE; + N(IsTattleActive) = FALSE; return ApiStatus_DONE2; } script->USE_STATE = USE_TATTLE_FACE_PLAYER; @@ -283,7 +285,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { goombario->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle - 90.0f); gPartnerActionStatus.partnerActionState = PARTNER_ACTION_USE; close_status_menu(); - if (TattleHadSpeechPrompt) { + if (N(HadSpeechPrompt)) { script->VAR_MSG = 0; script->USE_STATE = USE_TATTLE_FORCE_NPC; break; @@ -292,12 +294,12 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { // fallthrough case USE_TATTLE_CHOOSE: // check for entity tattle - if (GoombarioTattleInteractionID >= 0 && (GoombarioTattleInteractionID & COLLISION_WITH_ENTITY_BIT)) { - temp = get_entity_type(GoombarioTattleInteractionID); + if (WorldTattleInteractionID >= 0 && (WorldTattleInteractionID & COLLISION_WITH_ENTITY_BIT)) { + temp = get_entity_type(WorldTattleInteractionID); msgID = -1; do {} while (0); - for (i = 0; EntityTattles[2 * i] != -1; i++) { - if (EntityTattles[2 * i] != temp) { + for (i = 0; N(EntityTattles)[2 * i] != -1; i++) { + if (N(EntityTattles)[2 * i] != temp) { continue; } switch (temp) { @@ -343,7 +345,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { } break; case ENTITY_TYPE_CHEST: - if (get_entity_by_index(GoombarioTattleInteractionID & 0x3FFF)->dataBuf.chest->itemID == -1) { + if (get_entity_by_index(WorldTattleInteractionID & 0x3FFF)->dataBuf.chest->itemID == -1) { msgID = MSG_EntityTattle_EmptyChest; } break; @@ -351,7 +353,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { if (msgID != -1) { script->VAR_MSG = msgID; } else { - script->VAR_MSG = EntityTattles[2 * i + 1]; + script->VAR_MSG = N(EntityTattles)[2 * i + 1]; } script->VAR_SKIP = FALSE; return ApiStatus_DONE2; @@ -359,11 +361,11 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { } // check for NPC tattle - if (GoombarioTattleInteractionID >= 0 && (GoombarioTattleInteractionID & COLLISION_WITH_NPC_BIT)) { - TattleInteractNpc = get_npc_unsafe(GoombarioTattleInteractionID & 0x1FFF); - v0 = get_enemy(TattleInteractNpc->npcID)->tattleMsg; - if (v0 != 0) { - msgID = v0; + if (WorldTattleInteractionID >= 0 && (WorldTattleInteractionID & COLLISION_WITH_NPC_BIT)) { + N(InteractNpc) = get_npc_unsafe(WorldTattleInteractionID & 0x1FFF); + enemyTattleMsg = get_enemy(N(InteractNpc)->npcID)->tattleMsg; + if (enemyTattleMsg != 0) { + msgID = enemyTattleMsg; if (msgID < EVT_LIMIT) { script->VAR_MSG = ((s32(*)(void))msgID)(); } else { @@ -375,7 +377,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { } // generic interact tattle - if (TattleHadInteractPrompt) { + if (N(HadInteractPrompt)) { script->VAR_MSG = MSG_EntityTattle_Interact; script->VAR_SKIP = FALSE; return ApiStatus_DONE2; @@ -383,8 +385,8 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { // check for custom trigger tattle temp = MSG_NONE; - if (GoombarioTattleInteractionID >= 0) { - temp = world_goombario_get_trigger_tattle(GoombarioTattleInteractionID); + if (WorldTattleInteractionID >= 0) { + temp = N(get_trigger_tattle)(WorldTattleInteractionID); } // check map tattle @@ -420,7 +422,7 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { } break; case USE_TATTLE_FORCE_NPC: - npcMsgID = get_enemy(TattleInteractNpc->npcID)->tattleMsg; + npcMsgID = get_enemy(N(InteractNpc)->npcID)->tattleMsg; if (npcMsgID != MSG_NONE) { script->VAR_MSG = npcMsgID; script->VAR_SKIP = FALSE; @@ -431,13 +433,13 @@ API_CALLABLE(WorldGoombarioSelectTattleMsg) { return ApiStatus_BLOCK; } -API_CALLABLE(WorldGoombarioTattleEnd) { +API_CALLABLE(N(TattleEnd)) { PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus; set_time_freeze_mode(TIME_FREEZE_NORMAL); - if (WorldGoombarioTattleActive) { - WorldGoombarioTattleActive = FALSE; + if (N(IsTattleActive)) { + N(IsTattleActive) = FALSE; enable_player_input(); } @@ -446,15 +448,15 @@ API_CALLABLE(WorldGoombarioTattleEnd) { return ApiStatus_DONE2; } -EvtScript EVS_GoombarioUseAbility = { - EVT_CALL(WorldGoombarioSelectTattleMsg) +EvtScript EVS_WorldGoombario_UseAbility = { + EVT_CALL(N(SelectTattleMsg)) // abort without cleanup if failed to init EVT_IF_EQ(LVar0, -1) EVT_RETURN EVT_END_IF // abort if no tattle message is available EVT_IF_EQ(LVar0, MSG_NONE) - EVT_CALL(WorldGoombarioTattleEnd) + EVT_CALL(N(TattleEnd)) EVT_RETURN EVT_END_IF // show message if VAR_SKIP is FALSE @@ -463,12 +465,12 @@ EvtScript EVS_GoombarioUseAbility = { EVT_END_IF EVT_WAIT(1) // cleanup - EVT_CALL(WorldGoombarioTattleEnd) + EVT_CALL(N(TattleEnd)) EVT_RETURN EVT_END }; -API_CALLABLE(WorldGoombarioPutAway) { +API_CALLABLE(N(PutAway)) { Npc* goombario = script->owner2.npc; if (isInitialCall) { @@ -482,13 +484,13 @@ API_CALLABLE(WorldGoombarioPutAway) { } } -EvtScript EVS_GoombarioPutAway = { - EVT_CALL(WorldGoombarioPutAway) +EvtScript EVS_WorldGoombario_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; -void world_goombario_pre_battle(Npc* goombario) { +void N(pre_battle)(Npc* goombario) { PartnerActionStatus* goombarioActionStatus = &gPartnerActionStatus; if (goombarioActionStatus->partnerActionState != PARTNER_ACTION_NONE) { diff --git a/src/world/partner/goombario.h b/src/world/partner/goombario.h index ca02be6e2d..5ce2277b43 100644 --- a/src/world/partner/goombario.h +++ b/src/world/partner/goombario.h @@ -6,13 +6,12 @@ void world_goombario_init(Npc* partner); s32 world_goombario_can_pause(Npc* partner); -ApiStatus WorldGoombarioPutAway(Evt* script, s32 isInitialCall); void world_goombario_pre_battle(Npc* partner); s32 world_goombario_get_trigger_tattle(s32 arg0); -extern EvtScript EVS_GoombarioTakeOut; -extern EvtScript EVS_GoombarioUpdate; -extern EvtScript EVS_GoombarioUseAbility; -extern EvtScript EVS_GoombarioPutAway; +extern EvtScript EVS_WorldGoombario_TakeOut; +extern EvtScript EVS_WorldGoombario_Update; +extern EvtScript EVS_WorldGoombario_UseAbility; +extern EvtScript EVS_WorldGoombario_PutAway; #endif diff --git a/src/world/partner/goompa.c b/src/world/partner/goompa.c index b84498dc0a..c4992643b7 100644 --- a/src/world/partner/goompa.c +++ b/src/world/partner/goompa.c @@ -2,14 +2,14 @@ #include "goompa.h" #include "../src/world/partners.h" -API_CALLABLE(GoompaUpdate); +#define NAMESPACE world_goompa -void world_goompa_init(Npc* partner) { +void N(init)(Npc* partner) { partner->collisionHeight = 24; partner->collisionRadius = 20; } -API_CALLABLE(GoompaTakeOut) { +API_CALLABLE(N(TakeOut)) { Npc* goompa = script->owner2.npc; if (isInitialCall) { @@ -23,16 +23,16 @@ API_CALLABLE(GoompaTakeOut) { } } -EvtScript EVS_WorldGoompaTakeOut = { - EVT_CALL(GoompaTakeOut) +EvtScript EVS_WorldGoompa_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -BSS TweesterPhysics GoompaTweesterPhysics; -TweesterPhysics* GoompaTweesterPhysicsPtr = &GoompaTweesterPhysics; +BSS TweesterPhysics N(TweesterPhysicsData); +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -API_CALLABLE(GoompaUpdate) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* goompa = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -40,7 +40,7 @@ API_CALLABLE(GoompaUpdate) { if (isInitialCall) { partner_walking_enable(goompa, 1); - mem_clear(GoompaTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics)); TweesterTouchingPartner = NULL; } @@ -53,60 +53,60 @@ API_CALLABLE(GoompaUpdate) { return ApiStatus_BLOCK; } - switch (GoompaTweesterPhysicsPtr->state) { + switch (N(TweesterPhysicsPtr)->state) { case TWEESTER_PARTNER_INIT: - GoompaTweesterPhysicsPtr->state++; - GoompaTweesterPhysicsPtr->prevFlags = goompa->flags; - GoompaTweesterPhysicsPtr->radius = fabsf(dist2D(goompa->pos.x, goompa->pos.z, + N(TweesterPhysicsPtr)->state++; + N(TweesterPhysicsPtr)->prevFlags = goompa->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(goompa->pos.x, goompa->pos.z, entity->position.x, entity->position.z)); - GoompaTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, goompa->pos.x, goompa->pos.z); - GoompaTweesterPhysicsPtr->angularVelocity = 6.0f; - GoompaTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - GoompaTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, goompa->pos.x, goompa->pos.z); + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; goompa->flags |= NPC_FLAG_8 | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_CAMERA_FOR_YAW; goompa->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: - sin_cos_rad(DEG_TO_RAD(GoompaTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - goompa->pos.x = entity->position.x + (sinAngle * GoompaTweesterPhysicsPtr->radius); - goompa->pos.z = entity->position.z - (cosAngle * GoompaTweesterPhysicsPtr->radius); - GoompaTweesterPhysicsPtr->angle = clamp_angle(GoompaTweesterPhysicsPtr->angle - GoompaTweesterPhysicsPtr->angularVelocity); + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); + goompa->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + goompa->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); - if (GoompaTweesterPhysicsPtr->radius > 20.0f) { - GoompaTweesterPhysicsPtr->radius--; - } else if (GoompaTweesterPhysicsPtr->radius < 19.0f) { - GoompaTweesterPhysicsPtr->radius++; + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius--; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(GoompaTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - GoompaTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (GoompaTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - GoompaTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } goompa->pos.y += liftoffVelocity; - goompa->renderYaw = clamp_angle(360.0f - GoompaTweesterPhysicsPtr->angle); - GoompaTweesterPhysicsPtr->angularVelocity += 0.8; + goompa->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (GoompaTweesterPhysicsPtr->angularVelocity > 40.0f) { - GoompaTweesterPhysicsPtr->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--GoompaTweesterPhysicsPtr->countdown == 0) { - GoompaTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case TWEESTER_PARTNER_HOLD: - goompa->flags = GoompaTweesterPhysicsPtr->prevFlags; - GoompaTweesterPhysicsPtr->countdown = 30; - GoompaTweesterPhysicsPtr->state++; + goompa->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case TWEESTER_PARTNER_RELEASE: partner_walking_update_player_tracking(goompa); partner_walking_update_motion(goompa); - if (--GoompaTweesterPhysicsPtr->countdown == 0) { - GoompaTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; @@ -114,32 +114,32 @@ API_CALLABLE(GoompaUpdate) { return ApiStatus_BLOCK; } -EvtScript EVS_WorldGoompaUpdate = { - EVT_CALL(GoompaUpdate) +EvtScript EVS_WorldGoompa_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -void goompa_try_cancel_tweester(Npc* goompa) { +void N(try_cancel_tweester)(Npc* goompa) { if (TweesterTouchingPartner != NULL) { TweesterTouchingPartner = NULL; - goompa->flags = GoompaTweesterPhysicsPtr->prevFlags; - GoompaTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + goompa->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking(goompa); } } -API_CALLABLE(GoompaUseAbility) { +API_CALLABLE(N(UseAbility)) { return ApiStatus_DONE2; } -EvtScript EVS_WorldGoompaUseAbility = { - EVT_CALL(GoompaUseAbility) +EvtScript EVS_WorldGoompa_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -API_CALLABLE(GoompaPutAway) { +API_CALLABLE(N(PutAway)) { Npc* goompa = script->owner2.npc; if (isInitialCall) { @@ -153,8 +153,8 @@ API_CALLABLE(GoompaPutAway) { } } -EvtScript EVS_WorldGoompaPutAway = { - EVT_CALL(GoompaPutAway) +EvtScript EVS_WorldGoompa_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; diff --git a/src/world/partner/goompa.h b/src/world/partner/goompa.h index 743af58673..3c3e4189ba 100644 --- a/src/world/partner/goompa.h +++ b/src/world/partner/goompa.h @@ -6,9 +6,9 @@ void world_goompa_init(Npc* partner); -extern EvtScript EVS_WorldGoompaTakeOut; -extern EvtScript EVS_WorldGoompaUpdate; -extern EvtScript EVS_WorldGoompaUseAbility; -extern EvtScript EVS_WorldGoompaPutAway; +extern EvtScript EVS_WorldGoompa_TakeOut; +extern EvtScript EVS_WorldGoompa_Update; +extern EvtScript EVS_WorldGoompa_UseAbility; +extern EvtScript EVS_WorldGoompa_PutAway; #endif diff --git a/src/world/partner/kooper.c b/src/world/partner/kooper.c index 4dcf7462b4..aef25efe25 100644 --- a/src/world/partner/kooper.c +++ b/src/world/partner/kooper.c @@ -2,24 +2,26 @@ #include "../src/world/partners.h" #include "sprite/npc/WorldKooper.h" +#define NAMESPACE world_kooper + s32 entity_try_partner_interaction_trigger(s32); s32 test_item_entity_position(f32, f32, f32, f32); s32 npc_raycast_up_corner(s32 ignoreFlags, f32* x, f32* y, f32* z, f32* length); void fx_damage_stars(s32, f32, f32, f32, f32, f32, f32, s32); void auto_collect_item_entity(s32); -BSS s32 KooperShellTossHoldTime; -BSS s32 KooperTriggeredBattle; -BSS s32 ShellTossPlayerFacingLeft; -BSS s32 D_802BEC5C; -BSS s32 ShellTossKickFalling; -BSS s32 ShellTossControlsPlayer; -BSS s32 KooperHeldItemIdx; -BSS s32 KooperHasItem; -BSS f32 ShellTossPosX; -BSS f32 ShellTossPosY; -BSS f32 ShellTossPosZ; -BSS s32 D_802BEC7C; +BSS s32 N(ShellTossHoldTime); +BSS s32 N(TriggeredBattle); +BSS s32 N(PlayerWasFacingLeft); +BSS s32 N(D_802BEC5C); +BSS s32 N(ShellTossKickFalling); +BSS b32 N(LockingPlayerInput); +BSS s32 N(HeldItemIdx); +BSS s32 N(HasItem); +BSS f32 N(ShellTossPosX); +BSS f32 N(ShellTossPosY); +BSS f32 N(ShellTossPosZ); +BSS s32 D_802BEC7C; // padding? enum { SHELL_TOSS_HITBOX_DISABLED = 0, @@ -29,7 +31,7 @@ enum { s32 ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED; -s32 kooper_lateral_hit_interactable_entity(Npc* npc) { +s32 N(lateral_hit_interactable_entity)(Npc* npc) { if (NpcHitQueryColliderID < 0) { return FALSE; } @@ -41,7 +43,7 @@ s32 kooper_lateral_hit_interactable_entity(Npc* npc) { return entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); } -void kooper_vertical_hit_interactable_entity(Npc* kooper) { +void N(vertical_hit_interactable_entity)(Npc* kooper) { if (NpcHitQueryColliderID < 0) { return; } @@ -53,27 +55,27 @@ void kooper_vertical_hit_interactable_entity(Npc* kooper) { entity_try_partner_interaction_trigger(NpcHitQueryColliderID & ~COLLISION_WITH_ENTITY_BIT); } -s32 kooper_check_for_item_collision(Npc* kooper) { - KooperHeldItemIdx = test_item_entity_position(kooper->pos.x, kooper->pos.y, kooper->pos.z, kooper->collisionRadius); +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); - if (KooperHeldItemIdx < 0) { + if (N(HeldItemIdx) < 0) { return FALSE; } - KooperHasItem = TRUE; + N(HasItem) = TRUE; gOverrideFlags |= GLOBAL_OVERRIDES_40; - set_item_entity_flags(KooperHeldItemIdx, ITEM_ENTITY_FLAG_CANT_COLLECT); + set_item_entity_flags(N(HeldItemIdx), ITEM_ENTITY_FLAG_CANT_COLLECT); return TRUE; } -void world_kooper_init(Npc* kooper) { +void N(init)(Npc* kooper) { kooper->collisionHeight = 37; kooper->collisionRadius = 24; kooper->collisionChannel = COLLISION_CHANNEL_10000; - KooperTriggeredBattle = FALSE; + N(TriggeredBattle) = FALSE; } -API_CALLABLE(KooperTakeOut) { +API_CALLABLE(N(TakeOut)) { Npc* kooper = script->owner2.npc; if (isInitialCall) { @@ -87,16 +89,16 @@ API_CALLABLE(KooperTakeOut) { } } -EvtScript EVS_WorldKooperTakeOut = { - EVT_CALL(KooperTakeOut) +EvtScript EVS_WorldKooper_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -BSS TweesterPhysics KooperTweesterPhysics; -TweesterPhysics* KooperTweesterPhysicsPtr = &KooperTweesterPhysics; +BSS TweesterPhysics N(TweesterPhysicsData); +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -API_CALLABLE(KooperUpdate) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* kooper = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -104,7 +106,7 @@ API_CALLABLE(KooperUpdate) { if (isInitialCall) { partner_walking_enable(kooper, 1); - mem_clear(KooperTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics)); TweesterTouchingPartner = NULL; } @@ -117,61 +119,61 @@ API_CALLABLE(KooperUpdate) { return ApiStatus_BLOCK; } - switch (KooperTweesterPhysicsPtr->state) { + switch (N(TweesterPhysicsPtr)->state) { case TWEESTER_PARTNER_INIT: - KooperTweesterPhysicsPtr->state++; - KooperTweesterPhysicsPtr->prevFlags = kooper->flags; - KooperTweesterPhysicsPtr->radius = fabsf(dist2D(kooper->pos.x, kooper->pos.z, + N(TweesterPhysicsPtr)->state++; + N(TweesterPhysicsPtr)->prevFlags = kooper->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(kooper->pos.x, kooper->pos.z, entity->position.x, entity->position.z)); - KooperTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, kooper->pos.x, kooper->pos.z); - KooperTweesterPhysicsPtr->angularVelocity = 6.0f; - KooperTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - KooperTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, kooper->pos.x, kooper->pos.z); + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; kooper->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; kooper->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: - sin_cos_rad(DEG_TO_RAD(KooperTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); - kooper->pos.x = entity->position.x + (sinAngle * KooperTweesterPhysicsPtr->radius); - kooper->pos.z = entity->position.z - (cosAngle * KooperTweesterPhysicsPtr->radius); + kooper->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + kooper->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); - KooperTweesterPhysicsPtr->angle = clamp_angle(KooperTweesterPhysicsPtr->angle - KooperTweesterPhysicsPtr->angularVelocity); - if (KooperTweesterPhysicsPtr->radius > 20.0f) { - KooperTweesterPhysicsPtr->radius--; - } else if (KooperTweesterPhysicsPtr->radius < 19.0f) { - KooperTweesterPhysicsPtr->radius++; + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius--; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(KooperTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; - KooperTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (KooperTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - KooperTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } kooper->pos.y += liftoffVelocity; - kooper->renderYaw = clamp_angle(360.0f - KooperTweesterPhysicsPtr->angle); - KooperTweesterPhysicsPtr->angularVelocity += 0.8; - if (KooperTweesterPhysicsPtr->angularVelocity > 40.0f) { - KooperTweesterPhysicsPtr->angularVelocity = 40.0f; + kooper->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--KooperTweesterPhysicsPtr->countdown == 0) { - KooperTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case TWEESTER_PARTNER_HOLD: - kooper->flags = KooperTweesterPhysicsPtr->prevFlags; - KooperTweesterPhysicsPtr->countdown = 30; - KooperTweesterPhysicsPtr->state++; + kooper->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case TWEESTER_PARTNER_RELEASE: partner_walking_update_player_tracking(kooper); partner_walking_update_motion(kooper); - if (--KooperTweesterPhysicsPtr->countdown == 0) { - KooperTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; @@ -179,22 +181,22 @@ API_CALLABLE(KooperUpdate) { return ApiStatus_BLOCK; } -EvtScript EVS_WorldKooperUpdate = { - EVT_CALL(KooperUpdate) - EVT_RETURN - EVT_END -}; - -void kooper_try_cancel_tweester(Npc* kooper) { +void N(try_cancel_tweester)(Npc* kooper) { if (TweesterTouchingPartner != NULL) { TweesterTouchingPartner = NULL; - kooper->flags = KooperTweesterPhysicsPtr->prevFlags; - KooperTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + kooper->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking(kooper); } } -API_CALLABLE(KooperUseAbility) { +EvtScript EVS_WorldKooper_Update = { + EVT_CALL(N(Update)) + EVT_RETURN + EVT_END +}; + +API_CALLABLE(N(UseAbility)) { Camera* cam; ItemEntity* heldItem; EncounterStatus* currentEncounter = &gCurrentEncounter; @@ -226,12 +228,12 @@ API_CALLABLE(KooperUseAbility) { } if (isInitialCall) { - kooper_try_cancel_tweester(kooper); + N(try_cancel_tweester)(kooper); if (playerStatus->animFlags & PA_FLAG_CHANGING_MAP) { return ApiStatus_DONE2; } - if (!KooperTriggeredBattle) { + if (!N(TriggeredBattle)) { actionState = playerStatus->actionState; if (actionState == ACTION_STATE_IDLE || actionState == ACTION_STATE_WALK @@ -246,7 +248,7 @@ API_CALLABLE(KooperUseAbility) { partnerActionStatus->actingPartner = PARTNER_KOOPER; script->USE_STATE = SHELL_TOSS_STATE_HOLD; kooper->currentAnim = ANIM_WorldKooper_SpinShell; - KooperShellTossHoldTime = 30; + N(ShellTossHoldTime) = 30; } } @@ -261,14 +263,14 @@ API_CALLABLE(KooperUseAbility) { disable_player_input(); script->functionTemp[2] = playerStatus->inputDisabledCount; - ShellTossControlsPlayer = TRUE; + N(LockingPlayerInput) = TRUE; ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED; - KooperHasItem = FALSE; + N(HasItem) = FALSE; kooper->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_JUMPING | NPC_FLAG_8); kooper->flags |= (NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION); partnerActionStatus->actingPartner = PARTNER_KOOPER; partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_GATHER; - ShellTossPlayerFacingLeft = partner_force_player_flip_done(); + N(PlayerWasFacingLeft) = partner_force_player_flip_done(); enable_npc_blur(kooper); kooper->duration = 4; kooper->yaw = atan2(kooper->pos.x, kooper->pos.z, @@ -288,13 +290,13 @@ API_CALLABLE(KooperUseAbility) { } suggest_player_anim_allow_backward(ANIM_Mario1_BeforeJump); - kooper->moveToPos.x = ShellTossPosX = playerStatus->position.x; - kooper->moveToPos.y = ShellTossPosY = playerStatus->position.y; - kooper->moveToPos.z = ShellTossPosZ = playerStatus->position.z; + kooper->moveToPos.x = N(ShellTossPosX) = playerStatus->position.x; + kooper->moveToPos.y = N(ShellTossPosY) = playerStatus->position.y; + kooper->moveToPos.z = N(ShellTossPosZ) = playerStatus->position.z; kooper->currentAnim = ANIM_WorldKooper_Run; add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, playerStatus->colliderDiameter / 3, playerStatus->targetYaw); - moveAngle = clamp_angle(playerStatus->targetYaw + (ShellTossPlayerFacingLeft ? 90.0f : -90.0f)); + moveAngle = clamp_angle(playerStatus->targetYaw + (N(PlayerWasFacingLeft) ? 90.0f : -90.0f)); add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, playerStatus->colliderDiameter / 4, moveAngle); kooper->pos.x += (kooper->moveToPos.x - kooper->pos.x) / kooper->duration; @@ -329,7 +331,7 @@ API_CALLABLE(KooperUseAbility) { gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; suggest_player_anim_allow_backward(ANIM_Mario1_Jump); - ShellTossKickFalling = FALSE; + N(ShellTossKickFalling) = FALSE; sfx_play_sound_at_npc(SOUND_JUMP_2081, SOUND_SPACE_MODE_0, NPC_PARTNER); script->USE_STATE = SHELL_TOSS_STATE_JUMP; // fallthrough @@ -346,8 +348,8 @@ API_CALLABLE(KooperUseAbility) { kooper->jumpVelocity -= kooper->jumpScale; playerStatus->position.y += kooper->jumpVelocity; if (kooper->jumpVelocity < 0.0f) { - if (!ShellTossKickFalling) { - ShellTossKickFalling = TRUE; + if (!N(ShellTossKickFalling)) { + N(ShellTossKickFalling) = TRUE; suggest_player_anim_allow_backward(ANIM_Mario1_Fall); } } @@ -360,11 +362,11 @@ API_CALLABLE(KooperUseAbility) { if ((npc_raycast_up(COLLISION_CHANNEL_10000, &posX, &posY, &posZ, &hitLength)) && (hitLength < testLength)) { collisionStatus->currentCeiling = NpcHitQueryColliderID; playerStatus->position.y = posY - playerStatus->colliderHeight; - kooper_vertical_hit_interactable_entity(kooper); + N(vertical_hit_interactable_entity)(kooper); } if (!(kooper->jumpVelocity > 0.0f) && (playerStatus->position.y < kooper->moveToPos.z)) { - D_802BEC5C = 0; + N(D_802BEC5C) = 0; kooper->flags &= ~NPC_FLAG_IGNORE_PLAYER_COLLISION; partnerActionStatus->actingPartner = PARTNER_KOOPER; partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_TOSS; @@ -377,13 +379,13 @@ API_CALLABLE(KooperUseAbility) { sin_deg(playerStatus->targetYaw), -1.0f, -cos_deg(playerStatus->targetYaw), 3); start_bounce_b(); - if (ShellTossControlsPlayer) { + if (N(LockingPlayerInput)) { enable_player_input(); - ShellTossControlsPlayer = FALSE; + N(LockingPlayerInput) = FALSE; } script->USE_STATE = SHELL_TOSS_STATE_KICK; - ShellTossKickFalling = FALSE; + N(ShellTossKickFalling) = FALSE; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; sfx_play_sound_at_npc(SOUND_283, SOUND_SPACE_MODE_0, NPC_PARTNER); sfx_play_sound_at_npc(SOUND_284, SOUND_SPACE_MODE_0, NPC_PARTNER); @@ -410,7 +412,7 @@ API_CALLABLE(KooperUseAbility) { ) if (TEST_COLLISION_AT_ANGLE(kooper->yaw - 20.0f)) { - if (!kooper_lateral_hit_interactable_entity(kooper)) { + if (!N(lateral_hit_interactable_entity)(kooper)) { sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER); } @@ -422,7 +424,7 @@ API_CALLABLE(KooperUseAbility) { } if (TEST_COLLISION_AT_ANGLE(kooper->yaw + 20.0f)) { - if (!kooper_lateral_hit_interactable_entity(kooper)) { + if (!N(lateral_hit_interactable_entity)(kooper)) { sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER); } @@ -434,7 +436,7 @@ API_CALLABLE(KooperUseAbility) { } if (TEST_COLLISION_AT_ANGLE(kooper->yaw)) { - if (!kooper_lateral_hit_interactable_entity(kooper)) { + if (!N(lateral_hit_interactable_entity)(kooper)) { sfx_play_sound_at_npc(SOUND_IMMUNE, SOUND_SPACE_MODE_0, NPC_PARTNER); } @@ -469,13 +471,13 @@ API_CALLABLE(KooperUseAbility) { break; } - if (kooper_check_for_item_collision(kooper)) { + if (N(check_for_item_collision)(kooper)) { sfx_play_sound_at_npc(SOUND_286, SOUND_SPACE_MODE_0, NPC_PARTNER); fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, sin_deg(kooper->yaw), -1.0f, -cos_deg(kooper->yaw), 1); sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); script->USE_STATE = SHELL_TOSS_STATE_PICKUP; - KooperShellTossHoldTime = 8; + N(ShellTossHoldTime) = 8; kooper->moveSpeed -= 4.0; if (kooper->moveSpeed < 0.01) { kooper->moveSpeed = 0.01f; @@ -484,7 +486,7 @@ API_CALLABLE(KooperUseAbility) { } else if (ShellTossHitboxState == SHELL_TOSS_HITBOX_HIT_ENEMY) { sfx_play_sound_at_npc(SOUND_0, SOUND_SPACE_MODE_0, NPC_PARTNER); script->USE_STATE = SHELL_TOSS_STATE_HOLD; - KooperShellTossHoldTime = 30; + N(ShellTossHoldTime) = 30; kooper->moveSpeed = 0.0f; } else { if (kooper->planarFlyDist > 140.0f) { @@ -524,15 +526,15 @@ API_CALLABLE(KooperUseAbility) { kooper->planarFlyDist += 1.0; } - if (KooperShellTossHoldTime == 0) { + if (N(ShellTossHoldTime) == 0) { script->USE_STATE = SHELL_TOSS_STATE_RETURN; } - KooperShellTossHoldTime--; + N(ShellTossHoldTime)--; break; case SHELL_TOSS_STATE_HOLD: - if (KooperShellTossHoldTime != 0) { - KooperShellTossHoldTime--; + if (N(ShellTossHoldTime) != 0) { + N(ShellTossHoldTime)--; } else { script->USE_STATE = SHELL_TOSS_STATE_RETURN; } @@ -546,7 +548,7 @@ API_CALLABLE(KooperUseAbility) { ) { script->USE_STATE = SHELL_TOSS_STATE_FINISH; } else { - angleToStartPos = atan2(ShellTossPosX, ShellTossPosZ, kooper->pos.x, kooper->pos.z); + angleToStartPos = atan2(N(ShellTossPosX), N(ShellTossPosZ), kooper->pos.x, kooper->pos.z); kooper->yaw = angleToStartPos + get_clamped_angle_diff(kooper->yaw, angleToStartPos) * 0.125f; npc_move_heading(kooper, -kooper->moveSpeed, kooper->yaw); kooper->planarFlyDist -= kooper->moveSpeed; @@ -578,13 +580,13 @@ API_CALLABLE(KooperUseAbility) { testLength, -1.0f, -cos_deg(kooper->yaw + 180.0f), 1); script->USE_STATE = SHELL_TOSS_STATE_FINISH; } else { - if (KooperHasItem) { - heldItem = get_item_entity(KooperHeldItemIdx); + if (N(HasItem)) { + heldItem = get_item_entity(N(HeldItemIdx)); posX = kooper->pos.x; posY = kooper->pos.y + 8.0f; posZ = kooper->pos.z; - moveAngle = clamp_angle(playerStatus->targetYaw - (ShellTossPlayerFacingLeft ? 90.0f : -90.0f)); + moveAngle = clamp_angle(playerStatus->targetYaw - (N(PlayerWasFacingLeft) ? 90.0f : -90.0f)); add_vec2D_polar(&posX, &posZ, 4.0f, moveAngle); heldItem->position.x = posX; @@ -605,9 +607,9 @@ API_CALLABLE(KooperUseAbility) { } if (script->USE_STATE == SHELL_TOSS_STATE_FINISH) { - if (ShellTossControlsPlayer) { + if (N(LockingPlayerInput)) { enable_player_input(); - ShellTossControlsPlayer = FALSE; + N(LockingPlayerInput) = FALSE; } ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED; @@ -621,12 +623,12 @@ API_CALLABLE(KooperUseAbility) { sfx_stop_sound(SOUND_284); disable_npc_blur(kooper); - if (KooperHasItem) { - auto_collect_item_entity(KooperHeldItemIdx); - KooperHasItem = FALSE; + if (N(HasItem)) { + auto_collect_item_entity(N(HeldItemIdx)); + N(HasItem) = FALSE; } - KooperTriggeredBattle = FALSE; + N(TriggeredBattle) = FALSE; partner_clear_player_tracking(kooper); return ApiStatus_DONE2; } @@ -634,13 +636,13 @@ API_CALLABLE(KooperUseAbility) { return ApiStatus_BLOCK; } -EvtScript EVS_KooperUseAbility = { - EVT_CALL(KooperUseAbility) +EvtScript EVS_WorldKooper_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -API_CALLABLE(KooperPutAway) { +API_CALLABLE(N(PutAway)) { Npc* kooper = script->owner2.npc; if (isInitialCall) { @@ -650,13 +652,13 @@ API_CALLABLE(KooperPutAway) { return partner_put_away(kooper) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -EvtScript EVS_KooperPutAway = { - EVT_CALL(KooperPutAway) +EvtScript EVS_WorldKooper_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; -s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) { +s32 N(test_first_strike)(Npc* kooper, Npc* enemy) { f32 xTemp, yTemp, zTemp; f32 enemyX, enemyY, enemyZ; f32 kooperX; @@ -717,19 +719,19 @@ s32 world_kooper_test_first_strike(Npc* kooper, Npc* enemy) { return FALSE; } -void world_kooper_pre_battle(Npc* kooper) { +void N(pre_battle)(Npc* kooper) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* kooperActionStatus = &gPartnerActionStatus; - KooperTriggeredBattle = FALSE; + N(TriggeredBattle) = FALSE; if (kooperActionStatus->partnerActionState != PARTNER_ACTION_NONE) { if (kooperActionStatus->partnerActionState == PARTNER_ACTION_KOOPER_TOSS) { - KooperTriggeredBattle = TRUE; + N(TriggeredBattle) = TRUE; } - if (ShellTossControlsPlayer) { + if (N(LockingPlayerInput)) { enable_player_input(); - ShellTossControlsPlayer = FALSE; + N(LockingPlayerInput) = FALSE; } ShellTossHitboxState = SHELL_TOSS_HITBOX_DISABLED; @@ -749,8 +751,8 @@ void world_kooper_pre_battle(Npc* kooper) { } } -void world_kooper_post_battle(Npc* npc) { - if (KooperTriggeredBattle) { +void N(post_battle)(Npc* npc) { + if (N(TriggeredBattle)) { partner_clear_player_tracking(npc); partner_use_ability(); } diff --git a/src/world/partner/kooper.h b/src/world/partner/kooper.h index f156bdf523..614719c2a9 100644 --- a/src/world/partner/kooper.h +++ b/src/world/partner/kooper.h @@ -9,9 +9,9 @@ s32 world_kooper_test_first_strike(Npc*, Npc*); void world_kooper_pre_battle(Npc*); void world_kooper_post_battle(Npc*); -extern EvtScript EVS_WorldKooperTakeOut; -extern EvtScript EVS_WorldKooperUpdate; -extern EvtScript EVS_KooperUseAbility; -extern EvtScript EVS_KooperPutAway; +extern EvtScript EVS_WorldKooper_TakeOut; +extern EvtScript EVS_WorldKooper_Update; +extern EvtScript EVS_WorldKooper_UseAbility; +extern EvtScript EVS_WorldKooper_PutAway; #endif diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index 0a5ec453d4..fbbb087b56 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -3,6 +3,8 @@ #include "effects.h" #include "sprite/npc/WorldLakilester.h" +#define NAMESPACE world_lakilester + BSS s32 D_802BFF00; BSS s32 D_802BFF04; BSS s32 D_802BFF08; @@ -61,7 +63,7 @@ void world_lakilester_init(Npc* npc) { npc->moveToPos.z = npc->pos.z; } -ApiStatus func_802BD29C_320DEC(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BD29C_320DEC) { Npc* lakilester = script->owner2.npc; if (isInitialCall) { @@ -71,7 +73,7 @@ ApiStatus func_802BD29C_320DEC(Evt* script, s32 isInitialCall) { return partner_get_out(lakilester) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -EvtScript world_lakilester_take_out = { +EvtScript EVS_WorldLakilester_TakeOut = { EVT_CALL(func_802BD29C_320DEC) EVT_RETURN EVT_END @@ -79,7 +81,7 @@ EvtScript world_lakilester_take_out = { TweesterPhysics* LakilesterTweesterPhysicsPtr = &LakilesterTweesterPhysics; -ApiStatus func_802BD2D4_320E24(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BD2D4_320E24) { PlayerData* playerData = &gPlayerData; Npc* lakilester = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -161,7 +163,7 @@ ApiStatus func_802BD2D4_320E24(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_lakilester_update = { +EvtScript EVS_WorldLakilester_Update = { EVT_CALL(func_802BD2D4_320E24) EVT_RETURN EVT_END @@ -553,7 +555,7 @@ API_CALLABLE(LakilesterUseAbility) { D_802BFF14 = 40; } - if (partnerActionStatus->partnerAction_unk_1 == 0) { + if (!partnerActionStatus->partnerAction_unk_1) { if (gGameStatusPtr->keepUsingPartnerOnMapChange == FALSE) { if (playerStatus->actionState == ACTION_STATE_RIDE || playerStatus->actionState == ACTION_STATE_IDLE @@ -567,7 +569,7 @@ API_CALLABLE(LakilesterUseAbility) { } } } else { - partnerActionStatus->partnerAction_unk_1 = 0; + partnerActionStatus->partnerAction_unk_1 = FALSE; playerStatus->flags &= ~PS_FLAG_PAUSE_DISABLED; npc->flags &= ~(NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8); npc->flags |= NPC_FLAG_IGNORE_PLAYER_COLLISION; @@ -825,7 +827,7 @@ API_CALLABLE(LakilesterUseAbility) { D_802BFF14++; /* fallthrough */ case 5: - gCameras[0].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; + gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; playerStatus->position.y += npc->jumpVelocity; sp2C = playerStatus->colliderHeight * 0.5f; @@ -851,9 +853,9 @@ API_CALLABLE(LakilesterUseAbility) { break; } - gCameras[0].targetPos.x = playerStatus->position.x; - gCameras[0].targetPos.y = npc->moveToPos.y; - gCameras[0].targetPos.z = playerStatus->position.z; + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; + gCameras[CAM_DEFAULT].targetPos.y = npc->moveToPos.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; if (D_802BFF14 == 10) { D_802BFF0C = 0; @@ -907,13 +909,13 @@ API_CALLABLE(LakilesterUseAbility) { } -EvtScript EVS_LakilesterUseAbility = { +EvtScript EVS_WorldLakilester_UseAbility = { EVT_CALL(LakilesterUseAbility) EVT_RETURN EVT_END }; -ApiStatus func_802BF4F0_323040(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BF4F0_323040) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; Camera* cam = &gCameras[CAM_DEFAULT]; @@ -1045,7 +1047,7 @@ ApiStatus func_802BF4F0_323040(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_lakilester_put_away = { +EvtScript EVS_WorldLakilester_PutAway = { EVT_CALL(func_802BF4F0_323040) EVT_RETURN EVT_END @@ -1056,7 +1058,7 @@ void world_lakilester_pre_battle(Npc* npc) { if (D_802BFF0C) { partnerActionStatus->npc = *npc; - partnerActionStatus->partnerAction_unk_1 = 1; + partnerActionStatus->partnerAction_unk_1 = TRUE; enable_player_static_collisions(); enable_player_input(); set_action_state(ACTION_STATE_IDLE); @@ -1070,7 +1072,7 @@ void world_lakilester_pre_battle(Npc* npc) { void world_lakilester_post_battle(Npc* npc) { PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; - if (partnerActionStatus->partnerAction_unk_1 != 0) { + if (partnerActionStatus->partnerAction_unk_1) { if (D_802BFF0C) { *npc = partnerActionStatus->npc; gGameStatusPtr->keepUsingPartnerOnMapChange = 1; @@ -1090,22 +1092,19 @@ void func_802BFB44_323694(f32 arg0) { add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, arg0, currentCamera->currentYaw); } -s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BFBA0_3236F0) { PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; PlayerStatus* playerStatus = &gPlayerStatus; Npc* npc = get_npc_unsafe(NPC_PARTNER); f32 temp_f0, temp_f2, temp_f4; f32* temp_s0_2; s32 temp_v0_2; - s32 tempVar; if (isInitialCall) { script->functionTemp[0] = 0; } - tempVar = script->functionTemp[0]; - - switch (tempVar) { + switch (script->functionTemp[0]) { case 0: if (script->varTable[12] == 0) { temp_f0 = playerStatus->position.x; @@ -1163,7 +1162,7 @@ s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) { if (script->functionTemp[1] == 0) { if (script->varTable[12] != 0) { - partnerActionStatus->partnerAction_unk_1 = tempVar; + partnerActionStatus->partnerAction_unk_1 = TRUE; set_action_state(ACTION_STATE_RIDE); partnerActionStatus->actingPartner = PARTNER_NONE; partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; @@ -1178,7 +1177,7 @@ s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_lakilester_while_riding = { +EvtScript evs_worldlakilester_riding = { EVT_CALL(func_802BFBA0_3236F0) EVT_RETURN EVT_END diff --git a/src/world/partner/lakilester.h b/src/world/partner/lakilester.h index c2744c7eec..51a409fcb0 100644 --- a/src/world/partner/lakilester.h +++ b/src/world/partner/lakilester.h @@ -8,10 +8,10 @@ void world_lakilester_init(Npc*); void world_lakilester_pre_battle(Npc*); void world_lakilester_post_battle(Npc*); -extern EvtScript world_lakilester_take_out; -extern EvtScript world_lakilester_update; -extern EvtScript EVS_LakilesterUseAbility; -extern EvtScript world_lakilester_put_away; -extern EvtScript world_lakilester_while_riding; +extern EvtScript EVS_WorldLakilester_TakeOut; +extern EvtScript EVS_WorldLakilester_Update; +extern EvtScript EVS_WorldLakilester_UseAbility; +extern EvtScript EVS_WorldLakilester_PutAway; +extern EvtScript evs_worldlakilester_riding; #endif diff --git a/src/world/partner/parakarry.c b/src/world/partner/parakarry.c index 86fc66de09..d2faf00369 100644 --- a/src/world/partner/parakarry.c +++ b/src/world/partner/parakarry.c @@ -2,44 +2,65 @@ #include "../src/world/partners.h" #include "sprite/npc/WorldParakarry.h" -BSS s32 D_802BEBB0; -BSS s32 D_802BEBB4; -BSS s32 D_802BEBB8; -BSS s32 D_802BEBBC; -BSS s32 D_802BEBC0_31CBE0; -BSS s32 D_802BEBC4; -BSS TweesterPhysics ParakarryTweesterPhysics; +#define NAMESPACE world_parakarry -void world_parakarry_init(Npc* parakarry) { +BSS b32 N(UsingAbility); +BSS b32 N(LockingPlayerInput); +BSS b32 N(PlayerCollisionDisabled); // minor bug: never gets properly reset to FALSE +BSS b32 N(PlayerWasFacingLeft); +BSS s32 N(UseAbilityState); +BSS s32 N(AbilityStateTime); +BSS TweesterPhysics N(TweesterPhysicsData); + +enum { + AIR_LIFT_NONE = 0, // only used for initial value + // next two states lock input for a few frames, during which the ability can be canceled + AIR_LIFT_INIT = 40, + AIR_LIFT_DELAY = 41, + AIR_LIFT_BEGIN = 30, + AIR_LIFT_GATHER = 31, + AIR_LIFT_PICKUP = 1, // pick up the player and lift them into the air + AIR_LIFT_CARRY = 2, // carry the player through the air + AIR_LIFT_HOLD = 6, // remain in one position for a short period of time + AIR_LIFT_JUMP = 20, // player jumped off while being carried + AIR_LIFT_DROP = 21, // dropping the player + AIR_LIFT_CANCEL = 22, +}; + +void N(init)(Npc* parakarry) { parakarry->collisionHeight = 37; parakarry->collisionRadius = 40; - D_802BEBB0 = 0; - D_802BEBC0_31CBE0 = 0; - D_802BEBB4 = 0; - D_802BEBB8 = 0; - D_802BEBBC = 0; - D_802BEBC4 = 0; + N(UsingAbility) = FALSE; + N(UseAbilityState) = AIR_LIFT_NONE; + N(LockingPlayerInput) = FALSE; + N(PlayerCollisionDisabled) = FALSE; + N(PlayerWasFacingLeft) = FALSE; + N(AbilityStateTime) = 0; } -ApiStatus ParakarryTakeOut(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(TakeOut)) { Npc* parakarry = script->owner2.npc; if (isInitialCall) { partner_init_get_out(parakarry); } - return partner_get_out(parakarry) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_get_out(parakarry)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_parakarry_take_out = { - EVT_CALL(ParakarryTakeOut) +EvtScript EVS_WorldParakarry_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -TweesterPhysics* ParakarryTweesterPhysicsPtr = &ParakarryTweesterPhysics; +TweesterPhysics* N(TweesterPhysicsPtr) = &N(TweesterPhysicsData); -ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* parakarry = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; @@ -47,7 +68,7 @@ ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) { if (isInitialCall) { partner_flying_enable(parakarry, 1); - mem_clear(ParakarryTweesterPhysicsPtr, sizeof(TweesterPhysics)); + mem_clear(N(TweesterPhysicsPtr), sizeof(TweesterPhysics)); TweesterTouchingPartner = NULL; } @@ -60,61 +81,61 @@ ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } - switch (ParakarryTweesterPhysicsPtr->state) { + switch (N(TweesterPhysicsPtr)->state) { case TWEESTER_PARTNER_INIT: - ParakarryTweesterPhysicsPtr->state++; - ParakarryTweesterPhysicsPtr->prevFlags = parakarry->flags; - ParakarryTweesterPhysicsPtr->radius = fabsf(dist2D(parakarry->pos.x, parakarry->pos.z, + N(TweesterPhysicsPtr)->state++; + N(TweesterPhysicsPtr)->prevFlags = parakarry->flags; + N(TweesterPhysicsPtr)->radius = fabsf(dist2D(parakarry->pos.x, parakarry->pos.z, entity->position.x, entity->position.z)); - ParakarryTweesterPhysicsPtr->angle = atan2(entity->position.x, entity->position.z, + N(TweesterPhysicsPtr)->angle = atan2(entity->position.x, entity->position.z, parakarry->pos.x, parakarry->pos.z); - ParakarryTweesterPhysicsPtr->angularVelocity = 6.0f; - ParakarryTweesterPhysicsPtr->liftoffVelocityPhase = 50.0f; - ParakarryTweesterPhysicsPtr->countdown = 120; + N(TweesterPhysicsPtr)->angularVelocity = 6.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 50.0f; + N(TweesterPhysicsPtr)->countdown = 120; parakarry->flags |= NPC_FLAG_IGNORE_CAMERA_FOR_YAW | NPC_FLAG_IGNORE_PLAYER_COLLISION | NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; parakarry->flags &= ~NPC_FLAG_GRAVITY; case TWEESTER_PARTNER_ATTRACT: - sin_cos_rad(DEG_TO_RAD(ParakarryTweesterPhysicsPtr->angle), &sinAngle, &cosAngle); - parakarry->pos.x = entity->position.x + (sinAngle * ParakarryTweesterPhysicsPtr->radius); - parakarry->pos.z = entity->position.z - (cosAngle * ParakarryTweesterPhysicsPtr->radius); - ParakarryTweesterPhysicsPtr->angle = clamp_angle(ParakarryTweesterPhysicsPtr->angle - ParakarryTweesterPhysicsPtr->angularVelocity); + sin_cos_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->angle), &sinAngle, &cosAngle); + parakarry->pos.x = entity->position.x + (sinAngle * N(TweesterPhysicsPtr)->radius); + parakarry->pos.z = entity->position.z - (cosAngle * N(TweesterPhysicsPtr)->radius); + N(TweesterPhysicsPtr)->angle = clamp_angle(N(TweesterPhysicsPtr)->angle - N(TweesterPhysicsPtr)->angularVelocity); - if (ParakarryTweesterPhysicsPtr->radius > 20.0f) { - ParakarryTweesterPhysicsPtr->radius--; - } else if (ParakarryTweesterPhysicsPtr->radius < 19.0f) { - ParakarryTweesterPhysicsPtr->radius++; + if (N(TweesterPhysicsPtr)->radius > 20.0f) { + N(TweesterPhysicsPtr)->radius--; + } else if (N(TweesterPhysicsPtr)->radius < 19.0f) { + N(TweesterPhysicsPtr)->radius++; } - liftoffVelocity = sin_rad(DEG_TO_RAD(ParakarryTweesterPhysicsPtr->liftoffVelocityPhase)) * 3.0f; - ParakarryTweesterPhysicsPtr->liftoffVelocityPhase += 3.0f; + liftoffVelocity = sin_rad(DEG_TO_RAD(N(TweesterPhysicsPtr)->liftoffVelocityPhase)) * 3.0f; + N(TweesterPhysicsPtr)->liftoffVelocityPhase += 3.0f; - if (ParakarryTweesterPhysicsPtr->liftoffVelocityPhase > 150.0f) { - ParakarryTweesterPhysicsPtr->liftoffVelocityPhase = 150.0f; + if (N(TweesterPhysicsPtr)->liftoffVelocityPhase > 150.0f) { + N(TweesterPhysicsPtr)->liftoffVelocityPhase = 150.0f; } parakarry->pos.y += liftoffVelocity; - parakarry->renderYaw = clamp_angle(360.0f - ParakarryTweesterPhysicsPtr->angle); - ParakarryTweesterPhysicsPtr->angularVelocity += 0.8; + parakarry->renderYaw = clamp_angle(360.0f - N(TweesterPhysicsPtr)->angle); + N(TweesterPhysicsPtr)->angularVelocity += 0.8; - if (ParakarryTweesterPhysicsPtr->angularVelocity > 40.0f) { - ParakarryTweesterPhysicsPtr->angularVelocity = 40.0f; + if (N(TweesterPhysicsPtr)->angularVelocity > 40.0f) { + N(TweesterPhysicsPtr)->angularVelocity = 40.0f; } - if (--ParakarryTweesterPhysicsPtr->countdown == 0) { - ParakarryTweesterPhysicsPtr->state++; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state++; } break; case TWEESTER_PARTNER_HOLD: - parakarry->flags = ParakarryTweesterPhysicsPtr->prevFlags; - ParakarryTweesterPhysicsPtr->countdown = 30; - ParakarryTweesterPhysicsPtr->state++; + parakarry->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->countdown = 30; + N(TweesterPhysicsPtr)->state++; break; case TWEESTER_PARTNER_RELEASE: partner_flying_update_player_tracking(parakarry); partner_flying_update_motion(parakarry); - if (--ParakarryTweesterPhysicsPtr->countdown == 0) { - ParakarryTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + if (--N(TweesterPhysicsPtr)->countdown == 0) { + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; TweesterTouchingPartner = NULL; } break; @@ -122,514 +143,534 @@ ApiStatus ParakarryUpdate(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_parakarry_update = { - EVT_CALL(ParakarryUpdate) +EvtScript EVS_WorldParakarry_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -void func_802BD514_319A84(Npc* parakarry) { +void N(try_cancel_tweester)(Npc* parakarry) { if (TweesterTouchingPartner) { TweesterTouchingPartner = NULL; - parakarry->flags = ParakarryTweesterPhysicsPtr->prevFlags; - ParakarryTweesterPhysicsPtr->state = TWEESTER_PARTNER_INIT; + parakarry->flags = N(TweesterPhysicsPtr)->prevFlags; + N(TweesterPhysicsPtr)->state = TWEESTER_PARTNER_INIT; partner_clear_player_tracking (parakarry); } } -s32 func_802BD558_319AC8(void) { - f32 sp28, sp2C, sp30, sp34, sp38, sp3C, sp40, sp44; +s32 N(update_current_floor)(void) { + f32 x, y, z, length, hitRx, hitRz, hitDirX, hitDirZ; f32 colliderBaseHeight = gPlayerStatus.colliderHeight; - s32 raycastResult; + s32 hitResult; s32 surfaceType; - sp28 = gPlayerStatus.position.x; - sp2C = gPlayerStatus.position.y + (colliderBaseHeight * 0.5); - sp30 = gPlayerStatus.position.z; - sp34 = colliderBaseHeight * 0.5f; + x = gPlayerStatus.position.x; + y = gPlayerStatus.position.y + (colliderBaseHeight * 0.5); + z = gPlayerStatus.position.z; + length = colliderBaseHeight / 2.0f; - raycastResult = player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, - &sp3C, &sp40, &sp44); + hitResult = player_raycast_below_cam_relative(&gPlayerStatus, &x, &y, &z, &length, &hitRx, + &hitRz, &hitDirX, &hitDirZ); - surfaceType = get_collider_flags(raycastResult) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + surfaceType = get_collider_flags(hitResult) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) { gPlayerStatus.hazardType = HAZARD_TYPE_SPIKES; - D_802BEBC0_31CBE0 = 0x15; gPlayerStatus.flags |= PS_FLAG_HIT_FIRE; + N(UseAbilityState) = AIR_LIFT_DROP; } - return raycastResult; + return hitResult; } -ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { +API_CALLABLE(N(UseAbility)) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; - Npc* parakarry = evt->owner2.npc; + Npc* parakarry = script->owner2.npc; s32 buttonTemp = BUTTON_A; - f32 x, y, z, sp30, sp2C; - f32 diffZPlayer, diffXPlayer, diffZParakarry, diffXParakarry; - f32 tempX, tempZ; - s32 testMove; - u32 tempFrameCounterU32, tempFrameCounterTwoU32; - s32 tempConditional; - s32 diffTemp; - f32 tempYaw; + f32 x, y, z, yaw, length; + f32 playerDeltaX, playerDeltaZ; + f32 parakarryDeltaX, parakarryDeltaZ; f32 halfCollisionHeight; - u16 tempFrameCounter, tempFrameCounterTwo; + s32 hitCount; + b32 hitAbove; - if (gCurrentEncounter.unk_08 == 0) { - if (isInitialCall) { - func_802BD514_319A84(parakarry); - if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { - if (partnerActionStatus->partnerAction_unk_1 == 0) { - if (!func_800EA52C(PARTNER_PARAKARRY)) { - return ApiStatus_DONE2; - } - D_802BEBC0_31CBE0 = 0x28; - parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD; - parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD; - } else { - partnerActionStatus->partnerAction_unk_1 = 0; - set_action_state(ACTION_STATE_RIDE); - parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); - D_802BEBB0 = 1; - gCameras[0].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - parakarry->currentAnim = ANIM_WorldParakarry_CarryLight; - partnerActionStatus->actingPartner = PARTNER_PARAKARRY; - partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; - parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD; - parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD; - } - } else { - return ApiStatus_DONE2; - } - } + if (gCurrentEncounter.unk_08 != 0) { + return ApiStatus_BLOCK; + } - switch (D_802BEBC0_31CBE0) { - case 40: - if (playerStatus->inputDisabledCount == 0) { - D_802BEBC4 = 3; - D_802BEBC0_31CBE0 = 41; - evt->functionTemp[2] = playerStatus->inputDisabledCount; - } else { - goto block_end_return_ApiStatus_DONE2; // TODO remove this goto - } - case 41: - if (D_802BEBC4 == 0) { - if (evt->functionTemp[2] >= playerStatus->inputDisabledCount) { - if (func_800EA52C(PARTNER_PARAKARRY)) { - D_802BEBC0_31CBE0 = 30; - break; - } - } - return ApiStatus_DONE2; - } - D_802BEBC4--; - break; - } - - switch (D_802BEBC0_31CBE0) { - case 30: - set_action_state(ACTION_STATE_RIDE); - disable_player_input(); - disable_player_static_collisions(); - evt->functionTemp[2] = playerStatus->inputDisabledCount; - D_802BEBB4 = 1; - D_802BEBB8 = 1; - D_802BEBB0 = 1; - gCameras[0].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; - parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); - parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; - partnerActionStatus->actingPartner = PARTNER_PARAKARRY; - partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; - D_802BEBBC = partner_force_player_flip_done(); - enable_npc_blur(parakarry); - parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z); - parakarry->duration = 4; - D_802BEBC0_31CBE0++; - break; - case 31: - 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_HOP) { - disable_npc_blur(parakarry); - D_802BEBC0_31CBE0 = 21; - } else { - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - parakarry->moveToPos.x = playerStatus->position.x; - parakarry->moveToPos.y = playerStatus->position.y + 32.0f; - parakarry->moveToPos.z = playerStatus->position.z; - parakarry->currentAnim = ANIM_WorldParakarry_Run; - add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 0.0f, playerStatus->targetYaw); - tempYaw = playerStatus->targetYaw; - - tempYaw += (D_802BEBBC == 0) ? 90.0f : -90.0f; - - add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 5.0f, clamp_angle(tempYaw)); - - parakarry->pos.x += (parakarry->moveToPos.x - parakarry->pos.x) / parakarry->duration; - parakarry->pos.y += (parakarry->moveToPos.y - parakarry->pos.y) / parakarry->duration; - parakarry->pos.z += (parakarry->moveToPos.z - parakarry->pos.z) / parakarry->duration; - parakarry->duration--; - if (parakarry->duration != 0) { - if (evt->functionTemp[2] < playerStatus->inputDisabledCount) { - disable_npc_blur(parakarry); - D_802BEBC0_31CBE0 = 0x16; - } - } else { - disable_npc_blur(parakarry); - parakarry->yaw = playerStatus->targetYaw; - parakarry->moveSpeed = 0.2f; - parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; - parakarry->planarFlyDist = 0; - suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); - sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); - gCollisionStatus.lastTouchedFloor = -1; - gCollisionStatus.currentFloor = -1; - parakarry->currentFloor = -1; - D_802BEBC4 = 0x14; - D_802BEBC0_31CBE0 = 1; - } - } - break; - case 1: - if (playerStatus->actionState != ACTION_STATE_HIT_FIRE && playerStatus->actionState != ACTION_STATE_HIT_LAVA && playerStatus->actionState != ACTION_STATE_KNOCKBACK) { - if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) { - D_802BEBC0_31CBE0 = (partnerActionStatus->pressedButtons & BUTTON_A) ? 0x14 : 0x15; - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - } else { - tempFrameCounter = gGameStatusPtr->frameCounter; - tempFrameCounterU32 = tempFrameCounter; - tempFrameCounterU32 /= 6; - if (!((tempFrameCounter - tempFrameCounterU32 * 6) & 0xFFFF)) { - sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); - } - sp2C = fabsf(sin_rad(DEG_TO_RAD((20 - D_802BEBC4) * 18))) * 1.3; - playerStatus->position.y += sp2C; - parakarry->pos.y += sp2C; - x = parakarry->pos.x; - y = parakarry->pos.y + parakarry->collisionHeight * 0.5f; - z = parakarry->pos.z; - sp2C = parakarry->collisionHeight * 0.5f; - halfCollisionHeight = sp2C; - - if (npc_raycast_up(COLLISION_CHANNEL_10000, &x, &y, &z, &sp2C)) { - if (sp2C < halfCollisionHeight) { - D_802BEBC4 = 0; - } - } - - x = playerStatus->position.x; - z = playerStatus->position.z; - sp2C = playerStatus->colliderHeight * 0.5f; - y = playerStatus->position.y + playerStatus->colliderHeight * 0.5f; - halfCollisionHeight = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; - if (player_raycast_up_corners(playerStatus, &x, &y, &z, &sp2C, halfCollisionHeight) >= 0) { - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - D_802BEBC0_31CBE0 = 0x15; - break; - } - - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; - if (npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter) >= 2) { - playerStatus->position.x += (x - playerStatus->position.x) * 0.125f; - playerStatus->position.z += (z - playerStatus->position.z) * 0.125f; - parakarry->pos.x += (x - parakarry->pos.x) * 0.125f; - parakarry->pos.z += (z - parakarry->pos.z) * 0.125f; - } - - x = parakarry->pos.x; - y = parakarry->pos.y; - z = parakarry->pos.z; - testMove = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionRadius); - if (testMove >= 2) { - tempX = x; - tempZ = z; - diffXParakarry = (x - parakarry->pos.x) * 0.125f; - diffZParakarry = (z - parakarry->pos.z) * 0.125f; - - x = parakarry->pos.x + diffXParakarry; - z = parakarry->pos.z + diffZParakarry; - x = parakarry->pos.x; - y = parakarry->pos.y; - diffXPlayer = (tempX - playerStatus->position.x) * 0.125f; - diffZPlayer = (tempZ - playerStatus->position.z) * 0.125f; - z = parakarry->pos.z; - testMove = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, parakarry->collisionHeight, parakarry->collisionRadius); - if (testMove == 0) { - playerStatus->position.x += diffXPlayer; - playerStatus->position.z += diffZPlayer; - parakarry->pos.x += diffXParakarry; - parakarry->pos.z += diffZParakarry; - } - } - - if (testMove == 0 && !(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { - add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); - parakarry->planarFlyDist += parakarry->moveSpeed; - } - - x = playerStatus->position.x; - y = playerStatus->position.y + playerStatus->colliderHeight * 0.5f; - z = playerStatus->position.z; - sp2C = playerStatus->colliderHeight * 0.5f; - if (npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &sp2C, parakarry->yaw, parakarry->collisionRadius)) { - 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; - D_802BEBC0_31CBE0 = 0x15; - playerStatus->flags |= PS_FLAG_HIT_FIRE; - } - - playerStatus->position.y += (y - playerStatus->position.y) * 0.25f; - parakarry->pos.y = playerStatus->position.y + 32.0f; - } - if (!(parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - if (D_802BEBC4 != 0) { - D_802BEBC4--; - } else { - parakarry->jumpVelocity = -0.5f; - parakarry->jumpScale = -0.01f; - parakarry->moveToPos.y = playerStatus->position.y; - parakarry->duration = 0; - parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; - parakarry->animationSpeed = 1.8f; - gCollisionStatus.currentFloor = -1; - D_802BEBC0_31CBE0++; - } - } else { - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - D_802BEBC0_31CBE0 = 0x15; - } - } - } else { - D_802BEBC0_31CBE0 = 0x15; - } - break; - case 2: - gCollisionStatus.currentFloor = func_802BD558_319AC8(); - if (playerStatus->actionState != ACTION_STATE_HIT_FIRE && playerStatus->actionState != ACTION_STATE_HIT_LAVA && playerStatus->actionState != ACTION_STATE_KNOCKBACK) { - suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); - if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) { - if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) { - if (partnerActionStatus->pressedButtons & buttonTemp) { // TODO find a way to remove this while still loading 0x15 instead of moving it from register - if (!parakarry->pos.x) { - - } - } - D_802BEBC0_31CBE0 = (partnerActionStatus->pressedButtons & BUTTON_A) ? 0x14 : 0x15; - } else { - - tempFrameCounterTwoU32 = gGameStatusPtr->frameCounter; - tempFrameCounterTwo = tempFrameCounterTwoU32; - tempFrameCounterTwoU32 /= 6; - if (!((tempFrameCounterTwo - tempFrameCounterTwoU32 * 6) & 0xFFFF)) { - sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); - } - - parakarry->jumpVelocity -= parakarry->jumpScale; - if (parakarry->jumpVelocity > 0.0) { - parakarry->jumpVelocity = 0.0f; - } - - parakarry->pos.y += parakarry->jumpVelocity; - playerStatus->position.y += parakarry->jumpVelocity; - if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { - parakarry->moveSpeed += 0.1; - if (parakarry->moveSpeed > 2.0) { - parakarry->moveSpeed = 2.0f; - } - - add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); - add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); - parakarry->planarFlyDist += parakarry->moveSpeed; - parakarry->animationSpeed -= 0.05; - if (parakarry->animationSpeed < 1.5) { - parakarry->animationSpeed = 1.5f; - } - if (parakarry->planarFlyDist > 80.0f) { - parakarry->animationSpeed += 0.5; - } - if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { - x = playerStatus->position.x; - y = playerStatus->position.y; - z = playerStatus->position.z; - if (npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter)) { - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - D_802BEBC0_31CBE0 = 0x15; - } else { - x = parakarry->pos.x; - y = parakarry->pos.y; - 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)) { - tempConditional = FALSE; - x = parakarry->pos.x; - y = parakarry->pos.y + parakarry->collisionHeight * 0.5f; - z = parakarry->pos.z; - sp2C = parakarry->collisionHeight * 0.5f; - - halfCollisionHeight = sp2C; - if (npc_raycast_up(COLLISION_CHANNEL_10000, &x, &y, &z, &sp2C) && (sp2C < halfCollisionHeight)) { - parakarry->pos.y = y - parakarry->collisionHeight; - playerStatus->position.y = parakarry->pos.y - 32.0f; - tempConditional = TRUE; - } - x = playerStatus->position.x; - y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); - z = playerStatus->position.z; - sp2C = playerStatus->colliderHeight * 0.5f; - - if (!npc_raycast_down_around(COLLISION_CHANNEL_10000, &x, &y, &z, &sp2C, parakarry->yaw, parakarry->collisionRadius) - || (playerStatus->position.y += (y - playerStatus->position.y) * 0.25f, - parakarry->pos.y = playerStatus->position.y + 32.0f, - y = parakarry->pos.y, - parakarry->pos.y = playerStatus->position.y, - spawn_surface_effects(parakarry, SURFACE_INTERACT_WALK), - parakarry->pos.y = y, (!tempConditional))) { - if (!phys_adjust_cam_on_landing()) { - gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAG_2; - } - gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; - gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; - gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - if (!(parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { - parakarry->duration++; - if (!(parakarry->planarFlyDist < 100.0f)) { - D_802BEBC4 = 5; - D_802BEBC0_31CBE0 = 6; - } - break; - } - } else { - D_802BEBC0_31CBE0 = 21; - break; - } - } - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - D_802BEBC0_31CBE0 = 21; - } - break; - } - } - suggest_player_anim_allow_backward(ANIM_Mario1_Idle); - D_802BEBC0_31CBE0 = 21; - } - } else { - D_802BEBC0_31CBE0 = 20; - } - } else { - D_802BEBC0_31CBE0 = 21; - } - break; - case 6: - if (D_802BEBC4 != 0) { - D_802BEBC4--; - } else { - D_802BEBC0_31CBE0 = 21; - } - break; - } - - if (D_802BEBC0_31CBE0 == 0x16 || D_802BEBC0_31CBE0 == 0x15 || D_802BEBC0_31CBE0 == 0x14) { - parakarry->currentAnim = ANIM_WorldParakarry_Idle; - D_802BEBB0 = 0; - parakarry->jumpVelocity = 0.0f; - parakarry->flags &= ~NPC_FLAG_JUMPING; - parakarry->animationSpeed = 1.0f; - partner_clear_player_tracking(parakarry); - partnerActionStatus->actingPartner = PARTNER_NONE; - partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; - enable_partner_ai(); - sfx_stop_sound(SOUND_2009); - if (D_802BEBB4 != 0) { - enable_player_input(); - } - if (D_802BEBB8 != 0) { - enable_player_static_collisions(); - } - if (!(playerStatus->flags & PS_FLAG_HIT_FIRE)) { - if (D_802BEBC0_31CBE0 == 0x14) { - start_bounce_b(); - } else if (D_802BEBC0_31CBE0 == 0x15) { - start_falling(); - gravity_use_fall_parms(); - playerStatus->flags |= PS_FLAG_SCRIPTED_FALL; - } else { - set_action_state(ACTION_STATE_IDLE); - } - } else { - set_action_state(ACTION_STATE_HIT_LAVA); - } -block_end_return_ApiStatus_DONE2: + if (isInitialCall) { + N(try_cancel_tweester)(parakarry); + if ((playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { return ApiStatus_DONE2; } + + if (!partnerActionStatus->partnerAction_unk_1) { + if (!func_800EA52C(PARTNER_PARAKARRY)) { + return ApiStatus_DONE2; + } + N(UseAbilityState) = AIR_LIFT_INIT; + parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD; + parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD; + } else { + partnerActionStatus->partnerAction_unk_1 = FALSE; + set_action_state(ACTION_STATE_RIDE); + parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); + N(UsingAbility) = TRUE; + gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; + parakarry->currentAnim = ANIM_WorldParakarry_CarryLight; + partnerActionStatus->actingPartner = PARTNER_PARAKARRY; + partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; + parakarry->flags &= ~NPC_FLAG_COLLDING_FORWARD_WITH_WORLD; + parakarry->flags |= NPC_FLAG_COLLDING_WITH_WORLD; + } } + + switch (N(UseAbilityState)) { + case AIR_LIFT_INIT: + if (playerStatus->inputDisabledCount != 0) { + return ApiStatus_DONE2; + } + N(AbilityStateTime) = 3; + N(UseAbilityState) = AIR_LIFT_DELAY; + script->functionTemp[2] = playerStatus->inputDisabledCount; + // fallthrough + case AIR_LIFT_DELAY: + if (N(AbilityStateTime) == 0) { + if (script->functionTemp[2] < playerStatus->inputDisabledCount || !func_800EA52C(PARTNER_PARAKARRY)) { + return ApiStatus_DONE2; + } + N(UseAbilityState) = AIR_LIFT_BEGIN; + } else { + N(AbilityStateTime)--; + } + break; + } + + switch (N(UseAbilityState)) { + case AIR_LIFT_BEGIN: + set_action_state(ACTION_STATE_RIDE); + disable_player_input(); + disable_player_static_collisions(); + script->functionTemp[2] = playerStatus->inputDisabledCount; + N(LockingPlayerInput) = TRUE; + N(PlayerCollisionDisabled) = TRUE; + N(UsingAbility) = TRUE; + gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_IGNORE_PLAYER_Y; + parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); + parakarry->flags |= NPC_FLAG_IGNORE_WORLD_COLLISION | NPC_FLAG_8; + partnerActionStatus->actingPartner = PARTNER_PARAKARRY; + partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; + N(PlayerWasFacingLeft) = partner_force_player_flip_done(); + enable_npc_blur(parakarry); + parakarry->yaw = atan2(parakarry->pos.x, parakarry->pos.z, playerStatus->position.x, playerStatus->position.z); + parakarry->duration = 4; + N(UseAbilityState)++; // AIR_LIFT_GATHER + break; + case AIR_LIFT_GATHER: + 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_HOP + ) { + disable_npc_blur(parakarry); + N(UseAbilityState) = AIR_LIFT_DROP; + } else { + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + parakarry->moveToPos.x = playerStatus->position.x; + parakarry->moveToPos.y = playerStatus->position.y + 32.0f; + parakarry->moveToPos.z = playerStatus->position.z; + parakarry->currentAnim = ANIM_WorldParakarry_Run; + add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 0.0f, playerStatus->targetYaw); + yaw = playerStatus->targetYaw; + + yaw += !N(PlayerWasFacingLeft) ? 90.0f : -90.0f; + + add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 5.0f, clamp_angle(yaw)); + + parakarry->pos.x += (parakarry->moveToPos.x - parakarry->pos.x) / parakarry->duration; + parakarry->pos.y += (parakarry->moveToPos.y - parakarry->pos.y) / parakarry->duration; + parakarry->pos.z += (parakarry->moveToPos.z - parakarry->pos.z) / parakarry->duration; + parakarry->duration--; + if (parakarry->duration != 0) { + if (script->functionTemp[2] < playerStatus->inputDisabledCount) { + disable_npc_blur(parakarry); + N(UseAbilityState) = AIR_LIFT_CANCEL; + } + } else { + disable_npc_blur(parakarry); + parakarry->yaw = playerStatus->targetYaw; + parakarry->moveSpeed = 0.2f; + parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; + parakarry->planarFlyDist = 0; + suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); + sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); + gCollisionStatus.lastTouchedFloor = NO_COLLIDER; + gCollisionStatus.currentFloor = NO_COLLIDER; + parakarry->currentFloor = NO_COLLIDER; + N(AbilityStateTime) = 20; + N(UseAbilityState) = AIR_LIFT_PICKUP; + } + } + break; + case AIR_LIFT_PICKUP: + if (playerStatus->actionState == ACTION_STATE_HIT_FIRE + || playerStatus->actionState == ACTION_STATE_HIT_LAVA + || playerStatus->actionState == ACTION_STATE_KNOCKBACK + ) { + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + // handle jump/cancel inputs + if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) { + N(UseAbilityState) = (partnerActionStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP; + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + break; + } + + if (gGameStatusPtr->frameCounter % 6 == 0) { + sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); + } + + length = fabsf(sin_rad(DEG_TO_RAD((20 - N(AbilityStateTime)) * 18))) * 1.3; + playerStatus->position.y += length; + parakarry->pos.y += length; + x = parakarry->pos.x; + y = parakarry->pos.y + parakarry->collisionHeight / 2.0f; + z = parakarry->pos.z; + length = parakarry->collisionHeight / 2.0f; + halfCollisionHeight = length; + + if (npc_raycast_up(COLLISION_CHANNEL_10000, &x, &y, &z, &length)) { + if (length < halfCollisionHeight) { + N(AbilityStateTime) = 0; + } + } + + length = playerStatus->colliderHeight / 2.0f; + x = playerStatus->position.x; + y = playerStatus->position.y + playerStatus->colliderHeight / 2.0f; + z = playerStatus->position.z; + halfCollisionHeight = playerStatus->spriteFacingAngle - 90.0f + gCameras[gCurrentCameraID].currentYaw; + if (player_raycast_up_corners(playerStatus, &x, &y, &z, &length, halfCollisionHeight) >= 0) { + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + + x = playerStatus->position.x; + y = playerStatus->position.y; + z = playerStatus->position.z; + hitCount = npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter); + if (hitCount > 1) { + playerStatus->position.x += (x - playerStatus->position.x) / 8.0f; + playerStatus->position.z += (z - playerStatus->position.z) / 8.0f; + parakarry->pos.x += (x - parakarry->pos.x) / 8.0f; + parakarry->pos.z += (z - parakarry->pos.z) / 8.0f; + } + + 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); + 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); + if (hitCount == 0) { + playerStatus->position.x += playerDeltaX; + playerStatus->position.z += playerDeltaZ; + parakarry->pos.x += parakarryDeltaX; + parakarry->pos.z += parakarryDeltaZ; + } + } + + if (hitCount == 0 && !(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { + add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); + add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); + parakarry->planarFlyDist += parakarry->moveSpeed; + } + + x = playerStatus->position.x; + 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)) { + 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; + playerStatus->flags |= PS_FLAG_HIT_FIRE; + N(UseAbilityState) = AIR_LIFT_DROP; + } + + playerStatus->position.y += (y - playerStatus->position.y) / 4.0f; + parakarry->pos.y = playerStatus->position.y + 32.0f; + } + + if (parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD) { + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + if (N(AbilityStateTime) != 0) { + N(AbilityStateTime)--; + } else { + parakarry->jumpVelocity = -0.5f; + parakarry->jumpScale = -0.01f; + parakarry->moveToPos.y = playerStatus->position.y; + parakarry->duration = 0; + parakarry->currentAnim = ANIM_WorldParakarry_CarryHeavy; + parakarry->animationSpeed = 1.8f; + gCollisionStatus.currentFloor = NO_COLLIDER; + N(UseAbilityState)++; // AIR_LIFT_CARRY + } + break; + case AIR_LIFT_CARRY: + gCollisionStatus.currentFloor = N(update_current_floor)(); + if (playerStatus->actionState == ACTION_STATE_HIT_FIRE + || playerStatus->actionState == ACTION_STATE_HIT_LAVA + || playerStatus->actionState == ACTION_STATE_KNOCKBACK + ) { + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + + suggest_player_anim_always_forward(ANIM_MarioW2_HoldOnto); + if (playerStatus->flags & PS_FLAG_HIT_FIRE) { + N(UseAbilityState) = AIR_LIFT_JUMP; + break; + } + + // handle jump/cancel inputs + if (partnerActionStatus->pressedButtons & (BUTTON_A | BUTTON_B | BUTTON_C_DOWN)) { + if (partnerActionStatus->pressedButtons & buttonTemp) { // TODO find a way to remove this while still loading 0x15 instead of moving it from register + if (!parakarry->pos.x) { + + } + } + N(UseAbilityState) = (partnerActionStatus->pressedButtons & BUTTON_A) ? AIR_LIFT_JUMP : AIR_LIFT_DROP; + break; + } + + if (gGameStatusPtr->frameCounter % 6 == 0) { + sfx_play_sound_at_npc(SOUND_2009, SOUND_SPACE_MODE_0, NPC_PARTNER); + } + + parakarry->jumpVelocity -= parakarry->jumpScale; + if (parakarry->jumpVelocity > 0.0) { + parakarry->jumpVelocity = 0.0f; + } + + parakarry->pos.y += parakarry->jumpVelocity; + playerStatus->position.y += parakarry->jumpVelocity; + if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { + parakarry->moveSpeed += 0.1; + if (parakarry->moveSpeed > 2.0) { + parakarry->moveSpeed = 2.0f; + } + + add_vec2D_polar(¶karry->pos.x, ¶karry->pos.z, parakarry->moveSpeed, parakarry->yaw); + add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, parakarry->moveSpeed, parakarry->yaw); + parakarry->planarFlyDist += parakarry->moveSpeed; + parakarry->animationSpeed -= 0.05; + if (parakarry->animationSpeed < 1.5) { + parakarry->animationSpeed = 1.5f; + } + if (parakarry->planarFlyDist > 80.0f) { + parakarry->animationSpeed += 0.5; + } + if (!(playerStatus->animFlags & PA_FLAG_NPC_COLLIDED)) { + x = playerStatus->position.x; + y = playerStatus->position.y; + z = playerStatus->position.z; + if (npc_test_move_complex_with_slipping(COLLISION_CHANNEL_10000, + &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, + playerStatus->colliderHeight, playerStatus->colliderDiameter) + ) { + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + + x = parakarry->pos.x; + y = parakarry->pos.y; + 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) + ) { + hitAbove = FALSE; + x = parakarry->pos.x; + y = parakarry->pos.y + parakarry->collisionHeight / 2.0f; + z = parakarry->pos.z; + length = parakarry->collisionHeight / 2.0f; + + halfCollisionHeight = length; + if (npc_raycast_up(COLLISION_CHANNEL_10000, &x, &y, &z, &length) && (length < halfCollisionHeight)) { + parakarry->pos.y = y - parakarry->collisionHeight; + playerStatus->position.y = parakarry->pos.y - 32.0f; + hitAbove = TRUE; + } + x = playerStatus->position.x; + 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)) { + playerStatus->position.y += (y - playerStatus->position.y) / 4.0f; + parakarry->pos.y = playerStatus->position.y + 32.0f; + y = parakarry->pos.y; + parakarry->pos.y = playerStatus->position.y; + spawn_surface_effects(parakarry, SURFACE_INTERACT_WALK); + parakarry->pos.y = y; + + if (hitAbove) { + N(UseAbilityState) = AIR_LIFT_DROP; + break; + } + } + + if (!phys_adjust_cam_on_landing()) { + gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAG_2; + } + gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; + gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; + gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; + if (!(parakarry->flags & NPC_FLAG_COLLDING_FORWARD_WITH_WORLD)) { + parakarry->duration++; + if (!(parakarry->planarFlyDist < 100.0f)) { + N(AbilityStateTime) = 5; + N(UseAbilityState) = AIR_LIFT_HOLD; + } + break; + } + } + } + } + suggest_player_anim_allow_backward(ANIM_Mario1_Idle); + N(UseAbilityState) = AIR_LIFT_DROP; + break; + case AIR_LIFT_HOLD: + if (N(AbilityStateTime) != 0) { + N(AbilityStateTime)--; + } else { + N(UseAbilityState) = AIR_LIFT_DROP; + } + break; + } + + if (N(UseAbilityState) == AIR_LIFT_JUMP + || N(UseAbilityState) == AIR_LIFT_DROP + || N(UseAbilityState) == AIR_LIFT_CANCEL + ) { + parakarry->currentAnim = ANIM_WorldParakarry_Idle; + N(UsingAbility) = FALSE; + parakarry->jumpVelocity = 0.0f; + parakarry->flags &= ~NPC_FLAG_JUMPING; + parakarry->animationSpeed = 1.0f; + partner_clear_player_tracking(parakarry); + partnerActionStatus->actingPartner = PARTNER_NONE; + partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; + enable_partner_ai(); + sfx_stop_sound(SOUND_2009); + if (N(LockingPlayerInput)) { + enable_player_input(); + } + if (N(PlayerCollisionDisabled)) { + enable_player_static_collisions(); + } + if ((playerStatus->flags & PS_FLAG_HIT_FIRE)) { + set_action_state(ACTION_STATE_HIT_LAVA); + } else if (N(UseAbilityState) == AIR_LIFT_JUMP) { + start_bounce_b(); + } else if (N(UseAbilityState) == AIR_LIFT_DROP) { + start_falling(); + gravity_use_fall_parms(); + playerStatus->flags |= PS_FLAG_SCRIPTED_FALL; + } else { + set_action_state(ACTION_STATE_IDLE); + } + return ApiStatus_DONE2; + } + return ApiStatus_BLOCK; } -EvtScript world_parakarry_use_ability = { - EVT_CALL(func_802BD660_319BD0) +EvtScript EVS_WorldParakarry_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -ApiStatus ParakarryPutAway(Evt* script, s32 isInitialCall) { +API_CALLABLE(N(PutAway)) { Npc* parakarry = script->owner2.npc; if (isInitialCall) { partner_init_put_away(parakarry); } - return partner_put_away(parakarry) ? ApiStatus_DONE1 : ApiStatus_BLOCK; + if (partner_put_away(parakarry)) { + return ApiStatus_DONE1; + } else { + return ApiStatus_BLOCK; + } } -EvtScript world_parakarry_put_away = { - EVT_CALL(ParakarryPutAway) +EvtScript EVS_WorldParakarry_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; -void world_parakarry_pre_battle(Npc* parakarry) { - PartnerActionStatus* parakarryActionStatus = &gPartnerActionStatus; +void N(pre_battle)(Npc* parakarry) { + PartnerActionStatus* partnerStatus = &gPartnerActionStatus; - if (D_802BEBB0) { - if (D_802BEBB8) { + if (N(UsingAbility)) { + if (N(PlayerCollisionDisabled)) { enable_player_static_collisions(); } - if (D_802BEBB4) { + if (N(LockingPlayerInput)) { enable_player_input(); } set_action_state(ACTION_STATE_IDLE); - parakarryActionStatus->npc = *parakarry; - parakarryActionStatus->partnerAction_unk_1 = 1; + partnerStatus->npc = *parakarry; + partnerStatus->partnerAction_unk_1 = TRUE; partner_clear_player_tracking(parakarry); } - parakarryActionStatus->actingPartner = PARTNER_PARAKARRY; + partnerStatus->actingPartner = PARTNER_PARAKARRY; } -void world_parakarry_post_battle(Npc* parakarry) { - PartnerActionStatus* parakarryActionStatus = &gPartnerActionStatus; +void N(post_battle)(Npc* parakarry) { + PartnerActionStatus* partnerStatus = &gPartnerActionStatus; - if (parakarryActionStatus->partnerAction_unk_1 != 0) { - if (D_802BEBB8) { + if (partnerStatus->partnerAction_unk_1) { + if (N(PlayerCollisionDisabled)) { disable_player_static_collisions(); } - if (D_802BEBB4) { + if (N(LockingPlayerInput)) { disable_player_input(); } set_action_state(ACTION_STATE_RIDE); - *parakarry = parakarryActionStatus->npc; - parakarryActionStatus->actingPartner = PARTNER_NONE; - parakarryActionStatus->partnerActionState = PARTNER_ACTION_NONE; + *parakarry = partnerStatus->npc; + partnerStatus->actingPartner = PARTNER_NONE; + partnerStatus->partnerActionState = PARTNER_ACTION_NONE; partner_clear_player_tracking(parakarry); partner_use_ability(); } diff --git a/src/world/partner/parakarry.h b/src/world/partner/parakarry.h index c4b9ebd4a6..034fe82369 100644 --- a/src/world/partner/parakarry.h +++ b/src/world/partner/parakarry.h @@ -8,9 +8,9 @@ void world_parakarry_init(Npc*); void world_parakarry_pre_battle(Npc*); void world_parakarry_post_battle(Npc*); -extern EvtScript world_parakarry_take_out; -extern EvtScript world_parakarry_update; -extern EvtScript world_parakarry_use_ability; -extern EvtScript world_parakarry_put_away; +extern EvtScript EVS_WorldParakarry_TakeOut; +extern EvtScript EVS_WorldParakarry_Update; +extern EvtScript EVS_WorldParakarry_UseAbility; +extern EvtScript EVS_WorldParakarry_PutAway; #endif diff --git a/src/world/partner/sushie.c b/src/world/partner/sushie.c index a77bfc2017..6abc1d5929 100644 --- a/src/world/partner/sushie.c +++ b/src/world/partner/sushie.c @@ -5,6 +5,8 @@ #include "sprite/npc/WorldSushie.h" #include "sprite.h" +#define NAMESPACE world_sushie + BSS f32 OriginalPlayerY; BSS s32 bss_802BFEE4; BSS s32 bss_802BFEE8; @@ -262,7 +264,7 @@ void func_802BD414_31E184(Npc* npc) { bss_802BFEF4 = 1; playerStatus->renderMode = RENDER_MODE_ALPHATEST; func_802DDFF8(playerStatus->trueAnimation, 4, 2, 0, 0, 0, 0); - func_8003D624(npc, 4, 2, 0, 0, 0, 0); + func_8003D624(npc, FOLD_TYPE_4, 2, 0, 0, 0, 0); } if (bss_802BFEE8 >= 10 && (!(partnerActionStatus->currentButtons & BUTTON_C_DOWN) || bss_802BFEE8 >= 30)) { npc->currentAnim = ANIM_WorldSushie_Rise; @@ -295,7 +297,7 @@ void func_802BD414_31E184(Npc* npc) { if (bss_802BFEF4 != 0) { bss_802BFEF4 = 0; func_802DDFF8(ANIM_Mario1_Idle, 0, 0, 0, 0, 0, 0); - func_8003D624(npc, 0, 0, 0, 0, 0, 0); + func_8003D624(npc, FOLD_TYPE_NONE, 0, 0, 0, 0, 0); } bss_802BFEE4 = 0; npc->currentAnim = ANIM_WorldSushie_Ride; @@ -321,7 +323,7 @@ s32 func_802BE280_31EFF0(s32 arg0, f32* x, f32* y, f32* z, f32 length, f32 radiu return hitResult; } -ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BE3A4_31F114) { PlayerStatus* playerStatus = &gPlayerStatus; PlayerData* playerData = &gPlayerData; CollisionStatus* collisionStatus = &gCollisionStatus; @@ -375,7 +377,7 @@ ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) { suggest_player_anim_always_forward(ANIM_MarioW2_RideSushie); disable_player_shadow(); disable_npc_shadow(npc); - func_8003D624(npc, 4, 2, 0, 0, 0, 0); + func_8003D624(npc, FOLD_TYPE_4, 2, 0, 0, 0, 0); npc->currentAnim = ANIM_WorldSushie_Ride; npc->moveSpeed = playerStatus->runSpeed; npc->jumpScale = 0.0f; @@ -444,7 +446,7 @@ ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) { npc->flags |= NPC_FLAG_8; npc->flags &= ~(NPC_FLAG_GRAVITY | NPC_FLAG_IGNORE_WORLD_COLLISION); disable_npc_shadow(npc); - func_8003D624(npc, 4, 2, 0, 0, 0, 0); + func_8003D624(npc, FOLD_TYPE_4, 2, 0, 0, 0, 0); npc->currentAnim = ANIM_WorldSushie_Ride; playerStatus->flags |= PS_FLAG_MOVEMENT_LOCKED; dist = dist2D(playerStatus->position.x, playerStatus->position.z, npc->moveToPos.x, npc->moveToPos.z); @@ -669,7 +671,7 @@ ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) { partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; partnerActionStatus->actingPartner = 0; func_802DDFF8(ANIM_Mario1_Idle, 0, 0, 0, 0, 0, 0); - func_8003D624(npc, 0, 0, 0, 0, 0, 0); + func_8003D624(npc, FOLD_TYPE_NONE, 0, 0, 0, 0, 0); return ApiStatus_DONE1; } npc->duration--; @@ -678,7 +680,7 @@ ApiStatus func_802BE3A4_31F114(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_sushie_use_ability = { +EvtScript EVS_WorldSushie_UseAbility = { EVT_CALL(func_802BE3A4_31F114) EVT_RETURN EVT_END @@ -695,7 +697,7 @@ void world_sushie_init(Npc* sushie) { bss_802BFEF4 = 0; } -s32 SushieTakeOut(Evt* script, s32 isInitialCall) { +API_CALLABLE(SushieTakeOut) { Npc* sushie = script->owner2.npc; if (isInitialCall) { @@ -705,7 +707,7 @@ s32 SushieTakeOut(Evt* script, s32 isInitialCall) { return partner_get_out(sushie) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -EvtScript world_sushie_take_out = { +EvtScript EVS_WorldSushie_TakeOut = { EVT_CALL(SushieTakeOut) EVT_RETURN EVT_END @@ -713,7 +715,7 @@ EvtScript world_sushie_take_out = { TweesterPhysics* SushieTweesterPhysicsPtr = &SushieTweesterPhysics; -ApiStatus SushieUpdate(Evt* script, s32 isInitialCall) { +API_CALLABLE(SushieUpdate) { Npc* sushie = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; Entity* entity; @@ -794,7 +796,7 @@ ApiStatus SushieUpdate(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_sushie_update = { +EvtScript EVS_WorldSushie_Update = { EVT_CALL(SushieUpdate) EVT_RETURN EVT_END @@ -809,7 +811,7 @@ void func_802BF920_320690(Npc* sushie) { } } -s32 SushiePutAway(Evt* script, s32 isInitialCall) { +API_CALLABLE(SushiePutAway) { Npc* sushie = script->owner2.npc; if (isInitialCall) { @@ -820,7 +822,7 @@ s32 SushiePutAway(Evt* script, s32 isInitialCall) { return partner_put_away(sushie) ? ApiStatus_DONE1 : ApiStatus_BLOCK; } -EvtScript world_sushie_put_away = { +EvtScript EVS_WorldSushie_PutAway = { EVT_CALL(SushiePutAway) EVT_RETURN EVT_END @@ -850,7 +852,7 @@ void world_sushie_post_battle(Npc* sushie) { } } -s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BFAB8_320828) { Npc* partnerNPC = get_npc_unsafe(NPC_PARTNER); PlayerStatus* playerStatus = &gPlayerStatus; @@ -923,7 +925,7 @@ s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_sushie_while_riding = { +EvtScript EVS_WorldSushie_Riding = { EVT_CALL(func_802BFAB8_320828) EVT_RETURN EVT_END diff --git a/src/world/partner/sushie.h b/src/world/partner/sushie.h index ea44bddebc..4def965064 100644 --- a/src/world/partner/sushie.h +++ b/src/world/partner/sushie.h @@ -8,10 +8,10 @@ void world_sushie_init(Npc*); void world_sushie_pre_battle(Npc*); void world_sushie_post_battle(Npc*); -extern EvtScript world_sushie_take_out; -extern EvtScript world_sushie_update; -extern EvtScript world_sushie_use_ability; -extern EvtScript world_sushie_put_away; -extern EvtScript world_sushie_while_riding; +extern EvtScript EVS_WorldSushie_TakeOut; +extern EvtScript EVS_WorldSushie_Update; +extern EvtScript EVS_WorldSushie_UseAbility; +extern EvtScript EVS_WorldSushie_PutAway; +extern EvtScript EVS_WorldSushie_Riding; #endif diff --git a/src/world/partner/twink.c b/src/world/partner/twink.c index 0b3d8bffe5..ce7fd9491a 100644 --- a/src/world/partner/twink.c +++ b/src/world/partner/twink.c @@ -2,12 +2,14 @@ #include "../partners.h" #include "twink.h" -void world_twink_init(Npc* twink) { +#define NAMESPACE world_twink + +void N(init)(Npc* twink) { twink->collisionHeight = 20; twink->collisionRadius = 20; } -API_CALLABLE(TwinkTakeOut) { +API_CALLABLE(N(TakeOut)) { Npc* twink = script->owner2.npc; if (isInitialCall) { @@ -21,7 +23,7 @@ API_CALLABLE(TwinkTakeOut) { } } -API_CALLABLE(TwinkUpdate) { +API_CALLABLE(N(Update)) { PlayerData* playerData = &gPlayerData; Npc* twink = script->owner2.npc; @@ -36,11 +38,11 @@ API_CALLABLE(TwinkUpdate) { return ApiStatus_BLOCK; } -API_CALLABLE(TwinkUseAbility) { +API_CALLABLE(N(UseAbility)) { return ApiStatus_DONE2; } -API_CALLABLE(TwinkPutAway) { +API_CALLABLE(N(PutAway)) { Npc* twink = script->owner2.npc; if (isInitialCall) { @@ -54,26 +56,26 @@ API_CALLABLE(TwinkPutAway) { } } -EvtScript EVS_TwinkTakeOut = { - EVT_CALL(TwinkTakeOut) +EvtScript EVS_WorldTwink_TakeOut = { + EVT_CALL(N(TakeOut)) EVT_RETURN EVT_END }; -EvtScript EVS_TwinkUpdate = { - EVT_CALL(TwinkUpdate) +EvtScript EVS_WorldTwink_Update = { + EVT_CALL(N(Update)) EVT_RETURN EVT_END }; -EvtScript EVS_TwinkUseAbility = { - EVT_CALL(TwinkUseAbility) +EvtScript EVS_WorldTwink_UseAbility = { + EVT_CALL(N(UseAbility)) EVT_RETURN EVT_END }; -EvtScript EVS_TwinkPutAway = { - EVT_CALL(TwinkPutAway) +EvtScript EVS_WorldTwink_PutAway = { + EVT_CALL(N(PutAway)) EVT_RETURN EVT_END }; diff --git a/src/world/partner/twink.h b/src/world/partner/twink.h index ffc3785df4..d4f57555d4 100644 --- a/src/world/partner/twink.h +++ b/src/world/partner/twink.h @@ -6,9 +6,9 @@ void world_twink_init(Npc* partner); -extern EvtScript EVS_TwinkTakeOut; -extern EvtScript EVS_TwinkUpdate; -extern EvtScript EVS_TwinkUseAbility; -extern EvtScript EVS_TwinkPutAway; +extern EvtScript EVS_WorldTwink_TakeOut; +extern EvtScript EVS_WorldTwink_Update; +extern EvtScript EVS_WorldTwink_UseAbility; +extern EvtScript EVS_WorldTwink_PutAway; #endif diff --git a/src/world/partner/watt.c b/src/world/partner/watt.c index 429b749459..76173eaa0e 100644 --- a/src/world/partner/watt.c +++ b/src/world/partner/watt.c @@ -5,6 +5,8 @@ #include "sprite/npc/WorldWatt.h" #include "sprite.h" +#define NAMESPACE world_watt + void force_player_anim(AnimID); void func_802BE014_31DB84(void); @@ -61,7 +63,7 @@ void world_watt_init(Npc* npc) { WattStaticEffect = NULL; } -ApiStatus func_802BD27C_31CDEC(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BD27C_31CDEC) { Npc* watt = script->owner2.npc; if (isInitialCall) { @@ -75,7 +77,7 @@ ApiStatus func_802BD27C_31CDEC(Evt* script, s32 isInitialCall) { } } -EvtScript world_watt_take_out = { +EvtScript EVS_WorldWatt_TakeOut = { EVT_CALL(func_802BD27C_31CDEC) EVT_RETURN EVT_END @@ -85,13 +87,13 @@ TweesterPhysics* WattTweesterPhysicsPtr = &WattTweesterPhysics; s32 D_802BE278_31DDE8 = 0; -ApiStatus WattUpdate(Evt* script, s32 isInitialCall) { +API_CALLABLE(WattUpdate) { PlayerData* playerData = &gPlayerData; Npc* watt = script->owner2.npc; f32 sinAngle, cosAngle, liftoffVelocity; Entity* entity; - if (gPartnerActionStatus.partnerAction_unk_1 == 0) { + if (!gPartnerActionStatus.partnerAction_unk_1) { if (isInitialCall) { partner_flying_enable(watt, 1); mem_clear(WattTweesterPhysicsPtr, sizeof(TweesterPhysics)); @@ -123,7 +125,7 @@ ApiStatus WattUpdate(Evt* script, s32 isInitialCall) { WattStaticEffect->data.staticStatus->unk_0C = watt->pos.z; } - return 0; + return ApiStatus_BLOCK; } switch (WattTweesterPhysicsPtr->state) { @@ -190,10 +192,10 @@ ApiStatus WattUpdate(Evt* script, s32 isInitialCall) { WattStaticEffect->data.staticStatus->unk_0C = watt->pos.z; } } - return 0; + return ApiStatus_BLOCK; } -EvtScript world_watt_update = { +EvtScript EVS_WorldWatt_Update = { EVT_CALL(WattUpdate) EVT_RETURN EVT_END @@ -208,7 +210,7 @@ void func_802BD710_31D280(Npc* watt) { } } -ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { +API_CALLABLE(func_802BD754_31D2C4) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; Npc* npc = script->owner2.npc; @@ -216,7 +218,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { if (isInitialCall) { func_802BD710_31D280(npc); if (!(playerStatus->animFlags & PA_FLAG_CHANGING_MAP)) { - if (partnerActionStatus->partnerAction_unk_1 == 0) { + if (!partnerActionStatus->partnerAction_unk_1) { if ((partnerActionStatus->partnerActionState != ACTION_STATE_IDLE) || (func_800EA52C(PARTNER_WATT) && !is_starting_conversation())) { @@ -235,7 +237,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } } else { - partnerActionStatus->partnerAction_unk_1 = 0; + partnerActionStatus->partnerAction_unk_1 = FALSE; playerStatus->animFlags |= (PA_FLAG_USING_WATT | PA_FLAG_WATT_IN_HANDS); func_802BE014_31DB84(); npc->currentAnim = ANIM_WorldWatt_Idle; @@ -379,13 +381,13 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { return ApiStatus_BLOCK; } -EvtScript world_watt_use_ability = { +EvtScript EVS_WorldWatt_UseAbility = { EVT_CALL(func_802BD754_31D2C4) EVT_RETURN EVT_END }; -s32 WattPutAway(Evt* script, s32 isInitialCall) { +API_CALLABLE(WattPutAway) { PlayerStatus* playerStatus = &gPlayerStatus; PartnerActionStatus* wattActionStatus = &gPartnerActionStatus; Npc* watt = script->owner2.npc; @@ -407,7 +409,7 @@ s32 WattPutAway(Evt* script, s32 isInitialCall) { } } -EvtScript world_watt_put_away = { +EvtScript EVS_WorldWatt_PutAway = { EVT_CALL(WattPutAway) EVT_RETURN EVT_END @@ -418,7 +420,7 @@ void world_watt_pre_battle(Npc* watt) { if (D_802BE30C != 0) { wattActionStatus->npc = *watt; - wattActionStatus->partnerAction_unk_1 = 1; + wattActionStatus->partnerAction_unk_1 = TRUE; partner_clear_player_tracking(watt); } @@ -435,7 +437,7 @@ void world_watt_post_battle(Npc* watt) { } } -API_CALLABLE(WattRidingUpdate) { +API_CALLABLE(N(Riding)) { PartnerActionStatus* wattActionStatus = &gPartnerActionStatus; PlayerStatus* playerStatus = &gPlayerStatus; Npc* watt = get_npc_unsafe(NPC_PARTNER); @@ -543,8 +545,8 @@ void world_watt_sync_held_position(void) { } } -EvtScript world_watt_while_riding = { - EVT_CALL(WattRidingUpdate) +EvtScript EVS_WorldWatt_Riding = { + EVT_CALL(N(Riding)) EVT_RETURN EVT_END }; diff --git a/src/world/partner/watt.h b/src/world/partner/watt.h index 670d96d632..26dd104283 100644 --- a/src/world/partner/watt.h +++ b/src/world/partner/watt.h @@ -8,10 +8,10 @@ void world_watt_init(Npc*); void world_watt_pre_battle(Npc*); void world_watt_post_battle(Npc*); -extern EvtScript world_watt_take_out; -extern EvtScript world_watt_update; -extern EvtScript world_watt_use_ability; -extern EvtScript world_watt_put_away; -extern EvtScript world_watt_while_riding; +extern EvtScript EVS_WorldWatt_TakeOut; +extern EvtScript EVS_WorldWatt_Update; +extern EvtScript EVS_WorldWatt_UseAbility; +extern EvtScript EVS_WorldWatt_PutAway; +extern EvtScript EVS_WorldWatt_Riding; #endif diff --git a/src/world/partners.c b/src/world/partners.c index 585d7fd888..941e5963c0 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -186,10 +186,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_goombario_VRAM, .isFlying = FALSE, .init = world_goombario_init, - .takeOut = &EVS_GoombarioTakeOut, - .update = &EVS_GoombarioUpdate, - .useAbility = &EVS_GoombarioUseAbility, - .putAway = &EVS_GoombarioPutAway, + .takeOut = &EVS_WorldGoombario_TakeOut, + .update = &EVS_WorldGoombario_Update, + .useAbility = &EVS_WorldGoombario_UseAbility, + .putAway = &EVS_WorldGoombario_PutAway, .idle = ANIM_WorldGoombario_Idle, .canUseAbility = world_goombario_can_pause, .canPlayerPause = world_goombario_can_pause, @@ -201,10 +201,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_kooper_VRAM, .isFlying = FALSE, .init = world_kooper_init, - .takeOut = &EVS_WorldKooperTakeOut, - .update = &EVS_WorldKooperUpdate, - .useAbility = &EVS_KooperUseAbility, - .putAway = &EVS_KooperPutAway, + .takeOut = &EVS_WorldKooper_TakeOut, + .update = &EVS_WorldKooper_Update, + .useAbility = &EVS_WorldKooper_UseAbility, + .putAway = &EVS_WorldKooper_PutAway, .idle = ANIM_WorldKooper_Idle, .testFirstStrike = world_kooper_test_first_strike, .canUseAbility = partner_is_idle, @@ -218,10 +218,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_bombette_VRAM, .isFlying = FALSE, .init = world_bombette_init, - .takeOut = &world_bombette_take_out, - .update = &world_bombette_update, - .useAbility = &world_bombette_use_ability, - .putAway = &world_bombette_put_away, + .takeOut = &EVS_WorldBombette_TakeOut, + .update = &EVS_WorldBombette_Update, + .useAbility = &EVS_WorldBombette_UseAbility, + .putAway = &EVS_WorldBombette_PutAway, .idle = ANIM_WorldBombette_Idle, .testFirstStrike = world_bombette_test_first_strike, .canUseAbility = world_bombette_can_use_ability, @@ -234,10 +234,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_parakarry_VRAM, .isFlying = TRUE, .init = world_parakarry_init, - .takeOut = &world_parakarry_take_out, - .update = &world_parakarry_update, - .useAbility = &world_parakarry_use_ability, - .putAway = &world_parakarry_put_away, + .takeOut = &EVS_WorldParakarry_TakeOut, + .update = &EVS_WorldParakarry_Update, + .useAbility = &EVS_WorldParakarry_UseAbility, + .putAway = &EVS_WorldParakarry_PutAway, .idle = ANIM_WorldParakarry_Idle, .canPlayerPause = partner_is_idle, .preBattle = world_parakarry_pre_battle, @@ -249,10 +249,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_goompa_VRAM, .isFlying = FALSE, .init = world_goompa_init, - .takeOut = &EVS_WorldGoompaTakeOut, - .update = &EVS_WorldGoompaUpdate, - .useAbility = &EVS_WorldGoompaUseAbility, - .putAway = &EVS_WorldGoompaPutAway, + .takeOut = &EVS_WorldGoompa_TakeOut, + .update = &EVS_WorldGoompa_Update, + .useAbility = &EVS_WorldGoompa_UseAbility, + .putAway = &EVS_WorldGoompa_PutAway, .idle = ANIM_Goompa_Idle, }, [PARTNER_WATT] { @@ -261,15 +261,15 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_watt_VRAM, .isFlying = TRUE, .init = world_watt_init, - .takeOut = &world_watt_take_out, - .update = &world_watt_update, - .useAbility = &world_watt_use_ability, - .putAway = &world_watt_put_away, + .takeOut = &EVS_WorldWatt_TakeOut, + .update = &EVS_WorldWatt_Update, + .useAbility = &EVS_WorldWatt_UseAbility, + .putAway = &EVS_WorldWatt_PutAway, .idle = ANIM_WorldWatt_Idle, .canPlayerPause = world_partner_can_player_pause_default, .preBattle = world_watt_pre_battle, .postBattle = world_watt_post_battle, - .whileRiding = &world_watt_while_riding, + .whileRiding = &EVS_WorldWatt_Riding, }, [PARTNER_SUSHIE] { .dmaStart = &world_partner_sushie_ROM_START, @@ -277,15 +277,15 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_sushie_VRAM, .isFlying = FALSE, .init = world_sushie_init, - .takeOut = &world_sushie_take_out, - .update = &world_sushie_update, - .useAbility = &world_sushie_use_ability, - .putAway = &world_sushie_put_away, + .takeOut = &EVS_WorldSushie_TakeOut, + .update = &EVS_WorldSushie_Update, + .useAbility = &EVS_WorldSushie_UseAbility, + .putAway = &EVS_WorldSushie_PutAway, .idle = ANIM_WorldSushie_Idle, .canPlayerPause = world_partner_can_player_pause_default, .preBattle = world_sushie_pre_battle, .postBattle = world_sushie_post_battle, - .whileRiding = &world_sushie_while_riding, + .whileRiding = &EVS_WorldSushie_Riding, }, [PARTNER_LAKILESTER] { .dmaStart = &world_partner_lakilester_ROM_START, @@ -293,15 +293,15 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_lakilester_VRAM, .isFlying = TRUE, .init = world_lakilester_init, - .takeOut = &world_lakilester_take_out, - .update = &world_lakilester_update, - .useAbility = &EVS_LakilesterUseAbility, - .putAway = &world_lakilester_put_away, + .takeOut = &EVS_WorldLakilester_TakeOut, + .update = &EVS_WorldLakilester_Update, + .useAbility = &EVS_WorldLakilester_UseAbility, + .putAway = &EVS_WorldLakilester_PutAway, .idle = ANIM_WorldLakilester_Idle, .canPlayerPause = world_partner_can_player_pause_default, .preBattle = world_lakilester_pre_battle, .postBattle = world_lakilester_post_battle, - .whileRiding = &world_lakilester_while_riding, + .whileRiding = &evs_worldlakilester_riding, }, [PARTNER_BOW] { .dmaStart = &world_partner_bow_ROM_START, @@ -309,10 +309,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_bow_VRAM, .isFlying = TRUE, .init = world_bow_init, - .takeOut = &world_bow_take_out, - .update = &world_bow_update, - .useAbility = &world_bow_use_ability, - .putAway = &world_bow_put_away, + .takeOut = &EVS_WorldBow_TakeOut, + .update = &EVS_WorldBow_Update, + .useAbility = &EVS_WorldBow_UseAbility, + .putAway = &EVS_WorldBow_PutAway, .idle = ANIM_WorldBow_Idle, .canUseAbility = partner_is_idle, .canPlayerPause = world_partner_can_player_pause_default, @@ -324,10 +324,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_goombaria_VRAM, .isFlying = FALSE, .init = world_goombaria_init, - .takeOut = &EVS_WorldGoombariaTakeOut, - .update = &EVS_WorldGoombariaUpdate, - .useAbility = &EVS_WorldGoombariaUseAbility, - .putAway = &EVS_WorldGoombariaPutAway, + .takeOut = &EVS_WorldGoombaria_TakeOut, + .update = &EVS_WorldGoombaria_Update, + .useAbility = &EVS_WorldGoombaria_UseAbility, + .putAway = &EVS_WorldGoombaria_PutAway, .idle = ANIM_Goombaria_Idle, .canUseAbility = partner_is_idle, .canPlayerPause = partner_is_idle, @@ -338,10 +338,10 @@ WorldPartner wPartners[] = { .dmaDest = &world_partner_twink_VRAM, .isFlying = TRUE, .init = world_twink_init, - .takeOut = &EVS_TwinkTakeOut, - .update = &EVS_TwinkUpdate, - .useAbility = &EVS_TwinkUseAbility, - .putAway = &EVS_TwinkPutAway, + .takeOut = &EVS_WorldTwink_TakeOut, + .update = &EVS_WorldTwink_Update, + .useAbility = &EVS_WorldTwink_UseAbility, + .putAway = &EVS_WorldTwink_PutAway, .idle = ANIM_Twink_Idle, .canUseAbility = partner_is_idle, .canPlayerPause = partner_is_idle, @@ -925,7 +925,7 @@ void partner_init_after_battle(s32 partnerID) { D_8010CFE0 = 1; NextPartnerID = partnerID; actionStatus->partnerActionState = 0; - actionStatus->partnerAction_unk_1 = 0; + actionStatus->partnerAction_unk_1 = FALSE; if (wCurrentPartnerId != PARTNER_NONE && partnerID != PARTNER_NONE) { NextPartnerCommand = PARTNER_CMD_INSTA_SWITCH; @@ -1029,7 +1029,7 @@ void partner_initialize_data(void) { D_8010CFC4 = 0; actionStatus->actingPartner = 0; actionStatus->inputDisabled = 0; - actionStatus->partnerAction_unk_1 = 0; + actionStatus->partnerAction_unk_1 = FALSE; actionStatus->partnerActionState = 0; actionStatus->unk_358 = 0; actionStatus->partnerAction_unk_2 = 0; @@ -1221,7 +1221,7 @@ void partner_walking_update_motion(Npc* partner) { void partner_walking_follow_player(Npc* partner) { PlayerStatus* playerStatus = &gPlayerStatus; - Camera* cameras = &gCameras[0]; + Camera* cameras = &gCameras[CAM_DEFAULT]; s32 surfaceType; f32 moveHistoryX, moveHistoryY, moveHistoryZ; f32 x, y, z; diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index c94f36912a..b8ca8b188c 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -7678,96 +7678,95 @@ shim_general_heap_create_obfuscated = 0x802B2078; // type:func rom:0x316FA8 shim_battle_heap_create_obfuscated = 0x802B20B4; // type:func rom:0x316FE4 world_goombario_get_trigger_tattle = 0x802BD100; // type:func rom:0x317020 world_goombario_init = 0x802BD174; // type:func rom:0x317094 -WorldGoombarioTakeOut = 0x802BD188; // type:func rom:0x3170A8 -WorldGoombarioUpdate = 0x802BD1D0; // type:func rom:0x3170F0 -goombario_try_cancel_tweester = 0x802BD564; // type:func rom:0x317484 +world_goombario_TakeOut = 0x802BD188; // type:func rom:0x3170A8 +world_goombario_Update = 0x802BD1D0; // type:func rom:0x3170F0 +world_goombario_try_cancel_tweester = 0x802BD564; // type:func rom:0x317484 world_goombario_can_pause = 0x802BD5A8; // type:func rom:0x3174C8 -WorldGoombarioSelectTattleMsg = 0x802BD5D8; // type:func rom:0x3174F8 -WorldGoombarioTattleEnd = 0x802BDB30; // type:func rom:0x317A50 -WorldGoombarioPutAway = 0x802BDB84; // type:func rom:0x317AA4 +world_goombario_SelectTattleMsg = 0x802BD5D8; // type:func rom:0x3174F8 +world_goombario_TattleEnd = 0x802BDB30; // type:func rom:0x317A50 +world_goombario_PutAway = 0x802BDB84; // type:func rom:0x317AA4 world_goombario_pre_battle = 0x802BDBBC; // type:func rom:0x317ADC -EntityTattles = 0x802BDC40; // type:data rom:0x317B60 -EVS_GoombarioTakeOut = 0x802BDD6C; // type:data rom:0x317C8C -GoombarioTweesterPhysicsPtr = 0x802BDD88; // type:data rom:0x317CA8 -EVS_GoombarioUpdate = 0x802BDD8C; // type:data rom:0x317CAC -EVS_GoombarioUseAbility = 0x802BDDA8; // type:data rom:0x317CC8 -EVS_GoombarioPutAway = 0x802BDE60; // type:data rom:0x317D80 -D_802BDE80_317DA0 = 0x802BDE80; // type:data rom:0x317DA0 -jtbl_802BDE88_317DA8 = 0x802BDE88; // type:data rom:0x317DA8 -func_802BD100_317E50 = 0x802BD100; // type:func rom:0x317E50 -TattleHadInteractPrompt = 0x802BDF34; // type:data rom:0x317E54 -TattleInteractNpc = 0x802BDF38; // type:data rom:0x317E58 -D_802BDF3C = 0x802BDF3C; // type:data rom:0x317E5C -GoombarioTweesterPhysics = 0x802BDF40; // type:data rom:0x317E60 -D_802BDF5C = 0x802BDF5C; // type:data rom:0x317E7C -GoombarioTattleInteractionID = 0x802BDF60; // type:data rom:0x317E80 -WorldGoombarioTattleActive = 0x802BDF64; // type:data rom:0x317E84 +world_goombario_EntityTattles = 0x802BDC40; // type:data rom:0x317B60 +EVS_WorldGoombario_TakeOut = 0x802BDD6C; // type:data rom:0x317C8C +world_goombario_TweesterPhysicsPtr = 0x802BDD88; // type:data rom:0x317CA8 +EVS_WorldGoombario_Update = 0x802BDD8C; // type:data rom:0x317CAC +EVS_WorldGoombario_UseAbility = 0x802BDDA8; // type:data rom:0x317CC8 +EVS_WorldGoombario_PutAway = 0x802BDE60; // type:data rom:0x317D80 +world_bombette_blast_affect_entities = 0x802BD100; // type:func rom:0x317E50 +world_goombario_HadInteractPrompt = 0x802BDF34; // type:data rom:0x317E54 +world_goombario_InteractNpc = 0x802BDF38; // type:data rom:0x317E58 +world_goombario_D_802BDF3C = 0x802BDF3C; // type:data rom:0x317E5C +world_goombario_TweesterPhysicsData = 0x802BDF40; // type:data rom:0x317E60 +world_goombario_D_802BDF5C = 0x802BDF5C; // type:data rom:0x317E7C +WorldTattleInteractionID = 0x802BDF60; // type:data rom:0x317E80 +world_bombette_IsTattleActive = 0x802BDF64; // type:data rom:0x317E84 world_bombette_init = 0x802BD2D8; // type:func rom:0x318028 -func_802BD300_318050 = 0x802BD300; // type:func rom:0x318050 -func_802BD338_318088 = 0x802BD338; // type:func rom:0x318088 -func_802BD6DC_31842C = 0x802BD6DC; // type:func rom:0x31842C +world_bombette_TakeOut = 0x802BD300; // type:func rom:0x318050 +world_bombette_Update = 0x802BD338; // type:func rom:0x318088 +world_bombette_try_cancel_tweester = 0x802BD6DC; // type:func rom:0x31842C world_bombette_can_use_ability = 0x802BD720; // type:func rom:0x318470 world_bombette_can_player_pause = 0x802BD748; // type:func rom:0x318498 -func_802BD758_3184A8 = 0x802BD758; // type:func rom:0x3184A8 -func_802BE4E8_319238 = 0x802BE4E8; // type:func rom:0x319238 +world_bombette_UseAbility = 0x802BD758; // type:func rom:0x3184A8 +world_bombette_PutAway = 0x802BE4E8; // type:func rom:0x319238 world_bombette_test_first_strike = 0x802BE520; // type:func rom:0x319270 world_bombette_pre_battle = 0x802BE6E8; // type:func rom:0x319438 -world_bombette_take_out = 0x802BE880; // type:data rom:0x3195D0 +EVS_BombetteTakeOut = 0x802BE880; // type:data rom:0x3195D0 BombetteTweesterPhysicsPtr = 0x802BE89C; // type:data rom:0x3195EC -world_bombette_update = 0x802BE8A0; // type:data rom:0x3195F0 +EVS_BombetteUpdate = 0x802BE8A0; // type:data rom:0x3195F0 world_bombette_use_ability = 0x802BE8BC; // type:data rom:0x31960C -world_bombette_put_away = 0x802BE8D8; // type:data rom:0x319628 +EVS_WorldBombette_PutAway = 0x802BE8D8; // type:data rom:0x319628 D_802BE908_319658 = 0x802BE908; // type:data rom:0x319658 world_parakarry_init = 0x802BD100; // type:func rom:0x319670 -D_802BE924 = 0x802BE924; // type:data rom:0x319674 -D_802BE928 = 0x802BE928; // type:data rom:0x319678 -D_802BE92C = 0x802BE92C; // type:data rom:0x31967C -D_802BE930 = 0x802BE930; // type:data rom:0x319680 -D_802BE934 = 0x802BE934; // type:data rom:0x319684 -D_802BE938 = 0x802BE938; // type:data rom:0x319688 -D_802BE93C = 0x802BE93C; // type:data rom:0x31968C -BombetteTweesterPhysics = 0x802BE940; // type:data rom:0x319690 -ParakarryTakeOut = 0x802BD148; // type:func rom:0x3196B8 -ParakarryUpdate = 0x802BD180; // type:func rom:0x3196F0 -func_802BD514_319A84 = 0x802BD514; // type:func rom:0x319A84 -func_802BD558_319AC8 = 0x802BD558; // type:func rom:0x319AC8 -func_802BD660_319BD0 = 0x802BD660; // type:func rom:0x319BD0 -ParakarryPutAway = 0x802BE8D4; // type:func rom:0x31AE44 +world_bombette_PlayerWasFacingLeft = 0x802BE920; // type:data +world_bombette_PlayingFuseSound = 0x802BE924; // type:data rom:0x319674 +world_bombette_IsBlasting = 0x802BE928; // type:data rom:0x319678 +world_bombette_LockingPlayerInput = 0x802BE92C; // type:data rom:0x31967C +world_bombette_MaintainPosAfterBlast = 0x802BE930; // type:data rom:0x319680 +world_bombette_TriggeredEarlyDetonation = 0x802BE934; // type:data rom:0x319684 +world_bombette_MovementBlocked = 0x802BE938; // type:data rom:0x319688 +world_bombette_D_802BE93C = 0x802BE93C; // type:data rom:0x31968C +world_bombette_TweesterPhysics = 0x802BE940; // type:data rom:0x319690 +world_parakarry_TakeOut = 0x802BD148; // type:func rom:0x3196B8 +world_parakarry_Update = 0x802BD180; // type:func rom:0x3196F0 +world_parakarry_try_cancel_tweester = 0x802BD514; // type:func rom:0x319A84 +world_parakarry_update_current_floor = 0x802BD558; // type:func rom:0x319AC8 +world_parakarry_UseAbility = 0x802BD660; // type:func rom:0x319BD0 +world_parakarry_PutAway = 0x802BE8D4; // type:func rom:0x31AE44 world_parakarry_pre_battle = 0x802BE90C; // type:func rom:0x31AE7C world_parakarry_post_battle = 0x802BE9D0; // type:func rom:0x31AF40 -world_parakarry_take_out = 0x802BEA90; // type:data rom:0x31B000 -ParakarryTweesterPhysicsPtr = 0x802BEAAC; // type:data rom:0x31B01C -world_parakarry_update = 0x802BEAB0; // type:data rom:0x31B020 -world_parakarry_use_ability = 0x802BEACC; // type:data rom:0x31B03C -world_parakarry_put_away = 0x802BEAE8; // type:data rom:0x31B058 +EVS_WorldParakarry_TakeOut = 0x802BEA90; // type:data rom:0x31B000 +world_parakarry_TweesterPhysicsPtr = 0x802BEAAC; // type:data rom:0x31B01C +EVS_WorldParakarry_Update = 0x802BEAB0; // type:data rom:0x31B020 +EVS_WorldParakarry_UseAbility = 0x802BEACC; // type:data rom:0x31B03C +EVS_WorldParakarry_PutAway = 0x802BEAE8; // type:data rom:0x31B058 D_802BEB10_31B080 = 0x802BEB10; // type:data rom:0x31B080 D_802BEB98_31B108 = 0x802BEB98; // type:data rom:0x31B108 D_802BEBA0_31B110 = 0x802BEBA0; // type:data rom:0x31B110 D_802BEBA8_31B118 = 0x802BEBA8; // type:data rom:0x31B118 kooper_lateral_hit_interactable_entity = 0x802BD100; // type:func rom:0x31B120 -D_802BEBB4 = 0x802BEBB4; // type:data rom:0x31B124 -D_802BEBB8 = 0x802BEBB8; // type:data rom:0x31B128 -D_802BEBBC = 0x802BEBBC; // type:data rom:0x31B12C -D_802BEBC0_31CBE0 = 0x802BEBC0; // type:data rom:0x31B130 -D_802BEBC4 = 0x802BEBC4; // type:data rom:0x31B134 +world_parakarry_LockingPlayerInput = 0x802BEBB4; // type:data rom:0x31B124 +world_parakarry_PlayerCollisionDisabled = 0x802BEBB8; // type:data rom:0x31B128 +world_parakarry_PlayerWasFacingLeft = 0x802BEBBC; // type:data rom:0x31B12C +world_parakarry_UseAbilityState = 0x802BEBC0; // type:data rom:0x31B130 +world_parakarry_AbilityStateTime = 0x802BEBC4; // type:data rom:0x31B134 ParakarryTweesterPhysics = 0x802BEBC8; // type:data rom:0x31B138 -kooper_vertical_hit_interactable_entity = 0x802BD144; // type:func rom:0x31B164 -kooper_check_for_item_collision = 0x802BD17C; // type:func rom:0x31B19C +world_kooper_vertical_hit_interactable_entity = 0x802BD144; // type:func rom:0x31B164 +world_kooper_check_for_item_collision = 0x802BD17C; // type:func rom:0x31B19C world_kooper_init = 0x802BD200; // type:func rom:0x31B220 -KooperTakeOut = 0x802BD228; // type:func rom:0x31B248 -KooperUpdate = 0x802BD260; // type:func rom:0x31B280 -kooper_try_cancel_tweester = 0x802BD5F4; // type:func rom:0x31B614 -KooperUseAbility = 0x802BD638; // type:func rom:0x31B658 -KooperPutAway = 0x802BE7E0; // type:func rom:0x31C800 +world_kooper_TakeOut = 0x802BD228; // type:func rom:0x31B248 +world_kooper_Update = 0x802BD260; // type:func rom:0x31B280 +world_kooper_try_cancel_tweester = 0x802BD5F4; // type:func rom:0x31B614 +world_kooper_UseAbility = 0x802BD638; // type:func rom:0x31B658 +world_kooper_PutAway = 0x802BE7E0; // type:func rom:0x31C800 world_kooper_test_first_strike = 0x802BE818; // type:func rom:0x31C838 world_kooper_pre_battle = 0x802BEA24; // type:func rom:0x31CA44 world_kooper_post_battle = 0x802BEB10; // type:func rom:0x31CB30 ShellTossHitboxState = 0x802BEB40; // type:data rom:0x31CB60 -EVS_WorldKooperTakeOut = 0x802BEB44; // type:data rom:0x31CB64 +EVS_WorldKooper_TakeOut = 0x802BEB44; // type:data rom:0x31CB64 KooperTweesterPhysicsPtr = 0x802BEB60; // type:data rom:0x31CB80 -EVS_WorldKooperUpdate = 0x802BEB64; // type:data rom:0x31CB84 -EVS_KooperUseAbility = 0x802BEB80; // type:data rom:0x31CBA0 -EVS_KooperPutAway = 0x802BEB9C; // type:data rom:0x31CBBC +EVS_WorldKooper_Update = 0x802BEB64; // type:data rom:0x31CB84 +EVS_WorldKooper_UseAbility = 0x802BEB80; // type:data rom:0x31CBA0 +EVS_WorldKooper_PutAway = 0x802BEB9C; // type:data rom:0x31CBBC D_802BEC18_31CC38 = 0x802BEC18; // type:data rom:0x31CC38 D_802BEC20_31CC40 = 0x802BEC20; // type:data rom:0x31CC40 D_802BEC28_31CC48 = 0x802BEC28; // type:data rom:0x31CC48 @@ -7775,40 +7774,40 @@ D_802BEC30_31CC50 = 0x802BEC30; // type:data rom:0x31CC50 D_802BEC38_31CC58 = 0x802BEC38; // type:data rom:0x31CC58 D_802BEC40_31CC60 = 0x802BEC40; // type:data rom:0x31CC60 func_802BD100_31CC70 = 0x802BD100; // type:func rom:0x31CC70 -KooperTriggeredBattle = 0x802BEC54; // type:data rom:0x31CC74 -ShellTossPlayerFacingLeft = 0x802BEC58; // type:data rom:0x31CC78 -D_802BEC5C = 0x802BEC5C; // type:data rom:0x31CC7C -ShellTossKickFalling = 0x802BEC60; // type:data rom:0x31CC80 -ShellTossControlsPlayer = 0x802BEC64; // type:data rom:0x31CC84 -KooperHeldItemIdx = 0x802BEC68; // type:data rom:0x31CC88 -D_802BEC6C = 0x802BEC6C; // type:data rom:0x31CC8C -D_802BEC70 = 0x802BEC70; // type:data rom:0x31CC90 -ShellTossPosY = 0x802BEC74; // type:data rom:0x31CC94 -ShellTossPosZ = 0x802BEC78; // type:data rom:0x31CC98 -D_802BEC7C = 0x802BEC7C; // type:data rom:0x31CC9C -KooperTweesterPhysics = 0x802BEC80; // type:data rom:0x31CCA0 +world_kooper_TriggeredBattle = 0x802BEC54; // type:data rom:0x31CC74 +world_kooper_PlayerWasFacingLeft = 0x802BEC58; // type:data rom:0x31CC78 +world_kooper_D_802BEC5C = 0x802BEC5C; // type:data rom:0x31CC7C +world_kooper_ShellTossKickFalling = 0x802BEC60; // type:data rom:0x31CC80 +world_kooper_LockingPlayerInput = 0x802BEC64; // type:data rom:0x31CC84 +world_kooper_HeldItemIdx = 0x802BEC68; // type:data rom:0x31CC88 +world_kooper_HasItem = 0x802BEC6C; // type:data rom:0x31CC8C +world_kooper_ShellTossPosX = 0x802BEC70; // type:data rom:0x31CC90 +world_kooper_ShellTossPosY = 0x802BEC74; // type:data rom:0x31CC94 +world_kooper_ShellTossPosZ = 0x802BEC78; // type:data rom:0x31CC98 +world_kooper_D_802BEC7C = 0x802BEC7C; // type:data rom:0x31CC9C +world_kooper_TweesterPhysics = 0x802BEC80; // type:data rom:0x31CCA0 world_watt_dispose_static_effect = 0x802BD180; // type:func rom:0x31CCF0 func_802BD1AC_31CD1C = 0x802BD1AC; // type:func rom:0x31CD1C world_watt_init = 0x802BD23C; // type:func rom:0x31CDAC func_802BD27C_31CDEC = 0x802BD27C; // type:func rom:0x31CDEC -WattUpdate = 0x802BD2B4; // type:func rom:0x31CE24 +world_watt_Update = 0x802BD2B4; // type:func rom:0x31CE24 func_802BD710_31D280 = 0x802BD710; // type:func rom:0x31D280 func_802BD754_31D2C4 = 0x802BD754; // type:func rom:0x31D2C4 -WattPutAway = 0x802BDD0C; // type:func rom:0x31D87C +world_watt_PutAway = 0x802BDD0C; // type:func rom:0x31D87C world_watt_pre_battle = 0x802BDD9C; // type:func rom:0x31D90C world_watt_post_battle = 0x802BDE10; // type:func rom:0x31D980 -WattRidingUpdate = 0x802BDE88; // type:func rom:0x31D9F8 +world_watt_Riding = 0x802BDE88; // type:func rom:0x31D9F8 func_802BE014_31DB84 = 0x802BE014; // type:func rom:0x31DB84 world_watt_sync_held_position = 0x802BE070; // type:func rom:0x31DBE0 D_802BE250_31DDC0 = 0x802BE250; // type:data rom:0x31DDC0 D_802BE254_31DDC4 = 0x802BE254; // type:data rom:0x31DDC4 -world_watt_take_out = 0x802BE258; // type:data rom:0x31DDC8 +EVS_WorldWatt_TakeOut = 0x802BE258; // type:data rom:0x31DDC8 WattTweesterPhysicsPtr = 0x802BE274; // type:data rom:0x31DDE4 D_802BE278_31DDE8 = 0x802BE278; // type:data rom:0x31DDE8 -world_watt_update = 0x802BE27C; // type:data rom:0x31DDEC -world_watt_use_ability = 0x802BE298; // type:data rom:0x31DE08 -world_watt_put_away = 0x802BE2B4; // type:data rom:0x31DE24 -world_watt_while_riding = 0x802BE2D0; // type:data rom:0x31DE40 +EVS_WorldWatt_Update = 0x802BE27C; // type:data rom:0x31DDEC +EVS_WorldWatt_UseAbility = 0x802BE298; // type:data rom:0x31DE08 +EVS_WorldWatt_PutAway = 0x802BE2B4; // type:data rom:0x31DE24 +EVS_WorldWatt_Riding = 0x802BE2D0; // type:data rom:0x31DE40 func_802BD100_31DE70 = 0x802BD100; // type:func rom:0x31DE70 D_802BE304 = 0x802BE304; // type:data rom:0x31DE74 D_802BE308 = 0x802BE308; // type:data rom:0x31DE78 @@ -7833,12 +7832,12 @@ D_802BFDB0_320B20 = 0x802BFDB0; // type:data rom:0x320B20 D_802BFDB4_320B24 = 0x802BFDB4; // type:data rom:0x320B24 D_802BFDB8_320B28 = 0x802BFDB8; // type:data rom:0x320B28 D_802BFDBC_320B2C = 0x802BFDBC; // type:data rom:0x320B2C -world_sushie_use_ability = 0x802BFDC0; // type:data rom:0x320B30 -world_sushie_take_out = 0x802BFDDC; // type:data rom:0x320B4C +EVS_WorldSushie_UseAbility = 0x802BFDC0; // type:data rom:0x320B30 +EVS_WorldSushie_TakeOut = 0x802BFDDC; // type:data rom:0x320B4C SushieTweesterPhysicsPtr = 0x802BFDF8; // type:data rom:0x320B68 -world_sushie_update = 0x802BFDFC; // type:data rom:0x320B6C -world_sushie_put_away = 0x802BFE18; // type:data rom:0x320B88 -world_sushie_while_riding = 0x802BFE34; // type:data rom:0x320BA4 +EVS_WorldSushie_Update = 0x802BFDFC; // type:data rom:0x320B6C +EVS_WorldSushie_PutAway = 0x802BFE18; // type:data rom:0x320B88 +EVS_WorldSushie_Riding = 0x802BFE34; // type:data rom:0x320BA4 D_802BFE50_320BC0 = 0x802BFE50; // type:data rom:0x320BC0 D_802BFE58_320BC8 = 0x802BFE58; // type:data rom:0x320BC8 D_802BFE60_320BD0 = 0x802BFE60; // type:data rom:0x320BD0 @@ -7873,12 +7872,12 @@ world_lakilester_pre_battle = 0x802BFA00; // type:func rom:0x323550 world_lakilester_post_battle = 0x802BFAA8; // type:func rom:0x3235F8 func_802BFB44_323694 = 0x802BFB44; // type:func rom:0x323694 func_802BFBA0_3236F0 = 0x802BFBA0; // type:func rom:0x3236F0 -world_lakilester_take_out = 0x802BFE60; // type:data rom:0x3239B0 +EVS_WorldLakilester_TakeOut = 0x802BFE60; // type:data rom:0x3239B0 LakilesterTweesterPhysicsPtr = 0x802BFE7C; // type:data rom:0x3239CC -world_lakilester_update = 0x802BFE80; // type:data rom:0x3239D0 -EVS_LakilesterUseAbility = 0x802BFE9C; // type:data rom:0x3239EC -world_lakilester_put_away = 0x802BFEB8; // type:data rom:0x323A08 -world_lakilester_while_riding = 0x802BFED4; // type:data rom:0x323A24 +EVS_WorldLakilester_Update = 0x802BFE80; // type:data rom:0x3239D0 +EVS_WorldLakilester_UseAbility = 0x802BFE9C; // type:data rom:0x3239EC +EVS_WorldLakilester_PutAway = 0x802BFEB8; // type:data rom:0x323A08 +evs_worldlakilester_riding = 0x802BFED4; // type:data rom:0x323A24 D_802BFEF8_323A48 = 0x802BFEF8; // type:data rom:0x323A48 world_bow_init = 0x802BFF00; // type:data rom:0x323A50 D_802BFF04 = 0x802BFF04; // type:data rom:0x323A54 @@ -7892,55 +7891,55 @@ D_802BFF20 = 0x802BFF20; // type:data rom:0x323A70 D_802BFF24 = 0x802BFF24; // type:data rom:0x323A74 D_802BFF28 = 0x802BFF28; // type:data rom:0x323A78 D_802BFF2C = 0x802BFF2C; // type:data rom:0x323A7C -BowTakeOut = 0x802BD130; // type:func rom:0x323A80 -BowUpdate = 0x802BD168; // type:func rom:0x323AB8 -func_802BD4FC_323E4C = 0x802BD4FC; // type:func rom:0x323E4C -func_802BD540_323E90 = 0x802BD540; // type:func rom:0x323E90 -BowUseAbility = 0x802BD694; // type:func rom:0x323FE4 -func_802BDDF0_324740 = 0x802BDDF0; // type:func rom:0x324740 -func_802BDF08_324858 = 0x802BDF08; // type:func rom:0x324858 +world_bow_TakeOut = 0x802BD130; // type:func rom:0x323A80 +world_bow_Update = 0x802BD168; // type:func rom:0x323AB8 +world_bow_try_cancel_tweester = 0x802BD4FC; // type:func rom:0x323E4C +world_bow_check_for_treadmill_overlaps = 0x802BD540; // type:func rom:0x323E90 +world_bow_UseAbility = 0x802BD694; // type:func rom:0x323FE4 +world_bow_end_outta_sight_cleanup = 0x802BDDF0; // type:func rom:0x324740 +world_bow_PutAway = 0x802BDF08; // type:func rom:0x324858 world_bow_pre_battle = 0x802BDF64; // type:func rom:0x3248B4 -world_bow_take_out = 0x802BDFE0; // type:data rom:0x324930 +EVS_WorldBow_TakeOut = 0x802BDFE0; // type:data rom:0x324930 BowTweesterPhysicsPtr = 0x802BDFFC; // type:data rom:0x32494C -world_bow_update = 0x802BE000; // type:data rom:0x324950 -world_bow_use_ability = 0x802BE01C; // type:data rom:0x32496C -world_bow_put_away = 0x802BE038; // type:data rom:0x324988 +EVS_WorldBow_Update = 0x802BE000; // type:data rom:0x324950 +EVS_WorldBow_UseAbility = 0x802BE01C; // type:data rom:0x32496C +EVS_WorldBow_PutAway = 0x802BE038; // type:data rom:0x324988 D_802BE060_3249B0 = 0x802BE060; // type:data rom:0x3249B0 world_goompa_init = 0x802BD100; // type:func rom:0x324A10 -D_802BE0C4 = 0x802BE0C4; // type:data rom:0x324A14 -BowTweesterPhysics = 0x802BE0C8; // type:data rom:0x324A18 -GoompaTakeOut = 0x802BD114; // type:func rom:0x324A24 -D_802BE0E4 = 0x802BE0E4; // type:data rom:0x324A34 -D_802BE0E8 = 0x802BE0E8; // type:data rom:0x324A38 -D_802BE0EC = 0x802BE0EC; // type:data rom:0x324A3C -GoompaUpdate = 0x802BD14C; // type:func rom:0x324A5C -goompa_try_cancel_tweester = 0x802BD4E0; // type:func rom:0x324DF0 -GoompaUseAbility = 0x802BD524; // type:func rom:0x324E34 -GoompaPutAway = 0x802BD52C; // type:func rom:0x324E3C -EVS_WorldGoompaTakeOut = 0x802BD570; // type:data rom:0x324E80 +world_bow_LockingPlayerInput = 0x802BE0C4; // type:data rom:0x324A14 +world_bow_TweesterPhysicsData = 0x802BE0C8; // type:data rom:0x324A18 +world_goompa_TakeOut = 0x802BD114; // type:func rom:0x324A24 +world_bow_OuttaSightPosX = 0x802BE0E4; // type:data rom:0x324A34 +world_bow_OuttaSightPosY = 0x802BE0E8; // type:data rom:0x324A38 +world_bow_OuttaSightPosZ = 0x802BE0EC; // type:data rom:0x324A3C +world_goompa_Update = 0x802BD14C; // type:func rom:0x324A5C +world_goompa_try_cancel_tweester = 0x802BD4E0; // type:func rom:0x324DF0 +world_goompa_UseAbility = 0x802BD524; // type:func rom:0x324E34 +world_goompa_PutAway = 0x802BD52C; // type:func rom:0x324E3C +EVS_WorldGoompa_TakeOut = 0x802BD570; // type:data rom:0x324E80 GoompaTweesterPhysicsPtr = 0x802BD58C; // type:data rom:0x324E9C -EVS_WorldGoompaUpdate = 0x802BD590; // type:data rom:0x324EA0 -EVS_WorldGoompaUseAbility = 0x802BD5AC; // type:data rom:0x324EBC -EVS_WorldGoompaPutAway = 0x802BD5C8; // type:data rom:0x324ED8 +EVS_WorldGoompa_Update = 0x802BD590; // type:data rom:0x324EA0 +EVS_WorldGoompa_UseAbility = 0x802BD5AC; // type:data rom:0x324EBC +EVS_WorldGoompa_PutAway = 0x802BD5C8; // type:data rom:0x324ED8 D_802BD5F0_324F00 = 0x802BD5F0; // type:data rom:0x324F00 world_goombaria_init = 0x802BD100; // type:func rom:0x324F10 -GoombariaTakeOut = 0x802BD114; // type:func rom:0x324F24 -GoombariaUpdate = 0x802BD14C; // type:func rom:0x324F5C -GoombariaUseAbility = 0x802BD1AC; // type:func rom:0x324FBC -GoombariaPutAway = 0x802BD1B4; // type:func rom:0x324FC4 -EVS_WorldGoombariaTakeOut = 0x802BD1F0; // type:data rom:0x325000 -EVS_WorldGoombariaUpdate = 0x802BD20C; // type:data rom:0x32501C -EVS_WorldGoombariaUseAbility = 0x802BD228; // type:data rom:0x325038 -EVS_WorldGoombariaPutAway = 0x802BD244; // type:data rom:0x325054 +world_goombaria_TakeOut = 0x802BD114; // type:func rom:0x324F24 +world_goombaria_Update = 0x802BD14C; // type:func rom:0x324F5C +world_goombaria_UseAbility = 0x802BD1AC; // type:func rom:0x324FBC +world_goombaria_PutAway = 0x802BD1B4; // type:func rom:0x324FC4 +EVS_WorldGoombaria_TakeOut = 0x802BD1F0; // type:data rom:0x325000 +EVS_WorldGoombaria_Update = 0x802BD20C; // type:data rom:0x32501C +EVS_WorldGoombaria_UseAbility = 0x802BD228; // type:data rom:0x325038 +EVS_WorldGoombaria_PutAway = 0x802BD244; // type:data rom:0x325054 world_twink_init = 0x802BD100; // type:func rom:0x325070 -TwinkTakeOut = 0x802BD110; // type:func rom:0x325080 -TwinkUpdate = 0x802BD148; // type:func rom:0x3250B8 -TwinkUseAbility = 0x802BD1A8; // type:func rom:0x325118 -TwinkPutAway = 0x802BD1B0; // type:func rom:0x325120 -EVS_TwinkTakeOut = 0x802BD1F0; // type:data rom:0x325160 -EVS_TwinkUpdate = 0x802BD20C; // type:data rom:0x32517C -EVS_TwinkUseAbility = 0x802BD228; // type:data rom:0x325198 -EVS_TwinkPutAway = 0x802BD244; // type:data rom:0x3251B4 +world_twink_TakeOut = 0x802BD110; // type:func rom:0x325080 +world_twink_Update = 0x802BD148; // type:func rom:0x3250B8 +world_twink_UseAbility = 0x802BD1A8; // type:func rom:0x325118 +world_twink_PutAway = 0x802BD1B0; // type:func rom:0x325120 +EVS_WorldTwink_TakeOut = 0x802BD1F0; // type:data rom:0x325160 +EVS_WorldTwink_Update = 0x802BD20C; // type:data rom:0x32517C +EVS_WorldTwink_UseAbility = 0x802BD228; // type:data rom:0x325198 +EVS_WorldTwink_PutAway = 0x802BD244; // type:data rom:0x3251B4 WorldItem_ShowUseSparkles = 0x802BD100; // type:func rom:0x3251D0 WorldItem_ShowHPGain = 0x802BD1AC; // type:func rom:0x32527C WorldItem_ShowFPGain = 0x802BD26C; // type:func rom:0x32533C @@ -25295,7 +25294,7 @@ D_802B6E90_E2A300 = 0x802B6E90; // type:data rom:0xE2A300 D_802B6E98_E2A308 = 0x802B6E98; // type:data rom:0xE2A308 D_802B6EA0_E2A310 = 0x802B6EA0; // type:data rom:0xE2A310 action_update_use_tweester = 0x802B6000; // type:func rom:0xE2A340 -PlayerTweesterPhysics = 0x802B6350; // type:data rom:0xE2A690 +PlayerTweesterPhysicsPtr = 0x802B6350; // type:data rom:0xE2A690 D_802B6360_E2A6A0 = 0x802B6360; // type:data rom:0xE2A6A0 parasol_get_npc = 0x802B6000; // type:func rom:0xE2A6B0 action_update_parasol = 0x802B6120; // type:func rom:0xE2A7D0 @@ -27128,14 +27127,13 @@ D_802BCE32 = 0x802BCE32; // type:data D_802BCE34 = 0x802BCE34; // type:data GoompaTweesterPhysics = 0x802BD600; // type:data goompa_802BD600 = 0x802BD600; // type:data -TattleHadSpeechPrompt = 0x802BDF30; // type:data +world_goombario_HadSpeechPrompt = 0x802BDF30; // type:data func_802BE070 = 0x802BE070; // -D_802BE0C0 = 0x802BE0C0; // type:data +world_bow_IsHiding = 0x802BE0C0; // type:data D_802BE300 = 0x802BE300; // type:data -D_802BE920 = 0x802BE920; // type:data -D_802BEBB0 = 0x802BEBB0; // type:data +world_parakarry_UsingAbility = 0x802BEBB0; // type:data D_802BEBC0 = 0x802BEBC0; // type:data -KooperShellTossHoldTime = 0x802BEC50; // type:data +world_kooper_ShellTossHoldTime = 0x802BEC50; // type:data OriginalPlayerY = 0x802BFEE0; // type:data D_802BFEF0 = 0x802BFEF0; // type:data D_802BFEFC = 0x802BFEFC; // type:data