From f7e39c0802c502f1e185765d89d7756200f6533d Mon Sep 17 00:00:00 2001 From: HailSanta <53960937+HailSanta@users.noreply.github.com> Date: Tue, 13 Sep 2022 02:26:57 -0400 Subject: [PATCH] player anim + collider surface types (#769) * player anim + collider surface types * added default surface type * remove unused flags and define surface mask * revised action table * checkpoint * player sprite stuff * remove currentAnim union * more actions * enough * discharged Co-authored-by: HailSanta --- include/common_structs.h | 33 ++- include/enums.h | 97 +++++-- include/functions.h | 8 +- include/macros.h | 13 +- include/npc.h | 4 +- include/variables.h | 10 +- src/182B30.c | 16 +- src/190A10.c | 12 +- src/190B20.c | 6 +- src/19FAF0.c | 8 +- src/23680.c | 14 +- src/38F00.c | 2 +- src/415D90.c | 2 +- src/77480.c | 249 +++++++++--------- src/7B440.c | 12 +- src/7E9D0.c | 28 +- src/7bb60_len_41b0.c | 200 +++++++------- src/891b0_len_fb0.c | 16 +- src/C50A0.c | 18 +- src/EC2240.c | 6 +- src/EEFAA0.c | 4 +- src/bss2.c | 6 +- src/collision.c | 4 +- src/effects/peach_star_beam.c | 2 +- src/effects/throw_spiny.c | 2 +- src/encounter_api.c | 4 +- src/entity/Block.c | 4 +- src/entity/Chest.c | 10 +- src/entity/Switch.c | 8 +- src/entity/WoodenCrate.c | 4 +- src/entity/default/BoardedFloor.c | 4 +- src/entity/default/Padlock.c | 2 +- src/entity/jan_iwa/Plants2.c | 2 +- src/entity/sbk_omo/StarBoxLauncher.c | 2 +- src/evt/fa4c0_len_3bf0.c | 2 +- src/evt/msg_api.c | 2 +- src/evt/npc_api.c | 20 +- src/evt/player_api.c | 79 +++--- src/npc.c | 85 +++--- src/sprite.h | 10 +- src/world/action/hammer.c | 60 +++-- src/world/action/hit_fire.c | 47 ++-- src/world/action/hit_lava.c | 216 +++++++-------- src/world/action/idle.c | 129 ++++----- src/world/action/jump.c | 129 +++++---- src/world/action/{16.c => knockback.c} | 37 +-- src/world/action/land.c | 61 ++--- src/world/action/{encounter.c => misc.c} | 81 +++--- src/world/action/slide.c | 165 ++++++------ src/world/action/sneaky_parasol.c | 60 ++--- src/world/action/spin.c | 195 +++++++------- .../action/{super_boots.c => spin_jump.c} | 169 ++++++------ src/world/action/{18.c => step_up.c} | 77 +++--- .../action/{ultra_boots.c => tornado_jump.c} | 101 +++---- src/world/action/use_munchlesia.c | 90 ++++--- src/world/action/use_spinning_flower.c | 231 ++++++++-------- src/world/action/use_tweester.c | 27 +- src/world/action/walk.c | 114 ++++---- src/world/actions.c | 142 +++++----- src/world/actions.h | 2 +- src/world/area_arn/arn_03/events.c | 2 +- src/world/area_arn/arn_05/events.c | 2 +- src/world/area_arn/arn_08/BF47A0.c | 2 +- src/world/area_dro/dro_02/9694C0.c | 4 +- src/world/area_flo/flo_03/CA72E0.c | 6 +- src/world/area_flo/flo_16/CD4770.c | 2 +- src/world/area_isk/isk_05/97DAD0.c | 6 +- src/world/area_isk/isk_13/98F7E0.c | 6 +- src/world/area_isk/isk_14/992730.c | 6 +- src/world/area_iwa/iwa_00/90CEF0.c | 2 +- src/world/area_iwa/iwa_01/912960.c | 2 +- src/world/area_iwa/iwa_03/918EF0.c | 2 +- src/world/area_kkj/kkj_00/ABB290.c | 6 +- src/world/area_kkj/kkj_18/AF2FE0.c | 4 +- src/world/area_kkj/kkj_19/AF7C00.c | 4 +- src/world/area_kkj/kkj_25/B06D10.c | 6 +- src/world/area_kmr/kmr_02/8B36B0.c | 19 ++ src/world/area_kpa/kpa_14/A57830.c | 2 +- src/world/area_kpa/kpa_53/A6ACA0.c | 2 +- src/world/area_mac/mac_01/8017D0.c | 6 +- src/world/area_mgm/mgm_02/E15D80.c | 14 +- src/world/area_pra/pra_35/D8D270.c | 2 +- src/world/area_tik/tik_03/86F0F0.c | 2 +- src/world/area_tik/tik_04/872020.c | 2 +- src/world/area_tik/tik_07/87AC00.c | 2 +- src/world/area_trd/trd_05/9AE700.c | 10 +- src/world/area_tst/tst_04/B1B570.c | 2 +- src/world/area_tst/tst_11/B1CA50.c | 8 +- src/world/area_tst/tst_13/B1D760.c | 2 +- src/world/common/LetterDelivery.inc.c | 6 +- src/world/common/UnkAngleFunc001.inc.c | 8 +- src/world/common/UnkFunc001.inc.c | 6 +- src/world/common/UnkFunc11.inc.c | 4 +- src/world/common/UnkFunc44.inc.c | 4 +- src/world/common/atomic/Chest.inc.c | 6 +- src/world/common/atomic/Reflection.inc.c | 54 ++-- src/world/common/enemy/BulletBillAI.inc.c | 14 +- src/world/common/enemy/CleftAI.inc.c | 16 +- src/world/common/enemy/ClubbaNappingAI.inc.c | 32 +-- src/world/common/enemy/ClubbaPatrolAI.inc.c | 2 +- src/world/common/enemy/FireBarAI.inc.c | 2 +- src/world/common/enemy/FlyingAI.inc.c | 10 +- .../common/enemy/FlyingMagikoopaAI.inc.c | 12 +- src/world/common/enemy/FlyingNoAttackAI.inc.c | 4 +- src/world/common/enemy/GrooveGuyAI.inc.c | 14 +- src/world/common/enemy/HoppingAI.inc.c | 2 +- src/world/common/enemy/KoopaPatrolAI.inc.c | 2 +- src/world/common/enemy/LakituAI.inc.c | 4 +- src/world/common/enemy/MagikoopaAI.inc.c | 20 +- src/world/common/enemy/MeleeHitbox.inc.c | 6 +- src/world/common/enemy/MontyMoleAI.inc.c | 16 +- src/world/common/enemy/ParatroopaAI.inc.c | 6 +- src/world/common/enemy/PatrolNoAttackAI.inc.c | 2 +- src/world/common/enemy/ProjectileHitbox.inc.c | 10 +- src/world/common/enemy/RangedAttackAI.inc.c | 2 +- src/world/common/enemy/SentinelAI.inc.c | 4 +- src/world/common/enemy/ShyGuyPatrolAI.inc.c | 8 +- src/world/common/enemy/ShyGuyWanderAI.inc.c | 8 +- src/world/common/enemy/SpearGuyAI.inc.c | 8 +- src/world/common/enemy/SpinyAI.inc.c | 12 +- src/world/common/enemy/States_PatrolAI.inc.c | 14 +- src/world/common/enemy/States_TackleAI.inc.c | 6 +- src/world/common/enemy/StationaryAI.inc.c | 10 +- src/world/common/enemy/TackleAI.inc.c | 16 +- src/world/common/enemy/UnkFloAI.inc.c | 10 +- src/world/common/enemy/WanderMeleeAI.inc.c | 2 +- .../enemy/wip/Dead_PiranhaPlantAI_Main.inc.c | 2 +- .../common/enemy/wip/PiranhaPlantAI_00.inc.c | 2 +- .../common/enemy/wip/PiranhaPlantAI_01.inc.c | 2 +- .../common/enemy/wip/PiranhaPlantAI_10.inc.c | 2 +- .../common/enemy/wip/PiranhaPlantAI_11.inc.c | 2 +- .../common/enemy/wip/PiranhaPlantAI_12.inc.c | 4 +- .../enemy/wip/PiranhaPlantAI_Main.inc.c | 2 +- src/world/partner/bombette.c | 36 +-- src/world/partner/bow.c | 6 +- src/world/partner/kooper.c | 22 +- src/world/partner/lakilester.c | 72 ++--- src/world/partner/parakarry.c | 40 +-- src/world/partner/sushie.c | 4 +- src/world/partner/watt.c | 70 ++--- src/world/partners.c | 57 ++-- src/world/script_api/7E3700.c | 4 +- .../partner/bombette/func_802BD758_3184A8.s | 2 +- .../partner/sushie/func_802BD414_31E184.s | 2 +- .../partner/sushie/func_802BE3A4_31F114.s | 6 +- .../partners/partner_walking_follow_player.s | 8 +- ver/us/splat.yaml | 20 +- ver/us/symbol_addrs.txt | 106 ++++---- ver/us/undefined_syms.txt | 12 +- 149 files changed, 2149 insertions(+), 1974 deletions(-) rename src/world/action/{16.c => knockback.c} (53%) rename src/world/action/{encounter.c => misc.c} (71%) rename src/world/action/{super_boots.c => spin_jump.c} (61%) rename src/world/action/{18.c => step_up.c} (56%) rename src/world/action/{ultra_boots.c => tornado_jump.c} (72%) diff --git a/include/common_structs.h b/include/common_structs.h index a44a40c73f..1ad8cbc8da 100644 --- a/include/common_structs.h +++ b/include/common_structs.h @@ -189,10 +189,7 @@ typedef struct Npc { NpcQuizmoBlur* quizmo; } blur; /* 0x024 */ s32 spriteInstanceID; - /* 0x028 */ union { - /* */ u16 h; - /* */ u32 w; - /* */ } currentAnim; + /* 0x028 */ AnimID currentAnim; /* 0x02C */ s32 unk_2C; /* 0x030 */ f32 animationSpeed; /* 0x034 */ f32 renderYaw; @@ -989,7 +986,7 @@ typedef struct CollisionData { /* 0x04 */ Collider* colliderList; /* 0x08 */ union { struct ColliderBoundingBox* aabbs; - CameraControlSettings* camSettings; + struct CameraControlSettings* camSettings; }; /* 0x0C */ s16 numColliders; /* 0x0E */ char unk_0E[2]; @@ -1888,6 +1885,14 @@ typedef struct FontData { /* 0x00 */ char unk_00[24]; } FontData; // size = 0x18 +typedef struct SlideParams { + f32 heading; + f32 maxDescendAccel; + f32 launchVelocity; + f32 maxDescendVelocity; + f32 integrator[4]; +} SlideParams; + typedef struct PlayerStatus { /* 0x000 */ s32 flags; // PlayerStatusFlags /* 0x004 */ u32 animFlags; @@ -1922,31 +1927,31 @@ typedef struct PlayerStatus { /* 0x084 */ f32 currentYaw; /* 0x088 */ f32 overlapPushYaw; /* 0x08C */ f32 pitch; - /* 0x090 */ f32 unk_90[4]; + /* 0x090 */ f32 flipYaw[4]; /* 0x0A0 */ f32 heading; - /* 0x0A4 */ s32 trueAnimation; ///< Encoding back-facing sprite + /* 0x0A4 */ AnimID trueAnimation; ///< Encoding back-facing sprite /* 0x0A8 */ f32 spriteFacingAngle; /* angle of sprite, relative to camera, from 0 to 180 */ /* 0x0AC */ char unk_AC[4]; /* 0x0B0 */ s16 colliderHeight; /* 0x0B2 */ s16 colliderDiameter; /* 0x0B4 */ s8 actionState; /* 0x0B5 */ s8 prevActionState; - /* 0x0B6 */ s8 fallState; ///< Also used as sleep state in Peach idle action + /* 0x0B6 */ s8 actionSubstate; /* 0x0B7 */ char unk_B7; - /* 0x0B8 */ u32 anim; + /* 0x0B8 */ AnimID anim; /* 0x0BC */ u16 unk_BC; /* 0x0BE */ s8 renderMode; - /* 0x0BF */ s8 unk_BF; + /* 0x0BF */ s8 hazardType; /* 0x0C0 */ s16 timeInAir; /* 0x0C2 */ s16 unk_C2; - /* 0x0C4 */ char unk_C4; + /* 0x0C4 */ s8 peachItemHeld; /* 0x0C5 */ s8 unk_C5; /* 0x0C6 */ s16 interactingWithID; /* 0x0C8 */ Npc* encounteredNPC; /* 0x0CC */ s32 shadowID; - /* 0x0D0 */ f32* unk_D0; + /* 0x0D0 */ SlideParams* slideParams; /* 0x0D4 */ f32 spinRate; - /* 0x0D8 */ struct EffectInstance* unk_D8; // effect 46 + /* 0x0D8 */ struct EffectInstance* specialDecorationEffect; /* 0x0DC */ s32 currentButtons; /* 0x0E0 */ s32 pressedButtons; /* 0x0E4 */ s32 heldButtons; @@ -1958,7 +1963,7 @@ typedef struct PlayerStatus { /* 0x190 */ s32 stickYBuffer[10]; /* 0x1B8 */ s32 inputBufPos; /* 0x1BC */ char unk_1BC[196]; - /* 0x280 */ s8 unk_280; + /* 0x280 */ s8 poundImpactDelay; // governs period of immobility after landing a ground pound /* 0x281 */ char unk_281[7]; } PlayerStatus; // size = 0x288 diff --git a/include/enums.h b/include/enums.h index 7d8cc79677..22ab4645f5 100644 --- a/include/enums.h +++ b/include/enums.h @@ -654,11 +654,11 @@ enum SoundIDs { SOUND_139 = 0x00000139, SOUND_13D = 0x0000013D, SOUND_13E = 0x0000013E, - SOUND_STEP1 = 0x00000141, - SOUND_STEP2 = 0x00000142, - SOUND_143 = 0x00000143, - SOUND_144 = 0x00000144, - SOUND_146 = 0x00000146, + SOUND_STEP_NORMAL1 = 0x00000141, + SOUND_STEP_NORMAL2 = 0x00000142, + SOUND_STEP_CRUNCHY1 = 0x00000143, + SOUND_STEP_CRUNCHY2 = 0x00000144, + SOUND_SPIN_JUMP = 0x00000146, SOUND_TORNADO_JUMP = 0x00000147, SOUND_SOFT_LAND = 0x00000148, SOUND_149 = 0x00000149, @@ -679,7 +679,7 @@ enum SoundIDs { SOUND_166 = 0x00000166, SOUND_167 = 0x00000167, SOUND_168 = 0x00000168, - SOUND_172 = 0x00000172, + SOUND_DUST_OFF = 0x00000172, SOUND_173 = 0x00000173, SOUND_174 = 0x00000174, SOUND_175 = 0x00000175, @@ -872,7 +872,7 @@ enum SoundIDs { SOUND_2F1 = 0x000002F1, SOUND_2F3 = 0x000002F3, SOUND_2F4 = 0x000002F4, - SOUND_2F6 = 0x000002F6, + SOUND_TWEESTER_LAUNCH = 0x000002F6, SOUND_2F7 = 0x000002F7, SOUND_2F9 = 0x000002F9, SOUND_CLOSE_SHELL = 0x000002FF, @@ -1268,6 +1268,9 @@ enum SoundIDs { SOUND_8000006B = 0x8000006B, SOUND_8000006C = 0x8000006C, SOUND_B000000A = 0xB000000A, + SOUND_B000000C = 0xB000000C, + SOUND_B000000D = 0xB000000D, + SOUND_B000000E = 0xB000000E, SOUND_B0000010 = 0xB0000010, SOUND_B0000011 = 0xB0000011, SOUND_B0000012 = 0xB0000012, @@ -1374,9 +1377,9 @@ enum AuxCameraParams { enum ItemIDs { ITEM_NONE = 0x00000000, - ITEM_JUMP = 0x00000001, - ITEM_SPIN_JUMP = 0x00000002, - ITEM_TORNADO_JUMP = 0x00000003, + ITEM_BOOTS = 0x00000001, + ITEM_SUPER_BOOTS = 0x00000002, + ITEM_ULTRA_BOOTS = 0x00000003, ITEM_HAMMER = 0x00000004, ITEM_SUPER_HAMMER = 0x00000005, ITEM_ULTRA_HAMMER = 0x00000006, @@ -1619,7 +1622,7 @@ enum ItemIDs { ITEM_ATTACK_FX_A = 0x000000F3, ITEM_ALLOR_NOTHING = 0x000000F4, ITEM_HP_DRAIN = 0x000000F5, - ITEM_JUMP_CHARGE0 = 0x000000F6, + ITEM_BOOTS_CHARGE0 = 0x000000F6, ITEM_SLOW_GO = 0x000000F7, ITEM_FP_PLUS_A = 0x000000F8, ITEM_MEGA_RUSH = 0x000000F9, @@ -1639,7 +1642,7 @@ enum ItemIDs { ITEM_HAMMER_THROW = 0x00000107, ITEM_MEGA_QUAKE = 0x00000108, ITEM_SMASH_CHARGE = 0x00000109, - ITEM_JUMP_CHARGE = 0x0000010A, + ITEM_BOOTS_CHARGE = 0x0000010A, ITEM_S_SMASH_CHG = 0x0000010B, ITEM_S_JUMP_CHG = 0x0000010C, ITEM_POWER_RUSH = 0x0000010D, @@ -1783,6 +1786,22 @@ enum ItemTargetFlags { ITEM_TARGET_FLAG_8000 = 0x8000 }; +enum PlayerSprites { + SPR_Mario_1 = 0x1, + SPR_Mario_2 = 0x2, + SPR_Mario_3 = 0x3, + SPR_Mario_4 = 0x4, + SPR_Mario_5 = 0x5, + SPR_Mario_6 = 0x6, + SPR_Mario_7 = 0x7, + SPR_Mario_8 = 0x8, + SPR_Mario_9 = 0x9, + SPR_Peach_A = 0xA, + SPR_Peach_B = 0xB, + SPR_Peach_C = 0xC, + SPR_Peach_D = 0xD, +}; + // TODO: extract player sprite + animations enum PlayerAnims { ANIM_Mario_StandStill = 0x00010000, @@ -2638,13 +2657,13 @@ enum ActionStates { // Following action states prohibit movement (see set_action_state()) ACTION_STATE_TALK = 0x0000000C, ///< Reading signs doesn't count ACTION_STATE_SPIN_JUMP = 0x0000000D, - ACTION_STATE_GROUND_POUND = 0x0000000E, - ACTION_STATE_ULTRA_JUMP = 0x0000000F, - ACTION_STATE_ULTRA_POUND = 0x00000010, + ACTION_STATE_SPIN_POUND = 0x0000000E, + ACTION_STATE_TORNADO_JUMP = 0x0000000F, + ACTION_STATE_TORNADO_POUND = 0x00000010, ACTION_STATE_SLIDING = 0x00000011, ACTION_STATE_HAMMER = 0x00000012, ACTION_STATE_13 = 0x00000013, - ACTION_STATE_14 = 0x00000014, + ACTION_STATE_PUSHING_BLOCK = 0x00000014, ACTION_STATE_HIT_FIRE = 0x00000015, ///< Causes Mario to fly up and take damage. Used for fire bars. ACTION_STATE_KNOCKBACK = 0x00000016, // some kind of knockback, does no damage ACTION_STATE_HIT_LAVA = 0x00000017, @@ -2661,10 +2680,21 @@ enum ActionStates { ACTION_STATE_STEP_UP = 0x00000022, ACTION_STATE_23 = 0x00000023, ACTION_STATE_24 = 0x00000024, - ACTION_STATE_25 = 0x00000025, + ACTION_STATE_INVALID_25 = 0x00000025, ACTION_STATE_USE_SPRING = 0x00000026, }; +enum JumpSubstate { + JUMP_SUBSTATE_0 = 0, + JUMP_SUBSTATE_1 = 1, +}; + +enum LandOnSwitchSubstate { + LANDING_ON_SWITCH_SUBSTATE_0 = 0, + LANDING_ON_SWITCH_SUBSTATE_1 = 1, + LANDING_ON_SWITCH_SUBSTATE_2 = 2, +}; + /* (1 = isPeach, 2 = isTransformed, 4 = hasUmbrella) */ enum PeachStatusFlags { PEACH_STATUS_FLAG_IS_PEACH = 0x01, @@ -3093,6 +3123,7 @@ enum NpcFlags { }; enum PlayerStatusFlags { + PLAYER_STATUS_FLAGS_AIRBORNE = 0x0000000E, PLAYER_STATUS_FLAGS_JUMPING = 0x00000002, PLAYER_STATUS_FLAGS_FALLING = 0x00000004, PLAYER_STATUS_FLAGS_FLYING = 0x00000008, @@ -3109,7 +3140,7 @@ enum PlayerStatusFlags { PLAYER_STATUS_FLAGS_4000 = 0x00004000, PLAYER_STATUS_FLAGS_8000 = 0x00008000, PLAYER_STATUS_FLAGS_20000 = 0x00020000, - PLAYER_STATUS_FLAGS_40000 = 0x00040000, + PLAYER_STATUS_FLAGS_40000 = 0x00040000, // physics and animations run at half speed PLAYER_STATUS_FLAGS_80000 = 0x00080000, PLAYER_STATUS_FLAGS_100000 = 0x00100000, PLAYER_STATUS_FLAGS_200000 = 0x00200000, // using hammer? @@ -3407,6 +3438,13 @@ enum ActionCommand { ACTION_COMMAND_TIDAL_WAVE = 0x00000017, }; +enum HazardType { + HAZARD_TYPE_NONE = 0, + HAZARD_TYPE_LAVA = 1, + HAZARD_TYPE_SPIKES = 2, + HAZARD_TYPE_FIRE_BAR = 3, +}; + enum EffectGfxDataFlags { FX_GRAPHICS_DISABLED = 0x00000000, FX_GRAPHICS_ENABLED = 0x00000001, @@ -4078,16 +4116,23 @@ enum MusicSettingsFlags { MUSIC_SETTINGS_FLAGS_80000000 = 0x80000000, }; +// the lower byte of Collider::flags +enum SurfaceType { + SURFACE_TYPE_DEFAULT = 0, + SURFACE_TYPE_WATER = 1, + SURFACE_TYPE_SPIKES = 2, + SURFACE_TYPE_LAVA = 3, + SURFACE_TYPE_DOCK_WALL = 4, + SURFACE_TYPE_SLIDE = 5, + SURFACE_TYPE_FLOWERS = 6, + SURFACE_TYPE_CLOUD = 7, ///< used with clouds in flo_19 and flo_21 + SURFACE_TYPE_SNOW = 8, + SURFACE_TYPE_HEDGES = 9, ///< used within hedge maze in flo_11 +}; + enum ColliderFlags { COLLIDER_FLAGS_UPPER_MASK = 0x7FFFFE00, // map data dumper needs this to be first - COLLIDER_FLAGS_WATER_FLOOR = 0x00000001, - COLLIDER_FLAGS_LAVA_FLOOR = 0x00000002, - COLLIDER_FLAGS_SUSHIE_DOCK_WALL = 0x00000004, - COLLIDER_FLAGS_SNOW_FLOOR = 0x00000008, - COLLIDER_FLAGS_10 = 0x00000010, - COLLIDER_FLAGS_20 = 0x00000020, - COLLIDER_FLAGS_40 = 0x00000040, - COLLIDER_FLAGS_80 = 0x00000080, + COLLIDER_FLAGS_SURFACE_TYPE_MASK = 0x000000FF, COLLIDER_FLAGS_100 = 0x00000100, COLLIDER_FLAGS_200 = 0x00000200, COLLIDER_FLAGS_400 = 0x00000400, diff --git a/include/functions.h b/include/functions.h index c61dbde82d..26029c95f4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -608,9 +608,9 @@ s32 add_star_pieces(s32 amt); s32 make_item_entity_at_player(s32 itemID, s32 arg1, s32 pickupMsgFlags); void set_action_state(s32 actionState); -s32 get_collider_type_by_id(s32 colliderID); -void suggest_player_anim_setUnkFlag(s32 arg0); -void suggest_player_anim_clearUnkFlag(s32 arg0); +s32 get_collider_flags(s32 colliderID); +void suggest_player_anim_setUnkFlag(AnimID anim); +void suggest_player_anim_clearUnkFlag(AnimID anim); void subtract_hp(s32 amt); void draw_status_ui(void); void open_status_menu_long(void); @@ -740,7 +740,7 @@ void func_802B71C8(void); void func_802B71D4(void); void func_802B72C0_E22870(void); s32 func_802BD7DC(void); -void func_802BE070_31DBE0(void); +void world_watt_sync_held_position(void); void func_802BFB44_323694(f32 arg0); void initialize_curtains(void); diff --git a/include/macros.h b/include/macros.h index d9ef991167..083f88e168 100644 --- a/include/macros.h +++ b/include/macros.h @@ -83,8 +83,7 @@ // Should be 1.0f / 0x7FFF, but precision is wrong for a double #define SHT_MINV 3.051851e-05 - -#define SPRITE_WORLD_SCALE (5.0f/7.0f) +#define SPRITE_WORLD_SCALE_F (5.0f/7.0f) #define SPRITE_WORLD_SCALE_D (5.0/7.0) #define BATTLE_ENTITY_ID_MASK 0x800 @@ -112,10 +111,16 @@ #define ASCII_TO_U32(a, b, c, d) ((u32)((a << 24) | (b << 16) | (c << 8) | (d << 0))) -#define SPRITE_PIXEL_SCALE (5.0 / 7.0) - #define ITEM_VIS_GROUP(itemID, visGroupID) ((visGroupID) << 16 | (itemID)) +// loads integrator with standard parameter set used for falling + +#define LOAD_INTEGRATOR_FALL(ptr) \ + (ptr)[0] = 0.11430f; \ + (ptr)[1] = -0.28710f; \ + (ptr)[2] = -0.18230f; \ + (ptr)[3] = 0.01152f; \ + /* common AI function and script variables */ // ai script #define AI_TEMP_STATE functionTemp[0] diff --git a/include/npc.h b/include/npc.h index 14be884fb9..a04e3954fb 100644 --- a/include/npc.h +++ b/include/npc.h @@ -404,11 +404,11 @@ void init_npc_list(void); /// Presumably did something once upon a time but got commented out. void npc_iter_no_op(void); -s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims); +s32 _create_npc(NpcBlueprint* blueprint, AnimID** animList, s32 skipLoadingAnims); s32 _create_npc_basic(NpcBlueprint* blueprint); -s32 _create_npc_standard(NpcBlueprint* blueprint, u32** animList); +s32 _create_npc_standard(NpcBlueprint* blueprint, AnimID** animList); s32 _create_npc_partner(NpcBlueprint* blueprint); diff --git a/include/variables.h b/include/variables.h index 43994d2cdd..30fcdafdec 100644 --- a/include/variables.h +++ b/include/variables.h @@ -72,7 +72,7 @@ extern CollisionData gCollisionData; extern s8 D_800A0900; extern f32 GravityParamsStartFall[]; -extern s16 D_800F7B80; +extern s16 FootstepSoundSelector; extern u8* D_801512F0; extern u16 D_80151308; extern s32 gEntityHideMode; @@ -192,11 +192,11 @@ extern UNK_FUN_PTR(D_8010C940); extern Entity* TweesterTouchingPartner; extern Entity* TweesterTouchingPlayer; extern UNK_FUN_PTR(D_8010C958); -extern s32 D_8010C95C; +extern s32 PrevPlayerDirection; extern s32 D_8010C96C; extern s32 D_8010C980; extern s32 D_8010C9A0; -extern s32 D_800F7B40; +extern s32 PrevPlayerCamRelativeYaw; extern s32 D_800F7B44; extern f32 D_8010C938; extern f32 D_8010C990; @@ -258,8 +258,8 @@ extern s32 D_80292110[]; extern s32 D_8029FBD0; -extern s32 KoopatrolDisguiseExtraAnims[]; -extern s32 HammerBroDisguiseExtraAnims[]; +extern AnimID KoopatrolDisguiseExtraAnims[]; +extern AnimID HammerBroDisguiseExtraAnims[]; //various extern s32 D_802C05CC; diff --git a/src/182B30.c b/src/182B30.c index 00e4f03296..d028fe26b4 100644 --- a/src/182B30.c +++ b/src/182B30.c @@ -348,9 +348,9 @@ void appendGfx_player_actor_blur(Actor* actor) { guRotateF(mtxRotZ, rotZ, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotX, mtxRotY, mtxTransform); guMtxCatF(mtxTransform, mtxRotZ, mtxRotation); - guScaleF(mtxScale, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor, - actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor * partTable->verticalStretch, - actor->scale.z * SPRITE_PIXEL_SCALE); + guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor, + actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor * partTable->verticalStretch, + actor->scale.z * SPRITE_WORLD_SCALE_D); guMtxCatF(mtxScale, mtxPivotOn, mtxTemp); guMtxCatF(mtxTemp, mtxRotation, mtxTransform); guMtxCatF(mtxTransform, mtxPivotOff, mtxTemp); @@ -424,9 +424,9 @@ void func_802552EC(s32 arg0, Actor* actor) { guRotateF(mtxRotZ, actor->rotation.z, 0.0f, 0.0f, 1.0f); guMtxCatF(mtxRotX, mtxRotY, mtxTemp); guMtxCatF(mtxTemp, mtxRotZ, mtxRotation); - guScaleF(mtxScale, actor->scale.x * SPRITE_PIXEL_SCALE * actor->scalingFactor, - actor->scale.y * SPRITE_PIXEL_SCALE * actor->scalingFactor, - actor->scale.z * SPRITE_PIXEL_SCALE); + guScaleF(mtxScale, actor->scale.x * SPRITE_WORLD_SCALE_D * actor->scalingFactor, + actor->scale.y * SPRITE_WORLD_SCALE_D * actor->scalingFactor, + actor->scale.z * SPRITE_WORLD_SCALE_D); guMtxCatF(mtxScale, mtxRotation, mtxActor); numParts = actor->numParts; @@ -453,7 +453,7 @@ void func_802552EC(s32 arg0, Actor* actor) { } if (partTable->flags & ACTOR_PART_FLAG_USE_ABSOLUTE_POSITION) { - guScaleF(mtxPartScale, actor->scale.x * SPRITE_PIXEL_SCALE, actor->scale.y * SPRITE_PIXEL_SCALE, actor->scale.z * SPRITE_PIXEL_SCALE); + guScaleF(mtxPartScale, actor->scale.x * SPRITE_WORLD_SCALE_D, actor->scale.y * SPRITE_WORLD_SCALE_D, actor->scale.z * SPRITE_WORLD_SCALE_D); } j = decorationTable->unk_7D9; @@ -3705,7 +3705,7 @@ void func_8025DA68(ActorPart* part, s32 decorationIndex) { x = part->currentPos.x; y = part->currentPos.y + (part->size.y / 2); z = part->currentPos.z - 5.0f; - // bug? perhaps this should be % 4? + // @bug? perhaps this should be % 4? if ((gGameStatusPtr->frameCounter / 4) == 0) { fx_sparkles(FX_SPARKLES_1, x, y, z, 10.0f); } diff --git a/src/190A10.c b/src/190A10.c index 487d025dfb..05cad9b494 100644 --- a/src/190A10.c +++ b/src/190A10.c @@ -3,19 +3,19 @@ extern s32 D_8010C968; extern s32 D_8010C98C; -s32 func_80262130(f32 inX, f32 inY, f32 inZ, f32 arg3, f32 radius) { +s32 func_80262130(f32 inX, f32 inY, f32 inZ, f32 height, f32 radius) { f32 x = inX; f32 y = inY; f32 z = inZ; - f32 hitDepth = arg3; + f32 hitDepth = height; s32 ret = FALSE; s32 phi_s0 = 0; - if (npc_raycast_down_around(0, &x, &y, &z, &hitDepth, 90.0f, radius) && hitDepth <= arg3) { - s32 type = get_collider_type_by_id(D_8010C98C & 0xFF); - s32 type2 = get_collider_type_by_id(D_8010C968 & 0xFF); + if (npc_raycast_down_around(0, &x, &y, &z, &hitDepth, 90.0f, radius) && hitDepth <= height) { + s32 colliderFlagsA = get_collider_flags(D_8010C98C & 0xFF); + s32 colliderFlagsB = get_collider_flags(D_8010C968 & 0xFF); - phi_s0 = type & type2; + phi_s0 = colliderFlagsA & colliderFlagsB; if (phi_s0 != (D_8010C98C & 0xFF)) { phi_s0 = 0; } diff --git a/src/190B20.c b/src/190B20.c index 4ab01a09fe..e85a434052 100644 --- a/src/190B20.c +++ b/src/190B20.c @@ -36,7 +36,7 @@ extern ActorPartBlueprint bMarioParts[]; extern PartnerDMAData D_80283F10[]; -s32 func_80265CE8(u32*, s32); +s32 func_80265CE8(AnimID*, s32); void create_target_list(Actor* actor, s32 arg1); INCLUDE_ASM(s32, "190B20", create_target_list); @@ -1218,7 +1218,7 @@ void load_partner_actor(void) { if (part->idleAnimations != NULL) { part->currentAnimation = func_80265CE8(part->idleAnimations, 1); - part->unk_84 = spr_load_npc_sprite(part->currentAnimation | 0x80000000, NULL); + part->unk_84 = spr_load_npc_sprite(part->currentAnimation | SPRITE_ID_TAIL_ALLOCATE, NULL); } if (i + 1 >= partCount) { @@ -1484,7 +1484,7 @@ Actor* create_actor(Formation formation) { part->unk_84 = -1; if (part->idleAnimations != NULL) { - part->currentAnimation = func_80265CE8(part->idleAnimations, 1) & ~0x80000000; + part->currentAnimation = func_80265CE8(part->idleAnimations, 1) & ~SPRITE_ID_TAIL_ALLOCATE; part->unk_84 = spr_load_npc_sprite(part->currentAnimation, NULL); } diff --git a/src/19FAF0.c b/src/19FAF0.c index 5697e56e07..c6d987ae58 100644 --- a/src/19FAF0.c +++ b/src/19FAF0.c @@ -1351,9 +1351,9 @@ ApiStatus PlayerRunToGoal(Evt* script, s32 isInitialCall) { player->footStepCounter++; playerState->distance = 0.0f; if ((player->footStepCounter % 2) != 0) { - sfx_play_sound_at_position(SOUND_STEP1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); } else { - sfx_play_sound_at_position(SOUND_STEP2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); } } @@ -1426,9 +1426,9 @@ ApiStatus CancelablePlayerRunToGoal(Evt* script, s32 isInitialCall) { player->footStepCounter++; playerState->distance = 0.0f; if ((player->footStepCounter % 2) != 0) { - sfx_play_sound_at_position(SOUND_STEP1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL1, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); } else { - sfx_play_sound_at_position(SOUND_STEP2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); + sfx_play_sound_at_position(SOUND_STEP_NORMAL2, 0, player->currentPos.x, player->currentPos.y, player->currentPos.z); } } diff --git a/src/23680.c b/src/23680.c index 2bab4155db..1ef2de85fa 100644 --- a/src/23680.c +++ b/src/23680.c @@ -269,7 +269,7 @@ void basic_ai_wander_init(Evt* script, MobileAISettings* npcAISettings, EnemyDet // chose a random direction and move time npc->duration = (npcAISettings->moveTime / 2) + rand_int((npcAISettings->moveTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(60) - 30.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; script->functionTemp[1] = 0; if (enemy->territory->wander.moveSpeedOverride < 0) { @@ -379,7 +379,7 @@ void basic_ai_loiter_init(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->AI_TEMP_STATE = AI_STATE_LOITER; } @@ -430,7 +430,7 @@ void basic_ai_found_player_jump_init(Evt* script, MobileAISettings* npcAISetting Npc* npc = get_npc_unsafe(enemy->npcID); ai_enemy_play_sound(npc, SOUND_3E1, 0); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_JUMP]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_JUMP]; npc->jumpVelocity = 10.0f; npc->jumpScale = 2.5f; npc->moveToPos.y = npc->pos.y; @@ -489,7 +489,7 @@ void basic_ai_chase_init(Evt* script, MobileAISettings* npcAISettings, EnemyDete npc->duration = 0; } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->moveSpeed = npcAISettings->chaseSpeed; script->AI_TEMP_STATE = AI_STATE_CHASE; } @@ -502,7 +502,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 20; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; return; @@ -515,7 +515,7 @@ void basic_ai_chase(Evt* script, MobileAISettings* aiSettings, EnemyDetectVolume z = npc->pos.z; if (npc_test_move_simple_with_slipping(npc->collisionChannel, &x, &y, &z, 1.0f, npc->yaw, npc->collisionHeight, npc->collisionRadius)) { fx_emote(EMOTE_QUESTION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &sp28); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 15; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; return; @@ -570,7 +570,7 @@ ApiStatus BasicAI_Main(Evt* script, s32 isInitialCall) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/38F00.c b/src/38F00.c index 60a09fcb55..efe03f0e5b 100644 --- a/src/38F00.c +++ b/src/38F00.c @@ -105,7 +105,7 @@ ApiStatus func_8005DB00(Evt* script, s32 isInitialCall) { npc->duration = evt_get_variable(script, LVar1); script->functionTemp[1] = evt_get_variable(script, LVar2); script->functionTemp[2] = evt_get_variable(script, LVar3) / 2; - npc->currentAnim.w = script->varTable[10]; + npc->currentAnim = script->varTable[10]; script->functionTemp[0] = 1; break; case 1: diff --git a/src/415D90.c b/src/415D90.c index 1b79790de5..b433a34155 100644 --- a/src/415D90.c +++ b/src/415D90.c @@ -2665,7 +2665,7 @@ void btl_state_update_select_target(void) { } } - if (battleStatus->currentTargetListFlags < 0) { + if (battleStatus->currentTargetListFlags & 0x80000000) { if (!(gBattleStatus.flags1 & BS_FLAGS1_80000)) { gBattleState2 = battleStatus->unk_6E; if (gBattleStatus.flags2 & BS_FLAGS2_40) { diff --git a/src/77480.c b/src/77480.c index 9ec2df45d9..9af930024f 100644 --- a/src/77480.c +++ b/src/77480.c @@ -40,6 +40,7 @@ s32 get_player_back_anim(s32 arg0); void appendGfx_player(void* data); void appendGfx_player_spin(void* data); void update_player_shadow(void); +s32 partner_use_ability(void); s32 player_raycast_below(f32 yaw, f32 diameter, f32* outX, f32* outY, f32* outZ, f32* outLength, f32* hitRx, f32* hitRz, f32* hitDirX, f32* hitDirZ) { @@ -366,7 +367,7 @@ s32 player_test_lateral_overlap(s32 mode, PlayerStatus* playerStatus, f32* x, f3 radius = playerStatus->colliderDiameter * 0.5f; ret = -1; - if ((playerStatus->flags & (PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING)) == 0) { + if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING))) { height = playerStatus->colliderHeight * 0.286f; } else { height = 1.0f; @@ -544,7 +545,7 @@ s32 player_test_move_with_slipping(PlayerStatus* playerStatus, f32* x, f32* y, f s32 ret = -1; height = 0.0f; - if ((playerStatus->flags & (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING)) == 0) { + if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING))) { height = 10.01f; } radius = playerStatus->colliderDiameter * 0.5f; @@ -698,14 +699,14 @@ void phys_update_standard(void) { check_input_use_partner(); phys_update_action_state(); - if (!(playerStatus->flags & 8)) { - if (playerStatus->flags & 2) { + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_FLYING)) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_JUMPING) { phys_update_jump(); } } - if (playerStatus->flags & 4) { - if (!(playerStatus->flags & 8)) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_FALLING) { + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_FLYING)) { phys_update_falling(); } } @@ -716,11 +717,8 @@ void phys_update_standard(void) { collision_main_lateral(); collision_check_player_overlaps(); - if ( - collision_main_above() < 0 && - playerStatus->timeInAir == 0 && - playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS - ) { + if (collision_main_above() < 0 && playerStatus->timeInAir == 0 && + playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { func_800E4F10(); } @@ -730,8 +728,8 @@ void phys_update_standard(void) { } } - if (playerStatus->animFlags & 2) { - func_802BE070_31DBE0(); + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_2) { + world_watt_sync_held_position(); } if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_CAMERA_DOESNT_FOLLOW)) { @@ -823,7 +821,8 @@ s32 get_overriding_player_anim(s32 anim) { return -1; } } else if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - if (playerStatus->unk_C4 && (anim == ANIM_Peach_C0000 || anim == ANIM_Peach_C0001 || anim == ANIM_Peach_C0002)) { + if ((playerStatus->peachItemHeld != 0) + && (anim == ANIM_Peach_C0000 || anim == ANIM_Peach_C0001 || anim == ANIM_Peach_C0002)) { anim = ANIM_Peach_D0000; } } @@ -835,9 +834,9 @@ s32 get_overriding_player_anim(s32 anim) { return anim; } -void suggest_player_anim_clearUnkFlag(s32 anim) { +void suggest_player_anim_clearUnkFlag(AnimID anim) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 newAnim = get_overriding_player_anim(anim); + AnimID newAnim = get_overriding_player_anim(anim); if (newAnim != -1) { playerStatus->anim = newAnim; @@ -846,7 +845,7 @@ void suggest_player_anim_clearUnkFlag(s32 anim) { } } -void force_player_anim(s32 anim) { +void force_player_anim(AnimID anim) { PlayerStatus* playerStatus = &gPlayerStatus; playerStatus->anim = anim; @@ -854,9 +853,9 @@ void force_player_anim(s32 anim) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_10000000; } -void suggest_player_anim_setUnkFlag(s32 anim) { +void suggest_player_anim_setUnkFlag(AnimID anim) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 newAnim = get_overriding_player_anim(anim); + AnimID newAnim = get_overriding_player_anim(anim); if (newAnim != -1) { playerStatus->anim = newAnim; @@ -867,34 +866,34 @@ void suggest_player_anim_setUnkFlag(s32 anim) { void update_player_blink(void) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 phi_a2 = 0; + s32 outtaSight = FALSE; u8 phi_v1; u8* alpha; if (gPartnerActionStatus.actingPartner == PARTNER_BOW) { - phi_a2 = gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE; + outtaSight = gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE; } if (playerStatus->blinkTimer > 0) { playerStatus->blinkTimer--; alpha = &playerStatus->alpha1; if (!(gGameStatusPtr->frameCounter & 1)) { - if (phi_a2) { - phi_v1 = 0xC0; + if (outtaSight) { + phi_v1 = 192; } else { - phi_v1 = 0xFF; + phi_v1 = 255; } } else { - phi_v1 = 0x60; + phi_v1 = 96; } *alpha = phi_v1; if (!playerStatus->blinkTimer) { - if (phi_a2) { - playerStatus->alpha1 = 0x80; + if (outtaSight) { + playerStatus->alpha1 = 128; playerStatus->flags |= PLAYER_STATUS_FLAGS_8000; } else { - playerStatus->alpha1 = 0xFF; + playerStatus->alpha1 = 255; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_8000; } } else { @@ -965,9 +964,7 @@ void func_800E01DC(void) { s32 func_800E0208(void) { s32 ret = FALSE; - if (gGameStatusPtr->disableScripts && - (gGameStatusPtr->currentButtons[0] & PLAYER_STATUS_FLAGS_10)) - { + if (gGameStatusPtr->disableScripts && (gGameStatusPtr->currentButtons[0] & BUTTON_R)) { if (gPartnerActionStatus.partnerActionState == PARTNER_ACTION_NONE) { set_action_state(ACTION_STATE_IDLE); } @@ -1284,7 +1281,7 @@ void update_partner_timers(void) { for (i = 1; i < ARRAY_COUNT(playerData->partnerUnlockedTime); i++) { if (playerData->partners[i].enabled) { - playerData->partnerUnlockedTime[i] += 1; + playerData->partnerUnlockedTime[i]++; } } } @@ -1293,73 +1290,74 @@ void update_partner_timers(void) { void func_800E0B90(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 cameraYaw = gCameras[gCurrentCameraID].currentYaw; - f32 temp_f20 = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw); + f32 camRelativeYaw = get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw); s32 trueAnim; - s32 animByte; - f32 unk_90; - s32 phi_v1; - f32 phi_f0; + s32 sprIndex; + f32 angle; + s32 direction; + f32 timescale; D_800F7B48 = 0.0f; - if (temp_f20 < -5.0f && temp_f20 > -175.0f) { - temp_f20 = 0.0f; - phi_v1 = 0; - } else if (temp_f20 > 5.0f && temp_f20 < 175.0f) { - temp_f20 = 180.0f; - phi_v1 = 1; + if (camRelativeYaw < -5.0f && camRelativeYaw > -175.0f) { + camRelativeYaw = 0.0f; + direction = 0; + } else if (camRelativeYaw > 5.0f && camRelativeYaw < 175.0f) { + camRelativeYaw = 180.0f; + direction = 1; } else { - temp_f20 = D_800F7B40; - phi_v1 = 2; + // direction is close to flipping, use saved value + camRelativeYaw = PrevPlayerCamRelativeYaw; + direction = 2; } - if (D_8010C95C != phi_v1 && phi_v1 != 2) { - D_8010C95C = phi_v1; - playerStatus->unk_90[gCurrentCameraID] = (phi_v1 != 0) ? 180.0f : -180.0f; + // detect direction change + if (PrevPlayerDirection != direction && direction != 2) { + PrevPlayerDirection = direction; + playerStatus->flipYaw[gCurrentCameraID] = (direction != 0) ? 180.0f : -180.0f; if (fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) >= 90.0f) { - playerStatus->unk_90[gCurrentCameraID] = -playerStatus->unk_90[gCurrentCameraID]; + playerStatus->flipYaw[gCurrentCameraID] = -playerStatus->flipYaw[gCurrentCameraID]; } } - - unk_90 = playerStatus->unk_90[gCurrentCameraID]; - if (unk_90 != 0.0f) { - if (unk_90 < 0.0f) { - unk_90 += 28.0f; - if (unk_90 > 0.0f) { - unk_90 = 0.0f; + // handle sprite 'flipping' when changing direction + angle = playerStatus->flipYaw[gCurrentCameraID]; + if (angle != 0.0f) { + if (angle < 0.0f) { + angle += 28.0f; + if (angle > 0.0f) { + angle = 0.0f; } } - - if (unk_90 > 0.0f) { - unk_90 -= 28.0f; - if (unk_90 < 0.0f) { - unk_90 = 0.0f; + if (angle > 0.0f) { + angle -= 28.0f; + if (angle < 0.0f) { + angle = 0.0f; } } } - if (playerStatus->flags & 0x200000) { - unk_90 = 0.0f; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_200000) { + angle = 0.0f; } - playerStatus->unk_90[gCurrentCameraID] = unk_90; + playerStatus->flipYaw[gCurrentCameraID] = angle; - D_800F7B40 = unk_90 = clamp_angle(temp_f20); - unk_90 = clamp_angle(playerStatus->unk_90[gCurrentCameraID] + unk_90); + PrevPlayerCamRelativeYaw = angle = clamp_angle(camRelativeYaw); + angle = clamp_angle(playerStatus->flipYaw[gCurrentCameraID] + angle); if (playerStatus->currentSpeed == 0.0f) { D_800F7B48 = 0.0f; } trueAnim = playerStatus->anim; - if (playerStatus->flags & 0x20000) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_20000) { playerStatus->trueAnimation = trueAnim; } else { - animByte = (trueAnim >> 0x10) & 0xFF; + sprIndex = (trueAnim >> 0x10) & 0xFF; - if (playerStatus->actionState != 0xF && !(playerStatus->flags & 0x100000)) { - playerStatus->spriteFacingAngle = unk_90 + D_800F7B48; + if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && !(playerStatus->flags & PLAYER_STATUS_FLAGS_100000)) { + playerStatus->spriteFacingAngle = angle + D_800F7B48; trueAnim = playerStatus->anim; - if (!(playerStatus->flags & 0x10000000) && - (animByte == 1 || animByte == 6 || animByte == 10) && + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_10000000) && + (sprIndex == SPR_Mario_1 || sprIndex == SPR_Mario_6 || sprIndex == SPR_Peach_A) && fabsf(get_clamped_angle_diff(cameraYaw, playerStatus->currentYaw)) < 60.0f) { trueAnim = get_player_back_anim(trueAnim); @@ -1368,10 +1366,9 @@ void func_800E0B90(void) { playerStatus->currentYaw = playerStatus->targetYaw; } else { trueAnim = playerStatus->anim; - if (!(playerStatus->flags & 0x10000000) && - (animByte == 1 || animByte == 6 || animByte == 10) && - playerStatus->spriteFacingAngle < 350.0f && - playerStatus->spriteFacingAngle > 190.0f) + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_10000000) && + (sprIndex == SPR_Mario_1 || sprIndex == SPR_Mario_6 || sprIndex == SPR_Peach_A) && + playerStatus->spriteFacingAngle < 350.0f && playerStatus->spriteFacingAngle > 190.0f) { trueAnim = get_player_back_anim(trueAnim); } @@ -1379,61 +1376,61 @@ void func_800E0B90(void) { } } - phi_f0 = 1.0f; - if (playerStatus->flags & 0x40000) { - phi_f0 = 0.5f; + timescale = 1.0f; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) { + timescale = 0.5f; } - if (playerStatus->flags & 0x20000000) { - phi_f0 = 0.0f; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_20000000) { + timescale = 0.0f; } - playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, phi_f0); - playerStatus->flags |= 0x40000000; + playerStatus->unk_BC = spr_update_player_sprite(0, playerStatus->trueAnimation, timescale); + playerStatus->flags |= PLAYER_STATUS_FLAGS_40000000; } -s32 get_player_back_anim(s32 arg0) { - s32 animByte = (arg0 >> 16) & 0xff; - s32 ret = 0; +s32 get_player_back_anim(s32 anim) { + s32 sprIndex = (anim >> 16) & 0xff; + s32 outAnim = 0; - if (animByte != 1) { - if (animByte != 6 && animByte != 10) { - return arg0; + if (sprIndex != SPR_Mario_1) { + if (sprIndex != SPR_Mario_6 && sprIndex != SPR_Peach_A) { + return anim; } - if (animByte == 1) { - if (arg0 > 0x1000C) { - return arg0; + if (sprIndex == SPR_Mario_1) { + if (anim > ANIM_Mario_1000C) { + return anim; } - } else if (animByte == 6) { - if (arg0 == 0x6000C) { - ret = 0x6000D; - } else if (arg0 == 0x6000E) { - ret = 0x6000F; - } else if (arg0 == 0x60010) { - ret = 0x60011; - } else if (arg0 == 0x60012) { - ret = 0x60013; - } else if (arg0 == 0x60014) { - ret = 0x60015; - } else if (arg0 == 0x60016) { - ret = 0x60017; - } else if (arg0 == 0x60018) { - ret = 0x60019; - } else if (arg0 == 0x6001A) { - ret = 0x6001B; + } else if (sprIndex == SPR_Mario_6) { + if (anim == ANIM_Mario_6000C) { + outAnim = ANIM_Mario_6000D; + } else if (anim == ANIM_Mario_6000E) { + outAnim = ANIM_Mario_6000F; + } else if (anim == ANIM_Mario_60010) { + outAnim = ANIM_Mario_60011; + } else if (anim == ANIM_Mario_60012) { + outAnim = ANIM_Mario_60013; + } else if (anim == ANIM_Mario_60014) { + outAnim = ANIM_Mario_60015; + } else if (anim == ANIM_Mario_60016) { + outAnim = ANIM_Mario_60017; + } else if (anim == ANIM_Mario_60018) { + outAnim = ANIM_Mario_60019; + } else if (anim == ANIM_Mario_6001A) { + outAnim = ANIM_Mario_6001B; } - } else if (animByte == 10) { - if (arg0 > 0xA0006) { - ret = arg0 + 1; + } else if (sprIndex == SPR_Peach_A) { + if (anim > ANIM_Peach_A0006) { + outAnim = anim + 1; } } - } else if (arg0 > 0x1000C) { - return arg0; + } else if (anim > ANIM_Mario_1000C) { + return anim; } - if (ret != 0) { - return ret; + if (outAnim != 0) { + return outAnim; } else { - return arg0 | 0x1000000; + return anim | SPRITE_ID_BACK_FACING; } } @@ -1505,10 +1502,10 @@ void appendGfx_player(void* data) { PlayerStatus* playerStatus = &gPlayerStatus; Matrix4f sp20, sp60, spA0, spE0; f32 temp_f0 = -gCameras[gCurrentCamID].currentYaw; - s32 phi_a0; + s32 flags; if (playerStatus->actionState == ACTION_STATE_SLIDING) { - guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); + guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guRotateF(sp20, temp_f0, 0.0f, 1.0f, 0.0f); guMtxCatF(spE0, sp20, sp20); guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); @@ -1528,7 +1525,7 @@ void appendGfx_player(void* data) { guMtxCatF(sp20, spA0, sp20); guTranslateF(sp60, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f); guMtxCatF(sp20, sp60, sp20); - guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); + guScaleF(spE0, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); guMtxCatF(sp20, sp60, sp20); @@ -1546,14 +1543,14 @@ void appendGfx_player(void* data) { func_802DDEE4(0, -1, 0, 0, 0, 0, 0, 0); } } - - phi_a0 = 0; - + if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) { - phi_a0 = PLAYER_STATUS_ANIM_FLAGS_10000000; + flags = 0x10000000; + } else { + flags = 0; } - spr_draw_player_sprite(phi_a0, 0, 0, 0, sp20); + spr_draw_player_sprite(flags, 0, 0, 0, sp20); } D_800F7B4C++; @@ -1634,7 +1631,7 @@ void appendGfx_player_spin(void* data) { guMtxCatF(mtx, rotation, mtx); guTranslateF(translation, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f); guMtxCatF(mtx, translation, mtx); - guScaleF(scale, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(mtx, scale, mtx); guTranslateF(translation, px, py, pz); guMtxCatF(mtx, translation, mtx); diff --git a/src/7B440.c b/src/7B440.c index 36888157dc..853d0973c3 100644 --- a/src/7B440.c +++ b/src/7B440.c @@ -48,9 +48,9 @@ void reset_player_status(void) { D_8010C940 = 0; D_8010C958 = 0; D_8010C92C = 0; - D_8010C95C = 0; + PrevPlayerDirection = 0; D_8010C980 = 0; - D_800F7B40 = 0; + PrevPlayerCamRelativeYaw = 0; D_800F7B44 = 0; D_8010C938 = 0; D_8010C990 = 0.0f; @@ -97,10 +97,10 @@ void reset_player_status(void) { playerStatus->position.y = 0.0f; playerStatus->position.z = 0.0f; playerStatus->currentYaw = 0.0f; - playerStatus->unk_90[CAM_DEFAULT] = 0.0f; - playerStatus->unk_90[CAM_BATTLE] = 0.0f; - playerStatus->unk_90[CAM_TATTLE] = 0.0f; - playerStatus->unk_90[CAM_3] = 0.0f; + playerStatus->flipYaw[CAM_DEFAULT] = 0.0f; + playerStatus->flipYaw[CAM_BATTLE] = 0.0f; + playerStatus->flipYaw[CAM_TATTLE] = 0.0f; + playerStatus->flipYaw[CAM_3] = 0.0f; mapSettings = gAreas[gGameStatusPtr->areaID].maps[gGameStatusPtr->mapID].settings; diff --git a/src/7E9D0.c b/src/7E9D0.c index 54bd9a0966..2483fd9836 100644 --- a/src/7E9D0.c +++ b/src/7E9D0.c @@ -145,9 +145,11 @@ s32 phys_adjust_cam_on_landing(void) { } if (ret == 1) { - if ((get_collider_type_by_id(gCollisionStatus.currentFloor) & 0xFF) == 3) { - ret = 0; + s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + + if (surfaceType == SURFACE_TYPE_LAVA) { gCameras[0].moveFlags |= CAMERA_MOVE_FLAGS_1; + ret = 0; } else { gCameras[0].moveFlags &= ~CAMERA_MOVE_FLAGS_1; } @@ -347,11 +349,11 @@ void set_action_state(s32 actionState) { if (actionState == ACTION_STATE_HIT_FIRE || actionState == ACTION_STATE_HIT_LAVA) { s8 partner; - if (playerStatus->unk_BF == 3) { + if (playerStatus->hazardType == HAZARD_TYPE_FIRE_BAR) { actionState = ACTION_STATE_HIT_FIRE; } - // Whilst Sushie, Lakilester, Parakarry's ability is active, hazards have no effect. + // Whilst Sushie, Lakilester, or Parakarry's ability is active, hazards have no effect. partner = playerData->currentPartner; if (partner == PARTNER_SUSHIE || partner == PARTNER_LAKILESTER || partner == PARTNER_PARAKARRY) { @@ -391,9 +393,9 @@ void set_action_state(s32 actionState) { sfx_stop_sound(spinState->spinSoundID); } - if (playerStatus->unk_D8 != NULL) { - playerStatus->unk_D8->data.unk_46->unk_24 = 10; - playerStatus->unk_D8 = NULL; + if (playerStatus->specialDecorationEffect != NULL) { + playerStatus->specialDecorationEffect->data.unk_46->unk_24 = 10; + playerStatus->specialDecorationEffect = NULL; } } @@ -413,10 +415,7 @@ void start_falling(void) { PlayerStatus* playerStatus = &gPlayerStatus; set_action_state(ACTION_STATE_FALLING); - playerStatus->gravityIntegrator[0] = 0.1143f; - playerStatus->gravityIntegrator[1] = -0.2871f; - playerStatus->gravityIntegrator[2] = -0.1823f; - playerStatus->gravityIntegrator[3] = 0.01152f; + LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); } void start_bounce_a(void) { @@ -466,12 +465,15 @@ s32 check_input_hammer(void) { s32 check_input_jump(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; + s32 surfaceType; if (!(playerStatus->pressedButtons & BUTTON_A)) { return FALSE; } - if ((get_collider_type_by_id((u16)collisionStatus->currentFloor) == 5) && phys_should_player_be_sliding()) { + // @bug? collider flags not properly masked with COLLIDER_FLAGS_SURFACE_TYPE + surfaceType = get_collider_flags((u16)gCollisionStatus.currentFloor); + if ((surfaceType == SURFACE_TYPE_SLIDE) && phys_should_player_be_sliding()) { return FALSE; } @@ -542,7 +544,7 @@ void peach_set_disguise_anim(s32 arg0) { s32 listIndex = D_8010C96C; if (listIndex >= 0) { - get_npc_by_index(listIndex)->currentAnim.w = arg0; + get_npc_by_index(listIndex)->currentAnim = arg0; } } diff --git a/src/7bb60_len_41b0.c b/src/7bb60_len_41b0.c index 5ad5ac75af..14f982ae05 100644 --- a/src/7bb60_len_41b0.c +++ b/src/7bb60_len_41b0.c @@ -3,8 +3,8 @@ extern f32 GravityParamsStartJump[]; extern f32 D_8010C928; -extern f32 D_8010C960; -extern f32 D_8010C97C; +extern f32 JumpedOnSwitchX; +extern f32 JumpedOnSwitchZ; extern f32 D_8010C984; void func_800E315C(s32 colliderID); @@ -103,7 +103,7 @@ s32 collision_main_above(void) { } while (0); playerStatus->position.y = y - ((playerStatus->colliderHeight / 5.0f) * 3.0f); - if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP && + if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && playerStatus->actionState != ACTION_STATE_SPIN_JUMP) { playerStatus->gravityIntegrator[0] = 0.0f; @@ -121,16 +121,16 @@ s32 collision_main_above(void) { void func_800E29C8(void) { PlayerStatus* playerStatus = &gPlayerStatus; s32 colliderID; - f32 temp_f20; - s32 phi_a0; + f32 groundPosY; + AnimID anim; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - playerStatus->fallState = 0; + playerStatus->actionSubstate = LANDING_ON_SWITCH_SUBSTATE_0; } - if (playerStatus->fallState == 0) { - if (dist2D(D_8010C960, D_8010C97C, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { + if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_0) { + if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw); } integrate_gravity(); @@ -138,26 +138,26 @@ void func_800E29C8(void) { record_jump_apex(); gravity_use_fall_parms(); integrate_gravity(); - playerStatus->fallState = 1; + playerStatus->actionSubstate = LANDING_ON_SWITCH_SUBSTATE_1; } if (playerStatus->gravityIntegrator[0] > playerStatus->maxJumpSpeed) { playerStatus->gravityIntegrator[0] = playerStatus->maxJumpSpeed; } playerStatus->position.y += playerStatus->gravityIntegrator[0]; - } else if (playerStatus->fallState == 2) { - if (dist2D(D_8010C960, D_8010C97C, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { + } else if (playerStatus->actionSubstate == LANDING_ON_SWITCH_SUBSTATE_2) { + if (dist2D(JumpedOnSwitchX, JumpedOnSwitchZ, playerStatus->position.x, playerStatus->position.z) <= 22.0f) { add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, 5.0f, playerStatus->targetYaw); } - temp_f20 = player_check_collision_below(func_800E34D8(), &colliderID); + groundPosY = player_check_collision_below(func_800E34D8(), &colliderID); func_800E315C(colliderID); - playerStatus->position.y = temp_f20; + playerStatus->position.y = groundPosY; if (colliderID >= 0) { - if (!(playerStatus->animFlags & 1)) { - phi_a0 = 0x10009; + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { + anim = ANIM_Mario_10009; } else { - phi_a0 = 0x6000B; + anim = ANIM_Mario_6000B; } - suggest_player_anim_clearUnkFlag(phi_a0); + suggest_player_anim_clearUnkFlag(anim); enable_player_input(); phys_player_land(); } @@ -192,10 +192,7 @@ void func_800E2BB0(void) { if (cond) { record_jump_apex(); - playerStatus->gravityIntegrator[0] = 0.1143f; - playerStatus->gravityIntegrator[1] = -0.2871f; - playerStatus->gravityIntegrator[2] = -0.1823f; - playerStatus->gravityIntegrator[3] = 0.01152f; + LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); set_action_state(ACTION_STATE_FALLING); } } @@ -272,7 +269,7 @@ void phys_update_jump(void) { void phys_init_integrator_for_current_state(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32* temp_a0; + f32* params; switch (playerStatus->actionState) { case ACTION_STATE_LANDING_ON_SWITCH: @@ -283,22 +280,22 @@ void phys_init_integrator_for_current_state(void) { break; case ACTION_STATE_JUMP: case ACTION_STATE_SPIN_JUMP: - case ACTION_STATE_GROUND_POUND: - case ACTION_STATE_ULTRA_JUMP: - case ACTION_STATE_ULTRA_POUND: + case ACTION_STATE_SPIN_POUND: + case ACTION_STATE_TORNADO_JUMP: + case ACTION_STATE_TORNADO_POUND: case ACTION_STATE_HIT_FIRE: case ACTION_STATE_HIT_LAVA: - temp_a0 = GravityParamsStartJump; + params = GravityParamsStartJump; if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_40000)) { - playerStatus->gravityIntegrator[0] = *temp_a0++; - playerStatus->gravityIntegrator[1] = *temp_a0++; - playerStatus->gravityIntegrator[2] = *temp_a0++; - playerStatus->gravityIntegrator[3] = *temp_a0++; + playerStatus->gravityIntegrator[0] = *params++; + playerStatus->gravityIntegrator[1] = *params++; + playerStatus->gravityIntegrator[2] = *params++; + playerStatus->gravityIntegrator[3] = *params++; } else { - playerStatus->gravityIntegrator[0] = *temp_a0++ * 0.5f; - playerStatus->gravityIntegrator[1] = *temp_a0++ * 0.5f; - playerStatus->gravityIntegrator[2] = *temp_a0++ * 0.5f; - playerStatus->gravityIntegrator[3] = *temp_a0++ * 0.5f; + playerStatus->gravityIntegrator[0] = *params++ * 0.5f; + playerStatus->gravityIntegrator[1] = *params++ * 0.5f; + playerStatus->gravityIntegrator[2] = *params++ * 0.5f; + playerStatus->gravityIntegrator[3] = *params++ * 0.5f; } break; } @@ -308,21 +305,21 @@ static const f32 padding = 0.0f; // This function is wack. This weird stuff is needed to match void gravity_use_fall_parms(void) { - f32* floats = GravityParamsStartFall; + f32* params = GravityParamsStartFall; PlayerStatus* playerStatus; do {} while (0); playerStatus = &gPlayerStatus; - if (playerStatus->flags & 0x40000) { - playerStatus->gravityIntegrator[0] = *floats++ / 12.0f; - playerStatus->gravityIntegrator[1] = *floats++ / 12.0f; - playerStatus->gravityIntegrator[2] = *floats++ / 12.0f; - playerStatus->gravityIntegrator[3] = *floats++ / 12.0f; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) { + playerStatus->gravityIntegrator[0] = *params++ / 12.0f; + playerStatus->gravityIntegrator[1] = *params++ / 12.0f; + playerStatus->gravityIntegrator[2] = *params++ / 12.0f; + playerStatus->gravityIntegrator[3] = *params++ / 12.0f; } else { - playerStatus->gravityIntegrator[0] = *floats++; - playerStatus->gravityIntegrator[1] = *floats++; - playerStatus->gravityIntegrator[2] = *floats++; - playerStatus->gravityIntegrator[3] = *floats++; + playerStatus->gravityIntegrator[0] = *params++; + playerStatus->gravityIntegrator[1] = *params++; + playerStatus->gravityIntegrator[2] = *params++; + playerStatus->gravityIntegrator[3] = *params++; } } @@ -331,9 +328,7 @@ void phys_update_falling(void) { gPlayerStatus.actionState != ACTION_STATE_BOUNCE) { s32 colliderID; - gPlayerStatus.position.y = player_check_collision_below(func_800E34D8(), &colliderID); - func_800E315C(colliderID); } } @@ -343,19 +338,18 @@ void func_800E315C(s32 colliderID) { PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; if (colliderID >= 0) { - u8 colliderType = get_collider_type_by_id(colliderID); - - switch (colliderType) { - case 1: - case 4: - case 5: + s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + switch (surfaceType) { + case SURFACE_TYPE_WATER: + case SURFACE_TYPE_DOCK_WALL: + case SURFACE_TYPE_SLIDE: set_action_state(ACTION_STATE_LAND); break; - case 3: + case SURFACE_TYPE_LAVA: if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) { if (playerStatus->blinkTimer == 0) { if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) { - playerStatus->unk_BF = 1; + playerStatus->hazardType = HAZARD_TYPE_LAVA; set_action_state(ACTION_STATE_HIT_LAVA); } } else { @@ -363,11 +357,11 @@ void func_800E315C(s32 colliderID) { } } break; - case 2: + case SURFACE_TYPE_SPIKES: if ((*(s32*)(&partnerActionStatus->partnerActionState) & 0xFF0000FF) != 0x01000009) { if (playerStatus->blinkTimer == 0) { if (playerStatus->actionState != ACTION_STATE_HIT_FIRE) { - playerStatus->unk_BF = 2; + playerStatus->hazardType = HAZARD_TYPE_SPIKES; set_action_state(ACTION_STATE_HIT_LAVA); } break; @@ -393,7 +387,7 @@ void phys_player_land(void) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800000; playerStatus->landPos.x = playerStatus->position.x; playerStatus->landPos.z = playerStatus->position.z; - playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE; sfx_play_sound_at_player(SOUND_SOFT_LAND, 0); if (!(collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT)) { phys_adjust_cam_on_landing(); @@ -408,22 +402,22 @@ void phys_player_land(void) { Entity* entity = get_entity_by_index(collisionStatus->currentFloor); entity->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; - if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP && - playerStatus->actionState != ACTION_STATE_ULTRA_POUND && + if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && + playerStatus->actionState != ACTION_STATE_TORNADO_POUND && playerStatus->actionState != ACTION_STATE_SPIN_JUMP && - playerStatus->actionState != ACTION_STATE_GROUND_POUND) + playerStatus->actionState != ACTION_STATE_SPIN_POUND) { set_action_state(ACTION_STATE_LANDING_ON_SWITCH); } else { disable_player_input(); - playerStatus->fallState = 0xB; + playerStatus->actionSubstate = 11; } return; } } } - if (playerStatus->flags & 0x4000) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_4000) { set_action_state(ACTION_STATE_RUN); return; } @@ -465,12 +459,12 @@ f32 integrate_gravity(void) { } f32 func_800E34D8(void) { - f32 ret = integrate_gravity(); + f32 velocity = integrate_gravity(); if (func_800E0208()) { - ret = 0.0f; + velocity = 0.0f; } - return ret; + return velocity; } f32 player_check_collision_below(f32 offset, s32* colliderID) { @@ -549,8 +543,8 @@ void collision_main_lateral(void) { } } break; - case ACTION_STATE_GROUND_POUND: - case ACTION_STATE_ULTRA_POUND: + case ACTION_STATE_SPIN_POUND: + case ACTION_STATE_TORNADO_POUND: playerStatus->position.x += playerStatus->extraVelocity.x; playerStatus->position.y += playerStatus->extraVelocity.y; playerStatus->position.z += playerStatus->extraVelocity.z; @@ -624,7 +618,7 @@ void collision_main_lateral(void) { } sin_cos_rad(yaw * TAU / 360.0f, &sinTheta, &cosTheta); - if (playerStatus->actionState == ACTION_STATE_14) { + if (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK) { if (fabsf(sinTheta) > fabsf(cosTheta)) { xBump = speed * sinTheta; zBump = 0.0f; @@ -751,7 +745,7 @@ void collision_main_lateral(void) { case ACTION_STATE_LANDING_ON_SWITCH: case ACTION_STATE_LAND: case ACTION_STATE_STEP_DOWN_LAND: - case ACTION_STATE_ULTRA_JUMP: + case ACTION_STATE_TORNADO_JUMP: case ACTION_STATE_SLIDING: case ACTION_STATE_HIT_FIRE: case ACTION_STATE_HIT_LAVA: @@ -888,20 +882,20 @@ void phys_main_collision_below(void) { f32 temp_f24 = (2.0f * playerStatus->colliderHeight) / 7.0f; f32 hitRx, hitRz; f32 hitDirX, hitDirZ; - s32 result; + s32 colliderID; s32 cond; - result = player_raycast_below_cam_relative(playerStatus, &playerX, &playerY, &playerZ, &outLength, &hitRx, &hitRz, + colliderID = player_raycast_below_cam_relative(playerStatus, &playerX, &playerY, &playerZ, &outLength, &hitRx, &hitRz, &hitDirX, &hitDirZ); playerStatus->groundNormalPitch = get_player_normal_pitch(); if (collHeightHalf + (temp_f24 * 0.5f) < outLength) { - result = -1; + colliderID = -1; } if (playerStatus->timeInAir == 0) { - collisionStatus->currentFloor = result; + collisionStatus->currentFloor = colliderID; } - if (result >= 0) { + if (colliderID >= 0) { playerStatus->groundAnglesXZ.x = hitDirX; playerStatus->groundAnglesXZ.y = hitDirZ; } @@ -910,7 +904,7 @@ void phys_main_collision_below(void) { return; } - if (playerStatus->flags & (PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING)) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_AIRBORNE) { return; } @@ -922,13 +916,14 @@ void phys_main_collision_below(void) { (phys_adjust_cam_on_landing(), !phys_should_player_be_sliding()) || (set_action_state(ACTION_STATE_SLIDING), (playerStatus->actionState != ACTION_STATE_SLIDING)))) { - if (result >= 0) { - switch (get_collider_type_by_id(result) & 0xFF) { - case 2: + if (colliderID >= 0) { + s32 surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + switch (surfaceType) { + case SURFACE_TYPE_SPIKES: if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) { if (playerStatus->blinkTimer == 0) { if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) { - playerStatus->unk_BF = 2; + playerStatus->hazardType = HAZARD_TYPE_SPIKES; set_action_state(ACTION_STATE_HIT_LAVA); } } else { @@ -936,11 +931,11 @@ void phys_main_collision_below(void) { } } break; - case 3: + case SURFACE_TYPE_LAVA: if (partnerActionStatus->partnerActionState == PARTNER_ACTION_NONE || partnerActionStatus->actingPartner != PARTNER_BOW) { if (playerStatus->blinkTimer == 0) { if (playerStatus->actionState != ACTION_STATE_HIT_LAVA) { - playerStatus->unk_BF = 1; + playerStatus->hazardType = HAZARD_TYPE_LAVA; set_action_state(ACTION_STATE_HIT_LAVA); } } else { @@ -1000,7 +995,7 @@ void collision_lava_reset_check_additional_overlaps(void) { f32 x, y, z; f32 temp_f0; - if (playerStatus->animFlags & 0x1000) { + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { func_800E4F10(); return; } @@ -1098,7 +1093,7 @@ void check_input_midair_jump(void) { gPlayerStatus.flags |= 8; break; case 2: - set_action_state(ACTION_STATE_ULTRA_JUMP); + set_action_state(ACTION_STATE_TORNADO_JUMP); gPlayerStatus.flags |= 8; break; } @@ -1109,26 +1104,25 @@ s8 get_current_partner_id(void) { return gPlayerData.currentPartner; } -void try_player_footstep_sounds(s32 arg0) { - if (gGameStatusPtr->frameCounter % arg0 == 0) { - u8 colliderType = get_collider_type_by_id(gCollisionStatus.currentFloor); - s32 soundID; - s32 soundID2; +void try_player_footstep_sounds(s32 interval) { + if (gGameStatusPtr->frameCounter % interval == 0) { + s32 surfaceType = get_collider_flags(gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + s32 soundID, altSoundID; - if (colliderType == 6 || colliderType == 9) { - soundID = SOUND_143; - soundID2 = SOUND_144; + if (surfaceType == SURFACE_TYPE_FLOWERS || surfaceType == SURFACE_TYPE_HEDGES) { + soundID = SOUND_STEP_CRUNCHY1; + altSoundID = SOUND_STEP_CRUNCHY2; } else { - soundID = SOUND_STEP1; - soundID2 = SOUND_STEP2; + soundID = SOUND_STEP_NORMAL1; + altSoundID = SOUND_STEP_NORMAL2; } - if (D_800F7B80 == 0) { - soundID = soundID2; + if (FootstepSoundSelector == 0) { + soundID = altSoundID; } sfx_play_sound_at_player(soundID, 0); - D_800F7B80 ^= 1; + FootstepSoundSelector ^= 1; } } @@ -1186,16 +1180,16 @@ s32 phys_can_player_interact(void) { } f32 func_800E5348(void) { - f32 temp_f0 = get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, gPlayerStatus.currentYaw); + f32 deltaYaw = get_clamped_angle_diff(gCameras[gCurrentCameraID].currentYaw, gPlayerStatus.currentYaw); - if (temp_f0 < -5.0f && temp_f0 > -175.0f) { - temp_f0 = 0.0f; - } else if (temp_f0 > 5.0f && temp_f0 < 175.0f) { - temp_f0 = 180.0f; + if (deltaYaw < -5.0f && deltaYaw > -175.0f) { + deltaYaw = 0.0f; + } else if (deltaYaw > 5.0f && deltaYaw < 175.0f) { + deltaYaw = 180.0f; } else { - temp_f0 = D_800F7B40; + deltaYaw = PrevPlayerCamRelativeYaw; } - return clamp_angle(temp_f0 - 90.0f + gCameras[gCurrentCameraID].currentYaw); + return clamp_angle(deltaYaw - 90.0f + gCameras[gCurrentCameraID].currentYaw); } f32 player_get_camera_facing_angle(void) { diff --git a/src/891b0_len_fb0.c b/src/891b0_len_fb0.c index 9bb2281ee5..d47b522083 100644 --- a/src/891b0_len_fb0.c +++ b/src/891b0_len_fb0.c @@ -29,7 +29,7 @@ void func_800EFD08(void) { colliderType = D_80109480; } - D_80109480 = get_collider_type_by_id((u16)gCollisionStatus.currentFloor) & 0xFF; + D_80109480 = get_collider_flags((u16)gCollisionStatus.currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; if (playerStatus->actionState != ACTION_STATE_JUMP) { colliderType = D_80109480; @@ -42,19 +42,19 @@ void func_800EFD08(void) { D_8010CFF0 = playerStatus->timeInAir; switch (colliderType) { - case 6: + case SURFACE_TYPE_FLOWERS: func_800F0248(); break; - case 7: + case SURFACE_TYPE_CLOUD: func_800F0490(); break; - case 8: + case SURFACE_TYPE_SNOW: func_800F0864(); break; - case 9: + case SURFACE_TYPE_HEDGES: func_800F09EC(); break; - case 1: + case SURFACE_TYPE_WATER: func_800F0B3C(); break; default: @@ -89,7 +89,7 @@ void func_800F0248(void) { if ( playerStatus->actionState != ACTION_STATE_WALK && playerStatus->actionState != ACTION_STATE_RUN && - (playerStatus->actionState != ACTION_STATE_SPIN || playerStatus->fallState != 0) + !(playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->actionSubstate == 0) ) { D_80109490 = 0; return; @@ -128,7 +128,7 @@ void func_800F0864(void) { if ( ( playerStatus->actionState != ACTION_STATE_WALK && playerStatus->actionState != ACTION_STATE_RUN && - (playerStatus->actionState != ACTION_STATE_SPIN || playerStatus->fallState != 0) && + !(playerStatus->actionState == ACTION_STATE_SPIN && playerStatus->actionSubstate == 0) && playerStatus->actionState != ACTION_STATE_LAND && playerStatus->actionState != ACTION_STATE_IDLE ) || playerStatus->flags >= 0 ) { diff --git a/src/C50A0.c b/src/C50A0.c index 97e2dcfb09..83e8fac9c1 100644 --- a/src/C50A0.c +++ b/src/C50A0.c @@ -1854,7 +1854,7 @@ void update_item_entity_temp(ItemEntity* itemEntity) { actionState != ACTION_STATE_LAUNCH && actionState != ACTION_STATE_RIDE && actionState != ACTION_STATE_IDLE && - (actionState != ACTION_STATE_USE_SPINNING_FLOWER || playerStatus->fallState != 1) + !(actionState == ACTION_STATE_USE_SPINNING_FLOWER && playerStatus->actionSubstate == 1) ) { break; } @@ -1874,7 +1874,7 @@ void update_item_entity_temp(ItemEntity* itemEntity) { } } D_801568E0 = hud_element_create(gItemHudScripts[gItemTable[itemEntity->itemID].hudElemID].enabled); - hud_element_set_flags(D_801568E0, 0x80); + hud_element_set_flags(D_801568E0, HUD_ELEMENT_FLAGS_80); hud_element_set_render_pos(D_801568E0, -100, -100); itemEntity->state = 2; @@ -1942,9 +1942,9 @@ void update_item_entity_temp(ItemEntity* itemEntity) { playerData->hammerLevel = itemEntity->itemID - 4; } - if (itemEntity->itemID == ITEM_JUMP || - itemEntity->itemID == ITEM_SPIN_JUMP || - itemEntity->itemID == ITEM_TORNADO_JUMP) + if (itemEntity->itemID == ITEM_BOOTS || + itemEntity->itemID == ITEM_SUPER_BOOTS || + itemEntity->itemID == ITEM_ULTRA_BOOTS) { playerData->bootsLevel = itemEntity->itemID - 1; } @@ -1975,7 +1975,7 @@ block_47: // TODO required to match itemEntity->position.x = playerStatus->position.x; itemEntity->position.y = playerStatus->position.y + playerStatus->colliderHeight; itemEntity->position.z = playerStatus->position.z; - suggest_player_anim_setUnkFlag(0x6000C); + suggest_player_anim_setUnkFlag(ANIM_Mario_6000C); } if (gItemTable[itemEntity->itemID].typeFlags & ITEM_TYPE_FLAG_GEAR) { @@ -1998,7 +1998,7 @@ block_47: // TODO required to match (itemEntity->flags & ITEM_ENTITY_FLAGS_4000000) || (itemEntity->pickupMsgFlags & 2)) { - suggest_player_anim_setUnkFlag(0x6000C); + suggest_player_anim_setUnkFlag(ANIM_Mario_6000C); } } @@ -2170,7 +2170,7 @@ block_47: // TODO required to match sort_items(); add_item(itemEntity->itemID); } - suggest_player_anim_setUnkFlag(0x6000C); + suggest_player_anim_setUnkFlag(ANIM_Mario_6000C); func_801363A0(itemEntity); set_window_update(0xC, (s32) basic_window_update); D_801568E4 = 50; @@ -2192,7 +2192,7 @@ block_47: // TODO required to match } break; case 15: - suggest_player_anim_setUnkFlag(0x10002); + suggest_player_anim_setUnkFlag(ANIM_Mario_10002); set_time_freeze_mode(TIME_FREEZE_NORMAL); enable_player_input(); partner_enable_input(); diff --git a/src/EC2240.c b/src/EC2240.c index 27588eaecf..8ab02e5fac 100644 --- a/src/EC2240.c +++ b/src/EC2240.c @@ -55,18 +55,18 @@ ApiStatus func_80240158_EC2358(Evt* script, s32 isInitialCall) { osSyncPrintf("cccc\n"); } } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN]; npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14); npc_move_heading(npc, 2.0f, npc->yaw); } else if (temp_f4 > 0.2) { npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14); npc->pos.x = sp10; npc->pos.z = sp14; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; } else { npc->pos.x = sp10; npc->pos.z = sp14; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } return ApiStatus_BLOCK; } diff --git a/src/EEFAA0.c b/src/EEFAA0.c index 6582efff9d..e269fc046f 100644 --- a/src/EEFAA0.c +++ b/src/EEFAA0.c @@ -9,9 +9,9 @@ ApiStatus func_802429A0_EEFAA0(Evt* script, s32 isInitialCall) { script->varTable[0] = 0; do {} while (0); - if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND) { + if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND) { script->varTable[0] = 1; - } else if (gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) { + } else if (gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) { script->varTable[0] = 1; } return ApiStatus_DONE2; diff --git a/src/bss2.c b/src/bss2.c index 97d50040c3..ec23f51f2f 100644 --- a/src/bss2.c +++ b/src/bss2.c @@ -23,8 +23,8 @@ BSS s32 D_8010C94C; BSS s32 D_8010C950; BSS s32 TweesterTouchingPartner; BSS s32 D_8010C958; -BSS s32 D_8010C95C; -BSS s32 D_8010C960; +BSS s32 PrevPlayerDirection; +BSS s32 JumpedOnSwitchX; BSS s32 D_8010C964; BSS s32 D_8010C968; BSS s32 D_8010C96C; @@ -32,7 +32,7 @@ BSS s32 D_8010C970; BSS s32 D_8010C974; BSS s16 D_8010C978; BSS s16 D_8010C97A; -BSS s32 D_8010C97C; +BSS s32 JumpedOnSwitchZ; BSS s32 D_8010C980; BSS s32 D_8010C984; BSS char D_8010C988[0x4]; diff --git a/src/collision.c b/src/collision.c index e84ffa5b36..b3ed41a837 100644 --- a/src/collision.c +++ b/src/collision.c @@ -284,7 +284,7 @@ void load_hit_data(s32 idx, HitFile* hit) { e21_y = triangle->e21.y; e21_z = triangle->e21.z; - // vector product + // cross product normalX = e13_y * e21_z - e13_z * e21_y; normalY = e13_z * e21_x - e13_x * e21_z; normalZ = e13_x * e21_y - e13_y * e21_x; @@ -465,7 +465,7 @@ void update_collider_transform(s16 colliderID) { } } -s32 get_collider_type_by_id(s32 colliderID) { +s32 get_collider_flags(s32 colliderID) { if (colliderID & COLLISION_WITH_ENTITY_BIT) { return 0; } else { diff --git a/src/effects/peach_star_beam.c b/src/effects/peach_star_beam.c index a9876587b5..7d0039d241 100644 --- a/src/effects/peach_star_beam.c +++ b/src/effects/peach_star_beam.c @@ -189,7 +189,7 @@ void peach_star_beam_appendGfx(void* effect) { } if (!(data->pos.z < partZ)) { - shim_guPositionF(sp20, 0.0f, 0.0f, 0.0f, SPRITE_WORLD_SCALE, partX, partY, partZ); + shim_guPositionF(sp20, 0.0f, 0.0f, 0.0f, SPRITE_WORLD_SCALE_F, partX, partY, partZ); shim_guMtxF2L(sp20, &gDisplayContext->matrixStack[gMatrixListPos]); gSPMatrix(gMasterGfxPos++, &gDisplayContext->matrixStack[gMatrixListPos++], diff --git a/src/effects/throw_spiny.c b/src/effects/throw_spiny.c index 3732010b3e..b611832376 100644 --- a/src/effects/throw_spiny.c +++ b/src/effects/throw_spiny.c @@ -163,7 +163,7 @@ void throw_spiny_appendGfx(void* effect) { ThrowSpinyFXData* data = ((EffectInstance*)effect)->data.throwSpiny; s32 temp_s5 = data->rgba; s32 temp_s6 = data->unk_00; - f32 scale = data->unk_40 * SPRITE_PIXEL_SCALE; + f32 scale = data->unk_40 * SPRITE_WORLD_SCALE_D; gDPPipeSync(gMasterGfxPos++); gSPSegment(gMasterGfxPos++, 0x09, VIRTUAL_TO_PHYSICAL(((EffectInstance*)effect)->graphics->data)); diff --git a/src/encounter_api.c b/src/encounter_api.c index 10dbd225e2..7cbf744bcb 100644 --- a/src/encounter_api.c +++ b/src/encounter_api.c @@ -169,7 +169,7 @@ ApiStatus DoNpcDefeat(Evt* script, s32 isInitialCall) { Evt* newScript; kill_script(script); - npc->currentAnim.w = owner->animList[6]; + npc->currentAnim = owner->animList[6]; newScript = start_script(&SCRIPT_NpcDefeat, EVT_PRIORITY_A, 0); owner->defeatScript = newScript; owner->defeatScriptID = newScript->id; @@ -812,7 +812,7 @@ ApiStatus func_80045900(Evt* script, s32 isInitialCall) { s32 unk; if (!(enemy->aiFlags & ENEMY_AI_FLAGS_10)) { - npc->currentAnim.w = *enemy->animList; + npc->currentAnim = *enemy->animList; } if (!(enemy->aiFlags & ENEMY_AI_FLAGS_8)) { diff --git a/src/entity/Block.c b/src/entity/Block.c index 45264fc0bd..314d5bd020 100644 --- a/src/entity/Block.c +++ b/src/entity/Block.c @@ -343,11 +343,11 @@ s32 entity_block_handle_collision(Entity* entity) { breakBlock = FALSE; if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - if (playerStatus->actionState == ACTION_STATE_SPIN_JUMP || playerStatus->actionState == ACTION_STATE_ULTRA_JUMP) { + if (playerStatus->actionState == ACTION_STATE_SPIN_JUMP || playerStatus->actionState == ACTION_STATE_TORNADO_JUMP) { return FALSE; } - if (playerStatus->actionState == ACTION_STATE_GROUND_POUND || playerStatus->actionState == ACTION_STATE_ULTRA_POUND) { + if (playerStatus->actionState == ACTION_STATE_SPIN_POUND || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) { breakBlock = TRUE; } else { return TRUE; diff --git a/src/entity/Chest.c b/src/entity/Chest.c index 8ac53eb3ee..9a0077a745 100644 --- a/src/entity/Chest.c +++ b/src/entity/Chest.c @@ -330,7 +330,7 @@ void entity_GiantChest_open(Entity* entity) { chest->giveItemHeightInterpPhase = 180.0f; chest->state++; if (chest->itemID != 0) { - suggest_player_anim_setUnkFlag(0x6000C); + suggest_player_anim_setUnkFlag(ANIM_Mario_6000C); sin_cos_rad((90.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinRight, &cosRight); sin_cos_rad((180.0f - gCameras[CAM_DEFAULT].currentYaw) * TAU / 360.0f, &sinFwd, &cosFwd); horizontalOffset = 0.0f; @@ -360,13 +360,13 @@ void entity_GiantChest_give_equipment(Entity* entity) { s32 flagIndex; switch (data->itemID) { - case ITEM_JUMP: + case ITEM_BOOTS: gPlayerData.bootsLevel = 0; break; - case ITEM_SPIN_JUMP: + case ITEM_SUPER_BOOTS: gPlayerData.bootsLevel = 1; break; - case ITEM_TORNADO_JUMP: + case ITEM_ULTRA_BOOTS: gPlayerData.bootsLevel = 2; break; case ITEM_HAMMER: @@ -412,7 +412,7 @@ void entity_GiantChest_await_got_item(Entity* entity) { if (data->unk_30 != 0) { exec_entity_commandlist(entity); remove_item_entity_by_index(data->itemEntityIndex); - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); enable_player_input(); data->itemID = -1; } diff --git a/src/entity/Switch.c b/src/entity/Switch.c index 8fa5cd5c2f..8f0a1b7b1c 100644 --- a/src/entity/Switch.c +++ b/src/entity/Switch.c @@ -15,8 +15,8 @@ void entity_GreenStompSwitch_idle(Entity* entity) { SwitchData* data = entity->dataBuf.swtch; if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND) - || (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND) + || (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) { exec_entity_commandlist(entity); data->greenMotionTimer = 8; } @@ -75,8 +75,8 @@ void entity_HugeBlueSwitch_idle(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND) - || (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND) + || (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) { exec_entity_commandlist(entity); } } diff --git a/src/entity/WoodenCrate.c b/src/entity/WoodenCrate.c index 0bbc2aa89e..c41a48525f 100644 --- a/src/entity/WoodenCrate.c +++ b/src/entity/WoodenCrate.c @@ -220,8 +220,8 @@ s32 entity_WoodenCrate_idle(Entity* entity) { s32 shouldBreak = FALSE; if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - if ((playerStatus->actionState == ACTION_STATE_GROUND_POUND) - || (playerStatus->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((playerStatus->actionState == ACTION_STATE_SPIN_POUND) + || (playerStatus->actionState == ACTION_STATE_TORNADO_POUND)) { set_action_state(ACTION_STATE_FALLING); shouldBreak = TRUE; } diff --git a/src/entity/default/BoardedFloor.c b/src/entity/default/BoardedFloor.c index 40e90c108a..c62882ff20 100644 --- a/src/entity/default/BoardedFloor.c +++ b/src/entity/default/BoardedFloor.c @@ -207,8 +207,8 @@ void Entity_BoardedFloor_idle(Entity* entity) { PlayerStatus* playerStatus = &gPlayerStatus; if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { - if (playerStatus->actionState == ACTION_STATE_GROUND_POUND - || playerStatus->actionState == ACTION_STATE_ULTRA_POUND) { + if (playerStatus->actionState == ACTION_STATE_SPIN_POUND + || playerStatus->actionState == ACTION_STATE_TORNADO_POUND) { entity_start_script(entity); exec_entity_commandlist(entity); } diff --git a/src/entity/default/Padlock.c b/src/entity/default/Padlock.c index c611b519d3..3c12d99263 100644 --- a/src/entity/default/Padlock.c +++ b/src/entity/default/Padlock.c @@ -60,7 +60,7 @@ void entity_Padlock_push_player(Entity* entity) { if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) { if (data->pushSpeed == 0.0f) { - suggest_player_anim_clearUnkFlag(0x10005); + suggest_player_anim_clearUnkFlag(ANIM_Mario_Running); } data->pushSpeed += 0.5; diff --git a/src/entity/jan_iwa/Plants2.c b/src/entity/jan_iwa/Plants2.c index fa1953b424..aee98dde24 100644 --- a/src/entity/jan_iwa/Plants2.c +++ b/src/entity/jan_iwa/Plants2.c @@ -148,7 +148,7 @@ void func_802BC2B4_E2EBE4(Entity* entity) { gPlayerStatus.prevActionState = 0; gPlayerStatus.actionState = 0; gPlayerStatus.flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - suggest_player_anim_setUnkFlag(0x8001F); + suggest_player_anim_setUnkFlag(ANIM_Mario_8001F); } void func_802BC308_E2EC38(Entity* entity) { diff --git a/src/entity/sbk_omo/StarBoxLauncher.c b/src/entity/sbk_omo/StarBoxLauncher.c index 7384848695..aef9de905b 100644 --- a/src/entity/sbk_omo/StarBoxLauncher.c +++ b/src/entity/sbk_omo/StarBoxLauncher.c @@ -79,7 +79,7 @@ void entity_StarBoxLauncher_check_launch(Entity* entity) { result = get_entity_type(D_8010C978) == ENTITY_TYPE_STAR_BOX_LAUCHER; } } - } else if ((entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (actionState == ACTION_STATE_GROUND_POUND || actionState == ACTION_STATE_ULTRA_POUND)) { + } else if ((entity->collisionFlags & ENTITY_COLLISION_PLAYER_TOUCH_FLOOR) && (actionState == ACTION_STATE_SPIN_POUND || actionState == ACTION_STATE_TORNADO_POUND)) { result = 1; } else if (entity->collisionFlags & ENTITY_COLLISION_PLAYER_HAMMER) { result = -1; diff --git a/src/evt/fa4c0_len_3bf0.c b/src/evt/fa4c0_len_3bf0.c index 5ebfc3f0e2..5c2e8e9b41 100644 --- a/src/evt/fa4c0_len_3bf0.c +++ b/src/evt/fa4c0_len_3bf0.c @@ -37,7 +37,7 @@ static s32 PollMusicEvents(Evt* script, s32 isInitialCall) { } cur++; } - // bug? can cur ever be NULL here? + // @bug? can cur ever be NULL here? // condition should probably be if (cur->musicEventID != -1) if (cur != NULL) { EvtScript* newSource = cur->scripts[scriptSelector]; diff --git a/src/evt/msg_api.c b/src/evt/msg_api.c index 7857c7d36e..5536b544fd 100644 --- a/src/evt/msg_api.c +++ b/src/evt/msg_api.c @@ -84,7 +84,7 @@ s32 _show_message(Evt* script, s32 isInitialCall, s32 arg2) { npc = resolve_npc(script, temp_fp); get_screen_coords(gCurrentCameraID, npc->pos.x, npc->pos.y + npc->collisionHeight, npc->pos.z, &screenX, &screenY, &screenZ); - script->functionTemp[3] = npc->currentAnim.w; + script->functionTemp[3] = npc->currentAnim; script->varTable[15] = npc->yaw; } diff --git a/src/evt/npc_api.c b/src/evt/npc_api.c index 8e8d073f00..0313900ee1 100644 --- a/src/evt/npc_api.c +++ b/src/evt/npc_api.c @@ -18,11 +18,11 @@ void set_npc_animation(Npc* npc, u32 animID) { PlayerData* playerData = &gPlayerData; if (animID - PARTNER_ANIM_WALK < 9) { - npc->currentAnim.w = gPartnerAnimations[playerData->currentPartner].anims[animID - PARTNER_ANIM_WALK]; + npc->currentAnim = gPartnerAnimations[playerData->currentPartner].anims[animID - PARTNER_ANIM_WALK]; } else if ((animID - 0x201) < 0x10) { - npc->currentAnim.w = get_enemy(npc->npcID)->animList[animID - 0x201]; + npc->currentAnim = get_enemy(npc->npcID)->animList[animID - 0x201]; } else { - npc->currentAnim.w = animID; + npc->currentAnim = animID; } } @@ -207,7 +207,7 @@ ApiStatus GetNpcAnimation(Evt* script, s32 isInitialCall) { return ApiStatus_DONE2; } - evt_set_variable(script, outVar, npc->currentAnim.w); + evt_set_variable(script, outVar, npc->currentAnim); return ApiStatus_DONE2; } @@ -840,7 +840,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) { } npc->jumpVelocity = ((playerY - targetY) + (npc->jumpScale * npc->duration * npc->duration * 0.5f)) / npc->duration; - npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK]; + npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK]; return ApiStatus_BLOCK; } @@ -848,7 +848,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) { npc->jumpVelocity -= npc->jumpScale; npc->pos.y += npc->jumpVelocity; if (npc->jumpVelocity <= 0.0f) { - npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP]; + npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP]; } npc_move_heading(npc, npc->moveSpeed, npc->yaw); duration = npc->duration; @@ -861,7 +861,7 @@ s32 BringPartnerOut(Evt *script, s32 isInitialCall) { npc->duration--; if (npc->duration < 0) { - npc->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_IDLE]; + npc->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_IDLE]; npc->jumpVelocity = 0.0f; npc->pos.y = npc->moveToPos.y; npc->scale.x = 1.0f; @@ -910,7 +910,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { partnerY = targetY - partnerY; partner->jumpVelocity = (partnerY + (partner->jumpScale * partner->duration * partner->duration * 0.5f)) / partner->duration; - partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK]; + partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_WALK]; return ApiStatus_BLOCK; } else { return ApiStatus_DONE2; @@ -920,7 +920,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { partner->jumpVelocity -= partner->jumpScale; partner->pos.y += partner->jumpVelocity; if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP]; + partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_JUMP]; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); @@ -935,7 +935,7 @@ ApiStatus PutPartnerAway(Evt* script, s32 isInitialCall) { partner->duration--; if (partner->duration < 0) { - partner->currentAnim.w = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_FALL]; + partner->currentAnim = gPartnerAnimations[wExtraPartnerID].anims[PARTNER_ANIM_INDEX_FALL]; partner->jumpVelocity = 0.0f; partner->pos.y = partner->moveToPos.y; free_npc_by_index(wExtraPartnerNpcID); diff --git a/src/evt/player_api.c b/src/evt/player_api.c index 178222da20..c7eeb7d9b6 100644 --- a/src/evt/player_api.c +++ b/src/evt/player_api.c @@ -82,7 +82,7 @@ ApiStatus SetPlayerCollisionSize(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; Bytecode* args = script->ptrReadPos; s32 height = evt_get_variable(script, *args++); - s32 radius = evt_get_variable(script, *args); + s32 radius = evt_get_variable(script, *args++); playerNpc->collisionHeight = height; playerNpc->collisionRadius = radius; @@ -94,27 +94,26 @@ ApiStatus SetPlayerCollisionSize(Evt* script, s32 isInitialCall) { } ApiStatus SetPlayerSpeed(Evt* script, s32 isInitialCall) { - playerNpc->moveSpeed = evt_get_float_variable(script, *script->ptrReadPos); + Bytecode* args = script->ptrReadPos; + + playerNpc->moveSpeed = evt_get_float_variable(script, *args++); return ApiStatus_DONE2; } ApiStatus SetPlayerJumpscale(Evt* script, s32 isInitialCall) { - playerNpc->jumpScale = evt_get_float_variable(script, *script->ptrReadPos); + Bytecode* args = script->ptrReadPos; + + playerNpc->jumpScale = evt_get_float_variable(script, *args++); return ApiStatus_DONE2; } ApiStatus SetPlayerAnimation(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - s32 currentAnim = evt_get_variable(script, *args++); - s32 shakeAnim = 0x80003; + AnimID anim = evt_get_variable(script, *args++); - playerNpc->currentAnim.w = currentAnim; + gPlayerStatus.anim = playerNpc->currentAnim = anim; - do { } while (0); // Needed to match for some reason - - gPlayerStatus.anim = playerNpc->currentAnim.w; - - if (gPlayerStatus.anim == shakeAnim) { + if (gPlayerStatus.anim == ANIM_Mario_80003) { exec_ShakeCam1(0, 0, 2); } @@ -122,12 +121,16 @@ ApiStatus SetPlayerAnimation(Evt* script, s32 isInitialCall) { } ApiStatus SetPlayerActionState(Evt* script, s32 isInitialCall) { - set_action_state(evt_get_variable(script, *script->ptrReadPos)); + Bytecode* args = script->ptrReadPos; + + set_action_state(evt_get_variable(script, *args++)); return ApiStatus_DONE2; } ApiStatus SetPlayerAnimationSpeed(Evt* script, s32 isInitialCall) { - playerNpc->animationSpeed = evt_get_float_variable(script, *script->ptrReadPos); + Bytecode* args = script->ptrReadPos; + + playerNpc->animationSpeed = evt_get_float_variable(script, *args++); return ApiStatus_DONE2; } @@ -216,7 +219,7 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { f32 zTemp; f32 jumpVelocity; s32 duration; - s32 animID; + AnimID anim; f32 dist; if (isInitialCall) { @@ -252,20 +255,20 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { } playerNpc->jumpVelocity = (playerNpc->jumpScale * (playerNpc->duration - 1) / 2) + (yTemp / playerNpc->duration); - playerStatus->flags |= 8; - playerStatus->animFlags |= 0x10000000; + playerStatus->flags |= PLAYER_STATUS_FLAGS_FLYING; + playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_10000000; if (mode == 0) { - if (!(playerStatus->animFlags & 0x4000)) { - if (!(playerStatus->animFlags & 1)) { - animID = 0x10007; + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { + anim = ANIM_Mario_AnimMidairStill; } else { - animID = 0x60009; + anim = ANIM_Mario_60009; } } else { - animID = 0x90005; + anim = ANIM_Mario_90005; } - suggest_player_anim_clearUnkFlag(animID); + suggest_player_anim_clearUnkFlag(anim); sfx_play_sound_at_player(SOUND_JUMP_2081, 0); } script->functionTemp[0] = 1; @@ -277,16 +280,16 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { playerNpc->jumpVelocity -= playerNpc->jumpScale; if (mode == 0 && jumpVelocity > 0.0f && playerNpc->jumpVelocity <= 0.0f) { - if (!(playerStatus->animFlags & 0x4000)) { - if (!(playerStatus->animFlags & 1)) { - animID = 0x10008; + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { + anim = ANIM_Mario_AnimMidair; } else { - animID = 0x6000A; + anim = ANIM_Mario_6000A; } } else { - animID = 0x90005; + anim = ANIM_Mario_90005; } - suggest_player_anim_clearUnkFlag(animID); + suggest_player_anim_clearUnkFlag(anim); } playerStatus->position.x = playerNpc->pos.x; @@ -299,20 +302,20 @@ s32 player_jump(Evt* script, s32 isInitialCall, s32 mode) { playerNpc->duration--; if (playerNpc->duration == 0) { - playerStatus->flags &= -9; - playerStatus->animFlags &= ~0x10000000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; + playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_10000000; if (mode == 0) { - if (!(playerStatus->animFlags & 0x4000)) { - if (!(playerStatus->animFlags & 1)) { - animID = 0x10009; + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { + anim = ANIM_Mario_10009; } else { - animID = 0x6000B; + anim = ANIM_Mario_6000B; } } else { - animID = 0x10003; + anim = ANIM_Mario_AnimPanting; } - suggest_player_anim_clearUnkFlag(animID); + suggest_player_anim_clearUnkFlag(anim); func_8003D660(playerNpc, 2); } @@ -581,8 +584,8 @@ ApiStatus UseExitHeading(Evt* script, s32 isInitialCall) { s32 func_802D23F8(void) { if (gPlayerStatus.actionState == ACTION_STATE_IDLE || gPlayerStatus.actionState == ACTION_STATE_WALK || gPlayerStatus.actionState == ACTION_STATE_RUN || gPlayerStatus.actionState == ACTION_STATE_LAND || - gPlayerStatus.actionState == ACTION_STATE_STEP_DOWN_LAND || gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND || - gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND || gPlayerStatus.actionState == ACTION_STATE_SPIN) { + gPlayerStatus.actionState == ACTION_STATE_STEP_DOWN_LAND || gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND || + gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND || gPlayerStatus.actionState == ACTION_STATE_SPIN) { return TRUE; } return FALSE; diff --git a/src/npc.c b/src/npc.c index 6117c60d38..ea8ebe2dcf 100644 --- a/src/npc.c +++ b/src/npc.c @@ -66,7 +66,7 @@ void npc_iter_no_op(void) { } } -s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) { +s32 _create_npc(NpcBlueprint* blueprint, AnimID** animList, s32 skipLoadingAnims) { Npc* npc; s32 i; s32 j; @@ -115,7 +115,7 @@ s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) { npc->scale.x = 1.0f; npc->scale.y = 1.0f; npc->scale.z = 1.0f; - npc->currentAnim.w = blueprint->initialAnim; + npc->currentAnim = blueprint->initialAnim; npc->animationSpeed = 1.0f; npc->renderYaw = 0.0f; npc->unk_98 = 0; @@ -150,9 +150,9 @@ s32 _create_npc(NpcBlueprint* blueprint, u32** animList, s32 skipLoadingAnims) { npc->extraAnimList = animList; if (!(npc->flags & NPC_FLAG_1000000)) { if (!(npc->flags & NPC_FLAG_PARTICLE)) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, animList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, animList); } else { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w | 0x80000000, animList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, animList); } } else { npc->flags |= NPC_FLAG_2; @@ -172,7 +172,7 @@ s32 _create_npc_basic(NpcBlueprint* blueprint) { return _create_npc(blueprint, NULL, FALSE); } -s32 _create_npc_standard(NpcBlueprint* blueprint, u32** animList) { +s32 _create_npc_standard(NpcBlueprint* blueprint, AnimID** animList) { return _create_npc(blueprint, animList, FALSE); } @@ -552,14 +552,14 @@ void update_npcs(void) { if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_1000000)) { - if (npc->currentAnim.w != 0) { + if (npc->currentAnim != 0) { if (npc->spriteInstanceID >= 0) { - spr_update_sprite(npc->spriteInstanceID, npc->currentAnim.w, npc->animationSpeed); + spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed); } } } } else { - spr_update_player_sprite(1, npc->currentAnim.w, npc->animationSpeed); + spr_update_player_sprite(1, npc->currentAnim, npc->animationSpeed); } if (npc->flags & NPC_FLAG_HAS_SHADOW) { @@ -617,9 +617,9 @@ void update_npcs(void) { if (npc->spriteInstanceID < 0) { npc->spriteInstanceID++; if (npc->spriteInstanceID == -1) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList); ASSERT(npc->spriteInstanceID >= 0); - spr_update_sprite(npc->spriteInstanceID, npc->currentAnim.w, npc->animationSpeed); + spr_update_sprite(npc->spriteInstanceID, npc->currentAnim, npc->animationSpeed); } } } @@ -734,15 +734,15 @@ void appendGfx_npc(Npc* npc) { guMtxCatF(mtx2, mtx1, mtx1); } - if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f) - || (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f)) { - guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE, (npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE, - npc->scale.z * SPRITE_PIXEL_SCALE); + if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f) + || (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f)) { + guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D, (npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D, + npc->scale.z * SPRITE_WORLD_SCALE_D); guMtxCatF(mtx2, mtx1, mtx1); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0) && (npc->spriteInstanceID >= 0)) { + if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0) && (npc->spriteInstanceID >= 0)) { npc_draw_with_palswap(npc, renderYaw, mtx1); npc->unk_2C = func_802DE5C8(npc->spriteInstanceID); } @@ -763,20 +763,20 @@ void appendGfx_npc(Npc* npc) { } - if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f) - || (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f)) + if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f) + || (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f)) { do { - guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE, - (npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE, - npc->scale.z * SPRITE_PIXEL_SCALE); + guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D, + (npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D, + npc->scale.z * SPRITE_WORLD_SCALE_D); } while (0); // required to match (macro?) guMtxCatF(mtx2, mtx1, mtx1); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0)) { + if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0)) { spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1); } } else { @@ -794,19 +794,19 @@ void appendGfx_npc(Npc* npc) { guMtxCatF(mtx2, mtx1, mtx1); } - if ((npc->scale.x * SPRITE_PIXEL_SCALE != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE != 1.0f) - || (npc->scale.z * SPRITE_PIXEL_SCALE != 1.0f)) + if ((npc->scale.x * SPRITE_WORLD_SCALE_D != 1.0f) || ((npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D != 1.0f) + || (npc->scale.z * SPRITE_WORLD_SCALE_D != 1.0f)) { do { - guScaleF(mtx2, npc->scale.x * SPRITE_PIXEL_SCALE, - (npc->scale.y * npc->verticalStretch) * SPRITE_PIXEL_SCALE, - npc->scale.z * SPRITE_PIXEL_SCALE); + guScaleF(mtx2, npc->scale.x * SPRITE_WORLD_SCALE_D, + (npc->scale.y * npc->verticalStretch) * SPRITE_WORLD_SCALE_D, + npc->scale.z * SPRITE_WORLD_SCALE_D); } while (0); // required to match (macro?) guMtxCatF(mtx2, mtx1, mtx1); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { - if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim.w != 0)) { + if (!(npc->flags & NPC_FLAG_1000000) && (npc->currentAnim != 0)) { spr_draw_npc_sprite(npc->spriteInstanceID, renderYaw, 0, 0, mtx1); } } else { @@ -945,7 +945,7 @@ void set_npc_sprite(Npc* npc, s32 anim, u32** extraAnimList) { ASSERT(npc->spriteInstanceID >= 0); } - npc->currentAnim.w = anim; + npc->currentAnim = anim; if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_1000000)) { @@ -1023,19 +1023,19 @@ void npc_reload_all(void) { if (npc->flags && !(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_1000000)) { if (!(npc->flags & NPC_FLAG_PARTICLE)) { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim, npc->extraAnimList); } else { - npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim.w | 0x80000000, npc->extraAnimList); + npc->spriteInstanceID = spr_load_npc_sprite(npc->currentAnim | SPRITE_ID_TAIL_ALLOCATE, npc->extraAnimList); } } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_1000000) && (npc->palSwapType != 0)) { - npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim.h); + npc->spritePaletteList = spr_get_npc_palettes(npc->currentAnim >> 16); npc->paletteCount = 0; while (npc->spritePaletteList[npc->paletteCount] != -1) { npc->paletteCount++; } - npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim.h); + npc->unk_C0 = spr_get_npc_color_variations(npc->currentAnim >> 16); } if (!(npc->flags & NPC_FLAG_NO_ANIMS_LOADED)) { if (!(npc->flags & NPC_FLAG_1000000)) { @@ -1606,29 +1606,30 @@ void func_8003D660(Npc* npc, s32 arg1) { if ((npc->flags & (NPC_FLAG_400000 | NPC_FLAG_2)) == NPC_FLAG_400000) { if (npc->moveSpeed != 0.0f) { - switch (get_collider_type_by_id((u16)npc->currentFloor) & 0xFF) { - case 6: + s32 surfaceType = get_collider_flags((u16)npc->currentFloor) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + switch (surfaceType) { + case SURFACE_TYPE_FLOWERS: func_8003DA38(npc, arg1); return; - case 7: + case SURFACE_TYPE_CLOUD: func_8003DC38(npc, arg1); return; - case 8: + case SURFACE_TYPE_SNOW: if ((temp->partnerActionState == PARTNER_ACTION_NONE) || (temp->actingPartner != PARTNER_LAKILESTER)) { func_8003DFA0(npc, arg1); return; } break; - case 9: + case SURFACE_TYPE_HEDGES: func_8003E0D4(npc, arg1); return; - case 1: + case SURFACE_TYPE_WATER: func_8003E1D0(npc, arg1); return; - case 2: - case 3: - case 4: - case 5: + case SURFACE_TYPE_SPIKES: + case SURFACE_TYPE_LAVA: + case SURFACE_TYPE_DOCK_WALL: + case SURFACE_TYPE_SLIDE: default: func_8003D788(npc, arg1); return; diff --git a/src/sprite.h b/src/sprite.h index 332b5d10ad..7a9e7d898d 100644 --- a/src/sprite.h +++ b/src/sprite.h @@ -5,6 +5,14 @@ #define SPR_PLAYER_COLOR_VARIATIONS 6 +enum SpriteIDFields { + SPRITE_ID_ANIM_MASK = 0x000000FF, + SPRITE_ID_PAL_MASK = 0x0000FF00, + SPRITE_ID_SPR_MASK = 0x00FF0000, + SPRITE_ID_BACK_FACING = 0x01000000, + SPRITE_ID_TAIL_ALLOCATE = 0x80000000, +}; + typedef struct SpriteComponent { /* 0x00 */ s32 initialized; /* 0x04 */ s32 unk_04; @@ -111,7 +119,7 @@ void spr_render_init(void); void spr_update_player_raster_cache(void); -s32 spr_update_player_sprite(s32 arg0, s32 arg1, f32 arg2); +s32 spr_update_player_sprite(s32 arg0, s32 arg1, f32 timescale); s32 spr_draw_player_sprite(s32 spriteInstanceID, s32 yaw, s32 arg2, PAL_PTR* paletteList, Matrix4f mtx); diff --git a/src/world/action/hammer.c b/src/world/action/hammer.c index d2125c4e7c..eeb0b43425 100644 --- a/src/world/action/hammer.c +++ b/src/world/action/hammer.c @@ -1,5 +1,12 @@ #include "common.h" #include "effects.h" +#include "sprite.h" + +enum { + SUBSTATE_HAMMER_0 = 0, + SUBSTATE_HAMMER_1 = 1, + SUBSTATE_HAMMER_2 = 2 +}; typedef struct HammerHitData { /* 0x00 */ Vec3f hitPos; @@ -15,18 +22,18 @@ extern HammerHitData* HammerHit; void func_802B6820_E256F0(void); s32 action_hammer_is_swinging_away(s32 animID) { - if (animID & 0x1000000) { + if (animID & SPRITE_ID_BACK_FACING) { return TRUE; } - // away-facing swing anims + // back facing swing anims switch (animID) { - case 0x60011: - case 0x60013: - case 0x60015: - case 0x60017: - case 0x60019: - case 0x6001B: + case ANIM_Mario_60011: + case ANIM_Mario_60013: + case ANIM_Mario_60015: + case ANIM_Mario_60017: + case ANIM_Mario_60019: + case ANIM_Mario_6001B: return TRUE; } return FALSE; @@ -101,7 +108,7 @@ void action_hammer_play_hit_fx(s32 hitID) { } sfx_play_sound_at_player(soundID, 0); - start_rumble(0x100, 50); + start_rumble(256, 50); } s32 func_802B62A4_E25174(void) { @@ -115,6 +122,7 @@ s32 func_802B62A4_E25174(void) { s32 ret; s32 i; + // first attempt yaw = func_800E5348(); if (action_hammer_is_swinging_away(playerStatus->trueAnimation)) { angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); @@ -143,7 +151,8 @@ s32 func_802B62A4_E25174(void) { } } - if (i >= 0x10) { + // second attempt + if (i >= 16) { yaw = func_800E5348(); if (!action_hammer_is_swinging_away(playerStatus->trueAnimation)) { angle = clamp_angle(yaw + 90.0f - gCameras[gCurrentCameraID].currentYaw); @@ -213,47 +222,47 @@ s32 func_802B62A4_E25174(void) { return ret; } -void action_hammer_update(void) { +void action_update_hammer(void) { PlayerStatus* playerStatus = &gPlayerStatus; HammerHit->unk_1C = 0; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - s32 animID; + AnimID anim; s32 soundID; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; playerStatus->flags |= PLAYER_STATUS_FLAGS_200000; HammerHit->timer = 0; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_HAMMER_0; playerStatus->currentSpeed = 0.0f; playerStatus->unk_BC = 0; HammerHit->hitID = func_802B62A4_E25174(); if (gPlayerData.hammerLevel == 2) { soundID = SOUND_2117; - animID = 0x6001A; + anim = ANIM_Mario_6001A; if (HammerHit->hitID < 0) { soundID = SOUND_2117; - animID = 0x60018; + anim = ANIM_Mario_60018; } } else if (gPlayerData.hammerLevel == 1) { soundID = SOUND_2116; - animID = 0x60016; + anim = ANIM_Mario_60016; if (HammerHit->hitID < 0) { soundID = SOUND_2116; - animID = 0x60014; + anim = ANIM_Mario_60014; } } else { soundID = SOUND_2115; - animID = 0x60012; + anim = ANIM_Mario_60012; if (HammerHit->hitID < 0) { soundID = SOUND_2115; - animID = 0x60010; + anim = ANIM_Mario_60010; } } - suggest_player_anim_clearUnkFlag(animID); + suggest_player_anim_clearUnkFlag(anim); sfx_play_sound_at_player(soundID, 0); HammerHit->unk_0C = 0; HammerHit->unk_14 = 0; @@ -305,6 +314,7 @@ void func_802B6820_E256F0(void) { playerY = playerStatus->position.y; playerZ = playerStatus->position.z; + // check collision allong 16 points in a line away from the player for (i = 1; i < 16; i++) { x = playerX + (outSinTheta * i); y = playerY; @@ -382,13 +392,13 @@ void func_802B6820_E256F0(void) { } } - if (playerStatus->fallState == 0 && result >= 0 && HammerHit->unk_14 == 0) { - playerStatus->fallState++; + if (playerStatus->actionSubstate == SUBSTATE_HAMMER_0 && result >= 0 && HammerHit->unk_14 == 0) { + playerStatus->actionSubstate++; } - if (playerStatus->fallState == 1 && result < 0) { - playerStatus->fallState = 2; + if (playerStatus->actionSubstate == SUBSTATE_HAMMER_1 && result < 0) { + playerStatus->actionSubstate = SUBSTATE_HAMMER_2; } - HammerHit->timer += 1; + HammerHit->timer++; if (result >= 0) { HammerHit->unk_14 = 1; } diff --git a/src/world/action/hit_fire.c b/src/world/action/hit_fire.c index 4ab4b2f22b..d29fe72a22 100644 --- a/src/world/action/hit_fire.c +++ b/src/world/action/hit_fire.c @@ -1,58 +1,65 @@ #include "common.h" -extern f32 D_802B62B0; +enum { + SUBSTATE_FLYING = 0, + SUBSTATE_FALLING = 1 +}; -void func_802B6000_E27C90(void) { +void action_update_hit_fire(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 sinTheta; - f32 cosTheta; + f32 dx, dy; f32 speed; + static f32 ReturnAngle; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_4; playerStatus->flags |= (PLAYER_STATUS_FLAGS_800 | PLAYER_STATUS_FLAGS_FLYING); - suggest_player_anim_setUnkFlag(0x10019); - playerStatus->fallState = 0; + + suggest_player_anim_setUnkFlag(ANIM_Mario_Scared); + + playerStatus->actionSubstate = SUBSTATE_FLYING; playerStatus->gravityIntegrator[0] = 18.3473f; playerStatus->gravityIntegrator[1] = -3.738f; playerStatus->gravityIntegrator[2] = 0.8059f; playerStatus->gravityIntegrator[3] = -0.0987f; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; - D_802B62B0 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); + ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; subtract_hp(1); open_status_menu_long(); gOverrideFlags |= GLOBAL_OVERRIDES_40; } - sin_cos_rad(D_802B62B0 * TAU / 360.0f, &sinTheta, &cosTheta); + sin_cos_rad(ReturnAngle * TAU / 360.0f, &dx, &dy); speed = playerStatus->currentSpeed; - if (playerStatus->flags & 0x40000) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) { speed *= 0.5; } - playerStatus->position.x += speed * sinTheta; - playerStatus->position.z -= speed * cosTheta; + playerStatus->position.x += speed * dx; + playerStatus->position.z -= speed * dy; - if (playerStatus->fallState == 0) { + if (playerStatus->actionSubstate == SUBSTATE_FLYING) { integrate_gravity(); playerStatus->position.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] < 0.0f) { - playerStatus->fallState = 1; - playerStatus->flags |= 4; + playerStatus->actionSubstate = SUBSTATE_FALLING; + playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; } } else { - s32 collider; + s32 colliderID; - playerStatus->position.y = player_check_collision_below(func_800E34D8(), &collider); - if (collider >= 0) { - collider = get_collider_type_by_id(collider); + playerStatus->position.y = player_check_collision_below(func_800E34D8(), &colliderID); + if (colliderID >= 0) { + colliderID = get_collider_flags(colliderID); //TODO surfaceType set_action_state(ACTION_STATE_LAND); playerStatus->blinkTimer = 60; - playerStatus->unk_BF = 0; - playerStatus->flags &= ~0x800; + playerStatus->hazardType = HAZARD_TYPE_NONE; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800; gOverrideFlags &= ~GLOBAL_OVERRIDES_40; } } diff --git a/src/world/action/hit_lava.c b/src/world/action/hit_lava.c index 73490cff35..87a2f3f22b 100644 --- a/src/world/action/hit_lava.c +++ b/src/world/action/hit_lava.c @@ -1,196 +1,206 @@ #include "common.h" #include "effects.h" -extern f32 D_802B68B0; -extern f32 D_802B68B4; -extern f32 D_802B68B8; -extern f32 D_802B68BC; +enum { + SUBSTATE_INIT = 0, + SUBSTATE_DELAY_LAUNCH = 1, + SUBSTATE_LAUNCH = 2, + SUBSTATE_END_LAUNCH = 3, + SUBSTATE_RETURN_INIT = 4, + SUBSTATE_RETURN_MOTION = 5, + SUBSTATE_HOVER = 6, + SUBSTATE_BOUNCE = 7, + SUBSTATE_DELAY_DONE = 8, + SUBSTATE_DELAY_INIT_SINK = 20, + SUBSTATE_DELAY_INIT = 21 +}; -void func_802B6000_E27F40(void) { +void action_update_hit_lava(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 sp18; - f32 sp1C; - f32 sp20; - f32 sp24; - f32 sp28; - s32 sp2C; - f32 tempGravityIntegrator; - f32 theta; - f32 tempCurrentSpeed; + f32 resetPosX, resetPosY, resetPosZ; + f32 returnRadians; + f32 dx, dy; + f32 componentSpeed; + s32 completeAxes; // number of axes along which the 'return motion' is complete - if (playerStatus->flags & (1 << 31)) { - playerStatus->flags &= ~0x80000000; - playerStatus->flags |= 0x800008; - playerStatus->animFlags |= 4; - playerStatus->flags |= 0x800; - if (playerStatus->unk_BF == 1) { - playerStatus->fallState = 0x14; + static s32 pad[2]; // curious + static f32 LaunchVelocity; + static f32 LaunchInterpPhase; // used to interp launch velocity + static f32 ReturnAngle; + static f32 InitialPosY; + + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + playerStatus->flags |= (PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_FLYING); + playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_4; + playerStatus->flags |= PLAYER_STATUS_FLAGS_800; + if (playerStatus->hazardType == HAZARD_TYPE_LAVA) { + playerStatus->actionSubstate = SUBSTATE_DELAY_INIT_SINK; playerStatus->currentStateTime = 2; } else { - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; } - D_802B68BC = playerStatus->position.y; + InitialPosY = playerStatus->position.y; playerStatus->currentSpeed = 0.0f; - D_802B68B0 = 0.0f; + LaunchVelocity = 0.0f; gCameras[CAM_DEFAULT].moveFlags |= (CAMERA_MOVE_FLAGS_1 | CAMERA_MOVE_FLAGS_2); - D_802B68B4 = 90.0f; + LaunchInterpPhase = 90.0f; subtract_hp(1); open_status_menu_long(); gOverrideFlags |= GLOBAL_OVERRIDES_40; sfx_play_sound_at_player(SOUND_E8, 0); } - switch (playerStatus->fallState) { - case 21: + switch (playerStatus->actionSubstate) { + case SUBSTATE_DELAY_INIT: if (--playerStatus->currentStateTime == -1) { - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; } break; - case 20: + case SUBSTATE_DELAY_INIT_SINK: if (--playerStatus->currentStateTime == -1) { - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; } playerStatus->position.y -= 4.0f; break; - case 0: - if (playerStatus->unk_BF == 1) { + case SUBSTATE_INIT: + if (playerStatus->hazardType == HAZARD_TYPE_LAVA) { fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 1.0f, 40); } - suggest_player_anim_setUnkFlag(0x80000 | 2); + suggest_player_anim_setUnkFlag(ANIM_Mario_80002); playerStatus->gravityIntegrator[1] = 0.0f; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_LAUNCH; playerStatus->currentStateTime = 1; playerStatus->gravityIntegrator[0] = 20.0f; playerStatus->gravityIntegrator[2] = 250.0f; - playerStatus->gravityIntegrator[3] = D_802B68BC; + playerStatus->gravityIntegrator[3] = InitialPosY; playerStatus->jumpFromPos.x = playerStatus->position.x; playerStatus->jumpFromPos.z = playerStatus->position.z; playerStatus->jumpFromHeight = playerStatus->position.y; - playerStatus->flags |= 0x2; + playerStatus->flags |= PLAYER_STATUS_FLAGS_JUMPING; break; - case 1: - if (--playerStatus->currentStateTime << 16 <= 0) { - playerStatus->fallState++; + case SUBSTATE_DELAY_LAUNCH: + if (--playerStatus->currentStateTime <= 0) { + playerStatus->actionSubstate++; } break; - case 2: - if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) { + case SUBSTATE_LAUNCH: + if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); } if (playerStatus->position.y < playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]) { - sin_cos_rad((D_802B68B4 * TAU) / 360.0f, &sp18, &sp1C); - D_802B68B0 = sin_rad((D_802B68B4 * TAU) / 360.0f) * 16.0f; - if (D_802B68B0 < -1.0f) { - D_802B68B0 = -1.0f; + sin_cos_rad((LaunchInterpPhase * TAU) / 360.0f, &dx, &dy); + LaunchVelocity = sin_rad((LaunchInterpPhase * TAU) / 360.0f) * 16.0f; + if (LaunchVelocity < -1.0f) { + LaunchVelocity = -1.0f; } - playerStatus->position.y += D_802B68B0; - D_802B68B4 += 3.0f; - if (D_802B68B4 > 180.0f) { - D_802B68B4 = 180.0f; - playerStatus->fallState++; + playerStatus->position.y += LaunchVelocity; + LaunchInterpPhase += 3.0f; + if (LaunchInterpPhase > 180.0f) { + LaunchInterpPhase = 180.0f; + playerStatus->actionSubstate++; } } else { playerStatus->position.y = playerStatus->gravityIntegrator[3] + playerStatus->gravityIntegrator[2]; - playerStatus->fallState++; + playerStatus->actionSubstate++; } break; - case 3: - if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) { + case SUBSTATE_END_LAUNCH: + if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); } - if (get_lava_reset_pos(&sp20, &sp24, &sp28) == 0) { - sp20 = playerStatus->position.x; - sp28 = playerStatus->position.z; + if (get_lava_reset_pos(&resetPosX, &resetPosY, &resetPosZ) == 0) { + resetPosX = playerStatus->position.x; + resetPosZ = playerStatus->position.z; } - playerStatus->lastGoodPosition.x = sp20; - playerStatus->lastGoodPosition.z = sp28; + playerStatus->lastGoodPosition.x = resetPosX; + playerStatus->lastGoodPosition.z = resetPosZ; playerStatus->jumpApexHeight = playerStatus->position.y; - playerStatus->gravityIntegrator[0] = 0.1143f; - playerStatus->gravityIntegrator[1] = -0.2871f; - playerStatus->gravityIntegrator[2] = -0.1823f; - playerStatus->gravityIntegrator[3] = 0.01152f; - playerStatus->fallState++; + LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); + playerStatus->actionSubstate++; break; - case 4: - D_802B68B8 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); + case SUBSTATE_RETURN_INIT: + ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; - playerStatus->fallState++; + playerStatus->actionSubstate++; break; - case 5: - D_802B68B8 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); - theta = D_802B68B8 * TAU / 360.0f; - tempCurrentSpeed = playerStatus->currentSpeed * sin_rad(theta); - playerStatus->position.x += tempCurrentSpeed; - sp2C = 0; - if (tempCurrentSpeed >= 0.0f) { + case SUBSTATE_RETURN_MOTION: + ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); + returnRadians = ReturnAngle * TAU / 360.0f; + // update motion along x axis + componentSpeed = playerStatus->currentSpeed * sin_rad(returnRadians); + playerStatus->position.x += componentSpeed; + completeAxes = 0; + if (componentSpeed >= 0.0f) { if (playerStatus->lastGoodPosition.x <= playerStatus->position.x) { playerStatus->position.x = playerStatus->lastGoodPosition.x; - sp2C = 1; + completeAxes++; } } else { if (playerStatus->position.x <= playerStatus->lastGoodPosition.x) { playerStatus->position.x = playerStatus->lastGoodPosition.x; - sp2C = 1; + completeAxes++; } } - tempCurrentSpeed = playerStatus->currentSpeed * cos_rad(theta); - playerStatus->position.z -= tempCurrentSpeed; - if (tempCurrentSpeed >= 0.0f) { + // update motion along z axis + componentSpeed = playerStatus->currentSpeed * cos_rad(returnRadians); + playerStatus->position.z -= componentSpeed; + if (componentSpeed >= 0.0f) { if (playerStatus->position.z <= playerStatus->lastGoodPosition.z) { playerStatus->position.z = playerStatus->lastGoodPosition.z; - sp2C++; + completeAxes++; } } else { if (playerStatus->lastGoodPosition.z <= playerStatus->position.z) { playerStatus->position.z = playerStatus->lastGoodPosition.z; - sp2C++; + completeAxes++; } } - if (sp2C == 2) { - playerStatus->fallState++; + // if both axes are done, continue to next substate + if (completeAxes == 2) { + playerStatus->actionSubstate++; } break; - case 6: - if (playerStatus->unk_BF == 1 && (playerStatus->timeInAir % 2) == 0) { + case SUBSTATE_HOVER: + if (playerStatus->hazardType == HAZARD_TYPE_LAVA && (playerStatus->timeInAir % 2) == 0) { fx_smoke_burst(0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z, 0.7f, 18); } - playerStatus->position.y = player_check_collision_below(func_800E34D8(), &sp2C); - if (sp2C >= 0) { + playerStatus->position.y = player_check_collision_below(func_800E34D8(), &completeAxes); + if (completeAxes >= 0) { exec_ShakeCamX(0, 2, 1, 0.8f); - start_rumble(0x100, 0x32); + start_rumble(256, 50); phys_adjust_cam_on_landing(); gCameras[CAM_DEFAULT].moveFlags &= ~CAMERA_MOVE_FLAGS_2; sfx_play_sound_at_player(SOUND_3FB, 0); - suggest_player_anim_setUnkFlag(0x8001A); - playerStatus->flags &= ~0x800; - playerStatus->flags &= ~8; - playerStatus->unk_BF = 0; + suggest_player_anim_setUnkFlag(ANIM_Mario_8001A); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; + playerStatus->hazardType = HAZARD_TYPE_NONE; playerStatus->gravityIntegrator[0] = 6.0f; playerStatus->position.y += 6.0f; - playerStatus->fallState++; + playerStatus->actionSubstate++; } break; - case 7: - tempGravityIntegrator = playerStatus->gravityIntegrator[0] - 1.0; - playerStatus->gravityIntegrator[0] = tempGravityIntegrator; - playerStatus->position.y = player_check_collision_below(tempGravityIntegrator, &sp2C); - if (sp2C >= 0) { - playerStatus->currentStateTime = 0xA; - playerStatus->fallState++; + case SUBSTATE_BOUNCE: + playerStatus->gravityIntegrator[0] -= 1.0; + playerStatus->position.y = player_check_collision_below(playerStatus->gravityIntegrator[0], &completeAxes); + if (completeAxes >= 0) { + playerStatus->currentStateTime = 10; + playerStatus->actionSubstate++; } break; - case 8: - if (--playerStatus->currentStateTime << 16 <= 0) { + case SUBSTATE_DELAY_DONE: + if (--playerStatus->currentStateTime <= 0) { set_action_state(ACTION_STATE_LAND); - playerStatus->flags &= ~0x800000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_800000; gOverrideFlags &= ~GLOBAL_OVERRIDES_40; } break; } - if (playerStatus->fallState < 7) { + if (playerStatus->actionSubstate < SUBSTATE_BOUNCE) { playerStatus->timeInAir++; } } diff --git a/src/world/action/idle.c b/src/world/action/idle.c index 17500e8331..bc19eddb75 100644 --- a/src/world/action/idle.c +++ b/src/world/action/idle.c @@ -1,54 +1,58 @@ #include "common.h" #include "../actions.h" -s32 IdlePeachAnims[] = { - 0x000A0001, // none - 0x000A0007, // cream - 0x000A0009, // strawberry - 0x000A000B, // butter - 0x000A000D, // cleanser - 0x000A000F, // water - 0x000A0011, // milk - 0x000A0013, // flour - 0x000A0015, // egg - 0x000A0017, // complete cake - 0x000A0019, // cake bowl - 0x000A001B, // cake mixed - 0x000A001D, // cake pan - 0x000A001F, // cake batter - 0x000A0021, // cake bare - 0x000A0023, // salt - 0x000A0025, // sugar - 0x000A0027, // cake with icing - 0x000A0029, // cake with berries +AnimID IdlePeachAnims[] = { + ANIM_Peach_A0001, // none + ANIM_Peach_A0007, // cream + ANIM_Peach_A0009, // strawberry + ANIM_Peach_A000B, // butter + ANIM_Peach_A000D, // cleanser + ANIM_Peach_A000F, // water + ANIM_Peach_A0011, // milk + ANIM_Peach_A0013, // flour + ANIM_Peach_A0015, // egg + ANIM_Peach_A0017, // complete cake + ANIM_Peach_A0019, // cake bowl + ANIM_Peach_A001B, // cake mixed + ANIM_Peach_A001D, // cake pan + ANIM_Peach_A001F, // cake batter + ANIM_Peach_A0021, // cake bare + ANIM_Peach_A0023, // salt + ANIM_Peach_A0025, // sugar + ANIM_Peach_A0027, // cake with icing + ANIM_Peach_A0029, // cake with berries 0x00000000, }; -void action_idle_update_peach(void); +enum { + SUBSTATE_IDLE_DEFAULT = 0, + SUBSTATE_IDLE_STRETCH = 1, + SUBSTATE_DELAY_SLEEP = 2, + SUBSTATE_IDLE_SLEEP = 3, +}; -void action_idle_update(void) { +void action_update_idle_peach(void); + +void action_update_idle(void) { PlayerStatus* playerStatus = &gPlayerStatus; PlayerData* playerData = &gPlayerData; s32 wasMoving = FALSE; + f32 angle, magnitude; + AnimID anim; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - action_idle_update_peach(); + action_update_idle_peach(); return; } playerStatus->currentStateTime++; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - s32 anim; - playerStatus->flags &= - ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED - | PLAYER_STATUS_FLAGS_80000 - | PLAYER_STATUS_FLAGS_JUMPING - | PLAYER_STATUS_FLAGS_FALLING - | PLAYER_STATUS_FLAGS_FLYING); + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED + | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE); wasMoving = TRUE; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT; playerStatus->currentStateTime = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; @@ -56,13 +60,13 @@ void action_idle_update(void) { playerStatus->pitch = 0.0f; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - anim = 0x90002; + anim = ANIM_Mario_90002; } else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { - anim = 0x10002; - } else if ((s8)playerStatus->prevActionState == ACTION_STATE_IDLE) { - anim = 0x60005; + anim = ANIM_Mario_10002; + } else if (playerStatus->prevActionState == ACTION_STATE_IDLE) { + anim = ANIM_Mario_60005; } else { - anim = 0x60007; + anim = ANIM_Mario_60007; } suggest_player_anim_clearUnkFlag(anim); } @@ -70,9 +74,6 @@ void action_idle_update(void) { if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_RAISED_ARMS) { set_action_state(ACTION_STATE_RAISE_ARMS); } else { - f32 angle; - f32 magnitude; - player_input_to_move_vector(&angle, &magnitude); phys_update_interact_collider(); @@ -95,29 +96,25 @@ void action_idle_update(void) { } } -void action_idle_update_peach(void) { +void action_update_idle_peach(void) { PlayerStatus* playerStatus = &gPlayerStatus; PlayerData* playerData = &gPlayerData; - f32 angle; - f32 magnitude; + f32 angle, magnitude; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT; playerStatus->currentStateTime = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->currentSpeed = 0.0f; - playerStatus->flags &= - ~(PLAYER_STATUS_FLAGS_JUMPING - | PLAYER_STATUS_FLAGS_FALLING - | PLAYER_STATUS_FLAGS_FLYING); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE; if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { if (!(gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) { suggest_player_anim_clearUnkFlag(IdlePeachAnims[gGameStatusPtr->peachCookingIngredient]); } else { - suggest_player_anim_clearUnkFlag(0xC000E); + suggest_player_anim_clearUnkFlag(ANIM_Peach_C000E); } } else { peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].idle); @@ -125,38 +122,42 @@ void action_idle_update_peach(void) { } if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { - switch (playerStatus->fallState) { - case 0: - if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED)) && (playerStatus->unk_C4 == 0)) { + switch (playerStatus->actionSubstate) { + case SUBSTATE_IDLE_DEFAULT: + if (!(playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED)) + && (playerStatus->peachItemHeld == 0)) { if (playerStatus->currentStateTime > 1800) { - playerStatus->fallState++; - suggest_player_anim_clearUnkFlag(0xC0003); + // begin first yawm + playerStatus->actionSubstate++; + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0003); return; } playerStatus->currentStateTime++; } break; - case 1: + case SUBSTATE_IDLE_STRETCH: + // waiting for yawn to finish if (playerStatus->unk_BC != 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; playerStatus->currentStateTime = 0; - suggest_player_anim_clearUnkFlag(0xA0001); + suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001); } break; - case 2: { + case SUBSTATE_DELAY_SLEEP: + // delay before next yawn and sleep playerStatus->currentStateTime++; if (playerStatus->currentStateTime > 200) { - playerStatus->fallState++; - suggest_player_anim_clearUnkFlag(0xC0003); + playerStatus->actionSubstate++; + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0003); } break; - } - case 3: + case SUBSTATE_IDLE_SLEEP: + // peach is asleep if (playerStatus->flags & (PLAYER_STATUS_FLAGS_1000 | PLAYER_STATUS_FLAGS_INPUT_DISABLED)) { - suggest_player_anim_clearUnkFlag(0xA0001); - playerStatus->fallState = 0; + suggest_player_anim_clearUnkFlag(ANIM_Peach_A0001); + playerStatus->actionSubstate = SUBSTATE_IDLE_DEFAULT; } else if (playerStatus->unk_BC != 0) { - suggest_player_anim_clearUnkFlag(0xC0004); + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0004); } break; } diff --git a/src/world/action/jump.c b/src/world/action/jump.c index c176e71b52..ff8719aaa7 100644 --- a/src/world/action/jump.c +++ b/src/world/action/jump.c @@ -1,21 +1,23 @@ #include "common.h" -extern f32 D_8010C960; -extern f32 D_8010C97C; +extern f32 JumpedOnSwitchX; +extern f32 JumpedOnSwitchZ; -void func_802B6508_E24548(void); -void func_802B647C_E244BC(void); +// private functions +void initialize_jump(void); +void action_update_peach_step_down(void); +void action_update_peach_falling(void); -void func_802B6000_E24040(void) { +void initialize_jump(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; - s32 temp_v1; + AnimID anim; - playerStatus->fallState = 0; + playerStatus->actionSubstate = JUMP_SUBSTATE_0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; - playerStatus->flags &= ~0x80000008; - playerStatus->flags |= 2; + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_FLYING); + playerStatus->flags |= PLAYER_STATUS_FLAGS_JUMPING; playerStatus->jumpFromPos.x = playerStatus->position.x; playerStatus->jumpFromPos.z = playerStatus->position.z; playerStatus->jumpFromHeight = playerStatus->position.y; @@ -23,25 +25,25 @@ void func_802B6000_E24040(void) { phys_init_integrator_for_current_state(); if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - temp_v1 = 0x90005; + anim = ANIM_Mario_90005; } else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - temp_v1 = 0x10007; + anim = ANIM_Mario_AnimMidairStill; } else { - temp_v1 = 0x60009; + anim = ANIM_Mario_60009; } - suggest_player_anim_clearUnkFlag(temp_v1); + suggest_player_anim_clearUnkFlag(anim); collisionStatus->lastTouchedFloor = collisionStatus->currentFloor; collisionStatus->currentFloor = -1; } -void func_802B60B4_E240F4(void) { +void action_update_jump(void) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 anim; + AnimID anim; - if (playerStatus->flags < 0) { - playerStatus->flags &= ~0x80000000; - func_802B6000_E24040(); + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + initialize_jump(); if (playerStatus->actionState == ACTION_STATE_LAUNCH) { phys_adjust_cam_on_landing(); @@ -60,35 +62,35 @@ void func_802B60B4_E240F4(void) { } if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - anim = 0x90005; + anim = ANIM_Mario_90005; } else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - anim = 0x10007; + anim = ANIM_Mario_AnimMidairStill; } else { - anim = 0x60009; + anim = ANIM_Mario_60009; } suggest_player_anim_clearUnkFlag(anim); playerStatus->timeInAir++; } -void func_802B6198_E241D8(void) { +void action_update_landing_on_switch(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; - s32 anim; + AnimID anim; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { Entity* entity = get_entity_by_index(collisionStatus->currentFloor); - D_8010C960 = entity->position.x; - D_8010C97C = entity->position.z; - func_802B6000_E24040(); - playerStatus->flags |= 0x880000; + JumpedOnSwitchX = entity->position.x; + JumpedOnSwitchZ = entity->position.z; + initialize_jump(); + playerStatus->flags |= (PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000); disable_player_input(); } playerStatus->timeInAir++; - if (playerStatus->fallState != 1) { + if (playerStatus->actionSubstate != JUMP_SUBSTATE_1) { return; } @@ -96,60 +98,57 @@ void func_802B6198_E241D8(void) { playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING); playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; - if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - anim = 0x10008; + anim = ANIM_Mario_AnimMidair; } else { - anim = 0x6000A; + anim = ANIM_Mario_6000A; } suggest_player_anim_clearUnkFlag(anim); gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; } - playerStatus->fallState++; + playerStatus->actionSubstate++; } -void func_802B6294_E242D4(void) { +void action_update_falling(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - func_802B647C_E244BC(); + action_update_peach_falling(); return; } if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - s32 phi_a0; + s32 anim; playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING); playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - phi_a0 = 0x90005; + anim = ANIM_Mario_90005; } else if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - phi_a0 = 0x10008; + anim = ANIM_Mario_AnimMidair; } else { - phi_a0 = 0x6000A; + anim = ANIM_Mario_6000A; } - suggest_player_anim_clearUnkFlag(phi_a0); + suggest_player_anim_clearUnkFlag(anim); gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; } playerStatus->timeInAir++; } -void func_802B6348_E24388(void) { +void action_update_step_down(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 sub_arg5; - f32 sub_arg6; - f32 sub_arg7; - f32 sub_arg8; - f32 sp28; - f32 sp2C; - f32 sp30; - f32 sp34; + s32 colliderID; + s32 surfaceType; + f32 posX, posY, posZ; + f32 hitRx, hitRz; + f32 hitDirX, hitDirZ; + f32 height; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - func_802B6508_E24548(); + action_update_peach_step_down(); return; } @@ -161,23 +160,23 @@ void func_802B6348_E24388(void) { playerStatus->timeInAir++; phys_update_interact_collider(); - sp28 = playerStatus->position.x; - sp2C = playerStatus->position.y; - sp30 = playerStatus->position.z; - sp34 = playerStatus->colliderHeight; - - if (((get_collider_type_by_id(player_raycast_below_cam_relative(playerStatus, &sp28, &sp2C, &sp30, &sp34, - &sub_arg5, &sub_arg6, &sub_arg7, &sub_arg8)) & 0xFF) - 2 >= 2U) && check_input_jump()) { + posX = playerStatus->position.x; + posY = playerStatus->position.y; + posZ = playerStatus->position.z; + height = playerStatus->colliderHeight; + colliderID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); + surfaceType = get_collider_flags(colliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + if (!(surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) && check_input_jump()) { set_action_state(ACTION_STATE_JUMP); - playerStatus->flags &= ~0xE; - func_802B60B4_E240F4(); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE; + action_update_jump(); } } -void func_802B647C_E244BC(void) { +void action_update_peach_falling(void) { PlayerStatus* playerStatus = &gPlayerStatus; - s32 temp_v1; + AnimID anim; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; @@ -185,18 +184,18 @@ void func_802B647C_E244BC(void) { playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) { - temp_v1 = 0x10008; + anim = ANIM_Mario_AnimMidair; } else { - temp_v1 = 0xA0006; + anim = ANIM_Peach_A0006; } - suggest_player_anim_clearUnkFlag(temp_v1); + suggest_player_anim_clearUnkFlag(anim); gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; } playerStatus->timeInAir++; } -void func_802B6508_E24548(void) { +void action_update_peach_step_down(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { @@ -206,7 +205,7 @@ void func_802B6508_E24548(void) { gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - suggest_player_anim_clearUnkFlag(0xA0006); + suggest_player_anim_clearUnkFlag(ANIM_Peach_A0006); } } playerStatus->timeInAir++; diff --git a/src/world/action/16.c b/src/world/action/knockback.c similarity index 53% rename from src/world/action/16.c rename to src/world/action/knockback.c index 8462bd4a96..3cd1f1d15d 100644 --- a/src/world/action/16.c +++ b/src/world/action/knockback.c @@ -1,20 +1,25 @@ #include "common.h" -extern f32 D_802B6240; // bss? angle to lastGoodPosition +enum { + SUBSTATE_FLYING = 0, + SUBSTATE_FALLING = 1 +}; -void func_802B6000_E287F0(void) { +void action_update_knockback(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32 dx; - f32 dy; + f32 dx, dy; f32 speed; - if (playerStatus->flags & 0x80000000) { - playerStatus->flags &= ~0x80000000; + static f32 ReturnAngle; - suggest_player_anim_setUnkFlag(0x10017); + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + + suggest_player_anim_setUnkFlag(ANIM_Mario_FallBack); + + playerStatus->flags |= PLAYER_STATUS_FLAGS_FLYING; - playerStatus->flags |= 8; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_FLYING; playerStatus->gravityIntegrator[0] = 18.3473f; playerStatus->gravityIntegrator[1] = -3.738f; playerStatus->gravityIntegrator[2] = 0.8059f; @@ -22,30 +27,30 @@ void func_802B6000_E287F0(void) { gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; - D_802B6240 = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, + ReturnAngle = atan2(playerStatus->position.x, playerStatus->position.z, playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z); playerStatus->currentSpeed = get_xz_dist_to_player(playerStatus->lastGoodPosition.x, playerStatus->lastGoodPosition.z) / 18.0f; } - sin_cos_rad((D_802B6240 * TAU) / 360.0f, &dx, &dy); + sin_cos_rad((ReturnAngle * TAU) / 360.0f, &dx, &dy); speed = playerStatus->currentSpeed; - if (playerStatus->flags & 0x40000) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_40000) { speed *= 0.5f; } playerStatus->position.x += speed * dx; playerStatus->position.z -= speed * dy; - if (playerStatus->fallState == 0) { + if (playerStatus->actionSubstate == SUBSTATE_FLYING) { integrate_gravity(); playerStatus->position.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] < 0.0f) { - playerStatus->fallState = 1; // Now start checking for floor - playerStatus->flags |= 4; + playerStatus->actionSubstate = SUBSTATE_FALLING; + playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; } } else { s32 colliderID; @@ -53,7 +58,7 @@ void func_802B6000_E287F0(void) { playerStatus->position.y = player_check_collision_below(func_800E34D8(), &colliderID); if (colliderID >= 0) { - colliderID = get_collider_type_by_id(colliderID); // what + colliderID = get_collider_flags(colliderID); //TODO surfaceType set_action_state(ACTION_STATE_LAND); } } diff --git a/src/world/action/land.c b/src/world/action/land.c index 9550408120..80d479ed2e 100644 --- a/src/world/action/land.c +++ b/src/world/action/land.c @@ -1,19 +1,24 @@ #include "common.h" -void func_802B62CC_E24BEC(void); -void func_802B644C_E24D6C(void); +enum { + SUBSTATE_INIT = 0, + SUBSTATE_DONE = 1, +}; -void func_802B6000_E24920(void) { +void action_update_peach_land(void); +void action_update_peach_step_down_land(void); + +void action_update_land(void) { CollisionStatus* collisionStatus = &gCollisionStatus; PlayerStatus* playerStatus = &gPlayerStatus; Camera* camera = &gCameras[CAM_DEFAULT]; f32 inputMoveMagnitude; f32 inputMoveAngle; s32 jumpInputCheck; - s32 phi_a0; + AnimID anim; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - func_802B62CC_E24BEC(); + action_update_peach_land(); return; } @@ -22,25 +27,23 @@ void func_802B6000_E24920(void) { PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000 | - PLAYER_STATUS_FLAGS_FLYING | - PLAYER_STATUS_FLAGS_FALLING | - PLAYER_STATUS_FLAGS_JUMPING + PLAYER_STATUS_FLAGS_AIRBORNE ); - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->landPos.x = playerStatus->position.x; playerStatus->landPos.z = playerStatus->position.z; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - phi_a0 = 0x90002; + anim = ANIM_Mario_90002; } else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { - phi_a0 = 0x10009; + anim = ANIM_Mario_10009; } else { - phi_a0 = 0x6000B; + anim = ANIM_Mario_6000B; } - suggest_player_anim_clearUnkFlag(phi_a0); + suggest_player_anim_clearUnkFlag(anim); sfx_play_sound_at_player(SOUND_8161, 0); sfx_play_sound_at_player(SOUND_SOFT_LAND, 0); @@ -52,13 +55,13 @@ void func_802B6000_E24920(void) { playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_40000; camera->moveFlags &= ~CAMERA_MOVE_FLAGS_4; } - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE playerStatus->currentSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); jumpInputCheck = check_input_jump(); - if (jumpInputCheck != 0 || jumpInputCheck < playerStatus->fallState) { + if (jumpInputCheck != 0 || jumpInputCheck < playerStatus->actionSubstate) { if (inputMoveMagnitude == 0.0f) { set_action_state(ACTION_STATE_IDLE); return; @@ -70,14 +73,14 @@ void func_802B6000_E24920(void) { } } -void func_802B61C0_E24AE0(void) { +void action_update_step_down_land(void) { CollisionStatus* collisionStatus = &gCollisionStatus; PlayerStatus* playerStatus = &gPlayerStatus; f32 inputMoveMagnitude; f32 inputMoveAngle; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - func_802B644C_E24D6C(); + action_update_peach_step_down_land(); return; } @@ -86,11 +89,9 @@ void func_802B61C0_E24AE0(void) { PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000 | - PLAYER_STATUS_FLAGS_FLYING | - PLAYER_STATUS_FLAGS_FALLING | - PLAYER_STATUS_FLAGS_JUMPING + PLAYER_STATUS_FLAGS_AIRBORNE ); - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->landPos.x = playerStatus->position.x; @@ -103,7 +104,7 @@ void func_802B61C0_E24AE0(void) { collisionStatus->lastTouchedFloor = -1; } - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE playerStatus->currentSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); @@ -116,7 +117,7 @@ void func_802B61C0_E24AE0(void) { update_locomotion_state(); } -void func_802B62CC_E24BEC(void) { +void action_update_peach_land(void) { CollisionStatus* collisionStatus = &gCollisionStatus; PlayerStatus* playerStatus = &gPlayerStatus; f32 inputMoveMagnitude; @@ -124,10 +125,10 @@ void func_802B62CC_E24BEC(void) { if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; - playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE; playerStatus->landPos.x = playerStatus->position.x; playerStatus->landPos.z = playerStatus->position.z; @@ -140,7 +141,7 @@ void func_802B62CC_E24BEC(void) { collisionStatus->lastTouchedFloor = -1; } - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE playerStatus->currentSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); @@ -160,7 +161,7 @@ void func_802B62CC_E24BEC(void) { } } -void func_802B644C_E24D6C(void) { +void action_update_peach_step_down_land(void) { CollisionStatus* collisionStatus = &gCollisionStatus; PlayerStatus* playerStatus = &gPlayerStatus; f32 inputMoveMagnitude; @@ -168,10 +169,10 @@ void func_802B644C_E24D6C(void) { if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_INIT; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; - playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_AIRBORNE; playerStatus->landPos.x = playerStatus->position.x; playerStatus->landPos.z = playerStatus->position.z; @@ -181,7 +182,7 @@ void func_802B644C_E24D6C(void) { collisionStatus->lastTouchedFloor = -1; } - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE playerStatus->currentSpeed *= 0.6f; player_input_to_move_vector(&inputMoveAngle, &inputMoveMagnitude); diff --git a/src/world/action/encounter.c b/src/world/action/misc.c similarity index 71% rename from src/world/action/encounter.c rename to src/world/action/misc.c index 155430dae0..649fbe176c 100644 --- a/src/world/action/encounter.c +++ b/src/world/action/misc.c @@ -2,17 +2,16 @@ #include "world/actions.h" #include "world/partner/goombario.h" -s32 func_802B6000_E28A30(void) { +s32 action_update_ride(void) { PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; PlayerStatus* playerStatus = &gPlayerStatus; s32 oldFlags = playerStatus->flags; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~( - PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_FLYING | - PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING + PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE ); - playerStatus->fallState = 0; + playerStatus->actionSubstate = 0; playerStatus->currentStateTime = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; @@ -36,7 +35,7 @@ s32 func_802B6000_E28A30(void) { extern f32 D_802B6770_E27C80; -void func_802B609C_E28ACC(void) { +void action_update_state_23(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 hitDirZ; f32 hitDirX; @@ -55,11 +54,9 @@ void func_802B609C_E28ACC(void) { f32 playerOffsetTempVar; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - playerStatus->flags &= ~( - PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_FLYING | - PLAYER_STATUS_FLAGS_FALLING | PLAYER_STATUS_FLAGS_JUMPING - ); - playerStatus->fallState = 0; + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED + | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE); + playerStatus->actionSubstate = 0; playerStatus->currentStateTime = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; @@ -68,9 +65,9 @@ void func_802B609C_E28ACC(void) { D_802B6770_E27C80 = D_8010C938; } - switch (playerStatus->fallState) { + switch (playerStatus->actionSubstate) { case 0: - playerStatus->fallState++; + playerStatus->actionSubstate++; case 1: break; default: @@ -125,19 +122,19 @@ void func_802B609C_E28ACC(void) { } } -void func_802B6350_E28D80(void) { +void action_update_launch(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - playerStatus->flags &= ~(0x80000000 | 0x80000 | 0x8 | 0x4 | 0x2); - playerStatus->fallState = 0; + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000 | PLAYER_STATUS_FLAGS_AIRBORNE); + playerStatus->actionSubstate = 0; playerStatus->currentStateTime = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->currentSpeed = 0.0f; playerStatus->pitch = 0.0f; - if (playerStatus->animFlags & 0x1000) { + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { return; } playerStatus->currentStateTime = 5; @@ -149,17 +146,17 @@ void func_802B6350_E28D80(void) { } } -void func_802B63D4_E28E04(void) { +void action_update_first_strike(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - playerStatus->flags &= ~(0x80000000 | 0x8 | 0x4 | 0x2); - playerStatus->fallState = 0; + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_AIRBORNE); + playerStatus->actionSubstate = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->currentSpeed = 0.0f; playerStatus->pitch = 0.0f; - suggest_player_anim_setUnkFlag(0x10017); + suggest_player_anim_setUnkFlag(ANIM_Mario_FallBack); playerStatus->currentStateTime = 30; } @@ -170,48 +167,48 @@ void func_802B63D4_E28E04(void) { } } -void func_802B6478_E28EA8(void) { +void action_update_raise_arms(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - playerStatus->flags &= ~0x80000000; - playerStatus->flags |= 0x80000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + playerStatus->flags |= PLAYER_STATUS_FLAGS_80000; playerStatus->currentStateTime = 0; - playerStatus->fallState = 0; + playerStatus->actionSubstate = 0; playerStatus->currentSpeed = 0.0f; playerStatus->pitch = 0.0f; - suggest_player_anim_setUnkFlag(0x1001F); + suggest_player_anim_setUnkFlag(ANIM_Mario_GotItem); } - if (!(playerStatus->animFlags & 0x200)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_RAISED_ARMS)) { set_action_state(ACTION_STATE_IDLE); - playerStatus->flags &= ~0x80000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_80000; } } -void func_802B6508_E28F38(void) { +void action_update_pushing_block(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { f32 angle; f32 magnitude; - playerStatus->flags &= ~0x80000000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; playerStatus->currentSpeed = 0.0f; playerStatus->unk_60 = 0; playerStatus->currentStateTime = 5; player_input_to_move_vector(&angle, &magnitude); if (((angle >= 45.0f) && (angle <= 135.0f)) || ((angle >= 225.0f) && (angle <= 315.0f))) { - suggest_player_anim_setUnkFlag(0x80000 | 0x20); + suggest_player_anim_setUnkFlag(ANIM_Mario_80020); } else { - suggest_player_anim_clearUnkFlag(0x60000 | 0x4); + suggest_player_anim_clearUnkFlag(ANIM_Mario_60004); } } check_input_jump(); - if (playerStatus->animFlags & 0x800000) { + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_800000) { if (playerStatus->currentStateTime != 0) { playerStatus->currentStateTime--; if (playerStatus->currentStateTime == 0) { @@ -221,7 +218,7 @@ void func_802B6508_E28F38(void) { } } -void func_802B6638_E29068(void) { +void action_update_talk(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { @@ -229,11 +226,11 @@ void func_802B6638_E29068(void) { playerStatus->currentSpeed = 0.0f; playerStatus->unk_60 = 0; - if (!(playerStatus->animFlags & 0x1000)) { - suggest_player_anim_setUnkFlag(0x80007); - } else if (playerStatus->unk_C4 == 0) { - if (!(playerStatus->animFlags & 0x2000)) { - suggest_player_anim_setUnkFlag(0xC0000); + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) { + suggest_player_anim_setUnkFlag(ANIM_Mario_80007); + } else if (playerStatus->peachItemHeld == 0) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { + suggest_player_anim_setUnkFlag(ANIM_Peach_C0000); } else { peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].talk); } @@ -241,12 +238,12 @@ void func_802B6638_E29068(void) { playerStatus->currentStateTime = 30; } - if (playerStatus->animFlags & 0x1000) { + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { if (playerStatus->currentStateTime != 0) { playerStatus->currentStateTime--; - } else if (playerStatus->unk_C4 == 0) { - if (!(playerStatus->animFlags & 0x2000)) { - suggest_player_anim_setUnkFlag(0xA0001); + } else if (playerStatus->peachItemHeld == 0) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { + suggest_player_anim_setUnkFlag(ANIM_Peach_A0001); } else { peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].idle); } diff --git a/src/world/action/slide.c b/src/world/action/slide.c index 7594d31e9b..f959c1ce71 100644 --- a/src/world/action/slide.c +++ b/src/world/action/slide.c @@ -1,77 +1,82 @@ #include "common.h" -extern f32 D_802B6780; -extern f32 D_802B6784; -extern f32 D_802B6788; -extern f32 D_802B678C; -extern f32 D_802B6790; -extern f32 D_802B6794; -extern f32 D_802B6798; -extern s32 D_802B679C; +static f32 SlideAcceleration; +static f32 MaxSlideAccel; +static f32 MaxSlideVelocity; +static f32 SlideLaunchSpeed; +static f32 D_802B6790; +static f32 D_802B6794; +static f32 D_802B6798; +static s32 D_802B679C; + +enum { + SUBSTATE_SLIDING = 0, + SUBSTATE_STOP = 1, + SUBSTATE_LAUNCH = 2, + SUBSTATE_FALL = 3, + SUBSTATE_CRASH = 4, + SUBSTATE_GET_UP = 5, + SUBSTATE_DUST_OFF = 6, + SUBSTATE_DONE = 7, +}; void func_802B6000_E27510(void) { PlayerStatus* playerStatus = &gPlayerStatus; - f32* temp_v0 = playerStatus->unk_D0; + SlideParams* slide = playerStatus->slideParams; - playerStatus->gravityIntegrator[0] = temp_v0[4]; - playerStatus->gravityIntegrator[1] = temp_v0[5]; - playerStatus->gravityIntegrator[2] = temp_v0[6]; - playerStatus->gravityIntegrator[3] = temp_v0[7]; - playerStatus->heading = *temp_v0; - D_802B6784 = temp_v0[1]; - D_802B678C = temp_v0[2]; - D_802B6788 = temp_v0[3]; + playerStatus->gravityIntegrator[0] = slide->integrator[0]; + playerStatus->gravityIntegrator[1] = slide->integrator[1]; + playerStatus->gravityIntegrator[2] = slide->integrator[2]; + playerStatus->gravityIntegrator[3] = slide->integrator[3]; + playerStatus->heading = slide->heading; + MaxSlideAccel = slide->maxDescendAccel; + SlideLaunchSpeed = slide->launchVelocity; + MaxSlideVelocity = slide->maxDescendVelocity; } -void func_802B6060_E27570(void) { +void action_update_sliding(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus; - f32 cosA; - f32 sinA; + s32 surfaceType; + f32 sinA, cosA; + f32 speed; + f32 posX, posY, posZ, depth; + f32 hitRx, hitRy, hitDirX, hitDirZ; s32 hitID; - f32 hitDirZ; - f32 hitDirX; - f32 hitRy; - f32 hitRx; - f32 depth; - f32 posZ; - f32 posY; - f32 posX; - f32 tempCurrentSpeed; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_SLIDING; playerStatus->currentSpeed = 0.0f; playerStatus->animFlags |= 4; func_802B6000_E27510(); - D_802B6780 = 0.0f; + SlideAcceleration = 0.0f; D_802B6790 = 0.0f; D_802B6794 = 0.0f; D_802B6798 = 0.0f; D_802B679C = 0; - suggest_player_anim_clearUnkFlag(0x1000A); + suggest_player_anim_clearUnkFlag(ANIM_Mario_1000A); sfx_play_sound_at_player(SOUND_167, 0); gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; } - tempCurrentSpeed = playerStatus->currentSpeed; + speed = playerStatus->currentSpeed; posX = playerStatus->position.x; posY = playerStatus->position.y; posZ = playerStatus->position.z; - hitID = player_test_move_with_slipping(playerStatus, &posX, &posY, &posZ, tempCurrentSpeed, playerStatus->heading); + hitID = player_test_move_with_slipping(playerStatus, &posX, &posY, &posZ, speed, playerStatus->heading); playerStatus->position.x = posX; playerStatus->position.z = posZ; playerStatus->position.y = posY; - switch (playerStatus->fallState) { - case 0: - D_802B6780 += 0.1; - if (D_802B6784 <= D_802B6780) { - D_802B6780 = D_802B6784; + switch (playerStatus->actionSubstate) { + case SUBSTATE_SLIDING: + SlideAcceleration += 0.1; + if (MaxSlideAccel <= SlideAcceleration) { + SlideAcceleration = MaxSlideAccel; } - playerStatus->currentSpeed += D_802B6780; - if (D_802B6788 <= playerStatus->currentSpeed) { - playerStatus->currentSpeed = D_802B6788; + playerStatus->currentSpeed += SlideAcceleration; + if (MaxSlideVelocity <= playerStatus->currentSpeed) { + playerStatus->currentSpeed = MaxSlideVelocity; } posX = playerStatus->position.x; depth = 100.0f; @@ -82,111 +87,109 @@ void func_802B6060_E27570(void) { D_802B6798 = hitRy; if (hitID >= 0) { collisionStatus = &gCollisionStatus; - if ((u8)get_collider_type_by_id(hitID) == 5) { + surfaceType = get_collider_flags(hitID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + if (surfaceType == SURFACE_TYPE_SLIDE) { collisionStatus->currentFloor = hitID; playerStatus->position.y = posY; D_802B6790 = hitRy + 180.0f; break; } if (!(fabs(D_802B6794 - D_802B6798) >= 50.0)) { - playerStatus->fallState = 1; + playerStatus->actionSubstate = SUBSTATE_STOP; } else { - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_LAUNCH; } } else { - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_LAUNCH; } sin_cos_rad((D_802B6790 * TAU) / 360.0f, &sinA, &cosA); playerStatus->position.y += fabsf((sinA / cosA) * playerStatus->currentSpeed); snd_stop_sound(SOUND_167); break; - case 1: + case SUBSTATE_STOP: posX = playerStatus->position.x; depth = 50.0f; posZ = playerStatus->position.z; posY = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); hitID = player_raycast_below_cam_relative(playerStatus, &posX, &posY, &posZ, &depth, &hitRx, &hitRy, &hitDirX, &hitDirZ); if (hitID >= 0) { - tempCurrentSpeed = playerStatus->currentSpeed / 3.0f; - if (tempCurrentSpeed < 0.01) { + speed = playerStatus->currentSpeed / 3.0f; + if (speed < 0.01) { playerStatus->currentSpeed = 0.0f; } - playerStatus->currentSpeed -= tempCurrentSpeed; + playerStatus->currentSpeed -= speed; if (playerStatus->currentSpeed <= 0.0f) { - sfx_play_sound_at_player(SOUND_172, 0); - suggest_player_anim_setUnkFlag(0x10031); - playerStatus->fallState = 6; + sfx_play_sound_at_player(SOUND_DUST_OFF, 0); + suggest_player_anim_setUnkFlag(ANIM_Mario_DustOff); + playerStatus->actionSubstate = SUBSTATE_DUST_OFF; playerStatus->currentStateTime = 15; playerStatus->currentSpeed = 0.0f; playerStatus->position.y = posY; } break; } - case 2: - playerStatus->currentSpeed += D_802B678C; + case SUBSTATE_LAUNCH: + playerStatus->currentSpeed += SlideLaunchSpeed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; } playerStatus->gravityIntegrator[0] += playerStatus->gravityIntegrator[1]; playerStatus->position.y += playerStatus->gravityIntegrator[0]; if (playerStatus->gravityIntegrator[0] <= 0.0f) { - playerStatus->fallState = 3; - playerStatus->gravityIntegrator[0] = 0.1143f; - playerStatus->gravityIntegrator[1] = -0.2871f; - playerStatus->gravityIntegrator[2] = -0.1823f; - playerStatus->gravityIntegrator[3] = 0.01152f; + playerStatus->actionSubstate = SUBSTATE_FALL; + LOAD_INTEGRATOR_FALL(playerStatus->gravityIntegrator); } break; - case 3: - playerStatus->currentSpeed += D_802B678C; + case SUBSTATE_FALL: + playerStatus->currentSpeed += SlideLaunchSpeed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; } playerStatus->position.y = player_check_collision_below(func_800E34D8(), &hitID); if (hitID >= 0) { - D_802B678C = -1; - suggest_player_anim_setUnkFlag(0x80003); + SlideLaunchSpeed = -1; + suggest_player_anim_setUnkFlag(ANIM_Mario_80003); sfx_play_sound_at_player(SOUND_162, 0); - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_CRASH } break; - case 4: - playerStatus->currentSpeed += D_802B678C; + case SUBSTATE_CRASH: + playerStatus->currentSpeed += SlideLaunchSpeed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; } if (playerStatus->unk_BC != 0) { - suggest_player_anim_setUnkFlag(0x10030); - playerStatus->fallState++; + suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp); + playerStatus->actionSubstate++; // SUBSTATE_GET_UP } break; - case 5: - playerStatus->currentSpeed += D_802B678C; + case SUBSTATE_GET_UP: + playerStatus->currentSpeed += SlideLaunchSpeed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; } if (playerStatus->unk_BC != 0) { - suggest_player_anim_setUnkFlag(0x10031); - sfx_play_sound_at_player(SOUND_172, 0); + suggest_player_anim_setUnkFlag(ANIM_Mario_DustOff); + sfx_play_sound_at_player(SOUND_DUST_OFF, 0); playerStatus->currentStateTime = 15; - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DUST_OFF } break; - case 6: - playerStatus->currentSpeed += D_802B678C; + case SUBSTATE_DUST_OFF: + playerStatus->currentSpeed += SlideLaunchSpeed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; } if (--playerStatus->currentStateTime == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE } break; - case 7: - tempCurrentSpeed = playerStatus->currentSpeed / 3.0f; - if (tempCurrentSpeed < 0.01) { + case SUBSTATE_DONE: + speed = playerStatus->currentSpeed / 3.0f; + if (speed < 0.01) { playerStatus->currentSpeed = 0.0f; } - playerStatus->currentSpeed -= tempCurrentSpeed; + playerStatus->currentSpeed -= speed; if (playerStatus->currentSpeed <= 0.0f) { playerStatus->currentSpeed = 0.0f; set_action_state(ACTION_STATE_IDLE); diff --git a/src/world/action/sneaky_parasol.c b/src/world/action/sneaky_parasol.c index e94e20a051..933ae541f0 100644 --- a/src/world/action/sneaky_parasol.c +++ b/src/world/action/sneaky_parasol.c @@ -40,7 +40,7 @@ Npc* func_802B6000_E2A6B0(void) { } while (0); } -void func_802B6120_E2A7D0(void) { +void action_update_parasol(void) { PlayerStatus* playerStatus = &gPlayerStatus; SneakyParasolUnk* parasolStruct = &D_802B6E80; Camera* cam = &gCameras[gCurrentCameraID]; @@ -78,13 +78,13 @@ void func_802B6120_E2A7D0(void) { phi_f4 = 2; } *tempUnk_1C = phi_f4; - if (!(playerStatus->animFlags & 0x2000)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { playerStatus->currentStateTime = 20; - playerStatus->fallState = 0; + playerStatus->actionSubstate = 0; parasolStruct->unk_08 = 0xF; parasolStruct->npc = func_802B6000_E2A6B0(); } else { - playerStatus->fallState = 0x14; + playerStatus->actionSubstate = 0x14; playerStatus->currentStateTime = 40; parasolStruct->unk_04 = 1; parasolStruct->unk_0C = 0xC; @@ -95,26 +95,26 @@ void func_802B6120_E2A7D0(void) { } } - switch (playerStatus->fallState) { + switch (playerStatus->actionSubstate) { case 0: - if (playerStatus->unk_90[CAM_DEFAULT] == 0) { + if (playerStatus->flipYaw[CAM_DEFAULT] == 0) { if (peach_disguise_check_overlaps() < 0) { - suggest_player_anim_clearUnkFlag(0xC0024); + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0024); sfx_play_sound_at_player(SOUND_92, 0); - playerStatus->fallState++; + playerStatus->actionSubstate++; } else { - suggest_player_anim_clearUnkFlag(0xC0027); - playerStatus->fallState = 0x32; + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0027); + playerStatus->actionSubstate = 0x32; playerStatus->currentStateTime = 10; parasolStruct->unk_08 = 0; } } case 1: if (--playerStatus->currentStateTime == 0) { - suggest_player_anim_clearUnkFlag(0xC0025); - playerStatus->fallState = 2; + suggest_player_anim_clearUnkFlag(ANIM_Peach_C0025); + playerStatus->actionSubstate = 2; if (parasolStruct->npc == NULL) { - playerStatus->fallState = 0x28; + playerStatus->actionSubstate = 0x28; } else { set_time_freeze_mode(TIME_FREEZE_FULL); } @@ -124,7 +124,7 @@ void func_802B6120_E2A7D0(void) { if (playerStatus->unk_BC != 0) { playerStatus->currentStateTime = 12; playerStatus->flags |= 0x100000; - playerStatus->fallState++; + playerStatus->actionSubstate++; sfx_play_sound_at_player(SOUND_FD, 0); } break; @@ -132,7 +132,7 @@ void func_802B6120_E2A7D0(void) { if (--playerStatus->currentStateTime == 0) { playerStatus->currentStateTime = 10; parasolStruct->unk_0C = 0xA; - playerStatus->fallState++; + playerStatus->actionSubstate++; } func_802B6CF0_E2B3A0(); break; @@ -151,10 +151,10 @@ void func_802B6120_E2A7D0(void) { phi_v0 = 1; } if (phi_v0 != 0) { - playerStatus->fallState = 6; + playerStatus->actionSubstate = 6; playerStatus->currentStateTime = 2; if (peach_make_disguise_npc(playerStatus->unk_0D) != 0) { - playerStatus->fallState = 5; + playerStatus->actionSubstate = 5; peach_sync_disguise_npc(); } } @@ -166,10 +166,10 @@ void func_802B6120_E2A7D0(void) { gameStatus = gGameStatusPtr; playerStatus->animFlags |= 0x2000; gameStatus->peachFlags |= 2; - playerStatus->fallState++; + playerStatus->actionSubstate++; case 6: if (--playerStatus->currentStateTime == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; } func_802B6CF0_E2B3A0(); break; @@ -179,7 +179,7 @@ void func_802B6120_E2A7D0(void) { if (parasolStruct->unk_20 <= 0) { parasolStruct->unk_20 = 0; playerStatus->currentStateTime = 10; - playerStatus->fallState++; + playerStatus->actionSubstate++; playerStatus->spriteFacingAngle = 180; temp_v0 = get_npc_by_index(D_8010C96C); temp_v0->isFacingAway = 1; @@ -194,7 +194,7 @@ void func_802B6120_E2A7D0(void) { parasolStruct->unk_20 = 0; playerStatus->currentStateTime = 10; playerStatus->spriteFacingAngle = 0; - playerStatus->fallState++; + playerStatus->actionSubstate++; temp_v0 = get_npc_by_index(D_8010C96C); temp_v0->isFacingAway = 0; temp_f0_3 = clamp_angle((cam->currentYaw - playerStatus->spriteFacingAngle) - 90); @@ -221,7 +221,7 @@ void func_802B6120_E2A7D0(void) { break; case 20: if (--playerStatus->currentStateTime == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; } func_802B6CF0_E2B3A0(); playerStatus->targetYaw = clamp_angle(cam->currentYaw - playerStatus->spriteFacingAngle - 90); @@ -242,7 +242,7 @@ void func_802B6120_E2A7D0(void) { } if (phi_v0_2 != 0) { playerStatus->currentStateTime = 2; - playerStatus->fallState++; + playerStatus->actionSubstate++; gameStatus2 = gGameStatusPtr; playerStatus->animFlags &= -0x2001; gameStatus2->peachFlags &= 0xFD; @@ -257,7 +257,7 @@ void func_802B6120_E2A7D0(void) { break; case 22: if (--playerStatus->currentStateTime == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; } func_802B6CF0_E2B3A0(); break; @@ -267,12 +267,12 @@ void func_802B6120_E2A7D0(void) { if (parasolStruct->unk_20 <= 0) { parasolStruct->unk_20 = 0; playerStatus->currentStateTime = 10; - playerStatus->fallState++; + playerStatus->actionSubstate++; playerStatus->spriteFacingAngle = 180; - D_8010C95C = 1; + PrevPlayerDirection = 1; phi_f12 = (cam->currentYaw - 180) - 90; temp_f0_3 = clamp_angle((cam->currentYaw - 180) - 90); - D_800F7B40 = temp_f0_3; + PrevPlayerCamRelativeYaw = temp_f0_3; playerStatus->currentYaw = temp_f0_3; } } else { @@ -281,11 +281,11 @@ void func_802B6120_E2A7D0(void) { parasolStruct->unk_20 = 0; playerStatus->currentStateTime = 10; playerStatus->spriteFacingAngle = 0; - playerStatus->fallState++; - D_8010C95C = 0; + playerStatus->actionSubstate++; + PrevPlayerDirection = 0; phi_f12 = (cam->currentYaw - 0) - 90; temp_f0_3 = clamp_angle(phi_f12); - D_800F7B40 = temp_f0_3; + PrevPlayerCamRelativeYaw = temp_f0_3; playerStatus->currentYaw = temp_f0_3; } } diff --git a/src/world/action/spin.c b/src/world/action/spin.c index 3a329db373..d8f653463c 100644 --- a/src/world/action/spin.c +++ b/src/world/action/spin.c @@ -6,25 +6,43 @@ extern s32 gSpinHistoryPosY[5]; extern s32 gSpinHistoryPosX[5]; extern s32 gSpinHistoryPosZ[5]; extern s16 gSpinHistoryPosAngle[5]; + void phys_clear_spin_history(void); -void func_802B6000_E25D60(void) { +enum { + SUBSTATE_SPIN_0 = 0, + SUBSTATE_SPIN_1 = 1, + SUBSTATE_SPIN_2 = 2, + SUBSTATE_SPIN_3 = 3, +}; + +enum SpinTypeFlag { + SPIN_TYPE_DEFAULT = 0, + SPIN_TYPE_SPEEDY = 1, + SPIN_TYPE_DIZZY = 2, + SPIN_TYPE_ATTACK = 4, +}; + +void action_update_spin(void) { PlayerSpinState* playerSpinState = &gPlayerSpinState; PlayerStatus* playerStatus = &gPlayerStatus; - f32 sp10, sp14, temp_f24; - s32 phi_s2, phi_s3, phi_s4; - s32 temp_v1_2; - s32 phi_s5 = 0; + f32 angle, magnitude, speedModifier; + s32 spinFlags, nonDizzyFlags; + s32 effectType; + AnimID anim; + s32 firstCall = FALSE; + + // initialization if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_80000); playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_40000; playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_SPINNING; playerStatus->flags |= PLAYER_STATUS_FLAGS_20000; playerStatus->currentStateTime = 0; - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_SPIN_0; playerSpinState->stopSoundTimer = 0; - playerSpinState->hasBufferedSpin = 0; + playerSpinState->hasBufferedSpin = FALSE; playerSpinState->spinDirectionMagnitude = 0.0f; playerSpinState->spinDirection.x = 0.0f; playerSpinState->spinDirection.y = 0.0f; @@ -32,127 +50,128 @@ void func_802B6000_E25D60(void) { playerSpinState->bufferedStickAxis.x = 0; playerSpinState->bufferedStickAxis.y = 0; playerSpinState->spinSoundID = 0; - playerStatus->unk_D8 = NULL; + playerStatus->specialDecorationEffect = NULL; playerSpinState->initialSpinTime = 25; playerSpinState->fullSpeedSpinTime = 15; playerSpinState->spinRate = 40.0f; playerSpinState->speedScale = 2.0f; playerSpinState->frictionScale = 0.5f; - playerSpinState->spinCountdown = playerSpinState->initialSpinTime; //was unk2D access? - phi_s5 = 1; + playerSpinState->spinCountdown = playerSpinState->initialSpinTime; + spinFlags = SPIN_TYPE_DEFAULT; + firstCall = TRUE; if (is_ability_active(ABILITY_SPIN_ATTACK)) { - phi_s2 = 1 << 2; - } else { - phi_s2 = 0; + spinFlags |= SPIN_TYPE_ATTACK; } if (is_ability_active(ABILITY_DIZZY_ATTACK)) { - phi_s2 = phi_s2 | 2; + spinFlags |= SPIN_TYPE_DIZZY; } if (is_ability_active(ABILITY_SPEEDY_SPIN)) { playerSpinState->initialSpinTime = 30; playerSpinState->spinRate = 40.0f; playerSpinState->fullSpeedSpinTime = 20; - playerSpinState->spinCountdown = playerSpinState->initialSpinTime; //was unk2D access? + playerSpinState->spinCountdown = playerSpinState->initialSpinTime; playerSpinState->speedScale = 2.7f; playerSpinState->frictionScale = 0.9f; - phi_s2 |= 1; + spinFlags |= SPIN_TYPE_SPEEDY; } - phi_s4 = -1; - phi_s3 = 0x10010; + effectType = -1; + anim = ANIM_Mario_10010; - if (phi_s2) { - if (phi_s2 & 4) { - phi_s4 = 2; - phi_s3 = 0x10012; - } else if (phi_s2 & 2) { - phi_s4 = 4; - } else if (phi_s2 & 1) { - phi_s4 = 0; - phi_s3 = 0x10011; + if (spinFlags) { + if (spinFlags & SPIN_TYPE_ATTACK) { + effectType = 2; + anim = ANIM_Mario_Flailing; + } else if (spinFlags & SPIN_TYPE_DIZZY) { + effectType = 4; + anim = ANIM_Mario_10010; + } else if (spinFlags & SPIN_TYPE_SPEEDY) { + effectType = 0; + anim = ANIM_Mario_Spinning; } } playerSpinState->spinSoundID = SOUND_2111; - temp_v1_2 = phi_s2 & ~2; + nonDizzyFlags = spinFlags & ~SPIN_TYPE_DIZZY; - if (temp_v1_2 == 4) { + if (nonDizzyFlags == SPIN_TYPE_ATTACK) { playerSpinState->spinSoundID = SOUND_2113; } - if (temp_v1_2 == 1) { + if (nonDizzyFlags == SPIN_TYPE_SPEEDY) { playerSpinState->spinSoundID = SOUND_2112; } - if (temp_v1_2 == 5) { + if (nonDizzyFlags == (SPIN_TYPE_ATTACK | SPIN_TYPE_SPEEDY)) { playerSpinState->spinSoundID = SOUND_2114; } sfx_play_sound_at_player(playerSpinState->spinSoundID, 0); - suggest_player_anim_setUnkFlag(phi_s3); + suggest_player_anim_setUnkFlag(anim); if ((clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw) <= 180.0f)) { playerStatus->spinRate = playerSpinState->spinRate; } else { - phi_s4++; + effectType++; playerStatus->spinRate = -playerSpinState->spinRate; } - if (phi_s2 != 0) { - playerStatus->unk_D8 = fx_46(phi_s4, playerStatus, 1.0f, 1000); + if (spinFlags != 0) { + playerStatus->specialDecorationEffect = fx_46(effectType, playerStatus, 1.0f, 1000); } phys_clear_spin_history(); - player_input_to_move_vector(&sp10, &sp14); - playerStatus->targetYaw = sp10; - playerSpinState->inputMagnitude = sp14; + player_input_to_move_vector(&angle, &magnitude); + playerStatus->targetYaw = angle; + playerSpinState->inputMagnitude = magnitude; } + // update saved position and rotation values for motion blur effect gSpinHistoryPosAngle[gSpinHistoryBufferPos++] = playerStatus->spriteFacingAngle; - - if (gSpinHistoryBufferPos >= 6) { + if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) { gSpinHistoryBufferPos = 0; } - gSpinHistoryPosX[gSpinHistoryBufferPos] = playerStatus->position.x; gSpinHistoryPosY[gSpinHistoryBufferPos] = playerStatus->position.y; gSpinHistoryPosZ[gSpinHistoryBufferPos] = playerStatus->position.z; gSpinHistoryPosAngle[gSpinHistoryBufferPos] = playerStatus->spriteFacingAngle; gSpinHistoryBufferPos++; - - if (gSpinHistoryBufferPos >= 6) { + if (gSpinHistoryBufferPos > ARRAY_COUNT(gSpinHistoryPosX)) { gSpinHistoryBufferPos = 0; } - if (phi_s5 == 0 && (check_input_hammer() || check_input_jump())) { + // check for spin cancel + if (!firstCall && (check_input_hammer() || check_input_jump())) { playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_SPINNING; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000; sfx_stop_sound(playerSpinState->spinSoundID); - player_input_to_move_vector(&sp10, &sp14); - playerStatus->targetYaw = sp10; + player_input_to_move_vector(&angle, &magnitude); + playerStatus->targetYaw = angle; return; } - if (playerSpinState->spinCountdown < 11 && playerStatus->pressedButtons & Z_TRIG) { - playerSpinState->hasBufferedSpin = 1; + // check for buffered next spin + if (playerSpinState->spinCountdown < 11 && playerStatus->pressedButtons & BUTTON_Z) { + playerSpinState->hasBufferedSpin = TRUE; playerSpinState->prevActionState = playerStatus->prevActionState; playerSpinState->bufferedStickAxis.x = playerStatus->stickAxis[0]; playerSpinState->bufferedStickAxis.y = playerStatus->stickAxis[1]; } - if (playerStatus->fallState >= 2) { - playerSpinState->spinDirectionMagnitude = playerSpinState->spinDirectionMagnitude - 1.0f;; + // check for action finished + if (playerStatus->actionSubstate >= SUBSTATE_SPIN_2) { + playerSpinState->spinDirectionMagnitude -= 1.0f; if (playerSpinState->spinDirectionMagnitude < 0.0f) { playerSpinState->spinDirectionMagnitude = 0.0f; } - sp10 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); - playerSpinState->spinDirection.x = sin_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; - playerSpinState->spinDirection.y = -cos_rad((sp10 * TAU) / 360.0f) * playerSpinState->spinDirectionMagnitude; + angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; + playerSpinState->spinDirection.y = -cos_rad((angle * TAU) / 360.0f) * playerSpinState->spinDirectionMagnitude; playerStatus->currentStateTime--; if ((playerStatus->currentStateTime) == 0) { playerSpinState->stopSoundTimer = 4; - set_action_state(0); + set_action_state(ACTION_STATE_IDLE); playerStatus->flags &= ~PLAYER_STATUS_ANIM_FLAGS_20000; playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_SPINNING; sfx_stop_sound(playerSpinState->spinSoundID); @@ -161,36 +180,36 @@ void func_802B6000_E25D60(void) { return; } - if (playerStatus->fallState == 0) { + if (playerStatus->actionSubstate == SUBSTATE_SPIN_0) { if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_40000) { - playerStatus->fallState = 1; + playerStatus->actionSubstate = SUBSTATE_SPIN_1; } else if (gCollisionStatus.pushingAgainstWall >= 0) { playerSpinState->hitWallTime++; if (playerSpinState->hitWallTime >= 10) { - playerStatus->fallState = 1; + playerStatus->actionSubstate = SUBSTATE_SPIN_1; } } } if (!(playerStatus->currentStateTime > playerSpinState->fullSpeedSpinTime)) { - temp_f24 = (playerSpinState->inputMagnitude) ? playerSpinState->speedScale : 0.0f; + speedModifier = (playerSpinState->inputMagnitude) ? playerSpinState->speedScale : 0.0f; playerSpinState->spinDirectionMagnitude = playerSpinState->spinDirectionMagnitude + 0.9; if (playerSpinState->spinDirectionMagnitude > 9.0f) { playerSpinState->spinDirectionMagnitude = 9.0f; } - sp10 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); - playerSpinState->spinDirection.x = sin_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; - playerSpinState->spinDirection.y = -cos_rad(sp10 * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; + angle = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + playerSpinState->spinDirection.x = sin_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; + playerSpinState->spinDirection.y = -cos_rad(angle * TAU / 360.0f) * playerSpinState->spinDirectionMagnitude; } else { - temp_f24 = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale; - if (temp_f24 < 0.1) { - temp_f24 = 0.1f; + speedModifier = playerSpinState->speedScale - (playerStatus->currentStateTime - playerSpinState->fullSpeedSpinTime - 1) * playerSpinState->frictionScale; + if (speedModifier < 0.1) { + speedModifier = 0.1f; } if (playerSpinState->inputMagnitude == 0.0f) { - temp_f24 = 0.0f; + speedModifier = 0.0f; } playerSpinState->spinDirectionMagnitude -= 1.0f; @@ -202,22 +221,22 @@ void func_802B6000_E25D60(void) { playerStatus->currentStateTime++; switch (playerStatus->prevActionState) { - case 0: - player_input_to_move_vector(&sp10, &sp14); + case ACTION_STATE_IDLE: + player_input_to_move_vector(&angle, &magnitude); phys_update_interact_collider(); if (check_input_jump()) { - if (sp14 != 0.0f || playerStatus->targetYaw != sp10) { - playerStatus->targetYaw = sp10; + if (magnitude != 0.0f || playerStatus->targetYaw != angle) { + playerStatus->targetYaw = angle; } } - playerStatus->currentSpeed = (sp14 != 0.0f) ? playerStatus->runSpeed * temp_f24 : 0.0f; + playerStatus->currentSpeed = (magnitude != 0.0f) ? playerStatus->runSpeed * speedModifier : 0.0f; break; - case 1: - case 2: - playerStatus->currentSpeed = playerStatus->runSpeed * temp_f24; + case ACTION_STATE_WALK: + case ACTION_STATE_RUN: + playerStatus->currentSpeed = playerStatus->runSpeed * speedModifier; break; } - if (playerStatus->fallState == 0) { + if (playerStatus->actionSubstate == SUBSTATE_SPIN_0) { playerSpinState->spinCountdown--; if (playerSpinState->spinCountdown > 0) { if (playerStatus->currentStateTime >= 2) { @@ -225,33 +244,33 @@ void func_802B6000_E25D60(void) { } return; } else { - playerStatus->fallState = 1; + playerStatus->actionSubstate = SUBSTATE_SPIN_1; } } - if (playerStatus->fallState == 1) { - sp10 = playerStatus->spriteFacingAngle; - playerStatus->spriteFacingAngle = sp10 + playerStatus->spinRate; + if (playerStatus->actionSubstate == SUBSTATE_SPIN_1) { + angle = playerStatus->spriteFacingAngle; + playerStatus->spriteFacingAngle = angle + playerStatus->spinRate; - if (playerSpinState->hasBufferedSpin != 0) { + if (playerSpinState->hasBufferedSpin) { playerStatus->currentStateTime = 2; - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000; - suggest_player_anim_clearUnkFlag(0x10002); - } else if (sp10 < playerStatus->spriteFacingAngle) { - if (playerStatus->spriteFacingAngle >= 180.0f && sp10 < 180.0f) { + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); + } else if (angle < playerStatus->spriteFacingAngle) { + if (playerStatus->spriteFacingAngle >= 180.0f && angle < 180.0f) { playerStatus->spriteFacingAngle = 180.0f; playerStatus->currentStateTime = 2; - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000; - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } - } else if (playerStatus->spriteFacingAngle <= 0.0f && sp10 < 90.0f) { + } else if (playerStatus->spriteFacingAngle <= 0.0f && angle < 90.0f) { playerStatus->spriteFacingAngle = 0.0f; playerStatus->currentStateTime = 2; - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_SPIN_2; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_20000; - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle); } diff --git a/src/world/action/super_boots.c b/src/world/action/spin_jump.c similarity index 61% rename from src/world/action/super_boots.c rename to src/world/action/spin_jump.c index 172c47166b..8c63f109c0 100644 --- a/src/world/action/super_boots.c +++ b/src/world/action/spin_jump.c @@ -1,40 +1,52 @@ #include "common.h" -extern f32 D_802B6730; +enum { + SUBSTATE_SPIN = 0, + SUBSTATE_RISE = 2, + SUBSTATE_HOVER = 3, + SUBSTATE_DESCEND = 4, + SUBSTATE_IMPACT = 5, + SUBSTATE_HOLD = 6, + SUBSTATE_ABORT = 7, + SUBSTATE_HIT_SWITCH = 11, + SUBSTATE_DONE_SWITCH = 12 +}; -s32 func_802B6648_E27428(void); +static s32 get_collider_below_spin_jump(void); -void func_802B6000_E26DE0(void) { +void action_update_spin_jump(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; - Entity* entity; HiddenPanelsData* panels; - s32 sp10; - s32 tempCondition; - f32 temp_f20; + Entity* entity; + s32 belowColliderID; + s32 landed; + f32 velocity; u32 entityType; - u8 colliderType; + s32 surfaceType; + + static f32 RotationRate; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FALLING); playerStatus->flags |= (PLAYER_STATUS_FLAGS_JUMPING | PLAYER_STATUS_FLAGS_FLYING); - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_SPIN; playerStatus->currentSpeed = 0.0f; - D_802B6730 = 0.0f; + RotationRate = 0.0f; playerStatus->gravityIntegrator[0] = 5.2f; - suggest_player_anim_clearUnkFlag(0x1000A); + suggest_player_anim_clearUnkFlag(ANIM_Mario_1000A); disable_player_input(); playerStatus->flags |= PLAYER_STATUS_FLAGS_200; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; - sfx_play_sound_at_player(SOUND_146, 0); + sfx_play_sound_at_player(SOUND_SPIN_JUMP, 0); } - tempCondition = 0; - switch (playerStatus->fallState) { - case 0: - D_802B6730 = 40.0f; - playerStatus->pitch += 40.0f; + landed = FALSE; + switch (playerStatus->actionSubstate) { + case SUBSTATE_SPIN: + RotationRate = 40.0f; + playerStatus->pitch += RotationRate; if (playerStatus->pitch >= 360.0f) { playerStatus->pitch = 360.0f; } @@ -52,13 +64,13 @@ void func_802B6000_E26DE0(void) { if (playerStatus->pitch == 360.0f) { if (playerStatus->gravityIntegrator[0] <= 0.0f) { playerStatus->currentStateTime = 5; - playerStatus->fallState = 2; + playerStatus->actionSubstate = SUBSTATE_RISE; playerStatus->gravityIntegrator[0] = 2.0f; } } collisionStatus->currentCeiling = -1; break; - case 2: + case SUBSTATE_RISE: if (playerStatus->gravityIntegrator[0] >= 0.0f) { playerStatus->gravityIntegrator[0] -= 1.4; if (collisionStatus->currentCeiling < 0) { @@ -66,65 +78,65 @@ void func_802B6000_E26DE0(void) { } } if (--playerStatus->currentStateTime <= 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; } break; - case 3: - playerStatus->position.y = player_check_collision_below(0.0f, &sp10); - D_802B6730 = 45.0f; - playerStatus->pitch += 45.0f; + case SUBSTATE_HOVER: + playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); + RotationRate = 45.0f; + playerStatus->pitch += RotationRate; if (playerStatus->pitch >= 360.0) { playerStatus->pitch = 0.0f; - playerStatus->fallState++; + playerStatus->actionSubstate++; playerStatus->gravityIntegrator[1] = -3.4744f; playerStatus->gravityIntegrator[2] = 0.4704f; playerStatus->gravityIntegrator[3] = -1.1904f; playerStatus->gravityIntegrator[0] = playerStatus->gravityIntegrator[1]; - suggest_player_anim_clearUnkFlag(0x1000B); + suggest_player_anim_clearUnkFlag(ANIM_Mario_1000B); } break; - case 4: - temp_f20 = func_800E34D8(); - playerStatus->position.y = player_check_collision_below(temp_f20, &sp10); - if (temp_f20 < -100.0f) { + case SUBSTATE_DESCEND: + velocity = func_800E34D8(); + playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID); + if (velocity < -100.0f) { playerStatus->gravityIntegrator[3] = 0.0f; playerStatus->gravityIntegrator[2] = 0.0f; playerStatus->gravityIntegrator[1] = 0.0f; playerStatus->gravityIntegrator[0] = -100.0f; } - if (sp10 >= 0) { + if (belowColliderID >= 0) { if (collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT && (entityType = get_entity_type(collisionStatus->currentFloor), entityType == ENTITY_TYPE_RED_SWITCH || entityType == ENTITY_TYPE_BLUE_SWITCH)) { get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; - playerStatus->fallState = 0xB; + playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; break; } else { - colliderType = get_collider_type_by_id(sp10); - if (colliderType == 3) { - playerStatus->unk_BF = 1; + surfaceType = get_collider_flags(belowColliderID) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + if (surfaceType == SURFACE_TYPE_LAVA) { + playerStatus->hazardType = HAZARD_TYPE_LAVA; set_action_state(ACTION_STATE_HIT_LAVA); playerStatus->flags |= PLAYER_STATUS_FLAGS_800; playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; return; - } else if (colliderType == 2) { - set_action_state(ACTION_STATE_HIT_LAVA); - playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; - return; + } else if (surfaceType == SURFACE_TYPE_SPIKES) { + set_action_state(ACTION_STATE_HIT_LAVA); + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_FLYING; + return; } else { playerStatus->gravityIntegrator[1] = -3.4744f; playerStatus->gravityIntegrator[2] = 0.4704f; playerStatus->gravityIntegrator[3] = -1.1904f; playerStatus->gravityIntegrator[0] = 10.0f; - suggest_player_anim_clearUnkFlag(0x1000B); - playerStatus->actionState = ACTION_STATE_GROUND_POUND; + suggest_player_anim_clearUnkFlag(ANIM_Mario_1000B); + playerStatus->actionState = ACTION_STATE_SPIN_POUND; playerStatus->timeInAir = 0; - playerStatus->unk_280 = 0xC; + playerStatus->poundImpactDelay = 12; playerStatus->pitch = 0.0f; - playerStatus->fallState++; + playerStatus->actionSubstate++; exec_ShakeCam1(0, 0, 4); sfx_play_sound_at_player(SOUND_149, 0); - start_rumble(0x80, 0x19); + start_rumble(128, 25); panels = &gCurrentHiddenPanels; panels->tryFlipTrigger = TRUE; panels->flipTriggerPosY = playerStatus->position.y; @@ -133,70 +145,65 @@ void func_802B6000_E26DE0(void) { } } break; - case 5: - temp_f20 = integrate_gravity(); - if (temp_f20 == 0.0f) { - tempCondition = 1; + case SUBSTATE_IMPACT: + velocity = integrate_gravity(); + if (velocity == 0.0f) { + landed = TRUE; } else { if (playerStatus->gravityIntegrator[0] > 0.0f) { - playerStatus->position.y += temp_f20; + playerStatus->position.y += velocity; } else { - playerStatus->position.y = player_check_collision_below(temp_f20, &sp10); - if (playerStatus->gravityIntegrator[0] < 0.0f && sp10 >= 0) { - playerStatus->fallState++; + playerStatus->position.y = player_check_collision_below(velocity, &belowColliderID); + if (playerStatus->gravityIntegrator[0] < 0.0f && belowColliderID >= 0) { + playerStatus->actionSubstate++; } } - playerStatus->position.y = player_check_collision_below(0.0f, &sp10); + playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); } break; - case 6: - playerStatus->position.y = player_check_collision_below(0.0f, &sp10); - if (sp10 >= 0) { + case SUBSTATE_HOLD: + playerStatus->position.y = player_check_collision_below(0.0f, &belowColliderID); + if (belowColliderID >= 0) { playerStatus->gravityIntegrator[0] = 0.0f; playerStatus->gravityIntegrator[1] = 0.0f; playerStatus->gravityIntegrator[2] = 0.0f; playerStatus->gravityIntegrator[3] = 0.0f; } - case 7: - if (--playerStatus->unk_280 <= 0) { - tempCondition = 1; + // fallthrough + case SUBSTATE_ABORT: + if (--playerStatus->poundImpactDelay <= 0) { + landed = TRUE; } break; - case 11: + case SUBSTATE_HIT_SWITCH: set_action_state(ACTION_STATE_LANDING_ON_SWITCH); - playerStatus->fallState++; + playerStatus->actionSubstate++; enable_player_input(); break; - case 12: + case SUBSTATE_DONE_SWITCH: break; } - if (tempCondition != 0) { + if (landed) { set_action_state(ACTION_STATE_LAND); - playerStatus->flags &= ~0x8; + playerStatus->flags &= ~PLAYER_STATUS_ANIM_FLAGS_8; } if (playerStatus->gravityIntegrator[0] < 0.0f) { - sp10 = func_802B6648_E27428(); - if (sp10 >= 0) { + belowColliderID = get_collider_below_spin_jump(); + if (belowColliderID >= 0) { collisionStatus->lastTouchedFloor = -1; - collisionStatus->currentFloor = sp10; + collisionStatus->currentFloor = belowColliderID; } } } -s32 func_802B6648_E27428(void) { - f32 sp28; - f32 sp2C; - f32 sp30; - f32 sp34; - f32 sp38; - f32 sp3C; - f32 sp40; - f32 sp44; +static s32 get_collider_below_spin_jump(void) { + f32 posX, posY, posZ, height; + f32 hitRx, hitRz, hitDirX, hitDirZ; - sp28 = gPlayerStatus.position.x; - sp34 = gPlayerStatus.colliderHeight; - sp30 = gPlayerStatus.position.z; - sp2C = gPlayerStatus.position.y + (sp34 * 0.5f); - return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44); + posX = gPlayerStatus.position.x; + posZ = gPlayerStatus.position.z; + height = gPlayerStatus.colliderHeight; + posY = gPlayerStatus.position.y + (height * 0.5f); + return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } diff --git a/src/world/action/18.c b/src/world/action/step_up.c similarity index 56% rename from src/world/action/18.c rename to src/world/action/step_up.c index 1ec3515fab..c6bbda3840 100644 --- a/src/world/action/18.c +++ b/src/world/action/step_up.c @@ -1,51 +1,50 @@ #include "common.h" #include "world/actions.h" -s32 State18PeachAnims[] = { - 0x000A0002, // none - 0x000A002B, // cream - 0x000A002D, // strawberry - 0x000A002F, // butter - 0x000A0031, // cleanser - 0x000A0033, // water - 0x000A0035, // milk - 0x000A0037, // flour - 0x000A0039, // egg - 0x000A003B, // complete cake - 0x000A003D, // cake bowl - 0x000A003F, // cake mixed - 0x000A0041, // cake pan - 0x000A0043, // cake batter - 0x000A0045, // cake bare - 0x000A0047, // salt - 0x000A0049, // sugar - 0x000A004B, // cake with icing - 0x000A004D, // cake with berries +AnimID StepUpPeachAnims[] = { + ANIM_Peach_A0002, // none + ANIM_Peach_A002B, // cream + ANIM_Peach_A002D, // strawberry + ANIM_Peach_A002F, // butter + ANIM_Peach_A0031, // cleanser + ANIM_Peach_A0033, // water + ANIM_Peach_A0035, // milk + ANIM_Peach_A0037, // flour + ANIM_Peach_A0039, // egg + ANIM_Peach_A003B, // complete cake + ANIM_Peach_A003D, // cake bowl + ANIM_Peach_A003F, // cake mixed + ANIM_Peach_A0041, // cake pan + ANIM_Peach_A0043, // cake batter + ANIM_Peach_A0045, // cake bare + ANIM_Peach_A0047, // salt + ANIM_Peach_A0049, // sugar + ANIM_Peach_A004B, // cake with icing + ANIM_Peach_A004D, // cake with berries 0x00000000 }; -void func_802B6000_E245D0(void) { +void action_update_step_up(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 cosTheta; f32 sinTheta; s32 colliderID; + AnimID anim; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; phys_adjust_cam_on_landing(); - if (!(playerStatus->animFlags & 0x1000)) { - s32 temp; - - if (!(playerStatus->animFlags & 1)) { - temp = 0x10004; + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS)) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { + anim = ANIM_Mario_Walking; } else { - temp = 0x60000; + anim = ANIM_Mario_60000; } - suggest_player_anim_clearUnkFlag(temp); + suggest_player_anim_clearUnkFlag(anim); } else { func_802B6198_E24768(); } - playerStatus->fallState = 0; + playerStatus->actionSubstate = 0; playerStatus->timeInAir = 0; playerStatus->unk_C2 = 0; playerStatus->gravityIntegrator[0] = 17.7566f; @@ -76,23 +75,23 @@ void func_802B6000_E245D0(void) { } void func_802B6198_E24768(void) { - if (!(gPlayerStatus.animFlags & 0x2000)) { - if (!(gGameStatusPtr->peachFlags & 0x10)) { - suggest_player_anim_clearUnkFlag((State18PeachAnims)[gGameStatusPtr->peachCookingIngredient]); + if (!(gPlayerStatus.animFlags & PLAYER_STATUS_ANIM_FLAGS_IN_DISGUISE)) { + if (!(gGameStatusPtr->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) { + suggest_player_anim_clearUnkFlag((StepUpPeachAnims)[gGameStatusPtr->peachCookingIngredient]); } else { - suggest_player_anim_clearUnkFlag(0xD000D); // doood + suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D); } } else { peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk); } } -void func_802B6230_E24800(void) { +void action_update_step_up_peach(void) { PlayerStatus* playerStatus = &gPlayerStatus; if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; - suggest_player_anim_clearUnkFlag(0xA0005); + suggest_player_anim_clearUnkFlag(ANIM_Peach_A0005); playerStatus->currentStateTime = 8; } @@ -102,12 +101,12 @@ void func_802B6230_E24800(void) { try_player_footstep_sounds(1); } } else { - if (!(playerStatus->flags & 0x4000)) { - set_action_state(0); + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_4000)) { + set_action_state(ACTION_STATE_IDLE); } else if (playerStatus->currentSpeed >= playerStatus->runSpeed) { - set_action_state(2); + set_action_state(ACTION_STATE_RUN); } else { - set_action_state(1); + set_action_state(ACTION_STATE_WALK); } } } diff --git a/src/world/action/ultra_boots.c b/src/world/action/tornado_jump.c similarity index 72% rename from src/world/action/ultra_boots.c rename to src/world/action/tornado_jump.c index 0e6985b0c3..0ee63a355d 100644 --- a/src/world/action/ultra_boots.c +++ b/src/world/action/tornado_jump.c @@ -4,15 +4,27 @@ extern s32 gSpinHistoryBufferPos; extern s32 gSpinHistoryPosY[5]; extern s16 gSpinHistoryPosAngle[5]; -s32 func_802B65F8_E26D08(void); +void phys_clear_spin_history(void); +void record_jump_apex(void); -void func_802B6000_E26710(void) { +enum { + SUBSTATE_ASCEND = 0, + SUBSTATE_HOVER = 1, + SUBSTATE_DESCEND = 2, + SUBSTATE_IMPACT = 3, + SUBSTATE_HIT_SWITCH = 11, + SUBSTATE_DONE_SWITCH = 12, +}; + +static s32 get_collider_below_tornado_jump(void); + +void action_update_tornado_jump(void) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; - f32 temp_f0; + f32 cameraRelativeYaw; f32 fallVelocity; - u8 colliderType; - f32 phi_f4; + s32 surfaceType; + f32 spinRate; s32 colliderBelow; u32 entityType; @@ -20,24 +32,25 @@ void func_802B6000_E26710(void) { playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; playerStatus->flags |= (PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING | PLAYER_STATUS_FLAGS_JUMPING); phys_clear_spin_history(); - playerStatus->fallState = 0; + playerStatus->actionSubstate = SUBSTATE_ASCEND; playerStatus->currentSpeed = 0.0f; playerStatus->gravityIntegrator[0] = 16.0f; playerStatus->gravityIntegrator[1] = -7.38624f; playerStatus->gravityIntegrator[2] = 3.44694f; playerStatus->gravityIntegrator[3] = -0.75f; - suggest_player_anim_setUnkFlag(0x80000); + suggest_player_anim_setUnkFlag(ANIM_Mario_80000); disable_player_input(); - playerStatus->flags |= 0x200; + playerStatus->flags |= PLAYER_STATUS_FLAGS_200; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_MOVE_FLAGS_1; - temp_f0 = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); - phi_f4 = -60.0f; - if (temp_f0 <= 180.0f) { - phi_f4 = 60.0f; + cameraRelativeYaw = clamp_angle(playerStatus->targetYaw - gCameras[gCurrentCameraID].currentYaw); + if (cameraRelativeYaw <= 180.0f) { + spinRate = 60.0f; + } else { + spinRate = -60.0f; } - playerStatus->spinRate = phi_f4; + playerStatus->spinRate = spinRate; } - if (playerStatus->fallState < 4) { + if (playerStatus->actionSubstate <= SUBSTATE_IMPACT) { if (playerStatus->spinRate >= 0.0f) { playerStatus->spriteFacingAngle += playerStatus->spinRate; if (playerStatus->spriteFacingAngle >= 360.0f) { @@ -60,8 +73,8 @@ void func_802B6000_E26710(void) { gSpinHistoryBufferPos = 0; } - switch (playerStatus->fallState) { - case 0: + switch (playerStatus->actionSubstate) { + case SUBSTATE_ASCEND: fallVelocity = integrate_gravity(); playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow); if (colliderBelow >= 0 && collisionStatus->currentFloor & COLLISION_WITH_ENTITY_BIT ) { @@ -69,7 +82,7 @@ void func_802B6000_E26710(void) { if (entityType == ENTITY_TYPE_BLUE_SWITCH || entityType == ENTITY_TYPE_RED_SWITCH) { get_entity_by_index(collisionStatus->currentFloor)->collisionFlags |= ENTITY_COLLISION_PLAYER_TOUCH_FLOOR; disable_player_input(); - playerStatus->fallState = 0xB; + playerStatus->actionSubstate = SUBSTATE_HIT_SWITCH; break; } } @@ -77,7 +90,7 @@ void func_802B6000_E26710(void) { record_jump_apex(); playerStatus->currentStateTime = 3; playerStatus->flags |= PLAYER_STATUS_FLAGS_FALLING; - playerStatus->fallState++; + playerStatus->actionSubstate++; sfx_play_sound_at_player(SOUND_TORNADO_JUMP, 0); } if (colliderBelow >= 0) { @@ -85,12 +98,12 @@ void func_802B6000_E26710(void) { set_action_state(ACTION_STATE_LAND); } break; - case 1: + case SUBSTATE_HOVER: if (--playerStatus->currentStateTime <= 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; } break; - case 2: + case SUBSTATE_DESCEND: fallVelocity = integrate_gravity(); playerStatus->position.y = player_check_collision_below(fallVelocity, &colliderBelow); if (fallVelocity < -100.0f) { @@ -120,22 +133,22 @@ void func_802B6000_E26710(void) { } } - colliderType = get_collider_type_by_id(colliderBelow); - if (colliderType == 3) { - playerStatus->unk_BF = 1; + surfaceType = get_collider_flags(colliderBelow) & COLLIDER_FLAGS_SURFACE_TYPE_MASK; + if (surfaceType == SURFACE_TYPE_LAVA) { + playerStatus->hazardType = HAZARD_TYPE_LAVA; playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING); set_action_state(ACTION_STATE_HIT_LAVA); playerStatus->flags |= PLAYER_STATUS_FLAGS_800; return; - } else if (colliderType == 2) { + } else if (surfaceType == SURFACE_TYPE_SPIKES) { set_action_state(ACTION_STATE_HIT_LAVA); playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING); return; } playerStatus->currentStateTime = 8; playerStatus->timeInAir = 0; - playerStatus->actionState = ACTION_STATE_ULTRA_POUND; - playerStatus->fallState++; + playerStatus->actionState = ACTION_STATE_TORNADO_POUND; + playerStatus->actionSubstate++; exec_ShakeCam1(0, 0, 4); sfx_play_sound_at_player(SOUND_14A, 0); start_rumble(256, 50); @@ -145,24 +158,24 @@ void func_802B6000_E26710(void) { playerStatus->flags |= PLAYER_STATUS_FLAGS_400; } break; - case 3: + case SUBSTATE_IMPACT: if (--playerStatus->currentStateTime == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_20000 | PLAYER_STATUS_FLAGS_FLYING); set_action_state(ACTION_STATE_LAND); } break; - case 11: + case SUBSTATE_HIT_SWITCH: set_action_state(ACTION_STATE_LANDING_ON_SWITCH); - playerStatus->fallState++; + playerStatus->actionSubstate++; enable_player_input(); break; - case 12: + case SUBSTATE_DONE_SWITCH: break; } if (playerStatus->gravityIntegrator[0] < 0.0f) { - colliderBelow = func_802B65F8_E26D08(); + colliderBelow = get_collider_below_tornado_jump(); if (colliderBelow >= 0) { collisionStatus->lastTouchedFloor = -1; collisionStatus->currentFloor = colliderBelow; @@ -170,19 +183,13 @@ void func_802B6000_E26710(void) { } } -s32 func_802B65F8_E26D08(void) { - f32 sp28; - f32 sp2C; - f32 sp30; - f32 sp34; - f32 sp38; - f32 sp3C; - f32 sp40; - f32 sp44; +static s32 get_collider_below_tornado_jump(void) { + f32 posX, posY, posZ, height; + f32 hitRx, hitRz, hitDirX, hitDirZ; - sp28 = gPlayerStatus.position.x; - sp34 = gPlayerStatus.colliderHeight; - sp30 = gPlayerStatus.position.z; - sp2C = gPlayerStatus.position.y + (sp34 * 0.5f); - return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44); + posX = gPlayerStatus.position.x; + posZ = gPlayerStatus.position.z; + height = gPlayerStatus.colliderHeight; + posY = gPlayerStatus.position.y + (height * 0.5f); + return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } diff --git a/src/world/action/use_munchlesia.c b/src/world/action/use_munchlesia.c index a484548836..d6927dc56a 100644 --- a/src/world/action/use_munchlesia.c +++ b/src/world/action/use_munchlesia.c @@ -1,71 +1,79 @@ #include "common.h" -extern f32 D_802B62D0; -extern f32 D_802B62D4; -extern f32 D_802B62D8; -extern f32 D_802B62DC; +extern f32 Munchlesia_LaunchVelocity; +extern f32 Munchlesia_LateralVelocity; +extern f32 Munchlesia_LaunchAccel; +extern f32 Munchlesia_LaunchYaw; extern s32 D_802B62E0; -void func_802B6000_E291A0(void) { - PlayerStatus* playerStatus = &gPlayerStatus; - s32 sp10; - f32 tempCollision; +enum { + SUBSTATE_INIT = 0, + SUBSTATE_EJECT = 1, + SUBSTATE_FALL = 2, + SUBSTATE_CRASH = 3, + SUBSTATE_GET_UP = 5, +}; - if (playerStatus->flags & (1 << 31)) { - playerStatus->flags &= ~0x80000000; - playerStatus->fallState = 0; +void action_update_use_munchlesia(void) { + PlayerStatus* playerStatus = &gPlayerStatus; + s32 colliderID; + f32 hitPosY; + + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; + playerStatus->actionSubstate = SUBSTATE_INIT; gOverrideFlags |= GLOBAL_OVERRIDES_40; disable_player_static_collisions(); disable_player_input(); } - switch (playerStatus->fallState) { - case 0: - suggest_player_anim_clearUnkFlag(0x1002E); - D_802B62E0 = 0x20; - D_802B62D0 = 16.0f; - D_802B62D4 = 4.0f; - D_802B62D8 = 1.0f; - D_802B62D4 = 1.875f; - playerStatus->fallState++; - D_802B62DC = playerStatus->targetYaw; + switch (playerStatus->actionSubstate) { + case SUBSTATE_INIT: + suggest_player_anim_clearUnkFlag(ANIM_Mario_1002E); + D_802B62E0 = 32; + Munchlesia_LaunchVelocity = 16.0f; + Munchlesia_LateralVelocity = 4.0f; + Munchlesia_LaunchAccel = 1.0f; + Munchlesia_LateralVelocity = 1.875f; + playerStatus->actionSubstate++; // SUBSTATE_EJECT + Munchlesia_LaunchYaw = playerStatus->targetYaw; break; - case 1: - playerStatus->position.y += D_802B62D0; - D_802B62D0 -= D_802B62D8; - add_vec2D_polar(&playerStatus->position, &playerStatus->position.z, D_802B62D4, D_802B62DC); + case SUBSTATE_EJECT: + playerStatus->position.y += Munchlesia_LaunchVelocity; + Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel; + add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); 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_802B62D0 <= 0.0f) { - playerStatus->fallState++; + if (Munchlesia_LaunchVelocity <= 0.0f) { + playerStatus->actionSubstate++; // SUBSTATE_FALL } break; - case 2: - playerStatus->position.y += D_802B62D0; - D_802B62D0 -= D_802B62D8; - add_vec2D_polar(&playerStatus->position, &playerStatus->position.z, D_802B62D4, D_802B62DC); + case SUBSTATE_FALL: + playerStatus->position.y += Munchlesia_LaunchVelocity; + Munchlesia_LaunchVelocity -= Munchlesia_LaunchAccel; + add_vec2D_polar(&playerStatus->position.x, &playerStatus->position.z, Munchlesia_LateralVelocity, Munchlesia_LaunchYaw); gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - tempCollision = player_check_collision_below(D_802B62D0, &sp10); - if (sp10 >= 0) { + hitPosY = player_check_collision_below(Munchlesia_LaunchVelocity, &colliderID); + if (colliderID >= 0) { sfx_play_sound_at_player(SOUND_162, 0); - suggest_player_anim_setUnkFlag(0x80003); - playerStatus->position.y = tempCollision; - D_802B62E0 = 0xA; - playerStatus->fallState++; + suggest_player_anim_setUnkFlag(ANIM_Mario_80003); + playerStatus->position.y = hitPosY; + D_802B62E0 = 10; + playerStatus->actionSubstate++; // SUBSTATE_CRASH } break; - case 3: + case SUBSTATE_CRASH: if (playerStatus->unk_BC != 0) { - suggest_player_anim_setUnkFlag(0x10030); - playerStatus->fallState = 5; + suggest_player_anim_setUnkFlag(ANIM_Mario_GetUp); + playerStatus->actionSubstate = SUBSTATE_GET_UP; playerStatus->currentStateTime = 15; break; } break; - case 5: + case SUBSTATE_GET_UP: if (playerStatus->currentStateTime != 0) { playerStatus->currentStateTime--; break; diff --git a/src/world/action/use_spinning_flower.c b/src/world/action/use_spinning_flower.c index 860ef34c40..a45905c57d 100644 --- a/src/world/action/use_spinning_flower.c +++ b/src/world/action/use_spinning_flower.c @@ -1,54 +1,58 @@ #include "common.h" -extern s32 D_802B6ED0; // some entity index +extern s32 SpinningFlower_EntityIndex; extern f32 D_802B6ED4; extern f32 D_802B6ED8; extern f32 D_802B6EDC; extern f32 D_802B6EE0; extern f32 D_802B6EE4; extern f32 D_802B6EE8; -extern f32 D_802B6EEC; +extern f32 SpinningFlower_AngleToCenter; extern f32 D_802B6EF0; extern f32 D_802B6EF4; extern s16 D_802BCE30; extern s16 D_802BCE32; extern s16 D_802BCE34; -s32 func_802B6000_E29470(void) { - f32 sp28; - f32 sp2C; - f32 sp30; - f32 sp34; - f32 sp38; - f32 sp3C; - f32 sp40; - f32 sp44; +enum { + SUBSTATE_ATTRACT = 1, + SUBSTATE_EJECT = 2, + SUBSTATE_SPIN_UP = 3, + SUBSTATE_ASCEND_A = 4, + SUBSTATE_ASCEND_B = 5, + SUBSTATE_BOOST = 10, + SUBSTATE_FINISH = 11, +}; - sp28 = gPlayerStatus.position.x; - sp34 = gPlayerStatus.colliderHeight; - sp30 = gPlayerStatus.position.z; - sp2C = gPlayerStatus.position.y + (sp34 * 0.5); - return player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44); +static s32 get_entity_below_spinning_flower(void) { + f32 posX, posY, posZ, height; + f32 hitRx, hitRz, hitDirX, hitDirZ; + + posX = gPlayerStatus.position.x; + posZ = gPlayerStatus.position.z; + height = gPlayerStatus.colliderHeight; + posY = gPlayerStatus.position.y + (height * 0.5); + return player_raycast_below_cam_relative(&gPlayerStatus, &posX, &posY, &posZ, &height, &hitRx, &hitRz, &hitDirX, &hitDirZ); } -void func_802B60A4_E29514(void) { +void action_update_use_spinning_flower(void) { PlayerStatus* playerStatus = &gPlayerStatus; Entity* entityByIndex; s32* TempPointer; - s32 sp20; - f32 sp1C; - f32 sp18; - f32 sp14; - f32 sp10; - f32 tempY; - f32 tempDistance; + s32 entityID; + f32 inputMagnitude; + f32 inputAngle; + f32 dz; + f32 dx; + f32 ascentVelocity; + f32 distToCenter; s8 switchCondition; - if (playerStatus->flags & (1 << 31)) { - playerStatus->flags &= ~0x80000000; + if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED; gOverrideFlags |= GLOBAL_OVERRIDES_40; func_800EF300(); - playerStatus->fallState = 1; + playerStatus->actionSubstate = SUBSTATE_ATTRACT; playerStatus->currentStateTime = 0; D_802B6EE4 = 0.0f; D_802B6EE8 = 0.0f; @@ -56,27 +60,29 @@ void func_802B60A4_E29514(void) { D_802B6EDC = 3.0f; disable_player_static_collisions(); disable_player_input(); - playerStatus->flags |= 0x100000; - sp20 = gCollisionStatus.currentFloor; + playerStatus->flags |= PLAYER_STATUS_FLAGS_100000; + entityID = gCollisionStatus.currentFloor; - TempPointer = &D_802B6ED0; - if (sp20 >= 0){ - if (!(sp20 & COLLISION_WITH_ENTITY_BIT)) { - D_802B6ED0 = -1; + TempPointer = &SpinningFlower_EntityIndex; + if (entityID >= 0){ + if (!(entityID & COLLISION_WITH_ENTITY_BIT)) { + SpinningFlower_EntityIndex = -1; } else { - D_802B6ED0 = sp20 & 0x3FF; + SpinningFlower_EntityIndex = entityID & 0x3FF; } } else { - D_802B6ED0 = -1; + SpinningFlower_EntityIndex = -1; } if (!(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - suggest_player_anim_clearUnkFlag(0x1002B); + suggest_player_anim_clearUnkFlag(ANIM_Mario_1002B); } } - switch (playerStatus->fallState) { - case 1: + + switch (playerStatus->actionSubstate) { + case SUBSTATE_ATTRACT: gOverrideFlags |= GLOBAL_OVERRIDES_40; - if (++D_802B6EE4 >= 20.0f) { + D_802B6EE4 += 1.0f; + if (D_802B6EE4 >= 20.0f) { D_802B6EE4 = 20.0f; } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); @@ -86,72 +92,73 @@ void func_802B60A4_E29514(void) { } D_802B6EE8 += 8.0f; playerStatus->position.y = D_802B6EF4 + sin_rad(clamp_angle(D_802B6EE8) * TAU / 360.0f) * 4.0f; - if (D_802B6ED0 >= 0) { - entityByIndex = get_entity_by_index(D_802B6ED0); - tempDistance = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - D_802B6EEC = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - if (tempDistance > 4.0f) { - tempDistance--; + if (SpinningFlower_EntityIndex >= 0) { + entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex); + distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + if (distToCenter > 4.0f) { + distToCenter--; } - sin_cos_rad(D_802B6EEC * TAU / 360.0f, &sp10, &sp14); - playerStatus->position.x = entityByIndex->position.x + (sp10 * tempDistance); - playerStatus->position.z = entityByIndex->position.z - (sp14 * tempDistance); - sin_cos_rad((D_802B6EEC - 91.0f) * TAU / 360.0f, &sp10, &sp14); - D_802B6ED4 = sp10 * D_802B6EDC; - D_802B6ED8 = -sp14 * D_802B6EDC; + sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz); + playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter); + playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter); + sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz); + D_802B6ED4 = dx * D_802B6EDC; + D_802B6ED8 = -dz * D_802B6EDC; } - game_input_to_move_vector(&sp18, &sp1C); - if (sp1C != 0.0f) { - sin_cos_rad((sp18 * TAU) / 360.0f, &sp10, &sp14); - sp1C *= 0.03125f; - if (sp1C < 0.1) { - sp1C = 0.1f; + game_input_to_move_vector(&inputAngle, &inputMagnitude); + if (inputMagnitude != 0.0f) { + sin_cos_rad((inputAngle * TAU) / 360.0f, &dx, &dz); + inputMagnitude *= 0.03125f; + if (inputMagnitude < 0.1) { + inputMagnitude = 0.1f; } - playerStatus->position.x += sp10 * sp1C; - playerStatus->position.z -= sp14 * sp1C; + playerStatus->position.x += dx * inputMagnitude; + playerStatus->position.z -= dz * inputMagnitude; } gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - sp20 = func_802B6000_E29470(); - if (sp20 < 0 || !(sp20 & COLLISION_WITH_ENTITY_BIT)) { + entityID = get_entity_below_spinning_flower(); + if (entityID < 0 || !(entityID & COLLISION_WITH_ENTITY_BIT)) { playerStatus->currentStateTime = 20; D_802B6EE8 = 0.0f; D_802B6EF4 = playerStatus->position.y; - playerStatus->fallState++; + playerStatus->actionSubstate++; D_802B6EF0 = 1.6f; - playerStatus->flags |= 0x800000; + playerStatus->flags |= PLAYER_STATUS_FLAGS_800000; } - if (gGameStatusPtr->pressedButtons[0] & BUTTON_Z && !(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { - suggest_player_anim_setUnkFlag(0x10007); - playerStatus->fallState = 3; + if (gGameStatusPtr->pressedButtons[0] & BUTTON_Z && + !(playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2))) { + suggest_player_anim_setUnkFlag(ANIM_Mario_AnimMidairStill); + playerStatus->actionSubstate = SUBSTATE_SPIN_UP; playerStatus->currentStateTime = 30; D_802B6EE0 = 0.0f; gCollisionStatus.currentFloor = -1; - exec_entity_commandlist(get_entity_by_index(D_802B6ED0)); + exec_entity_commandlist(get_entity_by_index(SpinningFlower_EntityIndex)); } break; - case 2: + case SUBSTATE_EJECT: gOverrideFlags |= GLOBAL_OVERRIDES_40; if (--D_802B6EE4 < 0.0f) { D_802B6EE4 = 0.0f; - playerStatus->flags &= ~0x100000; + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_100000; } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); - sin_cos_rad((D_802B6EEC - 60.0f) * TAU / 360.0f, &sp10, &sp14); + sin_cos_rad((SpinningFlower_AngleToCenter - 60.0f) * TAU / 360.0f, &dx, &dz); D_802B6EDC += 0.2; D_802B6EF0 -= 0.72; - D_802B6ED4 = sp10 * D_802B6EDC; - D_802B6ED8 = -sp14 * D_802B6EDC; + D_802B6ED4 = dx * D_802B6EDC; + D_802B6ED8 = -dz * D_802B6EDC; playerStatus->position.x += D_802B6ED4; playerStatus->position.z += D_802B6ED8; collision_lava_reset_check_additional_overlaps(); - playerStatus->position.y = player_check_collision_below(D_802B6EF0, &sp20); + playerStatus->position.y = player_check_collision_below(D_802B6EF0, &entityID); 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 (sp20 >= 0) { - playerStatus->flags &= ~0x100000; + if (entityID >= 0) { + playerStatus->flags &= ~PLAYER_STATUS_FLAGS_100000; enable_player_input(); enable_player_static_collisions(); set_action_state(ACTION_STATE_LAND); @@ -161,22 +168,21 @@ void func_802B60A4_E29514(void) { } } - switchCondition = playerStatus->fallState - 3; - switch (switchCondition) { - case 0: - if (D_802B6ED0 >= 0) { - entityByIndex = get_entity_by_index(D_802B6ED0); - tempDistance = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - D_802B6EEC = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); - if (tempDistance > 4.0f) { - tempDistance -= 1.0f; + switch (playerStatus->actionSubstate) { + case SUBSTATE_SPIN_UP: + if (SpinningFlower_EntityIndex >= 0) { + entityByIndex = get_entity_by_index(SpinningFlower_EntityIndex); + distToCenter = dist2D(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + SpinningFlower_AngleToCenter = atan2(entityByIndex->position.x, entityByIndex->position.z, playerStatus->position.x, playerStatus->position.z); + if (distToCenter > 4.0f) { + distToCenter -= 1.0f; } - sin_cos_rad(D_802B6EEC * TAU / 360.0f, &sp10, &sp14); - playerStatus->position.x = entityByIndex->position.x + (sp10 * tempDistance); - playerStatus->position.z = entityByIndex->position.z - (sp14 * tempDistance); - sin_cos_rad((D_802B6EEC - 91.0f) * TAU / 360.0f, &sp10, &sp14); - D_802B6ED4 = sp10 * D_802B6EDC; - D_802B6ED8 = -sp14 * D_802B6EDC; + sin_cos_rad(SpinningFlower_AngleToCenter * TAU / 360.0f, &dx, &dz); + playerStatus->position.x = entityByIndex->position.x + (dx * distToCenter); + playerStatus->position.z = entityByIndex->position.z - (dz * distToCenter); + sin_cos_rad((SpinningFlower_AngleToCenter - 91.0f) * TAU / 360.0f, &dx, &dz); + D_802B6ED4 = dx * D_802B6EDC; + D_802B6ED8 = -dz * D_802B6EDC; } D_802B6EE8 += 8.0f; @@ -193,11 +199,11 @@ void func_802B60A4_E29514(void) { playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); break; } - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_ASCEND_A playerStatus->currentStateTime = 30; phys_adjust_cam_on_landing(); break; - case 1: + case SUBSTATE_ASCEND_A: D_802B6EE4 += 2.0f; if (D_802B6EE4 >= 45.0f) { D_802B6EE4 = 45.0f; @@ -208,51 +214,52 @@ void func_802B60A4_E29514(void) { D_802B6EE0 = 45.0f; } - tempY = sin_rad(D_802B6EE0 * TAU / 360.0f) * 4.0f; - playerStatus->position.y += tempY; + ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 4.0f; + playerStatus->position.y += ascentVelocity; gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; - tempDistance = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->position.x, playerStatus->position.z)); - if (tempDistance > 40.0f) { + distToCenter = fabsf(dist2D(D_802BCE34, D_802BCE32, playerStatus->position.x, playerStatus->position.z)); + if (distToCenter > 40.0f) { if (D_802BCE30 + 30 < playerStatus->position.y) { - playerStatus->fallState++; - sp18 = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32); - sin_cos_rad(sp18 * TAU / 360.0f, &sp10, &sp14); + playerStatus->actionSubstate++; // SUBSTATE_ASCEND_B + inputAngle = atan2(playerStatus->position.x, playerStatus->position.z, D_802BCE34, D_802BCE32); + sin_cos_rad(inputAngle * TAU / 360.0f, &dx, &dz); playerStatus->currentStateTime = 64; - D_802B6EEC = sp18; - D_802B6ED4 = (sp10 * tempDistance) * 0.015625; - D_802B6ED8 = (-sp14 * tempDistance) * 0.015625; + SpinningFlower_AngleToCenter = inputAngle; + D_802B6ED4 = (dx * distToCenter) * 0.015625; + D_802B6ED8 = (-dz * distToCenter) * 0.015625; } break; } if (playerStatus->currentStateTime == 0) { - playerStatus->fallState = 0xA; + playerStatus->actionSubstate = SUBSTATE_BOOST; playerStatus->currentStateTime = 20; } else { playerStatus->currentStateTime--; } break; - case 2: + case SUBSTATE_ASCEND_B: playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); if (playerStatus->currentStateTime != 0) { playerStatus->currentStateTime--; if (D_802B6EE0-- < 0.0f) { D_802B6EE0 = 0.0f; } - tempY = 2.0f * sin_rad(D_802B6EE0 * TAU / 360.0f); + ascentVelocity = 2.0f * sin_rad(D_802B6EE0 * TAU / 360.0f); playerStatus->position.x += D_802B6ED4; - playerStatus->position.y += tempY; + playerStatus->position.y += ascentVelocity; playerStatus->position.z += D_802B6ED8; } else { - playerStatus->fallState = 0xB; + playerStatus->actionSubstate = SUBSTATE_FINISH; } gCameras[CAM_DEFAULT].targetPos.x = playerStatus->position.x; gCameras[CAM_DEFAULT].targetPos.y = playerStatus->position.y; gCameras[CAM_DEFAULT].targetPos.z = playerStatus->position.z; break; - case 7: - if (++D_802B6EE4 >= 45.0f) { + case SUBSTATE_BOOST: + D_802B6EE4 += 1.0f; + if (D_802B6EE4 >= 45.0f) { D_802B6EE4 = 45.0f; } playerStatus->spriteFacingAngle = clamp_angle(playerStatus->spriteFacingAngle + D_802B6EE4); @@ -260,13 +267,13 @@ void func_802B60A4_E29514(void) { if (D_802B6EE0 > 45.0f) { D_802B6EE0 = 45.0f; } - tempY = sin_rad(D_802B6EE0 * TAU / 360.0f) * 3.0f; - playerStatus->position.y += tempY; + ascentVelocity = sin_rad(D_802B6EE0 * TAU / 360.0f) * 3.0f; + playerStatus->position.y += ascentVelocity; if (playerStatus->currentStateTime != 0) { playerStatus->currentStateTime--; break; } - case 8: + case SUBSTATE_FINISH: enable_player_static_collisions(); enable_player_input(); playerStatus->flags &= ~0x100000; diff --git a/src/world/action/use_tweester.c b/src/world/action/use_tweester.c index 8e8637f593..2d2abd0ee8 100644 --- a/src/world/action/use_tweester.c +++ b/src/world/action/use_tweester.c @@ -4,7 +4,12 @@ extern struct TweesterPhysics* PlayerTweesterPhysics; -void func_802B6000_E2A340(void) { +enum { + SUBSTATE_LAUNCH = 0, + SUBSTATE_DONE = 1 +}; + +void action_update_use_tweester(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 sinAngle, cosAngle, liftoffVelocity; Entity* entity; @@ -15,19 +20,19 @@ void func_802B6000_E2A340(void) { disable_player_static_collisions(); disable_player_input(); playerStatus->flags |= (PLAYER_STATUS_FLAGS_100000 | PLAYER_STATUS_FLAGS_FLYING); - suggest_player_anim_clearUnkFlag(0x8001F); - playerStatus->fallState = 0; - mem_clear(PlayerTweesterPhysics, sizeof(TweesterPhysics)); + suggest_player_anim_clearUnkFlag(ANIM_Mario_8001F); + 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 = 0x78; - sfx_play_sound_at_player(SOUND_2F6, 0); + PlayerTweesterPhysics->countdown = 120; + sfx_play_sound_at_player(SOUND_TWEESTER_LAUNCH, 0); } - switch (playerStatus->fallState) { - case 0: + switch (playerStatus->actionSubstate) { + case SUBSTATE_LAUNCH: sin_cos_rad((PlayerTweesterPhysics->angle * TAU) / 360.0f, &sinAngle, &cosAngle); playerStatus->position.x = entity->position.x + (sinAngle * PlayerTweesterPhysics->radius); @@ -54,14 +59,14 @@ void func_802B6000_E2A340(void) { PlayerTweesterPhysics->angularVelocity = 40.0f; } if (--PlayerTweesterPhysics->countdown == 0) { - playerStatus->fallState++; + playerStatus->actionSubstate++; // SUBSTATE_DONE entity_start_script(entity); } break; - case 1: + case SUBSTATE_DONE: disable_player_shadow(); disable_npc_shadow(wPartnerNpc); - playerStatus->blinkTimer = 0x32; + playerStatus->blinkTimer = 50; enable_player_static_collisions(); enable_player_input(); playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_100000 | PLAYER_STATUS_FLAGS_FLYING); diff --git a/src/world/action/walk.c b/src/world/action/walk.c index ac7d39013e..6e5f2cdbf2 100644 --- a/src/world/action/walk.c +++ b/src/world/action/walk.c @@ -1,44 +1,43 @@ #include "common.h" #include "world/actions.h" -s32 WalkPeachAnims[] = { - 0x000A0002, // none - 0x000A002B, // cream - 0x000A002D, // strawberry - 0x000A002F, // butter - 0x000A0031, // cleanser - 0x000A0033, // water - 0x000A0035, // milk - 0x000A0037, // flour - 0x000A0039, // egg - 0x000A003B, // complete cake - 0x000A003D, // cake bowl - 0x000A003F, // cake mixed - 0x000A0041, // cake pan - 0x000A0043, // cake batter - 0x000A0045, // cake bare - 0x000A0047, // salt - 0x000A0049, // sugar - 0x000A004B, // cake with icing - 0x000A004D, // cake with berries +AnimID WalkPeachAnims[] = { + ANIM_Peach_A0002, // none + ANIM_Peach_A002B, // cream + ANIM_Peach_A002D, // strawberry + ANIM_Peach_A002F, // butter + ANIM_Peach_A0031, // cleanser + ANIM_Peach_A0033, // water + ANIM_Peach_A0035, // milk + ANIM_Peach_A0037, // flour + ANIM_Peach_A0039, // egg + ANIM_Peach_A003B, // complete cake + ANIM_Peach_A003D, // cake bowl + ANIM_Peach_A003F, // cake mixed + ANIM_Peach_A0041, // cake pan + ANIM_Peach_A0043, // cake batter + ANIM_Peach_A0045, // cake bare + ANIM_Peach_A0047, // salt + ANIM_Peach_A0049, // sugar + ANIM_Peach_A004B, // cake with icing + ANIM_Peach_A004D, // cake with berries 0x00000000 }; -void action_run_update_peach(void); -void func_802B65E8_E23CC8(void); +static void action_update_run_peach(void); +static void action_update_walk_peach(void); -// walk -void func_802B6000_E236E0(void) { +void action_update_walk(void) { PlayerStatus* playerStatus = &gPlayerStatus; PlayerData* playerData = &gPlayerData; f32 moveVectorMagnitude; f32 moveVectorAngle; s32 stickAxisX; s32 stickAxisY; - s32 playerAnim; + AnimID anim; s32 changedAnim = FALSE; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - func_802B65E8_E23CC8(); + action_update_walk_peach(); return; } @@ -53,15 +52,15 @@ void func_802B6000_E236E0(void) { } if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - playerAnim = 0x90003; + anim = ANIM_Mario_90003; } else if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { - playerAnim = 0x10004; + anim = ANIM_Mario_Walking; } else { - playerAnim = 0x60000; + anim = ANIM_Mario_60000; } - suggest_player_anim_clearUnkFlag(playerAnim); + suggest_player_anim_clearUnkFlag(anim); } if (playerStatus->flags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { @@ -81,7 +80,7 @@ void func_802B6000_E236E0(void) { return; } - if (fabsf(D_800F7B40 - moveVectorAngle) <= 90.0f && abs(moveVectorMagnitude - D_800F7B44) < 20) { + if (fabsf(PrevPlayerCamRelativeYaw - moveVectorAngle) <= 90.0f && abs(moveVectorMagnitude - D_800F7B44) < 20) { if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000)) { if (moveVectorMagnitude >= 20.0f) { playerStatus->targetYaw = moveVectorAngle; @@ -111,25 +110,25 @@ void func_802B6000_E236E0(void) { } } -// run -void action_run_update(void) { +void action_update_run(void) { PlayerStatus* playerStatus = &gPlayerStatus; PlayerData* playerData = &gPlayerData; f32 moveX; f32 moveY; s32 temp_v1; - s32 phi_a0; - f32 phi_f2; + AnimID anim; + f32 runSpeedModifier; s32 phi_s3; phi_s3 = 0; if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_USING_PEACH_PHYSICS) { - action_run_update_peach(); + action_update_run_peach(); return; } if (playerStatus->flags & PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED) { - playerStatus->flags &= ~0x80880000; + playerStatus->flags &= ~(PLAYER_STATUS_FLAGS_ACTION_STATE_CHANGED | + PLAYER_STATUS_FLAGS_800000 | PLAYER_STATUS_FLAGS_80000); D_8010C980 = 0; playerStatus->unk_60 = 0; phi_s3 = 1; @@ -138,31 +137,31 @@ void action_run_update(void) { playerStatus->currentSpeed = playerStatus->runSpeed; } if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_8BIT_MARIO) { - phi_a0 = 0x90003; + anim = ANIM_Mario_90003; } else { if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT)) { - phi_a0 = 0x10005; + anim = ANIM_Mario_Running; } else { - phi_a0 = 0x60002; + anim = ANIM_Mario_60002; } } - suggest_player_anim_clearUnkFlag(phi_a0); + suggest_player_anim_clearUnkFlag(anim); } - if (playerStatus->flags & 0x00004000) { + if (playerStatus->flags & PLAYER_STATUS_FLAGS_4000) { playerStatus->targetYaw = playerStatus->heading; try_player_footstep_sounds(4); return; } D_8010C980++; - phi_f2 = 1.0f; + runSpeedModifier = 1.0f; - if (playerStatus->animFlags & 0x10000) { - phi_f2 = 1.5f; + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_SPINNING) { + runSpeedModifier = 1.5f; } - playerStatus->currentSpeed = playerStatus->runSpeed * phi_f2; + playerStatus->currentSpeed = playerStatus->runSpeed * runSpeedModifier; player_input_to_move_vector(&moveX, &moveY); phys_update_interact_collider(); if (check_input_jump() == FALSE) { @@ -178,19 +177,16 @@ void action_run_update(void) { return; } - if (fabsf(D_800F7B40 - moveX) <= 90.0f) { - temp_v1 = playerStatus->animFlags; - if (temp_v1 >= 0) { + if (fabsf(PrevPlayerCamRelativeYaw - moveX) <= 90.0f) { + if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000)) { playerStatus->targetYaw = moveX; } - playerStatus->animFlags &= ~0x80000000; + playerStatus->animFlags &= ~PLAYER_STATUS_ANIM_FLAGS_80000000; } else { - temp_v1 = playerStatus->animFlags; - temp_v1 = temp_v1 < 0; - if (temp_v1) { + if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_80000000) { playerStatus->targetYaw = moveX; } else { - playerStatus->animFlags |= 0x80000000; + playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_80000000; } } @@ -214,13 +210,13 @@ void func_802B6550_E23C30(void) { suggest_player_anim_clearUnkFlag(WalkPeachAnims[gGameStatusPtr->peachCookingIngredient]); return; } - suggest_player_anim_clearUnkFlag(0xD000D); + suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D); return; } peach_set_disguise_anim(BasicPeachDisguiseAnims[gPlayerStatus.peachDisguise].walk); } -void func_802B65E8_E23CC8(void) { +static void action_update_walk_peach(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 magnitude; f32 angle; @@ -256,7 +252,7 @@ void func_802B65E8_E23CC8(void) { try_player_footstep_sounds(8); } -void action_run_update_peach(void) { +static void action_update_run_peach(void) { PlayerStatus* playerStatus = &gPlayerStatus; GameStatus* gameStatus; f32 moveX; @@ -273,12 +269,12 @@ void action_run_update_peach(void) { gameStatus = gGameStatusPtr; if (!(gameStatus->peachFlags & PEACH_STATUS_FLAG_HAS_INGREDIENT)) { if (!gameStatus->peachCookingIngredient) { - suggest_player_anim_clearUnkFlag(0xA0003); + suggest_player_anim_clearUnkFlag(ANIM_Peach_A0003); } else { suggest_player_anim_clearUnkFlag(WalkPeachAnims[gameStatus->peachCookingIngredient]); } } else { - suggest_player_anim_clearUnkFlag(0xD000D); + suggest_player_anim_clearUnkFlag(ANIM_Peach_D000D); } } else { peach_set_disguise_anim(BasicPeachDisguiseAnims[playerStatus->peachDisguise].run); diff --git a/src/world/actions.c b/src/world/actions.c index 42ec21038f..c775ad4b64 100644 --- a/src/world/actions.c +++ b/src/world/actions.c @@ -2,27 +2,38 @@ #include "ld_addrs.h" #include "actions.h" -void action_idle_update(void); -void func_802B6000_E24920(void); -void action_run_update(void); -void func_802B60B4_E240F4(void); -void func_802B6198_E241D8(void); -void func_802B6294_E242D4(void); -void func_802B6348_E24388(void); -void func_802B61C0_E24AE0(void); -void func_802B6638_E29068(void); -void func_802B6060_E27570(void); -void action_hammer_update(void); -void func_802B6350_E28D80(void); -void func_802B6508_E28F38(void); -void func_802B6230_E24800(void); -void func_802B6120_E2A7D0(void); -void func_802B63D4_E28E04(void); -void func_802B6478_E28EA8(void); -void func_802B60A4_E29514(void); -void func_802B609C_E28ACC(void); +void action_update_idle(void); +void action_update_walk(void); +void action_update_run(void); +void action_update_land(void); +void action_update_jump(void); +void action_update_landing_on_switch(void); +void action_update_falling(void); +void action_update_step_down(void); +void action_update_step_down_land(void); +void action_update_spin_jump(void); +void action_update_tornado_jump(void); +void action_update_talk(void); +void action_update_sliding(void); +void action_update_hammer(void); +void action_update_launch(void); +void action_update_pushing_block(void); +void action_update_hit_fire(void); +void action_update_knockback(void); +void action_update_hit_lava(void); +void action_update_parasol(void); +void action_update_spin(void); +void action_update_step_up_peach(void); +void action_update_ride(void); +void action_update_step_up(void); +void action_update_first_strike(void); +void action_update_raise_arms(void); +void action_update_use_spinning_flower(void); +void action_update_use_munchlesia(void); +void action_update_use_tweester(void); +void action_update_state_23(void); -s32 D_800F7B40 = 0; +s32 PrevPlayerCamRelativeYaw = 0; s32 D_800F7B44 = 0; f32 D_800F7B48 = 0.0f; s32 D_800F7B4C = 0; @@ -36,15 +47,15 @@ f32 D_800F7B74 = 4.0f; // run f32 D_800F7B78 = 32.0f; // max jump f32 D_800F7B7C = -32.0f; // ??? -s16 D_800F7B80 = 0; +s16 FootstepSoundSelector = 0; s32 D_800F7B84[] = { 0, 0, 0}; f32 D_800F7B90 = 0.0; -s32 ClubbaDisguiseExtraAnims[] = { 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, ANIM_LIST_END }; +AnimID ClubbaDisguiseExtraAnims[] = { 0x00390000, 0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390008, 0x00390007, 0x00390013, 0x00390014, ANIM_LIST_END }; -s32 HammerBroDisguiseExtraAnims[] = { 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, ANIM_LIST_END }; +AnimID HammerBroDisguiseExtraAnims[] = { 0x005A0000, 0x005A0002, 0x005A0003, 0x005A0004, 0x005A0006, 0x005A0007, 0x005A0009, 0x005A000A, 0x005A000B, 0x005A001A, ANIM_LIST_END }; -s32 KoopatrolDisguiseExtraAnims[] = { 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, ANIM_LIST_END }; +AnimID KoopatrolDisguiseExtraAnims[] = { 0x00580000, 0x00580001, 0x00580002, 0x00580004, 0x00580005, 0x00580006, 0x00580007, 0x00580008, 0x00580009, 0x00580012, 0x00580014, 0x0058001B, ANIM_LIST_END }; DisguiseAnims BasicPeachDisguiseAnims[4] = { {0x00580001, 0x00580004, 0x00580006, 0x00580008, 0x00580000, 0x0058001B}, @@ -53,46 +64,49 @@ DisguiseAnims BasicPeachDisguiseAnims[4] = { {0x00390002, 0x00390003, 0x00390004, 0x00390005, 0x00390000, 0x00390014}, }; -s32* PeachDisguiseExtraAnims[4] = { KoopatrolDisguiseExtraAnims, KoopatrolDisguiseExtraAnims, HammerBroDisguiseExtraAnims, ClubbaDisguiseExtraAnims }; +AnimID* PeachDisguiseExtraAnims[4] = { KoopatrolDisguiseExtraAnims, KoopatrolDisguiseExtraAnims, HammerBroDisguiseExtraAnims, ClubbaDisguiseExtraAnims }; + +#define ACTION_FILE(name) world_action_##name##_ROM_START, world_action_##name##_ROM_END Action PlayerActionsTable[] = { - { action_idle_update, world_action_idle_ROM_START, world_action_idle_ROM_END, TRUE }, - { func_802B6000_E24920, world_action_walk_ROM_START, world_action_walk_ROM_END, TRUE }, - { action_run_update, world_action_walk_ROM_START, world_action_walk_ROM_END, TRUE }, - { func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE }, - { func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE }, - { func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE }, - { func_802B60B4_E240F4, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE }, - { func_802B6198_E241D8, world_action_jump_ROM_START, world_action_jump_ROM_END, FALSE }, - { func_802B6294_E242D4, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE }, - { func_802B6348_E24388, world_action_jump_ROM_START, world_action_jump_ROM_END, TRUE }, - { func_802B6000_E24920, world_action_land_ROM_START, world_action_land_ROM_END, TRUE }, - { func_802B61C0_E24AE0, world_action_land_ROM_START, world_action_land_ROM_END, TRUE }, - { func_802B6638_E29068, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE }, - { func_802B6000_E24920, world_action_super_boots_ROM_START, world_action_super_boots_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_super_boots_ROM_START, world_action_super_boots_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_ultra_boots_ROM_START, world_action_ultra_boots_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_ultra_boots_ROM_START, world_action_ultra_boots_ROM_END, FALSE }, - { func_802B6060_E27570, world_action_slide_ROM_START, world_action_slide_ROM_END, FALSE }, - { action_hammer_update, world_action_hammer_ROM_START, world_action_hammer_ROM_END, FALSE }, - { func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE }, - { func_802B6508_E28F38, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_hit_fire_ROM_START, world_action_hit_fire_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_16_ROM_START, world_action_16_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_hit_lava_ROM_START, world_action_hit_lava_ROM_END, FALSE }, - { func_802B6230_E24800, world_action_18_ROM_START, world_action_18_ROM_END, TRUE }, - { func_802B6120_E2A7D0, world_action_sneaky_parasol_ROM_START, world_action_sneaky_parasol_ROM_END, TRUE }, - { func_802B6000_E24920, world_action_spin_ROM_START, world_action_spin_ROM_END, FALSE }, - { func_802B63D4_E28E04, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B6478_E28EA8, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B60A4_E29514, world_action_use_spinning_flower_ROM_START, world_action_use_spinning_flower_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_use_munchlesia_ROM_START, world_action_use_munchlesia_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_use_tweester_ROM_START, world_action_use_tweester_ROM_END, FALSE }, - { func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE }, - { func_802B6000_E24920, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B6000_E24920, world_action_18_ROM_START, world_action_18_ROM_END, TRUE }, - { func_802B609C_E28ACC, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, FALSE }, - { func_802B6350_E28D80, world_action_walk_ROM_START, world_action_walk_ROM_END, FALSE }, - { func_802B6350_E28D80, world_action_encounter_ROM_START, world_action_encounter_ROM_END, TRUE }, + [ACTION_STATE_IDLE] { action_update_idle, ACTION_FILE(idle), TRUE }, + [ACTION_STATE_WALK] { action_update_walk, ACTION_FILE(walk), TRUE }, + [ACTION_STATE_RUN] { action_update_run, ACTION_FILE(walk), TRUE }, + [ACTION_STATE_JUMP] { action_update_jump, ACTION_FILE(jump), TRUE }, + [ACTION_STATE_BOUNCE] { action_update_jump, ACTION_FILE(jump), TRUE }, + [ACTION_STATE_HOP] { action_update_jump, ACTION_FILE(jump), FALSE }, + [ACTION_STATE_LAUNCH] { action_update_jump, ACTION_FILE(jump), FALSE }, + [ACTION_STATE_LANDING_ON_SWITCH] { action_update_landing_on_switch, ACTION_FILE(jump), FALSE }, + [ACTION_STATE_FALLING] { action_update_falling, ACTION_FILE(jump), TRUE }, + [ACTION_STATE_STEP_DOWN] { action_update_step_down, ACTION_FILE(jump), TRUE }, + [ACTION_STATE_LAND] { action_update_land, ACTION_FILE(land), TRUE }, + [ACTION_STATE_STEP_DOWN_LAND] { action_update_step_down_land, ACTION_FILE(land), TRUE }, + [ACTION_STATE_TALK] { action_update_talk, ACTION_FILE(misc), TRUE }, + [ACTION_STATE_SPIN_JUMP] { action_update_spin_jump, ACTION_FILE(spin_jump), FALSE }, + [ACTION_STATE_SPIN_POUND] { action_update_spin_jump, ACTION_FILE(spin_jump), FALSE }, + [ACTION_STATE_TORNADO_JUMP] { action_update_tornado_jump, ACTION_FILE(tornado_jump), FALSE }, + [ACTION_STATE_TORNADO_POUND] { action_update_tornado_jump, ACTION_FILE(tornado_jump), FALSE }, + [ACTION_STATE_SLIDING] { action_update_sliding, ACTION_FILE(slide), FALSE }, + [ACTION_STATE_HAMMER] { action_update_hammer, ACTION_FILE(hammer), FALSE }, + [ACTION_STATE_13] { action_update_launch, ACTION_FILE(misc), TRUE }, + [ACTION_STATE_PUSHING_BLOCK] { action_update_pushing_block, ACTION_FILE(misc), FALSE }, + [ACTION_STATE_HIT_FIRE] { action_update_hit_fire, ACTION_FILE(hit_fire), FALSE }, + [ACTION_STATE_KNOCKBACK] { action_update_knockback, ACTION_FILE(knockback), FALSE }, + [ACTION_STATE_HIT_LAVA] { action_update_hit_lava, ACTION_FILE(hit_lava), FALSE }, + [ACTION_STATE_STEP_UP_PEACH] { action_update_step_up_peach, ACTION_FILE(step_up), TRUE }, + [ACTION_STATE_USE_SNEAKY_PARASOL] { action_update_parasol, ACTION_FILE(sneaky_parasol), TRUE }, + [ACTION_STATE_SPIN] { action_update_spin, ACTION_FILE(spin), FALSE }, + [ACTION_STATE_ENEMY_FIRST_STRIKE] { action_update_first_strike, ACTION_FILE(misc), FALSE }, + [ACTION_STATE_RAISE_ARMS] { action_update_raise_arms, ACTION_FILE(misc), FALSE }, + [ACTION_STATE_USE_SPINNING_FLOWER] { action_update_use_spinning_flower, ACTION_FILE(use_spinning_flower), FALSE }, + [ACTION_STATE_USE_MUNCHLESIA] { action_update_use_munchlesia, ACTION_FILE(use_munchlesia), FALSE }, + [ACTION_STATE_USE_TWEESTER] { action_update_use_tweester, ACTION_FILE(use_tweester), FALSE }, + [ACTION_STATE_BOUNCE_OFF_SWITCH] { action_update_launch, ACTION_FILE(misc), TRUE }, + [ACTION_STATE_RIDE] { action_update_ride, ACTION_FILE(misc), FALSE }, + [ACTION_STATE_STEP_UP] { action_update_step_up, ACTION_FILE(step_up), TRUE }, + [ACTION_STATE_23] { action_update_state_23, ACTION_FILE(misc), FALSE }, + [ACTION_STATE_24] { action_update_launch, ACTION_FILE(misc), FALSE }, + //@bug function does not exist in world_action_walk, causes jump to middle of action_update_run and crashes + [ACTION_STATE_INVALID_25] { action_update_launch, ACTION_FILE(walk), FALSE }, + [ACTION_STATE_USE_SPRING] { action_update_launch, ACTION_FILE(misc), TRUE }, }; diff --git a/src/world/actions.h b/src/world/actions.h index 0e29e38811..c9e3b0c399 100644 --- a/src/world/actions.h +++ b/src/world/actions.h @@ -23,6 +23,6 @@ extern f32 D_800F7B90; extern Action PlayerActionsTable[39]; extern DisguiseAnims BasicPeachDisguiseAnims[4]; -extern s32* PeachDisguiseExtraAnims[4]; +extern AnimID* PeachDisguiseExtraAnims[4]; #endif diff --git a/src/world/area_arn/arn_03/events.c b/src/world/area_arn/arn_03/events.c index 5b7a2ef52e..d8450374e8 100644 --- a/src/world/area_arn/arn_03/events.c +++ b/src/world/area_arn/arn_03/events.c @@ -151,7 +151,7 @@ void N(func_80241068_BDFDF8)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1); } else { script->functionTemp[0] = 4; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } } } diff --git a/src/world/area_arn/arn_05/events.c b/src/world/area_arn/arn_05/events.c index 79f38ec3cc..70d44644da 100644 --- a/src/world/area_arn/arn_05/events.c +++ b/src/world/area_arn/arn_05/events.c @@ -1086,7 +1086,7 @@ void N(func_80241068_BE8C48)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration = aiSettings->waitTime / 2 + rand_int(aiSettings->waitTime / 2 + 1); } else { script->functionTemp[0] = 4; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } } } diff --git a/src/world/area_arn/arn_08/BF47A0.c b/src/world/area_arn/arn_08/BF47A0.c index f5c6c4a2cc..b473772e7c 100644 --- a/src/world/area_arn/arn_08/BF47A0.c +++ b/src/world/area_arn/arn_08/BF47A0.c @@ -7,7 +7,7 @@ ApiStatus N(func_80240000_BF47A0)(Evt* script, s32 isInitialCall) { if (isInitialCall) { script->functionTemp[0] = 0; - suggest_player_anim_clearUnkFlag(0x10007); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill); } temp_f20 = func_800E34D8(); diff --git a/src/world/area_dro/dro_02/9694C0.c b/src/world/area_dro/dro_02/9694C0.c index 99508d6c3d..83b08a2655 100644 --- a/src/world/area_dro/dro_02/9694C0.c +++ b/src/world/area_dro/dro_02/9694C0.c @@ -2515,7 +2515,7 @@ void N(func_80242214_96B3D4)(s32 arg0, f32* arg1, f32* arg2, f32* arg3, f32* arg Matrix4f sp60; Matrix4f spA0; - guPositionF(spA0, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE, + guPositionF(spA0, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F, evt_get_variable(N(D_8024EFCC), ArrayVar(4)), evt_get_variable(N(D_8024EFCC), ArrayVar(5)), evt_get_variable(N(D_8024EFCC), ArrayVar(6))); @@ -2539,7 +2539,7 @@ void N(func_80242EAC_96C06C)(Evt* script, s32 isInitialCall) { Matrix4f sp20; u32 temp_s1; - guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE, + guPositionF(sp20, 0.0f, -gCameras[gCurrentCameraID].currentYaw, 0.0f, SPRITE_WORLD_SCALE_F, evt_get_variable(N(D_8024EFCC), ArrayVar(4)), evt_get_variable(N(D_8024EFCC), ArrayVar(5)), evt_get_variable(N(D_8024EFCC), ArrayVar(6))); diff --git a/src/world/area_flo/flo_03/CA72E0.c b/src/world/area_flo/flo_03/CA72E0.c index a63098dcbd..52fe60a02d 100644 --- a/src/world/area_flo/flo_03/CA72E0.c +++ b/src/world/area_flo/flo_03/CA72E0.c @@ -1145,18 +1145,18 @@ ApiStatus N(func_80240158_CA73F8)(Evt* script, s32 isInitialCall) { add_vec2D_polar(&sp10, &sp14, 46.0f, clamp); } } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN]; npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14); npc_move_heading(npc, 2.0f, npc->yaw); } else if (temp_f4 > 0.2) { npc->yaw = atan2(npc->pos.x, npc->pos.z, sp10, sp14); npc->pos.x = sp10; npc->pos.z = sp14; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; } else { npc->pos.x = sp10; npc->pos.z = sp14; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } return ApiStatus_BLOCK; } diff --git a/src/world/area_flo/flo_16/CD4770.c b/src/world/area_flo/flo_16/CD4770.c index 07fa434f27..e2436552ec 100644 --- a/src/world/area_flo/flo_16/CD4770.c +++ b/src/world/area_flo/flo_16/CD4770.c @@ -3,7 +3,7 @@ ApiStatus N(func_80242940_CD4770)(Evt* script, s32 isInitialCall) { script->varTable[0] = 0; do {} while (0); - if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND || gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) { + if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND || gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) { script->varTable[0] = 1; } return ApiStatus_DONE2; diff --git a/src/world/area_isk/isk_05/97DAD0.c b/src/world/area_isk/isk_05/97DAD0.c index c92624a897..d8eca47016 100644 --- a/src/world/area_isk/isk_05/97DAD0.c +++ b/src/world/area_isk/isk_05/97DAD0.c @@ -99,9 +99,9 @@ ApiStatus func_80241B28_97F5F8(Evt* script, s32 isInitialCall) { ambush->rot.x = 0; ambush->rot.y = 0; ambush->rot.z = 0; - ambush->scale.x = SPRITE_WORLD_SCALE; - ambush->scale.y = SPRITE_WORLD_SCALE; - ambush->scale.z = SPRITE_WORLD_SCALE; + ambush->scale.x = SPRITE_WORLD_SCALE_F; + ambush->scale.y = SPRITE_WORLD_SCALE_F; + ambush->scale.z = SPRITE_WORLD_SCALE_F; ambush->renderYaw = 85.0f; ambush->alpha = 0.0f; diff --git a/src/world/area_isk/isk_13/98F7E0.c b/src/world/area_isk/isk_13/98F7E0.c index e4a9cfdc09..8ed9354a8b 100644 --- a/src/world/area_isk/isk_13/98F7E0.c +++ b/src/world/area_isk/isk_13/98F7E0.c @@ -107,9 +107,9 @@ ApiStatus func_80241BA8_991388(Evt* script, s32 isInitialCall) { ambush->rot.x = 0.0f; ambush->rot.y = 0.0f; ambush->rot.z = 90.0f; - ambush->scale.x = SPRITE_WORLD_SCALE; - ambush->scale.y = SPRITE_WORLD_SCALE; - ambush->scale.z = SPRITE_WORLD_SCALE; + ambush->scale.x = SPRITE_WORLD_SCALE_F; + ambush->scale.y = SPRITE_WORLD_SCALE_F; + ambush->scale.z = SPRITE_WORLD_SCALE_F; ambush->renderYaw = 60.0f; ambush->color.r = 255.0f; ambush->color.g = 128.0f; diff --git a/src/world/area_isk/isk_14/992730.c b/src/world/area_isk/isk_14/992730.c index ca2382c326..3fc3baf94d 100644 --- a/src/world/area_isk/isk_14/992730.c +++ b/src/world/area_isk/isk_14/992730.c @@ -97,9 +97,9 @@ ApiStatus func_80241AF0_994220(Evt* script, s32 isInitialCall) { ambush->rot.x = 0; ambush->rot.y = 0; ambush->rot.z = 0; - ambush->scale.x = SPRITE_WORLD_SCALE; - ambush->scale.y = SPRITE_WORLD_SCALE; - ambush->scale.z = SPRITE_WORLD_SCALE; + ambush->scale.x = SPRITE_WORLD_SCALE_F; + ambush->scale.y = SPRITE_WORLD_SCALE_F; + ambush->scale.z = SPRITE_WORLD_SCALE_F; ambush->renderYaw = 270.0f; ambush->foldID = 0; diff --git a/src/world/area_iwa/iwa_00/90CEF0.c b/src/world/area_iwa/iwa_00/90CEF0.c index ff82dafe96..24c3e6b989 100644 --- a/src/world/area_iwa/iwa_00/90CEF0.c +++ b/src/world/area_iwa/iwa_00/90CEF0.c @@ -1,7 +1,7 @@ #include "iwa_00.h" ApiStatus func_802402B0_90CEF0(Evt* script, s32 isInitialCall) { - gPlayerStatus.unk_D0 = script->varTablePtr[0]; + gPlayerStatus.slideParams = script->varTablePtr[0]; gPlayerStatus.flags |= PLAYER_STATUS_FLAGS_10; return ApiStatus_DONE2; } diff --git a/src/world/area_iwa/iwa_01/912960.c b/src/world/area_iwa/iwa_01/912960.c index 9ad40f3c12..63e5aecdd2 100644 --- a/src/world/area_iwa/iwa_01/912960.c +++ b/src/world/area_iwa/iwa_01/912960.c @@ -1,7 +1,7 @@ #include "iwa_01.h" ApiStatus func_802432B0_912960(Evt* script, s32 isInitialCall) { - gPlayerStatus.unk_D0 = script->varTablePtr[0]; + gPlayerStatus.slideParams = script->varTablePtr[0]; gPlayerStatus.flags |= PLAYER_STATUS_ANIM_FLAGS_INTERACT_PROMPT_AVAILABLE; return ApiStatus_DONE2; } diff --git a/src/world/area_iwa/iwa_03/918EF0.c b/src/world/area_iwa/iwa_03/918EF0.c index 8e5fe295ff..1403a13aab 100644 --- a/src/world/area_iwa/iwa_03/918EF0.c +++ b/src/world/area_iwa/iwa_03/918EF0.c @@ -3,7 +3,7 @@ #include "world/common/enemy/CleftAI.inc.c" ApiStatus func_80241320_919ED0(Evt* script, s32 isInitialCall) { - gPlayerStatus.unk_D0 = script->varTablePtr[0]; + gPlayerStatus.slideParams = script->varTablePtr[0]; gPlayerStatus.flags |= PLAYER_STATUS_FLAGS_10; return ApiStatus_DONE2; } diff --git a/src/world/area_kkj/kkj_00/ABB290.c b/src/world/area_kkj/kkj_00/ABB290.c index ba14eb507c..bcfaf84e4b 100644 --- a/src/world/area_kkj/kkj_00/ABB290.c +++ b/src/world/area_kkj/kkj_00/ABB290.c @@ -16,12 +16,12 @@ ApiStatus func_80240000_ABB290(Evt* script, s32 isInitialCall) { ApiStatus func_80240040_ABB2D0(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - PlayerStatus *status = &gPlayerStatus; + PlayerStatus* status = &gPlayerStatus; if (evt_get_variable(script, *args++) == 0) { - status->unk_D0 = &D_8024160C_ABC89C; + status->slideParams = &D_8024160C_ABC89C; } else { - status->unk_D0 = &D_8024162C_ABC8BC; + status->slideParams = &D_8024162C_ABC8BC; } status->flags |= PLAYER_STATUS_FLAGS_10; diff --git a/src/world/area_kkj/kkj_18/AF2FE0.c b/src/world/area_kkj/kkj_18/AF2FE0.c index f0304bf85f..c476556860 100644 --- a/src/world/area_kkj/kkj_18/AF2FE0.c +++ b/src/world/area_kkj/kkj_18/AF2FE0.c @@ -83,8 +83,8 @@ ApiStatus func_80240694_AF3334(Evt* script, s32 isInitialCall) { ApiStatus func_80240730_AF33D0(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - gPlayerStatus.unk_C4 = evt_get_float_variable(script, *args++); - gGameStatusPtr->peachCookingIngredient = gPlayerStatus.unk_C4; + gPlayerStatus.peachItemHeld = evt_get_float_variable(script, *args++); + gGameStatusPtr->peachCookingIngredient = gPlayerStatus.peachItemHeld; return ApiStatus_DONE2; } diff --git a/src/world/area_kkj/kkj_19/AF7C00.c b/src/world/area_kkj/kkj_19/AF7C00.c index 12e76064c4..1b8d595ba2 100644 --- a/src/world/area_kkj/kkj_19/AF7C00.c +++ b/src/world/area_kkj/kkj_19/AF7C00.c @@ -251,8 +251,8 @@ ApiStatus func_80240B8C_AF84DC(Evt* script, s32 isInitialCall) { ApiStatus func_80240C10_AF8560(Evt* script, s32 isInitialCall) { Bytecode* args = script->ptrReadPos; - gPlayerStatus.unk_C4 = evt_get_variable(script, *args++); - gGameStatusPtr->peachCookingIngredient = gPlayerStatus.unk_C4; + gPlayerStatus.peachItemHeld = evt_get_variable(script, *args++); + gGameStatusPtr->peachCookingIngredient = gPlayerStatus.peachItemHeld; return ApiStatus_DONE2; } diff --git a/src/world/area_kkj/kkj_25/B06D10.c b/src/world/area_kkj/kkj_25/B06D10.c index 9e06f20586..5a510b7a17 100644 --- a/src/world/area_kkj/kkj_25/B06D10.c +++ b/src/world/area_kkj/kkj_25/B06D10.c @@ -19,9 +19,9 @@ ApiStatus func_802406EC_B070EC(Evt* script, s32 isInitialCall) { unkStruct->rot.x = 0.0f; unkStruct->rot.y = 0.0f; unkStruct->rot.z = 0.0f; - unkStruct->scale.x = SPRITE_WORLD_SCALE; - unkStruct->scale.y = SPRITE_WORLD_SCALE; - unkStruct->scale.z = SPRITE_WORLD_SCALE; + unkStruct->scale.x = SPRITE_WORLD_SCALE_F; + unkStruct->scale.y = SPRITE_WORLD_SCALE_F; + unkStruct->scale.z = SPRITE_WORLD_SCALE_F; unkStruct->foldID = func_8013A704(1); unkStruct->entityID = create_generic_entity_world(NULL, kkj_25_UnkFoldFunc); diff --git a/src/world/area_kmr/kmr_02/8B36B0.c b/src/world/area_kmr/kmr_02/8B36B0.c index 65758a69bb..aad07f961a 100644 --- a/src/world/area_kmr/kmr_02/8B36B0.c +++ b/src/world/area_kmr/kmr_02/8B36B0.c @@ -2,6 +2,25 @@ #include "world/common/CheckPartnerFlags1000.inc.c" +#ifdef NON_MATCHING +ApiStatus func_8024366C_8B36DC(Evt* script, s32 isInitialCall) { + static s32* D_8025578C_8C57FC[4]; // EnemyTerritoryWander + + Bytecode* args = script->ptrReadPos; + s32 enemyIndex = evt_get_variable(script, *args++); + s32 territoryIndex = evt_get_variable(script, *args++); + s32* src = D_8025578C_8C57FC[territoryIndex]; + Enemy* enemy = get_enemy(enemyIndex); + s32 i; + + for (i = 0; i < 0xE; i++) { + enemy->territory.raw[i] = src[i]; + } + + return ApiStatus_DONE2; +} +#else INCLUDE_ASM(s32, "world/area_kmr/kmr_02/8B36B0", func_8024366C_8B36DC); +#endif #include "world/common/UnkFunc42.inc.c" diff --git a/src/world/area_kpa/kpa_14/A57830.c b/src/world/area_kpa/kpa_14/A57830.c index a354f76004..f146876985 100644 --- a/src/world/area_kpa/kpa_14/A57830.c +++ b/src/world/area_kpa/kpa_14/A57830.c @@ -28,7 +28,7 @@ ApiStatus func_8024073C_A57BEC(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; if (gCollisionStatus.currentFloor == floor || gCollisionStatus.lastTouchedFloor == floor) { - if (playerStatus->actionState != ACTION_STATE_ULTRA_JUMP && + if (playerStatus->actionState != ACTION_STATE_TORNADO_JUMP && playerStatus->actionState != ACTION_STATE_SPIN_JUMP && temp_a0 == 0) { diff --git a/src/world/area_kpa/kpa_53/A6ACA0.c b/src/world/area_kpa/kpa_53/A6ACA0.c index ae52d8dc64..9a28ddb615 100644 --- a/src/world/area_kpa/kpa_53/A6ACA0.c +++ b/src/world/area_kpa/kpa_53/A6ACA0.c @@ -30,7 +30,7 @@ ApiStatus func_80240050_A6ACF0(Evt* script, s32 isInitialCall) { } else { animID = 0xA0003; } - npc->currentAnim.w = animID; + npc->currentAnim = animID; evt_set_variable(script, outVar, playerStatus->targetYaw); return ApiStatus_DONE2; } diff --git a/src/world/area_mac/mac_01/8017D0.c b/src/world/area_mac/mac_01/8017D0.c index 5a38874ef3..2509907f6d 100644 --- a/src/world/area_mac/mac_01/8017D0.c +++ b/src/world/area_mac/mac_01/8017D0.c @@ -40,9 +40,9 @@ ApiStatus func_80243380_803C00(Evt* script, s32 isInitialCall) { temp_v0->rot.x = 0.0f; temp_v0->rot.y = 0.0f; temp_v0->rot.z = 0.0f; - temp_v0->scale.x = SPRITE_WORLD_SCALE; - temp_v0->scale.y = SPRITE_WORLD_SCALE; - temp_v0->scale.z = SPRITE_WORLD_SCALE; + temp_v0->scale.x = SPRITE_WORLD_SCALE_F; + temp_v0->scale.y = SPRITE_WORLD_SCALE_F; + temp_v0->scale.z = SPRITE_WORLD_SCALE_F; temp_v0->foldID = func_8013A704(1); temp_v0->entityID = create_generic_entity_world(NULL, mac_01_UnkFoldFunc); evt_set_variable(script, MapVar(10), (s32) temp_v0); diff --git a/src/world/area_mgm/mgm_02/E15D80.c b/src/world/area_mgm/mgm_02/E15D80.c index 8f6e321391..6667582fb8 100644 --- a/src/world/area_mgm/mgm_02/E15D80.c +++ b/src/world/area_mgm/mgm_02/E15D80.c @@ -436,7 +436,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) { case BOX_STATE_FUZZY_IDLE: data->box[i].stateTimer--; if (data->box[i].stateTimer <= 0) { - npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_2; + npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_2; data->box[i].state = BOX_STATE_FUZZY_POPUP; sfx_play_sound_at_position(enemy->varTable[8], 0x100000, npc->pos.x, npc->pos.y, npc->pos.z); get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); @@ -482,7 +482,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) { sfx_play_sound(enemy->varTable[8]); data->box[i].state = BOX_STATE_FUZZY_ATTACH; gPlayerStatusPtr->anim = ANIM_Mario_CrouchStill; - npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_3; + npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_3; get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); npc->pos.x = centerX; npc->pos.y = centerY; @@ -509,7 +509,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) { gPlayerStatusPtr->anim = ANIM_Mario_CrouchStill; npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_F; + npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_F; gPlayerStatusPtr->anim = ANIM_Mario_RunPanic; data->mashProgress = 0; npc->pos.x = gPlayerStatusPtr->position.x; @@ -535,7 +535,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) { hud_element_set_script(data->hudElemID_AButton, &HES_AButton); hud_element_set_alpha(data->hudElemID_AButton, 160); hud_element_set_alpha(data->hudElemID_Meter, 160); - npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_8; + npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_8; npc->pos.y += 3.0; } break; @@ -600,7 +600,7 @@ ApiStatus N(RunMinigame)(Evt* script, s32 isInitialCall) { case BOX_STATE_BOMB_HIT: enable_npc_shadow(npc); npc->duration = 15; - npc->currentAnim.w = NPC_ANIM_bob_omb_Palette_00_Anim_5; + npc->currentAnim = NPC_ANIM_bob_omb_Palette_00_Anim_5; data->stunFlags |= (STUN_FLAGS_STUNNED | STUN_FLAGS_CHANGED); data->box[i].state = BOX_STATE_BOMB_ATTACK; get_model_center_and_size(data->box[i].modelID, ¢erX, ¢erY, ¢erZ, &sizeX, &sizeY, &sizeZ); @@ -934,7 +934,7 @@ ApiStatus N(CleanupGame)(Evt* script, s32 isInitialCall) { if (data->box[i].state != BOX_STATE_FUZZY_END) { data->box[i].state = BOX_STATE_FUZZY_END; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback); - npc->currentAnim.w = NPC_ANIM_fuzzy_Palette_00_Anim_E; + npc->currentAnim = NPC_ANIM_fuzzy_Palette_00_Anim_E; enable_npc_shadow(npc); } break; @@ -943,7 +943,7 @@ ApiStatus N(CleanupGame)(Evt* script, s32 isInitialCall) { if (data->box[i].state != BOX_STATE_BOMB_END) { data->box[i].state = BOX_STATE_BOMB_END; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, 0.0f, 30, &writeback); - npc->currentAnim.w = NPC_ANIM_bob_omb_Palette_00_Anim_1C; + npc->currentAnim = NPC_ANIM_bob_omb_Palette_00_Anim_1C; enable_npc_shadow(npc); } break; diff --git a/src/world/area_pra/pra_35/D8D270.c b/src/world/area_pra/pra_35/D8D270.c index e4093c502d..e49631a255 100644 --- a/src/world/area_pra/pra_35/D8D270.c +++ b/src/world/area_pra/pra_35/D8D270.c @@ -28,7 +28,7 @@ ApiStatus func_802423CC_D8F61C(Evt *script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { npc->flags |= NPC_FLAG_GRAVITY; diff --git a/src/world/area_tik/tik_03/86F0F0.c b/src/world/area_tik/tik_03/86F0F0.c index ee3b31390b..e306dd9c9b 100644 --- a/src/world/area_tik/tik_03/86F0F0.c +++ b/src/world/area_tik/tik_03/86F0F0.c @@ -14,7 +14,7 @@ ApiStatus func_80240960_86F460(Evt* script, s32 isInitialCall) { if (gCollisionStatus.currentFloor != D_80242930_871430[i]) { continue; } - if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) { return ApiStatus_BLOCK; } } diff --git a/src/world/area_tik/tik_04/872020.c b/src/world/area_tik/tik_04/872020.c index ee55e1af42..c9dd3b4e73 100644 --- a/src/world/area_tik/tik_04/872020.c +++ b/src/world/area_tik/tik_04/872020.c @@ -63,7 +63,7 @@ ApiStatus func_80240C20_872650(Evt* script, s32 isInitialCall) { PlayerStatus* player = &gPlayerStatus; if ((gCollisionStatus.currentFloor == 9) || (gCollisionStatus.currentFloor == 0xB)) { - if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) { return ApiStatus_BLOCK; } } diff --git a/src/world/area_tik/tik_07/87AC00.c b/src/world/area_tik/tik_07/87AC00.c index e0d1add4fe..a4aeb96a84 100644 --- a/src/world/area_tik/tik_07/87AC00.c +++ b/src/world/area_tik/tik_07/87AC00.c @@ -12,7 +12,7 @@ ApiStatus func_80241390_87AF70(Evt* script, s32 isInitialCall) { if (gCollisionStatus.currentFloor != D_802449B0_87E590[i]) { continue; } - if ((player->actionState == ACTION_STATE_GROUND_POUND) || (player->actionState == ACTION_STATE_ULTRA_POUND)) { + if ((player->actionState == ACTION_STATE_SPIN_POUND) || (player->actionState == ACTION_STATE_TORNADO_POUND)) { return ApiStatus_BLOCK; } } diff --git a/src/world/area_trd/trd_05/9AE700.c b/src/world/area_trd/trd_05/9AE700.c index effe49abc8..e795e28d8e 100644 --- a/src/world/area_trd/trd_05/9AE700.c +++ b/src/world/area_trd/trd_05/9AE700.c @@ -87,14 +87,14 @@ void func_80240020_9AE720(void) { ApiStatus func_80240404_9AEB04(Evt* script, s32 isInitialCall) { N(D_80243090).pos.x = gPlayerStatus.position.x; - N(D_80243090).pos.y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * SPRITE_PIXEL_SCALE * 0.5); + N(D_80243090).pos.y = gPlayerStatus.position.y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5); N(D_80243090).pos.z = gPlayerStatus.position.z; N(D_80243090).rot.x = 0.0f; N(D_80243090).rot.y = 0.0f; N(D_80243090).rot.z = 0.0f; - N(D_80243090).scale.x = SPRITE_WORLD_SCALE; - N(D_80243090).scale.y = SPRITE_WORLD_SCALE; - N(D_80243090).scale.z = SPRITE_WORLD_SCALE; + N(D_80243090).scale.x = SPRITE_WORLD_SCALE_F; + N(D_80243090).scale.y = SPRITE_WORLD_SCALE_F; + N(D_80243090).scale.z = SPRITE_WORLD_SCALE_F; N(D_80243090).foldStateID = func_8013A704(1); N(D_80243090).entityID = create_generic_entity_world(0, func_80240020_9AE720); return ApiStatus_DONE2; @@ -113,7 +113,7 @@ ApiStatus func_80240508_9AEC08(Evt* script, s32 isInitialCall) { s32 z = evt_get_float_variable(script, *args++); N(D_80243090).pos.x = x; - N(D_80243090).pos.y = y + (gPlayerStatus.colliderHeight * SPRITE_PIXEL_SCALE * 0.5); + N(D_80243090).pos.y = y + (gPlayerStatus.colliderHeight * SPRITE_WORLD_SCALE_D * 0.5); N(D_80243090).pos.z = z; return ApiStatus_DONE2; } diff --git a/src/world/area_tst/tst_04/B1B570.c b/src/world/area_tst/tst_04/B1B570.c index 1c2834f30a..7f8a79e034 100644 --- a/src/world/area_tst/tst_04/B1B570.c +++ b/src/world/area_tst/tst_04/B1B570.c @@ -109,7 +109,7 @@ void func_80240360_B1B8D0(void* data) { guMtxCatF(main, rotation, main); guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(main, rotation, main); - guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z); guMtxCatF(main, translation, main); diff --git a/src/world/area_tst/tst_11/B1CA50.c b/src/world/area_tst/tst_11/B1CA50.c index cc486e3cb0..efdec2662f 100644 --- a/src/world/area_tst/tst_11/B1CA50.c +++ b/src/world/area_tst/tst_11/B1CA50.c @@ -51,11 +51,11 @@ void func_80240100_B1CB50(void* data) { guMtxCatF(main, rotation, main); guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(main, rotation, main); - guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z); guMtxCatF(main, translation, main); - spr_update_player_sprite(1, playerStatus->trueAnimation ^ 0x1000000, 1.0f); + spr_update_player_sprite(1, playerStatus->trueAnimation ^ SPRITE_ID_BACK_FACING, 1.0f); spr_draw_player_sprite(1, 0, 0, NULL, main); } @@ -104,7 +104,7 @@ void func_802403B8_B1CE08(void* data) { guMtxCatF(sp20, spA0, sp20); guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(sp20, spA0, sp20); - guScaleF(spE0, SPRITE_PIXEL_SCALE, -SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); + guScaleF(spE0, SPRITE_WORLD_SCALE_D, -SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); guTranslateF(sp60, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z); guMtxCatF(sp20, sp60, sp20); @@ -116,7 +116,7 @@ void func_802403B8_B1CE08(void* data) { guMtxCatF(sp20, spA0, sp20); guRotateF(spA0, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(sp20, spA0, sp20); - guScaleF(spE0, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE, SPRITE_PIXEL_SCALE); + guScaleF(spE0, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D, SPRITE_WORLD_SCALE_D); guMtxCatF(sp20, spE0, sp20); guTranslateF(sp60, playerStatus->position.x, playerStatus->position.y, 0.0f); guMtxCatF(sp20, sp60, sp20); diff --git a/src/world/area_tst/tst_13/B1D760.c b/src/world/area_tst/tst_13/B1D760.c index a932f963fd..cbf60b6b9b 100644 --- a/src/world/area_tst/tst_13/B1D760.c +++ b/src/world/area_tst/tst_13/B1D760.c @@ -8,7 +8,7 @@ ApiStatus func_80240000_B1D760(Evt* script, s32 isInitialCall) { f32 dist = dist2D(playerStatus->position.x, playerStatus->position.z, script->array[2], script->array[3]); script->varTable[0] = 1; - if (playerStatus->actionState != ACTION_STATE_GROUND_POUND && playerStatus->actionState != ACTION_STATE_ULTRA_POUND) { + if (playerStatus->actionState != ACTION_STATE_SPIN_POUND && playerStatus->actionState != ACTION_STATE_TORNADO_POUND) { script->varTable[0] = 0; } if (script->array[4] <= dist) { diff --git a/src/world/common/LetterDelivery.inc.c b/src/world/common/LetterDelivery.inc.c index d706cb5137..67b6d5adb9 100644 --- a/src/world/common/LetterDelivery.inc.c +++ b/src/world/common/LetterDelivery.inc.c @@ -45,14 +45,14 @@ ApiStatus N(LetterDelivery_CalcLetterPos)(Evt* script, s32 isInitialCall) { ApiStatus N(LetterDelivery_SaveNpcAnim)(Evt* script, s32 isInitialCall) { Npc* npc = get_npc_unsafe(script->varTable[2]); - N(LetterDelivery_SavedNpcAnim) = npc->currentAnim.w; - npc->currentAnim.w = script->varTable[4]; + N(LetterDelivery_SavedNpcAnim) = npc->currentAnim; + npc->currentAnim = script->varTable[4]; return ApiStatus_DONE2; } ApiStatus N(LetterDelivery_RestoreNpcAnim)(Evt* script, s32 isInitialCall) { Npc* npc = get_npc_unsafe(script->varTable[2]); - npc->currentAnim.w = N(LetterDelivery_SavedNpcAnim); + npc->currentAnim = N(LetterDelivery_SavedNpcAnim); return ApiStatus_DONE2; } diff --git a/src/world/common/UnkAngleFunc001.inc.c b/src/world/common/UnkAngleFunc001.inc.c index 3ac9da7649..42cf628e59 100644 --- a/src/world/common/UnkAngleFunc001.inc.c +++ b/src/world/common/UnkAngleFunc001.inc.c @@ -20,10 +20,10 @@ ApiStatus N(UnkAngleFunc001)(Evt* script, s32 isInitialCall) { } y = npc->pos.y; - if (npc->currentAnim.w == 0xB60000 || - npc->currentAnim.w == 0xB60004 || - npc->currentAnim.w == 0xB60008 || - npc->currentAnim.w == 0xB6000C) + if (npc->currentAnim == 0xB60000 || + npc->currentAnim == 0xB60004 || + npc->currentAnim == 0xB60008 || + npc->currentAnim == 0xB6000C) { y += 2.0f * sin_deg(N(unkAngle1)); } diff --git a/src/world/common/UnkFunc001.inc.c b/src/world/common/UnkFunc001.inc.c index b9f6f892cd..861a1cded4 100644 --- a/src/world/common/UnkFunc001.inc.c +++ b/src/world/common/UnkFunc001.inc.c @@ -43,7 +43,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) { switch (script->functionTemp[0]) { case 0: - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->verticalRenderOffset = npc->collisionHeight; npc->flags |= NPC_FLAG_UPSIDE_DOWN; script->functionTemp[1] = 0; @@ -63,7 +63,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) { break; } case 10: - npc->currentAnim.w = enemy->animList[3]; + npc->currentAnim = enemy->animList[3]; npc->planarFlyDist = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); npc->jumpScale = 1.3f; npc->jumpVelocity = 0.0f; @@ -173,7 +173,7 @@ ApiStatus N(UnkFunc001)(Evt* script, s32 isInitialCall) { break; } case 14: - npc->currentAnim.w = enemy->animList[8]; + npc->currentAnim = enemy->animList[8]; npc->verticalRenderOffset = npc->collisionHeight; npc->flags |= NPC_FLAG_UPSIDE_DOWN; npc->duration = 15; diff --git a/src/world/common/UnkFunc11.inc.c b/src/world/common/UnkFunc11.inc.c index 7905e35285..d4b1a29e52 100644 --- a/src/world/common/UnkFunc11.inc.c +++ b/src/world/common/UnkFunc11.inc.c @@ -6,7 +6,7 @@ ApiStatus N(UnkFunc11)(Evt* script, s32 isInitialCall) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; - if (((collisionStatus->pushingAgainstWall != pushableColliderID) && (playerStatus->actionState == ACTION_STATE_14)) || + if (((collisionStatus->pushingAgainstWall != pushableColliderID) && (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK)) || playerStatus->enableCollisionOverlapsCheck || playerStatus->inputEnabledCounter) { set_action_state(ACTION_STATE_IDLE); script->varTable[0] = 0; @@ -15,7 +15,7 @@ ApiStatus N(UnkFunc11)(Evt* script, s32 isInitialCall) { if (collisionStatus->pushingAgainstWall != pushableColliderID) { script->varTable[0] = 0; - } else if ((playerStatus->actionState != ACTION_STATE_14) && (playerStatus->actionState != ACTION_STATE_WALK) && + } else if ((playerStatus->actionState != ACTION_STATE_PUSHING_BLOCK) && (playerStatus->actionState != ACTION_STATE_WALK) && (playerStatus->actionState != ACTION_STATE_RUN)) { script->varTable[0] = 0; } else if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT) { diff --git a/src/world/common/UnkFunc44.inc.c b/src/world/common/UnkFunc44.inc.c index 10e1bf3114..7068f748d1 100644 --- a/src/world/common/UnkFunc44.inc.c +++ b/src/world/common/UnkFunc44.inc.c @@ -4,9 +4,9 @@ ApiStatus N(UnkFunc44)(Evt* script, s32 isInitialCall) { script->varTable[0] = 0; do {} while (0); - if (gPlayerStatus.actionState == ACTION_STATE_GROUND_POUND) { + if (gPlayerStatus.actionState == ACTION_STATE_SPIN_POUND) { script->varTable[0] = 1; - } else if (gPlayerStatus.actionState == ACTION_STATE_ULTRA_POUND) { + } else if (gPlayerStatus.actionState == ACTION_STATE_TORNADO_POUND) { script->varTable[0] = 1; } return ApiStatus_DONE2; diff --git a/src/world/common/atomic/Chest.inc.c b/src/world/common/atomic/Chest.inc.c index 3a9079ef6a..1ee424c508 100644 --- a/src/world/common/atomic/Chest.inc.c +++ b/src/world/common/atomic/Chest.inc.c @@ -7,18 +7,18 @@ // temporarily copied from StashVars to allow static varStash ApiStatus N(StashVars)(Evt* script, s32 isInitialCall) { - static s32** varStash = NULL; + static s32* varStash = NULL; s32 i; if (varStash == NULL) { varStash = heap_malloc(sizeof(script->varTable)); for (i = 0; i < ARRAY_COUNT(script->varTable); i++) { - varStash[i] = (s32*) script->varTable[i]; + varStash[i] = script->varTable[i]; } } else { for (i = 0; i < ARRAY_COUNT(script->varTable); i++) { - script->varTable[i] = (s32) varStash[i]; + script->varTable[i] = varStash[i]; } heap_free(varStash); diff --git a/src/world/common/atomic/Reflection.inc.c b/src/world/common/atomic/Reflection.inc.c index fc6ef5038c..91ec40788e 100644 --- a/src/world/common/atomic/Reflection.inc.c +++ b/src/world/common/atomic/Reflection.inc.c @@ -23,11 +23,11 @@ void N(SetPartnerFlags80000)(void); void N(SetPartnerFlags20000)(void); s32 N(reflection_unk_resolve_anim)(s32 playerAnim) { - u32 val; + AnimID temp; - playerAnim &= ~0x1000000; - val = playerAnim + ~0x6000B; - if (val < 0x10 && val & 1) { + playerAnim &= ~SPRITE_ID_BACK_FACING; + temp = playerAnim + ~ANIM_Mario_6000B; + if (temp < 16 && temp & 1) { playerAnim--; } @@ -35,32 +35,31 @@ s32 N(reflection_unk_resolve_anim)(s32 playerAnim) { } s32 N(reflection_unk_change_anim_facing)(s32 playerAnim) { - s32 temp_v1 = playerAnim >> 0x10; - u32 temp_v1_2; + s32 sprIndex = (playerAnim >> 0x10) & 0xFF; + u32 temp; - switch ((u8)temp_v1) { - case 1: - if (playerAnim > 0x1000C) { + switch (sprIndex) { + case SPR_Mario_1: + if (playerAnim > ANIM_Mario_1000C) { return playerAnim; } break; - case 6: - // above function, inlined - temp_v1_2 = playerAnim + 0xFFF9FFF4; // + ~0x0006000B - if (temp_v1_2 < 16) { - if (temp_v1_2 & 1) { + case SPR_Mario_6: + temp = playerAnim + ~ANIM_Mario_6000B; + if (temp < 16) { + if (temp & 1) { return playerAnim; } else { return playerAnim + 1; } } break; - case 8: - case 9: + case SPR_Mario_8: + case SPR_Mario_9: return playerAnim; } - return playerAnim | 0x1000000; + return playerAnim | SPRITE_ID_BACK_FACING; } ApiStatus N(ReflectWall)(Evt* script, s32 isInitialCall) { @@ -94,7 +93,7 @@ void N(reflection_setup_wall)(void) { spr_update_player_sprite(2, anim, 1.0f); - if (!(playerStatus->flags & 0x20000)) { + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_20000)) { if (playerStatus->alpha1 != D_802D9D70) { if (playerStatus->alpha1 < 254) { renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; @@ -132,7 +131,7 @@ void N(reflection_render_wall)(PlayerStatus* playerStatus) { guMtxCatF(main, rotation, main); guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(main, rotation, main); - guScaleF(scale, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); guTranslateF(translation, playerStatus->position.x, playerStatus->position.y, -playerStatus->position.z - 3.0f); guMtxCatF(main, translation, main); @@ -159,9 +158,7 @@ void N(reflection_setup_floor)(void) { s32 renderMode = playerStatus->renderMode; RenderTask renderTask; RenderTask* renderTaskPtr = &renderTask; - s32 screenX; - s32 screenY; - s32 screenZ; + s32 screenX, screenY, screenZ; if (playerStatus->flags & 1) { entityModel = get_entity_model(get_shadow_by_index(playerStatus->shadowID)->entityModelID); @@ -171,7 +168,7 @@ void N(reflection_setup_floor)(void) { spr_update_player_sprite(1, playerStatus->trueAnimation, 1.0f); - if (!(playerStatus->flags & 0x20000)) { + if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_20000)) { if (playerStatus->alpha1 != D_802D9D71) { if (playerStatus->alpha1 < 254) { renderMode = RENDER_MODE_SURFACE_XLU_LAYER1; @@ -191,7 +188,7 @@ void N(reflection_setup_floor)(void) { renderTaskPtr->appendGfxArg = playerStatus; renderTaskPtr->distance = -screenZ; renderTaskPtr->appendGfx = (void (*)(void*)) ( - !(playerStatus->flags & 0x20000) + !(playerStatus->flags & PLAYER_STATUS_FLAGS_20000) ? N(reflection_render_floor) : N(reflection_render_floor_fancy) ); @@ -214,7 +211,7 @@ void N(reflection_render_floor)(PlayerStatus* playerStatus) { guMtxCatF(main, rotation, main); guRotateF(rotation, playerStatus->spriteFacingAngle, 0.0f, 1.0f, 0.0f); guMtxCatF(main, rotation, main); - guScaleF(scale, SPRITE_WORLD_SCALE, -SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_F, -SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(main, scale, main); guTranslateF(translation, playerStatus->position.x, -playerStatus->position.y, playerStatus->position.z); guMtxCatF(main, translation, main); @@ -303,15 +300,14 @@ void N(reflection_render_floor_fancy)(PlayerStatus* playerStatus) { guMtxCatF(mtx, rotation, mtx); guTranslateF(translation, 0.0f, playerStatus->colliderHeight * 0.5f, 0.0f); guMtxCatF(mtx, translation, mtx); - guScaleF(scale, SPRITE_WORLD_SCALE, -SPRITE_WORLD_SCALE, SPRITE_WORLD_SCALE); + guScaleF(scale, SPRITE_WORLD_SCALE_F, -SPRITE_WORLD_SCALE_F, SPRITE_WORLD_SCALE_F); guMtxCatF(mtx, scale, mtx); guTranslateF(translation, px, -py, pz); guMtxCatF(mtx, translation, mtx); + flags = 1; if (playerStatus->spriteFacingAngle >= 90.0f && playerStatus->spriteFacingAngle < 270.0f) { - flags = 0x10000001; - } else { - flags = 1; + flags |= 0x10000000; } spr_draw_player_sprite(flags, 0, 0, NULL, mtx); diff --git a/src/world/common/enemy/BulletBillAI.inc.c b/src/world/common/enemy/BulletBillAI.inc.c index 6ac887b40a..a46f6e3615 100644 --- a/src/world/common/enemy/BulletBillAI.inc.c +++ b/src/world/common/enemy/BulletBillAI.inc.c @@ -88,14 +88,14 @@ ApiStatus N(BulletBillAI_Main)(Evt* script, s32 isInitialCall) { npc->pos.z = blasterNpc->pos.z + 1.0; npc->yaw = blasterNpc->yaw; npc->moveSpeed = aiSettings->chaseSpeed; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_RUN]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_RUN]; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 25.0f, npc->yaw); if (npc->yaw < 180.0f) { npc->renderYaw = 180.0f; } else { npc->renderYaw = 0.0f; } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->duration = 300; npc->flags |= (NPC_FLAG_DIRTY_SHADOW | NPC_FLAG_LOCK_ANIMS); enable_npc_shadow(npc); @@ -122,7 +122,7 @@ ApiStatus N(BulletBillAI_Main)(Evt* script, s32 isInitialCall) { } if (hitDetected) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_HIT]; ai_enemy_play_sound(npc, SOUND_B0000018, 0); fx_ring_blast(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 1.0f, 0.05f, 20); fx_smoke_burst(0, npc->pos.x, npc->pos.y + 5.0f, npc->pos.z + 0.0f, 1.2f, 25); @@ -162,7 +162,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall) { script->AI_TEMP_STATE = AI_STATE_BLASTER_INIT; npc->duration = 30; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; enemy->flags |= ENEMY_FLAGS_200000; disable_npc_shadow(npc); } @@ -173,7 +173,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) { } if (enemy->aiFlags & ENEMY_AI_FLAGS_4) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; if (enemy->aiPaused != 0) { return ApiStatus_BLOCK; } @@ -195,7 +195,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) { bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_INIT; bulletEnemy->AI_VAR_BULLET_BLASTER = enemy->npcID; bulletEnemy->AI_VAR_BULLET_RANGE = enemy->AI_VAR_BLASTER_RANGE; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_BLASTER_FIRE; } else { @@ -208,7 +208,7 @@ ApiStatus N(BillBlasterAI_Main)(Evt* script, s32 isInitialCall) { if (npc->duration > 0) { break; } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; bulletEnemy = get_enemy(enemy->AI_VAR_BLASTER_BULLET); bulletEnemy->VAR_PROJECTILE_HITBOX_STATE = PROJECTILE_HITBOX_STATE_PRE; ai_enemy_play_sound(npc, SOUND_328, 0x200000); diff --git a/src/world/common/enemy/CleftAI.inc.c b/src/world/common/enemy/CleftAI.inc.c index 87654e40a3..cb7b06b6d3 100644 --- a/src/world/common/enemy/CleftAI.inc.c +++ b/src/world/common/enemy/CleftAI.inc.c @@ -62,7 +62,7 @@ void N(CleftAI_HidingInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec npc->collisionRadius = 24; script->functionTemp[1] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[8]; + npc->currentAnim = enemy->animList[8]; script->AI_TEMP_STATE = AI_STATE_CLEFT_HIDING; } @@ -74,7 +74,7 @@ void N(CleftAI_Hiding)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol if (script->functionTemp[1] <= 0) { script->functionTemp[1] = aiSettings->playerSearchInterval; if (basic_ai_check_player_dist(volume, enemy, aiSettings->alertRadius * 0.85, aiSettings->alertOffsetDist, FALSE)) { - npc->currentAnim.w = enemy->animList[9]; + npc->currentAnim = enemy->animList[9]; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, 0x200000); npc->duration = 12; @@ -93,7 +93,7 @@ void N(CleftAI_PreAmbush)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration <= 0) { npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); enable_npc_shadow(npc); - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->duration = 8; script->AI_TEMP_STATE = AI_STATE_CLEFT_AMBUSH; } @@ -116,7 +116,7 @@ void N(CleftAI_FindPlayerInit)(Evt* script, MobileAISettings* aiSettings, EnemyD Npc* npc = get_npc_unsafe(enemy->npcID); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->functionTemp[1] = rand_int(1000) % 2 + 2; script->AI_TEMP_STATE = AI_STATE_CLEFT_FIND_PLAYER; } @@ -150,7 +150,7 @@ void N(CleftAI_RevUpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->duration = enemy->varTable[10]; - npc->currentAnim.w = enemy->animList[13]; + npc->currentAnim = enemy->animList[13]; script->AI_TEMP_STATE = AI_STATE_CLEFT_REV_UP; } @@ -220,7 +220,7 @@ void N(CleftAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDetec npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -256,7 +256,7 @@ void N(CleftAI_DisguiseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet if (npc->turnAroundYawAdjustment == 0 && npc->duration <= 0) { npc->duration = 8; - npc->currentAnim.w = enemy->animList[11]; + npc->currentAnim = enemy->animList[11]; script->AI_TEMP_STATE = AI_STATE_CLEFT_DISGUISE; } } @@ -268,7 +268,7 @@ void N(CleftAI_Disguise)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV npc->duration--; if (npc->duration <= 0) { npc->duration = 8; - npc->currentAnim.w = enemy->animList[14]; + npc->currentAnim = enemy->animList[14]; script->AI_TEMP_STATE = AI_STATE_CLEFT_POST_DISGUISE; } } diff --git a/src/world/common/enemy/ClubbaNappingAI.inc.c b/src/world/common/enemy/ClubbaNappingAI.inc.c index ff742016d5..f87ba94fdb 100644 --- a/src/world/common/enemy/ClubbaNappingAI.inc.c +++ b/src/world/common/enemy/ClubbaNappingAI.inc.c @@ -22,9 +22,9 @@ void N(ClubbaNappingAI_Init)(Evt* script, MobileAISettings* aiSettings, EnemyDet } if (npc->duration == 1) { - npc->currentAnim.w = enemy->animList[12]; + npc->currentAnim = enemy->animList[12]; } else if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->duration = 0; script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_SLEEP; } @@ -42,13 +42,13 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe if ( gPlayerStatusPtr->actionState == ACTION_STATE_RUN || gPlayerStatusPtr->actionState == ACTION_STATE_SPIN || gPlayerStatusPtr->actionState == ACTION_STATE_JUMP - || gPlayerStatusPtr->actionState == ACTION_STATE_GROUND_POUND - || gPlayerStatusPtr->actionState == ACTION_STATE_ULTRA_POUND + || gPlayerStatusPtr->actionState == ACTION_STATE_SPIN_POUND + || gPlayerStatusPtr->actionState == ACTION_STATE_TORNADO_POUND || gPlayerStatusPtr->actionState == ACTION_STATE_STEP_DOWN_LAND || gPlayerStatusPtr->actionState == ACTION_STATE_LAND || gPlayerStatusPtr->actionState == ACTION_STATE_HAMMER || gPlayerStatusPtr->actionState == ACTION_STATE_13 - || gPlayerStatusPtr->actionState == ACTION_STATE_25) { + || gPlayerStatusPtr->actionState == ACTION_STATE_INVALID_25) { shouldWakeUp = TRUE; } @@ -70,8 +70,8 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe } if (shouldWakeUp) { - ai_enemy_play_sound(npc, 0xB000000E, 0); - npc->currentAnim.w = enemy->animList[11]; + ai_enemy_play_sound(npc, SOUND_B000000E, 0); + npc->currentAnim = enemy->animList[11]; npc->duration = 10; fx_emote(EMOTE_EXCLAMATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); ai_enemy_play_sound(npc, SOUND_2F4, 0x200000); @@ -80,13 +80,13 @@ void N(ClubbaNappingAI_Sleep)(Evt* script, MobileAISettings* aiSettings, EnemyDe npc->duration++; if (npc->duration == 27) { - ai_enemy_play_sound(npc, 0xB000000C, 0); + ai_enemy_play_sound(npc, SOUND_B000000C, 0); } else if (npc->duration == 57) { - ai_enemy_play_sound(npc, 0xB000000D, 0); + ai_enemy_play_sound(npc, SOUND_B000000D, 0); } else if (npc->duration == 59) { - npc->currentAnim.w = enemy->animList[12]; + npc->currentAnim = enemy->animList[12]; } else if (npc->duration == 60) { - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->duration = 0; } } @@ -108,7 +108,7 @@ void N(ClubbaNappingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, En Npc* npc = get_npc_unsafe(enemy->npcID); npc->yaw = clamp_angle((npc->yaw + rand_int(180)) - 90.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->functionTemp[1] = (rand_int(1000) % 2) + 2; // chose random number 2-3 script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER; } @@ -153,7 +153,7 @@ void N(ClubbaNappingAI_ReturnHomeInit)(Evt* script, MobileAISettings* aiSettings npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -173,7 +173,7 @@ void N(ClubbaNappingAI_ReturnHome)(Evt* script, MobileAISettings* aiSettings, En script->AI_TEMP_STATE = AI_STATE_CHASE_INIT; } else if (dist2D(npc->pos.x, npc->pos.z, enemy->territory->wander.centerPos.x, enemy->territory->wander.centerPos.z) <= npc->moveSpeed) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 15; enemy->AI_VAR_NEXT_STATE = AI_STATE_NAPPING_CLUBBA_50; script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_LOITER_INIT; @@ -219,7 +219,7 @@ ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = AI_STATE_NAPPING_CLUBBA_INIT; npc->duration = 30; - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->flags &= ~NPC_FLAG_JUMPING; enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE; if (!enemy->territory->wander.isFlying) { @@ -230,7 +230,7 @@ ApiStatus N(ClubbaNappingAI_Main)(Evt* script, s32 isInitialCall) { if (enemy->aiFlags & ENEMY_AI_FLAGS_4) { script->AI_TEMP_STATE = AI_STATE_SUSPEND; script->AI_TEMP_STATE_AFTER_SUSPEND = AI_RETURN_HOME_INIT; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } enemy->aiFlags &= ~ENEMY_AI_FLAGS_4; } diff --git a/src/world/common/enemy/ClubbaPatrolAI.inc.c b/src/world/common/enemy/ClubbaPatrolAI.inc.c index e815c1860b..7a907668db 100644 --- a/src/world/common/enemy/ClubbaPatrolAI.inc.c +++ b/src/world/common/enemy/ClubbaPatrolAI.inc.c @@ -25,7 +25,7 @@ ApiStatus N(ClubbaPatrolAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = AI_STATE_PATROL_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~0x800; if (!enemy->territory->patrol.isFlying) { npc->flags |= 0x200; diff --git a/src/world/common/enemy/FireBarAI.inc.c b/src/world/common/enemy/FireBarAI.inc.c index aebaefd089..337c75d43a 100644 --- a/src/world/common/enemy/FireBarAI.inc.c +++ b/src/world/common/enemy/FireBarAI.inc.c @@ -101,7 +101,7 @@ ApiStatus N(FireBarAI_Main)(Evt* script, s32 isInitialCall) { angleToNpc = atan2(data->centerPos.x, data->centerPos.z, npc->pos.x, npc->pos.z); deltaYaw = get_clamped_angle_diff(angleToPlayer, angleToNpc); if ((hitDetected > 0) && (playerStatus->actionState != ACTION_STATE_HIT_FIRE)) { - playerStatus->unk_BF = 3; + playerStatus->hazardType = HAZARD_TYPE_FIRE_BAR; set_action_state(ACTION_STATE_HIT_FIRE); sfx_play_sound_at_position(SOUND_E8, 0, playerStatus->position.x, playerStatus->position.y, playerStatus->position.z); gCurrentEncounter.battleTriggerCooldown = 45; diff --git a/src/world/common/enemy/FlyingAI.inc.c b/src/world/common/enemy/FlyingAI.inc.c index dd1b321659..9907357181 100644 --- a/src/world/common/enemy/FlyingAI.inc.c +++ b/src/world/common/enemy/FlyingAI.inc.c @@ -29,7 +29,7 @@ void N(FlyingAI_WanderInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete } else { npc->yaw = clamp_angle((npc->yaw + rand_int(60)) - 30.0f); } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; script->functionTemp[1] = 0; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; @@ -189,7 +189,7 @@ void N(FlyingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim.w = *enemy->animList; + npc->currentAnim = *enemy->animList; script->functionTemp[0] = 3; } @@ -266,7 +266,7 @@ void N(FlyingAI_JumpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration = 0; npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; script->functionTemp[0] = AI_STATE_ALERT; } @@ -286,7 +286,7 @@ void N(FlyingAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec f32 jumpVelocity = (f32)enemy->varTable[5] / 100.0; f32 jumpScale = (f32)enemy->varTable[6] / 100.0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->jumpVelocity = jumpVelocity; npc->jumpScale = jumpScale; npc->moveSpeed = aiSettings->chaseSpeed; @@ -338,7 +338,7 @@ void N(FlyingAI_LosePlayer)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (npc->jumpVelocity >= 0.0) { npc->pos.y += npc->jumpVelocity; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; enemy->unk_07 = 0; if (!(npc->flags & NPC_FLAG_ENABLE_HIT_SCRIPT)) { posX = npc->pos.x; diff --git a/src/world/common/enemy/FlyingMagikoopaAI.inc.c b/src/world/common/enemy/FlyingMagikoopaAI.inc.c index c420226dfa..da87a09752 100644 --- a/src/world/common/enemy/FlyingMagikoopaAI.inc.c +++ b/src/world/common/enemy/FlyingMagikoopaAI.inc.c @@ -193,14 +193,14 @@ void N(FlyingMagikoopaAI_21)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration == 0) { - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 15; script->functionTemp[0] = 50; } else if ((N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory) == 1) && (npc->turnAroundYawAdjustment == 0)) { ai_enemy_play_sound(npc, 0x20D4, 0); - npc->currentAnim.w = enemy->animList[8]; + npc->currentAnim = enemy->animList[8]; posX = npc->pos.x; posY = npc->pos.y + 29.0f; posZ = npc->pos.z + 1.0f; @@ -217,7 +217,7 @@ void N(FlyingMagikoopaAI_22)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[9]; + npc->currentAnim = enemy->animList[9]; npc->duration = 7; script->functionTemp[0] = 0x17; } @@ -234,7 +234,7 @@ void N(FlyingMagikoopaAI_23)(Evt* script, MobileAISettings* aiSettings, EnemyDet temp_s1 = N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory); if (temp_s1 != 1) { fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 15; script->functionTemp[0] = 50; } else { @@ -256,7 +256,7 @@ void N(FlyingMagikoopaAI_24)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 3; script->AI_TEMP_STATE = 50; } diff --git a/src/world/common/enemy/FlyingNoAttackAI.inc.c b/src/world/common/enemy/FlyingNoAttackAI.inc.c index 39d220b37e..e0697b052e 100644 --- a/src/world/common/enemy/FlyingNoAttackAI.inc.c +++ b/src/world/common/enemy/FlyingNoAttackAI.inc.c @@ -17,7 +17,7 @@ void N(FlyingNoAttackAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDete f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); @@ -47,7 +47,7 @@ void N(FlyingNoAttackAI_13)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1) == 0) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xF, &var); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 30; script->functionTemp[0] = 20; enemy->varTable[9] = 30; diff --git a/src/world/common/enemy/GrooveGuyAI.inc.c b/src/world/common/enemy/GrooveGuyAI.inc.c index c8aa6b4b79..cb730231a6 100644 --- a/src/world/common/enemy/GrooveGuyAI.inc.c +++ b/src/world/common/enemy/GrooveGuyAI.inc.c @@ -20,20 +20,20 @@ void N(GrooveGuyAI_03)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol case 0: enemy->varTable[0] = 1; enemy->varTable[1] = 0; - npc->currentAnim.w = 0x3C000C; + npc->currentAnim = 0x3C000C; set_npc_yaw(npc, 270.0f); npc->rotation.y = 0.0f; // fallthrough case 1: phase = enemy->varTable[1] % 16; if (phase < 4) { - npc->currentAnim.w = 0x3C000C; + npc->currentAnim = 0x3C000C; } else if (phase < 8) { - npc->currentAnim.w = 0x3C000B; + npc->currentAnim = 0x3C000B; } else if (phase < 12) { - npc->currentAnim.w = 0x3C000C; + npc->currentAnim = 0x3C000C; } else if (phase < 16) { - npc->currentAnim.w = 0x3C000D; + npc->currentAnim = 0x3C000D; } enemy->varTable[1]++; if (enemy->varTable[1] >= 0x41) { @@ -44,7 +44,7 @@ void N(GrooveGuyAI_03)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol enemy->varTable[0] = 3; enemy->varTable[1] = 0; npc->rotation.y = 0.0f; - npc->currentAnim.w = 0x3C000C; + npc->currentAnim = 0x3C000C; // fallthrough case 3: npc->rotation.y += 35.0; @@ -88,7 +88,7 @@ ApiStatus N(GrooveGuyAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || enemy->aiFlags & 4) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/HoppingAI.inc.c b/src/world/common/enemy/HoppingAI.inc.c index e98fc74040..8ea61573b0 100644 --- a/src/world/common/enemy/HoppingAI.inc.c +++ b/src/world/common/enemy/HoppingAI.inc.c @@ -118,7 +118,7 @@ void N(HoppingAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->AI_TEMP_STATE = 3; } diff --git a/src/world/common/enemy/KoopaPatrolAI.inc.c b/src/world/common/enemy/KoopaPatrolAI.inc.c index 19a022aced..3a3ed3f129 100644 --- a/src/world/common/enemy/KoopaPatrolAI.inc.c +++ b/src/world/common/enemy/KoopaPatrolAI.inc.c @@ -32,7 +32,7 @@ ApiStatus N(KoopaPatrolAI_Main)(Evt* script, s32 isInitialCall) { npc->duration = 0; script->functionTemp[0] = 0; enemy->unk_07 = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; npc->collisionHeight = enemy->varTable[6]; enemy->unk_B5 = 0; diff --git a/src/world/common/enemy/LakituAI.inc.c b/src/world/common/enemy/LakituAI.inc.c index 2154d48d66..afec570cc4 100644 --- a/src/world/common/enemy/LakituAI.inc.c +++ b/src/world/common/enemy/LakituAI.inc.c @@ -230,7 +230,7 @@ s32 N(LakituAI_Main)(Evt* script, s32 isInitialCall) { spinyEnemy->varTable[10] = 1; spinyEnemy->varTable[11] = enemy->npcID; npc->duration = 15; - npc->currentAnim.w = NPC_ANIM_lakitu_Palette_00_Anim_14; + npc->currentAnim = NPC_ANIM_lakitu_Palette_00_Anim_14; script->AI_TEMP_STATE = 30; } } @@ -263,7 +263,7 @@ s32 N(LakituAI_Main)(Evt* script, s32 isInitialCall) { if (npc->duration > 0) { break; } - npc->currentAnim.w = NPC_ANIM_lakitu_Palette_00_Anim_15; + npc->currentAnim = NPC_ANIM_lakitu_Palette_00_Anim_15; spinyEnemy = get_enemy(enemy->varTable[4]); spinyEnemy->varTable[10] = 3; npc->duration = 10; diff --git a/src/world/common/enemy/MagikoopaAI.inc.c b/src/world/common/enemy/MagikoopaAI.inc.c index 5f9462c463..305755e07c 100644 --- a/src/world/common/enemy/MagikoopaAI.inc.c +++ b/src/world/common/enemy/MagikoopaAI.inc.c @@ -18,7 +18,7 @@ void N(MagikoopaAI_00)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~2; npc->duration = 0; script->AI_TEMP_STATE = 1; @@ -76,7 +76,7 @@ void N(MagikoopaAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol f32 posX, posY, posZ; enemy->varTable[0] = 1; - npc->currentAnim.w = enemy->animList[8]; + npc->currentAnim = enemy->animList[8]; npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); npc->flags &= ~2; npc->scale.x = 0.1f; @@ -157,16 +157,16 @@ void N(MagikoopaAI_21)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration == 0) { - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 12, &emoteTemp); - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 0xF; script->AI_TEMP_STATE = 0; return; } if (N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory) == 1) { ai_enemy_play_sound(npc, SOUND_SPELL_CAST1, 0); - npc->currentAnim.w = enemy->animList[8]; + npc->currentAnim = enemy->animList[8]; posX = npc->pos.x; posY = npc->pos.y + 32.0f; posZ = npc->pos.z + 1.0f; @@ -183,7 +183,7 @@ void N(MagikoopaAI_22)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol temp_v0->duration--; if (temp_v0->duration <= 0) { - temp_v0->currentAnim.w = temp_s0->animList[9]; + temp_v0->currentAnim = temp_s0->animList[9]; temp_v0->duration = 9; script->AI_TEMP_STATE = 0x17; } @@ -200,7 +200,7 @@ void N(MagikoopaAI_23)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol projectileEnemy = N(MagikoopaAI_CanShootSpell)(script, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, territory); if (projectileEnemy != 1) { fx_emote(2, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0xC, &emoteTemp); - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 15; script->AI_TEMP_STATE = 0; } else { @@ -218,7 +218,7 @@ void N(MagikoopaAI_24)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol npc->duration--; if (npc->duration <= 0) { - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->duration = 3; script->AI_TEMP_STATE = 0; } @@ -246,7 +246,7 @@ ApiStatus N(MagikoopaAI_Main)(Evt* script, s32 isInitialCall) { territory.detectFlags = 0; if (isInitialCall || (enemy->aiFlags & 4)) { - npc->currentAnim.w = enemy->animList[0]; + npc->currentAnim = enemy->animList[0]; npc->flags &= ~0x800; npc->flags |= 0x200000; enemy->flags |= 0x200000; @@ -317,7 +317,7 @@ ApiStatus N(MagikoopaAI_OnPlayerFled)(Evt* script, s32 isInitialCall) { Npc* npc = get_npc_unsafe(enemy->npcID); npc->alpha = 255; - npc->currentAnim.w = enemy->animList[2]; + npc->currentAnim = enemy->animList[2]; npc->duration = 0; script->functionTemp[0] = 0; return ApiStatus_DONE2; diff --git a/src/world/common/enemy/MeleeHitbox.inc.c b/src/world/common/enemy/MeleeHitbox.inc.c index c181022bf4..f5440c32d8 100644 --- a/src/world/common/enemy/MeleeHitbox.inc.c +++ b/src/world/common/enemy/MeleeHitbox.inc.c @@ -17,7 +17,7 @@ void N(MeleeHitbox_30)(Evt* script) { if (npc->turnAroundYawAdjustment == 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_PRE; npc->duration = enemy->AI_VAR_MELEE_PRE_TIME; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; script->AI_TEMP_STATE = AI_STATE_MELEE_HITBOX_PRE; } } @@ -30,7 +30,7 @@ void N(MeleeHitbox_31)(Evt* script) { if (npc->duration <= 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_ACTIVE; npc->duration = enemy->AI_VAR_MELEE_HIT_TIME; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; script->AI_TEMP_STATE = AI_STATE_MELEE_HITBOX_ACTIVE; } } @@ -43,7 +43,7 @@ void N(MeleeHitbox_32)(Evt* script) { npc->duration--; if (npc->duration <= 0) { enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_POST; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = enemy->AI_VAR_MELEE_MISS_TIME; if (enemy->AI_VAR_MELEE_MISS_TIME >= 8) { fx_emote(EMOTE_FRUSTRATION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, enemy->AI_VAR_MELEE_MISS_TIME - 1, &emoteTemp); diff --git a/src/world/common/enemy/MontyMoleAI.inc.c b/src/world/common/enemy/MontyMoleAI.inc.c index 5d84ef0700..bda63f3fbd 100644 --- a/src/world/common/enemy/MontyMoleAI.inc.c +++ b/src/world/common/enemy/MontyMoleAI.inc.c @@ -131,7 +131,7 @@ static void N(MontyMoleAI_PreSurface)(Evt* script, MobileAISettings* aiSettings, npc->flags &= -(NPC_FLAG_PASSIVE | NPC_FLAG_2); ai_enemy_play_sound(npc, SOUND_MOLE_SURFACE, 0); npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - npc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_10; // emerge from ground + npc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_10; // emerge from ground npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_MOLE_SURFACE; } @@ -145,7 +145,7 @@ static void N(MontyMoleAI_Surface)(Evt* script, MobileAISettings* aiSettings, En enemy->flags &= ~MONTY_MOLE_UNK_NPC_FLAGS; } if (npc->duration <= 0) { - npc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_18; // get and throw rock + npc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_18; // get and throw rock npc->duration = 10; script->AI_TEMP_STATE = AI_STATE_MOLE_DRAW_ROCK; } @@ -160,11 +160,11 @@ static void N(MontyMoleAI_DrawRock)(Evt* script, MobileAISettings* aiSettings, E if ((npc->duration) <= 0) { if (!N(MontyMoleAI_CanAttack)(script, territory, aiSettings->alertRadius * 1.1, aiSettings->alertOffsetDist)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteOut); - npc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_1; // cancel attack + npc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_1; // cancel attack npc->duration = 30; script->AI_TEMP_STATE = AI_STATE_MOLE_PRE_BURROW; } else { - npc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_1B; // throw rock + npc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_1B; // throw rock npc->duration = 15; script->AI_TEMP_STATE = AI_STATE_MOLE_THROW_ROCK; } @@ -186,12 +186,12 @@ static void N(MontyMoleAI_ThrowRock)(Evt* script, MobileAISettings* aiSettings, } if (moleNpc->duration < 8) { if (dist2D(moleNpc->pos.x, moleNpc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z) > 100.0) { - moleNpc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_15; // clap + moleNpc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_15; // clap } } if (moleNpc->duration <= 0) { - if (moleNpc->currentAnim.w != NPC_ANIM_monty_mole_Palette_00_Anim_15) { - moleNpc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_1; + if (moleNpc->currentAnim != NPC_ANIM_monty_mole_Palette_00_Anim_15) { + moleNpc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_1; } moleNpc->duration = 15; script->AI_TEMP_STATE = AI_STATE_MOLE_PRE_BURROW; @@ -206,7 +206,7 @@ static void N(MontyMoleAI_PreBurrow)(Evt* script, MobileAISettings* aiSettings, if (npc->duration <= 0) { ai_enemy_play_sound(npc, SOUND_MOLE_DIG, 0); npc->duration = 11; - npc->currentAnim.w = NPC_ANIM_monty_mole_Palette_00_Anim_11; // retreat into ground + npc->currentAnim = NPC_ANIM_monty_mole_Palette_00_Anim_11; // retreat into ground script->AI_TEMP_STATE = AI_STATE_MOLE_BURROW; } } diff --git a/src/world/common/enemy/ParatroopaAI.inc.c b/src/world/common/enemy/ParatroopaAI.inc.c index 5abb5af559..4041fd0a79 100644 --- a/src/world/common/enemy/ParatroopaAI.inc.c +++ b/src/world/common/enemy/ParatroopaAI.inc.c @@ -17,7 +17,7 @@ void N(ParatroopaAI_Windup)(Evt* script, MobileAISettings* aiSettings, EnemyDete Npc* npc = get_npc_unsafe(enemy->npcID); f32 yawTemp; - npc->currentAnim.w = enemy->animList[9]; + npc->currentAnim = enemy->animList[9]; npc->jumpVelocity = -5.0f; npc->jumpScale = 0.15f; npc->collisionHeight = enemy->varTable[8] / 2; @@ -50,7 +50,7 @@ void N(ParatroopaAI_Dive)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->jumpScale = 0.3f; npc->jumpVelocity = 0.0f; npc->moveSpeed = 3.0f; - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; script->AI_TEMP_STATE = AI_STATE_PARATROOPA_OVERSHOOT; } } @@ -81,7 +81,7 @@ void N(ParatroopaAI_Overshoot)(Evt *script, MobileAISettings *arg1, EnemyDetectV if (!(npc->pos.y < endOvershootHeight)) { npc->duration = 10; - npc->currentAnim.w = enemy->animList[11]; + npc->currentAnim = enemy->animList[11]; npc->collisionHeight = enemy->varTable[8]; script->AI_TEMP_STATE = AI_STATE_PARATROOPA_RESET; } diff --git a/src/world/common/enemy/PatrolNoAttackAI.inc.c b/src/world/common/enemy/PatrolNoAttackAI.inc.c index 84ab6688fc..831356418e 100644 --- a/src/world/common/enemy/PatrolNoAttackAI.inc.c +++ b/src/world/common/enemy/PatrolNoAttackAI.inc.c @@ -41,7 +41,7 @@ ApiStatus N(PatrolNoAttackAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAGS_4) { script->AI_TEMP_STATE = AI_STATE_PATROL_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { diff --git a/src/world/common/enemy/ProjectileHitbox.inc.c b/src/world/common/enemy/ProjectileHitbox.inc.c index 971ad5cfcb..1cc1366ff6 100644 --- a/src/world/common/enemy/ProjectileHitbox.inc.c +++ b/src/world/common/enemy/ProjectileHitbox.inc.c @@ -58,14 +58,14 @@ void N(UnkNpcAIFunc48)(Evt* script, f32 arg1, f32 arg2, EnemyDetectVolume* terri s32 sp28; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &sp28); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 20; script->functionTemp[0] = 33; } else { s32 npcID = N(ProjectileHitbox_GetUsableProjectileID)(script); if (npcID != NPC_SELF && get_enemy(npcID)->varTable[0] == 0 && npc->turnAroundYawAdjustment == 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->duration = enemy->varTable[1]; script->functionTemp[0] = 30; } @@ -84,11 +84,11 @@ void N(ProjectileHitbox_30)(Evt* script) { s32 emoteTemp; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; } else { Enemy* hitboxEnemy; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; hitboxEnemy = get_enemy(npcID); hitboxEnemy->varTable[4] = enemy->npcID; hitboxEnemy->varTable[0] = 1; @@ -113,7 +113,7 @@ void N(ProjectileHitbox_32)(Evt* script) { npc->yaw = atan2(npc->pos.x, npc->pos.z, npc2->pos.x, npc2->pos.z); if (enemy2->varTable[0] == 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = enemy->varTable[2]; script->functionTemp[0] = AI_STATE_PROJECTILE_HITBOX_33; } diff --git a/src/world/common/enemy/RangedAttackAI.inc.c b/src/world/common/enemy/RangedAttackAI.inc.c index a63f778a5e..0907a7bef0 100644 --- a/src/world/common/enemy/RangedAttackAI.inc.c +++ b/src/world/common/enemy/RangedAttackAI.inc.c @@ -32,7 +32,7 @@ ApiStatus N(RangedAttackAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/SentinelAI.inc.c b/src/world/common/enemy/SentinelAI.inc.c index 994852a59f..654dce3b74 100644 --- a/src/world/common/enemy/SentinelAI.inc.c +++ b/src/world/common/enemy/SentinelAI.inc.c @@ -49,7 +49,7 @@ void N(SentinelAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDet if (npc->duration <= 0) { npc->flags &= ~NPC_FLAG_200000; npc->duration = aiSettings->chaseUpdateInterval / 2 + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->moveSpeed = aiSettings->chaseSpeed; angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); deltaAngle = get_clamped_angle_diff(npc->yaw, angle); @@ -164,7 +164,7 @@ void N(SentinelAI_LosePlayerInit)(Evt* script, MobileAISettings* aiSettings, Ene sfx_stop_sound(SOUND_80000011); enemy->varTable[0] &= ~SENTINEL_AI_FLAG_PLAYING_SOUND; } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; npc->duration = 20; script->AI_TEMP_STATE = AI_STATE_SENTINEL_LOSE_PLAYER; } diff --git a/src/world/common/enemy/ShyGuyPatrolAI.inc.c b/src/world/common/enemy/ShyGuyPatrolAI.inc.c index c52b2e9a9d..f3cdf2c891 100644 --- a/src/world/common/enemy/ShyGuyPatrolAI.inc.c +++ b/src/world/common/enemy/ShyGuyPatrolAI.inc.c @@ -8,7 +8,7 @@ void N(ShyGuyPatrolAI_14)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->moveSpeed *= 0.6; - npc->currentAnim.w = enemy->animList[12]; + npc->currentAnim = enemy->animList[12]; npc->duration = 5; script->functionTemp[0] = 0xF; } @@ -26,7 +26,7 @@ void N(ShyGuyPatrolAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration == 0) { npc->moveSpeed *= 0.6; - npc->currentAnim.w = enemy->animList[11]; + npc->currentAnim = enemy->animList[11]; npc->duration = 10; script->functionTemp[0] = 16; } @@ -54,7 +54,7 @@ void N(ShyGuyPatrolAI_17)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; if (npc->duration == 0) { - npc->currentAnim.w = *enemy->animList; + npc->currentAnim = *enemy->animList; script->functionTemp[0] = 0; } } @@ -83,7 +83,7 @@ ApiStatus N(ShyGuyPatrolAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || enemy->aiFlags & 4) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->patrol.isFlying) { diff --git a/src/world/common/enemy/ShyGuyWanderAI.inc.c b/src/world/common/enemy/ShyGuyWanderAI.inc.c index 3be9eb6ac7..8e29a96f87 100644 --- a/src/world/common/enemy/ShyGuyWanderAI.inc.c +++ b/src/world/common/enemy/ShyGuyWanderAI.inc.c @@ -6,7 +6,7 @@ void N(ShyGuyWanderAI_14)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Npc* npc = get_npc_unsafe(enemy->npcID); npc->moveSpeed *= 0.6; - npc->currentAnim.w = enemy->animList[12]; + npc->currentAnim = enemy->animList[12]; npc->duration = 5; script->functionTemp[0] = 0xF; } @@ -24,7 +24,7 @@ void N(ShyGuyWanderAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration == 0) { npc->moveSpeed *= 0.6; - npc->currentAnim.w = enemy->animList[11]; + npc->currentAnim = enemy->animList[11]; npc->duration = 10; script->functionTemp[0] = 16; } @@ -52,7 +52,7 @@ void N(ShyGuyWanderAI_17)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; if (npc->duration == 0) { - npc->currentAnim.w = *enemy->animList; + npc->currentAnim = *enemy->animList; script->functionTemp[0] = 0; } } @@ -81,7 +81,7 @@ ApiStatus N(ShyGuyWanderAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || enemy->aiFlags & 4) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/SpearGuyAI.inc.c b/src/world/common/enemy/SpearGuyAI.inc.c index fa4ddffa1f..b9aaf7a039 100644 --- a/src/world/common/enemy/SpearGuyAI.inc.c +++ b/src/world/common/enemy/SpearGuyAI.inc.c @@ -31,7 +31,7 @@ void N(SpearGuyAI_Loiter)(Evt *script, MobileAISettings* aiSettings, EnemyDetect case 1: enemy->varTable[0] = 2; enemy->varTable[1] = 0; - npc->currentAnim.w = NPC_ANIM_jungle_guy_Palette_00_Anim_F; + npc->currentAnim = NPC_ANIM_jungle_guy_Palette_00_Anim_F; case 2: enemy->varTable[1]++; if (enemy->varTable[1] > 50) { @@ -41,7 +41,7 @@ void N(SpearGuyAI_Loiter)(Evt *script, MobileAISettings* aiSettings, EnemyDetect case 3: enemy->varTable[0] = 4; enemy->varTable[1] = 0; - npc->currentAnim.w = NPC_ANIM_jungle_guy_Palette_00_Anim_10; + npc->currentAnim = NPC_ANIM_jungle_guy_Palette_00_Anim_10; case 4: enemy->varTable[1]++; if (enemy->varTable[1] == 25) { @@ -54,7 +54,7 @@ void N(SpearGuyAI_Loiter)(Evt *script, MobileAISettings* aiSettings, EnemyDetect case 5: enemy->varTable[0] = 6; enemy->varTable[1] = 0; - npc->currentAnim.w = NPC_ANIM_jungle_guy_Palette_00_Anim_3; + npc->currentAnim = NPC_ANIM_jungle_guy_Palette_00_Anim_3; fx_sweat(0, npc->pos.x, npc->pos.y, npc->pos.z, npc->collisionHeight, 0, 10); case 6: enemy->varTable[1]++; @@ -100,7 +100,7 @@ ApiStatus N(SpearGuyAI_Main)(Evt *script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/SpinyAI.inc.c b/src/world/common/enemy/SpinyAI.inc.c index 9483817adc..a243a5977e 100644 --- a/src/world/common/enemy/SpinyAI.inc.c +++ b/src/world/common/enemy/SpinyAI.inc.c @@ -47,7 +47,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->varTable[10] == 100)) { script->AI_TEMP_STATE = 100; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; enemy->flags |= ENEMY_FLAGS_200000; npc->flags &= ~NPC_FLAG_GRAVITY; @@ -64,7 +64,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { npc->collisionHeight = enemy->varTable[6]; enemy->aiFlags &= ~ENEMY_AI_FLAGS_4; if (npc->flags & NPC_FLAG_JUMPING) { - npc->currentAnim.w = 0x4A0018; + npc->currentAnim = 0x4A0018; npc->moveSpeed = 0.0f; npc->jumpVelocity = 0.0f; npc->jumpScale = 1.0f; @@ -72,7 +72,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { } else { s32 emoteTemp; fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 0x28, &emoteTemp); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->functionTemp[1] = 0; script->AI_TEMP_STATE = 200; } @@ -134,7 +134,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { npc->flags &= ~NPC_FLAG_2; npc->flags &= ~NPC_FLAG_GRAVITY; npc->renderYaw = 0.0f; - npc->currentAnim.w = 0x4A0018; + npc->currentAnim = 0x4A0018; script->AI_TEMP_STATE = 101; case 101: if (enemy->varTable[10] != 3) { @@ -192,7 +192,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { npc->flags &= ~NPC_FLAG_JUMPING; npc->jumpVelocity = 0.0f; npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); - npc->currentAnim.w = 0x4A001A; + npc->currentAnim = 0x4A001A; npc->duration = 3; script->AI_TEMP_STATE = 103; break; @@ -205,7 +205,7 @@ ApiStatus N(SpinyAI_Main)(Evt* script, s32 isInitialCall) { npc->duration--; if (npc->duration <= 0) { npc->flags &= ~NPC_FLAG_40000; - npc->currentAnim.w = 0x4A0001; + npc->currentAnim = 0x4A0001; script->AI_TEMP_STATE = 0; } break; diff --git a/src/world/common/enemy/States_PatrolAI.inc.c b/src/world/common/enemy/States_PatrolAI.inc.c index 99bc3efc9f..57042c29bf 100644 --- a/src/world/common/enemy/States_PatrolAI.inc.c +++ b/src/world/common/enemy/States_PatrolAI.inc.c @@ -34,7 +34,7 @@ void N(PatrolAI_MoveInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect } } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; if (enemy->territory->patrol.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -99,7 +99,7 @@ void N(PatrolAI_LoiterInit)(Evt* script, MobileAISettings* aiSettings, EnemyDete npc->duration = (aiSettings->waitTime / 2) + rand_int((aiSettings->waitTime / 2) + 1); npc->yaw = clamp_angle(npc->yaw + rand_int(180) - 90.0f); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->AI_TEMP_STATE = AI_STATE_LOITER; } @@ -146,7 +146,7 @@ void N(PatrolAI_PostLoiter)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (script->functionTemp[2] >= enemy->territory->patrol.numPoints) { script->functionTemp[2] = 0; } - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; if (enemy->territory->patrol.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->moveSpeed; } else { @@ -159,7 +159,7 @@ void N(PatrolAI_JumpInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetect Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_JUMP]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_JUMP]; npc->jumpVelocity = 10.0f; npc->jumpScale = 2.0f; npc->moveToPos.y = npc->pos.y; @@ -188,7 +188,7 @@ void N(PatrolAI_ChaseInit)(Evt* script, MobileAISettings* aiSettings, EnemyDetec f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; angle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); @@ -215,7 +215,7 @@ ApiStatus N(PatrolAI_Chase)(Evt* script, MobileAISettings* aiSettings, EnemyDete if (!basic_ai_check_player_dist(territory, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { @@ -257,7 +257,7 @@ void N(PatrolNoAttackAI_15)(Evt* script, MobileAISettings* aiSettings, EnemyDete } npc->moveSpeed = aiSettings->moveSpeed; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; script->functionTemp[1] = 0; script->AI_TEMP_STATE = AI_STATE_PATROL; } diff --git a/src/world/common/enemy/States_TackleAI.inc.c b/src/world/common/enemy/States_TackleAI.inc.c index cc196b683f..981e8a3b09 100644 --- a/src/world/common/enemy/States_TackleAI.inc.c +++ b/src/world/common/enemy/States_TackleAI.inc.c @@ -11,7 +11,7 @@ void N(set_script_owner_npc_anim)(Evt* script, MobileAISettings* aiSettings, Ene Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->duration = enemy->varTable[2]; npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); script->AI_TEMP_STATE = 13; @@ -24,7 +24,7 @@ ApiStatus N(UnkDistFunc)(Evt* script, MobileAISettings* aiSettings, EnemyDetectV if ((npc->duration <= 0) || (--npc->duration <= 0)) { if (npc->turnAroundYawAdjustment == 0) { - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; npc->moveSpeed = aiSettings->chaseSpeed; if ((enemy->varTable[7] == 5) || (enemy->varTable[7] == 0) || (enemy->varTable[7] == 1)) { npc->collisionHeight = enemy->varTable[6] / 2; @@ -66,7 +66,7 @@ void N(UnkNpcAIFunc12)(Evt* script, MobileAISettings* aiSettings, EnemyDetectVol if ((npc->duration <= 0) || (--npc->duration <= 0) || (temp != 0)) { enemy->unk_07 = 0; - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->duration = 0; script->functionTemp[0] = 15; } diff --git a/src/world/common/enemy/StationaryAI.inc.c b/src/world/common/enemy/StationaryAI.inc.c index 03eecebb20..9d0a26d6ec 100644 --- a/src/world/common/enemy/StationaryAI.inc.c +++ b/src/world/common/enemy/StationaryAI.inc.c @@ -23,7 +23,7 @@ void N(StationaryAI_IdleInit)(Evt* script, StationaryAISettings* aiSettings, Ene Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->AI_TEMP_STATE = AI_STATE_STATIONARY_IDLE; if (enemy->flags & ENEMY_FLAGS_100000) { @@ -86,7 +86,7 @@ void N(StationaryAI_ChaseInit)(Evt* script, StationaryAISettings* aiSettings, En f32 angleDiff; npc->duration = (aiSettings->chaseUpdateInterval / 2) + rand_int(aiSettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->moveSpeed = aiSettings->chaseSpeed; tempAngle = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); @@ -113,7 +113,7 @@ void N(StationaryAI_Chase)(Evt* script, StationaryAISettings* aiSettings, EnemyD if (!basic_ai_check_player_dist(arg2, enemy, aiSettings->chaseRadius, aiSettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { @@ -139,7 +139,7 @@ void N(StationaryAI_ReturnHomeInit)(Evt* script, StationaryAISettings* aiSetting Enemy* enemy = script->owner1.enemy; Npc* npc = get_npc_unsafe(enemy->npcID); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_WALK]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_WALK]; if (enemy->territory->wander.moveSpeedOverride < 0) { npc->moveSpeed = aiSettings->chaseSpeed * 0.3; } else { @@ -206,7 +206,7 @@ ApiStatus N(StationaryAI_Main)(Evt* script, s32 isInitialCall) { script->AI_TEMP_STATE = AI_STATE_STATIONARY_IDLE_INIT; npc->duration = 0; enemy->varTable[0] = npc->yaw; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!(enemy->territory->wander.isFlying)) { diff --git a/src/world/common/enemy/TackleAI.inc.c b/src/world/common/enemy/TackleAI.inc.c index aac45b5cbb..398ea91f49 100644 --- a/src/world/common/enemy/TackleAI.inc.c +++ b/src/world/common/enemy/TackleAI.inc.c @@ -49,7 +49,7 @@ ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall) { script->AI_TEMP_STATE = 0; npc->duration = 0; enemy->unk_07 = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; npc->collisionHeight = enemy->varTable[6]; enemy->varTable[9] = 0; @@ -78,10 +78,10 @@ ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall) { if (enemy->varTable[9] > 0) { enemy->varTable[9]--; if (enemy->varTable[9] == 0) { - if (npc->currentAnim.w == NPC_ANIM_bony_beetle_Palette_00_Anim_2E || - npc->currentAnim.w == NPC_ANIM_bony_beetle_Palette_00_Anim_2F) + if (npc->currentAnim == NPC_ANIM_bony_beetle_Palette_00_Anim_2E || + npc->currentAnim == NPC_ANIM_bony_beetle_Palette_00_Anim_2F) { - npc->currentAnim.w = NPC_ANIM_bony_beetle_Palette_00_Anim_C; + npc->currentAnim = NPC_ANIM_bony_beetle_Palette_00_Anim_C; } } else { return ApiStatus_BLOCK; @@ -102,11 +102,11 @@ ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall) { if (enemy->varTable[8] != 0) { enemy->varTable[8] = 0; enemy->unk_B5 = 0; - npc->currentAnim.w = NPC_ANIM_bony_beetle_Palette_00_Anim_2F; + npc->currentAnim = NPC_ANIM_bony_beetle_Palette_00_Anim_2F; } else { enemy->varTable[8] = 1; enemy->unk_B5 = 1; - npc->currentAnim.w = NPC_ANIM_bony_beetle_Palette_00_Anim_2E; + npc->currentAnim = NPC_ANIM_bony_beetle_Palette_00_Anim_2E; } enemy->varTable[9] = 7; return ApiStatus_BLOCK; @@ -138,7 +138,7 @@ ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall) { enemy->unk_B5 = 0; } if (enemy->varTable[8] != 0) { - switch (npc->currentAnim.w) { + switch (npc->currentAnim) { case NPC_ANIM_bony_beetle_Palette_00_Anim_4: case NPC_ANIM_bony_beetle_Palette_00_Anim_C: case NPC_ANIM_bony_beetle_Palette_00_Anim_E: @@ -146,7 +146,7 @@ ApiStatus N(TackleAI_Main)(Evt* script, s32 isInitialCall) { case NPC_ANIM_bony_beetle_Palette_00_Anim_12: case NPC_ANIM_bony_beetle_Palette_00_Anim_16: case NPC_ANIM_bony_beetle_Palette_00_Anim_18: - npc->currentAnim.w++; + npc->currentAnim++; break; } } diff --git a/src/world/common/enemy/UnkFloAI.inc.c b/src/world/common/enemy/UnkFloAI.inc.c index 7a345ffff3..0747eabf44 100644 --- a/src/world/common/enemy/UnkFloAI.inc.c +++ b/src/world/common/enemy/UnkFloAI.inc.c @@ -27,7 +27,7 @@ void N(UnkFloAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, EnemyDe f32 posZCCW; npc->duration = npcAISettings->chaseUpdateInterval / 2 + rand_int(npcAISettings->chaseUpdateInterval / 2 + 1); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_CHASE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_CHASE]; npc->moveSpeed = npcAISettings->chaseSpeed; detectedPlayer = FALSE; @@ -116,7 +116,7 @@ void N(UnkFloAI_ChaseInit)(Evt* script, MobileAISettings* npcAISettings, EnemyDe } if (detectedPlayer) { npc->duration = 10; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; } script->AI_TEMP_STATE = AI_STATE_CHASE; } @@ -128,11 +128,11 @@ void N(UnkFloAI_Chase)(Evt* script, MobileAISettings* npcAISettings, EnemyDetect if (!basic_ai_check_player_dist(territory, enemy, npcAISettings->chaseRadius, npcAISettings->chaseOffsetDist, 1)) { fx_emote(EMOTE_QUESTION, npc, 0.0f, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 15, &emoteTemp); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->duration = 25; script->AI_TEMP_STATE = AI_STATE_LOSE_PLAYER; } else { - if (npc->currentAnim.w != enemy->animList[ENEMY_ANIM_MELEE_PRE]) { + if (npc->currentAnim != enemy->animList[ENEMY_ANIM_MELEE_PRE]) { if (npc->moveSpeed < 4.0) { func_8003D660(npc, 0); } else { @@ -190,7 +190,7 @@ ApiStatus N(UnkFloAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->functionTemp[0] = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~0x800; if (!enemy->territory->wander.isFlying) { npc->flags = (npc->flags | 0x200) & ~0x8; diff --git a/src/world/common/enemy/WanderMeleeAI.inc.c b/src/world/common/enemy/WanderMeleeAI.inc.c index bfbfe734a9..cc14dd0394 100644 --- a/src/world/common/enemy/WanderMeleeAI.inc.c +++ b/src/world/common/enemy/WanderMeleeAI.inc.c @@ -42,7 +42,7 @@ ApiStatus N(WanderMeleeAI_Main)(Evt *script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = AI_STATE_WANDER_INIT; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; npc->flags &= ~NPC_FLAG_JUMPING; if (!enemy->territory->wander.isFlying) { diff --git a/src/world/common/enemy/wip/Dead_PiranhaPlantAI_Main.inc.c b/src/world/common/enemy/wip/Dead_PiranhaPlantAI_Main.inc.c index e3a1663abf..802762eb26 100644 --- a/src/world/common/enemy/wip/Dead_PiranhaPlantAI_Main.inc.c +++ b/src/world/common/enemy/wip/Dead_PiranhaPlantAI_Main.inc.c @@ -33,7 +33,7 @@ ApiStatus N(PiranhaPlantAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || enemy->aiFlags & ENEMY_AI_FLAGS_4) { script->functionTemp[0] = 0; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; enemy->varTable[0] = 0; if (enemy->aiFlags & ENEMY_AI_FLAGS_4) { diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_00.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_00.inc.c index ef2931d519..b4100a2bc4 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_00.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_00.inc.c @@ -10,7 +10,7 @@ void N(PiranhaPlantAI_00)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration--; } else { enemy->varTable[0] = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; script->functionTemp[1] = 0; script->functionTemp[0] = 1; } diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_01.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_01.inc.c index 84d9a97294..1924837cb8 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_01.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_01.inc.c @@ -11,7 +11,7 @@ void N(PiranhaPlantAI_01)(Evt* script, MobileAISettings* aiSettings, EnemyDetect ai_enemy_play_sound(npc, 802, 0); fx_emote(EMOTE_EXCLAMATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &temp); ai_enemy_play_sound(npc, SOUND_2F4, 0x200000); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_PRE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_PRE]; npc->duration = enemy->varTable[8]; script->functionTemp[0] = 10; } diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_10.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_10.inc.c index 696bc4051c..8e9a6bcf67 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_10.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_10.inc.c @@ -179,7 +179,7 @@ void N(PiranhaPlantAI_10)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->yaw = atan2(npc->pos.x, npc->pos.z, gPlayerStatusPtr->position.x, gPlayerStatusPtr->position.z); ai_enemy_play_sound(npc, SOUND_MOLE_SURFACE, 0); - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_MELEE_HIT]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_MELEE_HIT]; npc->duration = enemy->varTable[10]; script->functionTemp[0] = 11; } diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_11.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_11.inc.c index f906ec4f7b..effe1eadef 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_11.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_11.inc.c @@ -9,7 +9,7 @@ void N(PiranhaPlantAI_11)(Evt* script, MobileAISettings* aiSettings, EnemyDetect enemy->flags &= ~(ENEMY_FLAGS_100000 | ENEMY_FLAGS_IGNORE_TOUCH | ENEMY_FLAGS_IGNORE_JUMP | ENEMY_FLAGS_IGNORE_HAMMER | ENEMY_FLAGS_8000000 | ENEMY_FLAGS_10000000); } if (npc->duration == 0) { - npc->currentAnim.w = enemy->animList[10]; + npc->currentAnim = enemy->animList[10]; npc->duration = 0; script->functionTemp[0] = 12; } diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_12.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_12.inc.c index d4a27aad80..0da73421bc 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_12.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_12.inc.c @@ -9,7 +9,7 @@ void N(PiranhaPlantAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDetect npc->duration++; if (npc->duration == enemy->varTable[13]) { - npc->currentAnim.w = enemy->animList[11]; + npc->currentAnim = enemy->animList[11]; } if (npc->duration == enemy->varTable[14]) { enemy->varTable[0] = 3; @@ -17,7 +17,7 @@ void N(PiranhaPlantAI_12)(Evt* script, MobileAISettings* aiSettings, EnemyDetect if (npc->duration >= enemy->varTable[12]) { enemy->varTable[0] = 4; npc->duration = 8; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; fx_emote(EMOTE_FRUSTRATION, npc, 0, npc->collisionHeight, 1.0f, 2.0f, -20.0f, 10, &temp); script->functionTemp[0] = 13; } diff --git a/src/world/common/enemy/wip/PiranhaPlantAI_Main.inc.c b/src/world/common/enemy/wip/PiranhaPlantAI_Main.inc.c index eb496fe04b..70691b641b 100644 --- a/src/world/common/enemy/wip/PiranhaPlantAI_Main.inc.c +++ b/src/world/common/enemy/wip/PiranhaPlantAI_Main.inc.c @@ -35,7 +35,7 @@ s32 N(PiranhaPlantAI_Main)(Evt* script, s32 isInitialCall) { if (isInitialCall || (enemy->aiFlags & ENEMY_AI_FLAGS_4)) { script->AI_TEMP_STATE = AI_STATE_PIRANHA_PLANT_00; npc->duration = 0; - npc->currentAnim.w = enemy->animList[ENEMY_ANIM_IDLE]; + npc->currentAnim = enemy->animList[ENEMY_ANIM_IDLE]; enemy->AI_VAR_ATTACK_STATE = MELEE_HITBOX_STATE_NONE; if (enemy->aiFlags & ENEMY_AI_FLAGS_4) { diff --git a/src/world/partner/bombette.c b/src/world/partner/bombette.c index 71750acb52..e4d8ce95c9 100644 --- a/src/world/partner/bombette.c +++ b/src/world/partner/bombette.c @@ -238,7 +238,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { 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_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); evt->functionTemp[0] = 21; case 21: if (playerStatus->actionState == 0x15 || playerStatus->actionState == 0x16) { @@ -255,7 +255,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->moveToPos.x = playerStatus->position.x; npc->moveToPos.y = playerStatus->position.y; npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim.w = 0x30007; + npc->currentAnim = 0x30007; 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)); @@ -277,9 +277,9 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->pos.y = npc->moveToPos.y; npc->pos.z = npc->moveToPos.z; disable_npc_blur(npc); - suggest_player_anim_clearUnkFlag(0x6000C); + suggest_player_anim_clearUnkFlag(ANIM_Mario_6000C); npc->yaw = playerStatus->targetYaw; - npc->currentAnim.w = 0x30005; + npc->currentAnim = 0x30005; evt->functionTemp[0] = 1; evt->functionTemp[1] = 10; } @@ -288,7 +288,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->pos.y = playerStatus->position.y + playerStatus->colliderHeight; npc->yaw = playerStatus->targetYaw; if (evt->functionTemp[1] == 1) { - suggest_player_anim_clearUnkFlag(0x60006); + suggest_player_anim_clearUnkFlag(ANIM_Mario_60006); } if (evt->functionTemp[1] != 0) { @@ -299,7 +299,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { sfx_play_sound_at_npc(0x80000000, 0, -4); D_802BE924 = 1; add_vec2D_polar(&npc->pos.x, &npc->pos.z, 0.0f, npc->yaw); - npc->currentAnim.w = 0x30006; + npc->currentAnim = 0x30006; npc->jumpVelocity = 0.0f; D_802BE938 = 0; npc->flags = (npc->flags | 0x200) & ~0x100; @@ -329,11 +329,11 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { y = npc->pos.y + 14.0f; z = npc->pos.z; hitDepth = 16.0f; - if ((npc_raycast_down_around(0x10000, &x, &y, &z, &hitDepth, npc->yaw, npc->collisionRadius) != 0) && ((u32) ((get_collider_type_by_id(D_8010C978) & 0xFF) - 2) < 2U)) { + if ((npc_raycast_down_around(0x10000, &x, &y, &z, &hitDepth, npc->yaw, npc->collisionRadius) != 0) && ((u32) ((get_collider_flags(D_8010C978) & 0xFF) - 2) < 2U)) { if (playerStatus->actionState == 0) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } - npc->currentAnim.w = 0x30010; + npc->currentAnim = 0x30010; npc->flags &= ~0x200; evt->functionTemp[1] = 2; evt->functionTemp[0] = 3; @@ -351,7 +351,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { } if (evt->functionTemp[1] == 40) { if (playerStatus->actionState == 0) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } enable_player_input(); D_802BE92C = 0; @@ -372,11 +372,11 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { } } - npc->currentAnim.w = 0x30000 | 0x10; + npc->currentAnim = 0x30000 | 0x10; evt->functionTemp[1] = 0x14; evt->functionTemp[0] = 3; if (playerStatus->actionState == 0) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } } } @@ -436,7 +436,7 @@ 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; - npc->currentAnim.w = 0x30011; + npc->currentAnim = 0x30011; 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; @@ -463,7 +463,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->yaw = clamp_angle(gCameras[CAM_DEFAULT].currentYaw + playerStatus->spriteFacingAngle); add_vec2D_polar(&npc->pos.x, &npc->pos.z, 10.0f, npc->yaw); npc->jumpVelocity = 0.0f; - npc->currentAnim.w = 0x30011; + npc->currentAnim = 0x30011; npc->flags |= 0x800; evt->functionTemp[0] = 6; break; @@ -492,7 +492,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { switch (evt->functionTemp[0]) { case 7: if (playerStatus->actionState == 0) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } if (D_802BE92C != 0) { D_802BE92C = 0; @@ -506,7 +506,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->pos.y = playerStatus->position.y; npc->rotation.x = 0.0f; npc->rotation.z = 0.0f; - npc->currentAnim.w = 0x30003; + npc->currentAnim = 0x30003; partner_clear_player_tracking(npc); if (D_802BE924 == 0) { return ApiStatus_DONE2; @@ -525,7 +525,7 @@ ApiStatus func_802BD758_3184A8(Evt* evt, s32 isInitialCall) { npc->pos.y = playerStatus->position.y; npc->rotation.x = 0.0f; npc->rotation.z = 0.0f; - npc->currentAnim.w = 0x30003; + npc->currentAnim = 0x30003; npc->pos.x = playerStatus->position.x; npc->pos.y = playerStatus->position.y; npc->pos.z = playerStatus->position.z; @@ -663,7 +663,7 @@ void world_bombette_pre_battle(Npc* bombette) { bombette->pos.y = playerStatus->position.y; bombette->rotation.x = 0.0f; bombette->rotation.z = 0.0f; - bombette->currentAnim.w = 0x30003; + bombette->currentAnim = 0x30003; partner_clear_player_tracking(bombette); disable_npc_blur(bombette); diff --git a/src/world/partner/bow.c b/src/world/partner/bow.c index da0091f4a1..1220b88e51 100644 --- a/src/world/partner/bow.c +++ b/src/world/partner/bow.c @@ -247,7 +247,7 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { bow->moveToPos.x = playerStatus->position.x; bow->moveToPos.y = playerStatus->position.y + (playerStatus->colliderHeight * 0.5f); bow->moveToPos.z = playerStatus->position.z; - bow->currentAnim.w = 0x50002; + bow->currentAnim = 0x50002; bow->yaw = playerStatus->targetYaw; add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, -2.0f, gCameras[gCurrentCameraID].currentYaw); add_vec2D_polar(&bow->moveToPos.x, &bow->moveToPos.z, @@ -255,7 +255,7 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { bow->duration = 5; bow->yaw = atan2(bow->pos.x, bow->pos.z, playerStatus->position.x, playerStatus->position.z); set_action_state(ACTION_STATE_RIDE); - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); script->functionTemp[0]++; break; case 21: @@ -274,7 +274,7 @@ ApiStatus BowUseAbility(Evt* script, s32 isInitialCall) { if (bow->duration == 0) { bow->yaw = playerStatus->targetYaw; func_8003D624(bow, 7, playerStatus->alpha1, 0, 0, 0, 0); - suggest_player_anim_setUnkFlag(0x10014); + suggest_player_anim_setUnkFlag(ANIM_Mario_Crouch); sfx_play_sound_at_npc(SOUND_BOW_VANISH, 0, -4); script->functionTemp[0] = 1; } diff --git a/src/world/partner/kooper.c b/src/world/partner/kooper.c index 870bbbba66..f2046c7dcf 100644 --- a/src/world/partner/kooper.c +++ b/src/world/partner/kooper.c @@ -215,7 +215,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { partnerActionStatus->partnerActionState = PARTNER_ACTION_KOOPER_1; partnerActionStatus->actingPartner = PARTNER_KOOPER; script->functionTemp[0] = 5; - kooper->currentAnim.w = 0x20009; + kooper->currentAnim = 0x20009; D_802BEC50 = 30; } } @@ -254,15 +254,15 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { case 21: //TODO: make if statement less bad if ((((u8)playerStatus->actionState - 0x15) < 3U) || (playerStatus->timeInAir != 0)) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); script->functionTemp[0] = 0; break; } else { - suggest_player_anim_clearUnkFlag(0x10006); + suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump); kooper->moveToPos.x = D_802BEC70 = playerStatus->position.x; kooper->moveToPos.y = D_802BEC74 = playerStatus->position.y; kooper->moveToPos.z = D_802BEC78 = playerStatus->position.z; - kooper->currentAnim.w = 0x20005; + kooper->currentAnim = 0x20005; add_vec2D_polar(&kooper->moveToPos.x, &kooper->moveToPos.z, playerStatus->colliderDiameter / 3, playerStatus->targetYaw); clamp = clamp_angle(playerStatus->targetYaw + ((D_802BEC58 != 0) ? 90.0f : -90.0f)); @@ -279,9 +279,9 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { disable_npc_blur(kooper); if (script->functionTemp[2] < playerStatus->inputEnabledCounter) { if (!(playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_100000)) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } else { - suggest_player_anim_clearUnkFlag(0x10005); + suggest_player_anim_clearUnkFlag(ANIM_Mario_Running); } script->functionTemp[0] = 0; break; @@ -289,7 +289,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { kooper->yaw = playerStatus->targetYaw; kooper->jumpVelocity = 18.0f; kooper->jumpScale = 3.0f; - kooper->currentAnim.w = 0x2000A; + kooper->currentAnim = 0x2000A; kooper->collisionHeight = 12; kooper->moveToPos.y = playerStatus->position.y; @@ -297,7 +297,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { playerStatus->flags |= PLAYER_STATUS_FLAGS_JUMPING; gCameras[CAM_DEFAULT].moveFlags |= CAMERA_FLAGS_1; - suggest_player_anim_clearUnkFlag(0x10007); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill); D_802BEC60 = 0; sfx_play_sound_at_npc(SOUND_JUMP_2081, 0, -4); script->functionTemp[0] = 2; @@ -315,7 +315,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { if (kooper->jumpVelocity < 0.0f) { if (D_802BEC60 == 0) { D_802BEC60 = 1; - suggest_player_anim_clearUnkFlag(0x10008); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidair); } } @@ -339,7 +339,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { kooper->rotation.z = 0.0f; kooper->planarFlyDist = 0.0f; kooper->moveSpeed = 8.0f; - kooper->currentAnim.w = 0x20009; + kooper->currentAnim = 0x20009; D_802BEB40_31CB60 = 1; fx_damage_stars(3, kooper->pos.x, kooper->pos.y + kooper->collisionHeight, kooper->pos.z, sin_deg(playerStatus->targetYaw), -1.0f, -cos_deg(playerStatus->targetYaw), 3); @@ -577,7 +577,7 @@ ApiStatus func_802BD638_31B658(Evt* script, s32 isInitialCall) { partnerActionStatus->partnerActionState = PARTNER_ACTION_NONE; kooper->jumpVelocity = 0.0f; kooper->collisionHeight = 24; - kooper->currentAnim.w = 0x20000 | 4; + kooper->currentAnim = 0x20000 | 4; sfx_stop_sound(0x284); disable_npc_blur(kooper); diff --git a/src/world/partner/lakilester.c b/src/world/partner/lakilester.c index 08e347d054..43063a1947 100644 --- a/src/world/partner/lakilester.c +++ b/src/world/partner/lakilester.c @@ -225,10 +225,10 @@ s32 func_802BD7DC(void) { //TODO find better match if (outLength <= 16.0f && colliderTypeID >= 0) { if (!(colliderTypeID & COLLISION_WITH_ENTITY_BIT) || !(get_entity_type(colliderTypeID) - 0x2E < 2)){ - colliderTypeID = get_collider_type_by_id(colliderTypeID) & 0xFF; - if (colliderTypeID - 1 >= 3U) { + colliderTypeID = get_collider_flags(colliderTypeID) & 0xFF; //TODO surface type + if (!(colliderTypeID == SURFACE_TYPE_WATER || colliderTypeID == SURFACE_TYPE_SPIKES || colliderTypeID == SURFACE_TYPE_LAVA)) { // ret = FALSE; - if (colliderTypeID != 5) { + if (colliderTypeID != SURFACE_TYPE_SLIDE) { npc->moveToPos.x = outX; npc->moveToPos.y = outY; npc->moveToPos.z = outZ; @@ -342,19 +342,21 @@ void func_802BDDD8_321928(Npc* npc) { PlayerStatus* playerStatus = &gPlayerStatus; CollisionStatus* collisionStatus = &gCollisionStatus; PartnerActionStatus* partnerActionStatus = &gPartnerActionStatus; - f32 sp3C, sp40, sp44, sp48, sp4C, sp50, sp54; + f32 hitDepth, sp40, sp44, sp48, sp4C, sp50, sp54; f32 yaw = 0.0f; f32 moveSpeed = 0.0f; f32 x, y, z; f32 temp_f0_3; s32 raycastBelowResult; - s32 phi_a3; - f32 phi_f20; - + s32 currentSurfaceType; + s32 belowSurfaceType; + s32 pitchShift; + f32 height; func_802BD6BC_32120C(&yaw, &moveSpeed); - if ((u8)(get_collider_type_by_id(npc->currentFloor)) == 3) { + currentSurfaceType = get_collider_flags(npc->currentFloor) & 0xFF; + if (currentSurfaceType == SURFACE_TYPE_LAVA) { moveSpeed *= 0.5f; } @@ -373,11 +375,11 @@ void func_802BDDD8_321928(Npc* npc) { } if (D_802BFF20 < 0x3C) { - phi_a3 = update_lerp(0, 0.0f, 100.0f, D_802BFF20, 60); - sfx_play_sound_with_params(SOUND_295, 0, 0x40, phi_a3); + pitchShift = update_lerp(0, 0.0f, 100.0f, D_802BFF20, 60); + sfx_play_sound_with_params(SOUND_295, 0, 0x40, pitchShift); } else { - phi_a3 = update_lerp(0, 100.0f, 0.0f, D_802BFF20 - 60, 60); - sfx_play_sound_with_params(SOUND_295, 0, 0x40, phi_a3); + pitchShift = update_lerp(0, 100.0f, 0.0f, D_802BFF20 - 60, 60); + sfx_play_sound_with_params(SOUND_295, 0, 0x40, pitchShift); } } } @@ -466,18 +468,18 @@ void func_802BDDD8_321928(Npc* npc) { func_802BDA90_3215E0(npc); npc->moveToPos.y -= npc->jumpScale; - sp3C = npc->collisionHeight + 2; + hitDepth = npc->collisionHeight + 2; y = npc->moveToPos.y + 12.0f; x = playerStatus->position.x; z = playerStatus->position.z; add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); - raycastBelowResult = player_raycast_below_cam_relative(playerStatus, &x, &y, &z, &sp3C, &sp40, + raycastBelowResult = player_raycast_below_cam_relative(playerStatus, &x, &y, &z, &hitDepth, &sp40, &sp44, &sp48, &sp4C); D_802BFF28 = get_player_normal_pitch(); - phi_f20 = 12.0f; + height = 12.0f; if (D_802BFF28 != 0.0f) { - phi_f20 = 32.0f; + height = 32.0f; } if (D_802BFF28 > 0.0f && raycastBelowResult >= 0) { @@ -485,7 +487,7 @@ void func_802BDDD8_321928(Npc* npc) { npc->pos.y = (npc->pos.y + fabs((sp50 / sp54) * playerStatus->runSpeed)); } - if (sp3C <= phi_f20 && raycastBelowResult >= 0) { + if (hitDepth <= height && raycastBelowResult >= 0) { playerStatus->lastGoodPosition.x = npc->pos.x; playerStatus->lastGoodPosition.y = npc->pos.y; playerStatus->lastGoodPosition.z = npc->pos.z; @@ -498,12 +500,12 @@ void func_802BDDD8_321928(Npc* npc) { npc->jumpScale = 0.0f; playerStatus->timeInAir = 0; - if ((get_collider_type_by_id(raycastBelowResult) & 0xFF) == 3) { - - npc->currentAnim.w = 0x80006; + belowSurfaceType = get_collider_flags(raycastBelowResult) & 0xFF; + if (belowSurfaceType == SURFACE_TYPE_LAVA) { + npc->currentAnim = 0x80006; npc->moveSpeed = moveSpeed * 0.5f; } else { - npc->currentAnim.w = 0x80005; + npc->currentAnim = 0x80005; npc->moveSpeed = moveSpeed; } return; @@ -582,8 +584,8 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { npc->flags &= ~(NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT); npc->flags |= NPC_FLAG_100; set_action_state(ACTION_STATE_RIDE); - suggest_player_anim_setUnkFlag(0x8000E); - npc->currentAnim.w = 0x80005; + suggest_player_anim_setUnkFlag(ANIM_Mario_8000E); + npc->currentAnim = 0x80005; D_802BFF0C = 1; npc->flags &= ~(NPC_FLAG_40 | NPC_FLAG_ENABLE_HIT_SCRIPT); npc->flags |= (NPC_FLAG_100 | NPC_FLAG_400000); @@ -593,12 +595,12 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { npc->pos.x = playerStatus->position.x; npc->pos.y = npc->moveToPos.y; npc->pos.z = playerStatus->position.z; - npc->currentAnim.w = 0x80005; + npc->currentAnim = 0x80005; playerStatus->position.y = npc->pos.y + 10.0f; npc->moveSpeed = 3.0f; npc->jumpScale = 0.0f; npc->yaw = playerStatus->targetYaw; - suggest_player_anim_setUnkFlag(0x8000E); + suggest_player_anim_setUnkFlag(ANIM_Mario_8000E); set_action_state(ACTION_STATE_RIDE); disable_player_static_collisions(); D_802BFF08 = 1; @@ -697,15 +699,15 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { npc->yaw = atan2(npc->pos.x, npc->pos.z, npc->moveToPos.x, npc->moveToPos.z); npc->duration = 12; - npc->currentAnim.w = 0x80005; + npc->currentAnim = 0x80005; npc->jumpVelocity = 8.0f; npc->jumpScale = 1.4f; - suggest_player_anim_clearUnkFlag(0x10006); + suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump); D_802BFF14 = 101; break; case 101: sfx_play_sound_at_npc(SOUND_JUMP_2081, 0, NPC_PARTNER); - suggest_player_anim_clearUnkFlag(0x10007); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill); /* fallthrough */ case 102: D_802BFF14 += 1; @@ -723,7 +725,7 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { npc->jumpVelocity -= npc->jumpScale; if (npc->jumpVelocity <= 0.0f) { - suggest_player_anim_clearUnkFlag(0x10008); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidair); } npc->duration--; @@ -740,7 +742,7 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { npc->yaw = playerStatus->targetYaw; npc->duration = 3; set_action_state(ACTION_STATE_RIDE); - suggest_player_anim_setUnkFlag(0x8000E); + suggest_player_anim_setUnkFlag(ANIM_Mario_8000E); disable_player_shadow(); partnerActionStatus->actingPartner = PARTNER_LAKILESTER; partnerActionStatus->partnerActionState = PARTNER_ACTION_LAKILESTER_1; @@ -827,11 +829,11 @@ ApiStatus func_802BE724_322274(Evt* script, s32 isInitialCall) { } npc->moveSpeed = sp2C / npc->duration; - suggest_player_anim_clearUnkFlag(0x10006); + suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump); D_802BFF14 += 1; break; case 4: - suggest_player_anim_clearUnkFlag(0x10007); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill); D_802BFF14++; /* fallthrough */ case 5: @@ -962,11 +964,11 @@ ApiStatus func_802BF4F0_323040(Evt* script, s32 isInitialCall) { lakilester->moveSpeed = sp2C / lakilester->duration; lakilester->yaw = atan2(playerStatus->position.x, playerStatus->position.z, lakilester->moveToPos.x, lakilester->moveToPos.z); - suggest_player_anim_clearUnkFlag(0x10006); + suggest_player_anim_clearUnkFlag(ANIM_Mario_BeforeJump); D_802BFF00++; break; case 1: - suggest_player_anim_clearUnkFlag(0x10007); + suggest_player_anim_clearUnkFlag(ANIM_Mario_AnimMidairStill); D_802BFF00++; case 2: playerStatus->position.y += lakilester->jumpVelocity; @@ -1149,7 +1151,7 @@ s32 func_802BFBA0_3236F0(Evt* script, s32 isInitialCall) { } sfx_play_sound_at_npc(SOUND_295, 0, -4); - playerStatus->anim = 0x8000E; + playerStatus->anim = ANIM_Mario_8000E; playerStatus->unk_BC = 0; playerStatus->flags |= PLAYER_STATUS_FLAGS_10000000; func_802BFB44_323694(2.0f); diff --git a/src/world/partner/parakarry.c b/src/world/partner/parakarry.c index d334cb5763..a8d5fdf33a 100644 --- a/src/world/partner/parakarry.c +++ b/src/world/partner/parakarry.c @@ -140,6 +140,7 @@ s32 func_802BD558_319AC8(void) { f32 sp28, sp2C, sp30, sp34, sp38, sp3C, sp40, sp44; f32 colliderBaseHeight = gPlayerStatus.colliderHeight; s32 raycastResult; + s32 surfaceType; sp28 = gPlayerStatus.position.x; sp2C = gPlayerStatus.position.y + (colliderBaseHeight * 0.5); @@ -149,8 +150,9 @@ s32 func_802BD558_319AC8(void) { raycastResult = player_raycast_below_cam_relative(&gPlayerStatus, &sp28, &sp2C, &sp30, &sp34, &sp38, &sp3C, &sp40, &sp44); - if (((get_collider_type_by_id(raycastResult) & 0xFF) - 2) < 2U) { - gPlayerStatus.unk_BF = 2; + surfaceType = get_collider_flags(raycastResult) & 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 |= PLAYER_STATUS_FLAGS_800; } @@ -191,7 +193,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { parakarry->flags &= ~(NPC_FLAG_JUMPING | NPC_FLAG_GRAVITY); D_802BEBB0 = 1; gCameras[0].moveFlags |= CAMERA_MOVE_FLAGS_1; - parakarry->currentAnim.w = 0x40009; + parakarry->currentAnim = 0x40009; partnerActionStatus->actingPartner = PARTNER_PARAKARRY; partnerActionStatus->partnerActionState = PARTNER_ACTION_PARAKARRY_HOVER; parakarry->flags &= ~NPC_FLAG_4000; @@ -251,11 +253,11 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { disable_npc_blur(parakarry); D_802BEBC0_31CBE0 = 0x15; } else { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); parakarry->moveToPos.x = playerStatus->position.x; parakarry->moveToPos.y = playerStatus->position.y + 32.0f; parakarry->moveToPos.z = playerStatus->position.z; - parakarry->currentAnim.w = 0x40003; + parakarry->currentAnim = 0x40003; add_vec2D_polar(¶karry->moveToPos.x, ¶karry->moveToPos.z, 0.0f, playerStatus->targetYaw); tempYaw = playerStatus->targetYaw; @@ -276,9 +278,9 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { disable_npc_blur(parakarry); parakarry->yaw = playerStatus->targetYaw; parakarry->moveSpeed = 0.2f; - parakarry->currentAnim.w = 0x4000A; + parakarry->currentAnim = 0x4000A; parakarry->planarFlyDist = 0; - suggest_player_anim_setUnkFlag(0x8000D); + suggest_player_anim_setUnkFlag(ANIM_Mario_8000D); sfx_play_sound_at_npc(SOUND_2009, 0, -4); gCollisionStatus.lastTouchedFloor = -1; gCollisionStatus.currentFloor = -1; @@ -292,7 +294,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { 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_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); } else { tempFrameCounter = gGameStatusPtr->frameCounter; tempFrameCounterU32 = tempFrameCounter; @@ -321,7 +323,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { 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_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); D_802BEBC0_31CBE0 = 0x15; break; } @@ -373,9 +375,9 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { z = playerStatus->position.z; sp2C = playerStatus->colliderHeight * 0.5f; if (npc_raycast_down_around(0x10000, &x, &y, &z, &sp2C, parakarry->yaw, parakarry->collisionRadius)) { - u32 colliderType = (u8) get_collider_type_by_id(D_8010C978); - if (colliderType == 2 || colliderType == 3) { - playerStatus->unk_BF = 2; + s32 surfaceType = get_collider_flags(D_8010C978) & 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 |= PLAYER_STATUS_FLAGS_800; } @@ -394,13 +396,13 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { parakarry->jumpScale = -0.01f; parakarry->moveToPos.y = playerStatus->position.y; parakarry->duration = 0; - parakarry->currentAnim.w = 0x4000A; + parakarry->currentAnim = 0x4000A; parakarry->animationSpeed = 1.8f; gCollisionStatus.currentFloor = -1; D_802BEBC0_31CBE0++; } } else { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); D_802BEBC0_31CBE0 = 0x15; } } @@ -411,7 +413,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { 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_setUnkFlag(0x8000D); + suggest_player_anim_setUnkFlag(ANIM_Mario_8000D); if (!(playerStatus->flags & PLAYER_STATUS_FLAGS_800)) { 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 @@ -457,7 +459,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { y = playerStatus->position.y; z = playerStatus->position.z; if (npc_test_move_complex_with_slipping(0x10000, &x, &y, &z, parakarry->moveSpeed, parakarry->yaw, playerStatus->colliderHeight, playerStatus->colliderDiameter)) { - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); D_802BEBC0_31CBE0 = 0x15; } else { x = parakarry->pos.x; @@ -507,13 +509,13 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { break; } } - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); D_802BEBC0_31CBE0 = 0x15; } break; } } - suggest_player_anim_clearUnkFlag(0x10002); + suggest_player_anim_clearUnkFlag(ANIM_Mario_10002); D_802BEBC0_31CBE0 = 0x15; } } else { @@ -533,7 +535,7 @@ ApiStatus func_802BD660_319BD0(Evt* evt, s32 isInitialCall) { } if (D_802BEBC0_31CBE0 == 0x16 || D_802BEBC0_31CBE0 == 0x15 || D_802BEBC0_31CBE0 == 0x14) { - parakarry->currentAnim.w = 0x40001; + parakarry->currentAnim = 0x40001; D_802BEBB0 = 0; parakarry->jumpVelocity = 0.0f; parakarry->flags &= ~ACTOR_FLAG_HP_OFFSET_BELOW; diff --git a/src/world/partner/sushie.c b/src/world/partner/sushie.c index 6f53ace01b..4250ff95cb 100644 --- a/src/world/partner/sushie.c +++ b/src/world/partner/sushie.c @@ -309,7 +309,7 @@ s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) { partnerNPC->yaw, partnerNPC->collisionRadius * 0.5f); partnerNPC->pos.y = D_802BFEE0 - (partnerNPC->collisionHeight * 0.5f); temp_f0 = atan2(partnerNPC->pos.x, partnerNPC->pos.z, script->varTable[1], script->varTable[3]); - partnerNPC->currentAnim.w = 0x7000A; + partnerNPC->currentAnim = 0x7000A; partnerNPC->yaw = temp_f0; partnerNPC->jumpScale = 0.0f; partnerNPC->moveSpeed = 3.0f; @@ -324,7 +324,7 @@ s32 func_802BFAB8_320828(Evt* script, s32 isInitialCall) { if (script->varTable[12] == 0) { partner_kill_ability_script(); } else { - suggest_player_anim_setUnkFlag(0x8000F); + suggest_player_anim_setUnkFlag(ANIM_Mario_8000F); if ((partnerNPC->yaw >= 0.0f) && (partnerNPC->yaw <= 180.0f)) { partnerNPC->yawCamOffset = partnerNPC->yaw; partnerNPC->isFacingAway = 1; diff --git a/src/world/partner/watt.c b/src/world/partner/watt.c index fdbc60034f..95183821e0 100644 --- a/src/world/partner/watt.c +++ b/src/world/partner/watt.c @@ -3,7 +3,7 @@ #include "../src/world/partners.h" #include "npc.h" -void force_player_anim(s32 arg0); +void force_player_anim(AnimID); void func_802BE014_31DB84(void); s32 D_802BE250_31DDC0[] = {24, 6}; @@ -107,12 +107,12 @@ ApiStatus WattUpdate(Evt* script, s32 isInitialCall) { if (D_802BE278_31DDE8 == 0) { D_802BE278_31DDE8 = 1; func_802BD1AC_31CD1C(1); - watt->currentAnim.w = 0x60003; + watt->currentAnim = 0x60003; } } else if (D_802BE278_31DDE8 != 0) { D_802BE278_31DDE8 = 0; func_802BD1AC_31CD1C(0); - watt->currentAnim.w = 0x60001; + watt->currentAnim = 0x60001; } if (WattStaticEffect != NULL) { @@ -219,7 +219,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { (func_800EA52C(6) && !is_starting_conversation())) { if (gGameStatusPtr->keepUsingPartnerOnMapChange) { - if (playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_2 | 1)) { + if (playerStatus->animFlags & (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2)) { D_802BE304 = 20; } else { D_802BE304 = 40; @@ -234,9 +234,9 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { } } else { partnerActionStatus->partnerAction_unk_1 = 0; - playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT; + playerStatus->animFlags |= (PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT | PLAYER_STATUS_ANIM_FLAGS_2); func_802BE014_31DB84(); - npc->currentAnim.w = 0x60001; + npc->currentAnim = 0x60001; D_802BE304 = 1; script->functionTemp[1] = 2; } @@ -285,10 +285,10 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { npc->moveToPos.x = playerStatus->position.x; npc->moveToPos.y = playerStatus->position.y + 5.0f; npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim.w = 0x60002; + npc->currentAnim = 0x60002; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 15.0f, playerStatus->targetYaw); npc->yaw = playerStatus->targetYaw; - npc->currentAnim.w = 0x60001; + npc->currentAnim = 0x60001; playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_2; func_802BE014_31DB84(); npc_set_palswap_mode_A(npc, 1); @@ -305,7 +305,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { npc->moveToPos.x = playerStatus->position.x; npc->moveToPos.y = playerStatus->position.y + 5.0f; npc->moveToPos.z = playerStatus->position.z; - npc->currentAnim.w = 0x60002; + npc->currentAnim = 0x60002; add_vec2D_polar(&npc->moveToPos.x, &npc->moveToPos.z, 15.0f, playerStatus->targetYaw); npc->duration = 8; npc->yaw = atan2(npc->pos.x, npc->pos.z, playerStatus->position.x, playerStatus->position.z); @@ -319,7 +319,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { npc->duration--; if (npc->duration == 0) { npc->yaw = playerStatus->targetYaw; - npc->currentAnim.w = 0x60001; + npc->currentAnim = 0x60001; partnerActionStatus->actingPartner = PARTNER_WATT; playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_2; func_802BE014_31DB84(); @@ -328,7 +328,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { } break; case 1: - func_802BE070_31DBE0(); + world_watt_sync_held_position(); if ((playerStatus->flags & PLAYER_STATUS_FLAGS_800)) { D_802BE304 = 2; } else { @@ -354,7 +354,7 @@ ApiStatus func_802BD754_31D2C4(Evt* script, s32 isInitialCall) { if (D_802BE304 == 2) { playerStatus->animFlags &= ~(PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT); - npc->currentAnim.w = 0x60001; + npc->currentAnim = 0x60001; partner_clear_player_tracking(npc); D_802BE30C = 0; partnerActionStatus->actingPartner = PARTNER_NONE; @@ -391,7 +391,7 @@ s32 WattPutAway(Evt* script, s32 isInitialCall) { if (isInitialCall) { world_watt_dispose_static_effect(); partner_init_put_away(watt); - force_player_anim(0x10002); + force_player_anim(ANIM_Mario_10002); wattActionStatus->actingPartner = PARTNER_NONE; wattActionStatus->partnerActionState = PARTNER_ACTION_NONE; playerStatus->animFlags &= ~(PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT); @@ -455,8 +455,8 @@ ApiStatus func_802BDE88_31D9F8(Evt* script, s32 isInitialCall) { playerStatus->targetYaw = atan2(playerStatus->position.x, playerStatus->position.z, script->varTable[1], script->varTable[3]); playerStatus->heading = playerStatus->targetYaw; - move_player(script->functionTemp[1], playerStatus->heading, *((f32*) &script->varTable[5])); - func_802BE070_31DBE0(); + move_player(script->functionTemp[1], playerStatus->heading, script->varTableF[5]); + world_watt_sync_held_position(); watt->flags &= ~NPC_FLAG_GRAVITY; watt->flags |= NPC_FLAG_100; playerStatus->animFlags |= PLAYER_STATUS_ANIM_FLAGS_2 | PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT; @@ -467,7 +467,7 @@ ApiStatus func_802BDE88_31D9F8(Evt* script, s32 isInitialCall) { script->functionTemp[0] += 1; break; case 1: - func_802BE070_31DBE0(); + world_watt_sync_held_position(); script->functionTemp[1]--; if (script->functionTemp[1] == 0) { if (script->varTable[12]) { @@ -484,57 +484,57 @@ ApiStatus func_802BDE88_31D9F8(Evt* script, s32 isInitialCall) { void func_802BE014_31DB84(void) { PlayerStatus* playerStatus = &gPlayerStatus; f32 currentSpeed = playerStatus->currentSpeed; - s32 animationID; + AnimID anim; if (playerStatus->runSpeed <= currentSpeed) { - animationID = 0x60002; + anim = ANIM_Mario_60002; } else if (playerStatus->walkSpeed <= currentSpeed) { - animationID = 0x60000; + anim = ANIM_Mario_60000; } else { - animationID = 0x60007; + anim = ANIM_Mario_60007; } - suggest_player_anim_clearUnkFlag(animationID); + suggest_player_anim_clearUnkFlag(anim); } -void func_802BE070_31DBE0(void) { +void world_watt_sync_held_position(void) { Npc* partnerNPC; Npc* new_var2; Camera* camera = gCameras; PlayerStatus* playerStatus; - f32 temp, angle; + f32 offsetScale, angle; f32 spriteFacingAngle; - s32 phi_v1; + s32 angleOffset; if (gPartnerActionStatus.partnerActionState != PARTNER_ACTION_NONE) { spriteFacingAngle = gPlayerStatusPtr->spriteFacingAngle; if ((spriteFacingAngle < 90.0f) || (spriteFacingAngle > 270.0f)) { if (!(gPlayerStatusPtr->trueAnimation & NPC_FLAG_1000000)) { - phi_v1 = -5; - temp = 0.6f; + angleOffset = -5; + offsetScale = 0.6f; } else { - phi_v1 = 5; - temp = 0.6f; + angleOffset = 5; + offsetScale = 0.6f; } } else { if (!(gPlayerStatusPtr->trueAnimation & NPC_FLAG_1000000)) { - phi_v1 = 5; - temp = 0.6f; + angleOffset = 5; + offsetScale = 0.6f; } else { - phi_v1 = -5; - temp = 0.6f; + angleOffset = -5; + offsetScale = 0.6f; } } - angle = (camera->currentYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + phi_v1) * TAU / 360.0f; + angle = (camera->currentYaw + 270.0f - gPlayerStatusPtr->spriteFacingAngle + angleOffset) * TAU / 360.0f; playerStatus = gPlayerStatusPtr; partnerNPC = wPartnerNpc; - partnerNPC->pos.x = playerStatus->position.x + (sin_rad(angle) * gPlayerStatusPtr->colliderDiameter * temp); + partnerNPC->pos.x = playerStatus->position.x + (sin_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); new_var2 = wPartnerNpc; playerStatus = gPlayerStatusPtr; partnerNPC = new_var2; - partnerNPC->pos.z = playerStatus->position.z - (cos_rad(angle) * gPlayerStatusPtr->colliderDiameter * temp); + partnerNPC->pos.z = playerStatus->position.z - (cos_rad(angle) * gPlayerStatusPtr->colliderDiameter * offsetScale); wPartnerNpc->yaw = gPlayerStatusPtr->targetYaw; wPartnerNpc->pos.y = gPlayerStatusPtr->position.y + 5.0f; diff --git a/src/world/partners.c b/src/world/partners.c index aebb9963f7..3d99583b12 100644 --- a/src/world/partners.c +++ b/src/world/partners.c @@ -767,7 +767,7 @@ void _use_partner_ability(void) { wPartnerCurrentScriptID = wPartnerCurrentScript->id; wPartnerCurrentScript->groupFlags = EVT_GROUP_08 | EVT_GROUP_02; D_8010CD30 = 1; - wPartnerNpc->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FLY]; + wPartnerNpc->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FLY]; enable_player_input(); break; } @@ -1102,7 +1102,7 @@ void partner_walking_enable(Npc* partner, s32 val) { D_8010CFCC = 0; wPartnerMoveTime = 16; wPartnerTetherDistance = 40.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; func_800EA5B8(&partner->flags); partner->collisionChannel = 0x10000; partner->jumpVelocity = 0.0f; @@ -1206,7 +1206,7 @@ void partner_flying_enable(Npc* partner, s32 val) { D_8010CFCC = 0; wPartnerMoveTime = 16; wPartnerTetherDistance = 40.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; func_800EA5B8(&partner->flags); partner->collisionChannel = 0x10000; partner->flags |= NPC_FLAG_100; @@ -1403,12 +1403,12 @@ void partner_flying_follow_player(Npc* partner) { yaw = partner->yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; } else { yaw = partner->yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; } break; } @@ -1465,7 +1465,7 @@ void partner_flying_follow_player(Npc* partner) { partner->jumpVelocity = 20.0f; } D_8010CFC8 = 2; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[2]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[2]; partner->moveToPos.x = partner->pos.x; partner->moveToPos.y = partner->pos.y; partner->moveToPos.z = partner->pos.z; @@ -1475,14 +1475,14 @@ void partner_flying_follow_player(Npc* partner) { partner->jumpVelocity -= partner->jumpScale; partner->pos.y += partner->jumpVelocity; if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[3]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[3]; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); if (partner->jumpVelocity <= 0.0f) { if (partner->pos.y < partner->moveToPos.y) { partner->jumpVelocity = 0.0f; partner->pos.y = partner->moveToPos.y; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[4]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[4]; partner->yaw = atan2(partner->pos.x, partner->pos.z, playerStatus->position.x, playerStatus->position.z); D_8010CFC8 = 0; temp = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); @@ -1507,7 +1507,7 @@ void partner_flying_follow_player(Npc* partner) { temp_f2_3 = (y + (((playerStatus->position.y + (playerStatus->colliderHeight - ((s32) ((s16) temp_v0_3 + ((u32) (temp_v0_3 << 0x10) >> 0x1F)) >> 1))) - partner->pos.y) * 0.03125)); partner->pos.y = temp_f2_3; y = temp_f2_3; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; if (playerStatus->actionState == 0xC) { D_8010CFCA = 0; } @@ -1528,7 +1528,7 @@ void partner_flying_follow_player(Npc* partner) { partner->moveSpeed = 2.0f; if (temp > 2.0f) { partner->yaw = yaw; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[6]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[6]; if (!(partner->flags & 0x4000)) { D_800F803A = 0; } else { @@ -1538,7 +1538,7 @@ void partner_flying_follow_player(Npc* partner) { partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; partner->renderYaw = yaw; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; if (D_8010CFCA == 2 || playerStatus->actionState == 0xC) { D_8010CFCA = 0; } @@ -1549,7 +1549,7 @@ void partner_flying_follow_player(Npc* partner) { partner->yaw = yaw; partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; if (D_8010CFCA == 2 || playerStatus->actionState == 0xC) { D_8010CFCA = 0; } @@ -1593,7 +1593,7 @@ void partner_flying_follow_player(Npc* partner) { add_vec2D_polar(&partner->moveToPos.x, &partner->moveToPos.z, playerStatus->colliderDiameter, temp_f0_15); temp = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = wPartnerMoveSpeed = temp / wPartnerMoveTime; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[(partner->moveSpeed < 4.0) ? 1 : 6]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[(partner->moveSpeed < 4.0) ? 1 : 6]; D_800F8034 = atan2(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->yaw = D_800F8034; D_8010CFCE++; @@ -1628,7 +1628,7 @@ void partner_flying_follow_player(Npc* partner) { partner_clear_player_tracking(partner); partner->moveSpeed = 0.0f; partner->jumpScale = 0.0f; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; D_8010CFC8 = 0; D_8010CFCA = 0; D_8010CFCE = 0; @@ -1640,7 +1640,7 @@ void partner_flying_follow_player(Npc* partner) { partner_move_to_goal(partner, 1); break; case 40: - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[5]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[5]; break; case 50: break; @@ -1693,7 +1693,7 @@ s32 partner_put_away(Npc* partner) { partner->moveSpeed = partner->planarFlyDist / divisor; tempMoveToY = tempPosY - tempMoveToY; partner->jumpVelocity = (tempMoveToY + partner->jumpScale * partner->duration * partner->duration * 0.5f) / partner->duration; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_JUMP]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_JUMP]; enable_npc_blur(partner); D_8010CFC8 = 1; break; @@ -1701,7 +1701,7 @@ s32 partner_put_away(Npc* partner) { partner->jumpVelocity -= partner->jumpScale; partner->pos.y += partner->jumpVelocity; if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FALL]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FALL]; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); tempDuration = partner->duration; @@ -1717,7 +1717,7 @@ s32 partner_put_away(Npc* partner) { } break; case 2: - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FLY]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FLY]; partner->jumpVelocity = 0.0f; partner->pos.y = partner->moveToPos.y; disable_npc_blur(partner); @@ -1765,9 +1765,10 @@ s32 partner_get_out(Npc* partner) { add_vec2D_polar(&x, &z, 2.0f, gCameras[gCurrentCameraID].currentYaw); hitDepth = 1000.0f; if (npc_raycast_down_around(0x10000, &x, &y, &z, &hitDepth, partner->yaw, partner->collisionRadius)) { - s32 colliderType = get_collider_type_by_id(D_8010C978); + // @bug? collider flags not properly masked with COLLIDER_FLAGS_SURFACE_TYPE + s32 surfaceType = get_collider_flags(D_8010C978); - if ((colliderType == 2 || colliderType == 3) || (hitDepth > 100.0f)) { + if ((surfaceType == SURFACE_TYPE_SPIKES || surfaceType == SURFACE_TYPE_LAVA) || (hitDepth > 100.0f)) { moveToX = playerStatus->position.x; moveToY = playerStatus->position.y; moveToZ = playerStatus->position.z; @@ -1798,7 +1799,7 @@ s32 partner_get_out(Npc* partner) { partner->duration; D_8010CFC8 = 1; y = moveToY - y; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[2]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[2]; break; case 1: if (partner->jumpVelocity < 0.0f && func_800397E8(partner, fabsf(partner->jumpVelocity))) { @@ -1808,7 +1809,7 @@ s32 partner_get_out(Npc* partner) { partner->jumpVelocity -= partner->jumpScale; partner->pos.y += partner->jumpVelocity; if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[3]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[3]; } npc_move_heading(partner, partner->moveSpeed, partner->yaw); npc_do_world_collision(partner); @@ -1930,7 +1931,7 @@ s32 func_800EF4E0(void) { Camera* cameras = gCameras; s32 ret; - if (playerStatus->unk_90[CAM_DEFAULT] == 0.0f) { + if (playerStatus->flipYaw[CAM_DEFAULT] == 0.0f) { if (!(playerStatus->spriteFacingAngle >= 90.0f) || !(playerStatus->spriteFacingAngle < 270.0f)) { ret = 1; playerStatus->targetYaw = clamp_angle(cameras[CAM_DEFAULT].currentYaw - 90.0f); @@ -2009,7 +2010,7 @@ void partner_move_to_goal(Npc* partner, s32 arg1) { wPartnerMoveTime = 18; temp = dist2D(partner->pos.x, partner->pos.z, partner->moveToPos.x, partner->moveToPos.z); partner->moveSpeed = wPartnerMoveSpeed = temp / wPartnerMoveTime; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[ + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; case 1: if (wPartnerMoveTime != 0) { @@ -2022,7 +2023,7 @@ void partner_move_to_goal(Npc* partner, s32 arg1) { partner->jumpVelocity -= partner->jumpScale; partner->pos.y += partner->jumpVelocity; if (partner->jumpVelocity <= 0.0f) { - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FALL]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_FALL]; } if (partner->jumpVelocity <= 0.0f) { @@ -2035,7 +2036,7 @@ void partner_move_to_goal(Npc* partner, s32 arg1) { partner->yaw, partner->collisionRadius) && (temp <= fabsf(partner->jumpVelocity) + 22.0f)) { - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[ + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; partner->jumpScale = 0.0f; partner->jumpVelocity = 0.0f; @@ -2047,7 +2048,7 @@ void partner_move_to_goal(Npc* partner, s32 arg1) { partner->moveSpeed = wPartnerMoveSpeed; partner->yaw = D_800F8034; npc_move_heading(partner, partner->moveSpeed, partner->yaw); - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[ + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[ (partner->moveSpeed >= 4.0) ? PARTNER_ANIM_INDEX_RUN : PARTNER_ANIM_INDEX_WALK]; npc_do_world_collision(partner); } else { @@ -2067,7 +2068,7 @@ void partner_move_to_goal(Npc* partner, s32 arg1) { func_8003D660(partner, var_a1); } else { partner->flags &= ~NPC_FLAG_40; - partner->currentAnim.w = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; + partner->currentAnim = gPartnerAnimations[D_8010CFD8].anims[PARTNER_ANIM_INDEX_IDLE]; D_8010CFCE++; } break; diff --git a/src/world/script_api/7E3700.c b/src/world/script_api/7E3700.c index bf63f848ca..d3adecbed1 100644 --- a/src/world/script_api/7E3700.c +++ b/src/world/script_api/7E3700.c @@ -226,7 +226,7 @@ ApiStatus func_80283174(Evt* script, s32 isInitialCall) { s32 collider = script->varTable[11] + COLLISION_WITH_ENTITY_BIT; if (gCollisionStatus.pushingAgainstWall == collider) { - if (playerStatus->actionState == ACTION_STATE_14 + if (playerStatus->actionState == ACTION_STATE_PUSHING_BLOCK || playerStatus->actionState == ACTION_STATE_WALK || playerStatus->actionState == ACTION_STATE_RUN) { if (playerStatus->animFlags & PLAYER_STATUS_ANIM_FLAGS_HOLDING_WATT) { @@ -351,7 +351,7 @@ ApiStatus GetPushBlock(Evt* script, s32 isInitialCall) { s32 cellIndex; if (gridX >= blockGrid->numCellsX || gridX < 0 || gridZ >= blockGrid->numCellsZ || gridZ < 0) { - // bug: sets error value and then performs lookup anyway -- return statement forgotten here + // @bug: sets error value and then performs lookup anyway -- return statement forgotten here evt_set_variable(script, outVar, PUSH_GRID_OUT_OF_BOUNDS); } cellIndex = gridX + (gridZ * blockGrid->numCellsX); diff --git a/ver/us/asm/nonmatchings/world/partner/bombette/func_802BD758_3184A8.s b/ver/us/asm/nonmatchings/world/partner/bombette/func_802BD758_3184A8.s index f61aa34705..2fd257c86b 100644 --- a/ver/us/asm/nonmatchings/world/partner/bombette/func_802BD758_3184A8.s +++ b/ver/us/asm/nonmatchings/world/partner/bombette/func_802BD758_3184A8.s @@ -348,7 +348,7 @@ glabel func_802BD758_3184A8 /* 3189B0 802BDC60 00000000 */ nop /* 3189B4 802BDC64 3C048011 */ lui $a0, %hi(D_8010C978) /* 3189B8 802BDC68 8C84C978 */ lw $a0, %lo(D_8010C978)($a0) -/* 3189BC 802BDC6C 0C016F6A */ jal get_collider_type_by_id +/* 3189BC 802BDC6C 0C016F6A */ jal get_collider_flags /* 3189C0 802BDC70 00000000 */ nop /* 3189C4 802BDC74 304200FF */ andi $v0, $v0, 0xff /* 3189C8 802BDC78 2442FFFE */ addiu $v0, $v0, -2 diff --git a/ver/us/asm/nonmatchings/world/partner/sushie/func_802BD414_31E184.s b/ver/us/asm/nonmatchings/world/partner/sushie/func_802BD414_31E184.s index c81d73ca7a..fdbcf2fc0d 100644 --- a/ver/us/asm/nonmatchings/world/partner/sushie/func_802BD414_31E184.s +++ b/ver/us/asm/nonmatchings/world/partner/sushie/func_802BD414_31E184.s @@ -316,7 +316,7 @@ glabel func_802BD414_31E184 /* 31E5F4 802BD884 2442C978 */ addiu $v0, $v0, %lo(D_8010C978) /* 31E5F8 802BD888 8C440000 */ lw $a0, ($v0) /* 31E5FC 802BD88C 94420002 */ lhu $v0, 2($v0) -/* 31E600 802BD890 0C016F6A */ jal get_collider_type_by_id +/* 31E600 802BD890 0C016F6A */ jal get_collider_flags /* 31E604 802BD894 A6220000 */ sh $v0, ($s1) /* 31E608 802BD898 304200FF */ andi $v0, $v0, 0xff /* 31E60C 802BD89C 24030004 */ addiu $v1, $zero, 4 diff --git a/ver/us/asm/nonmatchings/world/partner/sushie/func_802BE3A4_31F114.s b/ver/us/asm/nonmatchings/world/partner/sushie/func_802BE3A4_31F114.s index 9c6d9d7625..4ead7d18b7 100644 --- a/ver/us/asm/nonmatchings/world/partner/sushie/func_802BE3A4_31F114.s +++ b/ver/us/asm/nonmatchings/world/partner/sushie/func_802BE3A4_31F114.s @@ -78,7 +78,7 @@ glabel func_802BE3A4_31F114 /* 31F208 802BE498 30824000 */ andi $v0, $a0, 0x4000 /* 31F20C 802BE49C 14400415 */ bnez $v0, .L802BF4F4 /* 31F210 802BE4A0 24020001 */ addiu $v0, $zero, 1 -/* 31F214 802BE4A4 0C016F6A */ jal get_collider_type_by_id +/* 31F214 802BE4A4 0C016F6A */ jal get_collider_flags /* 31F218 802BE4A8 00000000 */ nop /* 31F21C 802BE4AC 304200FF */ andi $v0, $v0, 0xff /* 31F220 802BE4B0 24030004 */ addiu $v1, $zero, 4 @@ -186,7 +186,7 @@ glabel func_802BE3A4_31F114 /* 31F3A8 802BE638 2403FFFF */ addiu $v1, $zero, -1 /* 31F3AC 802BE63C 04400004 */ bltz $v0, .L802BE650 /* 31F3B0 802BE640 AFA20040 */ sw $v0, 0x40($sp) -/* 31F3B4 802BE644 0C016F6A */ jal get_collider_type_by_id +/* 31F3B4 802BE644 0C016F6A */ jal get_collider_flags /* 31F3B8 802BE648 0040202D */ daddu $a0, $v0, $zero /* 31F3BC 802BE64C 304300FF */ andi $v1, $v0, 0xff .L802BE650: @@ -776,7 +776,7 @@ glabel func_802BE3A4_31F114 /* 31FC88 802BEF18 30424000 */ andi $v0, $v0, 0x4000 /* 31FC8C 802BEF1C 14400007 */ bnez $v0, .L802BEF3C /* 31FC90 802BEF20 00000000 */ nop -/* 31FC94 802BEF24 0C016F6A */ jal get_collider_type_by_id +/* 31FC94 802BEF24 0C016F6A */ jal get_collider_flags /* 31FC98 802BEF28 00000000 */ nop /* 31FC9C 802BEF2C 304200FF */ andi $v0, $v0, 0xff /* 31FCA0 802BEF30 24030004 */ addiu $v1, $zero, 4 diff --git a/ver/us/asm/nonmatchings/world/partners/partner_walking_follow_player.s b/ver/us/asm/nonmatchings/world/partners/partner_walking_follow_player.s index bebe1ee4db..ee9490138d 100644 --- a/ver/us/asm/nonmatchings/world/partners/partner_walking_follow_player.s +++ b/ver/us/asm/nonmatchings/world/partners/partner_walking_follow_player.s @@ -284,7 +284,7 @@ glabel partner_walking_follow_player /* 8552C 800EC07C 0C00F598 */ jal func_8003D660 /* 85530 800EC080 0220202D */ daddu $a0, $s1, $zero /* 85534 800EC084 86240084 */ lh $a0, 0x84($s1) -/* 85538 800EC088 0C016F6A */ jal get_collider_type_by_id +/* 85538 800EC088 0C016F6A */ jal get_collider_flags /* 8553C 800EC08C 00000000 */ nop /* 85540 800EC090 2442FFFE */ addiu $v0, $v0, -2 /* 85544 800EC094 2C420002 */ sltiu $v0, $v0, 2 @@ -335,7 +335,7 @@ glabel partner_walking_follow_player /* 855F0 800EC140 0803B4B7 */ j .L800ED2DC /* 855F4 800EC144 00000000 */ nop .L800EC148_855F8: -/* 855F8 800EC148 0C016F6A */ jal get_collider_type_by_id +/* 855F8 800EC148 0C016F6A */ jal get_collider_flags /* 855FC 800EC14C 86240084 */ lh $a0, 0x84($s1) /* 85600 800EC150 3C058011 */ lui $a1, %hi(D_8010CFBC) /* 85604 800EC154 24A5CFBC */ addiu $a1, $a1, %lo(D_8010CFBC) @@ -765,7 +765,7 @@ glabel partner_walking_follow_player /* 85C64 800EC7B4 A4800000 */ sh $zero, ($a0) .L800EC7B8: /* 85C68 800EC7B8 86240084 */ lh $a0, 0x84($s1) -/* 85C6C 800EC7BC 0C016F6A */ jal get_collider_type_by_id +/* 85C6C 800EC7BC 0C016F6A */ jal get_collider_flags /* 85C70 800EC7C0 00000000 */ nop /* 85C74 800EC7C4 2442FFFE */ addiu $v0, $v0, -2 /* 85C78 800EC7C8 2C420002 */ sltiu $v0, $v0, 2 @@ -938,7 +938,7 @@ glabel partner_walking_follow_player /* 85EF4 800ECA44 00000000 */ nop /* 85EF8 800ECA48 3C108011 */ lui $s0, %hi(D_8010C978) /* 85EFC 800ECA4C 2610C978 */ addiu $s0, $s0, %lo(D_8010C978) -/* 85F00 800ECA50 0C016F6A */ jal get_collider_type_by_id +/* 85F00 800ECA50 0C016F6A */ jal get_collider_flags /* 85F04 800ECA54 8E040000 */ lw $a0, ($s0) /* 85F08 800ECA58 2442FFFE */ addiu $v0, $v0, -2 /* 85F0C 800ECA5C 2C420002 */ sltiu $v0, $v0, 2 diff --git a/ver/us/splat.yaml b/ver/us/splat.yaml index 3cf9529798..bb67aee3e9 100644 --- a/ver/us/splat.yaml +++ b/ver/us/splat.yaml @@ -11994,13 +11994,13 @@ segments: subsegments: - [0xE24040, c, jump] - type: code - name: world_action_18 + name: world_action_step_up dir: world/action start: 0xE245D0 vram: 0x802B6000 overlay: True subsegments: - - [0xE245D0, c, 18] + - [0xE245D0, c, step_up] - [0xE248D0] - type: code name: world_action_land @@ -12030,22 +12030,22 @@ segments: - [0xE25D60, c, spin] - [0xE26700] - type: code - name: world_action_ultra_boots + name: world_action_tornado_jump dir: world/action start: 0xE26710 vram: 0x802B6000 overlay: True subsegments: - - [0xE26710, c, ultra_boots] + - [0xE26710, c, tornado_jump] - [0xE26DA0] - type: code - name: world_action_super_boots + name: world_action_spin_jump dir: world/action start: 0xE26DE0 vram: 0x802B6000 overlay: True subsegments: - - [0xE26DE0, c, super_boots] + - [0xE26DE0, c, spin_jump] - [0xE274C0] - type: code name: world_action_slide @@ -12074,21 +12074,21 @@ segments: - [0xE27F40, c, hit_lava] - [0xE28790] - type: code - name: world_action_16 + name: world_action_knockback dir: world/action start: 0xE287F0 vram: 0x802B6000 overlay: True subsegments: - - [0xE287F0, c, 16] + - [0xE287F0, c, knockback] - type: code - name: world_action_encounter + name: world_action_misc dir: world/action start: 0xE28A30 vram: 0x802B6000 overlay: True subsegments: - - [0xE28A30, c, encounter] + - [0xE28A30, c, misc] - [0xE29190] - type: code name: world_action_use_munchlesia diff --git a/ver/us/symbol_addrs.txt b/ver/us/symbol_addrs.txt index 389bca4f70..7ff704b60b 100644 --- a/ver/us/symbol_addrs.txt +++ b/ver/us/symbol_addrs.txt @@ -836,7 +836,7 @@ parent_collider_to_model = 0x8005B780; // type:func rom:0x36B80 _add_hit_vert_to_buffer = 0x8005B9A0; // type:func rom:0x36DA0 _get_hit_vert_index_from_buffer = 0x8005B9F4; // type:func rom:0x36DF4 update_collider_transform = 0x8005BA24; // type:func rom:0x36E24 -get_collider_type_by_id = 0x8005BDA8; // type:func rom:0x371A8 +get_collider_flags = 0x8005BDA8; // type:func rom:0x371A8 get_flat_collider_normal = 0x8005BDD8; // type:func rom:0x371D8 get_collider_center = 0x8005BE10; // type:func rom:0x37210 test_ray_triangle_general = 0x8005BE84; // type:func rom:0x37284 @@ -3136,7 +3136,7 @@ D_800B451E = 0x800B451E; // type:data rom:0x8F91E D_800B451F = 0x800B451F; // type:data rom:0x8F91F D_800B4520 = 0x800B4520; // type:data rom:0x8F920 gPlayerStatusPtr = 0x800F7B30; // rom:0x90FE0 -D_800F7B40 = 0x800F7B40; // type:data rom:0x90FF0 +PrevPlayerCamRelativeYaw = 0x800F7B40; // type:data rom:0x90FF0 D_800F7B44 = 0x800F7B44; // type:data rom:0x90FF4 D_800F7B48 = 0x800F7B48; // type:data rom:0x90FF8 D_800F7B4C = 0x800F7B4C; // type:data rom:0x90FFC @@ -3816,8 +3816,8 @@ D_8010C94C = 0x8010C94C; // type:data rom:0xA5DFC D_8010C950 = 0x8010C950; // type:data rom:0xA5E00 TweesterTouchingPartner = 0x8010C954; // type:data rom:0xA5E04 D_8010C958 = 0x8010C958; // type:data rom:0xA5E08 -D_8010C95C = 0x8010C95C; // type:data rom:0xA5E0C -D_8010C960 = 0x8010C960; // type:data rom:0xA5E10 +PrevPlayerDirection = 0x8010C95C; // type:data rom:0xA5E0C +JumpedOnSwitchX = 0x8010C960; // type:data rom:0xA5E10 D_8010C964 = 0x8010C964; // type:data rom:0xA5E14 D_8010C968 = 0x8010C968; // type:data rom:0xA5E18 D_8010C96C = 0x8010C96C; // type:data rom:0xA5E1C @@ -3825,7 +3825,7 @@ D_8010C970 = 0x8010C970; // type:data rom:0xA5E20 D_8010C974 = 0x8010C974; // type:data rom:0xA5E24 D_8010C978 = 0x8010C978; // type:data rom:0xA5E28 D_8010C97A = 0x8010C97A; // type:data rom:0xA5E2A -D_8010C97C = 0x8010C97C; // type:data rom:0xA5E2C +JumpedOnSwitchZ = 0x8010C97C; // type:data rom:0xA5E2C D_8010C980 = 0x8010C980; // type:data rom:0xA5E30 D_8010C984 = 0x8010C984; // type:data rom:0xA5E34 D_8010C988 = 0x8010C988; // type:data rom:0xA5E38 @@ -7767,7 +7767,7 @@ world_watt_pre_battle = 0x802BDD9C; // type:func rom:0x31D90C world_watt_post_battle = 0x802BDE10; // type:func rom:0x31D980 func_802BDE88_31D9F8 = 0x802BDE88; // type:func rom:0x31D9F8 func_802BE014_31DB84 = 0x802BE014; // type:func rom:0x31DB84 -func_802BE070_31DBE0 = 0x802BE070; // type:func rom:0x31DBE0 +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 @@ -25062,75 +25062,75 @@ D_802B7BC0_E23170 = 0x802B7BC0; // type:data rom:0xE23170 D_802B7BE0_E23190 = 0x802B7BE0; // type:data rom:0xE23190 D_802B7C00_E231B0 = 0x802B7C00; // type:data rom:0xE231B0 D_802B7C78_E23228 = 0x802B7C78; // type:data rom:0xE23228 -action_idle_update = 0x802B6000; // type:func rom:0xE23260 -action_idle_update_peach = 0x802B61E4; // type:func rom:0xE23444 +action_update_idle = 0x802B6000; // type:func rom:0xE23260 +action_update_idle_peach = 0x802B61E4; // type:func rom:0xE23444 IdlePeachAnims = 0x802B6430; // type:data rom:0xE23690 -func_802B6000_E236E0 = 0x802B6000; // type:func rom:0xE236E0 -action_run_update = 0x802B6288; // type:func rom:0xE23968 +action_update_walk = 0x802B6000; // type:func rom:0xE236E0 +action_update_run = 0x802B6288; // type:func rom:0xE23968 func_802B6550_E23C30 = 0x802B6550; // type:func rom:0xE23C30 -func_802B65E8_E23CC8 = 0x802B65E8; // type:func rom:0xE23CC8 -action_run_update_peach = 0x802B6738; // type:func rom:0xE23E18 +action_update_walk_peach = 0x802B65E8; // type:func rom:0xE23CC8 +action_update_run_peach = 0x802B6738; // type:func rom:0xE23E18 WalkPeachAnims = 0x802B6910; // type:data rom:0xE23FF0 -func_802B6000_E24040 = 0x802B6000; // type:func rom:0xE24040 -func_802B60B4_E240F4 = 0x802B60B4; // type:func rom:0xE240F4 -func_802B6198_E241D8 = 0x802B6198; // type:func rom:0xE241D8 -func_802B6294_E242D4 = 0x802B6294; // type:func rom:0xE242D4 -func_802B6348_E24388 = 0x802B6348; // type:func rom:0xE24388 -func_802B647C_E244BC = 0x802B647C; // type:func rom:0xE244BC -func_802B6508_E24548 = 0x802B6508; // type:func rom:0xE24548 -func_802B6000_E245D0 = 0x802B6000; // type:func rom:0xE245D0 +initialize_jump = 0x802B6000; // type:func rom:0xE24040 +action_update_jump = 0x802B60B4; // type:func rom:0xE240F4 +action_update_landing_on_switch = 0x802B6198; // type:func rom:0xE241D8 +action_update_falling = 0x802B6294; // type:func rom:0xE242D4 +action_update_step_down = 0x802B6348; // type:func rom:0xE24388 +action_update_peach_falling = 0x802B647C; // type:func rom:0xE244BC +action_update_peach_step_down = 0x802B6508; // type:func rom:0xE24548 +action_update_step_up = 0x802B6000; // type:func rom:0xE245D0 func_802B6198_E24768 = 0x802B6198; // type:func rom:0xE24768 -func_802B6230_E24800 = 0x802B6230; // type:func rom:0xE24800 +action_update_step_up_peach = 0x802B6230; // type:func rom:0xE24800 State18PeachAnims = 0x802B6300; // type:data rom:0xE248D0 -func_802B6000_E24920 = 0x802B6000; // type:func rom:0xE24920 -func_802B61C0_E24AE0 = 0x802B61C0; // type:func rom:0xE24AE0 -func_802B62CC_E24BEC = 0x802B62CC; // type:func rom:0xE24BEC -func_802B644C_E24D6C = 0x802B644C; // type:func rom:0xE24D6C +action_update_land = 0x802B6000; // type:func rom:0xE24920 +action_update_step_down_land = 0x802B61C0; // type:func rom:0xE24AE0 +action_update_peach_land = 0x802B62CC; // type:func rom:0xE24BEC +action_update_peach_step_down_land = 0x802B644C; // type:func rom:0xE24D6C action_hammer_is_swinging_away = 0x802B6000; // type:func rom:0xE24ED0 action_hammer_play_hit_fx = 0x802B6048; // type:func rom:0xE24F18 func_802B62A4_E25174 = 0x802B62A4; // type:func rom:0xE25174 -action_hammer_update = 0x802B66A8; // type:func rom:0xE25578 +action_update_hammer = 0x802B66A8; // type:func rom:0xE25578 func_802B6820_E256F0 = 0x802B6820; // type:func rom:0xE256F0 HammerHit = 0x802B6DB0; // type:data rom:0xE25C80 D_802B6DC0_E25C90 = 0x802B6DC0; // type:data rom:0xE25C90 -func_802B6000_E25D60 = 0x802B6000; // type:func rom:0xE25D60 +action_update_spin = 0x802B6000; // type:func rom:0xE25D60 D_802B69A0_E26700 = 0x802B69A0; // type:data rom:0xE26700 D_802B69A8_E26708 = 0x802B69A8; // type:data rom:0xE26708 -func_802B6000_E26710 = 0x802B6000; // type:func rom:0xE26710 +action_update_tornado_jump = 0x802B6000; // type:func rom:0xE26710 func_802B65F8_E26D08 = 0x802B65F8; // type:func rom:0xE26D08 -func_802B6000_E26DE0 = 0x802B6000; // type:func rom:0xE26DE0 +action_update_spin_jump = 0x802B6000; // type:func rom:0xE26DE0 func_802B6648_E27428 = 0x802B6648; // type:func rom:0xE27428 D_802B6718_E274F8 = 0x802B6718; // type:data rom:0xE274F8 D_802B6720_E27500 = 0x802B6720; // type:data rom:0xE27500 D_802B6728_E27508 = 0x802B6728; // type:data rom:0xE27508 func_802B6000_E27510 = 0x802B6000; // type:func rom:0xE27510 -func_802B6060_E27570 = 0x802B6060; // type:func rom:0xE27570 +action_update_sliding = 0x802B6060; // type:func rom:0xE27570 D_802B6760_E27C70 = 0x802B6760; // type:data rom:0xE27C70 D_802B6768_E27C78 = 0x802B6768; // type:data rom:0xE27C78 D_802B6770_E27C80 = 0x802B6770; // type:data rom:0xE27C80 -func_802B6000_E27C90 = 0x802B6000; // type:func rom:0xE27C90 -func_802B6000_E27F40 = 0x802B6000; // type:func rom:0xE27F40 -func_802B6000_E287F0 = 0x802B6000; // type:func rom:0xE287F0 -func_802B6000_E28A30 = 0x802B6000; // type:func rom:0xE28A30 -func_802B609C_E28ACC = 0x802B609C; // type:func rom:0xE28ACC -func_802B6350_E28D80 = 0x802B6350; // type:func rom:0xE28D80 -func_802B63D4_E28E04 = 0x802B63D4; // type:func rom:0xE28E04 -func_802B6478_E28EA8 = 0x802B6478; // type:func rom:0xE28EA8 -func_802B6508_E28F38 = 0x802B6508; // type:func rom:0xE28F38 -func_802B6638_E29068 = 0x802B6638; // type:func rom:0xE29068 +action_update_hit_fire = 0x802B6000; // type:func rom:0xE27C90 +action_update_hit_lava = 0x802B6000; // type:func rom:0xE27F40 +action_update_knockback = 0x802B6000; // type:func rom:0xE287F0 +action_update_ride = 0x802B6000; // type:func rom:0xE28A30 +action_update_state_23 = 0x802B609C; // type:func rom:0xE28ACC +action_update_launch = 0x802B6350; // type:func rom:0xE28D80 +action_update_first_strike = 0x802B63D4; // type:func rom:0xE28E04 +action_update_raise_arms = 0x802B6478; // type:func rom:0xE28EA8 +action_update_pushing_block = 0x802B6508; // type:func rom:0xE28F38 +action_update_talk = 0x802B6638; // type:func rom:0xE29068 D_802B6760_E29190 = 0x802B6760; // type:data rom:0xE29190 D_802B6768_E29198 = 0x802B6768; // type:data rom:0xE29198 -func_802B6000_E291A0 = 0x802B6000; // type:func rom:0xE291A0 +action_update_use_munchlesia = 0x802B6000; // type:func rom:0xE291A0 func_802B6000_E29470 = 0x802B6000; // type:func rom:0xE29470 -func_802B60A4_E29514 = 0x802B60A4; // type:func rom:0xE29514 +action_update_use_spinning_flower = 0x802B60A4; // type:func rom:0xE29514 D_802B6E90_E2A300 = 0x802B6E90; // type:data rom:0xE2A300 D_802B6E98_E2A308 = 0x802B6E98; // type:data rom:0xE2A308 D_802B6EA0_E2A310 = 0x802B6EA0; // type:data rom:0xE2A310 -func_802B6000_E2A340 = 0x802B6000; // type:func rom:0xE2A340 +action_update_use_tweester = 0x802B6000; // type:func rom:0xE2A340 PlayerTweesterPhysics = 0x802B6350; // type:data rom:0xE2A690 D_802B6360_E2A6A0 = 0x802B6360; // type:data rom:0xE2A6A0 func_802B6000_E2A6B0 = 0x802B6000; // type:func rom:0xE2A6B0 -func_802B6120_E2A7D0 = 0x802B6120; // type:func rom:0xE2A7D0 +action_update_parasol = 0x802B6120; // type:func rom:0xE2A7D0 func_802B6CF0_E2B3A0 = 0x802B6CF0; // type:func rom:0xE2B3A0 D_802B6E60_E2B510 = 0x802B6E60; // type:data rom:0xE2B510 D_802B6E68_E2B518 = 0x802B6E68; // type:data rom:0xE2B518 @@ -25824,8 +25824,8 @@ D_8010C94C = 0x8010C94C; // type:data D_8010C950 = 0x8010C950; // type:data TweesterTouchingPartner = 0x8010C954; // type:data D_8010C958 = 0x8010C958; // type:data -D_8010C95C = 0x8010C95C; // type:data -D_8010C960 = 0x8010C960; // type:data +PrevPlayerDirection = 0x8010C95C; // type:data +JumpedOnSwitchX = 0x8010C960; // type:data D_8010C964 = 0x8010C964; // type:data D_8010C968 = 0x8010C968; // type:data D_8010C96C = 0x8010C96C; // type:data @@ -25833,7 +25833,7 @@ D_8010C970 = 0x8010C970; // type:data D_8010C974 = 0x8010C974; // type:data D_8010C978 = 0x8010C978; // type:data D_8010C97A = 0x8010C97A; // type:data -D_8010C97C = 0x8010C97C; // type:data +JumpedOnSwitchZ = 0x8010C97C; // type:data D_8010C980 = 0x8010C980; // type:data D_8010C984 = 0x8010C984; // type:data D_8010C98C = 0x8010C98C; // type:data @@ -27105,10 +27105,10 @@ D_802AD6C0 = 0x802AD6C0; // type:data D_802AD6D4 = 0x802AD6D4; // type:data D_802B6240 = 0x802B6240; // type:data D_802B62B0 = 0x802B62B0; // type:data -D_802B62D0 = 0x802B62D0; // type:data -D_802B62D4 = 0x802B62D4; // type:data -D_802B62D8 = 0x802B62D8; // type:data -D_802B62DC = 0x802B62DC; // type:data +Munchlesia_LaunchVelocity = 0x802B62D0; // type:data +Munchlesia_LateralVelocity = 0x802B62D4; // type:data +Munchlesia_LaunchAccel = 0x802B62D8; // type:data +Munchlesia_LaunchYaw = 0x802B62DC; // type:data D_802B62E0 = 0x802B62E0; // type:data D_802B6730 = 0x802B6730; // type:data D_802B6780 = 0x802B6780; // type:data @@ -27124,14 +27124,14 @@ D_802B68B4 = 0x802B68B4; // type:data D_802B68B8 = 0x802B68B8; // type:data D_802B68BC = 0x802B68BC; // type:data D_802B6E80 = 0x802B6E80; // type:data -D_802B6ED0 = 0x802B6ED0; // type:data +SpinningFlower_EntityIndex = 0x802B6ED0; // type:data D_802B6ED4 = 0x802B6ED4; // type:data D_802B6ED8 = 0x802B6ED8; // type:data D_802B6EDC = 0x802B6EDC; // type:data D_802B6EE0 = 0x802B6EE0; // type:data D_802B6EE4 = 0x802B6EE4; // type:data D_802B6EE8 = 0x802B6EE8; // type:data -D_802B6EEC = 0x802B6EEC; // type:data +SpinningFlower_AngleToCenter = 0x802B6EEC; // type:data D_802B6EF0 = 0x802B6EF0; // type:data D_802B6EF4 = 0x802B6EF4; // type:data D_802B7140 = 0x802B7140; // type:data diff --git a/ver/us/undefined_syms.txt b/ver/us/undefined_syms.txt index fefda32576..cb03203317 100644 --- a/ver/us/undefined_syms.txt +++ b/ver/us/undefined_syms.txt @@ -1051,10 +1051,10 @@ D_802AD6C0 = 0x802AD6C0; D_802AD6D4 = 0x802AD6D4; D_802B6240 = 0x802B6240; D_802B62B0 = 0x802B62B0; -D_802B62D0 = 0x802B62D0; -D_802B62D4 = 0x802B62D4; -D_802B62D8 = 0x802B62D8; -D_802B62DC = 0x802B62DC; +Munchlesia_LaunchVelocity = 0x802B62D0; +Munchlesia_LateralVelocity = 0x802B62D4; +Munchlesia_LaunchAccel = 0x802B62D8; +Munchlesia_LaunchYaw = 0x802B62DC; D_802B62E0 = 0x802B62E0; D_802B6730 = 0x802B6730; D_802B6770_E27C80 = 0x802B6770; @@ -1072,14 +1072,14 @@ D_802B68B8 = 0x802B68B8; D_802B68BC = 0x802B68BC; D_802B6E80 = 0x802B6E80; D_802B6E90_E2A300 = 0x802B6E90; -D_802B6ED0 = 0x802B6ED0; +SpinningFlower_EntityIndex = 0x802B6ED0; D_802B6ED4 = 0x802B6ED4; D_802B6ED8 = 0x802B6ED8; D_802B6EDC = 0x802B6EDC; D_802B6EE0 = 0x802B6EE0; D_802B6EE4 = 0x802B6EE4; D_802B6EE8 = 0x802B6EE8; -D_802B6EEC = 0x802B6EEC; +SpinningFlower_AngleToCenter = 0x802B6EEC; D_802B6EF0 = 0x802B6EF0; D_802B6EF4 = 0x802B6EF4; mdl_clearRenderTasks = 0x802B7E00;