From 092de6aae319ee7f0b724d05a14b9ad047ce3cd3 Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 16 Jun 2024 22:36:36 -0500 Subject: [PATCH] documentation: core2/ba/physics --- decompressed.us.v10.yaml | 8 +- include/actor.h | 33 +++ include/animation.h | 7 +- include/core1/mem.h | 15 +- include/core2/ba/physics.h | 53 ++++ include/core2/yaw.h | 2 +- include/functions.h | 35 +-- src/BGS/ch/croctus.c | 14 +- src/BGS/ch/leafboat.c | 8 +- src/BGS/ch/mudhut.c | 4 +- src/BGS/ch/pinkegg.c | 4 +- src/BGS/ch/tanktup.c | 8 +- src/BGS/code_8DF0.c | 59 ++-- src/BGS/code_9750.c | 2 +- src/CC/code_19B0.c | 43 +-- src/CCW/code_2B00.c | 10 +- src/CCW/code_7BF0.c | 4 +- src/CCW/code_8050.c | 2 +- src/FP/ch/bearcub.c | 4 +- src/FP/ch/boggy1.c | 8 +- src/FP/ch/boggy2.c | 34 +-- src/FP/ch/racesled.c | 2 +- src/FP/ch/scarfsled.c | 2 +- src/FP/ch/snowmanbutton.c | 4 +- src/FP/ch/twinkly.c | 10 +- src/FP/ch/twinklybox.c | 16 +- src/FP/ch/twinklymuncher.c | 14 +- src/FP/ch/wozza.c | 26 +- src/FP/ch/wozzasjig.c | 2 +- src/FP/ch/xmastree.c | 10 +- src/FP/ch/xmastreestar.c | 6 +- src/FP/ch/xmastreeswitch.c | 8 +- src/FP/code_19E0.c | 4 +- src/FP/code_1FF0.c | 4 +- src/GV/ch/ancientone.c | 6 +- src/GV/ch/histup.c | 14 +- src/GV/ch/sarcophagus.c | 16 +- src/GV/ch/toots.c | 6 +- src/GV/code_3630.c | 12 +- src/GV/code_3D90.c | 8 +- src/GV/code_4740.c | 20 +- src/GV/code_5570.c | 14 +- src/GV/code_61E0.c | 4 +- src/GV/code_7060.c | 10 +- src/GV/code_7DB0.c | 4 +- src/GV/code_7FF0.c | 20 +- src/MM/ch/chimpystump.c | 4 +- src/MM/ch/conga.c | 32 +-- src/MM/ch/grublin.c | 4 +- src/MM/ch/hut.c | 4 +- src/MM/ch/lmonkey.c | 10 +- src/MM/code_24C0.c | 19 +- src/MMM/ch/loggo.c | 4 +- src/MMM/code_2040.c | 12 +- src/MMM/code_2F60.c | 4 +- src/MMM/code_DC0.c | 2 +- src/SM/ch/attacktutorial.c | 2 +- src/SM/ch/vegetables.c | 8 +- src/SM/code_2990.c | 8 +- src/SM/code_3FC0.c | 2 +- src/SM/code_4070.c | 2 +- src/SM/code_5B0.c | 2 +- src/SM/code_BF0.c | 2 +- src/TTC/ch/blubber.c | 16 +- src/TTC/ch/clam.c | 6 +- src/TTC/ch/leaky.c | 2 +- src/TTC/ch/lockup.c | 10 +- src/TTC/ch/nipper.c | 16 +- src/TTC/ch/treasure.c | 2 +- src/core1/code_1D5D0.c | 8 +- src/core1/code_EAF0.c | 8 +- src/core1/memory.c | 38 ++- src/core2/ba/anim.c | 6 +- src/core2/ba/marker.c | 7 +- src/core2/ba/model.c | 3 +- src/core2/ba/physics.c | 432 +++++++++++++++++++++++++++++ src/core2/bs/ant.c | 69 ++--- src/core2/bs/bBarge.c | 30 +- src/core2/bs/bEggAss.c | 8 +- src/core2/bs/bEggHead.c | 8 +- src/core2/bs/bFlap.c | 31 ++- src/core2/bs/bFlip.c | 37 +-- src/core2/bs/bFly.c | 111 ++++---- src/core2/bs/bLongLeg.c | 53 ++-- src/core2/bs/bPeck.c | 14 +- src/core2/bs/bShock.c | 34 +-- src/core2/bs/bSwim.c | 66 ++--- src/core2/bs/bTrot.c | 101 +++---- src/core2/bs/bWhirl.c | 40 +-- src/core2/bs/bbuster.c | 38 +-- src/core2/bs/beeFly.c | 54 ++-- src/core2/bs/beeMain.c | 83 +++--- src/core2/bs/carry.c | 13 +- src/core2/bs/claw.c | 10 +- src/core2/bs/climb.c | 19 +- src/core2/bs/croc.c | 83 +++--- src/core2/bs/crouch.c | 9 +- src/core2/bs/die.c | 19 +- src/core2/bs/droneenter.c | 4 +- src/core2/bs/dronegoto.c | 17 +- src/core2/bs/dronelook.c | 11 +- src/core2/bs/dronevanish.c | 4 +- src/core2/bs/dronexform.c | 15 +- src/core2/bs/jig.c | 10 +- src/core2/bs/jump.c | 61 ++-- src/core2/bs/ow.c | 6 +- src/core2/bs/pumpkin.c | 77 ++--- src/core2/bs/rebound.c | 35 +-- src/core2/bs/rest.c | 5 +- src/core2/bs/sled.c | 6 +- src/core2/bs/slide.c | 16 +- src/core2/bs/splat.c | 8 +- src/core2/bs/stand.c | 9 +- src/core2/bs/surf.c | 6 +- src/core2/bs/swim.c | 23 +- src/core2/bs/talk.c | 5 +- src/core2/bs/throw.c | 7 +- src/core2/bs/timeout.c | 9 +- src/core2/bs/turn.c | 17 +- src/core2/bs/twirl.c | 14 +- src/core2/bs/walk.c | 51 ++-- src/core2/bs/walrus.c | 110 ++++---- src/core2/bs/washy.c | 8 +- src/core2/ch/beehive.c | 2 +- src/core2/ch/bigbutt.c | 40 +-- src/core2/ch/bottlesbonus.c | 74 ++--- src/core2/ch/bottlesbonuscursor.c | 85 +++--- src/core2/ch/climbBase.c | 2 +- src/core2/ch/collectible.c | 2 +- src/core2/ch/crab.c | 28 +- src/core2/ch/gameSelect.c | 14 +- src/core2/ch/ghost.c | 22 +- src/core2/ch/gloop.c | 4 +- src/core2/ch/gravestone.c | 14 +- src/core2/ch/icecube.c | 10 +- src/core2/ch/jiggy.c | 2 +- src/core2/ch/jigsawdance.c | 8 +- src/core2/ch/jinjo.c | 18 +- src/core2/ch/mole.c | 16 +- src/core2/ch/molehill.c | 4 +- src/core2/ch/overlaynocontroller.c | 16 +- src/core2/ch/overlaypressstart.c | 6 +- src/core2/ch/shrapnel.c | 6 +- src/core2/ch/snowball.c | 2 +- src/core2/ch/snowman.c | 8 +- src/core2/ch/snowmanhat.c | 2 +- src/core2/ch/termite.c | 8 +- src/core2/ch/trainers.c | 10 +- src/core2/ch/wadingboots.c | 10 +- src/core2/code_13A00.c | 3 +- src/core2/code_14420.c | 13 +- src/core2/code_1550.c | 93 ++++--- src/core2/code_33C30.c | 10 +- src/core2/code_379B0.c | 6 +- src/core2/code_39D0.c | 8 +- src/core2/code_47BD0.c | 22 +- src/core2/code_4A6F0.c | 36 +-- src/core2/code_4C020.c | 24 +- src/core2/code_509D0.c | 8 +- src/core2/code_53C10.c | 34 +-- src/core2/code_57C70.c | 8 +- src/core2/code_59D40.c | 18 +- src/core2/code_654C0.c | 2 +- src/core2/code_6B030.c | 4 +- src/core2/code_6B30.c | 5 +- src/core2/code_7060.c | 5 +- src/core2/code_72060.c | 2 +- src/core2/code_7AF80.c | 43 ++- src/core2/code_851D0.c | 2 +- src/core2/code_935F0.c | 2 +- src/core2/code_9E370.c | 149 +++++----- src/core2/code_A960.c | 3 +- src/core2/code_AD0.c | 2 +- src/core2/code_AD5B0.c | 2 +- src/core2/code_B850.c | 8 +- src/core2/code_BEF20.c | 4 +- src/core2/code_C0E60.c | 40 +-- src/core2/code_C4320.c | 2 +- src/core2/code_C4B0.c | 12 +- src/core2/code_D5FD0.c | 2 +- src/core2/code_D6600.c | 32 +-- src/core2/code_D89E0.c | 16 +- src/core2/code_D9B0.c | 6 +- src/core2/code_E910.c | 5 +- src/core2/code_EE40.c | 3 +- src/core2/code_EF50.c | 6 +- src/core2/code_FD60.c | 432 ----------------------------- src/core2/fx/airscore.c | 103 +++---- src/core2/fx/common2score.c | 16 +- src/core2/spawnqueue.c | 1 + src/cutscenes/code_6730.c | 2 +- src/cutscenes/code_6C90.c | 2 +- src/fight/chbossjinjo.c | 12 +- src/fight/chbossjinjobase.c | 4 +- src/fight/chfinalboss.c | 24 +- src/fight/chjinjonator.c | 24 +- src/fight/chjinjonatorbase.c | 4 +- src/fight/chspellfireball.c | 2 +- src/fight/chstonejinjo.c | 6 +- src/lair/ch/brentilda.c | 10 +- src/lair/ch/cauldron.c | 8 +- src/lair/code_0.c | 28 +- src/lair/code_86F0.c | 2 +- src/lair/code_A4A0.c | 2 +- src/lair/code_A810.c | 2 +- src/lair/code_AD70.c | 2 +- src/lair/code_BBD0.c | 20 +- src/lair/code_C1C0.c | 8 +- 208 files changed, 2342 insertions(+), 2163 deletions(-) create mode 100644 include/actor.h create mode 100644 include/core2/ba/physics.h create mode 100644 src/core2/ba/physics.c delete mode 100644 src/core2/code_FD60.c diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index ec476ca7..a80a139d 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -537,7 +537,7 @@ segments: - [0xF64270, c, code_E910] #DONE - [0xF647A0, c, code_EE40] #DONE - [0xF648B0, c, code_EF50] #DONE - - [0xF656C0, c, code_FD60] #DONE + - [0xF656C0, c, ba/physics] #DONE - [0xF66630, c, code_10CD0] #DONE - [0xF66700, c, pitch] #DONE - [0xF669A0, c, code_11040] #DONE @@ -906,7 +906,7 @@ segments: - [0x1032170, .data, eggshatter] - [0x10321C0, .data, code_C0E0] - [0x10321F0, .data, code_E910] - - [0x1032E10, .data, code_FD60] + - [0x1032E10, .data, ba/physics] - [0x1032E20, .data, code_117D0] - [0x1032F30, .data, code_126C0] - [0x1032F50, .data, code_12F30] @@ -1136,7 +1136,7 @@ segments: - [0x1043170, .rodata, code_D9B0] - [0x1043180, .rodata, code_E680] - [0x10431B0, .rodata, code_EF50] - - [0x1043350, .rodata, code_FD60] + - [0x1043350, .rodata, ba/physics] - [0x10433B0, .rodata, code_10CD0] - [0x10433C0, .rodata, pitch] - [0x10433F0, .rodata, code_11040] @@ -1399,7 +1399,7 @@ segments: - [0x1048560, .bss, code_E910] - [0x1048560, .bss, code_EE40] - [0x1048560, .bss, code_EF50] - - [0x1048560, .bss, code_FD60] + - [0x1048560, .bss, ba/physics] - [0x1048560, .bss, code_10CD0] - [0x1048560, .bss, pitch] - [0x1048560, .bss, code_11040] diff --git a/include/actor.h b/include/actor.h new file mode 100644 index 00000000..b805b435 --- /dev/null +++ b/include/actor.h @@ -0,0 +1,33 @@ +#ifndef ACTOR_H +#define ACTOR_H + +#define ACTOR_FLAG_NONE (0) +#define ACTOR_FLAG_UNKNOWN_0 (1 << 0) // 0x1 +#define ACTOR_FLAG_UNKNOWN_1 (1 << 1) // 0x2 +#define ACTOR_FLAG_UNKNOWN_2 (1 << 2) // 0x4 +#define ACTOR_FLAG_UNKNOWN_3 (1 << 3) // 0x8 +#define ACTOR_FLAG_UNKNOWN_4 (1 << 4) // 0x10 +#define ACTOR_FLAG_UNKNOWN_5 (1 << 5) // 0x20 +#define ACTOR_FLAG_UNKNOWN_6 (1 << 6) // 0x40 +#define ACTOR_FLAG_UNKNOWN_7 (1 << 7) // 0x80 +#define ACTOR_FLAG_UNKNOWN_8 (1 << 8) // 0x100 +#define ACTOR_FLAG_UNKNOWN_9 (1 << 9) // 0x200 +#define ACTOR_FLAG_UNKNOWN_10 (1 << 10) // 0x400 +#define ACTOR_FLAG_UNKNOWN_11 (1 << 11) // 0x800 +#define ACTOR_FLAG_UNKNOWN_12 (1 << 12) // 0x1000 +#define ACTOR_FLAG_UNKNOWN_13 (1 << 13) // 0x2000 +#define ACTOR_FLAG_UNKNOWN_14 (1 << 14) // 0x4000 +#define ACTOR_FLAG_UNKNOWN_15 (1 << 15) // 0x8000 +#define ACTOR_FLAG_UNKNOWN_16 (1 << 16) // 0x10000 +#define ACTOR_FLAG_UNKNOWN_17 (1 << 17) // 0x20000 +#define ACTOR_FLAG_UNKNOWN_18 (1 << 18) // 0x40000 +#define ACTOR_FLAG_UNKNOWN_19 (1 << 19) // 0x80000 +#define ACTOR_FLAG_UNKNOWN_20 (1 << 20) // 0x100000 +#define ACTOR_FLAG_UNKNOWN_21 (1 << 21) // 0x200000 +#define ACTOR_FLAG_UNKNOWN_22 (1 << 22) // 0x400000 +#define ACTOR_FLAG_UNKNOWN_23 (1 << 23) // 0x800000 +#define ACTOR_FLAG_UNKNOWN_24 (1 << 24) // 0x1000000 +#define ACTOR_FLAG_UNKNOWN_25 (1 << 25) // 0x2000000 +#define ACTOR_FLAG_UNKNOWN_26 (1 << 26) // 0x4000000 + +#endif // ACTOR_H diff --git a/include/animation.h b/include/animation.h index 7c0235e7..3ee0a63a 100644 --- a/include/animation.h +++ b/include/animation.h @@ -40,11 +40,6 @@ typedef struct animation_file_s{ u8 pad6[2]; } AnimationFile; -typedef struct animation_file_cache_s{ - AnimationFile *unk0; - u16 unk4_15:15; - u16 unk4_0:1; - u8 pad6[2]; -}AnimationFileCache; + #endif diff --git a/include/core1/mem.h b/include/core1/mem.h index 069133a4..029d7882 100644 --- a/include/core1/mem.h +++ b/include/core1/mem.h @@ -1,6 +1,19 @@ #ifndef __MEM_H__ #define __MEM_H__ +/** +* copy memory area +*/ void memcpy(void * dst, void *src, int size); -void func_80254630(void * dst, void *src, int size); //memcopy_fast + +/** +* copy an array of wide_characters +*/ +void wmemcpy(void * dst, void *src, int size); + + +/** + * copy memory area +*/ +void memmove(u8* dst, u8* src, s32 n); #endif diff --git a/include/core2/ba/physics.h b/include/core2/ba/physics.h new file mode 100644 index 00000000..23518022 --- /dev/null +++ b/include/core2/ba/physics.h @@ -0,0 +1,53 @@ +#ifndef __BA_PHYSICS_H__ +#define __BA_PHYSICS_H__ + +#include + +typedef enum ba_physics_type_e{ + BA_PHYSICS_NONE, + BA_PHYSICS_UNK1, + BA_PHYSICS_NORMAL, + BA_PHYSICS_LOCKED_ROTATION, + BA_PHYSICS_UNK4, + BA_PHYSICS_INVERTED_YAW, + BA_PHYSICS_AIRBORN, + BA_PHYSICS_FREEZE, + BA_PHYSICS_UNK8, + BA_PHYSICS_NO_GRAVITY, + BA_PHYSICS_CLIMB, + BA_PHYSICS_TRANSFORM, + BA_PHYSICS_GOTO, + BA_PHYSICS_END +}BaPhysicsType; + +void baphysics_get_position_change(f32 dst[3]); +void baphysics_init(void); +void baphysics_update(void); +void baphysics_reset_horizontal_velocity(void); +void baphysics_set_type(BaPhysicsType); +void baphysics_set_target_velocity(f32 src[3]); +void baphysics_set_target_horizontal_velocity(f32); +void baphysics_set_target_yaw(f32); +void baphysics_set_vertical_velocity(f32); +void baphysics_set_horizontal_velocity(f32, f32); +void baphysics_set_velocity(f32 src[3]); +f32 baphysics_get_gravity(void); +BaPhysicsType baphysics_get_type(void); +f32 baphysics_get_target_horizontal_velocity(void); +f32 baphysics_get_target_vertical_velocity(void); +f32 baphysics_get_target_yaw(void); +void baphysics_get_velocity(f32 dst[3]); +f32 baphysics_get_vertical_velocity(void); +f32 baphysics_get_horizontal_velocity(void); +f32 baphysics_get_horizontal_velocity_percentage(void); +void baphysics_reset(void); +void baphysics_set_acceleration(f32); +void baphysics_reset_gravity(void); +void baphysics_reset_terminal_velocity(void); +void baphysics_set_goto_duration(f32); +void baphysics_set_goto_position(f32 src[3]); +void baphysics_set_gravity(f32); +void baphysics_set_terminal_velocity(f32); +int baphysics_is_slower_than(f32); +int baphysics_goto_done(void); +#endif diff --git a/include/core2/yaw.h b/include/core2/yaw.h index 82015cab..ab1a616c 100644 --- a/include/core2/yaw.h +++ b/include/core2/yaw.h @@ -5,7 +5,7 @@ enum yaw_state_e{ YAW_STATE_0_NONE, YAW_STATE_1_DEFAULT, YAW_STATE_2_UNBOUNDED, - YAW_STATE_3_BOUNDED, + YAW_STATE_3_BOUNDED }; void yaw_init(void); diff --git a/include/functions.h b/include/functions.h index 468f7507..c51b59da 100644 --- a/include/functions.h +++ b/include/functions.h @@ -108,10 +108,6 @@ void pitch_setIdeal(f32); f32 pitch_get(void); f32 player_getYPosition(void); -void func_80297970(f32); - -f32 _get_vertVelocity(void); - void climbGetBottom(f32 dst[3]); void yaw_setIdeal(f32); @@ -155,7 +151,7 @@ void actor_collisionOff(Actor *); void *assetcache_get(enum asset_e assetId); -Actor *actor_new(s32 (*position)[3], s32 yaw, ActorInfo *actorInfo, u32 flags); +Actor *actor_new(s32 position[3], s32 yaw, ActorInfo *actorInfo, u32 flags); Actor *func_802C8A54(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *func_802C8AA8(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); Actor *func_802C8AF8(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags); @@ -209,7 +205,7 @@ void fxhealthscore_free(enum item_e, struct8s *); struct7s *fxairscore_new(s32); void fxairscore_update(enum item_e, struct7s *); void fxairscore_draw(enum item_e, struct8s *, Gfx**, Mtx**, Vtx **); -void fxairscore_free(s32, struct8s *); +void fxairscore_free(s32, struct7s *); @@ -252,9 +248,9 @@ void particleEmitter_setParticleVelocityRange(ParticleEmitter *, f32, f32, f32, void func_802EFF50(ParticleEmitter *, f32); void particleEmitter_setRGB(ParticleEmitter *this, s32 arg1[3]); void particleEmitter_setSpawnInterval(ParticleEmitter *, f32); - int func_8024DC04(f32, f32, f32); void func_8024E3A8(f32 [3], f32); +OSContPad *func_8024F3F4(void); OSMesgQueue *pfsManager_getFrameReplyQ(void); void ml_vec3f_clear(f32 dst[3]); @@ -322,20 +318,6 @@ void func_80294980(f32 arg0[3]); f32 get_slope_timer(void); f32 get_turbo_duration(void); void func_80295C08(void (* arg0)(void)); -void func_802978DC(int); -void func_80297970(f32); -void func_8029797C(f32); -void player_setYVelocity(f32); -void func_802979AC(f32, f32); -f32 func_80297A64(void); -f32 func_80297A70(void); -f32 func_80297A7C(void); -f32 _get_horzVelocity(void); -f32 func_80297AF0(void); -void gravity_set(f32); -void func_80297B64(f32); -void func_80297BF8(f32); -int func_80297C04(f32); void func_80297CCC(f32); f32 pitch_getIdeal(void); void pitch_setAngVel(f32, f32); @@ -455,11 +437,11 @@ void func_8032728C(f32[3], f32, s32, int(*)(Actor *)); Actor *func_8032813C(enum actor_e actor_id, f32 position[3], s32 yaw); int func_8032863C(AnimCtrl *, f32, f32); int func_80328A2C(Actor *, f32, s32, f32); -void func_80328A84(Actor *, u32); +void subaddie_set_state(Actor *, u32); ActorMarker *func_8032B16C(enum jiggy_e jiggy_id); -int func_80328B38(Actor *, s32, f32); -void func_80328B8C(Actor * this, s32 myAnimId, f32 arg2, s32 direction); -int func_80328BD4(Actor *, s32, f32, s32, f32 ); +int subaddie_maybe_set_state(Actor *, s32, f32); +void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32 direction); +int subaddie_maybe_set_state_position_direction(Actor *, s32, f32, s32, f32 ); void func_80328CEC(Actor *, s32, s32, s32); void func_80328FB0(Actor *, f32); int func_80329030(Actor *, s32); @@ -501,7 +483,6 @@ void func_80352CF4(f32 *, f32 *, f32, f32); AnimCtrl *baanim_getAnimCtrlPtr(void); -void _get_velocity(f32 dst[3]); void player_setYPosition(f32); NodeProp *func_80304C38(enum actor_e arg0, Actor *arg1); @@ -576,6 +557,6 @@ void ability_unlock(enum ability_e); extern void func_802EE278(Actor *, s32, s32, s32, f32, f32); extern void fxSparkle_chTreasure(s16[3]); extern void actor_collisionOn(Actor *); -extern void func_80328AC8(Actor *, s32); +extern void subaddie_set_state_forward(Actor *, s32); #endif diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index 238edf02..ca653add 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -92,7 +92,7 @@ void func_80387E68(ActorMarker *caller, enum asset_e text_id, s32 arg2){ timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000); func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); - func_80328B8C(this, 5, 0.79f, 1); + subaddie_set_state_with_direction(this, 5, 0.79f, 1); func_80326310(this); bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE; timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->unkF4_8])); @@ -144,13 +144,13 @@ void func_80387FD4(Actor *this){ if (this->unkF4_8 == 1) { func_8028F94C(2, this->position); func_80311480(0xC86, 0xE, this->position, this->marker, func_80387E68, NULL); - func_80328B8C(this, 6, 0.79f, 1); + subaddie_set_state_with_direction(this, 6, 0.79f, 1); } else { timed_playSfx(0.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //0.4f timed_playSfx(1.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //1.4f func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000); func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); - func_80328B8C(this, 5, 0.79f, 1); + subaddie_set_state_with_direction(this, 5, 0.79f, 1); if (this->unkF4_8 == 5) { timedFunc_set_1(0.9f, (GenFunction_1) func_80387E40, (s32) this->marker); } else { @@ -172,7 +172,7 @@ void func_80387FD4(Actor *this){ case 1:// L80388370 this->unk60 += time_getDelta(); if(0.7 <= this->unk60){ - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); func_80387C90(this); this->unk60 = 0.0f; func_80324D54(0.1f, SFX_D0_GRIMLET_SQUEAK, 1.0f, 0x7530, this->position, 0.0f, 1800.0f); @@ -181,14 +181,14 @@ void func_80387FD4(Actor *this){ case 2:// L80388400 if(actor_animationIsAt(this, 0.62f)){ - func_80328B8C(this, 3, 0.62f, 1); + subaddie_set_state_with_direction(this, 3, 0.62f, 1); } break; case 3:// L80388434 this->unk60 += time_getDelta(); if( this->unk60 >= 0.13 + 0.7/4 * (5 - this->unkF4_8)){ - func_80328B8C(this, 4, 0.62f, 1); + subaddie_set_state_with_direction(this, 4, 0.62f, 1); func_80387C90(this); this->unk60 = 0.0f; func_80324D54(0.3f, 0x406, 1.0f, 0x55f0, this->position, 0.0f, 1800.0f); @@ -197,7 +197,7 @@ void func_80387FD4(Actor *this){ case 4:// L8038850C if(actor_animationIsAt(this, 0.0f)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; diff --git a/src/BGS/ch/leafboat.c b/src/BGS/ch/leafboat.c index cda926a7..bb46af45 100644 --- a/src/BGS/ch/leafboat.c +++ b/src/BGS/ch/leafboat.c @@ -93,7 +93,7 @@ void func_8038FD9C(Actor *this){ this->unk1C[0] = 1.0f; this->alpha_124_19 = 0xff; if(this->unk54 != 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; @@ -104,7 +104,7 @@ void func_8038FD9C(Actor *this){ this->marker->propPtr->unk8_3 = 1; this->unk1C[0] = 1.0f; if(15.0f <= this->velocity_x){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); this->velocity_x = 0.0f; } else{ @@ -124,7 +124,7 @@ void func_8038FD9C(Actor *this){ this->unk1C[0] = 0.0f; this->alpha_124_19 = 0; if (this->unk54 == 0.0f) { - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -132,7 +132,7 @@ void func_8038FD9C(Actor *this){ this->marker->propPtr->unk8_3 = 1; this->unk1C[0] = 1.0f; if (this->velocity[0] >= 15.0f) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[0] = 0.0f; } else { if(tmp[5-(((s32)this->velocity_x)%6)]) { diff --git a/src/BGS/ch/mudhut.c b/src/BGS/ch/mudhut.c index 775b603f..995c20db 100644 --- a/src/BGS/ch/mudhut.c +++ b/src/BGS/ch/mudhut.c @@ -9,7 +9,7 @@ extern f32 player_stateTimer_get(enum state_timer_e); void func_802C4218(u32,f32,f32,f32); -void func_80328A84(Actor *, u32); +void subaddie_set_state(Actor *, u32); /* local declarations */ Actor *chmudhut_draw(ActorMarker *this, Gfx** gdl, Mtx** mtx, Vtx **vtx); @@ -97,7 +97,7 @@ void chmudhut_update(Actor *this){ diffPos[1] += 130.0; FUNC_8030E8B4(SFX_5B_HEAVY_STUFF_FALLING, 1.0f, 28000, this->position, 0x12C, 0xBB8); - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->marker->propPtr->unk8_3 = 0; actor_playAnimationOnce(this); if(tmp == 5){ diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index ff10853d..9e305c61 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -85,7 +85,7 @@ void chpinkegg_collision(ActorMarker *this, ActorMarker *other_marker){ thisActor = marker_getActor(this); this->propPtr->unk8_3 = 0; func_8030E510(SFX_AA_BGS_EGG_BREAKING_1, 28000); - func_80328A84(thisActor, 3); + subaddie_set_state(thisActor, 3); actor_playAnimationOnce(thisActor); this->collidable = 0; thisActor->unk124_6 = 0; @@ -108,7 +108,7 @@ void chpinkegg_update(Actor *this){ case 1: if(!((ActorLocal_PinkEgg *) &this->local)->unk4){ this->marker->collidable = 1; - func_80328A84(this,2); + subaddie_set_state(this,2); }else{ ((ActorLocal_PinkEgg *) &this->local)->unk4--; diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 01eddaff..be84802e 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -47,7 +47,7 @@ void func_8038F470(ActorMarker *this, s32 arg1, enum chtanktup_leg_e leg_id){ sp18[1] += 50.0f; leg = func_8032813C(leg_id + ACTOR_E9_TANKTUP_LEG_FL, sp18, (s32)thisActor->yaw); - func_80328B8C(leg, arg1 + 1, 0, -1); + subaddie_set_state_with_direction(leg, arg1 + 1, 0, -1); leg->unk10_12 = leg_id; } @@ -148,7 +148,7 @@ void func_8038F6A4(Actor *this) } if (local->unk10) { - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); local->unk10 = 0; sp44 = 0; if(&sp44); @@ -182,11 +182,11 @@ void func_8038F6A4(Actor *this) { if (!local->unk14) { - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); } else { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); actor_playAnimationOnce(this); } } diff --git a/src/BGS/code_8DF0.c b/src/BGS/code_8DF0.c index 93cfee00..4ef56013 100644 --- a/src/BGS/code_8DF0.c +++ b/src/BGS/code_8DF0.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "prop.h" +#include "actor.h" extern ActorInfo D_80390804; extern ActorInfo D_80390690; @@ -34,35 +35,35 @@ extern ActorInfo D_80390BD8; extern ActorInfo D_80390BFC; void BGS_func_8038F1E0(void){//bgs_updateSpawnableActors - spawnableActorList_add(&D_80390804, actor_new, 0x00000088);//croctus - spawnableActorList_add(&D_80390690, actor_new, 0x020108A1); //flibbit - spawnableActorList_add(&D_803906F8, actor_new, 0x400); //pink_egg_largest - spawnableActorList_add(&D_8039071C, actor_new, 0x400); //pink_egg_large - spawnableActorList_add(&D_80390740, actor_new, 0x400); //pink_egg_medium - spawnableActorList_add(&D_80390764, actor_new, 0x400); //pink_egg_small - spawnableActorList_add(&D_80390788, actor_new, 0x400); //pink_egg_smallest - spawnableActorList_add(&D_80390B68, actor_new, 0); //mudhut_top - spawnableActorList_add(&D_80390C40, actor_new, 0x4000548);//tanktup - spawnableActorList_add(&D_80390C88, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390CC8, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390D08, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&D_80390D48, actor_new, 0x400042c);//tanktup_leg - spawnableActorList_add(&chFrogMinigame, actor_new, 0x81); - spawnableActorList_add(&BGS_D_80390AE0, actor_new, 0x20108a1); //yellow_flibbit - spawnableActorList_add(&D_80390960, actor_new, 0); - spawnableActorList_add(&D_80390A40, actor_new, 0x880); //yumblie - spawnableActorList_add(&D_80390A70, actor_new, 0x9a2); //mr. vile - spawnableActorList_add(&D_80390830, actor_new, 0x888); //tiptup - spawnableActorList_add(&D_80390880, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908A4, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908C8, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_803908EC, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390910, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390934, actor_new, 0x9a8); //tiptup_chiorMember - spawnableActorList_add(&D_80390DA8, actor_new, 0x4000); //leafboat - spawnableActorList_add(&D_80390D70, actor_new, 0x580); //bigAlligator - spawnableActorList_add(&D_80390BD8, actor_new, 8); //green_jiggy_switch - spawnableActorList_add(&D_80390BFC, actor_new, 8); //green_jiggy_switch + spawnableActorList_add(&D_80390804, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3);//croctus + spawnableActorList_add(&D_80390690, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); //flibbit + spawnableActorList_add(&D_803906F8, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_largest + spawnableActorList_add(&D_8039071C, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_large + spawnableActorList_add(&D_80390740, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_medium + spawnableActorList_add(&D_80390764, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_small + spawnableActorList_add(&D_80390788, actor_new, ACTOR_FLAG_UNKNOWN_10); //pink_egg_smallest + spawnableActorList_add(&D_80390B68, actor_new, ACTOR_FLAG_NONE); //mudhut_top + spawnableActorList_add(&D_80390C40, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_3);//tanktup + spawnableActorList_add(&D_80390C88, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390CC8, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390D08, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&D_80390D48, actor_new, ACTOR_FLAG_UNKNOWN_26 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_2);//tanktup_leg + spawnableActorList_add(&chFrogMinigame, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_0); + spawnableActorList_add(&BGS_D_80390AE0, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); //yellow_flibbit + spawnableActorList_add(&D_80390960, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add(&D_80390A40, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7); //yumblie + spawnableActorList_add(&D_80390A70, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_1); //mr. vile + spawnableActorList_add(&D_80390830, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup + spawnableActorList_add(&D_80390880, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908A4, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908C8, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_803908EC, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390910, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390934, actor_new, ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_3 ); //tiptup_chiorMember + spawnableActorList_add(&D_80390DA8, actor_new, ACTOR_FLAG_UNKNOWN_14); //leafboat + spawnableActorList_add(&D_80390D70, actor_new, ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_7); //bigAlligator + spawnableActorList_add(&D_80390BD8, actor_new, ACTOR_FLAG_UNKNOWN_3); //green_jiggy_switch + spawnableActorList_add(&D_80390BFC, actor_new, ACTOR_FLAG_UNKNOWN_3); //green_jiggy_switch } diff --git a/src/BGS/code_9750.c b/src/BGS/code_9750.c index 1917e9b6..5c38e2d3 100644 --- a/src/BGS/code_9750.c +++ b/src/BGS/code_9750.c @@ -62,7 +62,7 @@ void func_8038FB40(ActorMarker *this, s32 arg1){ Actor * thisActor; thisActor = marker_getActor(this); - func_80328A84(thisActor, 2); + subaddie_set_state(thisActor, 2); actor_playAnimationOnce(thisActor); FUNC_8030E624(SFX_A_BANJO_LANDING_05, 0.8f, 32750); } diff --git a/src/CC/code_19B0.c b/src/CC/code_19B0.c index 84a25d52..a23ae3a5 100644 --- a/src/CC/code_19B0.c +++ b/src/CC/code_19B0.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" extern ActorInfo D_80389AA0; extern ActorInfo D_80389AD0; @@ -27,25 +28,25 @@ extern ActorInfo D_80389E8C; /* .code */ void CC_func_80387DA0(void) { - spawnableActorList_add(&D_80389AA0, actor_new, 0X4080); - spawnableActorList_add(&D_80389E44, actor_new, 0X10080); - spawnableActorList_add(&D_80389E68, actor_new, 0X10080); - spawnableActorList_add(&D_80389E8C, actor_new, 0X10080); - spawnableActorList_add(&D_80389AD0, actor_new, 0X80); - spawnableActorList_add(&D_80389B00, actor_new, 0X80); - spawnableActorList_add(&D_80389B24, actor_new, 0X80); - spawnableActorList_add(&D_80389B90, actor_new, 0X80); - spawnableActorList_add(&D_80389BB4, actor_new, 0X80); - spawnableActorList_add(&D_80389C90, actor_new, 0X2488); - spawnableActorList_add(&D_80389CB4, actor_new, 0X2488); - spawnableActorList_add(&D_80389CD8, actor_new, 0X2488); - spawnableActorList_add(&D_80389CFC, actor_new, 0X2488); - spawnableActorList_add(&D_80389D20, actor_new, 0X2488); - spawnableActorList_add(&D_80389D44, actor_new, 0X2488); - spawnableActorList_add(&D_80389D68, actor_new, 0X2488); - spawnableActorList_add(&D_80389D8C, actor_new, 0X2488); - spawnableActorList_add(&D_80389DB0, actor_new, 0X2488); - spawnableActorList_add(&D_80389DD4, actor_new, 0X2488); - spawnableActorList_add(&D_80389DF8, actor_new, 0X2488); - spawnableActorList_add(&D_80389E1C, actor_new, 0X2488); + spawnableActorList_add(&D_80389AA0, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E44, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E68, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389E8C, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); + spawnableActorList_add(&D_80389AD0, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B00, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B24, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389B90, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389BB4, actor_new, ACTOR_FLAG_UNKNOWN_7); + spawnableActorList_add(&D_80389C90, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CB4, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CD8, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389CFC, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D20, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D44, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D68, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389D8C, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DB0, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DD4, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389DF8, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); + spawnableActorList_add(&D_80389E1C, actor_new, ACTOR_FLAG_UNKNOWN_13 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); } diff --git a/src/CCW/code_2B00.c b/src/CCW/code_2B00.c index 2b13ae23..8cf3cf75 100644 --- a/src/CCW/code_2B00.c +++ b/src/CCW/code_2B00.c @@ -70,7 +70,7 @@ void func_80388F50(ActorMarker *marker, ActorMarker *other_marker){ if ((func_8028ECAC() != 1) && !this->unk38_0) { this->unk38_0 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_playAnimationOnce(this); func_8030E6D4(SFX_90_SWITCH_PRESS); } @@ -87,7 +87,7 @@ void func_80388FD4(Actor *this) { if (!this->unk16C_4) { if (fileProgressFlag_get(this->unk10_12 + FILEPROG_8B_CCW_SPRING_OPEN)) { actor_playAnimationOnce(this); - func_80328B8C(this, 4, 0.999f, 1); + subaddie_set_state_with_direction(this, 4, 0.999f, 1); actor_collisionOff(this); } else { marker_setCollisionScripts(this->marker, 0, &func_80388F50, 0); @@ -143,7 +143,7 @@ void func_80389268(Actor *this) { this->unk16C_4 = TRUE; if (fileProgressFlag_get(this->unk10_12 + FILEPROG_8B_CCW_SPRING_OPEN)) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } } @@ -153,14 +153,14 @@ void func_80389268(Actor *this) { if (levelSpecificFlags_get(this->unk10_12 + 7)) { timedFunc_set_1(0.05f, func_803891B0, (s32) this->marker); timedFunc_set_1(4.0f, func_8038921C, (s32) this->marker); - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2: this->position[1] += 60.0f * time_getDelta(); if (this->unk1C[1] <= this->position[1]) { levelSpecificFlags_set(this->unk10_12 + 7, FALSE); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; case 3: diff --git a/src/CCW/code_7BF0.c b/src/CCW/code_7BF0.c index aa24a7f4..7557066e 100644 --- a/src/CCW/code_7BF0.c +++ b/src/CCW/code_7BF0.c @@ -21,12 +21,12 @@ ActorInfo D_8038F908 = { /* .code */ void func_8038DFE0(Actor* actor) { - func_80328B8C(actor, 1, 0.001f, 1); + subaddie_set_state_with_direction(actor, 1, 0.001f, 1); actor->unk38_31 = randi2(0, 0); } void CCW_func_8038E034(Actor* actor) { - func_80328B8C(actor, 2, 0.001f, 1); + subaddie_set_state_with_direction(actor, 2, 0.001f, 1); } void func_8038E060(s32 arg0, ActorMarker *marker){ diff --git a/src/CCW/code_8050.c b/src/CCW/code_8050.c index 0708d6ae..fca59e6a 100644 --- a/src/CCW/code_8050.c +++ b/src/CCW/code_8050.c @@ -82,7 +82,7 @@ void func_8038E4C0(ActorMarker* marker, s32 arg1) { Actor* actor = marker_getActor(marker); ParticleEmitter *pCtrl; - func_80328B8C(actor, 5, 0.0f, 1); + subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); pCtrl = partEmitMgr_newEmitter(1); diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index f2cb5468..0ce6bb61 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -111,7 +111,7 @@ void func_8038A384(Actor *this){ if( jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) ){ - func_80328B8C(this, 2, randf2(0.0f, 0.9f), 1); + subaddie_set_state_with_direction(this, 2, randf2(0.0f, 0.9f), 1); } }//L8038A4E4 @@ -153,7 +153,7 @@ void func_8038A384(Actor *this){ break; } if(levelSpecificFlags_get(D_80391E80[sp3C].unk0)){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); if(sp38 == 0xc19){ func_80311480(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL); } diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index 99fc1ff5..ba2bff24 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -47,14 +47,14 @@ Actor *func_803875E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void func_803876A4(Actor *this){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 32000, this->position, 1250, 2500); } void func_803876F8(Actor *this){ this->marker->propPtr->unk8_3 = FALSE; - func_80328B8C(this, 5, 0.0001f, 1); + subaddie_set_state_with_direction(this, 5, 0.0001f, 1); this->unk48 = 0.0f; func_80343DEC(this); } @@ -76,7 +76,7 @@ void func_803877A8(ActorMarker *caller, enum asset_e text_id, s32 arg2){ jiggySpawn(JIGGY_2A_FP_BOGGY_1, this->velocity); } else if(arg2 == 2){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); actor_loopAnimation(this); actor_collisionOff(this); } @@ -178,7 +178,7 @@ void func_8038794C(Actor *this){ }//L80387CF4 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); actor_loopAnimation(this); } break; diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index 8358b276..9a10460d 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -90,7 +90,7 @@ Actor *func_80388740(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void FP_func_803888E4(Actor *this){ static f32 D_80391D0C[3] = {1842.0f, 658.0f, 5758.0f}; static f32 D_80391D18[3] = {1463.0f, 635.0f, 5193.0f}; - func_80328B8C(this, 0xC, 0.0001f, 1); + subaddie_set_state_with_direction(this, 0xC, 0.0001f, 1); if(!jiggyscore_isSpawned(JIGGY_30_FP_BOGGY_2)){ if(mapSpecificFlags_get(5)){ func_80324DBC(0.1f, 0xc06, 0x2a, D_80391D18, this->marker, func_80388D70, NULL); @@ -115,7 +115,7 @@ void FP_func_803888E4(Actor *this){ void func_80388A50(Actor *this){ ActorLocal_FP_2350 *local = (ActorLocal_FP_2350 *)&this->local; - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); timed_setStaticCameraToNode(0.0f, 4); local->unk18 = 0; } @@ -206,7 +206,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ local->unk4 = partEmitMgr_newEmitter(16); func_80388EE8(local->unk0); func_80388EE8(local->unk4); - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); local->unk14 = (local->unk19 == 2) ? 1.0f : 0.0f; this->marker->unk40_23 = TRUE; break; @@ -217,10 +217,10 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ mapSpecificFlags_set(6, TRUE); break; case 0: - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); break; default: - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); break; } break; @@ -432,7 +432,7 @@ void func_803896FC(Actor *this){ local->unk19 = 1; this->unk38_31 = 2; this->unk4C = 600.0f; - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } else{ local->unk19 = 1; @@ -445,10 +445,10 @@ void func_803896FC(Actor *this){ if(!func_8038A1A0(this->marker)){ switch(this->unk38_31){ case 1://L80389920 - func_80328B8C(this, 9, 0.0001f, 1); + subaddie_set_state_with_direction(this, 9, 0.0001f, 1); break; case 2://L80389938 - func_80328B8C(this, 10, 0.0001f, 1); + subaddie_set_state_with_direction(this, 10, 0.0001f, 1); break; } }//L80389950 @@ -500,9 +500,9 @@ void func_803896FC(Actor *this){ local->unk14 = 0.0f; if( randf() < 0.02 && sp58 < 0.0){ if(randf() < 0.5) - func_80328B8C(this, 5, 0.0001f, 1); + subaddie_set_state_with_direction(this, 5, 0.0001f, 1); else - func_80328B8C(this, 6, 0.0001f, 1); + subaddie_set_state_with_direction(this, 6, 0.0001f, 1); }//L80389C18 func_803893E4(this, sp58, local->unk19); @@ -516,7 +516,7 @@ void func_803896FC(Actor *this){ case 5:// L80389C80 case 6:// L80389C80 if(actor_animationIsAt(this, 0.9999f) || sp58 >= 0.0){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); }//L80389CC8 func_803893E4(this, sp58, local->unk19); @@ -528,7 +528,7 @@ void func_803896FC(Actor *this){ case 7:// L80389D34 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); }//L80389D60 func_803893E4(this, sp58, local->unk19); func_80388F90(this); @@ -556,7 +556,7 @@ void func_803896FC(Actor *this){ func_80388F90(this); } if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } break; @@ -567,7 +567,7 @@ void func_803896FC(Actor *this){ } if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 11, 0.0001f, 1); + subaddie_set_state_with_direction(this, 11, 0.0001f, 1); } break; @@ -629,10 +629,10 @@ void func_8038A0E4(UNK_TYPE(s32) arg0, ActorMarker *marker){ if(actor){ if(actor->state != 7){ - func_80328B8C(actor, 7, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 7, 0.0001f, 1); } else{ - func_80328B8C(actor, 4, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 4, 0.0001f, 1); } }; } @@ -641,7 +641,7 @@ void func_8038A150(UNK_TYPE(s32) arg0, ActorMarker *marker){ Actor *actor = marker_getActor(marker); if(actor && actor->state != 8){ - func_80328B8C(actor, 8, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 8, 0.0001f, 1); }; } diff --git a/src/FP/ch/racesled.c b/src/FP/ch/racesled.c index b9ee0a4d..37a8a31a 100644 --- a/src/FP/ch/racesled.c +++ b/src/FP/ch/racesled.c @@ -31,7 +31,7 @@ Actor *chRaceSled_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void __chRaceSled_setState(Actor *this, s32 next_state){ if(this->state != 1 || next_state != 1){ - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); switch(next_state){ case 1: //L8038697C this->unk10_12 = TRUE; diff --git a/src/FP/ch/scarfsled.c b/src/FP/ch/scarfsled.c index 5eab7eae..5be4d707 100644 --- a/src/FP/ch/scarfsled.c +++ b/src/FP/ch/scarfsled.c @@ -21,7 +21,7 @@ ActorInfo chScarfSled = { /* .code */ void __chScarfSled_setState(Actor *this, s32 next_state){ - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); if(next_state == 2){ mapSpecificFlags_set(0xB, TRUE); diff --git a/src/FP/ch/snowmanbutton.c b/src/FP/ch/snowmanbutton.c index 89d724ff..e862101b 100644 --- a/src/FP/ch/snowmanbutton.c +++ b/src/FP/ch/snowmanbutton.c @@ -50,7 +50,7 @@ void FP_func_80386BEC(Actor *this){ ParticleEmitter *pCtrl = partEmitMgr_newEmitter(12); player_getPosition(plyr_pos); - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_collisionOff(this); func_8025A6EC(COMUSIC_2B_DING_B, 28000); FUNC_8030E624(SFX_90_SWITCH_PRESS, 1.0f, 32000); @@ -93,7 +93,7 @@ void FP_func_80386CF8(Actor *this){ break; case 2: if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 3, 0.99f, 0); + subaddie_set_state_with_direction(this, 3, 0.99f, 0); } break; case 3: diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index 9c72cfac..88639237 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -242,7 +242,7 @@ void func_8038C8F0(ActorMarker *marker){ void func_8038C94C(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); if(!func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ - func_80328A84(this, 6); + subaddie_set_state(this, 6); __spawnQueue_add_1((GenFunction_1)func_8038C8F0, reinterpret_cast(s32, this->marker)); } } @@ -261,7 +261,7 @@ void func_8038C9A0(Actor *this){ this->marker->unk18 = &FP_D_80392018; this->unk38_31 = 0; if(0.0f != other->velocity[0]){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk1C[1] = this->position_y + 50.0f; this->unk1C[2] = this->position_y; } @@ -286,7 +286,7 @@ void func_8038C9A0(Actor *this){ switch(this->state){ case 1:// 8038CB2C if(!func_8038C718(this, 0)){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); func_8038C428(this, D_80392088, randf2(20.0f, 24.0f)); this->unk60 = this->yaw; } @@ -311,7 +311,7 @@ void func_8038C9A0(Actor *this){ if(!func_8038C718(this, 0.0f)){ if(func_8038C844(this->position, D_80392088)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); func_8038C428(this, D_80392094, 0.0f); } else{ @@ -341,7 +341,7 @@ void func_8038C9A0(Actor *this){ else{ func_80311480(0xc25, 0x2b, this->position, this->marker, func_8038C94C, NULL); } - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->pitch -= 3.0f; } break; diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index dc1ed543..810b2b30 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -268,7 +268,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){ func_8024BD08(0); this->unk1C[2] = 428571.0f; func_8025AEA0(0x68, (s32)this->unk1C[2]); - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[0] = 1.0f; }//L8038D6B8 @@ -303,7 +303,7 @@ void func_8038D6C8(Actor *this){ this->unk1C[0] = -1.0f; func_8028F8F8(7, FALSE); if(func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) && gcparade_8031B4F4() == -1){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[0] = 1.0f; } @@ -320,9 +320,9 @@ void func_8038D6C8(Actor *this){ break; if(!(func_8023DB5C() & 1)) - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); else - func_80328B8C(this, 2, 0.999f, 0); + subaddie_set_state_with_direction(this, 2, 0.999f, 0); actor_playAnimationOnce(this); this->velocity[2] = randf2(1.4f, 2.0f); @@ -335,7 +335,7 @@ void func_8038D6C8(Actor *this){ if( ( sp20 == TRUE && actor_animationIsAt(this, 0.999f) ) || ( sp20 == FALSE && actor_animationIsAt(this, 0.001f) ) ){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); break; } @@ -362,7 +362,7 @@ void func_8038D6C8(Actor *this){ timed_exitStaticCamera(0.0f); func_8028F784(0); - func_80328B8C(this, 4, 0.999f, 1); + subaddie_set_state_with_direction(this, 4, 0.999f, 1); actor_playAnimationOnce(this); item_set(ITEM_0_HOURGLASS_TIMER, 80*60 - 1); item_set(ITEM_6_HOURGLASS, TRUE); @@ -381,7 +381,7 @@ void func_8038D6C8(Actor *this){ func_8025AEA0(COMUSIC_68_TWINKLY_MINIGAME, (s32)this->unk1C[2]); if(item_getCount(ITEM_24_TWINKLY_SCORE) == 0){ - func_80328B8C(this, 1, 0.001f, 1); + subaddie_set_state_with_direction(this, 1, 0.001f, 1); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_8038D3D8(); func_80324E38(0.0f, 3); @@ -393,7 +393,7 @@ void func_8038D6C8(Actor *this){ } if(item_empty(ITEM_6_HOURGLASS)){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); this->unk38_31 = 0; item_set(ITEM_6_HOURGLASS, FALSE); diff --git a/src/FP/ch/twinklymuncher.c b/src/FP/ch/twinklymuncher.c index bd3004b7..125852bc 100644 --- a/src/FP/ch/twinklymuncher.c +++ b/src/FP/ch/twinklymuncher.c @@ -35,23 +35,23 @@ Actor *func_8038DD70(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_8038DDC8(Actor *this){ actor_collisionOn(this); - func_80328B8C(this, 2, 0.03f, 1); + subaddie_set_state_with_direction(this, 2, 0.03f, 1); actor_playAnimationOnce(this); } void func_8038DE08(Actor *this){ - func_80328B8C(this, 3, 0.03f, 1); + subaddie_set_state_with_direction(this, 3, 0.03f, 1); actor_loopAnimation(this); } void func_8038DE40(Actor *this){ - func_80328B8C(this, 4, 0.03f, 1); + subaddie_set_state_with_direction(this, 4, 0.03f, 1); actor_playAnimationOnce(this); } void func_8038DE78(Actor *this){ actor_collisionOff(this); - func_80328B8C(this, 5, 0.03f, 1); + subaddie_set_state_with_direction(this, 5, 0.03f, 1); actor_playAnimationOnce(this); } @@ -93,7 +93,7 @@ Actor *func_8038DF34(Actor *this){ void func_8038E040(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); timed_exitStaticCamera(0.5f); - func_80328B8C(this, 7, 0.03f, 1); + subaddie_set_state_with_direction(this, 7, 0.03f, 1); actor_playAnimationOnce(this); } @@ -129,7 +129,7 @@ void func_8038E094(Actor *this){ timed_setStaticCameraToNode(0.5f, 0xd); func_80311480(ASSET_C15_TEXT_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL); this->velocity[0] = 1.0f; - func_80328B8C(this, 6, 0.03f, 1); + subaddie_set_state_with_direction(this, 6, 0.03f, 1); actor_loopAnimation(this); } } @@ -214,7 +214,7 @@ void func_8038E094(Actor *this){ case 5: //L8038E644 this->marker->propPtr->unk8_3 = TRUE; if(actor_animationIsAt(this, 0.97f)){ - func_80328B8C(this, 1, 0.97f, 0); + subaddie_set_state_with_direction(this, 1, 0.97f, 0); actor_playAnimationOnce(this); this->unk60 = 0.0f; } diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 2721abc3..45a5bbb5 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -56,12 +56,12 @@ void func_8038F274(void){ } void func_8038F2B8(Actor *this){ - func_80328B8C(this, 3, 0.02f, 1); + subaddie_set_state_with_direction(this, 3, 0.02f, 1); actor_loopAnimation(this); } void func_8038F2F0(Actor *this){ - func_80328B8C(this, 11, 0.02f, 1); + subaddie_set_state_with_direction(this, 11, 0.02f, 1); actor_loopAnimation(this); func_8038F274(); } @@ -96,14 +96,14 @@ void func_8038F3F4(ActorMarker *marker){ } void func_8038F41C(Actor *this){ - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); actor_loopAnimation(this); } void func_8038F454(Actor *this){ if(!mapSpecificFlags_get(7) && func_8028ECAC() != BSGROUP_A_FLYING && func_80329530(this, 1000) ){ mapSpecificFlags_set(7, TRUE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); actor_loopAnimation(this); timed_setStaticCameraToNode(0.0f, 0x2e); func_80324DBC(0.0f, 0xc1b, 0x2a, this->position, this->marker, func_8038F330, NULL); @@ -115,12 +115,12 @@ void func_8038F454(Actor *this){ } void func_8038F528(Actor *this){ - func_80328B8C(this, 4, 0.02f, 1); + subaddie_set_state_with_direction(this, 4, 0.02f, 1); actor_loopAnimation(this); } void func_8038F560(Actor *this){ - func_80328B8C(this, 7, 0.02f, 1); + subaddie_set_state_with_direction(this, 7, 0.02f, 1); actor_loopAnimation(this); } @@ -149,7 +149,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){ bool FP_func_8038F6C4(Actor *this, f32 arg1[3], f32 arg2){ s32 dTheta; - func_80328C64(this, func_803297C8(this, arg1)); + subaddie_set_ideal_yaw(this, func_803297C8(this, arg1)); func_80328FB0(this, arg2); dTheta = this->yaw - this->yaw_ideal; if(-arg2 <= dTheta && dTheta <= arg2){ @@ -223,7 +223,7 @@ void FP_func_8038F7AC(Actor *this){ } if(func_80329530(this, 1300) && player_getTransformation() == TRANSFORM_4_WALRUS){ - func_80328B8C(this, 8, 0.02f, 1); + subaddie_set_state_with_direction(this, 8, 0.02f, 1); actor_loopAnimation(this); break; } @@ -252,7 +252,7 @@ void FP_func_8038F7AC(Actor *this){ } if(func_8038F5D4(this, local->unk0, 30.0f, 12.0f, 0x3C)){ - func_80328B8C(this, 5, 0.02f, 1); + subaddie_set_state_with_direction(this, 5, 0.02f, 1); actor_playAnimationOnce(this); } break; @@ -260,7 +260,7 @@ void FP_func_8038F7AC(Actor *this){ case 5: //L8038FB50 FP_func_8038F6C4(this, local->unk18, 1.0f); if(0.97 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 6, 0.02f, 1); + subaddie_set_state_with_direction(this, 6, 0.02f, 1); actor_loopAnimation(this); } break; @@ -309,7 +309,7 @@ void FP_func_8038F7AC(Actor *this){ if(mapSpecificFlags_get(8)){ if(FP_func_8038F6C4(this, D_803925AC, 9.0f)){ - func_80328B8C(this, 9, 0.02f, 1); + subaddie_set_state_with_direction(this, 9, 0.02f, 1); actor_playAnimationOnce(this); } break; @@ -331,7 +331,7 @@ void FP_func_8038F7AC(Actor *this){ case 9: //L8038FE14 FP_func_8038F6C4(this, D_803925AC, 9.0f); if(0.97 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 10, 0.02f, 1); + subaddie_set_state_with_direction(this, 10, 0.02f, 1); actor_loopAnimation(this); } break; @@ -342,7 +342,7 @@ void FP_func_8038F7AC(Actor *this){ case 11: //L8038FE84 if(func_8038F5D4(this, local->unk24, 30.0f, 12.0f, 0x3C)){ - func_80328A84(this, 12); + subaddie_set_state(this, 12); } break; diff --git a/src/FP/ch/wozzasjig.c b/src/FP/ch/wozzasjig.c index c08acf54..f246ad17 100644 --- a/src/FP/ch/wozzasjig.c +++ b/src/FP/ch/wozzasjig.c @@ -51,7 +51,7 @@ void func_8038FF54(Actor *this){ other = marker_getActor(this->unk100); if(this->state != 9){ if(other->state == 9){ - func_80328B8C(this, 9, 0.01f, 1); + subaddie_set_state_with_direction(this, 9, 0.01f, 1); actor_playAnimationOnce(this); } else{ diff --git a/src/FP/ch/xmastree.c b/src/FP/ch/xmastree.c index d79a1bc3..c68dd31f 100644 --- a/src/FP/ch/xmastree.c +++ b/src/FP/ch/xmastree.c @@ -47,7 +47,7 @@ void __chXmasTree_80386F3C(void){ } void __chXmasTree_80386F84(Actor * this){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); __chXmasTree_80386EF4(this, 0); } @@ -123,7 +123,7 @@ void chXmasTree_update(Actor *this){ case 2: // L80387294 if(!mapSpecificFlags_get(2)) break; - func_80328A84(this, 3); + subaddie_set_state(this, 3); this->unk60 = 2.0f; func_8025A6EC(COMUSIC_61_XMAS_TREE_LIGHTS_UP, 28000); func_802BAFE4(0x1A); @@ -148,7 +148,7 @@ void chXmasTree_update(Actor *this){ } else{//L803873BC if(func_802BB270()){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); __chXmasTree_80386EF4(this, 1); item_set(ITEM_0_HOURGLASS_TIMER, 3600 - 1); item_set(ITEM_6_HOURGLASS, TRUE); @@ -159,7 +159,7 @@ void chXmasTree_update(Actor *this){ case 4: // L80387400 if(mapSpecificFlags_get(3)){ - func_80328A84(this, 6); + subaddie_set_state(this, 6); __chXmasTree_80386EF4(this, 1); item_set(ITEM_6_HOURGLASS, FALSE); tmp_a0 = this->unk44_31; @@ -172,7 +172,7 @@ void chXmasTree_update(Actor *this){ } else{//L80387470 if(item_empty(ITEM_6_HOURGLASS)){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); mapSpecificFlags_set(2, FALSE); this->unk60 = 0.1f; if(!func_8038BFA0()){ diff --git a/src/FP/ch/xmastreestar.c b/src/FP/ch/xmastreestar.c index 9b86c2e9..082abdde 100644 --- a/src/FP/ch/xmastreestar.c +++ b/src/FP/ch/xmastreestar.c @@ -104,14 +104,14 @@ void func_8038ECD8(Actor *this){ if(!mapSpecificFlags_get(2)) break; if(mapSpecificFlags_get(3)) break; - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->unk38_31 = 0; break; case 2://L8038EF5C if(!local->unk1A) return; if(item_empty(ITEM_6_HOURGLASS)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); } else{ this->marker->collidable = TRUE; @@ -136,7 +136,7 @@ void func_8038ECD8(Actor *this){ }//L8038F090 if(!(this->unk38_31 < 3)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); mapSpecificFlags_set(3, 1); } } diff --git a/src/FP/ch/xmastreeswitch.c b/src/FP/ch/xmastreeswitch.c index b0e44451..f930d674 100644 --- a/src/FP/ch/xmastreeswitch.c +++ b/src/FP/ch/xmastreeswitch.c @@ -28,7 +28,7 @@ Actor *func_8038E720(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_8038E774(Actor *this){ - func_80328B8C(this, 2, 0.05f, 1); + subaddie_set_state_with_direction(this, 2, 0.05f, 1); actor_playAnimationOnce(this); this->marker->collidable = TRUE; this->unk38_31 = 0; @@ -70,7 +70,7 @@ void func_8038E940(Actor *this){ if(jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE) || levelSpecificFlags_get(0x29)){ this->marker->propPtr->unk8_3 = TRUE; this->marker->collidable = FALSE; - func_80328B8C(this, 3, 0.95f, 0); + subaddie_set_state_with_direction(this, 3, 0.95f, 0); return; }//L8038E9B8 @@ -79,7 +79,7 @@ void func_8038E940(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->marker->collidable = FALSE; marker_setCollisionScripts(this->marker, NULL, func_8038E7CC, NULL); - func_80328B8C(this, 1, 0.05f, 1); + subaddie_set_state_with_direction(this, 1, 0.05f, 1); this->unk38_31 = 0; this->unk60 = 0.0f; }//L8038EA3C @@ -98,7 +98,7 @@ void func_8038E940(Actor *this){ if(this->unk38_31 < 3) break; - func_80328B8C(this, 3, 0.05f, 1); + subaddie_set_state_with_direction(this, 3, 0.05f, 1); actor_playAnimationOnce(this); FUNC_8030E624(SFX_416, 0.8f, 32000); this->marker->collidable = FALSE; diff --git a/src/FP/code_19E0.c b/src/FP/code_19E0.c index 979f2b7f..247b7f90 100644 --- a/src/FP/code_19E0.c +++ b/src/FP/code_19E0.c @@ -98,7 +98,7 @@ void func_8038811C(ActorMarker *this_marker, ActorMarker *other_marker){ if(this->state == 2) return; - func_80328B8C(this, 2, 0.0001, 1); + subaddie_set_state_with_direction(this, 2, 0.0001, 1); func_8030E878(SFX_6A_FLAGPOLE_WOBBLE, randf2(0.9f, 1.1f), 32000, this->position, 1000.0f, 2000.0f); } @@ -137,7 +137,7 @@ void func_803881AC(Actor *this){ if(this->state == 2){ if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } } diff --git a/src/FP/code_1FF0.c b/src/FP/code_1FF0.c index fcdeab78..6b54d15a 100644 --- a/src/FP/code_1FF0.c +++ b/src/FP/code_1FF0.c @@ -38,7 +38,7 @@ Actor *func_803883E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_803884F4(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); if(this->state != 2){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); func_8030E878(SFX_6A_FLAGPOLE_WOBBLE, randf2(0.9f, 1.1f), 32000, this->position, 1000.0f, 2000.0f); } } @@ -78,7 +78,7 @@ void func_80388584(Actor *this){ func_8028E668(this->position, 200.0f, -10.0f, 30.0f); if(this->state == 2){ if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } } } diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index 44caf36b..e3859bb5 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -96,7 +96,7 @@ void func_803867F4(void){ void func_80386850(ActorMarker *caller_marker, enum asset_e text_id, s32 arg2){ Actor *caller = marker_getActor(caller_marker); if(text_id == 0xA80){ - func_80328B8C(caller, 2, 0.0f, 1); + subaddie_set_state_with_direction(caller, 2, 0.0f, 1); actor_playAnimationOnce(caller); func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); timedFunc_set_0(1.0f, func_803867F4); @@ -162,7 +162,7 @@ void chAncientOne_update(Actor *this){ } } - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_playAnimationOnce(this); if(this->unkF4_8 < 5){ D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE; @@ -198,7 +198,7 @@ void chAncientOne_update(Actor *this){ break; case 2: //L80386DCC if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.9999f, 1); + subaddie_set_state_with_direction(this, 3, 0.9999f, 1); actor_playAnimationOnce(this); } break; diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 81460532..7e8914d8 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -70,7 +70,7 @@ Actor *func_8038DA18(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void GV_func_8038DB0C(Actor *this){ - func_80328B8C(this, 1, 0.99f, 0); + subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); } @@ -112,7 +112,7 @@ void func_8038DBDC(Actor *this){ this->initialized = TRUE; this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.99f, 0); + subaddie_set_state_with_direction(this, 1, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); D_80391AB8 = 0; func_8038DB4C(0); @@ -120,7 +120,7 @@ void func_8038DBDC(Actor *this){ }//L8038DC90 if(func_8038E178() != (s32)this->unk1C[0] || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ if(15.0f <= this->unk60){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); animctrl_setDuration(this->animctrl, 2.0f); this->unk1C[0] = (f32)func_8038E178(); @@ -135,7 +135,7 @@ void func_8038DBDC(Actor *this){ if(!(func_8038E178() < 5)){ func_8038DB88(this); if(D_80391AB8){ - func_80328B8C(this, 3, 0.99f, 0); + subaddie_set_state_with_direction(this, 3, 0.99f, 0); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); this->unk1C[0] = 0.0f; } @@ -158,7 +158,7 @@ void func_8038DBDC(Actor *this){ break; case 3: //8038DE44 if(!(this->unk38_31 < 0x21)){ - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); animctrl_setDuration(this->animctrl, 3.0f); func_803865F8(); @@ -170,7 +170,7 @@ void func_8038DBDC(Actor *this){ break; case 4: //8038DEBC if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); animctrl_setDuration(this->animctrl, 2.0f); func_8038DB58(0); @@ -191,7 +191,7 @@ void func_8038DBDC(Actor *this){ break; case 5: //8038DFC8 if(func_8038DB64() == 0x127){ - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); animctrl_setDuration(this->animctrl, 1.6f); func_80386608(); diff --git a/src/GV/ch/sarcophagus.c b/src/GV/ch/sarcophagus.c index 82f5a3dd..a96b3c1e 100644 --- a/src/GV/ch/sarcophagus.c +++ b/src/GV/ch/sarcophagus.c @@ -37,7 +37,7 @@ s32 D_80390E88[4] = {0, 0, 0, 0}; void GV_func_803894B0(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); this->unk38_31 = 0; this->initialized = TRUE; } @@ -72,7 +72,7 @@ void chSarcophagus_update(Actor *this){ GV_func_803894B0(this); } if(func_80329530(this, 500) && func_8038957C(this)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); @@ -88,13 +88,13 @@ void chSarcophagus_update(Actor *this){ this->unk38_31 = 1; } if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); } break; case 3: //L80389788 if(!func_80329530(this, 700)){ - func_80328B8C(this, 4, 0.5f, 1); + subaddie_set_state_with_direction(this, 4, 0.5f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); } @@ -110,7 +110,7 @@ void chSarcophagus_update(Actor *this){ } if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); } else if(actor_animationIsAt(this, 0.9f)){ FUNC_8030E8B4(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000, this->position, 1250, 2500); @@ -123,7 +123,7 @@ void chSarcophagus_updateSNS(Actor *this){ if(!this->initialized){ GV_func_803894B0(this); if(fileProgressFlag_get(FILEPROG_A4_GV_SNS_SARCOPHAGUS_OPEN)) - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); this->unk1C[0] = 0.0f; } @@ -132,7 +132,7 @@ void chSarcophagus_updateSNS(Actor *this){ if(this->unk1C[0] != 0.0f){ this->unk1C[0] -= 1.0f; if(this->unk1C[0] == 0.0f){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 0.5f, 32000, this->position, 1250, 2500); FUNC_8030E8B4(SFX_3F6_UNKNOWN, 0.5f, 32000, this->position, 1250, 2500); } @@ -145,7 +145,7 @@ void chSarcophagus_updateSNS(Actor *this){ break; case 5://L803899DC if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 25000); } break; diff --git a/src/GV/ch/toots.c b/src/GV/ch/toots.c index 6804e711..3b0e96e6 100644 --- a/src/GV/ch/toots.c +++ b/src/GV/ch/toots.c @@ -24,17 +24,17 @@ s32 D_80391A34; /* .code */ void GV_func_803863F0(Actor *this){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); D_80391A30 = FALSE; } void GV_func_80386420(Actor *this){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); this->unk38_31 = 0x23; } void func_80386464(Actor *this){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); } void chtoots_update(Actor *this){ diff --git a/src/GV/code_3630.c b/src/GV/code_3630.c index 10cc369f..dd69a89a 100644 --- a/src/GV/code_3630.c +++ b/src/GV/code_3630.c @@ -25,13 +25,13 @@ ActorInfo D_80390ED0 = { MARKER_A9_RUBEE, ACTOR_11B_RUBEE, ASSET_3DD_MODEL_RUBEE void func_80389A20(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); func_8038E18C(); - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } void func_80389A60(Actor *this){ func_80311480(ASSET_A70_TEXT_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); this->unk138_24 = TRUE; - func_80328A84(this, 5); + subaddie_set_state(this, 5); } void func_80389ABC(Actor *this){ @@ -75,7 +75,7 @@ void func_80389B1C(Actor *this){ func_80389ABC(this); } else if(actor_animationIsAt(this, 0.99f)){ - func_80328B38(this, 2, 0.9f); + subaddie_maybe_set_state(this, 2, 0.9f); } if( actor_animationIsAt(this, 0.42f) @@ -96,7 +96,7 @@ void func_80389B1C(Actor *this){ func_80389ABC(this); } else if(actor_animationIsAt(this, 0.99f)){ - func_80328B38(this, 1, 0.4f); + subaddie_maybe_set_state(this, 1, 0.4f); } break; case 3: //L80389E14 @@ -106,12 +106,12 @@ void func_80389B1C(Actor *this){ } if( actor_animationIsAt(this, 0.99f)){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; case 4: //L80389E64 if(!func_8038E178()) - func_80328A84(this, 2); + subaddie_set_state(this, 2); break; }//L80389E80 } diff --git a/src/GV/code_3D90.c b/src/GV/code_3D90.c index d4b191f3..a77a2e4b 100644 --- a/src/GV/code_3D90.c +++ b/src/GV/code_3D90.c @@ -88,7 +88,7 @@ void func_8038A31C(Actor *this){ this->unk1C[0] = 1.0; this->alpha_124_19 = 0xff; if(this->unk54 != 0.0f){ - func_80328B8C(this, 2, 0.02f, 1); + subaddie_set_state_with_direction(this, 2, 0.02f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); } break; @@ -96,7 +96,7 @@ void func_8038A31C(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->unk1C[0] = 1.0; if(45.0f <= this->velocity[0]){ - func_80328B8C(this, 3, 0.02f, 1); + subaddie_set_state_with_direction(this, 3, 0.02f, 1); this->velocity[0] = 0.0f; } else{ @@ -115,7 +115,7 @@ void func_8038A31C(Actor *this){ this->unk1C[0] = 0.0; this->alpha_124_19 = 0; if(this->unk54 == 0.0f){ - func_80328B8C(this, 4, 0.02f, 1); + subaddie_set_state_with_direction(this, 4, 0.02f, 1); } break; @@ -123,7 +123,7 @@ void func_8038A31C(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; this->unk1C[0] = 1.0; if(45.0f <= this->velocity[0]){ - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); this->velocity[0] = 0.0f; } diff --git a/src/GV/code_4740.c b/src/GV/code_4740.c index 8628b582..6f90f7b1 100644 --- a/src/GV/code_4740.c +++ b/src/GV/code_4740.c @@ -104,7 +104,7 @@ void func_8038ADFC(f32 pos[3], s32 cnt){ void func_8038AF10(Actor *this){ animctrl_setSmoothTransition(this->animctrl, TRUE); - func_80328B8C(this, 3, 0.00001f, 1); + subaddie_set_state_with_direction(this, 3, 0.00001f, 1); actor_loopAnimation(this); this->unk28 = 16.0f; this->unk1C[0] = 1.0f; @@ -124,7 +124,7 @@ void func_8038AFF4(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); func_8032B4DC(this, other_marker, 0xC); actor_collisionOff(this); - func_80328B8C(this, ASSET_9_ANIM_BSDIE, 0.00001f, 1); + subaddie_set_state_with_direction(this, ASSET_9_ANIM_BSDIE, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 0.0f; func_8030E878(SFX_D7_GRABBA_DEATH, 1.0f, 32000, this->position, 2250.0f, 4500.0f); @@ -189,7 +189,7 @@ void func_8038B124(Actor *this){ && func_803292E0(this) ){ animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 2, 0.00001f, 1); + subaddie_set_state_with_direction(this, 2, 0.00001f, 1); actor_playAnimationOnce(this); this->yaw = (f32)func_80329784(this); this->unk28 = 0.0f; @@ -221,12 +221,12 @@ void func_8038B124(Actor *this){ case 3: //L8038B494 func_8030E2C4(this->unk44_31); if(func_80329530(this, 175)){ - func_80328B8C(this, 4, 0.00001f, 1); + subaddie_set_state_with_direction(this, 4, 0.00001f, 1); actor_loopAnimation(this); this->unk1C[0] = 1.0f; } else if(!func_80329530(this, 1100) || !func_8038AF78(this, 8.0f, 16.0f)){ - func_80328B8C(this, 8, 0.00001f, 1); + subaddie_set_state_with_direction(this, 8, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 1.0f; func_802BB3DC(0, 6.0f, 0.92f); @@ -249,7 +249,7 @@ void func_8038B124(Actor *this){ this->yaw_ideal = func_80329784(this); func_80328FB0(this, 8.0f); if(this->unk38_31 >= 20){ - func_80328B8C(this, 5, 0.00001f, 1); + subaddie_set_state_with_direction(this, 5, 0.00001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; this->unk1C[0] = 1.0f; @@ -269,7 +269,7 @@ void func_8038B124(Actor *this){ func_8030E878(SFX_3_DULL_CANNON_SHOT, 1.0f, 32000, this->position, 2250.0f, 4500.0f); }//L8038B734 if(0.98 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 6, 0.99f, 0); + subaddie_set_state_with_direction(this, 6, 0.99f, 0); actor_playAnimationOnce(this); this->unk60 = 0.0f; this->unk1C[0] = 1.0f; @@ -278,7 +278,7 @@ void func_8038B124(Actor *this){ case 6: //L8038B78C if(75.0f <= this->unk60){ - func_80328B8C(this, 7, 0.00001f, 1); + subaddie_set_state_with_direction(this, 7, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 1.0f; } @@ -295,14 +295,14 @@ void func_8038B124(Actor *this){ case 8: //L8038B820 if(0.98 < animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 1, 0.00001f, 1); + subaddie_set_state_with_direction(this, 1, 0.00001f, 1); this->unk1C[0] = 0.0f; this->unk1C[1] = 2.0f; } break; case 9: //L8038B870 - func_80328A84(this, 0xA); + subaddie_set_state(this, 0xA); func_8038ACEC(this->position, 2); func_8034A174(this->marker->unk44, 5, GV_D_80391A70); func_8038ACEC(GV_D_80391A70, 2); diff --git a/src/GV/code_5570.c b/src/GV/code_5570.c index 16634b8f..2aecc5d6 100644 --- a/src/GV/code_5570.c +++ b/src/GV/code_5570.c @@ -47,7 +47,7 @@ extern s32 D_80391A80; /* .code */ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); actor_loopAnimation(this); func_802BAFE4(0x13); FUNC_8030E624(SFX_8D_BOGGY_OHWW, 0.9f, 32000); @@ -56,7 +56,7 @@ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ } void func_8038BA08(Actor *this){ - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_loopAnimation(this); this->unk100 = NULL; D_80391A80 = 3; @@ -182,7 +182,7 @@ void GV_func_8038BEA0(Actor *this){ this->unk100 = func_8032B16C(JIGGY_3E_GV_GRABBA); local->unk0 = this->unk100 != NULL ? this->unk100->unk5C : NULL; } - func_80328B8C(this, this->state, 0.01f, 1); + subaddie_set_state_with_direction(this, this->state, 0.01f, 1); this->unk58_0 = FALSE; this->marker->propPtr->unk8_3 = FALSE; }//L8038BFF4 @@ -195,7 +195,7 @@ void GV_func_8038BEA0(Actor *this){ this->unk58_0 = FALSE; this->marker->propPtr->unk8_3 = FALSE; if(func_8038BB24(this)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; D_80391A80 = this->state; @@ -208,7 +208,7 @@ void GV_func_8038BEA0(Actor *this){ case 2: //L8038C108 if(actor_animationIsAt(this, 0.69f)){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); D_80391A80 = this->state; if(this->unk100){ @@ -230,7 +230,7 @@ void GV_func_8038BEA0(Actor *this){ func_8038BA08(this); } else if(this->unk38_31 >= 0xC){ - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_playAnimationOnce(this); D_80391A80 = this->state; func_802BB3DC(0, 12.0f, 0.92f); @@ -257,7 +257,7 @@ void GV_func_8038BEA0(Actor *this){ func_8038BA08(this); } else if(actor_animationIsAt(this, 0.89f)){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); D_80391A80 = this->state; } diff --git a/src/GV/code_61E0.c b/src/GV/code_61E0.c index 491905d0..09a409b0 100644 --- a/src/GV/code_61E0.c +++ b/src/GV/code_61E0.c @@ -49,13 +49,13 @@ void GV_func_8038C658(Actor *this){ if(!this->unk16C_4 && this->initialized){ this->unk16C_4 = TRUE; - func_80328B8C(this, this->state, 0.01f, 1); + subaddie_set_state_with_direction(this, this->state, 0.01f, 1); } sp24 = GV_func_8038C5BC(); if(GV_D_80391A90) marker_despawn(this->marker); if(this->state != sp24) - func_80328A84(this, sp24); + subaddie_set_state(this, sp24); } void func_8038C748(void){ diff --git a/src/GV/code_7060.c b/src/GV/code_7060.c index 43643980..61f7bd63 100644 --- a/src/GV/code_7060.c +++ b/src/GV/code_7060.c @@ -23,7 +23,7 @@ ActorInfo D_803912B8 = { MARKER_F9_JINXY, ACTOR_1F7_JINXY, ASSET_422_MODEL_JINXY /* .code */ void func_8038D450(ActorMarker *this_marker){ Actor *this = marker_getActor(this_marker); - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); } void func_8038D47C(Actor *this){ @@ -83,13 +83,13 @@ void func_8038D47C(Actor *this){ case 1: //L8038D6C0 if(!mapSpecificFlags_get(0xE) && mapSpecificFlags_get(0) + mapSpecificFlags_get(1) == 1){ mapSpecificFlags_set(0xE, TRUE); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->unk38_31 = 1; } else if(!mapSpecificFlags_get(0xF) && mapSpecificFlags_get(0) + mapSpecificFlags_get(1) == 2){ mapSpecificFlags_set(0xF, TRUE); func_8028F918(2); - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); func_802BAFE4(0); } break; @@ -104,7 +104,7 @@ void func_8038D47C(Actor *this){ if(--this->unk38_31 == 0){ func_80311480(ASSET_A7C_TEXT_JINXY_ONE_EGG, 4, NULL, NULL, NULL, NULL); mapSpecificFlags_set(0x14, TRUE); - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } } break; @@ -126,7 +126,7 @@ void func_8038D47C(Actor *this){ } } if(actor_animationIsAt(this, 0.99f)){ - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } break; case 4: //L8038D910 diff --git a/src/GV/code_7DB0.c b/src/GV/code_7DB0.c index a9af74ef..44ae1c6e 100644 --- a/src/GV/code_7DB0.c +++ b/src/GV/code_7DB0.c @@ -34,7 +34,7 @@ void func_8038E1A8(Actor *this){ if(sp24){ sp24->velocity_y = 1.0f; } - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); } else{ if(actor_animationIsAt(this, 0.2f)) @@ -57,7 +57,7 @@ void func_8038E2FC(ActorMarker *this_marker){ Actor *this = marker_getActor(this_marker); Actor *other = func_8032A7AC(this); if(other){ - func_80328B8C(this, 2, 0.02f, 1); + subaddie_set_state_with_direction(this, 2, 0.02f, 1); } } diff --git a/src/GV/code_7FF0.c b/src/GV/code_7FF0.c index 99d410e0..66ff3221 100644 --- a/src/GV/code_7FF0.c +++ b/src/GV/code_7FF0.c @@ -229,7 +229,7 @@ void func_8038E648(Actor *this){ this->pitch = 0.0f; if(mapSpecificFlags_get(5)){ func_802BAFE4(2); - func_80328A84(this, 6); + subaddie_set_state(this, 6); this->unk38_31 = 600; func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); func_802D68F0(25); @@ -240,7 +240,7 @@ void func_8038E648(Actor *this){ case 6: //L8038E700 this->pitch += (this->pitch < 1.0) ? 0.017 : 1.09; if(90.0f <= this->pitch){ - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->pitch = 90.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(0); @@ -250,7 +250,7 @@ void func_8038E648(Actor *this){ case 7: //L8038E78C this->unk38_31 -= time_getDelta(); if(this->unk38_31 == 0){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); } break; @@ -258,7 +258,7 @@ void func_8038E648(Actor *this){ case 8: //L8038E894 this->pitch -= 1.5; if(this->pitch <= 0.0f){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->pitch = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(5, FALSE); @@ -295,7 +295,7 @@ void func_8038E97C(Actor *this){ this->position_z += 117.0; this->position_y += 130.0; this->unk38_31 = 30; - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(1, 0x6A, 0x7ff8, 0.3f); } }//L8038EA6C @@ -313,7 +313,7 @@ void func_8038E97C(Actor *this){ this->position_y = tmp_f0 - (f32)130.0/30.0f; this->unk38_31 -= 1; if(this->unk38_31 == 0){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); func_80244C78(1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); } @@ -329,7 +329,7 @@ void chKazooieDoor_update(Actor *this){ if(mapSpecificFlags_get(6)){ func_8025A6EC(COMUSIC_2B_DING_B, -1); func_802BAFE4(3); - func_80328A84(this, 6); + subaddie_set_state(this, 6); func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); this->unk1C[1] = this->position_y + 210.0f; this->unk1C[0] = this->position_y; @@ -340,7 +340,7 @@ void chKazooieDoor_update(Actor *this){ this->position_y += 1.8; this->position_z -= 1.3319999999999999; if(this->unk1C[1] <= this->position_y){ - func_80328A84(this, 7); + subaddie_set_state(this, 7); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(1); this->unk38_31 = 450; @@ -350,7 +350,7 @@ void chKazooieDoor_update(Actor *this){ case 7: //L8038EC70 this->unk38_31--; if(this->unk38_31 == 0){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); } break; @@ -360,7 +360,7 @@ void chKazooieDoor_update(Actor *this){ this->position_z += 1.3319999999999999; if(this->position_y <= this->unk1C[0]){ this->position_y = this->unk1C[0]; - func_80328A84(this, 1); + subaddie_set_state(this, 1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); func_80244C78(1); mapSpecificFlags_set(6, FALSE); diff --git a/src/MM/ch/chimpystump.c b/src/MM/ch/chimpystump.c index 47ea0ffb..201d4846 100644 --- a/src/MM/ch/chimpystump.c +++ b/src/MM/ch/chimpystump.c @@ -44,7 +44,7 @@ void chchimpystump_update(Actor *this){ { case 1: if(mapSpecificFlags_get(0)) - func_80328A84(this, 2); + subaddie_set_state(this, 2); _chchimpystump_80386CA0(this); break; @@ -53,7 +53,7 @@ void chchimpystump_update(Actor *this){ this->position_y += 2.5; if(this->unk28 <= this->position_y){ this->position_y = this->unk28; - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_802BB41C(1); func_80244C78(0); } diff --git a/src/MM/ch/conga.c b/src/MM/ch/conga.c index 7f62feeb..edc783c3 100644 --- a/src/MM/ch/conga.c +++ b/src/MM/ch/conga.c @@ -17,7 +17,7 @@ void func_80328FB0(Actor *, f32); -void func_80328B8C(Actor*, s32, f32, s32); +void subaddie_set_state_with_direction(Actor*, s32, f32, s32); void func_802C8F70(f32); void timed_exitStaticCamera(f32); Actor *func_8032811C(s32 actor_id, s32 position[3], s32 yaw); @@ -78,7 +78,7 @@ int func_80386ED0(Actor * this){ } void func_80386FB0(Actor *this){ - func_80328C64(this, func_80329784(this)); + subaddie_set_ideal_yaw(this, func_80329784(this)); func_80328FB0(this, 3.0f); } @@ -92,7 +92,7 @@ void func_80386FE8(void){ } void func_8038708C(Actor *this, s32 anim_id){ - func_80328B8C(this, anim_id, 0.0f, 1); + subaddie_set_state_with_direction(this, anim_id, 0.0f, 1); func_8030E58C(SFX_24_KONGA_NOISE_3, randf2(0.9f, 1.1f)); } @@ -128,7 +128,7 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ if( actorPtr->unk38_31 == 3 && !jiggyscore_isCollected(JIGGY_A_MM_CONGA) ){ - func_80328B8C(actorPtr, 8, 0 ,1); + subaddie_set_state_with_direction(actorPtr, 8, 0 ,1); timed_setStaticCameraToNode(0.0f, 0x10); func_80324E38(0.0f, 3); FUNC_8030E624(SFX_84_GOBI_CRYING, 0.8f, 32750); @@ -238,7 +238,7 @@ void func_803876D0(Actor *this){ ){ if(this->state > 3 && this->state < 8){ actor_loopAnimation(this); - func_80328B8C(this, 1, 0.76f, 1); + subaddie_set_state_with_direction(this, 1, 0.76f, 1); } return; } @@ -269,7 +269,7 @@ void func_803876D0(Actor *this){ }; }//L80387A18 if(actor_animationIsAt(this, 0.66f)){ - func_80328BD4(this, 6, 0, 1, 0.38f); + subaddie_maybe_set_state_position_direction(this, 6, 0, 1, 0.38f); } if( sp3C && func_8028ECAC() != 1 @@ -278,14 +278,14 @@ void func_803876D0(Actor *this){ && !func_8032A9E4(((ActorLocal_Conga *)&this->local)->unk10, ((ActorLocal_Conga *)&this->local)->unk18, ((ActorLocal_Conga *)&this->local)->unk1C) && !func_803872EC() ){ - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); }//L80387AC0 if( func_8028ECAC() != 1 && func_80386ED0(this) && this->unk38_31 != 0 && !func_803872EC() ){ - func_80328B8C(this, 7, 0.0f, 1); + subaddie_set_state_with_direction(this, 7, 0.0f, 1); } break; @@ -296,12 +296,12 @@ void func_803876D0(Actor *this){ if( animctrl_isPlayedForwards(this->animctrl) == TRUE && actor_animationIsAt(this, 0.0f) ){ - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); } else if( !animctrl_isPlayedForwards(this->animctrl) && actor_animationIsAt(this, 0.001f) ){ - func_80328B8C(this, 1, 0.76f, 1); + subaddie_set_state_with_direction(this, 1, 0.76f, 1); } break; @@ -310,7 +310,7 @@ void func_803876D0(Actor *this){ actor_loopAnimation(this); func_80386FE8(); if( actor_animationIsAt(this, 0.99f)){ - func_80328BD4(this, 6, 0.999f, 0, sp3C ? 1.0 : 0.4); + subaddie_maybe_set_state_position_direction(this, 6, 0.999f, 0, sp3C ? 1.0 : 0.4); }//L80387C30 if( actor_animationIsAt(this, 0.9f) || actor_animationIsAt(this, 0.4f) @@ -330,21 +330,21 @@ void func_803876D0(Actor *this){ || !timedFuncQueue_is_empty() || func_803872EC() ){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; case 2: //L80387D0C actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; case 8: //L80387D4C actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); func_80311480(ASSET_B38_TEXT_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); } break; @@ -352,7 +352,7 @@ void func_803876D0(Actor *this){ case 3: //L80387DB8 actor_loopAnimation(this); if(jiggyscore_isCollected(JIGGY_A_MM_CONGA)){ - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } break; @@ -360,7 +360,7 @@ void func_803876D0(Actor *this){ if(this->unk10_12 == 0){ if(actor_animationIsAt(this, 0.97f)){ ((ActorLocal_Conga *)&this->local)->unkC = 1; - func_80328B8C(this, 6, 0.0f, 1); + subaddie_set_state_with_direction(this, 6, 0.0f, 1); } } break; diff --git a/src/MM/ch/grublin.c b/src/MM/ch/grublin.c index 724119c9..21e74875 100644 --- a/src/MM/ch/grublin.c +++ b/src/MM/ch/grublin.c @@ -21,7 +21,7 @@ typedef struct chgrublin_s{ void (*unk34)(ActorMarker *, s32); }ActorLocal_Grublin; -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void func_80388A80(Actor *); @@ -51,7 +51,7 @@ void func_803889A0(ActorMarker *this, s32 arg1){ Actor *actorPtr; actorPtr = marker_getActor(this); - func_80328B8C(actorPtr, 5, 0.0f, 1); + subaddie_set_state_with_direction(actorPtr, 5, 0.0f, 1); actor_playAnimationOnce(actorPtr); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actorPtr->position, 1250, 2500); diff --git a/src/MM/ch/hut.c b/src/MM/ch/hut.c index dfa36681..82919a05 100644 --- a/src/MM/ch/hut.c +++ b/src/MM/ch/hut.c @@ -82,7 +82,7 @@ void chhut_update(Actor *this){ sp3C[2] = this->position_z; sp3C[1] += 125.0; func_8030E484(SFX_5B_HEAVY_STUFF_FALLING); - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_playAnimationOnce(this); __spawnQueue_add_1((GenFunction_1)func_803869EC, (s32)this->marker); func_802C8F70(this->yaw); @@ -98,7 +98,7 @@ void chhut_update(Actor *this){ case 1: //L80386C2C if(animctrl_getAnimTimer(this->animctrl) > 0.99){ animctrl_setTransitionDuration(this->animctrl, 0.0f); - func_80328A84(this, 2); + subaddie_set_state(this, 2); this->position_y -= 160.0f; } break; diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index 65d92f67..23db90e1 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -4,7 +4,7 @@ void func_8028E668(f32 *, f32, f32, f32); int actor_animationIsAt(Actor *, f32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void timed_exitStaticCamera(f32); void func_80324E38(f32,s32); void timed_setStaticCameraToNode(f32, s32); @@ -70,7 +70,7 @@ void __chLMonkey_spawnJiggy(s32 x, s32 y, s32 z){ void __chLMonkey_complete(ActorMarker *marker, enum asset_e arg1, s32 arg2){ Actor * actor = marker_getActor(marker); mapSpecificFlags_set(4,1); - func_80328A84(actor, 3); + subaddie_set_state(actor, 3); timed_setStaticCameraToNode(2.3f, 0x12); timedFunc_set_3(2.9f,__chLMonkey_spawnJiggy, actor->position_x, actor->position_y + 150.0f, actor->position_z); timed_exitStaticCamera(4.3f); @@ -90,7 +90,7 @@ void chLMonkey_update(Actor *this){ switch(this->state){ case 1://L80388690 if(mapSpecificFlags_get(2)){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); if(!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)){ func_80311480(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chLMonkey_complete, NULL); }else{//L803886E8 @@ -107,14 +107,14 @@ void chLMonkey_update(Actor *this){ this->unk138_24 = 1; }//L80388774 actor_loopAnimation(this); - func_80328BD4(this, 2, 0.0f, -1, 0.02f); + subaddie_maybe_set_state_position_direction(this, 2, 0.0f, -1, 0.02f); } break; case 2: //L803887A4 func_80388300(&this); actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this,1,0.0f,-1); + subaddie_set_state_with_direction(this,1,0.0f,-1); } break; case 4: //L803887E4 diff --git a/src/MM/code_24C0.c b/src/MM/code_24C0.c index 4b915ed3..c50426a7 100644 --- a/src/MM/code_24C0.c +++ b/src/MM/code_24C0.c @@ -2,6 +2,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" @@ -16,13 +17,13 @@ extern ActorInfo chorangepadInfo; extern ActorInfo chlmonkeyInfo; void MM_func_803888B0(void){ - spawnableActorList_add( &chhutInfo, actor_new, 0X400); - spawnableActorList_add( &chchimpystump, actor_new, 0x0); - spawnableActorList_add( &chgrublinInfo, actor_new, 0X2000121); - spawnableActorList_add( &chcongaInfo, actor_new, 0X2000160); - spawnableActorList_add( &chorangeInfo, actor_new, 0x0); - spawnableActorList_add( &chjujuhitboxInfo, actor_new, 0x0); - spawnableActorList_add( &chjujuInfo, actor_new, 0X4004); - spawnableActorList_add( &chorangepadInfo, actor_new, 0X40); - spawnableActorList_add( &chlmonkeyInfo, actor_new, 0X100); + spawnableActorList_add( &chhutInfo, actor_new, ACTOR_FLAG_UNKNOWN_10); + spawnableActorList_add( &chchimpystump, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chgrublinInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_0); + spawnableActorList_add( &chcongaInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_5); + spawnableActorList_add( &chorangeInfo, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chjujuhitboxInfo, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add( &chjujuInfo, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_2); + spawnableActorList_add( &chorangepadInfo, actor_new, ACTOR_FLAG_UNKNOWN_6); + spawnableActorList_add( &chlmonkeyInfo, actor_new, ACTOR_FLAG_UNKNOWN_8); } diff --git a/src/MMM/ch/loggo.c b/src/MMM/ch/loggo.c index 41e14839..3cc7b77e 100644 --- a/src/MMM/ch/loggo.c +++ b/src/MMM/ch/loggo.c @@ -24,7 +24,7 @@ ActorInfo chLoggo = { void __chLoggo_flush(ActorMarker* marker) { Actor* sp1C = marker_getActor(marker); func_8028F918(2); - func_80328B8C(sp1C, 2, 0.01, 1); + subaddie_set_state_with_direction(sp1C, 2, 0.01, 1); actor_playAnimationOnce(sp1C); sp1C->unk60 = 3.2f; } @@ -67,7 +67,7 @@ void chLoggo_update(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; actor_collisionOn(this); marker_setCollisionScripts(this->marker, __chLoggo_collide, NULL, NULL); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); this->unk60 = 0.0f; if(!fileProgressFlag_get(FILEPROG_8A_EXITED_LOGGO) && levelSpecificFlags_get(0x33)){ diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index 7bdc6491..6592f514 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -191,7 +191,7 @@ f32 MMM_func_80388430(Actor *this, s32 arg1, s32 arg2, f32 arg3) { this->unk1C[1] = 11.0f; break; case 3: - func_80328A84(this, 5); + subaddie_set_state(this, 5); break; } func_8030E878(SFX_82_METAL_BREAK, randf2(0.93f, 1.07f), 0x7FF8, this->position, 100.0f, 900.0f); @@ -290,7 +290,7 @@ void func_80388BDC(Actor *this) { if (!this->unk16C_4) { if (this->yaw != 0.0f) { this->unk60 = 0.5f; - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->unk38_31 = 1; this->yaw = 270.0f; } else { @@ -305,7 +305,7 @@ void func_80388BDC(Actor *this) { this->yaw = 0.0f; if(mapSpecificFlags_get(0)) { func_802BAFE4(0x21); - func_80328A84(this, 6); + subaddie_set_state(this, 6); func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); mapSpecificFlags_set(2, 0); func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1); @@ -316,7 +316,7 @@ void func_80388BDC(Actor *this) { case 6: func_80388B2C(this, - (((this->yaw == 0.0f) || (359.0 < this->yaw)) ? 0.023 : 1.09)); if ((this->yaw <= 270.0f) && (this->yaw > 260.0f)) { - func_80328A84(this, 7U); + subaddie_set_state(this, 7U); this->yaw = 270.0f; func_8030E540(0x7F); func_80244C78(0); @@ -339,14 +339,14 @@ void func_80388BDC(Actor *this) { } else { func_802BAFE4(0x23); } - func_80328A84(this, 8); + subaddie_set_state(this, 8); func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); } break; case 8: func_80388B2C(this, 1.3f); if ((this->yaw >= 0.0f) && (this->yaw < 10.0f)) { - func_80328A84(this, 1U); + subaddie_set_state(this, 1U); this->yaw = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(0, 0); diff --git a/src/MMM/code_2F60.c b/src/MMM/code_2F60.c index ef12dfd3..0c4abb65 100644 --- a/src/MMM/code_2F60.c +++ b/src/MMM/code_2F60.c @@ -75,7 +75,7 @@ void func_803893A4(Actor *this){ break; case 2: if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 1, 0.001f, 0); + subaddie_set_state_with_direction(this, 1, 0.001f, 0); actor_playAnimationOnce(this); this->unk38_31 = 2; } @@ -86,7 +86,7 @@ void func_803893A4(Actor *this){ void func_80389484(ActorMarker * marker, f32 anim_duration){ Actor *this = marker_getActor(marker); - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); actor_playAnimationOnce(this); animctrl_setDuration(this->animctrl, anim_duration); this->unk38_31 = 1; diff --git a/src/MMM/code_DC0.c b/src/MMM/code_DC0.c index 988d2e75..8879059b 100644 --- a/src/MMM/code_DC0.c +++ b/src/MMM/code_DC0.c @@ -74,7 +74,7 @@ bool MMM_func_80387340(ActorMarker *marker){ if(actor->state == 2) return FALSE; - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE); sp1C = func_803871B0(); if(sp1C != 0){ diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index d90a23ec..98c7341b 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -98,7 +98,7 @@ void chAttackTutorial_setState(Actor * this, s32 arg1){ } break; }//L803874A8 - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } int func_803874C4(void){ diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index 4a895e08..168f655d 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -8,7 +8,7 @@ f32 func_80309724(f32*); void func_802C4218(s32, f32, f32, f32); void func_803252D0(f32, s32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); //typedefs typedef struct ch_vegatable{ @@ -208,7 +208,7 @@ void func_80387C28(Actor * this){ func_803252D0(1.5f, 7); actor_collisionOff(this); if(local->unkC != 3){ - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } else{ @@ -337,7 +337,7 @@ void func_80388080(Actor *this){ this->unk1C_y += (local->unkC == 3)? 270.0 : 85.0; } //L80388384 - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; case 4: //L8038839C @@ -352,7 +352,7 @@ void func_80388080(Actor *this){ func_80387F00(this); actor_collisionOn(this); - func_80328A84(this, 2); + subaddie_set_state(this, 2); }//L80388494 if(!this->unk138_23){ diff --git a/src/SM/code_2990.c b/src/SM/code_2990.c index d6c19034..065d38ac 100644 --- a/src/SM/code_2990.c +++ b/src/SM/code_2990.c @@ -8,7 +8,7 @@ void func_8028E668(f32*, f32, f32, f32); void func_80328FB0(Actor *, f32); void func_8030DA44(u8); void timed_exitStaticCamera(f32); -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); //static types typedef struct sm_2900_struct{ @@ -126,7 +126,7 @@ void func_80388FA0(Actor *this, s32 arg1){ other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) - func_80328B8C(other, 3, 0.0001f, 1); + subaddie_set_state_with_direction(other, 3, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, 0x3f9); @@ -150,7 +150,7 @@ void func_80388FA0(Actor *this, s32 arg1){ other = subaddie_getLinkedActor(this); myOther = this->unk100; if(myOther && other && myOther->unk14_20 == 0xB8) - func_80328B8C(other, 2, 0.0001f, 1); + subaddie_set_state_with_direction(other, 2, 0.0001f, 1); animctrl_setSmoothTransition(this->animctrl, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); @@ -162,7 +162,7 @@ void func_80388FA0(Actor *this, s32 arg1){ func_8028F94C(2, this->position); break; } - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); } void func_80389214(ActorMarker *marker, enum asset_e text_id, s32 arg2){ diff --git a/src/SM/code_3FC0.c b/src/SM/code_3FC0.c index 46e26ed5..ac0a0659 100644 --- a/src/SM/code_3FC0.c +++ b/src/SM/code_3FC0.c @@ -57,7 +57,7 @@ void func_8038A3B0(Actor *this){ actor_collisionOff(this); if(this->state == 2 && levelSpecificFlags_get(sp24 + 0x35)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_playAnimationOnce(this); } diff --git a/src/SM/code_4070.c b/src/SM/code_4070.c index ba5f06ff..39347c92 100644 --- a/src/SM/code_4070.c +++ b/src/SM/code_4070.c @@ -52,7 +52,7 @@ void func_8038A4DC(Actor *this, s32 arg1){ mapSpecificFlags_set(5, 1); break; }//L8038A5BC - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } void SM_func_8038A5D8(Actor *this){ diff --git a/src/SM/code_5B0.c b/src/SM/code_5B0.c index 10c7194a..13aecdef 100644 --- a/src/SM/code_5B0.c +++ b/src/SM/code_5B0.c @@ -145,7 +145,7 @@ void SM_func_80386EF4(Actor *this) { } else { this->unk100 = NULL; } - func_80328A84(this, 2); + subaddie_set_state(this, 2); } } } diff --git a/src/SM/code_BF0.c b/src/SM/code_BF0.c index 078cb8c7..1e0dd9ab 100644 --- a/src/SM/code_BF0.c +++ b/src/SM/code_BF0.c @@ -25,7 +25,7 @@ void SM_func_80386FE0(Actor *this){ case 1://L80387064 if(this->unk38_31++ == 2){ this->unk10_12 = actorArray_actorCount(ACTOR_16F_QUARRIE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L803870C4 diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index 36271de3..e6cfa225 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -60,7 +60,7 @@ void func_80387520(ActorMarker *caller, enum asset_e text_id, s32 arg1){ local->unk24 = 0; } else{ - func_80328B8C(this, 2, 0, 1); + subaddie_set_state_with_direction(this, 2, 0, 1); } } @@ -77,7 +77,7 @@ void func_803875D4(ActorMarker *marker){ Actor *this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); enum asset_e text_id; - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); this->unk28 = 0.0f; @@ -97,7 +97,7 @@ void func_80387678(Actor *this){ func_8028F918(2); timed_setStaticCameraToNode(0.0f, 4); timedFunc_set_1(1.0f, (GenFunction_1)func_803875D4, (s32)this->marker); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } void func_8038771C(Actor *this){ @@ -140,7 +140,7 @@ void func_803878CC(Actor * this){ if(!this->unk16C_4){ if(this->state == 3){ - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } this->unk16C_4 = TRUE; }//L80387970 @@ -151,7 +151,7 @@ void func_803878CC(Actor * this){ ){ func_80311480(0xa0b, 0xe, this->position, this->marker, func_80387520, NULL); this->unk138_24 = TRUE; - func_80328AC8(this, 3); + subaddie_set_state_forward(this, 3); } if( mapSpecificFlags_get(0) @@ -173,7 +173,7 @@ void func_803878CC(Actor * this){ } func_80387774(&this); - if(func_80328BD4(this, 2, 0.0f, 1, 0.007f)) + if(subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.007f)) break; func_80328FB0(this, 3.0f); @@ -185,7 +185,7 @@ void func_803878CC(Actor * this){ case 2:// 80387B10 func_80387774(&this); if( actor_animationIsAt(this, 0.99f) - && func_80328BD4(this, 1, 0.0f, 1, 0.78f) + && subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.78f) ){ this->unk28 = 4.0f; break; @@ -214,7 +214,7 @@ void func_803878CC(Actor * this){ func_80328FB0(this, 3.0f); local = (ActorLocal_Blubber*)&this->local; if(actor_animationIsAt(this, 0.99f) && !local->unk24){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->unk28 = 8.0f; } } diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index a0d7b507..ab2b743e 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -35,7 +35,7 @@ void __chClam_func_803863F0(enum sfx_e sfx_id, f32 arg1, s32 arg2, f32 position[ } void __chClam_func_80386454(Actor *this){ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); animctrl_setDuration(this->animctrl, randf2(1.9f, 2.1f)); } @@ -286,7 +286,7 @@ void chClam_update(Actor *this){ if(this->position_y <= sp48 + 15.0f && sp48 - 15.0f <= this->position_y){ this->position_y = sp48; this->unk38_31 = sp44; - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); this->velocity_x = 0.0f; animctrl_setDuration(this->animctrl, 0.6f); @@ -298,7 +298,7 @@ void chClam_update(Actor *this){ switch(this->state){ case 1://L80387170 if(__chClam_rotateTowardTarget(this, 140)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); animctrl_setDuration(this->animctrl, 1.0f); __chClam_func_803863F0(SFX_3F2_UNKNOWN, randf2(1.0f, 1.1f), 22000, this->position, 1500.0f, 2000.0f); diff --git a/src/TTC/ch/leaky.c b/src/TTC/ch/leaky.c index e29c461f..e11ff76f 100644 --- a/src/TTC/ch/leaky.c +++ b/src/TTC/ch/leaky.c @@ -83,7 +83,7 @@ void chLeaky_update(Actor *this) { void __chLeaky_startCutscene(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); Struct73s *temp_v0; - func_80328A84(this, 2); + subaddie_set_state(this, 2); temp_v0 = func_8034C5AC(300); if(temp_v0 != NULL){ func_8034E7B8(temp_v0, -600, 4.0f, 2, 10.0f); diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index 86fd9f64..47136a49 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -56,7 +56,7 @@ Actor *func_803894C0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } void TTC_func_80389530(Actor *this){ - func_80328B8C(this, 1, 0.2f, 1); + subaddie_set_state_with_direction(this, 1, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; FUNC_8030E8B4(SFX_6C_LOCKUP_CLOSING, 1.0f, 32000, this->position, 1250, 2500); @@ -65,7 +65,7 @@ void TTC_func_80389530(Actor *this){ void func_8038959C(Actor *this){ func_80389468(); - func_80328B8C(this, 2, 0.2f, 1); + subaddie_set_state_with_direction(this, 2, 0.2f, 1); this->unk38_31 = 1; FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); } @@ -94,7 +94,7 @@ void func_80389600(Actor *this){ case 1: //L803896F0 if(!this->initialized){ this->marker->propPtr->unk8_3 = TRUE; - func_80328B8C(this, 1, 0.2f, 1); + subaddie_set_state_with_direction(this, 1, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; this->initialized = TRUE; @@ -119,7 +119,7 @@ void func_80389600(Actor *this){ } if(actor_animationIsAt(this, 0.5f)){ - func_80328B8C(this, 3, 0.5f, 1); + subaddie_set_state_with_direction(this, 3, 0.5f, 1); } if(0.15 < animctrl_getAnimTimer(this->animctrl)){ this->marker->collidable = TRUE; @@ -135,7 +135,7 @@ void func_80389600(Actor *this){ if(!(local->unk4 < tmp_v1)){ local->unk4 = 0; - func_80328B8C(this, 4, 0.5f, 1); + subaddie_set_state_with_direction(this, 4, 0.5f, 1); } break; diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index f28364c6..23952e43 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -66,7 +66,7 @@ Actor *func_80387EB0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { } void TTC_func_80387F18(Actor *this) { - func_80328AEC(this, 3); + subaddie_set_state_looped(this, 3); this->unk1C[0] = 0.0f; switch((s32)this->unk60){ case 0x78: @@ -94,7 +94,7 @@ void TTC_func_80387FB0(ActorMarker *caller, enum asset_e text_id, s32 arg2){ void TTC_func_80387FF4(Actor *this) { s32 i; - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i ++){ FUNC_8030E8B4(SFX_79_TICKER_DEATH, 0.5f, 17000, this->position, 1500, 3000); @@ -127,7 +127,7 @@ void func_80388178(ActorMarker *this_marker, ActorMarker *other_marker) { func_8032B4DC(this, other_marker, 7); if (this->unk60 == 40.0f) { - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i++){ FUNC_8030E8B4(SFX_78_EAGLECRY, 0.7f, 20000, this->position, 1500, 3000); @@ -220,7 +220,7 @@ void func_80388434(Actor *this){ case 1:// L80388578 if(!this->initialized){ animctrl_setTransitionDuration(this->animctrl, 0.35f); - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); this->unk60 = 120.0f; this->marker->propPtr->unk8_3 = TRUE; marker_setCollisionScripts(this->marker, func_803883C8, func_80388344, func_80388178); @@ -233,7 +233,7 @@ void func_80388434(Actor *this){ && temp_v0 != 1 && temp_v0 != 10 ){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); if(func_80311480(0xa0e, 0xf, this->position, this->marker, TTC_func_80387FB0, NULL)){ this->unk138_24 = TRUE; } @@ -258,7 +258,7 @@ void func_80388434(Actor *this){ case 2:// L8038872C if(!func_8038812C(this)){ - func_80328AEC(this, 1); + subaddie_set_state_looped(this, 1); break; } @@ -284,7 +284,7 @@ void func_80388434(Actor *this){ } if(2.0f <= this->unk1C[0]){ - func_80328AEC(this, 2); + subaddie_set_state_looped(this, 2); this->unk38_31 = 0; break; } @@ -322,7 +322,7 @@ void func_80388434(Actor *this){ } if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 7, 0.01f, 1); + subaddie_set_state_with_direction(this, 7, 0.01f, 1); } break; diff --git a/src/TTC/ch/treasure.c b/src/TTC/ch/treasure.c index 498ff08c..32d87422 100644 --- a/src/TTC/ch/treasure.c +++ b/src/TTC/ch/treasure.c @@ -76,7 +76,7 @@ void chtreasure_update(Actor *this){ this->unk5C = animctrl_getAnimTimer(this->animctrl) *300.0; //radius of 300.0f if(animctrl_isStopped(this->animctrl)){ actor_loopAnimation(this); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->marker->propPtr->unk8_3 = 1; actor_collisionOn(this); func_8030E878(SFX_3F2_UNKNOWN, randf2(1.2f, 1.3f), 20000, this->position, 200.0f, 1500.0f); diff --git a/src/core1/code_1D5D0.c b/src/core1/code_1D5D0.c index 743ed5c1..0335e3e6 100644 --- a/src/core1/code_1D5D0.c +++ b/src/core1/code_1D5D0.c @@ -216,9 +216,8 @@ void sns_write_payload_over_heap(void) sns_generate_payload(snsBasePayloadPtr2); - // memcpy - func_80254630(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); - func_80254630(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy(snsBasePayloadPtr3, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy(snsBasePayloadPtr4, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); for (i = 1; i < 5; i++) { @@ -231,8 +230,7 @@ void sns_write_payload_over_heap(void) val1 -= val1 & 0x1FFF; for (val1 += 0x2C00; val1 < val3; val1 += 0x2000) - // memcpy - func_80254630((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); + wmemcpy((void *)val1, snsBasePayloadPtr2, sizeof(*snsBasePayloadPtr2)); } } } diff --git a/src/core1/code_EAF0.c b/src/core1/code_EAF0.c index c04a2689..b067227b 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/code_EAF0.c @@ -79,10 +79,10 @@ f32 viewport_getYaw(void){ return viewportRotation[1]; } -void func_8024C794(f32 *arg0, f32 *arg1, f32 *arg2){ - *arg0 = viewportRotation[0]; - *arg1 = viewportRotation[1]; - *arg2 = viewportRotation[2]; +void func_8024C794(f32 *pitch, f32 *yaw, f32 *roll){ + *pitch = viewportRotation[0]; + *yaw = viewportRotation[1]; + *roll = viewportRotation[2]; } void func_8024C7B8(Gfx **gfx, Mtx **mtx){ diff --git a/src/core1/memory.c b/src/core1/memory.c index 31ae19cf..e88a24ce 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -141,7 +141,7 @@ void memcpy(void * dst, void *src, int size){ } } -void func_80254630(void * dst, void *src, int size){ +void wmemcpy(void * dst, void *src, int size){ while(size > 0){ *(u32*)dst = *(u32*)src; size -= 4; @@ -150,22 +150,16 @@ void func_80254630(void * dst, void *src, int size){ } } -void func_80254658(u8* arg0, u8* arg1, s32 arg2) { - if(arg0 < arg1){ - if(arg2--){ - do{ - *(arg0++) = *(arg1++); - - }while(arg2--); +void memmove(u8* dst, u8* src, s32 n) { + if(dst < src){ //copy + while(n--){ + *(dst++) = *(src++); } - }else{ - arg0 += arg2 -1; - arg1 += arg2 -1; - if(arg2--){ - do{ - *(arg0--) = *(arg1--); - - }while(arg2--); + }else{ //copy backwards to avoid data lose + dst += n -1; + src += n -1; + while(n--){ + *(dst--) = *(src--); } } } @@ -244,11 +238,11 @@ void func_80254908(void){ } } -u32 _heap_get_occupied_size(void){ +static u32 _heap_get_occupied_size(void){ return heap_occupiedBytes; } -u32 func_8025496C(void){ +u32 heap_get_occupied_size(void){ return _heap_get_occupied_size(); } @@ -356,7 +350,7 @@ void *malloc(s32 size){ animCache_flushStale(); if(!func_80254B84(0)) - func_8028873C(0); + animBinCache_flushStale(0); //nonpersistent anim if(!func_80254B84(0)) func_8032AD7C(2); @@ -377,7 +371,7 @@ void *malloc(s32 size){ func_802F1294(); //particleEmitters if(!func_80254B84(0)) - func_8028873C(1); //AnimationFileCache + animBinCache_flushStale(1); //persistent anim if(v1 = func_80254B84(0)){} else @@ -591,8 +585,8 @@ void *realloc(void *ptr, s32 size){ return ptr; } -u32 func_80255498(void){ - return HEAP_SIZE - func_8025496C(); +u32 heap_get_free_size(void){ + return HEAP_SIZE - heap_get_occupied_size(); } s32 heap_findLargestEmptyBlock(s32 *size_ptr){ diff --git a/src/core2/ba/anim.c b/src/core2/ba/anim.c index cb89b56a..beca5c24 100644 --- a/src/core2/ba/anim.c +++ b/src/core2/ba/anim.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + extern f32 func_802E4B38(void); extern f32 ml_mapRange_f(f32, f32, f32, f32, f32); @@ -53,14 +55,14 @@ void __baanim_update_scaleToHorizontalVelocity(void) { f32 scale; scale = (baAnimScale.scalable_duration != 0) ? baAnimScale.duration_scale : 1.0f; - _get_velocity(velocity); + baphysics_get_velocity(velocity); temp_f12 = ml_mapRange_f(gu_sqrtf(velocity[0]*velocity[0] + velocity[2] * velocity[2]), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min * scale, baAnimScale.duration_max * scale); animctrl_setDuration(playerAnimCtrl, ml_clamp_f(temp_f12, baAnimMinDuration, baAnimMaxDuration)); animctrl_update(playerAnimCtrl); } void __baanim_update_scaleToVerticalVelocity(void) { - animctrl_setDuration(playerAnimCtrl, ml_clamp_f(ml_mapRange_f(mlAbsF(_get_vertVelocity()), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min, baAnimScale.duration_max), baAnimMinDuration, baAnimMaxDuration)); + animctrl_setDuration(playerAnimCtrl, ml_clamp_f(ml_mapRange_f(mlAbsF(baphysics_get_vertical_velocity()), baAnimScale.velocity_min, baAnimScale.velocity_max, baAnimScale.duration_min, baAnimScale.duration_max), baAnimMinDuration, baAnimMaxDuration)); animctrl_update(playerAnimCtrl); } diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index e00a61aa..3e3e42a1 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" #include "prop.h" #include "SnS.h" @@ -105,8 +106,8 @@ void __baMarker_8028B7F4(void){ yaw_setIdeal(func_8029B41C()); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(2); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029151C(0xC); } @@ -686,7 +687,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ case MARKER_6B_GLOOPBUBBLE: //L8028CD20 if(func_8028EE84() == BSWATERGROUP_2_UNDERWATER){ - func_803463D4(ITEM_17_AIR, func_80301DBC(2)); + func_803463D4(ITEM_17_AIR, fxairscore_count_to_time(2)); } break; diff --git a/src/core2/ba/model.c b/src/core2/ba/model.c index f4c49e14..1427f43e 100644 --- a/src/core2/ba/model.c +++ b/src/core2/ba/model.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/model.h" +#include "core2/ba/physics.h" void func_80254008(void); extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); @@ -317,7 +318,7 @@ void baModel_80292284(f32 arg0[3], s32 arg1){ arg0[1] += sp44[1]; arg0[2] += sp44[2]; } - func_802976C0(sp38); + baphysics_get_position_change(sp38); arg0[0] = arg0[0] + sp38[0]; arg0[1] = arg0[1] + sp38[1]; arg0[2] = arg0[2] + sp38[2]; diff --git a/src/core2/ba/physics.c b/src/core2/ba/physics.c new file mode 100644 index 00000000..659be176 --- /dev/null +++ b/src/core2/ba/physics.c @@ -0,0 +1,432 @@ +#include +#include "functions.h" +#include "variables.h" +#include "core2/ba/physics.h" + +#define _SQ3v1(v) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]) + +extern f32 ml_sin_deg(f32); +extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); +extern void func_80256D0C(f32, f32, f32, f32, f32, f32 *, f32 *, f32 *); +extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); +extern f32 climbGetRadius(void); +extern f32 func_8029CED0(void); + +/* .data */ +f32 baphysics_default_gravity = -2700.0f; //defaultGravity +f32 baphysics_default_terminal_velocity = -4000.0f; + +/* .bss */ +s32 baphysics_type; +f32 s_next_position[3]; +f32 s_player_velocity[3]; //velocity? +f32 baphysics_target_velocity[3]; +f32 s_delta_position[3]; +f32 D_8037C4E4; +f32 s_gravity; //gravity +f32 s_terminal_velocity; +f32 baphysics_target_horizontal_velocity; +f32 baphysics_target_yaw; //angle +f32 baphysics_acceleration; +f32 D_8037C4FC; +f32 D_8037C500; + +struct { + u8 state; + //u8 pad1[0x3]; + f32 start_position[3]; + f32 end_position[3]; + f32 duration; + f32 elapsed_time; +} baphysics_goto; + +/* .code */ +void __baphysics_update_normal(void){ + f32 sp84[3]; + f32 sp78[3]; + f32 sp6C[3]; + f32 sp60[3]; + f32 sp54[3]; + f32 sp48[3]; + f32 sp44; + f32 sp40; + + + func_80256D0C(0.0f, baphysics_target_yaw, 0.0f, 0.0f, baphysics_target_horizontal_velocity, &baphysics_target_velocity[0], &baphysics_target_velocity[1], &baphysics_target_velocity[2]); + sp6C[0] = s_player_velocity[0];\ + sp6C[1] = 0.0f;\ + sp6C[2] = s_player_velocity[2]; + // sp6C[1] = s_player_velocity[1]; + + ml_vec3f_copy(sp60, baphysics_target_velocity); + sp60[1] = 0.0f; + if(func_80294548()){ + func_80294480(sp54); + ml_vec3f_normalize_copy(sp48, sp60); + sp44 = ml_dotProduct_vec3f(sp48, sp54); + sp40 = get_slope_timer(); + if(sp44 != 0.0f){ + if(sp44 < 0){ + //sp44 = 0.0f; + if(func_8028B3B4()){ + sp40 = ml_map_f(sp40, 0.0f, 1.0f, sp44*0.5, -1.0f); + } + else{//L80296E3C + sp40 = 0.5*sp44; + }//L80296E54 + ml_vec3f_scale(sp60, 1.0 + sp40); + } + else{//L80296E84 + sp40 = sp44*0.2; + ml_vec3f_scale(sp60, sp40 + 1.0); + } + }//L80296EBC + }//L80296EBC + + ml_vec3f_scale_copy(sp84, sp60, func_8029CED0()); + ml_vec3f_scale_copy(sp78, sp6C, func_8029CED0()); + ml_vec3f_diff(sp84, sp78); + ml_vec3f_scale(sp84, time_getDelta()/0.0333333); + s_player_velocity[0] += sp84[0];\ + s_player_velocity[1] += sp84[1];\ + s_player_velocity[2] += sp84[2]; + + sp6C[0] = s_player_velocity[0]; + sp6C[2] = s_player_velocity[2]; + ml_vec3f_scale_copy(s_delta_position, sp6C, 1.0f); + if(mlAbsF(s_player_velocity[0]) < 0.0001) + s_player_velocity[0] = 0; + + if(mlAbsF(s_player_velocity[2]) < 0.0001) + s_player_velocity[2] = 0; + + //update velocity for gravity + s_player_velocity[1] = s_player_velocity[1] + time_getDelta()*s_gravity ; + if(s_player_velocity[1] < s_terminal_velocity) + s_player_velocity[1] = s_terminal_velocity; + + //update position + s_delta_position[1] = s_delta_position[1] + s_player_velocity[1]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_no_gravity(void){ + f32 sp24[3]; + //update velocity + ml_vec3f_diff_copy(sp24, baphysics_target_velocity, s_player_velocity); + ml_vec3f_scale(sp24, time_getDelta()*baphysics_acceleration); + if(_SQ3v1(sp24) < 0.02){ + ml_vec3f_copy(s_player_velocity, baphysics_target_velocity); + } + else{ + s_player_velocity[0] += sp24[0];\ + s_player_velocity[1] += sp24[1];\ + s_player_velocity[2] += sp24[2]; + } + //update position + s_delta_position[0] = s_player_velocity[0];\ + s_delta_position[1] = s_player_velocity[1];\ + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale( s_delta_position, time_getDelta()); + + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void func_802971DC(void){ + s_player_velocity[1] = s_player_velocity[1] + time_getDelta()*s_gravity; + if(s_player_velocity[1] < s_terminal_velocity) + s_player_velocity[1] = s_terminal_velocity; + + s_delta_position[0] = s_player_velocity[0];\ + s_delta_position[1] = s_player_velocity[1];\ + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + + s_next_position[0] += s_delta_position[0];\ + s_next_position[1] += s_delta_position[1];\ + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_climb(void){ + f32 sp34[3]; + f32 sp28[3]; + + climbGetBottom(sp28); + s_next_position[0] = sp28[0]; + s_next_position[2] = sp28[2]; + func_80256E24(sp34, 0.0f, yaw_get(), 0.0f, 0.0f, -climbGetRadius()); + + s_player_velocity[2] = 0.0f; + s_next_position[0] += sp34[0];\ + s_next_position[1] += sp34[1];\ + s_next_position[2] += sp34[2]; + + + s_player_velocity[0] = baphysics_target_velocity[0] = baphysics_target_velocity[2] = s_player_velocity[2]; + __baphysics_update_no_gravity(); +} + +void func_8029737C(void){ + s_delta_position[0] = s_player_velocity[0]; + s_delta_position[1] = s_player_velocity[1]; + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0]; + s_next_position[1] += s_delta_position[1]; + s_next_position[2] += s_delta_position[2]; +} + +void func_8029740C(void){ + s_delta_position[0] = s_player_velocity[0]; + s_delta_position[1] = s_player_velocity[1]; + s_delta_position[2] = s_player_velocity[2]; + ml_vec3f_clear(s_player_velocity); + ml_vec3f_scale(s_delta_position, time_getDelta()); + s_next_position[0] += s_delta_position[0]; + s_next_position[1] += s_delta_position[1]; + s_next_position[2] += s_delta_position[2]; +} + +void __baphysics_update_goto(void){ + f32 sp2C; + + switch(baphysics_goto.state){ + case 0: //L80297628 + break; + case 1: //L802974E8 + baphysics_goto.state = 2; + _player_getPosition(baphysics_goto.start_position); + baphysics_goto.elapsed_time = 0.0f; + baphysics_set_velocity(0); + break; + case 2: //L80297510 + baphysics_goto.elapsed_time += time_getDelta(); + sp2C = ml_map_f(baphysics_goto.elapsed_time, 0.0f, baphysics_goto.duration, 0.0f, 1.0f); + ml_vec3f_copy(s_player_velocity, s_next_position); + s_next_position[0] = ml_interpolate_f(sp2C, baphysics_goto.start_position[0], baphysics_goto.end_position[0]); + s_next_position[1] = ml_interpolate_f(sp2C, baphysics_goto.start_position[1], baphysics_goto.end_position[1]); + s_next_position[2] = ml_interpolate_f(sp2C, baphysics_goto.start_position[2], baphysics_goto.end_position[2]); + ml_vec3f_diff_copy(s_player_velocity, s_next_position, s_player_velocity); + ml_vec3f_scale(s_player_velocity, 1.0/time_getDelta()); + if(1.0 == sp2C){ + baphysics_set_velocity(0); + baphysics_goto.state = 3; + } + break; + case 3: //L80297628 + break; + } +} + +void __baphysics_update_transform(void){ + f32 temp_f0; + + D_8037C500 += time_getDelta(); + temp_f0 = func_80257A44(D_8037C500, 1.2f); + temp_f0 = ml_sin_deg(temp_f0*360.0f); + s_next_position[1] = 5.0*temp_f0 + D_8037C4FC; +} + +void baphysics_get_position_change(f32 arg0[3]){ + ml_vec3f_copy(arg0, s_delta_position); +} + +void baphysics_init(void){ + baphysics_type = 0; + ml_vec3f_clear(s_player_velocity); + ml_vec3f_clear(baphysics_target_velocity); + ml_vec3f_clear(s_delta_position); + ml_vec3f_clear(s_next_position); + D_8037C4E4 = 0.0f; + baphysics_reset(); +} + +void baphysics_update(void){ + _player_getPosition(s_next_position); + switch(baphysics_type){ + case BA_PHYSICS_GOTO: //L80297780 + __baphysics_update_goto(); + break; + case BA_PHYSICS_TRANSFORM: //L80297790 + __baphysics_update_transform(); + break; + case BA_PHYSICS_UNK8: //L802977A0 + func_8029737C(); + break; + case BA_PHYSICS_UNK1: //L802977B0 + func_802971DC(); + break; + case BA_PHYSICS_NO_GRAVITY: //L802977C0 + __baphysics_update_no_gravity(); + break; + case BA_PHYSICS_NORMAL: //L802977D0 //bear + baphysics_set_target_yaw(yaw_getIdeal()); + __baphysics_update_normal(); + break; + case BA_PHYSICS_INVERTED_YAW: //L802977F0 //bird + baphysics_set_target_yaw(mlNormalizeAngle(yaw_getIdeal() + 180.0f)); + __baphysics_update_normal(); + break; + case BA_PHYSICS_LOCKED_ROTATION: //L80297820 + __baphysics_update_normal(); + break; + case BA_PHYSICS_UNK4: //L80297830 + func_8029740C(); + break; + case BA_PHYSICS_AIRBORN: //L80297840 + if(0.0f < func_8029B2E8()){ + baphysics_set_target_yaw(func_8029B33C()); + } + __baphysics_update_normal(); + break; + case BA_PHYSICS_CLIMB: //L80297880 + __baphysics_update_climb(); + break; + case BA_PHYSICS_NONE: + case BA_PHYSICS_FREEZE: + default: + break; + } + player_setPosition(s_next_position); +} + +void baphysics_reset_horizontal_velocity(void){ + baphysics_set_target_horizontal_velocity(0.0f); + s_player_velocity[0] = s_player_velocity[2] = 0.0f; +} + +void baphysics_set_type(BaPhysicsType arg0){ + if((arg0 == BA_PHYSICS_TRANSFORM) && (arg0 != baphysics_type)){ + D_8037C4FC = s_next_position[1]; + D_8037C500 = 0.0f; + } + if(arg0 == BA_PHYSICS_GOTO){ + baphysics_goto.state = 1; + } + baphysics_type = arg0; +} + +void baphysics_set_target_velocity(f32 src[3]){ + if(src) + ml_vec3f_copy(baphysics_target_velocity, src); + else + ml_vec3f_clear(baphysics_target_velocity); +} + +void baphysics_set_target_horizontal_velocity(f32 arg0){ + baphysics_target_horizontal_velocity = arg0; +} + +void baphysics_set_target_yaw(f32 arg0){ + baphysics_target_yaw = mlNormalizeAngle(arg0); +} + +void baphysics_set_vertical_velocity(f32 arg0){ + s_player_velocity[1] = arg0; +} + +void baphysics_set_horizontal_velocity(f32 yaw, f32 magnitude) { \ + func_80256D0C(0.0f, yaw, 0.0f, 0.0f, magnitude, &s_player_velocity[0], &s_player_velocity[1], &s_player_velocity[2]); +} + +void baphysics_set_velocity(f32 src[3]){ + if(src) + ml_vec3f_copy(s_player_velocity, src); + else + ml_vec3f_clear(s_player_velocity); +} + +f32 baphysics_get_gravity(void){ + return s_gravity; +} + +BaPhysicsType baphysics_get_type(void){ + return baphysics_type; +} + +f32 baphysics_get_target_horizontal_velocity(void){ + return baphysics_target_horizontal_velocity; +} + +f32 baphysics_get_target_vertical_velocity(void){ + return baphysics_target_velocity[1]; +} + +f32 baphysics_get_target_yaw(void){ + return baphysics_target_yaw; +} + +void baphysics_get_velocity(f32 dst[3]){ + ml_vec3f_copy(dst, s_player_velocity); +} + +f32 baphysics_get_vertical_velocity(void){ + return s_player_velocity[1]; +} + +f32 baphysics_get_horizontal_velocity(void){ + return gu_sqrtf(s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2]); +} + +f32 baphysics_get_horizontal_velocity_percentage(void){ + f32 horz_vel; + f32 target_vel; + f32 temp_f12; + + horz_vel = baphysics_get_horizontal_velocity(); + target_vel = baphysics_get_target_horizontal_velocity(); + + if(horz_vel < target_vel){ + temp_f12 = horz_vel/target_vel; + } + else{ + temp_f12 = 1.0f; + } + return temp_f12; +} + +void baphysics_reset(void){ + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); +} + +void baphysics_set_acceleration(f32 arg0){ + baphysics_acceleration = arg0; +} + +void baphysics_reset_gravity(void){ + baphysics_set_gravity(baphysics_default_gravity); +} + +void baphysics_reset_terminal_velocity(void){ + baphysics_set_terminal_velocity(baphysics_default_terminal_velocity); +} + +void baphysics_set_goto_duration(f32 arg0){ + baphysics_goto.duration = arg0; +} + +void baphysics_set_goto_position(f32 src[3]) { \ + ml_vec3f_copy(baphysics_goto.end_position, src); +} + +void baphysics_set_gravity(f32 arg0){ + s_gravity = arg0; +} + +void baphysics_set_terminal_velocity(f32 arg0){ + s_terminal_velocity = arg0; +} + +int baphysics_is_slower_than(f32 arg0){ + return s_player_velocity[0]*s_player_velocity[0] + s_player_velocity[2]*s_player_velocity[2] <= (arg0*arg0); +} + +int baphysics_goto_done(void){ + return baphysics_goto.state == 3; +} diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index d3f9ae95..697f9557 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/yaw.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" void func_80293D48(f32,f32); @@ -41,10 +42,10 @@ void func_8029E48C(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1C, D_80364960, D_80364964)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364960, D_80364964)); } } @@ -79,8 +80,8 @@ int bsant_inSet(s32 move_indx){ void bsant_idle_init(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5E_ANIM_BSANT_IDLE, 1.2f); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,1,2); - func_80297970(0.0f); + func_8029C7F4(1,YAW_STATE_1_DEFAULT,1,BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); miscflag_set(3); @@ -115,7 +116,7 @@ void bsant_idle_end(void){ void bsant_walk_init(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5F_ANIM_BSANT_WALK, 0.8f); - func_8029C7F4(2,YAW_STATE_1_DEFAULT,1,2); + func_8029C7F4(2, YAW_STATE_1_DEFAULT,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364960, D_80364964, D_80364968, D_8036496C); func_802900B4(); } @@ -133,7 +134,7 @@ void bsant_walk_update(void){ if(animctrl_isAt(aCtrl, 0.2781f)) func_8029E448(1); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) sp1C = BS_35_ANT_IDLE; if(func_8028B094()) @@ -161,14 +162,14 @@ void bsant_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.4423f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsant.c", 0x17c); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_8029E48C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364970); - gravity_set(D_80364974); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364970); + baphysics_set_gravity(D_80364974); func_8029E3E0(); D_8037D294 = 0; } @@ -180,10 +181,10 @@ void bsant_jump_update(void){ f32 sp1C[3]; func_8029E48C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D294){ case 0://L8029EA88 @@ -213,7 +214,7 @@ void bsant_jump_update(void){ break; }//L8029EB38 if(func_8028B2E8()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); if(func_8029B300() > 0) sp2C = BS_ANT_WALK; @@ -225,7 +226,7 @@ void bsant_jump_update(void){ } void bsant_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_8029E4EC(); } @@ -239,7 +240,7 @@ void bsant_fall_init(void){ animctrl_setStart(aCtrl, 0.4423f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsant.c", 0x208); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,6); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_AIRBORN); D_8037D294 = 0; } @@ -252,7 +253,7 @@ void bsant_fall_update(void){ if(D_8037D298) func_8029E48C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch(D_8037D294){ case 0: if(func_8028B254(0x5A)){ @@ -300,12 +301,12 @@ static void __bsant_recoil_init(int take_damage){ func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D294 = 0; @@ -336,7 +337,7 @@ static void __bsant_recoil_update(void){ static void __bsant_recoil_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_8029E4EC(); @@ -387,12 +388,12 @@ void bsant_die_init(void){ D_8037D290 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D290); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D290); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xd); ncDynamicCamD_func_802BF2C0(30.0f); @@ -406,7 +407,7 @@ void bsant_die_init(void){ void bsant_die_update(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - func_80297970(D_8037D290); + baphysics_set_target_horizontal_velocity(D_8037D290); func_80299628(0); switch(D_8037D294){ case 0://L8029F270 @@ -440,7 +441,7 @@ void bsant_die_update(void){ void bsant_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -450,8 +451,8 @@ void bsant_die_end(void){ void func_8029F398(void){ func_8029E554(); baanim_playForDuration_loopSmooth(ASSET_5E_ANIM_BSANT_IDLE, 2.0f); - func_8029C7F4(1,YAW_STATE_1_DEFAULT,3,2); - func_80297970(0.0f); + func_8029C7F4(1, YAW_STATE_1_DEFAULT, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/bBarge.c b/src/core2/bs/bBarge.c index c23e323c..589617a7 100644 --- a/src/core2/bs/bBarge.c +++ b/src/core2/bs/bBarge.c @@ -1,15 +1,11 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" -void func_8029797C(f32); -f32 func_80297A64(void); -void func_80297970(f32); -f32 func_80297A7C(void); s32 func_8029E2E0(s32, f32); void func_80292864(f32, f32); -void func_802979AC(f32, f32); void func_8029E3C0(s32, f32); @@ -36,15 +32,15 @@ void func_8029F4F0(void){ switch(D_8037D2A4){ case 0: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f - 70.0f, 20.0f); break; case 1: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f - 10.0f, 20.0f); break; case 2: - tmp_f = (func_80297A7C() + 180.0f); + tmp_f = (baphysics_get_target_yaw() + 180.0f); func_80292864(tmp_f + 50.0f, 20.0f); break; } @@ -73,10 +69,10 @@ void bsbarge_init(void){ animctrl_setPlaybackType(plyrMvmnt, ANIMCTRL_ONCE); animctrl_start(plyrMvmnt, "bsbbarge.c", 0x98); D_8037D2A4 = 0; - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_80297970(func_80297A64()*0.3); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity()*0.3); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); D_8037D2A6 = 0; D_8037D2A5 = 0; @@ -127,15 +123,15 @@ void bsbarge_update(void){ animctrl_setDuration(plyrMvmnt, 1.0f); baanim_setEnd(0.565f); - func_80297970(D_8037D2A0); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_target_horizontal_velocity(D_8037D2A0); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8030E760(SFX_2_CLAW_SWIPE, 0.558f, 22000); D_8037D2A5 = 2; func_8029F4F0(); D_8037D2A6 = 1; break; case 2: - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(animctrl_isStopped(plyrMvmnt)){ animctrl_setDuration(plyrMvmnt, 2.0f); baanim_setEnd(0.6f); @@ -149,7 +145,7 @@ void bsbarge_update(void){ if(miscflag_isFalse(0xC) || func_8029E384(0)){ D_8037D2A0 -= 80.0f; } - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(D_8037D2A0 < 200.0f){ animctrl_setDuration(plyrMvmnt, 1.5f); baanim_setEnd(1.0f); @@ -164,7 +160,7 @@ void bsbarge_update(void){ D_8037D2A0 = 0.0f; D_8037D2A6 = 0; } - func_80297970(D_8037D2A0); + baphysics_set_target_horizontal_velocity(D_8037D2A0); if(animctrl_isAt(plyrMvmnt, 0.9193f)) sp24 = BS_20_LANDING; break; diff --git a/src/core2/bs/bEggAss.c b/src/core2/bs/bEggAss.c index ada34240..dc705448 100644 --- a/src/core2/bs/bEggAss.c +++ b/src/core2/bs/bEggAss.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D2E0; u8 D_8037D2E1; @@ -9,9 +11,9 @@ u8 D_8037D2E1; /* .code */ void bseggass_init(void){ baanim_playForDuration_onceSmooth(ASSET_2B_ANIM_BSEGGASS, 1.0f); - func_8029C7F4(1,3,1,3); + func_8029C7F4(1,3,1, BA_PHYSICS_LOCKED_ROTATION); yaw_setVelocityBounded(350.0f, 14.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029E058(1); D_8037D2E0 = (D_8037D2E1 = 1); func_802952A8(5,0); @@ -60,6 +62,6 @@ void bseggass_update(void) { void bseggass_end(void){ func_802952A8(5, 1); - gravity_reset(); + baphysics_reset_gravity(); func_8029E058(0); } diff --git a/src/core2/bs/bEggHead.c b/src/core2/bs/bEggHead.c index 1a0bb2d2..ffa0dee7 100644 --- a/src/core2/bs/bEggHead.c +++ b/src/core2/bs/bEggHead.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + void yaw_setVelocityBounded(f32, f32); void animctrl_start(AnimCtrl *, char*, s32); @@ -12,9 +14,9 @@ u8 D_8037D2F1; /* .code */ void bsegghead_init(void){ baanim_playForDuration_onceSmooth(ASSET_2A_ANIM_BSEGGHEAD, 1.0f); - func_8029C7F4(1,3,1,3); + func_8029C7F4(1,3,1, BA_PHYSICS_LOCKED_ROTATION); yaw_setVelocityBounded(350.0f, 14.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029E070(1); D_8037D2F0 = (D_8037D2F1 = 1); func_802952A8(2,0); @@ -68,6 +70,6 @@ void bsegghead_update(void) { void bsegghead_end(void){ func_802952A8(2, 1); - gravity_reset(); + baphysics_reset_gravity(); func_8029E070(0); } diff --git a/src/core2/bs/bFlap.c b/src/core2/bs/bFlap.c index e273af61..62fed1b6 100644 --- a/src/core2/bs/bFlap.c +++ b/src/core2/bs/bFlap.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" f32 func_802A2858(void); @@ -19,15 +20,15 @@ u8 D_8037D30C; void bsbflap_init(void) { baanim_playForDuration_onceSmooth(ASSET_18_ANIM_BSBFLAP_ENTER, 0.3f); - func_8029C7F4(1, 1, 1, 2); + func_8029C7F4(1, 1, 1, BA_PHYSICS_NORMAL); if (func_8029B2E8() != 0.0f) { yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(0.0f); - gravity_set(D_80364A14); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(0.0f); + baphysics_set_gravity(D_80364A14); func_8029E070(1); miscflag_set(MISC_FLAG_12_HAS_FLAPPED); func_8029E3C0(0, 2.5f); @@ -119,9 +120,9 @@ void bsbflap_update(void){ animctrl_setPlaybackType(sp18, ANIMCTRL_LOOP); animctrl_setStart(sp18, 0.0f); animctrl_start(sp18, "bsbflap.c", 0xe1); - player_setYVelocity(D_80364A10); - gravity_set(D_80364A14); - func_80297BF8(D_80364A18); + baphysics_set_vertical_velocity(D_80364A10); + baphysics_set_gravity(D_80364A14); + baphysics_set_terminal_velocity(D_80364A18); D_8037D300 = 1; } break; @@ -144,8 +145,8 @@ void bsbflap_update(void){ if(D_8037D301 == 4) D_8037D300 = 3; if(button_released(BUTTON_A)){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); animctrl_setDuration(sp18, 1.0f); D_8037D300 = 4; } @@ -157,14 +158,14 @@ void bsbflap_update(void){ func_802A28CC(); func_802A298C(); if(button_released(BUTTON_A)){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); animctrl_setDuration(sp18, 1.0f); func_80293240(2); D_8037D300 = 4; } else{ - func_80297970(func_80297A64() * 0.35); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity() * 0.35); } break; case 4: @@ -192,8 +193,8 @@ void bsbflap_update(void){ void bsbflap_end(void) { ability_use(1); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E090(0, 0.2f); func_8030DA44(D_8037D30C); } diff --git a/src/core2/bs/bFlip.c b/src/core2/bs/bFlip.c index 2fc17f75..186c1bcc 100644 --- a/src/core2/bs/bFlip.c +++ b/src/core2/bs/bFlip.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" /* .data */ const f32 D_80364A20 = 920.0f; @@ -18,9 +19,9 @@ void _bsbflip_802A2D60(void){ f32 sp1C; sp1C = func_8029B30C(); if(!func_8029B300()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364A2C, D_80364A30)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364A2C, D_80364A30)); } void _bsbflip_802A2DC0(void){ @@ -33,10 +34,10 @@ void _bsbflip_802A2DC0(void){ animctrl_setStart(aCtrl, 0.8566f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0x69); //nice - func_802978DC(3); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); ml_vec3f_clear(sp20); - func_80297A0C(sp20); + baphysics_set_velocity(sp20); func_8029C5E8(); } @@ -50,7 +51,7 @@ void bsbflip_init(void){ animctrl_setStart(aCtrl, 0.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0x80); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); @@ -79,17 +80,17 @@ void bsbflip_update(void){ yaw_setIdeal(func_8029B33C()); } yaw_rotateTimed(1.0f); - func_802978DC(6); - func_8029797C(yaw_getIdeal()); - func_80297970(200.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); }else{//L802A3098 - func_802978DC(6); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); } - player_setYVelocity(D_80364A20); - gravity_set(D_80364A24); - func_80297BF8(D_80364A28); + baphysics_set_vertical_velocity(D_80364A20); + baphysics_set_gravity(D_80364A24); + baphysics_set_terminal_velocity(D_80364A28); animctrl_setDuration(aCtrl, 1.9f); func_8030E4E4(SFX_33_BANJO_AHOO); D_8037D310 = 1; @@ -120,7 +121,7 @@ void bsbflip_update(void){ animctrl_setDuration(aCtrl, 0.8f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbflip.c", 0xee); - func_80297B94(); + baphysics_reset_terminal_velocity(); D_8037D310 = 3; }//L802A320C if(func_8028B2E8()){ @@ -160,8 +161,8 @@ void bsbflip_update(void){ void bsbflip_end(void){ ability_use(2); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); func_8029B0C0(); } diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index 37233efd..3d95e39d 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern void func_8028FDC8(f32); extern void baModel_setYDisplacement(f32); @@ -60,8 +61,8 @@ void func_802A3430(void){ void func_802A34C8(void){ if(!bsbfly_inSet(bs_getNextState())){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); baModel_setYDisplacement(0.0f); func_8029CB84(); @@ -134,14 +135,14 @@ int func_802A37F8(void){ void bsbfly_enter_init(void){ baanim_playForDuration_onceSmooth(ASSET_45_ANIM_BSBFLY_ENTER, 1.4f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); - func_80297A0C(0); - func_80297970(0.0f); - gravity_set(-1200.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_velocity(0); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_gravity(-1200.0f); func_8029E070(1); func_80299BD4(); D_8037D344 = 0; @@ -156,14 +157,14 @@ void bsbfly_enter_update(void){ case 0: if(animctrl_isAt(aCtrl, 0.2416f)){ animctrl_setDuration(aCtrl, 2.4f); - player_setYVelocity(1600.0f); + baphysics_set_vertical_velocity(1600.0f); func_8030E58C(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.7f); D_8037D344 = 1; } break; default: func_802A36D0(); - if(_get_vertVelocity() < 0.0f) + if(baphysics_get_vertical_velocity() < 0.0f) sp1C = BS_24_FLY; break; } @@ -178,18 +179,18 @@ void bsbfly_enter_end(void){ void bsbfly_init(void){ baanim_playForDuration_loopSmooth(ASSET_38_ANIM_BSBFLY, 0.62f); - func_8029C7F4(1,1,3,3); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); if(miscflag_isTrue(9)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{ - func_80297970(600.0f); + baphysics_set_target_horizontal_velocity(600.0f); } - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_8029797C(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_target_yaw(yaw_getIdeal()); func_8029E070(1); - gravity_set(-300.0f); - func_80297BF8(-99.9f); + baphysics_set_gravity(-300.0f); + baphysics_set_terminal_velocity(-99.9f); func_802914CC(4); func_802A3430(); D_8037D320 = 1.0f; @@ -247,7 +248,7 @@ void bsbfly_update(void){ pitch_setIdeal(sp34); func_802A3404(); if(sp30){ - player_setYVelocity(sp30 * 400.0); + baphysics_set_vertical_velocity(sp30 * 400.0); } if(!sp30){ animctrl_setDuration(aCtrl, 0.62f); @@ -259,19 +260,19 @@ void bsbfly_update(void){ if(animctrl_isAt(aCtrl, 0.1358f)){ func_8030EBC8(SFX_2_CLAW_SWIPE, 0.6f, 0.7f, 0x2710, 0x2ee0); } - gravity_set(-300.0f); + baphysics_set_gravity(-300.0f); if(miscflag_isTrue(9)){ - func_80297BF8(0.0f); - func_80297A0C(0); + baphysics_set_terminal_velocity(0.0f); + baphysics_set_velocity(0); sp38 = 0.0f; } else if(sp3C <= 80.0f){ - func_80297BF8(ml_map_f(sp3C, 60.0f, 80.0f, -99.9f, -1000.33)); - gravity_set(ml_map_f(sp3C, 60.0f, 80.0f, -300.0f, -700.0f)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 60.0f, 80.0f, -99.9f, -1000.33)); + baphysics_set_gravity(ml_map_f(sp3C, 60.0f, 80.0f, -300.0f, -700.0f)); sp38 = ml_map_f(sp3C, 60.0f, 80.0f, 600.0f, 60.0f); } else{ - func_80297BF8(ml_map_f(sp3C, 300.0f, 310.0f, -399.99f, -99.9f)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 300.0f, 310.0f, -399.99f, -99.9f)); sp38 = ml_map_f(sp3C, 300.0f, 340.0f, 0.0f, 600.0f); }//L802A3E18 @@ -281,8 +282,8 @@ void bsbfly_update(void){ if(sp4C != NULL && -1.0 < sp40[1]) sp38 = 0.0f; - func_8029797C(yaw_get()); - func_80297970(sp38); + baphysics_set_target_yaw(yaw_get()); + baphysics_set_target_horizontal_velocity(sp38); if(should_beak_bust()) sp54 = BS_F_BBUSTER; @@ -321,12 +322,12 @@ int bsbfly_bombHitboxActive(void){ void func_802A3F9C(void){ f32 sp1C[3]; baanim_playForDuration_once(ASSET_43_ANIM_BSBFLY_BEAKBOMB_START, 1.0f); - func_8029C7F4(1,1,3,7); + func_8029C7F4(1,1,3,BA_PHYSICS_FREEZE); func_802A339C(D_8037D338, sp1C, 4200.0f); yaw_setIdeal(sp1C[1] + 180.0f); pitch_setIdeal(sp1C[0]); roll_setIdeal(0.0f); - func_80297A0C(D_8037D338); + baphysics_set_velocity(D_8037D338); pitch_setIdeal(sp1C[0]); func_8029E070(1); func_802914CC(4); @@ -375,7 +376,7 @@ void func_802A411C(void) { switch (D_8037D344) { case 0: if (animctrl_isAt(sp58, 0.6905f)) { - func_802978DC(8); + baphysics_set_type(BA_PHYSICS_UNK8); func_802914CC(5); ncDynamicCam5_func_802BF590(&D_8037D338); animctrl_setDuration(sp58, 0.05f); @@ -453,15 +454,15 @@ void func_802A4430(void){ animctrl_setDuration(plyr_animctrl, 0.38f); animctrl_setPlaybackType(plyr_animctrl, ANIMCTRL_LOOP); animctrl_start(plyr_animctrl, "bsbfly.c", 0x38a); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); func_8029E070(1); func_802A3430(); func_80293D74(); func_80294378(1); roll_setIdeal(0.0f); pitch_setIdeal(0.0f); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); baModel_setYDisplacement(0.0f); func_80299CF4(SFX_31_BANJO_OHHWAAOOO, 1.0f, 0x7fff); func_80299D2C(SFX_61_CARTOONY_FALL, 1.0f, 0x7fff); @@ -472,7 +473,7 @@ void func_802A4430(void){ void func_802A4548(void){ s32 next_state = 0; f32 sp20[3]; - _get_velocity(sp20); + baphysics_get_velocity(sp20); switch(D_8037D344){ case 0://L802A457C if(func_8028B254(0x5A)){ @@ -528,7 +529,7 @@ void func_802A46C8(void) { void bsbfly_beakbomb_crash_init(void) { baanim_playForDuration_once(ASSET_3E_ANIM_BSBFLY_BEAKBOMB_CRASH, 1.4f); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); func_8029E070(1); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 32750); func_80299CF4(SFX_36_BANJO_DOH, 1.0f, 28000); @@ -552,7 +553,7 @@ void func_802A47E0(void) { func_80299CF4(SFX_38_BANJO_AYE_1, 1.0f, 22000); } if (animctrl_isAt(sp1C, 0.92f)) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } if (animctrl_getAnimTimer(sp1C) < 0.8) { func_802929F8(); @@ -639,17 +640,17 @@ void func_802A4A78(s32 arg0) { func_80257F18(sp30, sp3C, &sp28); yaw_setIdeal(mlNormalizeAngle(sp28 + 180.0f)); yaw_applyIdeal(); - func_80297970(sp20); - func_8029797C(sp28); - func_802979AC(sp28, func_80297A64()); + baphysics_set_target_horizontal_velocity(sp20); + baphysics_set_target_yaw(sp28); + baphysics_set_horizontal_velocity(sp28, baphysics_get_target_horizontal_velocity()); if ((arg0 == 1) && (map_get() == MAP_90_GL_BATTLEMENTS)) { yaw_setIdeal(mlNormalizeAngle(sp28)); yaw_applyIdeal(); } - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(800.0f); - gravity_set(sp2C); - func_80297BF8(-4000.0f); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(800.0f); + baphysics_set_gravity(sp2C); + baphysics_set_terminal_velocity(-4000.0f); func_8029E070(1); func_802914CC(4); ncDynamicCam4_func_802BFE50(12.0f, 10000.0f, 800.0f); @@ -671,7 +672,7 @@ void func_802A4C34(s32 arg0) { } void func_802A4C88(s32 arg0) { - func_80297B3C(); + baphysics_reset(); baMarker_collisionOn(); func_80297CA8(); func_8029E070(0); @@ -716,16 +717,16 @@ void func_802A4D90(void) { func_80257F18(sp1C, player_position, &sp34); yaw_setIdeal(mlNormalizeAngle(sp34 + 180.0f)); yaw_applyIdeal(); - func_80297970(1300.0f); - func_8029797C(sp34); - func_802979AC(sp34, func_80297A64()); + baphysics_set_target_horizontal_velocity(1300.0f); + baphysics_set_target_yaw(sp34); + baphysics_set_horizontal_velocity(sp34, baphysics_get_target_horizontal_velocity()); if (map_get() == MAP_90_GL_BATTLEMENTS) { yaw_setIdeal(mlNormalizeAngle(sp34)); yaw_applyIdeal(); } - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(400.0f); - gravity_set(-1800.0f); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(400.0f); + baphysics_set_gravity(-1800.0f); baMarker_collisionOff(); func_802914CC(4); ncDynamicCam4_func_802BFE50(12.0f, 10000.0f, 800.0f); @@ -748,14 +749,14 @@ void func_802A4EC8(void) { } void func_802A4F44(void){ - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_802A34C8(); } void func_802A4F74(void) { baanim_playForDuration_loopSmooth(ASSET_38_ANIM_BSBFLY, 0.62f); - func_8029C7F4(1, 1, 3, 7); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); func_8029E070(1); func_802914CC(4); func_802A3430(); @@ -808,15 +809,15 @@ void func_802A50F8(void){ void func_802A5120(void){ baanim_playForDuration_loop(ASSET_68_ANIM_BSJUMP_TUMBLE, 0.35f); - func_8029C7F4(1,1,3,6); - func_80297970(0.0f); - func_80297A0C(0); - player_setYVelocity(2000.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); + baphysics_set_vertical_velocity(2000.0f); func_80299CF4(SFX_63_BANJO_UWAAAAOOH, 1.0f, 32000); } void func_802A5190(void){ - player_setYVelocity(2000.0f); + baphysics_set_vertical_velocity(2000.0f); bs_setState(0); } diff --git a/src/core2/bs/bLongLeg.c b/src/core2/bs/bLongLeg.c index 4d72f617..c2c0bd94 100644 --- a/src/core2/bs/bLongLeg.c +++ b/src/core2/bs/bLongLeg.c @@ -4,6 +4,7 @@ #include "core2/ba/model.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ @@ -39,9 +40,9 @@ void func_802A5208(int arg0){ void func_802A524C(void){ f32 sp1C = func_8029B30C(); if(!func_8029B300()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364A40, D_80364A44)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364A40, D_80364A44)); } int bslongleg_inSet(s32 move_indx){ @@ -125,8 +126,8 @@ void bsblongleg_enter_init(void){ __bsblongleg_enterFromTrot(); else __bsblongleg_enter(); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A5374(); func_80299BD4(); } @@ -156,8 +157,8 @@ void bsblongleg_enter_end(void){ void bsblongleg_stand_enter(void){ baanim_playForDuration_loopSmooth(ASSET_41_ANIM_BSLONGLEG_IDLE, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_802A5374(); } @@ -202,7 +203,7 @@ void bsblongleg_walk_init(void){ animctrl_setIndex(aCtrl, ASSET_42_ANIM_BSLONGLEG_WALK); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bsblongleg.c", 0x1a1); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364A40, D_80364A44, D_80364A48, D_80364A4C); } @@ -220,10 +221,10 @@ void bsblongleg_walk_update(void){ func_802A5208(1); func_802A524C(); - if(button_pressed(BUTTON_B) && func_80297A64() == 0.0f) + if(button_pressed(BUTTON_B) && baphysics_get_target_horizontal_velocity() == 0.0f) stateTimer_clear(STATE_TIMER_2_LONGLEG); - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) next_state = BS_26_LONGLEG_IDLE; if(player_shouldSlideTrot()) @@ -273,7 +274,7 @@ void bsblongleg_exit_init(void){ func_802A5AB0(); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_8029957C(2); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D361 = func_8030D90C(); sfxsource_setSfxId(D_8037D361, SFX_2C_PULLING_NOISE); func_8030E04C(D_8037D361, 1.4f, 0.4f, -1.2f); @@ -322,14 +323,14 @@ void bsblongleg_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.42f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsblongleg.c", 0x27F); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A524C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364A50); - gravity_set(D_80364A54); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364A50); + baphysics_set_gravity(D_80364A54); func_8030E58C(SFX_48_KAZOOIE_RUUH, 0.9f); D_8037D360 = 0; } @@ -342,9 +343,9 @@ void bsblongleg_jump_update(void){ func_802A531C(); func_802A524C(); - _get_velocity(&sp34); + baphysics_get_velocity(sp34); if(button_released(BUTTON_A) && 0.0f < sp34[1]) - gravity_reset(); + baphysics_reset_gravity(); sp30 = player_getYPosition() - func_80294438(); switch(D_8037D360){ @@ -400,7 +401,7 @@ void bsblongleg_jump_update(void){ } void bsblongleg_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802A5404(); } @@ -412,14 +413,14 @@ void bsblongleg_slide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_setStart(aCtrl, 0.0865f); animctrl_start(aCtrl, "bsblongleg.c", 0x339); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); func_8029E064(1); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D358 = 1.0f; } @@ -437,8 +438,8 @@ void bsblongleg_slide_update(void){ func_80294480(sp30); func_8025801C(sp30, &sp2C); func_80299594(1, 0.5f); - func_80297970(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); func_8029C22C(); }else{//L802A6304 sp3C = BS_26_LONGLEG_IDLE; @@ -463,8 +464,8 @@ void func_802A6388(f32 arg0){ void func_802A6394(void){ baanim_playForDuration_loopSmooth(ASSET_41_ANIM_BSLONGLEG_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A5374(); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_8029C674(); diff --git a/src/core2/bs/bPeck.c b/src/core2/bs/bPeck.c index 63ee5a16..18e27bf3 100644 --- a/src/core2/bs/bPeck.c +++ b/src/core2/bs/bPeck.c @@ -3,6 +3,8 @@ #include "variables.h" #include "core2/yaw.h" +#include "core2/ba/physics.h" + void baModel_80292048(s32, f32, f32, f32); void animctrl_start(AnimCtrl *, char *, s32); @@ -38,11 +40,11 @@ void bsbpeck_init(void){ func_80293240(2); baanim_playForDuration_onceSmooth(ASSET_1A_ANIM_BSBPECK, 0.2f); - func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, 6); + func_8029C7F4(1,YAW_STATE_3_BOUNDED, 1, BA_PHYSICS_AIRBORN); yaw_setVelocityBounded(1200.0f, 10.0f); func_8029E070(1); - gravity_set(D_80364A60); - player_setYVelocity(D_80364A64); + baphysics_set_gravity(D_80364A60); + baphysics_set_vertical_velocity(D_80364A64); baModel_80292048(1, -38.0f, 0.0f, 105.0f); baModel_80292048(0, -38.0f, 0.0f, -7.0f); baMarker_8028D638(0x23, 0x2A); @@ -66,7 +68,7 @@ void func_802A664C(void){ } miscflag_set(MISC_FLAG_5_HAS_PECKED); func_8030E58C(SFX_42_KAZOOIE_RAH, sp1C); - player_setYVelocity(D_80364A64); + baphysics_set_vertical_velocity(D_80364A64); D_8037D375++; } @@ -76,7 +78,7 @@ void bsbpeck_update(void){ func_802B6FA8(); if(D_8037D377){ - func_80297970(func_80297A64() * 0.1); + baphysics_set_target_horizontal_velocity(baphysics_get_target_horizontal_velocity() * 0.1); } switch(D_8037D374){ @@ -134,5 +136,5 @@ void bsbpeck_end(void){ baModel_80292048(0, 0.0f, 0.0f, 0.0f); baMarker_8028D638(0, 0); func_8029E070(0); - gravity_reset(); + baphysics_reset_gravity(); } diff --git a/src/core2/bs/bShock.c b/src/core2/bs/bShock.c index 40151c1f..815da98c 100644 --- a/src/core2/bs/bShock.c +++ b/src/core2/bs/bShock.c @@ -1,6 +1,8 @@ #include #include "functions.h" -#include "variables.h"s +#include "variables.h" + +#include "core2/ba/physics.h" /* .data */ const f32 D_80364A70 = 1250.0f; @@ -21,14 +23,14 @@ void bsbshock_charge_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.1061f); animctrl_setPlaybackType(aCtrl,1); animctrl_start(aCtrl, "bsbshock.c", 0x61); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E064(1); func_8029E070(1); func_80299BD4(); @@ -55,9 +57,9 @@ void bsbshock_charge_update(void){ func_8029C348(); } func_802B6FA8(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]){ - gravity_reset(); + baphysics_reset_gravity(); } switch(D_8037D381){ @@ -89,7 +91,7 @@ void bsbshock_charge_update(void){ D_8037D380 = 0; }//L802A6CF4 if(func_8028B2E8()) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{//L802A6D18 if(should_flap()) @@ -102,7 +104,7 @@ void bsbshock_charge_update(void){ sp2C = BS_BSHOCK_JUMP; if(animctrl_isAt(aCtrl, 0.5551f)){ - player_setYVelocity(180.0f); + baphysics_set_vertical_velocity(180.0f); baModel_80292158(0.0f); func_80298528(50.0f); } @@ -132,16 +134,16 @@ void bsbshock_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setPlaybackType(aCtrl,1); animctrl_start(aCtrl, "bsbshock.c", 0x13a); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364A70); - gravity_set(D_80364A74); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364A70); + baphysics_set_gravity(D_80364A74); func_8030E484(SFX_E_SHOCKSPRING_BOING); func_8029E064(1); func_8029E070(1); @@ -157,12 +159,12 @@ void bsbshock_update(void){ AnimCtrl * aCtrl = baanim_getAnimCtrlPtr(); func_802B6FA8(); - _get_velocity(sp20); + baphysics_get_velocity(sp20); if(animctrl_isAt(aCtrl, 0.7f)) func_8030E484(SFX_53_BANJO_HUIII); if(button_released(BUTTON_A) && 0.0f < sp20[1]) - gravity_reset(); + baphysics_reset_gravity(); if(D_8037D381 == 0){ func_8029C348(); @@ -186,7 +188,7 @@ void bsbshock_update(void){ void bsbshock_end(void){ if(bs_getNextState() != BS_11_BPECK) - gravity_reset(); + baphysics_reset_gravity(); func_8029E064(0); func_8029E070(0); diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index f536cd78..82d47f8a 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -3,6 +3,8 @@ #include "variables.h" #include "core2/ba/model.h" +#include "core2/ba/physics.h" + extern f32 func_8029494C(void); extern f32 func_8029B2D0(void); @@ -17,12 +19,12 @@ u8 D_8037D396; f32 D_8037D398; void func_802A7140() { - func_8029C7F4(1, 3, 3, 9); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NO_GRAVITY); } f32 func_802A716C() { f32 sp24[3]; - _get_velocity(sp24); + baphysics_get_velocity(sp24); ml_map_f(gu_sqrtf((sp24[0] * sp24[0]) + (sp24[1] * sp24[1]) + (sp24[2] * sp24[2])), 50.0f, 200.0f, 0.0f, 1.0f); } @@ -71,14 +73,14 @@ void func_802A744C(void) { func_8035644C(FILEPROG_AC_DIVE_OILY_WATER); } roll_setAngularVelocity(30.0f, 0.9f); - gravity_set(0.0f); - func_80297BF8(-399.99f); + baphysics_set_gravity(0.0f); + baphysics_set_terminal_velocity(-399.99f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); func_80294378(3); baModel_setYDisplacement(60.0f); - func_80297B64(2.0f); + baphysics_set_acceleration(2.0f); } @@ -102,8 +104,8 @@ void func_802A75B0(void) { if (!bsbswim_inSet(bs_getNextState())) { pitch_setIdeal(0.0f); roll_setIdeal(0.0f); - func_80297B94(); - gravity_reset(); + baphysics_reset_terminal_velocity(); + baphysics_reset_gravity(); func_8029B0C0(); func_8029E070(0); func_80294378(1); @@ -114,9 +116,9 @@ void func_802A75B0(void) { void func_802A762C() { baanim_playForDuration_loopSmooth(0x70, 2.0f); func_802A7140(); - func_80297930(0); + baphysics_set_target_velocity(0); func_802A744C(); - func_80297B64(0.4f); + baphysics_set_acceleration(0.4f); } void func_802A7674() { @@ -162,7 +164,7 @@ void func_802A7738(void) { func_802A7140(); func_802A744C(); D_8037D390 = 0.0f; - func_80297B64(1.0f); + baphysics_set_acceleration(1.0f); func_802906A4(2); } @@ -174,8 +176,8 @@ void func_802A77D8(void) { sp34 = pitch_get(); sp30 = yaw_get(); func_80256E24(sp24, sp34, sp30, 0.0f, 0.0f, D_8037D390); - func_80297930(sp24); - func_80297A0C(sp24); + baphysics_set_target_velocity(sp24); + baphysics_set_velocity(sp24); } void func_802A7838(void) { @@ -237,7 +239,7 @@ void func_802A7A54() { func_802A7140(); func_802A744C(); D_8037D390 = 120.0f; - func_80297B64(2.0f); + baphysics_set_acceleration(2.0f); func_802906A4(2); } @@ -291,10 +293,10 @@ void func_802A7BD0(void) { func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C)); yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); baMarker_collisionOff(); func_80292E48(); func_802A744C(); @@ -333,7 +335,7 @@ void bsSwim_dive_init(void) { baanim_playForDuration_once(ASSET_3C_ANIM_BSSWIM_DIVE_ENTER, 1.0f); func_802A7140(); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297930(0); + baphysics_set_target_velocity(0); func_802A744C(); pitch_setAngVel(200.0f, 2.5f); func_80299BD4(); @@ -357,7 +359,7 @@ void func_802A7E2C(void) { sp34 = pitch_get(); sp30 = yaw_get(); func_80256E24(sp24, sp34, sp30, 0.0f, 0.0f, 800.0f); - func_80297A0C(sp24); + baphysics_set_velocity(sp24); func_8029E3C0(1, 0.8f); D_8037D396 = TRUE; } @@ -394,9 +396,9 @@ void func_802A7F6C(void) { baanim_playForDuration_loopSmooth(ASSET_B9_ANIM_BSSWIM_DIE, 0.7f); func_802A7140(); func_802A744C(); - func_80297B64(1.0f); - func_80297930(0); - func_80297A0C(0); + baphysics_set_acceleration(1.0f); + baphysics_set_target_velocity(0); + baphysics_set_velocity(0); pitch_setIdeal(275.0f); roll_setIdeal(0.0f); D_8037D396 = 0; @@ -415,8 +417,8 @@ void func_802A8098(void) { next_state = 0; func_80256E24(sp40, -90.0f, 0.0f, 0.0f, 0.0f, 100.0f); - func_80297930(sp40); - func_80297A0C(sp40); + baphysics_set_target_velocity(sp40); + baphysics_set_velocity(sp40); func_8029E22C(1); if( func_8029E284(1, 0.2f) || func_8029E284(1, 0.8f) @@ -437,7 +439,7 @@ void func_802A8098(void) { next_state = BS_2D_SWIM_IDLE; } if (func_8029E314(1, 1.55f)) { - player_setYVelocity(-50.0f); + baphysics_set_vertical_velocity(-50.0f); } if (func_8029E284(1, 1.9f)) { func_802914CC(0xD); @@ -487,8 +489,8 @@ void func_802A8330(void) { void func_802A83C0(void) { baanim_playForDuration_loopSmooth(0x70, 2.0f); func_802A7140(); - func_80297930(0); - func_80297B64(0.4f); + baphysics_set_target_velocity(0); + baphysics_set_acceleration(0.4f); func_802A744C(); func_802A8330(); } @@ -535,10 +537,10 @@ void func_802A846C(void) { animctrl_start(temp_s0, "bsbswim.c", 0x41E); } D_8037D398 = ml_map_f(sp28, 40.0f, 1000.0f, -300.0f, -1200.0f); - player_setYVelocity(D_8037D398); - func_8029C7F4(1, 3, 3, 9); + baphysics_set_vertical_velocity(D_8037D398); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NO_GRAVITY); func_802A744C(); - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); } void func_802A85EC(void) { @@ -554,7 +556,7 @@ void func_802A85EC(void) { particleEmitter_emitN(sp34, 1); if (D_8037D398 < 0.0f) { D_8037D398 += ml_max_f(mlAbsF(D_8037D398) * 0.1, 50.0f); - player_setYVelocity(D_8037D398); + baphysics_set_vertical_velocity(D_8037D398); } if (func_8028B2E8()) { next_state = BS_2D_SWIM_IDLE; @@ -562,7 +564,7 @@ void func_802A85EC(void) { if (!player_inWater()) { next_state = BS_1_IDLE; } - if (_get_vertVelocity() >= 0.0f) { + if (baphysics_get_vertical_velocity() >= 0.0f) { next_state = BS_2D_SWIM_IDLE; } bs_setState(next_state); diff --git a/src/core2/bs/bTrot.c b/src/core2/bs/bTrot.c index 6d9b4948..3a1f7bc8 100644 --- a/src/core2/bs/bTrot.c +++ b/src/core2/bs/bTrot.c @@ -3,8 +3,9 @@ #include "variables.h" #include "core2/ba/model.h" -#include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" +#include "core2/statetimer.h" /* .data */ f32 D_80364A90 = 30.0f; @@ -42,7 +43,7 @@ void func_802A880C(s32 arg0){ void func_802A8850(void){ if( button_pressed(BUTTON_B) && stateTimer_isActive(STATE_TIMER_3_TURBO_TALON) - && func_80297A64() == 0.0f + && baphysics_get_target_horizontal_velocity() == 0.0f ){ stateTimer_clear(STATE_TIMER_3_TURBO_TALON); } @@ -90,10 +91,10 @@ f32 func_802A8984(void){ void func_802A89D4(void){ f32 sp24 = func_8029B30C(); if(!func_8029B300()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp24, func_802A8900(), func_802A88B0())); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp24, func_802A8900(), func_802A88B0())); } } @@ -213,8 +214,8 @@ enum bs_e func_802A8D84(enum bs_e arg0){ void bsbtrot_enter_init(void){ func_802A8AD8(); baanim_playForDuration_onceSmooth(ASSET_16_ANIM_BSBTROT_ENTER, 1.0f); - func_8029C7F4(1,1,2,2); - func_80297970(0.0f); + func_8029C7F4(1,1,2, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); func_80299BD4(); func_802952A8(0,0); @@ -242,8 +243,8 @@ void bsbtrot_enter_end(void){ void bsbtrot_stand_init(void){ baanim_playForDuration_loopSmooth(ASSET_26_ANIM_BSBTROT_IDLE, 1.2f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); } @@ -272,7 +273,7 @@ void func_802A9054(void){ f32 tmp = 1.0f; baanim_setVelocityMapRanges(func_802A8900(), func_802A88B0(), func_802A8984(), func_802A8934()); if(func_8028B394()){ - tmp = ml_map_f(func_80297AF0(), 0.0f, 1.0f, 0.6f, 0.9f); + tmp = ml_map_f(baphysics_get_horizontal_velocity_percentage(), 0.0f, 1.0f, 0.6f, 0.9f); baanim_scaleDuration(tmp); } else{ @@ -282,7 +283,7 @@ void func_802A9054(void){ void bsbtrot_walk_init(void){ baanim_playForDuration_loopSmooth(func_802A9030(), 0.53f); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); func_802A8A40(); func_802A9054(); } @@ -312,7 +313,7 @@ void bsbtrot_walk_update(void){ if(animctrl_isAt(aCtrl, 0.2115f) || animctrl_isAt(aCtrl, 0.7115f)) func_802A87C0(); } - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) sp1C = BS_15_BTROT_IDLE; if(func_8028B094()) @@ -355,15 +356,15 @@ void bsbtrot_jump_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A89D4(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364ABC); - gravity_set(D_80364AC0); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364ABC); + baphysics_set_gravity(D_80364AC0); func_8030E484(SFX_48_KAZOOIE_RUUH); D_8037D3A4 = 0; } @@ -377,13 +378,13 @@ void bsbtrot_jump_update(void){ func_802A87C0(); if(miscflag_isTrue(0xF)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802A89D4(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3A4){ case 0://L802A9530 @@ -411,13 +412,13 @@ void bsbtrot_jump_update(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); func_8029957C(1); D_8037D3A4 = 3; - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_8029C22C(); } break; case 3://L802A9660 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); func_80299628(1); @@ -430,7 +431,7 @@ void bsbtrot_jump_update(void){ func_8029C22C(); break; case 4://L802A96F0 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -444,7 +445,7 @@ void bsbtrot_jump_update(void){ func_8029C22C(); break; case 5://L802A9780 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); func_80299628(1); @@ -474,14 +475,14 @@ void bsbtrot_jump_update(void){ } void bsbtrot_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802A8BB0(); } void bsbtrot_exit_init(void){ baanim_playForDuration_onceSmooth(ASSET_7_ANIM_BSBTROT_EXIT, 0.6f); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } void bsbtrot_exit_update(void){ @@ -504,14 +505,14 @@ void bsbtrot_slide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsbtrot.c", 0x382); func_802A8A40(); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); func_8029E070(1); func_8029E064(1); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D3A0 = 1.0f; } @@ -530,8 +531,8 @@ void bsbtrot_slide_update(void){ func_80294480(sp30); func_8025801C(sp30, &sp2C); func_80299628(1); - func_80297970(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(pitch_getIdeal(), 20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); func_8029C22C(); }else{ sp3C = BS_15_BTROT_IDLE; @@ -572,10 +573,10 @@ void bsbtrot_fall_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bsbtrot.c", 0x400); func_802A8A40(); - func_8029C7F4(1,1,3,6); - func_8029797C(yaw_getIdeal()); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A89D4(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); D_8037D3A4 = 0; } @@ -588,11 +589,11 @@ void bsbtrot_fall_update(void){ func_802A87C0(); if(miscflag_isTrue(0xf)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802A89D4(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D3A4){ case 0://L802A9D90 if(func_8028B254(0x8C)){ @@ -610,7 +611,7 @@ void bsbtrot_fall_update(void){ animctrl_setDuration(aCtrl, 0.9f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); func_8029957C(1); - if(220.0f < func_80297A64()){ + if(220.0f < baphysics_get_target_horizontal_velocity()){ func_80299AAC(); } func_8029C22C(); @@ -618,7 +619,7 @@ void bsbtrot_fall_update(void){ } break; case 2://L802A9E78 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -632,7 +633,7 @@ void bsbtrot_fall_update(void){ func_8029C22C(); break; case 3://L802A9F08 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -646,7 +647,7 @@ void bsbtrot_fall_update(void){ func_8029C22C(); break; case 4://802A9F98 - if(220.0f < func_80297A64()) + if(220.0f < baphysics_get_target_horizontal_velocity()) func_80299AAC(); func_802A9320(); @@ -679,8 +680,8 @@ void bsbtrot_fall_end(void){ void bsbtrot_unk79_init(void){ baanim_playForDuration_loopSmooth(ASSET_26_ANIM_BSBTROT_IDLE, 1.2f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802A8A40(); baModel_setDirection(PLAYER_MODEL_DIR_KAZOOIE); func_8029C674(); @@ -715,14 +716,14 @@ void bsbtrot_ow_init(void){ func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C + 180.0f));\ yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1,1,2,3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); if(func_802987B4() == 2) - func_802978DC(6); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); baMarker_collisionOff(); func_80292E48(); } @@ -749,7 +750,7 @@ void bsbtrot_ow_update(void){ void bsbtrot_ow_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802A8BB0(); diff --git a/src/core2/bs/bWhirl.c b/src/core2/bs/bWhirl.c index 3ffe3549..a3563d32 100644 --- a/src/core2/bs/bWhirl.c +++ b/src/core2/bs/bWhirl.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" const f32 D_80364AD0 = 80.0f; const f32 D_80364AD4 = 425.0f; @@ -19,9 +20,9 @@ u8 D_8037D3B4; void func_802AA400(void){ f32 sp1C = func_8029B30C(); if(!func_8029B300()){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{ - func_80297970(ml_interpolate_f(sp1C, D_80364AD0, D_80364AD4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364AD0, D_80364AD4)); } } @@ -79,8 +80,8 @@ void func_802AA58C(enum bs_e *arg0){ void bsbwhirl_enter_init(void){ baanim_playForDuration_onceSmooth(ASSET_22_ANIM_BSWHIRL_EXIT, 0.5f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_8029E070(1); @@ -107,8 +108,8 @@ void bsbwhirl_enter_end(void){ void bsbwhirl_stand_init(void){ baanim_playForDuration_loopSmooth(ASSET_23_ANIM_BSWONDERWING_IDLE, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); } void bsbwhirl_stand_update(void){ @@ -134,8 +135,7 @@ void bsbwhirl_stand_end(void){ void bsbwhirl_walk_init(void){ baanim_playForDuration_loopSmooth(ASSET_11_ANIM_BSWHIRL_WALK, 0.53f); baanim_setVelocityMapRanges(D_80364AD0, D_80364AD4, D_80364AD8, D_80364ADC); - func_8029C7F4(2,1,1,2); - + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); } void bsbwhirl_walk_update(void){ @@ -145,7 +145,7 @@ void bsbwhirl_walk_update(void){ func_8029AD28(0.97f, 3); func_802AA400(); - if(!func_8029B300() && func_80297C04(1.0f)) + if(!func_8029B300() && baphysics_is_slower_than(1.0f)) sp1C = BS_1B_WONDERWING_IDLE; if(button_released(BUTTON_Z)) @@ -180,15 +180,15 @@ void bsbwhirl_jump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.4495f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbwhirl.c", 0x181); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3,BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802AA400(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364AE0); - gravity_set(D_80364AE4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364AE0); + baphysics_set_gravity(D_80364AE4); func_80299B58(0.91f, 1.09f); D_8037D3B4 = 0; } @@ -200,9 +200,9 @@ void bsbwhirl_jump_update(void){ __bsbwhirl_spawnSparkle(); func_802AA400(); - _get_velocity(&sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3B4){ case 0://L802AAB48 @@ -236,7 +236,7 @@ void bsbwhirl_jump_update(void){ } void bsbwhirl_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); __bsbwhirl_end(); } @@ -252,7 +252,7 @@ void bsbwhirl_exit_init(void){ animctrl_start(aCtrl, "bsbwhirl.c", 0x201); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_8029957C(2); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); comusic_8025AB44(COMUSIC_25_USING_GOLD_FEATHERS, 0.0f, 0xFA0); } @@ -285,8 +285,8 @@ void bsbwhirl_drone_end(void){ void func_802AADBC(void){ baanim_playForDuration_loopSmooth(ASSET_23_ANIM_BSWONDERWING_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); } diff --git a/src/core2/bs/bbuster.c b/src/core2/bs/bbuster.c index bd2602c3..0aece6cd 100644 --- a/src/core2/bs/bbuster.c +++ b/src/core2/bs/bbuster.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /*.data*/ const f32 D_80364990 = 400.0f; const f32 D_80364994 = -800.0f; @@ -62,11 +64,11 @@ void bsbbuster_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.35f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsbbuster.c", 0x81); - func_8029C7F4(1,1,3,6); - gravity_set(0.0f); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); + baphysics_set_gravity(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); ml_vec3f_clear(sp20); - func_80297A0C(sp20); + baphysics_set_velocity(sp20); func_8029E070(1); func_802A02B4(0); D_8037D2B9 = 0; @@ -101,16 +103,16 @@ void bsbbuster_update(void){ case 1://8029FE24 D_8037D2B0 -= time_getDelta(); if(D_8037D2B0 <= 0.0f){ - gravity_reset(); - func_80297BF8(D_803649A8); - gravity_set(D_803649A4); - player_setYVelocity(D_803649A0); + baphysics_reset_gravity(); + baphysics_set_terminal_velocity(D_803649A8); + baphysics_set_gravity(D_803649A4); + baphysics_set_vertical_velocity(D_803649A0); D_8037D2B7 = 1; D_8037D2BA = 2; } break; case 2://8029FEA0 - if(D_8037D2B5 == 0 && _get_vertVelocity() < 0.0f){ + if(D_8037D2B5 == 0 && baphysics_get_vertical_velocity() < 0.0f){ func_8030E760(SFX_45_KAZOOIE_HUGHH, 1.2f, 0x7530); D_8037D2B5++; } @@ -137,9 +139,9 @@ void bsbbuster_update(void){ func_802BB3DC( 0, 45.0f, 0.71f); func_8029AE74(0); func_8029FB30(); - func_80297A0C(0); - gravity_set(0.0f); - func_80297970(0.0f); + baphysics_set_velocity(0); + baphysics_set_gravity(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D2B7 = 2; D_8037D2B8 = 1; D_8037D2B0 = 0.09f; @@ -160,11 +162,11 @@ void bsbbuster_update(void){ D_8037D2B0 -= time_getDelta(); if(D_8037D2B0 <= 0.0f){ if(D_8037D2BB){ - player_setYVelocity(D_80364990); - gravity_set(D_80364994); + baphysics_set_vertical_velocity(D_80364990); + baphysics_set_gravity(D_80364994); }else{ - player_setYVelocity(D_80364998); - gravity_set(D_8036499C); + baphysics_set_vertical_velocity(D_80364998); + baphysics_set_gravity(D_8036499C); } animctrl_setSubRange(aCtrl, 0.0f, 0.7299f); @@ -196,8 +198,8 @@ void bsbbuster_update(void){ }//L802A024C void bsbbuster_end(void){ - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8029E070(0); D_8037D2B7 = 0; D_8037D2B8 = 0; diff --git a/src/core2/bs/beeFly.c b/src/core2/bs/beeFly.c index f6f15945..6a44ba47 100644 --- a/src/core2/bs/beeFly.c +++ b/src/core2/bs/beeFly.c @@ -2,20 +2,18 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + + void func_80354030(f32*, f32); f32 func_8029B2E8(void); f32 func_8029B33C(void); -void func_8029797C(f32); -void func_80297970(f32); void baModel_setYDisplacement(f32); -void func_80297BF8(f32); void ncDynamicCam4_func_802BFE50(f32, f32, f32); void yaw_setVelocityBounded(f32, f32); f32 func_8029B2D0(void); f32 func_8029B2DC(void); -f32 func_80297A64(void); -void func_802979AC(f32, f32); void func_8028FDC8(f32); void func_80290B40(f32); void func_80290A6C(void); @@ -45,13 +43,13 @@ void func_802A04F0(void){ void func_802A0590(void){ func_802A0340(); baanim_playForDuration_onceSmooth(0x1df, 1.5f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); - func_80297970(0.0f); - gravity_set(-1200.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_gravity(-1200.0f); D_8037D2C0 = 0; } @@ -64,7 +62,7 @@ void func_802A0630(void){ case 0: if(!animctrl_isAt(mvmnt, 0.266f)) break; - player_setYVelocity(1600.0f); + baphysics_set_vertical_velocity(1600.0f); func_8030E58C(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.7f); D_8037D2C0 = 1; break; @@ -72,7 +70,7 @@ void func_802A0630(void){ func_802A04F0(); if(animctrl_isStopped(mvmnt)) baanim_playForDuration_loopSmooth(ASSET_1DC_ANIM_BEE_FLY, 0.38f); - if(_get_vertVelocity() < 0.0f) + if(baphysics_get_vertical_velocity() < 0.0f) next_state = BS_BEE_FLY; break; } @@ -98,8 +96,8 @@ void _bsbeefly_end(void){ roll_setIdeal(0.0f); pitch_setIdeal(0.0f); func_80291548(); - gravity_reset(); - func_80297B94(); + baphysics_reset_gravity(); + baphysics_reset_terminal_velocity(); func_8028FFBC(0); func_8029099C(); } @@ -111,8 +109,8 @@ void func_802A07F8(void){ yaw_setUpdateState(3); roll_setAngularVelocity(500.0f, 2.0f); func_802A0724(); - gravity_set(-300.0f); - func_80297BF8(-99.9f); + baphysics_set_gravity(-300.0f); + baphysics_set_terminal_velocity(-99.9f); func_8028FEF0(); func_8028FFBC(1); func_802909C4(); @@ -153,13 +151,13 @@ void bsbeefly_enter(void){ mvmnt = bs_getPrevState(); baanim_playForDuration_loopSmooth(ASSET_1DC_ANIM_BEE_FLY, 0.38); - func_8029C7F4(1, 1, 3, 3); + func_8029C7F4(1, 1, 3, BA_PHYSICS_LOCKED_ROTATION); if(miscflag_isTrue(9)) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(600.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(600.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802914CC(4); func_802A07F8(); if(mvmnt != 0x8b){ @@ -200,7 +198,7 @@ void bsbeefly_update(void){ sp40 += *sp24; sp3C = pitch_get(); sp30 = 0.0f; - if(_get_vertVelocity() < 0.0f){ + if(baphysics_get_vertical_velocity() < 0.0f){ if(sp3C < 300.0f){ sp30 = ml_map_f(sp3C, 0.0f, 80.0f, 0.0f, 0.23f); } @@ -228,7 +226,7 @@ void bsbeefly_update(void){ pitch_setIdeal(sp40); func_802A0750(); if(sp44 != 0){ - player_setYVelocity(sp44*400.0); + baphysics_set_vertical_velocity(sp44*400.0); func_802A04F0(); } if((s32)sp24 == (s32)&D_803649C4){ @@ -238,23 +236,23 @@ void bsbeefly_update(void){ break; }//L802A0DF0 if(miscflag_isTrue(9)){ - func_80297BF8(0.0f); - func_80297A0C(0); + baphysics_set_terminal_velocity(0.0f); + baphysics_set_velocity(0); sp38 = 0.0f; }else{ if(sp3C <= 80.0f){ - func_80297BF8(ml_map_f(sp3C, 60.0f, 80.0f, -99.9, -1266.66)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 60.0f, 80.0f, -99.9, -1266.66)); sp38 = ml_map_f(sp3C, 60.0f, 80.0f, 600.0f, 60.0f); }else{ - func_80297BF8(ml_map_f(sp3C, 300.0f, 310.0f, -399.99, -99.9)); + baphysics_set_terminal_velocity(ml_map_f(sp3C, 300.0f, 310.0f, -399.99, -99.9)); sp38 = ml_map_f(sp3C, 300.0f, 340.0f, 0.0f, 600.0f); } } - func_8029797C(yaw_get()); + baphysics_set_target_yaw(yaw_get()); if(button_held(9)){ sp38 += (f64)sp38; } - func_80297970(sp38); + baphysics_set_target_horizontal_velocity(sp38); if(func_8028B2E8() && !player_inWater()) sp4C = BS_85_BEE_IDLE; func_8028FFF0(); diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 675d4cc1..016e2567 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -2,13 +2,12 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + f32 func_8029B41C(void); void func_8029E3C0(s32, f32); void func_80299628(s32); void yaw_applyIdeal(void); -void func_8029797C(f32); -f32 func_80297A64(void); -void func_802979AC(f32, f32); void ncDynamicCamD_func_802BF2C0(f32); f32 baanim_getTimer(void); @@ -51,18 +50,18 @@ void func_802A1020(void){ sp1c = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1c, D_803649E0, D_803649E4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1c, D_803649E0, D_803649E4)); } } void func_802A1080(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE,3.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802900B4(); } @@ -97,7 +96,7 @@ void func_802A117C(void){ void func_802A11A4(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DD_ANIM_BEE_WALK, 0.38f); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_803649E0, D_803649E4, D_803649E8, D_803649EC); func_802900B4(); } @@ -110,7 +109,7 @@ void func_802A1214(void){ func_802A1020(); func_8029AD28(0.94f, 4); func_8029AD28(0.44f, 3); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) s0 = BS_85_BEE_IDLE; if(func_8028B094()) @@ -143,15 +142,15 @@ void func_802A12FC(void){ animctrl_setDuration(s0, 1.2f); animctrl_setPlaybackType(s0, ANIMCTRL_ONCE); animctrl_start(s0, "bsbeemain.c", 0x15b); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802A1020(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_803649F0); - gravity_set(D_803649F4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_803649F0); + baphysics_set_gravity(D_803649F4); func_802A0FB4(); D_8037D2D4 = 0; } @@ -164,9 +163,9 @@ void func_802A1438(void){ sp2c = 0; sp28 = baanim_getAnimCtrlPtr(); func_802A1020(); - _get_velocity(sp1c); + baphysics_get_velocity(sp1c); if(button_released(BUTTON_A) && (0.0f < sp1c[1])){ - gravity_reset(); + baphysics_reset_gravity(); } switch (D_8037D2D4) { @@ -198,7 +197,7 @@ void func_802A1438(void){ case 3: func_80299628(0); if(animctrl_isStopped(sp28)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2c = BS_85_BEE_IDLE; } break; @@ -222,7 +221,7 @@ void func_802A1438(void){ void func_802A163C(void){ func_802A02C0(); - gravity_reset(); + baphysics_reset_gravity(); } void func_802A1664(void){ @@ -237,7 +236,7 @@ void func_802A1664(void){ animctrl_setSubRange(s0, 0, 0.51f); animctrl_setPlaybackType(s0, ANIMCTRL_ONCE); animctrl_start(s0, "bsbeemain.c", 0x1e2); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D2D4 = 0; } @@ -250,7 +249,7 @@ void func_802A170C(void){ sp28 = baanim_getAnimCtrlPtr(); func_80299628(0); func_802A1020(); - _get_velocity(sp1c); + baphysics_get_velocity(sp1c); switch(D_8037D2D4){ case 0: if(func_8028B254(0x82)){ @@ -262,7 +261,7 @@ void func_802A170C(void){ func_80299628(0); if(func_8028B2E8()){ func_802A0F90(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); baanim_setEndAndDuration(1.0f, 0.7f); D_8037D2D4 = 2; } @@ -270,7 +269,7 @@ void func_802A170C(void){ case 2: func_80299628(0); if(animctrl_isStopped(sp28)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2c = BS_85_BEE_IDLE; } break; @@ -325,12 +324,12 @@ void func_802A18E8(s32 arg0){ func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D2D4 = 0; @@ -363,7 +362,7 @@ void func_802A1A50(void){ void func_802A1B28(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802A02C0(); @@ -409,18 +408,18 @@ void bsbeemain_die_init(void){ animctrl_setDuration(sp3C, 1.7f); animctrl_setPlaybackType(sp3C, ANIMCTRL_ONCE); animctrl_start(sp3C, "bsbeemain.c", 0x2ef); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); _player_getPosition(sp2C); func_80294980(sp20); func_80257F18(sp20, sp2C, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); D_8037D2D0 = 250.f; - func_80297970(D_8037D2D0); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - player_setYVelocity(420.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D2D0); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(420.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); baMarker_collisionOff(); func_80292E48(); @@ -433,7 +432,7 @@ void bsbeemain_die_init(void){ } void func_802A1DD8(void){ - func_80297970(D_8037D2D0); + baphysics_set_target_horizontal_velocity(D_8037D2D0); func_80299628(0); switch(D_8037D2D4){ case 0: @@ -442,7 +441,7 @@ void func_802A1DD8(void){ baanim_setEnd(0.7453f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D2D4 = 1; break; case 1: @@ -471,7 +470,7 @@ void func_802A1DD8(void){ void func_802A1F2C(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); func_80291548(); func_80292EA4(); func_802A02C0(); @@ -480,8 +479,8 @@ void func_802A1F2C(void){ void func_802A1F6C(void){ func_802A0340(); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE, 3.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } @@ -518,8 +517,8 @@ void func_802A2098(void){ miscflag_clear(0x1A); baanim_playForDuration_loopSmooth(ASSET_1DE_ANIM_BEE_IDLE, 3.0f); yaw_setIdeal(func_8029B41C()); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8024BD08(0); func_8025A2FC(0, 0xFA0); func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); diff --git a/src/core2/bs/carry.c b/src/core2/bs/carry.c index cf6f7d4f..726ef183 100644 --- a/src/core2/bs/carry.c +++ b/src/core2/bs/carry.c @@ -4,6 +4,7 @@ #include "bsint.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ const f32 D_80364AF0 = 30.0f; @@ -14,9 +15,9 @@ const f32 D_80364AFC = 0.4f; void func_802AAE80(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); else - func_80297970(ml_interpolate_f(sp1C, D_80364AF0, D_80364AF4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364AF0, D_80364AF4)); } void func_802AAEE0(void){ @@ -34,8 +35,8 @@ void bscarry_idle_init(void){ animctrl_setIndex(aCtrl, ASSET_72_ANIM_BSCARRY_IDLE); animctrl_setDuration(aCtrl, 1.2f); animctrl_start(aCtrl, "bscarry.c", 0x6f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); } @@ -63,7 +64,7 @@ void bscarry_walk_init(void){ animctrl_setDuration(aCtrl, 0.8f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bscarry.c", 0xac); - func_8029C7F4(2,1,1,2); + func_8029C7F4(2,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364AF0, D_80364AF4, D_80364AF8, D_80364AFC); } @@ -72,7 +73,7 @@ void bscarry_walk_update(void){ func_8029AD28(0.4f, 4); func_8029AD28(0.9f, 3); func_802AAE80(); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) sp1C = BS_3A_CARRY_IDLE; if(carriedobj_getMarker() == NULL) diff --git a/src/core2/bs/claw.c b/src/core2/bs/claw.c index af05634e..a87b216b 100644 --- a/src/core2/bs/claw.c +++ b/src/core2/bs/claw.c @@ -1,7 +1,7 @@ #include #include "functions.h" #include "variables.h" - +#include "core2/ba/physics.h" void func_802915CC(f32); @@ -17,9 +17,9 @@ int bsclaw_hitboxActive(void){ void bsclaw_init(void){ baanim_playForDuration_once(ASSET_5_ANIM_BSPUNCH, 1.3f); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_80297970(160.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(160.0f); func_802915CC(80.0f); _bsclawHitboxActive = 0; } @@ -37,7 +37,7 @@ void bsclaw_update(void){ || animctrl_isAt(aCtrl, 0.5788f) || (0.4788 < sp24 && sp24 < 0.6788); if(animctrl_isAt(aCtrl, 0.5788f)) - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_8029AD28(0.08f, 3); func_8029AD28(0.34f, 4); diff --git a/src/core2/bs/climb.c b/src/core2/bs/climb.c index c3bc7bc0..322fc9a1 100644 --- a/src/core2/bs/climb.c +++ b/src/core2/bs/climb.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ u8 D_8037D3D0; @@ -24,7 +25,7 @@ void func_802AB5C0(void){ sp2C[0] = 0.0f; sp2C[1] = f2; sp2C[2] = 0.0f; - func_80297930(sp2C); + baphysics_set_target_velocity(sp2C); } void func_802AB654(void){ @@ -33,8 +34,8 @@ void func_802AB654(void){ yaw_setVelocityBounded(500.0f, 15.0f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); - func_802978DC(0xA); - func_80297B64(10.0f); + baphysics_set_type(BA_PHYSICS_CLIMB); + baphysics_set_acceleration(10.0f); func_80294378(5); func_80293D48(80.0f, 10.0f); func_802914CC(0x10); @@ -45,7 +46,7 @@ void func_802AB6F0(void){ func_80291548(); func_8029B0C0(); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); - func_802978DC(2); + baphysics_set_type(BA_PHYSICS_NORMAL); func_80294378(1); func_80293D74(); } @@ -56,7 +57,7 @@ void func_802AB750(f32 arg0, f32 arg1){ } int func_802AB788(void){ - return (0.0f < mlAbsF(func_80297A70())) || (yaw_get() != yaw_getIdeal()); + return (0.0f < mlAbsF(baphysics_get_target_vertical_velocity())) || (yaw_get() != yaw_getIdeal()); } int bsclimb_inSet(s32 move_indx){ @@ -160,15 +161,15 @@ void bsclimb_move_update(void){ func_80299D2C(SFX_D3_JINXIE_SNIFFLING_1, 0.87f, 22000); }//L802ABB84 - if(!func_802AB788() && _get_vertVelocity() < 30.0f) + if(!func_802AB788() && baphysics_get_vertical_velocity() < 30.0f) next_state = BS_4F_CLIMB_IDLE; _player_getPosition(plyr_pos); - if(func_80297A70() < 0.0f && climbGetBottomY() == plyr_pos[1]) + if(baphysics_get_target_vertical_velocity() < 0.0f && climbGetBottomY() == plyr_pos[1]) next_state = BS_1_IDLE; if( func_8029825C() == 2 - && 0.0f < func_80297A70() + && 0.0f < baphysics_get_target_vertical_velocity() && climbGetTopY() == plyr_pos[1] ){ next_state = BS_51_CLIMB_EXIT; @@ -194,7 +195,7 @@ void func_802ABCCC(void){ baanim_playForDuration_loopSmooth(ASSET_B2_ANIM_BSCLIMB_IDLE_2, 2.64f); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_802AB654(); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); } //bsclimb_unknown_9E_update diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index a7748f1c..1999a6ee 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" int bscroc_inSet(enum bs_e state); @@ -68,10 +69,10 @@ void func_802ABE70(void){ void func_802ABF54(void){ f32 sp1C = func_8029B30C(); if(func_8029B300() == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); } else{ - func_80297970(ml_interpolate_f(sp1C, bsCrocMinWalkVelocity, __bscroc_getMaxVelocity())); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsCrocMinWalkVelocity, __bscroc_getMaxVelocity())); } } @@ -103,8 +104,8 @@ int bscroc_inSet(enum bs_e state){ void bscroc_idle_init(void){ baanim_playForDuration_loopSmooth(0xe1, 1.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -144,7 +145,7 @@ void bscroc_idle_end(void){ void bscroc_walk_init(void){ baanim_playForDuration_loopStartingAt(ASSET_E0_ANIM_BSCROC_WALK, 0.8f, 0.4f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ, 1, 1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(bsCrocMinWalkVelocity, bsCrocMaxWalkVelocity, bsCrocSlowestWalkDuration, bsCrocFastestWalkDuration); func_802900B4(); } @@ -158,7 +159,7 @@ void bscroc_walk_update(void){ func_8029AD28(0.1f, 4); func_8029AD28(0.6f, 3); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) next_state = BS_5E_CROC_IDLE; if(func_8028B094()) @@ -189,15 +190,15 @@ void bscroc_jump_init(void){ animctrl_setStart(aCtrl, 0.1f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bscroc.c", 0x1ac); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802ABF54(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(bsCrocInitialJumpVelocity); - gravity_set(bsCrocGravity); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(bsCrocInitialJumpVelocity); + baphysics_set_gravity(bsCrocGravity); __bscroc_jumpSfx(); D_8037D3EC = 0; } @@ -209,9 +210,9 @@ void bscroc_jump_update(void){ func_802ABE70(); func_802ABF54(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); if(button_released(BUTTON_A) && 0.0f < player_velocity[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D3EC){ case 0: @@ -243,7 +244,7 @@ void bscroc_jump_update(void){ case 3: func_80299628(0); if(animctrl_isStopped(aCtrl)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); sp2C = BS_5E_CROC_IDLE; } break; @@ -264,7 +265,7 @@ void bscroc_jump_update(void){ } void bscroc_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802ABFBC(); } @@ -277,7 +278,7 @@ void bscroc_fall_init(void){ animctrl_setDuration(aCtrl, 0.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bscroc.c", 0x235); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D3EC = 0; } @@ -289,7 +290,7 @@ void bscroc_fall_update(void){ func_802ABE70(); func_80299628(0); func_802ABF54(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); switch(D_8037D3EC){ case 0: @@ -301,7 +302,7 @@ void bscroc_fall_update(void){ case 1: if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); baanim_setEndAndDuration(1.0f, 1.0f); D_8037D3EC = 2; } @@ -348,12 +349,12 @@ static void __bscroc_recoil_init(s32 damage){ func_80257F18(sp20, player_position, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D3EC = 0; @@ -383,7 +384,7 @@ static void __bscroc_recoil_update(void){ void __bscroc_recoil_end(void){ func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802ABFBC(); @@ -427,18 +428,18 @@ void bscroc_die_init(void){ animctrl_setDuration(aCtrl, 1.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bscroc.c", 0x32b); - func_8029C7F4(1,1,2,3); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); _player_getPosition(player_position); func_80294980(sp20); func_80257F18(sp20, player_position, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); D_8037D3E0 = 250.0f; - func_80297970(D_8037D3E0); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - player_setYVelocity(420.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D3E0); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(420.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); baMarker_collisionOff(); func_80292E48(); @@ -453,7 +454,7 @@ void bscroc_die_init(void){ void bscroc_die_update(void){ enum bs_e next_state = 0; func_802ABE70(); - func_80297970(D_8037D3E0); + baphysics_set_target_horizontal_velocity(D_8037D3E0); func_80299628(0); switch(D_8037D3EC){ case 0: @@ -461,7 +462,7 @@ void bscroc_die_update(void){ baanim_setEnd(0.7453f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D3EC = 1; } break; @@ -490,7 +491,7 @@ void bscroc_die_update(void){ void bscroc_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -507,12 +508,12 @@ static void func_802ACF58(void){ sp2C = func_8028B2E8() ? 500.0f : 400.0f; func_802589E4(sp20, yaw_get(), sp2C); sp20[1] = 200.0f; - func_80297A0C(sp20); + baphysics_set_velocity(sp20); } void bscroc_bite_init(void){ baanim_playForDuration_loopStartingAt(ASSET_122_ANIM_BSCROC_BITE, 0.25f, 0.2f); - func_8029C7F4(1,1,1,3); + func_8029C7F4(1,1,1, BA_PHYSICS_LOCKED_ROTATION); func_802ACF58(); D_8037D3F4 = 0; _bscrocHitboxActive = TRUE; @@ -561,8 +562,8 @@ void bscroc_bite_end(void){ void bscroc_eat_bad_init(void){ baanim_playForDuration_once(ASSET_123_ANIM_BSCROC_EAT_BAD, 2.41f); - func_8029C7F4(1,1,2,3); - func_80297970(0.0f); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); } void bscroc_eat_bad_update(void){ @@ -612,7 +613,7 @@ void func_802AD318(void){ void bscroc_eat_good_init(void){ baanim_playForDuration_loopSmooth(ASSET_122_ANIM_BSCROC_BITE, 0.25f); - func_8029C7F4(1,1,1,2); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); baModel_setPostDraw(func_802AD2A8); D_8037D3E8 = assetcache_get(func_80294974()); D_8037D3F0 = 1.0f; @@ -668,8 +669,8 @@ void bscroc_eat_good_end(void){ void func_802AD56C(void){ baanim_playForDuration_loopSmooth(ASSET_E1_ANIM_BSCROC_IDLE, 1.0f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/crouch.c b/src/core2/bs/crouch.c index 892aa997..ae771656 100644 --- a/src/core2/bs/crouch.c +++ b/src/core2/bs/crouch.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D400; @@ -62,16 +63,16 @@ void bscrouch_init(void){ yaw_setVelocityBounded(350.0f, 14.0f); func_8029957C(7); func_8029932C(8.0f); - func_802978DC(3); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); func_8029E3C0(0, 0.7f); func_8029E3C0(1, 0.2f); - _get_velocity(&sp28); + baphysics_get_velocity(sp28); D_8037D400 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); if(140.0f < D_8037D400) func_80299AAC(); if(func_8025801C(sp28, &sp20)) - func_8029797C(sp20); + baphysics_set_target_yaw(sp20); D_8037D404 = 0; } @@ -88,7 +89,7 @@ void bscrouch_update(void){ func_8029E1A8(1); sp30 = ml_map_f(func_8029E270(0), 0.0f, 0.3f, 0.0f, D_8037D400); - func_80297970(sp30); + baphysics_set_target_horizontal_velocity(sp30); if(220.0f < sp30) func_802929F8(); if(160.0f < sp30) diff --git a/src/core2/bs/die.c b/src/core2/bs/die.c index 21ff2bed..dca890d5 100644 --- a/src/core2/bs/die.c +++ b/src/core2/bs/die.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D410; @@ -41,15 +42,15 @@ void bsdie_init(void){ D_8037D410 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D410); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); + baphysics_set_target_horizontal_velocity(D_8037D410); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(2); - func_802978DC(3); - player_setYVelocity(510.0f); - gravity_set(-1400.0f); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1400.0f); pitch_setAngVel(1000.0f, 12.0f); func_8029E070(1); func_8029151C(0xd); @@ -64,14 +65,14 @@ void bsdie_init(void){ void bsdie_update(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); enum bs_e sp28 = 0; - func_80297970(D_8037D410); + baphysics_set_target_horizontal_velocity(D_8037D410); func_80299628(0); switch(D_8037D414){ case 0://L802AE0B8 if(_bsdie_802ADE00()){ animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); func_80299DB8(); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.0f, 18000); rumbleManager_80250D94(1.0f, 1.0f, 0.4f); @@ -124,7 +125,7 @@ void bsdie_update(void){ void bsdie_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); func_8029E070(0); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/droneenter.c b/src/core2/bs/droneenter.c index ac332c04..c1bbe4a8 100644 --- a/src/core2/bs/droneenter.c +++ b/src/core2/bs/droneenter.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + enum bsdroneenter_state_e{ BSDRONEENTER_SUBSTATE_0_UNINITIALIZED, @@ -108,7 +110,7 @@ void bsDroneEnter_init(void) { func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1, 1, 3, 7); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); func_80294378(6); __bsDroneEnter_init(); bsDroneEnterSubstate = BSDRONEENTER_SUBSTATE_0_UNINITIALIZED; diff --git a/src/core2/bs/dronegoto.c b/src/core2/bs/dronegoto.c index 04b47964..7cbf5cac 100644 --- a/src/core2/bs/dronegoto.c +++ b/src/core2/bs/dronegoto.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -void func_80297BB8(f32); +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D440; @@ -34,11 +35,11 @@ void func_802AEB60(s32 arg0){ } void func_802AEC08(void){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); } void func_802AEC28(void){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); if(func_8028B2E8() || player_inWater()) func_802AEB60(2); } @@ -52,9 +53,9 @@ void func_802AEC78(void){ func_8029BC60(&sp1C, &sp2C); baanim_playForDuration_loopSmooth(sp1C, sp2C); func_802925F8(&sp20, &sp2C); - func_80297BC4(&sp20); - func_80297BB8(sp2C); - func_8029C7F4(1,1,3,0xC); + baphysics_set_goto_position(&sp20); + baphysics_set_goto_duration(sp2C); + func_8029C7F4(1,1,3,BA_PHYSICS_GOTO); func_8029436C(1); D_8037D441 = 0; } @@ -64,7 +65,7 @@ void func_802AECE4(void){ f32 sp20[3]; AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - _get_velocity(&sp20); + baphysics_get_velocity(sp20); if(func_8025801C(sp20, &sp2C)){ yaw_setIdeal(sp2C); } @@ -77,7 +78,7 @@ void func_802AECE4(void){ animctrl_start(aCtrl, "bsdronegoto.c", 0x9d); } - if(func_80297C48() && D_8037D441 == 0){ + if(baphysics_goto_done() && D_8037D441 == 0){ D_8037D441++; func_80292768(); } diff --git a/src/core2/bs/dronelook.c b/src/core2/bs/dronelook.c index 9678720f..13017231 100644 --- a/src/core2/bs/dronelook.c +++ b/src/core2/bs/dronelook.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern f32 func_8029B2D0(void); @@ -18,9 +19,9 @@ void bsDroneLook_init(void) { func_80299D2C(SFX_12D_CAMERA_ZOOM_CLOSEST, 1.2f, 12000); func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); - func_80297A0C(0); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); ncDynamicCamera_enterFirstPerson(); __bsDroneLook_getEyePos(eye_position); ncFirstPersonCamera_setZoomedOutPosition(eye_position); @@ -42,6 +43,7 @@ void bsDroneLook_update(void) { next_state = 0; dt = time_getDelta(); if (ncFirstPersonCamera_getState() == 2) { + //camera is in "idle" state ncFirstPersonCamera_getZoomedInRotation(eye_rotation); eye_rotation[0] -= func_8029B2DC() * 90.0f * dt; eye_rotation[1] -= func_8029B2D0() * 90.0f * dt; @@ -49,10 +51,13 @@ void bsDroneLook_update(void) { eye_rotation[0] = (eye_rotation[0] > 180.0f) ? ml_max_f(305.0f, eye_rotation[0]) : ml_min_f(70.0f, eye_rotation[0]); ncFirstPersonCamera_setZoomedOutRotation(eye_rotation); yaw_setIdeal(eye_rotation[1] + 180.0f); + exit_first_person = FALSE; + // 1st person cancelled via input if (button_pressed(BUTTON_B) || button_pressed(BUTTON_A) || button_pressed(BUTTON_C_UP)) { exit_first_person = TRUE; } + // 1st person cancelled via entering water if (player_inWater()) { if (player_getTransformation() == TRANSFORM_1_BANJO && func_8028EE84() == BSWATERGROUP_0_NONE) { exit_first_person += TRUE; diff --git a/src/core2/bs/dronevanish.c b/src/core2/bs/dronevanish.c index 0d6cf7c8..2ef91e5f 100644 --- a/src/core2/bs/dronevanish.c +++ b/src/core2/bs/dronevanish.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ struct { ParticleEmitter *unk0; @@ -93,7 +95,7 @@ void bsDroneVanish_init(void){ func_8029BCF8(&anim_id, &anim_duration); baanim_playForDuration_loopSmooth(anim_id, anim_duration); - func_8029C7F4(1,1,3,7); + func_8029C7F4(1,1,3, BA_PHYSICS_FREEZE); func_80294378(6); __bsDroneVanish_init(); D_8037D468 = 0; diff --git a/src/core2/bs/dronexform.c b/src/core2/bs/dronexform.c index 8f3987c5..6718856e 100644 --- a/src/core2/bs/dronexform.c +++ b/src/core2/bs/dronexform.c @@ -1,10 +1,11 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void player_setYPosition(f32); extern void yaw_applyIdeal(void); -extern void func_802978DC(int); extern f32 func_80257A44(f32, f32); extern f32 cosf(f32); extern f32 ml_remainder_f(f32, f32); @@ -260,14 +261,14 @@ static void __bsdronexform_setState(int next_state){ func_802AFBA0(180.0f); func_802AFBAC(0.04f); func_802B01B0(0.05f); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); func_8029E3C0(0, 2.8f); FUNC_8030E624(SFX_17E_MUMBO_TRANSFORMATION_01, 1.0f, 15000); break; case 2:// 802B02A8 func_8029E3C0(0, 0.5f); - func_802978DC(0xb); + baphysics_set_type(BA_PHYSICS_TRANSFORM); break; case 3:// 802B02C4 @@ -314,7 +315,7 @@ static void __bsdronexform_setState(int next_state){ case 9:// 802B0438 D_8037D470.unk1C = 0; func_8029E3C0(0, 0.7f); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); break; } } @@ -324,9 +325,9 @@ void bsdronexform_init(void){ enum asset_e sp18; func_8029BCAC(&sp18, &sp1C); baanim_playForDuration_loopSmooth(sp18, sp1C); - func_8029C7F4(1,1,3,7); - func_80297A0C(0); - func_80297930(0); + func_8029C7F4(1,1,3, BA_PHYSICS_FREEZE); + baphysics_set_velocity(0); + baphysics_set_target_velocity(0); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80294378(6); diff --git a/src/core2/bs/jig.c b/src/core2/bs/jig.c index 15451e66..f412063a 100644 --- a/src/core2/bs/jig.c +++ b/src/core2/bs/jig.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D4B0; u8 D_8037D4B1; @@ -28,8 +30,8 @@ void bsjig_jiggy_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjig.c", 0x7f); yaw_setIdeal(func_8029B41C()); //face camera - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8024BD08(0); func_8025A2FC(0,0xfa0); tmp = (item_getCount(ITEM_E_JIGGY) == 9); @@ -169,8 +171,8 @@ void bsjig_notedoor_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjig.c", 0x14d); yaw_setIdeal(func_8029B41C()); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); if(bs_getPrevState() != BS_44_JIG_JIGGY){ func_8024BD08(0); func_8025A2FC(0,0xfa0); diff --git a/src/core2/bs/jump.c b/src/core2/bs/jump.c index 10807ba0..9906d298 100644 --- a/src/core2/bs/jump.c +++ b/src/core2/bs/jump.c @@ -5,10 +5,9 @@ #include "core2/ba/model.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + f32 func_80294438(void); -void func_8029797C(f32); -void func_802979AC(f32, f32); -f32 func_80297A64(void); void func_80299B58(f32, f32); f32 func_8029B2E8(void); f32 func_8029B33C(void); @@ -59,19 +58,19 @@ void bsjump_init(void){ animctrl_setSubRange(aCtrl, 0.0f, 0.5042f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bsjump.c", 0x95); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f){ yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B6FA8(); - func_802979AC(yaw_getIdeal(), func_80297A64()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); if(D_8037D4C1){ - player_setYVelocity(D_80364CE4); + baphysics_set_vertical_velocity(D_80364CE4); } else { - player_setYVelocity(D_80364CD0); + baphysics_set_vertical_velocity(D_80364CD0); } - gravity_set(D_80364CD4); + baphysics_set_gravity(D_80364CD4); D_8037D4C0 = 0; if(D_8037D4C2){ func_8030E6D4(SFX_33_BANJO_AHOO); @@ -91,14 +90,14 @@ void bsjump_update(void){ func_8029C348(); if(miscflag_isTrue(0xf)){ - func_802978A4(); + baphysics_reset_horizontal_velocity(); }else{ func_802B6FA8(); } - _get_velocity(velocity); + baphysics_get_velocity(velocity); if((button_released(BUTTON_A) && 0.0f < velocity[1] && !D_8037D4C2) || !can_control_jump_height()){ - gravity_reset(); + baphysics_reset_gravity(); } switch(D_8037D4C0){ @@ -166,15 +165,15 @@ void bsjump_end(void){ ability_use(0); if(bs_getNextState() != BS_11_BPECK) - gravity_reset(); + baphysics_reset_gravity(); } void bsjump_fall_init(void){ AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); int sp20; - if(miscflag_isTrue(7) && 700.0f < _get_vertVelocity()) - player_setYVelocity(700.0f); + if(miscflag_isTrue(7) && 700.0f < baphysics_get_vertical_velocity()) + baphysics_set_vertical_velocity(700.0f); sp20 = (bs_getPrevState() == BS_12_BFLIP)? 0 : 1; animctrl_reset(aCtrl); @@ -183,7 +182,7 @@ void bsjump_fall_init(void){ animctrl_setTransitionDuration(aCtrl, 0.3f); animctrl_setDuration(aCtrl, 0.38f); animctrl_start(aCtrl, "bsjump.c", 0x188); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); D_8037D4C0 = 0; } @@ -193,11 +192,11 @@ void bsjump_fall_update(void){ f32 player_velocity[3]; if(miscflag_isTrue(0xf)) - func_802978A4(); + baphysics_reset_horizontal_velocity(); else func_802B6FA8(); - _get_velocity(player_velocity); + baphysics_get_velocity(player_velocity); switch(D_8037D4C0){ case 0://L802B17B8 @@ -264,12 +263,12 @@ void func_802B1928(void) { baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(3); - func_8029797C(yaw_getIdeal()); - func_80297970(60.0f); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364CDC); - gravity_set(D_80364CE0); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_target_horizontal_velocity(60.0f); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364CDC); + baphysics_set_gravity(D_80364CE0); func_80294378(6); D_8037D4C0 = 0; func_802B1100(); @@ -282,7 +281,7 @@ void func_802B1A54(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); - _get_velocity(velocity); + baphysics_get_velocity(velocity); if (velocity[1] < 0.0f) { func_80294378(1); } @@ -321,7 +320,7 @@ void func_802B1A54(void) { void func_802B1BCC(void){ func_80294378(1); - gravity_reset(); + baphysics_reset_gravity(); } void func_802B1BF4(void) { @@ -345,9 +344,9 @@ void func_802B1BF4(void) { baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(6); - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_type(BA_PHYSICS_AIRBORN); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); D_8037D4C0 = 0; baMarker_collisionOff(); } @@ -359,7 +358,7 @@ void func_802B1CF8(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); - _get_velocity(velocity); + baphysics_get_velocity(velocity); switch (D_8037D4C0) { case 0: if (func_8028B254(90)) { @@ -388,7 +387,7 @@ bool bsjump_jumpingFromWater(void){ void bsjump_tumble_init(void){ baanim_playForDuration_loop(ASSET_68_ANIM_BSJUMP_TUMBLE, 0.35f); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); baModel_setYDisplacement(60.0f); if(func_80293234() == 1){ func_8029E3C0(0, 0.5f); diff --git a/src/core2/bs/ow.c b/src/core2/bs/ow.c index 00c7b131..ae4b1034 100644 --- a/src/core2/bs/ow.c +++ b/src/core2/bs/ow.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + void func_802B37DC(void); /* .bss */ @@ -54,7 +56,7 @@ void bsow_update(void) { if (func_8028B2E8() != 0) { sp1C = BS_2_WALK_SLOW; } - if ((player_inWater() != 0) && (_get_vertVelocity() <= 0.0f)) { + if ((player_inWater() != 0) && (baphysics_get_vertical_velocity() <= 0.0f)) { sp1C = BS_4C_LANDING_IN_WATER; } @@ -65,7 +67,7 @@ void bsow_end(void){ func_802B35DC(); func_802B1FD0(0); func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); } diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index 21b0ab8b..e87df0ec 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -4,6 +4,7 @@ #include "core2/ba/model.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern void baanim_playForDuration_loop(s32, f32); extern void func_8029AD68(f32, s32); @@ -43,10 +44,10 @@ void func_802B223C(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, D_80364CF0, D_80364CF4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364CF0, D_80364CF4)); } void func_802B229C(void) { @@ -74,8 +75,8 @@ int bspumpkin_inSet(s32 move_indx){ void bspumpkin_idle_init(void) { baanim_playForDuration_loop(ASSET_A0_ANIM_BSPUMPKIN_WALK, 0.8f); - func_8029C7F4(1, 1, 1, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -118,7 +119,7 @@ void bspumpkin_walk_init(void) { animctrl_setDuration(anim_ctrl, 0.8f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bspumpkin.c", 0x11D); - func_8029C7F4(2, 1, 1, 2); + func_8029C7F4(2, 1, 1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364CF0, D_80364CF4, D_80364CF8, D_80364CFC); func_802900B4(); } @@ -130,7 +131,7 @@ void bspumpkin_walk_update(void) { next_state = 0; func_802B223C(); func_8029AD68(0.3f, 4); - if ((func_8029B300() == 0) && func_80297C04(1.0f)) { + if ((func_8029B300() == 0) && baphysics_is_slower_than(1.0f)) { next_state = BS_48_PUMPKIN_IDLE; } if (func_8028B094()) { @@ -157,15 +158,15 @@ void bspumpkin_jump_init(void) { animctrl_setDuration(anim_ctrl, 1.2f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_ONCE); animctrl_start(anim_ctrl, "bspumpkin.c", 0x16C); - func_8029C7F4(1, 1, 3, 6); + func_8029C7F4(1, 1, 3, BA_PHYSICS_AIRBORN); if (func_8029B2E8() != 0.0f) { yaw_setIdeal(func_8029B33C()); } - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B223C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364D00); - gravity_set(D_80364D04); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364D00); + baphysics_set_gravity(D_80364D04); func_802B21D0(); D_8037D4E0 = 0; } @@ -178,13 +179,13 @@ void bspumpkin_jump_update(void) { next_state = 0; anim_ctrl = baanim_getAnimCtrlPtr(); func_802B223C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if (button_released(BUTTON_A) && sp1C[1] > 0.0f) { - gravity_reset(); + baphysics_reset_gravity(); } switch (D_8037D4E0) { case 0: - if (_get_vertVelocity() < 0.0f) { + if (baphysics_get_vertical_velocity() < 0.0f) { if (func_8028B254(130)) { func_80292E48(); animctrl_setDuration(anim_ctrl, 0.7f); @@ -218,7 +219,7 @@ void bspumpkin_jump_update(void) { case 3: if (animctrl_isStopped(anim_ctrl)) { func_80292EA4(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); next_state = BS_48_PUMPKIN_IDLE; } break; @@ -236,7 +237,7 @@ void bspumpkin_jump_update(void) { void bspumpkin_jump_end(void){ func_80292EA4(); - gravity_reset(); + baphysics_reset_gravity(); func_802B229C(); } @@ -251,7 +252,7 @@ void bspumpkin_fall_init(void) { animctrl_setDuration(anim_ctrl, 0.7f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_STOPPED); animctrl_start(anim_ctrl, "bspumpkin.c", 0x1F1); - func_8029C7F4(1, 1, 3, 6); + func_8029C7F4(1, 1, 3, BA_PHYSICS_AIRBORN); D_8037D4E0 = 0; } @@ -266,7 +267,7 @@ void bspumpkin_fall_update(void) { if (D_8037D4E4) { func_802B223C(); } - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D4E0) { case 0: if (func_8028B254(130)) { @@ -278,7 +279,7 @@ void bspumpkin_fall_update(void) { case 1: if (func_8028B2E8()) { func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); animctrl_setSubRange(anim_ctrl, 0.0f, 1.0f); animctrl_setDuration(anim_ctrl, 1.2f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_ONCE); @@ -306,7 +307,7 @@ void func_802B2BF0(void) { func_8029656C(D_8037D4E8); func_8028FAB0(D_8037D4E8); baanim_playForDuration_loop(ASSET_A0_ANIM_BSPUMPKIN_WALK, 0.8f); - func_8029C7F4(1, 1, 2, 7); + func_8029C7F4(1, 1, 2, BA_PHYSICS_FREEZE); func_80294378(6); func_8029E3C0(0, 0.0f); } @@ -357,12 +358,12 @@ void __bspumpkin_bounce_init(s32 arg0) { func_80257F18(sp20, plyr_pos, &sp38); yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(200.0f); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(200.0f); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); baMarker_collisionOff(); func_80292E48(); D_8037D4E0 = 0; @@ -394,7 +395,7 @@ void __bspumpkin_bounce_update(void) { void __bspumpkin_bounce_end(void) { func_80297CA8(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802B229C(); @@ -446,12 +447,12 @@ void bspumpkin_die_init(void) { D_8037D4F4 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D4F4); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1, 1, 2, 3); - player_setYVelocity(510.0f); - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D4F4); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(510.0f); + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xD); ncDynamicCamD_func_802BF2C0(30.0f); @@ -463,7 +464,7 @@ void bspumpkin_die_init(void) { } void bspumpkin_die_update(void){ - func_80297970(D_8037D4F4); + baphysics_set_target_horizontal_velocity(D_8037D4F4); func_80299628(0); switch(D_8037D4E0){ case 0://L802B3284 @@ -485,7 +486,7 @@ void bspumpkin_die_update(void){ case 2://L802B3300 if(baanim_isStopped()) { - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); baanim_setEnd(0.355f); D_8037D4E0 = 3; } @@ -524,7 +525,7 @@ void bspumpkin_die_update(void){ void bspumpkin_die_end(void) { func_802B229C(); func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80292EA4(); @@ -533,8 +534,8 @@ void bspumpkin_die_end(void) { void func_802B34A0(void) { baanim_playForDuration_loopSmooth(0xA0, 0.8f); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B3A50(); } diff --git a/src/core2/bs/rebound.c b/src/core2/bs/rebound.c index 70622e59..0b0264ab 100644 --- a/src/core2/bs/rebound.c +++ b/src/core2/bs/rebound.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern f32 func_80296548(void); extern f32 func_8029653C(void); -extern f32 func_80297A4C(void); extern f32 func_8029B56C(f32, f32, f32, f32); /* .bss */ @@ -18,7 +19,7 @@ void func_802B35D0(s32 arg0){ void func_802B35DC(void) { if (D_8037D500 == 1) { - func_80297A0C(0); + baphysics_set_velocity(0); } } @@ -37,31 +38,31 @@ void func_802B360C(void) { func_80257F18(sp38, sp2C, &sp28); if ((sp1C == 0xE) || (sp1C == 0x10)) { func_802B35D0(1); - func_8029C7F4(1, 1, 2, 1); + func_8029C7F4(1, 1, 2, BA_PHYSICS_UNK1); yaw_setIdeal(mlNormalizeAngle(sp28)); - gravity_set(func_80296548()); + baphysics_set_gravity(func_80296548()); sp20 = func_8029653C(); - sp24 = func_8029B56C(sp2C[1], sp38[1], sp20, func_80297A4C()); + sp24 = func_8029B56C(sp2C[1], sp38[1], sp20, baphysics_get_gravity()); ml_vec3f_diff_copy(sp44, sp38, sp2C); D_8037D504 = sp24; sp44[0] /= sp24; sp44[1] /= sp24; sp44[2] /= sp24; sp44[1] = sp20; - func_80297A0C(sp44); + baphysics_set_velocity(sp44); func_8029E3C0(6, sp24); } else { func_802B35D0(0); func_80298760(sp1C); yaw_setIdeal(mlNormalizeAngle(sp28 + 180.0f)); - func_80297970(func_802987D4()); - func_8029797C(sp28); - func_802979AC(sp28, func_80297A64()); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); - func_8029C7F4(1, 1, 2, 3); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp28); + baphysics_set_horizontal_velocity(sp28, baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); + func_8029C7F4(1, 1, 2, BA_PHYSICS_LOCKED_ROTATION); if (func_802987B4() == 2) { - func_802978DC(6); + baphysics_set_type(BA_PHYSICS_AIRBORN); } } yaw_applyIdeal(); @@ -72,11 +73,11 @@ void func_802B37DC(void) { if (D_8037D500 != 0) { if ((D_8037D500 == 1) && func_8029E1A8(6)) { - _get_velocity(velocity); + baphysics_get_velocity(velocity); velocity[0] = 0.0f; velocity[2] = 0.0f; - func_80297A0C(velocity); - func_80297970(0.0f); + baphysics_set_velocity(velocity); + baphysics_set_target_horizontal_velocity(0.0f); } } else if (func_802987B4() == 2) { func_802B6FA8(); @@ -132,6 +133,6 @@ void func_802B3954(void) { void func_802B3A20(void) { func_802B35DC(); - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); } diff --git a/src/core2/bs/rest.c b/src/core2/bs/rest.c index 973528ec..328c7e10 100644 --- a/src/core2/bs/rest.c +++ b/src/core2/bs/rest.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_802B3A50(void) { f32 sp34; @@ -40,8 +41,8 @@ void func_802B3AAC(enum asset_e anim_id, f32 anim_duration) { } else { baanim_playForDuration_loopSmooth(anim_id, anim_duration); } - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802B3A50(); } diff --git a/src/core2/bs/sled.c b/src/core2/bs/sled.c index 77c772d0..7c39fa2f 100644 --- a/src/core2/bs/sled.c +++ b/src/core2/bs/sled.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + ActorMarker *bssled_gSledMarker; @@ -25,8 +27,8 @@ void func_802B3F60(void){ void bssled_init(void){ func_802B3F20(); baanim_playForDuration_loopSmooth(ASSET_228_ANIM_BANJO_SLED, 1.8f); - func_8029C7F4(1, 1, 3, 7); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_80294A8C(0); func_80294378(6); } diff --git a/src/core2/bs/slide.c b/src/core2/bs/slide.c index 4d8de3fb..e96f53be 100644 --- a/src/core2/bs/slide.c +++ b/src/core2/bs/slide.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ s32 D_8037D520; s32 D_8037D524; @@ -66,11 +68,11 @@ void bsslide_init(void){ animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_setDuration(aCtrl, 1.0f); animctrl_start(aCtrl, "bsslide.c", 0x7f); - func_8029C7F4(1,1,3,3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal() ,func_80297A64()); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal() ,baphysics_get_target_horizontal_velocity()); pitch_setAngVel(800.0f, 8.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_80299AAC(); D_8037D524 = 0; D_8037D528 = 1.0f; @@ -95,10 +97,10 @@ void bsslide_update(void){ yaw_setIdeal(sp2C); pitch_setIdeal(sp28); } - func_80297970(ml_map_f(sp28,20.0f, 60.0f, 550.0f, 700.0f)); - func_8029797C(sp2C); + baphysics_set_target_horizontal_velocity(ml_map_f(sp28,20.0f, 60.0f, 550.0f, 700.0f)); + baphysics_set_target_yaw(sp2C); }else{ - func_80297970(500.0f); + baphysics_set_target_horizontal_velocity(500.0f); } func_802B40D0(); }else{//L802B44C4 diff --git a/src/core2/bs/splat.c b/src/core2/bs/splat.c index 646b663c..e63de900 100644 --- a/src/core2/bs/splat.c +++ b/src/core2/bs/splat.c @@ -3,6 +3,8 @@ #include "variables.h" #include "bsint.h" +#include "core2/ba/physics.h" + void func_80292900(f32, f32); void rumbleManager_80250D94(f32, f32, f32); @@ -21,7 +23,7 @@ void func_802B4570(void) { void bssplat_init(void){ s32 sp1C; baanim_playForDuration_onceSmooth(ASSET_149_ANIM_BSSPLAT, 1.1f); - func_8029C7F4(1,1,3,3); + func_8029C7F4(1,1,3, BA_PHYSICS_LOCKED_ROTATION); func_802931DC(&sp1C); func_803463D4(ITEM_14_HEALTH, -sp1C); if(func_8029CEB0() == 4){ @@ -45,12 +47,12 @@ void bssplat_init(void){ void bssplat_update(void){ enum bs_e sp1C = 0; AnimCtrl *aCtrl = baanim_getAnimCtrlPtr(); - func_80297970(ml_max_f(0.0f, func_80297A64() - 15.0f)); + baphysics_set_target_horizontal_velocity(ml_max_f(0.0f, baphysics_get_target_horizontal_velocity() - 15.0f)); switch (D_8037D530) { case 0://L802B4760 - if(140.0f < func_80297A64()) + if(140.0f < baphysics_get_target_horizontal_velocity()) func_802929F8(); if(func_8028B094()) diff --git a/src/core2/bs/stand.c b/src/core2/bs/stand.c index 3a886a79..ae3c4fc3 100644 --- a/src/core2/bs/stand.c +++ b/src/core2/bs/stand.c @@ -3,6 +3,7 @@ #include "variables.h" #include "bsint.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" extern f32 func_8029B2E8(void); void yaw_setVelocityBounded(f32, f32); @@ -91,8 +92,8 @@ void bsstand_init(void){ climbRelease(); baanim_playForDuration_once(ASSET_6F_ANIM_BSSTAND_IDLE, 5.5f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802900B4(); D_8037D540 = 0; D_8037D544 = 0; @@ -279,8 +280,8 @@ void bsstand_end(void){ //bsStand_Land_init void bsstand_landing_init(void){ - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); } //bsStand_Land_update diff --git a/src/core2/bs/surf.c b/src/core2/bs/surf.c index 526b5da2..89671a04 100644 --- a/src/core2/bs/surf.c +++ b/src/core2/bs/surf.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ s32 D_8037D560; @@ -15,8 +17,8 @@ void func_802B5FD0(void) { animctrl_setDuration(anim_ctrl, 1.8f); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bssurf.c", 0x33); - func_8029C7F4(1, 1, 3, 2); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D560 = 1; } diff --git a/src/core2/bs/swim.c b/src/core2/bs/swim.c index 076279e6..b0f693d0 100644 --- a/src/core2/bs/swim.c +++ b/src/core2/bs/swim.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern void func_80295328(s32, f32); @@ -66,10 +67,10 @@ void func_802B55DC(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, bsSwimHorzVelocityMin, bsSwimHorzVelocityMax)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsSwimHorzVelocityMin, bsSwimHorzVelocityMax)); } void func_802B563C(void) { @@ -78,8 +79,8 @@ void func_802B563C(void) { } else if (map_get() == MAP_46_CCW_WINTER) { func_8035644C(FILEPROG_DD_HAS_TOUCHED_ICY_WATER); } - gravity_set(100.0f); - func_80297BF8(133.33f); + baphysics_set_gravity(100.0f); + baphysics_set_terminal_velocity(133.33f); func_8029B324(0, 0.03f); func_8029B324(1, 1.0f); func_80294378(3); @@ -88,8 +89,8 @@ void func_802B563C(void) { void func_802B56D4(void) { if (!bsswim_inset(bs_getNextState())) { - func_80297B94(); - gravity_reset(); + baphysics_reset_terminal_velocity(); + baphysics_reset_gravity(); func_8029B0C0(); func_80294378(1); } @@ -138,9 +139,9 @@ void func_802B5774(void) { animctrl_setDuration(anim_ctrl, 1.2f); animctrl_start(anim_ctrl, "bsswim.c", 0xFD); } - func_8029C7F4(1, 3, 3, 2); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NORMAL); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_802B563C(); bsSwimCurrentAnimation = 0; } @@ -212,7 +213,7 @@ void func_802B5B18(void) { yaw_setUpdateState(3); yaw_setVelocityBounded(500.0f, 5.0f); func_8029957C(1); - func_802978DC(2); + baphysics_set_type(BA_PHYSICS_NORMAL); } void func_802B5C40(void) { @@ -280,9 +281,9 @@ void func_802B5E30(void) { void func_802B5E8C(void) { baanim_playForDuration_loopSmooth(0x57, 1.2f); - func_8029C7F4(1, 3, 3, 2); + func_8029C7F4(1, 3, 3, BA_PHYSICS_NORMAL); yaw_setVelocityBounded(500.0f, 5.0f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); func_802B563C(); func_802B5E30(); } diff --git a/src/core2/bs/talk.c b/src/core2/bs/talk.c index 1e8229ca..2e052bf3 100644 --- a/src/core2/bs/talk.c +++ b/src/core2/bs/talk.c @@ -2,6 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" #include "core2/yaw.h" /* .bss */ @@ -26,8 +27,8 @@ void bstalk_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(YAW_STATE_1_DEFAULT); func_8029957C(3); - func_802978DC(2); - func_80297970(0.0f); + baphysics_set_type(BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); bsTalkStayInState = TRUE; } diff --git a/src/core2/bs/throw.c b/src/core2/bs/throw.c index f932ba1a..c6e7f429 100644 --- a/src/core2/bs/throw.c +++ b/src/core2/bs/throw.c @@ -3,6 +3,7 @@ #include "variables.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" extern ActorMarker *carriedobj_getMarker(void); @@ -22,9 +23,9 @@ void bsthrow_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_802978DC(3); - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); D_8037D580 = 0; } diff --git a/src/core2/bs/timeout.c b/src/core2/bs/timeout.c index 4c628f00..8012eae5 100644 --- a/src/core2/bs/timeout.c +++ b/src/core2/bs/timeout.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_80292E80(s32, f32); @@ -9,8 +10,8 @@ void ncDynamicCamD_func_802BF2C0(f32); void func_802B6270(void){ baanim_playForDuration_once(ASSET_77_ANIM_BSTIMEOUT, 3.2f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xd); yaw_setIdeal(func_8029B41C() + 35.0f); ncDynamicCamD_func_802BF2C0(80.0f); @@ -50,8 +51,8 @@ void func_802B63F8(void){ func_8029C848(aCtrl); animctrl_setPlaybackType(aCtrl, ANIMCTRL_LOOP); animctrl_start(aCtrl, "bstimeout.c", 0x7e); - func_8029C7F4(1,1,3,7); - func_80297970(0.0f); + func_8029C7F4(1,1,3,BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xd); yaw_setIdeal(func_8029B41C() + 35.0f); ncDynamicCamD_func_802BF2C0(80.0f); diff --git a/src/core2/bs/turn.c b/src/core2/bs/turn.c index 24d375ba..2e16695b 100644 --- a/src/core2/bs/turn.c +++ b/src/core2/bs/turn.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" /* .data */ -f32 D_8037D590; +f32 bsturn_starting_horizontal_velocity; s32 D_8037D594; /* .code */ @@ -21,9 +22,9 @@ void bsturn_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(2); - func_802978DC(3); - _get_velocity(&sp28); - D_8037D590 = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + baphysics_get_velocity(sp28); + bsturn_starting_horizontal_velocity = gu_sqrtf(sp28[0]*sp28[0] + sp28[2]*sp28[2]); func_8030EBC8(SFX_19_BANJO_LANDING_08, 0.95f, 1.05f, 0x7530, 0x7d00); D_8037D594 = 0; } @@ -31,7 +32,7 @@ void bsturn_init(void){ void bsturn_update(void){ enum bs_e sp2C = 0; - func_80297970(ml_map_f(animctrl_getAnimTimer(baanim_getAnimCtrlPtr()), 0.18f, 1.0f, D_8037D590, 0.0f)); + baphysics_set_target_horizontal_velocity(ml_map_f(animctrl_getAnimTimer(baanim_getAnimCtrlPtr()), 0.18f, 1.0f, bsturn_starting_horizontal_velocity, 0.0f)); D_8037D594++; if(!(D_8037D594 < 6)) @@ -39,13 +40,13 @@ void bsturn_update(void){ switch(D_8037D594){ case -1://L802B68DC - func_802927E0(func_80297A7C() - 10.0f, _get_horzVelocity()*0.88); + func_802927E0(baphysics_get_target_yaw() - 10.0f, baphysics_get_horizontal_velocity()*0.88); break; case 0://L802B691C - func_802927E0(func_80297A7C(), _get_horzVelocity()); + func_802927E0(baphysics_get_target_yaw(), baphysics_get_horizontal_velocity()); break; case 1://L802B6940 - func_802927E0(func_80297A7C() + 10.0f, _get_horzVelocity()*0.88); + func_802927E0(baphysics_get_target_yaw() + 10.0f, baphysics_get_horizontal_velocity()*0.88); break; }//L802B6978 diff --git a/src/core2/bs/twirl.c b/src/core2/bs/twirl.c index b8f72663..b7faed24 100644 --- a/src/core2/bs/twirl.c +++ b/src/core2/bs/twirl.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" - +#include "core2/ba/physics.h" /* .bss */ f32 D_8037D5A0; u8 D_8037D5A4; @@ -25,11 +25,11 @@ void bstwirl_init(void){ baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); yaw_setUpdateState(1); func_8029957C(3); - func_8029797C(yaw_getIdeal()); - func_802979AC(yaw_getIdeal(), func_80297A64()); - func_802978DC(3); - D_8037D5A0 = func_80297A64(); - func_80297970(600.0f); + baphysics_set_target_yaw(yaw_getIdeal()); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_type(BA_PHYSICS_LOCKED_ROTATION); + D_8037D5A0 = baphysics_get_target_horizontal_velocity(); + baphysics_set_target_horizontal_velocity(600.0f); func_80299CF4(SFX_32_BANJO_EGHEE, 1.0f, 0x6590); _bstwirlHitboxActive = TRUE; func_8029E3C0(0, 0.01f); @@ -54,7 +54,7 @@ void bstwirl_update(void){ } if(animctrl_isAt(aCtrl, 0.8011f)){ animctrl_setDuration(aCtrl, 2.5f); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); _bstwirlHitboxActive = 0; D_8037D5A4 = 3; } diff --git a/src/core2/bs/walk.c b/src/core2/bs/walk.c index 586e77c8..161b85ec 100644 --- a/src/core2/bs/walk.c +++ b/src/core2/bs/walk.c @@ -3,18 +3,15 @@ #include "variables.h" #include "animation.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" void baanim_setDurationRange(f32, f32); -f32 _get_horzVelocity(void); void func_802927E0(f32, f32); f32 func_8029B2E8(void); -int func_80297C04(f32); void func_8029AD28(f32, s32); -f32 func_80297AF0(void); void baanim_scaleDuration(f32); f32 func_8029B30C(void); f32 ml_interpolate_f(f32, f32, f32); -f32 func_80297A64(void); void func_80299594(s32, f32); // .data @@ -49,27 +46,27 @@ void func_802B6D00(void){ sp18 = func_8029B300(); if(func_8028B128()){ if(sp18 == 0){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); }else{//L802B6D48 - func_80297970(ml_interpolate_f(func_8029B2E8(), bsWalkMinMudVelocity, bsWalkMaxMudVelocity)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(func_8029B2E8(), bsWalkMinMudVelocity, bsWalkMaxMudVelocity)); } } else{//L802B6D78 switch(sp18){ case 0://802B6D98 - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); break; case 1://802B6DAC - func_80297970(ml_interpolate_f(sp1C, bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold)); break; case 2://802B6DD0 - func_80297970(ml_interpolate_f(sp1C, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold)); break; case 3://802B6DF4 - func_80297970(ml_interpolate_f(sp1C, bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold)); break; case 4://802B6E18 - func_80297970(ml_interpolate_f(sp1C, bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity)); break; } }//L802B6E34 @@ -77,7 +74,7 @@ void func_802B6D00(void){ void func_802B6E44(void){ if(func_8028B394()){ - baanim_scaleDuration(ml_map_f(func_80297AF0(), 0.0f, 1.0f, 0.5f, 0.9f)); + baanim_scaleDuration(ml_map_f(baphysics_get_horizontal_velocity_percentage(), 0.0f, 1.0f, 0.5f, 0.9f)); }else{ baanim_scaleDuration(1.0f); } @@ -98,7 +95,7 @@ int func_802B6EF4(void){ s32 func_802B6F20(s32 arg0){ if(button_pressed(BUTTON_B)){ - if( bsWalkWalkFastWalkVelocityThreshold < func_80297A64()){ + if( bsWalkWalkFastWalkVelocityThreshold < baphysics_get_target_horizontal_velocity()){ if(can_roll()) arg0 = BS_ROLL; }else{//L802B6F74 @@ -132,7 +129,7 @@ void bswalk_creep_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0xe4); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkMinCreepVelocity, bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowestCreepDuration, bsWalkFastestCreepDuration); } @@ -149,7 +146,7 @@ void bswalk_creep_update(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B7160 - if(func_80297C04(1.0f)) + if(baphysics_is_slower_than(1.0f)) next_state = BS_1_IDLE; break; case 2://L802B7180 @@ -205,7 +202,7 @@ void bswalk_slow_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x168); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkCreepSlowWalkVelocityThreshold, bsWalkSlowWalkWalkVelocityThreshold, bsWalkSlowestSlowWalkDuration, bsWalkFastestSlowWalkDuration); } @@ -222,7 +219,7 @@ void bswalk_slow_upate(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B7160 - if(func_80297C04(3.0f)) + if(baphysics_is_slower_than(3.0f)) next_state = BS_1_IDLE; break; case 1://L802B7180 @@ -283,7 +280,7 @@ void bswalk_init(void){ animctrl_setStart(anim_ctrl, start_position); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x1ed); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkSlowWalkWalkVelocityThreshold, bsWalkWalkFastWalkVelocityThreshold, bsWalkSlowestWalkDuration, bsWalkFastestWalkDuration); func_802B6EB0(0.3f); @@ -300,7 +297,7 @@ void bswalk_update(void){ case 0: case 1: case 2: - if(func_80297C04(bsWalkSlowWalkWalkVelocityThreshold) && func_802B6EF4()) + if(baphysics_is_slower_than(bsWalkSlowWalkWalkVelocityThreshold) && func_802B6EF4()) next_state = BS_2_WALK_SLOW; break; case 4: @@ -310,7 +307,7 @@ void bswalk_update(void){ if(func_8028B128()) next_state = BS_WALK_MUD; - if(func_8028B4C4() && bsWalkSkidVelocity < _get_horzVelocity()){ + if(func_8028B4C4() && bsWalkSkidVelocity < baphysics_get_horizontal_velocity()){ next_state = BS_SKID; } @@ -347,7 +344,7 @@ void bswalk_fast_init(void){ switch(bs_getPrevState()){ case 1: case 2://L802B780C - if(_get_horzVelocity() < 200.0f){ + if(baphysics_get_horizontal_velocity() < 200.0f){ func_802927E0(0.0f, 0.0f); } break; @@ -367,7 +364,7 @@ void bswalk_fast_init(void){ animctrl_setStart(anim_ctrl, sp28); animctrl_setPlaybackType(anim_ctrl, ANIMCTRL_LOOP); animctrl_start(anim_ctrl, "bswalk.c", 0x27d); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkWalkFastWalkVelocityThreshold, bsWalkMaxFastWalkVelocity, bsWalkSlowestFastWalkDuration, bsWalkFastestFastWalkDuration); pitch_setAngVel(1000.0f, 12.0f); @@ -386,7 +383,7 @@ void bswalk_fast_update(void){ func_802B6D00(); switch(func_8029B300()){ case 0://L802B79EC - if(func_80297C04(18.0f)) + if(baphysics_is_slower_than(18.0f)) next_state = BS_1_IDLE; if(func_80294F78()) @@ -395,7 +392,7 @@ void bswalk_fast_update(void){ break; case 1: case 2://L802B7A28 - if(func_80297C04(bsWalkSlowWalkWalkVelocityThreshold)) + if(baphysics_is_slower_than(bsWalkSlowWalkWalkVelocityThreshold)) next_state = BS_2_WALK_SLOW; if(func_80294F78()) @@ -403,7 +400,7 @@ void bswalk_fast_update(void){ break; case 3://L802B7A60 - if(func_80297C04(bsWalkWalkFastWalkVelocityThreshold) && func_802B6EF4()) + if(baphysics_is_slower_than(bsWalkWalkFastWalkVelocityThreshold) && func_802B6EF4()) next_state = BS_WALK; if(func_80294F78()) @@ -413,7 +410,7 @@ void bswalk_fast_update(void){ if(func_8028B128()) next_state = BS_WALK_MUD; - if(func_8028B4C4() && bsWalkSkidVelocity < _get_horzVelocity()){ + if(func_8028B4C4() && bsWalkSkidVelocity < baphysics_get_horizontal_velocity()){ next_state = BS_SKID; } @@ -446,7 +443,7 @@ void bswalk_fast_end(void){ void bswalk_mud_init(void){ baanim_playForDuration_loopSmooth(ASSET_B_ANIM_BSWALK_MUD, 0.43f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setDurationRange(0.3f, 1.5f); baanim_setVelocityMapRanges(bsWalkMinMudVelocity, bsWalkMaxMudVelocity, bsWalkSlowestMudDuration, bsWalkFastestMudDuration); } diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 8ea906d4..593e1109 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" + extern void func_8029AD68(f32, s32); extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); @@ -44,10 +46,10 @@ void func_802B7E6C(void) { sp1C = func_8029B30C(); if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp1C, D_80364DC0, D_80364DC4)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp1C, D_80364DC0, D_80364DC4)); } void func_802B7ECC(void) { @@ -70,7 +72,7 @@ void func_802B7F28(void) { sp3C = D_80364DDC; sp40 = func_8029B30C(); func_802B7ECC(); - _get_velocity(sp20); + baphysics_get_velocity(sp20); sp20[1] = 0.0f; if (900.0 < sp20[0] * sp20[0] + sp20[1] * sp20[1] + sp20[2] * sp20[2]) { ml_vec3f_normalize(sp20); @@ -80,10 +82,10 @@ void func_802B7F28(void) { } } if (func_8029B300() == 0) { - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); return; } - func_80297970(ml_interpolate_f(sp40, sp38, sp3C)); + baphysics_set_target_horizontal_velocity(ml_interpolate_f(sp40, sp38, sp3C)); } void func_802B8048(void){ @@ -141,8 +143,8 @@ int bswalrus_inSet(enum bs_e state){ void bswalrus_idle_init(void){ baanim_playForDuration_loopSmooth(ASSET_11F_ANIM_BSWALRUS_IDLE, 4.0f); - func_8029C7F4(1,1,1,2); - func_80297970(0.0f); + func_8029C7F4(1,1,1, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); pitch_setAngVel(1000.0f, 12.0f); roll_setAngularVelocity(1000.0f, 12.0f); func_80293D48(50.0f, 25.0f); @@ -179,7 +181,7 @@ void bswalrus_idle_end(void){ void bswalrus_walk_init(void){ baanim_playForDuration_loopSmooth(ASSET_120_ANIM_BSWALRUS_WALK, 0.8f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364DC0, D_80364DC4, D_80364DC8, D_80364DCC); func_802900B4(); func_802B8110(); @@ -192,7 +194,7 @@ void bswalrus_walk_update(void){ func_802B7E6C(); func_8029AD68(0.3f, 4); - if(func_8029B300() == 0 && func_80297C04(1.0f)) + if(func_8029B300() == 0 && baphysics_is_slower_than(1.0f)) next_state = BS_67_WALRUS_IDLE; if(func_8028B094()) @@ -220,14 +222,14 @@ void bswalrus_jump_init(void){ animctrl_setStart(aCtrl, 0.1); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bswalrus.c", 0x1f8); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B7E6C(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364DD0); - gravity_set(D_80364DD4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364DD0); + baphysics_set_gravity(D_80364DD4); func_802B7E00(); func_802B8110(); D_8037D5C8 = 0; @@ -239,9 +241,9 @@ void bswalrus_jump_update(void){ f32 sp1C[3]; func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch(D_8037D5C8){ case 0://L802B86D8 @@ -279,7 +281,7 @@ void bswalrus_jump_update(void){ case 3://L802B880C func_80299628(0); if(animctrl_isStopped(aCtrl)){ - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); next_state = BS_67_WALRUS_IDLE; } break; @@ -297,7 +299,7 @@ void bswalrus_jump_update(void){ } void bswalrus_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802B8048(); } @@ -309,7 +311,7 @@ void bswalrus_fall_init(void){ animctrl_setDuration(aCtrl, 0.7f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bswalrus.c", 0x284); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); func_802B8110(); D_8037D5C8 = 0; } @@ -321,7 +323,7 @@ void bswalrus_fall_update(void){ func_80299628(0); func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D5C8) { @@ -335,7 +337,7 @@ void bswalrus_fall_update(void){ case 1://L802B89E0 if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); animctrl_setSubRange(aCtrl, 0.0f, 1.0f); animctrl_setDuration(aCtrl, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); @@ -381,12 +383,12 @@ static void __bswalrus_recoil_init(s32 damage){ func_80257F18(sp24, sp30, &sp3C); yaw_setIdeal(mlNormalizeAngle(sp3C + 180.0f)); yaw_applyIdeal(); - func_80297970(func_802987D4()); - func_8029797C(sp3C); - func_802979AC(sp3C, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(func_802987C4()); - gravity_set(func_802987E4()); + baphysics_set_target_horizontal_velocity(func_802987D4()); + baphysics_set_target_yaw(sp3C); + baphysics_set_horizontal_velocity(sp3C, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(func_802987C4()); + baphysics_set_gravity(func_802987E4()); baMarker_collisionOff(); func_80292E48(); func_802B8110(); @@ -404,7 +406,7 @@ static void __bswalrus_recoil_update(void){ } static void __bswalrus_recoil_end(void){ - gravity_reset(); + baphysics_reset_gravity(); baMarker_collisionOn(); func_80292EA4(); func_802B8048(); @@ -455,12 +457,12 @@ void bswalrus_die_init(void){ D_8037D5C4 = 250.0f; yaw_setIdeal(mlNormalizeAngle(sp38 + 180.0f)); yaw_applyIdeal(); - func_80297970(D_8037D5C4); - func_8029797C(sp38); - func_802979AC(sp38, func_80297A64()); - func_8029C7F4(1,1,2,3); - player_setYVelocity(420.0f); //B) - gravity_set(-1200.0f); + baphysics_set_target_horizontal_velocity(D_8037D5C4); + baphysics_set_target_yaw(sp38); + baphysics_set_horizontal_velocity(sp38, baphysics_get_target_horizontal_velocity()); + func_8029C7F4(1,1,2, BA_PHYSICS_LOCKED_ROTATION); + baphysics_set_vertical_velocity(420.0f); //B) + baphysics_set_gravity(-1200.0f); pitch_setAngVel(1000.0f, 12.0f); func_802914CC(0xd); ncDynamicCamD_func_802BF2C0(30.0f); @@ -477,7 +479,7 @@ void bswalrus_die_init(void){ void bswalrus_die_update(void){ enum bs_e next_state = 0; - func_80297970(D_8037D5C4); + baphysics_set_target_horizontal_velocity(D_8037D5C4); func_80299628(0); switch(D_8037D5C8){ case 0://L802B8F54 @@ -485,7 +487,7 @@ void bswalrus_die_update(void){ baanim_setEnd(1.0f); FUNC_8030E624(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 18000); FUNC_8030E624(SFX_39_BANJO_AYE_2, 1.8f, 18000); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); D_8037D5C8 = 2; } break; @@ -507,7 +509,7 @@ void bswalrus_die_update(void){ void bswalrus_die_end(void){ func_8024BD08(0); - gravity_reset(); + baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); func_80291548(); @@ -530,8 +532,8 @@ void bswalrus_drone_end(void){ void func_802B90D0(void){ baanim_playForDuration_loopSmooth(ASSET_19E_ANIM_BSWALRUS_SLED, 0.8f); - func_8029C7F4(1,1,3,2); - func_80297970(0.0f); + func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); + baphysics_set_target_horizontal_velocity(0.0f); func_8029C674(); func_802B813C(); func_802B3A50(); @@ -555,7 +557,7 @@ void func_802B917C(void){ void bswalrus_sled_init(void){ baanim_playForDuration_loopSmooth(ASSET_19E_ANIM_BSWALRUS_SLED, 0.8f); - func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1,2); + func_8029C7F4(BAANIM_UPDATE_2_SCALE_HORZ,1,1, BA_PHYSICS_NORMAL); baanim_setVelocityMapRanges(D_80364DC0, D_80364DC4, D_80364DE0, D_80364DE4); func_802900B4(); func_802B813C(); @@ -565,7 +567,7 @@ void bswalrus_sled_update(void){ enum bs_e next_state = 0; f32 sp20[3]; - if(50.0f < _get_horzVelocity()){ + if(50.0f < baphysics_get_horizontal_velocity()){ if(func_8023DB4C(1)){ baModel_80292554(&sp20); }else{ @@ -601,14 +603,14 @@ void bswalrus_sled_jump_init(void){ animctrl_setStart(aCtrl, 0.14f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_ONCE); animctrl_start(aCtrl, "bswalrus.c", 0x477); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); if(func_8029B2E8() != 0.0f) yaw_setIdeal(func_8029B33C()); - func_8029797C(yaw_getIdeal()); + baphysics_set_target_yaw(yaw_getIdeal()); func_802B7F28(); - func_802979AC(yaw_getIdeal(), func_80297A64()); - player_setYVelocity(D_80364DD0); - gravity_set(D_80364DD4); + baphysics_set_horizontal_velocity(yaw_getIdeal(), baphysics_get_target_horizontal_velocity()); + baphysics_set_vertical_velocity(D_80364DD0); + baphysics_set_gravity(D_80364DD4); func_802B7E00(); func_802B813C(); D_8037D5C8 = 0; @@ -620,10 +622,10 @@ void bswalrus_sled_jump_update(void){ f32 sp1C[3]; func_802B7F28(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); if(button_released(BUTTON_A) && 0.0f < sp1C[1]) - gravity_reset(); + baphysics_reset_gravity(); switch (D_8037D5C8) { @@ -657,7 +659,7 @@ void bswalrus_sled_jump_update(void){ } void bswalrus_sled_jump_end(void){ - gravity_reset(); + baphysics_reset_gravity(); func_802B80D0(); } @@ -669,7 +671,7 @@ void func_802B95A0(void){ animctrl_setDuration(aCtrl, 1.0f); animctrl_setPlaybackType(aCtrl, ANIMCTRL_STOPPED); animctrl_start(aCtrl, "bswalrus.c", 0x4e2); - func_8029C7F4(1,1,3,6); + func_8029C7F4(1,1,3, BA_PHYSICS_AIRBORN); func_802B813C(); D_8037D5C8 = 0; } @@ -681,7 +683,7 @@ void func_802B963C(void){ func_80299628(0); func_802B7E6C(); - _get_velocity(sp1C); + baphysics_get_velocity(sp1C); switch (D_8037D5C8) { case 0://L802B9694 @@ -693,7 +695,7 @@ void func_802B963C(void){ case 1://L802B96C0 if(func_8028B2E8()){ func_8029AE48(); - func_80297970(0.0f); + baphysics_set_target_horizontal_velocity(0.0f); D_8037D5C8 = 2; } break; @@ -724,8 +726,8 @@ void func_802B976C(void){ void bswalrus_timeout_init(void) { baanim_playForDuration_once(ASSET_1A9_ANIM_BSWALRUS_LOSS, 3.2f); - func_8029C7F4(1, 1, 3, 7); - func_80297970(0.0f); + func_8029C7F4(1, 1, 3, BA_PHYSICS_FREEZE); + baphysics_set_target_horizontal_velocity(0.0f); func_802914CC(0xD); ncDynamicCamD_func_802BF2C0(60.0f); func_8025A58C(0, 4000); diff --git a/src/core2/bs/washy.c b/src/core2/bs/washy.c index ffa0bb47..38b25b93 100644 --- a/src/core2/bs/washy.c +++ b/src/core2/bs/washy.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + /* .bss */ u8 D_8037D5D0; @@ -14,11 +16,11 @@ void func_802B9980(s32 arg0){ case 1: //L802B99B8 func_802BB3DC(0, 30.0f, 0.6f); func_8030E58C(SFX_82_METAL_BREAK, 0.8f); - player_setYVelocity(400.0f); + baphysics_set_vertical_velocity(400.0f); break; case 2: //L802B99F4 func_802BB3DC(0, 10.0f, 0.6f); - player_setYVelocity(300.0f); + baphysics_set_vertical_velocity(300.0f); break; case 3: //L802B9A20 func_8029E3C0(0, 0.01f); @@ -45,7 +47,7 @@ void func_802B9AAC(void){ void func_802B9ACC(void){ baanim_playForDuration_once(ASSET_281_ANIM_WISHYWASHY_DOOOH, 40.0f); - func_8029C7F4(1, 1, 3, 2); + func_8029C7F4(1, 1, 3, BA_PHYSICS_NORMAL); func_802900B4(); func_802B9980(0); } diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 98e2a206..5a0303d5 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -23,7 +23,7 @@ void func_802CE7E0(ActorMarker *marker, ActorMarker *other){ Actor *actor = marker_getActor(marker); FUNC_8030E8B4(SFX_11_WOOD_BREAKING_1, 1.0f, 28000, actor->position, 300, 3000); FUNC_8030E8B4(SFX_D_EGGSHELL_BREAKING, 1.0f, 28000, actor->position, 300, 3000); - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); actor_playAnimationOnce(actor); marker->collidable = FALSE; actor->unk138_27 = 3; diff --git a/src/core2/ch/bigbutt.c b/src/core2/ch/bigbutt.c index d6270bc8..9c19bed4 100644 --- a/src/core2/ch/bigbutt.c +++ b/src/core2/ch/bigbutt.c @@ -52,19 +52,19 @@ void func_802C5EB8(Actor *this){ } else{ if(func_80329530(this, 1200) && func_803292E0(this)){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); } } } void func_802C5F44(Actor *this){ if(!func_80329530(this, 1200) || !func_803292E0(this)){ - func_80328B8C(this, 1, 0.16f, 1); + subaddie_set_state_with_direction(this, 1, 0.16f, 1); } } void func_802C5F94(Actor *this){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802C5E80(this); func_80328CEC(this, (s32)this->yaw_ideal, 135, 175); this->unk38_31 = 150; @@ -87,14 +87,14 @@ void func_802C60AC(ActorMarker *marker, ActorMarker *other_marker){ && func_803294F0(actor, 80, func_80329784(actor)) ){ animctrl_setPlaybackType(actor->animctrl, ANIMCTRL_ONCE); - func_80328A84(actor, 5); + subaddie_set_state(actor, 5); func_8030E58C(SFX_1E_HITTING_AN_ENEMY_2, 1.0f); } } void func_802C6150(ActorMarker *marker, ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - func_80328AC8(actor, 0xC); + subaddie_set_state_forward(actor, 0xC); func_8030E878(SFX_2B_BULL_MOO_1, randf2(1.28f, 1.37f), 32000, actor->position, 0.0f, 2000.0f); } @@ -104,7 +104,7 @@ void func_802C61C0(ActorMarker *marker, ActorMarker *other_marker){ && actor->state != 0xe && actor->state != 0xf ){ - func_80328AC8(actor, 0xd); + subaddie_set_state_forward(actor, 0xd); FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); } @@ -147,7 +147,7 @@ void func_802C6240(Actor *this){ func_802C5FF8(this); if( func_8032863C(this->animctrl, 0.65f, 0.99f) >= 2 && !func_80328A2C(this, 0.0f, -1, 0.45f) - && func_80328BD4(this, 2, 0.0f, -1, 0.58f) + && subaddie_maybe_set_state_position_direction(this, 2, 0.0f, -1, 0.58f) ){ func_80328CEC(this, (s32)this->yaw, 10, 45); func_802C5E80(this); @@ -165,11 +165,11 @@ void func_802C6240(Actor *this){ func_80328CEC(this, (s32)this->yaw_ideal, 10, 20); if(!(func_8023DB5C() & 0x7)) - func_80328BD4(this, 1, 0.16f, 1, 0.02f); + subaddie_maybe_set_state_position_direction(this, 1, 0.16f, 1, 0.02f); if( !(func_8023DB5C() & 0xf) && func_80329078(this, (s32)this->yaw_ideal, 150) - && func_80328B38(this, 3, 0.13f) + && subaddie_maybe_set_state(this, 3, 0.13f) ){ this->unk28 = randf2(7.1f, 8.4f); } @@ -181,17 +181,17 @@ void func_802C6240(Actor *this){ this->yaw_ideal = func_80329784(this); func_80328FB0(this, 4.0f); if(func_80329480(this)) - func_80328A84(this, 6); + subaddie_set_state(this, 6); break; case 0x3: //L802C6620 func_80328FB0(this, 3.0f); if(! func_80329030(this, 0) && func_80329480(this)){ func_80328CEC(this, (s32)this->yaw, 120, 180); - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802C5E80(this); } - if(!(func_8023DB5C() & 0xf) && func_80328B38(this, 2, 0.08f)) + if(!(func_8023DB5C() & 0xf) && subaddie_maybe_set_state(this, 2, 0.08f)) func_802C5E80(this); func_802C5EB8(this); break; @@ -200,7 +200,7 @@ void func_802C6240(Actor *this){ animctrl_setDuration(this->animctrl, D_80366010[6].duration - (3 - this->unk10_12)*0.1085); this->yaw_ideal = (f32)func_80329784(this); if(!func_803294B4(this, 0x21)){ - func_80328A84(this, 8); + subaddie_set_state(this, 8); } func_802C5F44(this); if(actor_animationIsAt(this, 0.35f) && func_8028EE84() != BSWATERGROUP_2_UNDERWATER){ @@ -211,7 +211,7 @@ void func_802C6240(Actor *this){ func_802C5F94(this); if(this->unk10_12 == 0 || (this->unk10_12 < 3 && func_80329530(this, 300))){ - func_80328A84(this, 9); + subaddie_set_state(this, 9); this->unk28 = 13.0f; } break; @@ -232,7 +232,7 @@ void func_802C6240(Actor *this){ if(func_80329530(this, 320)){ if(func_80329078(this, (s32)this->yaw_ideal,200)){ animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk28 += 5.7; tmp_a0 = this->unk44_31; if(this->unk44_31 == 0){ @@ -261,7 +261,7 @@ void func_802C6240(Actor *this){ func_80329878(this, func_80329530(this, 250)? 0.8: 1.2); if(0.0f == this->unk28){ animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); func_8030DA44(this->unk44_31); this->unk44_31 = 0; func_8030E484(SFX_19_BANJO_LANDING_08); @@ -282,7 +282,7 @@ void func_802C6240(Actor *this){ case 0xc: //L802C6BDC actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); actor_loopAnimation(this); } break; @@ -290,7 +290,7 @@ void func_802C6240(Actor *this){ case 0xd: //L802C6C28 actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 0xe, 0.99f, 1); + subaddie_set_state_with_direction(this, 0xe, 0.99f, 1); this->unk60 = 4.0f; } break; @@ -300,7 +300,7 @@ void func_802C6240(Actor *this){ this->unk60 -= time_getDelta(); if(this->unk60 <= 0.0f){ this->unk166 = 0x63; - func_80328AC8(this, 0xF); + subaddie_set_state_forward(this, 0xF); } break; @@ -308,7 +308,7 @@ void func_802C6240(Actor *this){ case 0xf: //L802C6CD4 actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.95f)){ - func_80328B8C(this, 1, 0.65f, 1); + subaddie_set_state_with_direction(this, 1, 0.65f, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index dfaca5fd..ec45b440 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -13,6 +13,10 @@ BKAnimationList *model_getAnimationList(BKModelBin *arg0); extern void func_8034BB08(s32); extern void func_803458E4(f32[4], f32[4], f32[4], f32); +#define CH_BOTTLES_BONUS_PUZZLE_HEIGHT (4) +#define CH_BOTTLES_BONUS_PUZZLE_WIDTH (5) +#define CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT (CH_BOTTLES_BONUS_PUZZLE_HEIGHT * CH_BOTTLES_BONUS_PUZZLE_WIDTH) + /* .extern symbols??? */ extern u8 D_8037DCC0[7]; extern u8 D_8037DCC7; @@ -74,7 +78,7 @@ ActorAnimationInfo chBottlesBonusAnimations[] ={ f32 D_80368250 = 0.999388993f; -s32 D_80368254[20] = { +s32 D_80368254[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT] = { 0x3C, 0x3D, 0x3F, 0x40, 0x42, 0x41, 0x43, 0x3A, 0x32, 0x30, 0x2E, 0x3E, @@ -106,37 +110,37 @@ Struct_core2_560F0_1 *D_8037DEB8; Struct_core2_560F0_1 *D_8037DEBC; Struct_core2_560F0_1 *D_8037DEC0; Struct_core2_560F0_1 *D_8037DEC4; -f32 D_8037DEC8[20]; -f32 D_8037DF18[20]; +f32 D_8037DEC8[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; +f32 D_8037DF18[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; s32 chBottleBonusPuzzleIndex; f32 D_8037DF70[3]; f32 D_8037DF80[3]; -s32 D_8037DF90[20]; +s32 D_8037DF90[CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT]; /* .code */ void chBottlesBonus_func_802DD080(Gfx **gfx, Mtx **mtx) { - f32 sp24[3]; - f32 sp18[3]; + f32 vp_position[3]; + f32 vp_rotation[3]; func_8024E258(); func_8024CE60(50.0f, 2000.0f); if (getGameMode() == GAME_MODE_A_SNS_PICTURE) { - sp18[0] = 0.0f; - sp18[1] = 0.0f; - sp18[2] = 0.0f; - sp24[0] = 0.0f; - sp24[1] = 0.0f; - sp24[2] = 400.0f; + vp_rotation[0] = 0.0f; + vp_rotation[1] = 0.0f; + vp_rotation[2] = 0.0f; + vp_position[0] = 0.0f; + vp_position[1] = 0.0f; + vp_position[2] = 400.0f; } else { - sp24[0] = 248.4125; - sp24[1] = 328.9; - sp24[2] = -186.4; - sp18[0] = 0.0f; - sp18[1] = 270.0f; - sp18[2] = 0.0f; + vp_position[0] = 248.4125; + vp_position[1] = 328.9; + vp_position[2] = -186.4; + vp_rotation[0] = 0.0f; + vp_rotation[1] = 270.0f; + vp_rotation[2] = 0.0f; } - viewport_setPosition(sp24); - viewport_setRotation(sp18); + viewport_setPosition(vp_position); + viewport_setRotation(vp_rotation); viewport_update(); func_8024C904(gfx, mtx); } @@ -153,7 +157,7 @@ Actor *chBottlesBonus_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) void *sp50; sp6C = marker_getActor(marker); - sp50 = func_8030C704(); + sp50 = func_8030C704(); //grabs frame as texture? if ((sp50 == NULL) || (getGameMode() != GAME_MODE_8_BOTTLES_BONUS)) return sp6C; @@ -287,18 +291,18 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { spD0 = func_8033DDB8(); if (D_8037DEB0 == 0) { D_8037DEB0 = 1; - for(i = 0; i < 20; i++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ func_8033A57C(arg0, D_80368254[i], D_8037DEC4[i].unkC); boneTransformList_getBoneScale(arg0, D_80368254[i], D_8037DEC4[i].unk1C); chBottlesBonus_func_802DD778(arg0, i, D_8037DEC4[i].unk0); - chBottlesBonusCursor_func_802DF460(i + 20, chBottlesBonusMarker, D_8037DEC4[i].unk0); + chBottlesBonusCursor_func_802DF460(i + CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT, chBottlesBonusMarker, D_8037DEC4[i].unk0); } } if((actor->state == 4 || actor->state == 5)){ if (D_8037DEB4 == 0) { D_8037DEB4 = 1; - for(i = 0; i < 20; i++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ func_8033A57C(arg0, D_80368254[i], D_8037DEB8[i].unkC); boneTransformList_getBoneScale(arg0, D_80368254[i], D_8037DEB8[i].unk1C); chBottlesBonus_func_802DD778(arg0, i, D_8037DEB8[i].unk0); @@ -315,7 +319,7 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { } } - for(i = 0; i < 20; i++){ + for(i = 0; i < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; i++){ spD8[0] = 1.0f; spD8[1] = 1.0f; spD8[2] = 1.0f; @@ -466,18 +470,18 @@ void chBottlesBonus_update(Actor *this) { func_8034CF74(local, 0, D_8037DEAC, 0xF0); } func_8028746C(this->animctrl, chBottlesBonus_func_802DD8AC); - for(phi_s0 = 0; phi_s0 < 0x14; phi_s0++){ + for(phi_s0 = 0; phi_s0 < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; phi_s0++){ func_8034DFB0(func_8034C2C4(this->marker, phi_s0 + 0x190), D_803682B4, D_803682A4, 0.0f); } - D_8037DEB8 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1)); - D_8037DEBC = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1)); - D_8037DEC0 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1)); - D_8037DEC4 = (Struct_core2_560F0_1 *) malloc(0x14*sizeof(Struct_core2_560F0_1)); + D_8037DEB8 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEBC = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEC0 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); + D_8037DEC4 = (Struct_core2_560F0_1 *) malloc(CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT*sizeof(Struct_core2_560F0_1)); } func_8034CF90(local, D_8037DEAC, 0xF0); sp48 = chBottlesBonusCursor_func_802E06B4() - 1; cursor_state = chBottlesBonusCursor_getState(); - for(phi_s0_2 = 0; phi_s0_2 < 0x14; phi_s0_2++){ + for(phi_s0_2 = 0; phi_s0_2 < CH_BOTTLES_BONUS_PUZZLE_PIECE_COUNT; phi_s0_2++){ sp40 = D_8037DF90[phi_s0_2]; temp_v0_2 = func_8034C2C4(this->marker, phi_s0_2 + 0x190); if ((phi_s0_2 == sp48) && (cursor_state == 1) && !chBottlesBonusCursor_func_802E0538(phi_s0_2)) { @@ -506,7 +510,7 @@ void chBottlesBonus_update(Actor *this) { func_8025A6EC(COMUSIC_98_BBONUS_PIECES_SHUFFLE, -1); comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 2000); func_8025AABC(COMUSIC_95_BBONUS_A); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_playAnimationOnce(this); } break; @@ -535,7 +539,7 @@ void chBottlesBonus_update(Actor *this) { } } break; - case 5: + case 5: //lose break; }//L802DE9A0 } @@ -550,7 +554,7 @@ void __chBottlesBonus_spawn(void){ } } -void chBottlesBonus_Spawn(s32 arg0, s32 arg1){ +void chBottlesBonus_spawn(s32 arg0, s32 arg1){ if(chBottlesBonusMarker == NULL){ __spawnQueue_add_0(__chBottlesBonus_spawn); } @@ -579,7 +583,7 @@ s32 chBottlesBonus_getState(void){ return actor->state; } -f32 *chBottlesBonus_func_802DEAF8(s32 arg0){ +f32 *chBottlesBonus_get_piece_distance_vec4f(s32 arg0){ //returns distance vector of puzzle piece id return D_8037DEBC[arg0].unkC; } diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index de2ee35f..021c0cf8 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -60,9 +60,9 @@ ActorInfo D_80368418 = { }; /* .bss */ -ActorMarker *chBottlesBonusSursorMarker; +ActorMarker *chBottlesBonusCursorMarker; f32 D_8037E068[20][2]; -Struct_core2_584D0_0 D_8037E248[20]; +Struct_core2_584D0_0 D_8037E248[20]; //puzzle pieces u8 pad_8037E478[0x140]; s32 D_8037E5B8; struct { @@ -124,7 +124,7 @@ bool chBottlesBonusCursor_checkPuzzleCompletion(void) { for(i = 0; i < 20 && D_8037E5C0.is_completed != 0; i++){ if((D_8037E248[i].state != 3) || (i != D_8037E248[i].piece_id) - || !vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(i)) + || !vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(i)) ) { D_8037E5C0.is_completed = FALSE; } @@ -132,10 +132,10 @@ bool chBottlesBonusCursor_checkPuzzleCompletion(void) { if (D_8037E5C0.is_completed) { item_set(ITEM_6_HOURGLASS, FALSE); - timedFunc_set_3(0.25f, comusic_8025AB44, COMUSIC_94_BBONUS, 0, 2000); - timedFunc_set_2(0.3f, func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000); - timedFunc_set_0(1.5f, chBottlesBonusCursor_func_802DF99C); - timedFunc_set_0(1.0f, chBottlesBonus_completedPuzzle); + timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_94_BBONUS, 0, 2000); + timedFunc_set_2(0.3f, (GenFunction_2)func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000); + timedFunc_set_0(1.5f, (GenFunction_0)chBottlesBonusCursor_func_802DF99C); + timedFunc_set_0(1.0f, (GenFunction_0)chBottlesBonus_completedPuzzle); } return D_8037E5C0.is_completed; } @@ -145,9 +145,9 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { Actor *this; f32 sp3C; - this = marker_getActorAndRotation(chBottlesBonusSursorMarker, &rotation); + this = marker_getActorAndRotation(chBottlesBonusCursorMarker, rotation); modelRender_preDraw((GenFunction_1)actor_predrawMethod, (s32)this); - modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)chBottlesBonusSursorMarker); + modelRender_postDraw((GenFunction_1)actor_postdrawMethod, (s32)chBottlesBonusCursorMarker); modelRender_setDepthMode(MODEL_RENDER_DEPTH_FULL); actor_setOpacity(this, 0xB9); func_8024E030(this->position, D_8037E5C0.unk18); @@ -157,7 +157,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { (s32)sp3C, (s32)sp3C, D_803A5D00[func_8024BDA0()] ); - modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, func_80330B1C(chBottlesBonusSursorMarker)); + modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, func_80330B1C(chBottlesBonusCursorMarker)); func_8024E030(this->position, D_8037E5C0.unk10); if (this->state == 1) { D_8037E5C0.unk10[0] -= 24.0f; @@ -170,8 +170,8 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { ActorMarker *chBottlesBonusCursor_spawn(void){ Actor *this = func_8032813C(0x2B4, D_80368400, 0); - chBottlesBonusSursorMarker = this->marker; - return chBottlesBonusSursorMarker; + chBottlesBonusCursorMarker = this->marker; + return chBottlesBonusCursorMarker; } void chBottlesBonusCursor_func_802DF928(s32 indx) { @@ -197,7 +197,7 @@ void chBottlesBonusCursor_freeMethod(Actor *this) { gameFile_load(func_8034BAFC()); func_80347AA8(); } - chBottlesBonusSursorMarker = 0; + chBottlesBonusCursorMarker = 0; } void chBottlesBonusCursor_update(Actor *this) { @@ -225,8 +225,8 @@ void chBottlesBonusCursor_update(Actor *this) { D_8037E5B8 = -1; D_8037E5C0.prev_button = sp5C->button; D_8037E5C0.is_completed = 0; - timedFunc_set_2(3.0f, func_8025A6EC, COMUSIC_94_BBONUS, 0x5DC0); - timedFunc_set_1(3.0f, func_8025AABC, COMUSIC_94_BBONUS); + timedFunc_set_2(3.0f, (GenFunction_2)func_8025A6EC, COMUSIC_94_BBONUS, 0x5DC0); + timedFunc_set_1(3.0f, (GenFunction_1)func_8025AABC, COMUSIC_94_BBONUS); for(i = 0; i < 20; i++){ bzero(&D_8037E248[i], sizeof(Struct_core2_584D0_0)); D_8037E068[40 + i][0] = D_8037E068[40 + i][1] = 0.0f; @@ -275,7 +275,7 @@ void chBottlesBonusCursor_update(Actor *this) { chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); chBottlesBonus_func_802DEA74(D_8037E5C0.unk0); func_8030E58C(SFX_12D_CAMERA_ZOOM_CLOSEST, 0.9f); - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } if((sp5C->button & R_CBUTTONS) && !(D_8037E5C0.prev_button & R_CBUTTONS)){ @@ -283,7 +283,7 @@ void chBottlesBonusCursor_update(Actor *this) { chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); chBottlesBonus_func_802DEA74(D_8037E5C0.unk0); func_8030E58C(SFX_12D_CAMERA_ZOOM_CLOSEST, 1.0f); - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_playAnimationOnce(this); } } @@ -303,7 +303,7 @@ void chBottlesBonusCursor_update(Actor *this) { chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); func_8025A6EC(COMUSIC_96_BBONUS_PICKUP_PIECE, -1); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } @@ -312,7 +312,7 @@ void chBottlesBonusCursor_update(Actor *this) { ) { if (D_8037E248[D_8037E5B8 - 41].state == 3) { if( D_8037E5B8 - 41 != D_8037E248[D_8037E5B8 - 41].piece_id - || !vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(D_8037E5B8 - 41)) + || !vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(D_8037E5B8 - 41)) ) { D_8037E5C0.unk0 = D_8037E5B8 - 41; chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); @@ -320,7 +320,7 @@ void chBottlesBonusCursor_update(Actor *this) { held_piece->state = 2; chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); func_8030E484(SFX_112_TINKER_ATTENTION); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } } @@ -330,7 +330,7 @@ void chBottlesBonusCursor_update(Actor *this) { case 2://L802E029C if((sp5C->button & B_BUTTON) && !(D_8037E5C0.prev_button & B_BUTTON)){ held_piece->state = 0; - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); func_8025A6EC(COMUISC_97_BBONUS_DROP_PIECE, -1); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; @@ -341,64 +341,71 @@ void chBottlesBonusCursor_update(Actor *this) { if ((D_8037E5B8 >= 21) && (D_8037E5B8 < 41)) { held_piece->state = 3; held_piece->piece_id = D_8037E5B8 - 21; - if ((D_8037E5C0.unk0 == held_piece->piece_id) && vec4f_isAlmostZero(chBottlesBonus_func_802DEAF8(D_8037E5C0.unk0))) { + if ((D_8037E5C0.unk0 == held_piece->piece_id) && vec4f_isAlmostZero(chBottlesBonus_get_piece_distance_vec4f(D_8037E5C0.unk0))) { + //placed correctly sp44 = COMUSIC_2B_DING_B; - func_80328B8C(this, 6, 0.0f, 1); + subaddie_set_state_with_direction(this, 6, 0.0f, 1); actor_playAnimationOnce(this); } else { + //placed incorrectly sp44 = COMUSIC_2C_BUZZER; - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } if (chBottlesBonusCursor_checkPuzzleCompletion()) { - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); actor_playAnimationOnce(this); } - timedFunc_set_2(0.25f, func_8025A6EC, sp44, 26000); + timedFunc_set_2(0.25f, (GenFunction_2)func_8025A6EC, sp44, 26000); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; } } break; + //rotate CCW case 3://L802E0420 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; + //rotate CW case 4://L802E0450 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; case 7://L802E0480 if (animctrl_isStopped(this->animctrl) ) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; case 5://L802E04B0 - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); break; + //placing correct piece case 6://L802E04CC if (actor_animationIsAt(this, 0.5f) != 0) { FUNC_8030E624(SFX_6C_LOCKUP_CLOSING, 1.0f, 24000); } if (animctrl_isStopped(this->animctrl) != 0) { - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); actor_loopAnimation(this); } break; + //puzzle complete case 8://L802E0510 break; + case 9://L802E0510 break; } @@ -413,7 +420,7 @@ s32 chBottlesBonusCursor_func_802E0538(s32 indx){ s32 chBottlesBonusCursor_getState(void){ Actor *this; - this = marker_getActor(chBottlesBonusSursorMarker); + this = marker_getActor(chBottlesBonusCursorMarker); return this->state; } @@ -423,13 +430,13 @@ s32 chBottlesBonusCursor_func_802E0588(s32 indx){ f32 *chBottlesBonusCursor_func_802E05AC(s32 indx) { if (indx == D_8037E5C0.unk0) { - D_8037E5F8[0] = D_8036840C[0] + marker_getActor(chBottlesBonusSursorMarker)->position[0]; - D_8037E5F8[1] = D_8036840C[1] + marker_getActor(chBottlesBonusSursorMarker)->position[1]; - D_8037E5F8[2] = D_8036840C[2] + marker_getActor(chBottlesBonusSursorMarker)->position[2]; + D_8037E5F8[0] = D_8036840C[0] + marker_getActor(chBottlesBonusCursorMarker)->position[0]; + D_8037E5F8[1] = D_8036840C[1] + marker_getActor(chBottlesBonusCursorMarker)->position[1]; + D_8037E5F8[2] = D_8036840C[2] + marker_getActor(chBottlesBonusCursorMarker)->position[2]; } else { - ml_vec3f_assign(&D_8037E5F8, 0, 0, 0); + ml_vec3f_assign(D_8037E5F8, 0, 0, 0); } - return &D_8037E5F8; + return D_8037E5F8; } f32 *chBottlesBonusCursor_func_802E0664(s32 indx){ @@ -451,7 +458,7 @@ bool chBottlesBonusCursor_isPuzzleCompleted(void){ void chBottlesBonusCursor_lose(void){ Actor *this; - this = marker_getActor(chBottlesBonusSursorMarker); - func_80328B8C(this, 9, 0.0f, 1); + this = marker_getActor(chBottlesBonusCursorMarker); + subaddie_set_state_with_direction(this, 9, 0.0f, 1); actor_playAnimationOnce(this); } diff --git a/src/core2/ch/climbBase.c b/src/core2/ch/climbBase.c index bd3d393d..c6c101a2 100644 --- a/src/core2/ch/climbBase.c +++ b/src/core2/ch/climbBase.c @@ -68,7 +68,7 @@ void func_802D77D4(Actor *this) { case 1: func_802D76E0(this, sp30); ml_vec3f_copy(local->unk0, sp30); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; case 2: diff --git a/src/core2/ch/collectible.c b/src/core2/ch/collectible.c index d3dfe0a2..30018158 100644 --- a/src/core2/ch/collectible.c +++ b/src/core2/ch/collectible.c @@ -47,7 +47,7 @@ void chCollectible_setState(Actor *arg0, s32 next_state){ actor_collisionOn(arg0); break; } - func_80328A84(arg0, next_state); + subaddie_set_state(arg0, next_state); } void func_802D8C98(Actor *this, s32 arg1) { diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index 40ff6efe..5d0582f2 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -50,14 +50,14 @@ void __chCrab_802CB078(Actor *this) { && ( (this->modelCacheIndex == ACTOR_F2_BLACK_SNIPPET) || func_803292E0(this)) ) { this->unk28 = 0.0f; - func_80328A84(this, 3U); + subaddie_set_state(this, 3U); } } } } void __chCrab_802CB140(Actor *this) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); __chCrab_802CB040(this); func_80328CEC(this, (s32) this->yaw_ideal, 135, 175); this->unk38_31 = 150; @@ -70,7 +70,7 @@ void __chCrab_touch(ActorMarker *marker, ActorMarker *other){ if ((this->state == 4) && func_803294F0(this, 80, func_80329784(this))) { FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 28000, this->position, 950, 1900); __chCrab_802CB140(this); - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } @@ -79,7 +79,7 @@ void __chCrab_ow(ActorMarker *marker, ActorMarker *other) { this = marker_getActor(marker); this->unk60 = 3.0f; - func_80328A84(this, 6); + subaddie_set_state(this, 6); actor_playAnimationOnce(this); if (marker->unk14_20 == MARKER_13_SNIPPET) { FUNC_8030E8B4(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); @@ -292,14 +292,14 @@ void chCrab_update(Actor *this) { } if (levelSpecificFlags_get(0xE)) { if ((this->state != 8) && (this->state != 9)) { - func_80328B8C(this, (this->unk138_24) ? 8 : 9, 0.0f, 1); + subaddie_set_state_with_direction(this, (this->unk138_24) ? 8 : 9, 0.0f, 1); this->unk138_24 = FALSE; } } switch(this->state){ case 1: //L802CBE30 - if (func_80328B38(this, 2, 0.03f)) { + if (subaddie_maybe_set_state(this, 2, 0.03f)) { __chCrab_802CB040(this); } __chCrab_802CB078(this); @@ -307,7 +307,7 @@ void chCrab_update(Actor *this) { case 9: //L802CBE6C if (!levelSpecificFlags_get(0xE)) { - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } break; @@ -318,7 +318,7 @@ void chCrab_update(Actor *this) { ) { func_80328CEC(this, (s32) this->yaw, 90, 150); } - func_80328BD4(this, 1, 0.0f, 1, 0.0075f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); __chCrab_802CB078(this); break; @@ -326,7 +326,7 @@ void chCrab_update(Actor *this) { this->yaw_ideal = (f32) func_80329784(this); func_80328FB0(this, 4.0f); if (func_80329480(this)) { - func_80328A84(this, 4); + subaddie_set_state(this, 4); this->unk28 = 12.0f; } break; @@ -335,10 +335,10 @@ void chCrab_update(Actor *this) { this->yaw_ideal = func_80329784(this) + 90.0; func_80328FB0(this, 4.0f); if (func_80329480(this)) { - func_80328A84(this, 9); + subaddie_set_state(this, 9); this->unk28 = 12.0f; } else if (!levelSpecificFlags_get(0xE)) { - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); } break; @@ -355,7 +355,7 @@ void chCrab_update(Actor *this) { case 5: //L802CC0AC this->unk60 = MAX(0.0, this->unk60 - sp30); if (this->unk60 == 0.0f) { - func_80328A84(this, 7); + subaddie_set_state(this, 7); actor_playAnimationOnce(this); if (this->marker->unk14_20 == 0x16B) { this->marker->unk14_20 = MARKER_13_SNIPPET; @@ -371,7 +371,7 @@ void chCrab_update(Actor *this) { if (this->unk60 == 0.0f) { func_80326310(this); } else { - func_80328A84(this, 5); + subaddie_set_state(this, 5); actor_loopAnimation(this); } } @@ -379,7 +379,7 @@ void chCrab_update(Actor *this) { case 7: //L802CC1E8 if (animctrl_isStopped(this->animctrl)) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index 0586c154..caa23cf3 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -315,7 +315,7 @@ void func_802C4C14(Actor *this){ func_802C7478(this); if(!sp80){ if(this->state != 1){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } else{//L802C4D24 @@ -373,7 +373,7 @@ void func_802C4C14(Actor *this){ } } func_802C4768(sp84); - func_80328A84(this, 2); + subaddie_set_state(this, 2); break; case 5://L802C5040 if(D_8037DD2C == 0 && @@ -383,7 +383,7 @@ void func_802C4C14(Actor *this){ func_802C4AC8(sp84); func_8025A6EC(COMUSIC_2B_DING_B, 22000); } - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_8031877C(chGameSelectTopZoombox); func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; @@ -417,7 +417,7 @@ void func_802C4C14(Actor *this){ func_8031877C(chGameSelectTopZoombox); func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[func_8031B5B0()]); D_8037DD2C = 1; - func_80328A84(this, 5); + subaddie_set_state(this, 5); } else{//L802C5240 func_8025A6EC(COMUSIC_2C_BUZZER, 22000); @@ -445,16 +445,16 @@ void func_802C4C14(Actor *this){ func_8030E540(SFX_8F_SNOWBALL_FLYING); break; }//L802C5394 - func_80328A84(this, 4); + subaddie_set_state(this, 4); levelSpecificFlags_set(sp84 + 0x35, 1); } else{//L802C53B4 func_8030E484(SFX_3EA_UNKNOWN); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } }else{//L802C53D0 func_8030E510(SFX_4F_BANJO_WAHOO, 28000); - func_80328A84(this, 3); + subaddie_set_state(this, 3); }//L802C53E8 if(sp84 == 0) func_802C75A0(this, 2); diff --git a/src/core2/ch/ghost.c b/src/core2/ch/ghost.c index ee74e1dd..73d19ef0 100644 --- a/src/core2/ch/ghost.c +++ b/src/core2/ch/ghost.c @@ -76,7 +76,7 @@ void func_8035B1CC(ActorMarker *this_marker, ActorMarker *other_marker){ sp30 = this->scale; func_8030E878(SFX_121_AWAWAU, 1.3f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); func_8030E878(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); actor_collisionOff(this); func_80326310(this); @@ -88,7 +88,7 @@ void func_8035B2C4(ActorMarker *this_marker, ActorMarker *other_marker){ f32 sp30 = this->scale; func_8030E878(SFX_121_AWAWAU, 1.3f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); func_8030E878(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, this->scale*400.0f, this->scale*1800.0f); - func_80328B8C(this, 6, 0.01f, 1); + subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_playAnimationOnce(this); actor_collisionOff(this); func_8035AFE0(sp30, this->position, 8, ASSET_700_SPRITE_DUST, D_80372C6C); @@ -160,21 +160,21 @@ void func_8035B56C(Actor *this){ void func_8035B674(Actor *this){ ActorLocal_Core2_D4050 *local = (ActorLocal_Core2_D4050 *)&this->local; - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_loopAnimation(this); local->unk0 = randf2(1.0f, 4.5f); } void func_8035B6CC(Actor *this){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk28 = 1.0f; func_8030E878(0x3F4, randf2(1.0f, 1.2f), 32000, this->position, this->scale*400.0f, this->scale*1800.0f); } void func_8035B75C(Actor *this){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); this->unk28 = func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) ? 0.0 : 12.0; func_8030E878(0x3F4, randf2(1.0f, 1.2f), 32000, this->position, this->scale*400.0f, this->scale*1800.0f); @@ -183,7 +183,7 @@ void func_8035B75C(Actor *this){ void func_8035B824(Actor *this){ ActorLocal_Core2_D4050 *local = (ActorLocal_Core2_D4050 *)&this->local; - func_80328B8C(this, 4, 0.01f, 1); + subaddie_set_state_with_direction(this, 4, 0.01f, 1); actor_loopAnimation(this); func_80328CEC(this, (s32)this->yaw_ideal, 0xA, 0x1E); this->unk28 = 4.0f; @@ -193,7 +193,7 @@ void func_8035B824(Actor *this){ } void func_8035B8A8(Actor *this){ - func_80328B8C(this, 5, 0.01f, 1); + subaddie_set_state_with_direction(this, 5, 0.01f, 1); actor_loopAnimation(this); func_80328CEC(this, (s32)this->yaw_ideal, 0xE1, 0x87); } @@ -314,12 +314,12 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else{//L8035BE04 - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); actor_setOpacity(this, 0); } } else{//L8035BE2C - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_setOpacity(this, 0xff); } }//L8035BE50 @@ -331,7 +331,7 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else if(mapSpecificFlags_getClear(3)){ - func_80328B8C(this, 3, 0.01f, 1); + subaddie_set_state_with_direction(this, 3, 0.01f, 1); } break; case 3: //L8035BECC @@ -360,7 +360,7 @@ void func_8035BD48(Actor *this){ marker_despawn(this->marker); } else{ - func_80328B8C(this, 1, 0.01f, 1); + subaddie_set_state_with_direction(this, 1, 0.01f, 1); timedFunc_set_2(randf2(5.0f, 10.0f), mapSpecificFlags_set, 3, TRUE); } } diff --git a/src/core2/ch/gloop.c b/src/core2/ch/gloop.c index fbe1722b..f1a6cf1c 100644 --- a/src/core2/ch/gloop.c +++ b/src/core2/ch/gloop.c @@ -56,7 +56,7 @@ void chgloop_update(Actor *this){ case 2://L802D14DC actor_loopAnimation(this); if(this->unk54 != 0.0f) - func_80328A84(this, 4); + subaddie_set_state(this, 4); if( !mapSpecificFlags_get(2) && func_80329530(this, 350) @@ -69,7 +69,7 @@ void chgloop_update(Actor *this){ case 4://L802D1558 actor_playAnimationOnce(this); if(this->unk54 == 0.0f) - func_80328A84(this, 2); + subaddie_set_state(this, 2); if(actor_animationIsAt(this, 0.6f)){ if(this->marker->unk14_21){ diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index cb360cdf..c3fef13b 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -97,14 +97,14 @@ void func_8035EE48(Actor *this){ } void func_8035EE80(Actor *this){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); this->unk28 = 10.5f; func_8035EE48(this); } void func_8035EEC0(Actor *this){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); this->unk28 = 9.0f; func_8035EE48(this); @@ -130,7 +130,7 @@ void func_8035EF9C(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_core2_D7D10 *)&this->local; this->velocity[2] = 0.0f; - func_80328B8C(this, 7, 0.02f, 1); + subaddie_set_state_with_direction(this, 7, 0.02f, 1); actor_playAnimationOnce(this); local->unk0 = 2; actor_collisionOff(this); @@ -149,7 +149,7 @@ void func_8035F048(ActorMarker *marker, ActorMarker *other_marker) { FUNC_8030E8B4(SFX_F9_GRUNTLING_NOISE_1, 1.2f, 22000, this->position, 1750, 3500); FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); this->velocity[2] = 0.0f; - func_80328B8C(this, 6, 0.02f, 1); + subaddie_set_state_with_direction(this, 6, 0.02f, 1); actor_playAnimationOnce(this); local->unk0 = 2; func_8035EE48(this); @@ -199,7 +199,7 @@ void func_8035F138(Actor *this) { } animctrl_setAnimTimer(this->animctrl, 0.0f); if (func_80329530(this, (s32) (this->scale * 650.0f)) && func_803292E0(this)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); actor_playAnimationOnce(this); this->unk1C[1] = 1.0f; this->unk44_31 = func_8030ED2C(SFX_2C_PULLING_NOISE, 3); @@ -251,7 +251,7 @@ void func_8035F138(Actor *this) { } this->unk38_31 -= sp2C; if (func_8035ED60(this)) { - func_80328B8C(this, 5, 0.99f, 0); + subaddie_set_state_with_direction(this, 5, 0.99f, 0); actor_playAnimationOnce(this); this->unk28 = 0.0f; this->unk1C[1] = 1.9f; @@ -275,7 +275,7 @@ void func_8035F138(Actor *this) { func_8030DBB4(this->unk44_31, this->unk1C[1]); } if (animctrl_getAnimTimer(this->animctrl) <= 0.02) { - func_80328B8C(this, 1, 0.02f, 1); + subaddie_set_state_with_direction(this, 1, 0.02f, 1); actor_playAnimationOnce(this); this->unk28 = 0.0f; func_8035EE48(this); diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 023b82f8..f0869693 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -232,20 +232,20 @@ void __chicecube_die(ActorMarker *marker, ActorMarker *other_marker){ } void func_8035A998(Actor *this){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0; } void func_8035A9E0(Actor *this){ - func_80328B8C(this, 3, animctrl_getAnimTimer(this->animctrl), 1); + subaddie_set_state_with_direction(this, 3, animctrl_getAnimTimer(this->animctrl), 1); actor_loopAnimation(this); this->unk38_31 = 1; this->unk28 = 0.0f; } void func_8035AA40(Actor *this){ - func_80328B8C(this, 5, 0.9999f, 0); + subaddie_set_state_with_direction(this, 5, 0.9999f, 0); actor_playAnimationOnce(this); this->unk38_31 = 1; } @@ -305,7 +305,7 @@ void chicecube_update(Actor *this){ if( func_80359DF4(this, 900) || (this->unkF4_8 == 2 && func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) ){ - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); this->unk38_31 = 0x1; } @@ -330,7 +330,7 @@ void chicecube_update(Actor *this){ } func_8035A694(this); if(!func_80359DF4(this, 1300)){ - func_80328B8C(this, 4, animctrl_getAnimTimer(this->animctrl), 1); + subaddie_set_state_with_direction(this, 4, animctrl_getAnimTimer(this->animctrl), 1); actor_loopAnimation(this); this->unk38_31 = 1; } diff --git a/src/core2/ch/jiggy.c b/src/core2/ch/jiggy.c index f1dfc3ce..5a1a3c86 100644 --- a/src/core2/ch/jiggy.c +++ b/src/core2/ch/jiggy.c @@ -142,7 +142,7 @@ void chjiggy_update(Actor *this){ marker_despawn(this->marker); } else{ - func_80328A84(this, 2); + subaddie_set_state(this, 2); switch(chjiggy_getJiggyId(this)){ case JIGGY_17_CC_CLANKER_RAISED: //L802C7EF8 case JIGGY_49_CCW_EYRIE:// L802C7EF8 diff --git a/src/core2/ch/jigsawdance.c b/src/core2/ch/jigsawdance.c index 00848b70..26aee375 100644 --- a/src/core2/ch/jigsawdance.c +++ b/src/core2/ch/jigsawdance.c @@ -81,15 +81,15 @@ void chJigsawDance_setState(Actor * this, u32 arg1){ switch(arg1){ case 3: if(this->state == 1){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); animctrl_setPlaybackType(this->animctrl, ANIMCTRL_ONCE); } break; case 2: - func_80328A84(this, 3); + subaddie_set_state(this, 3); break; case 1: - func_80328A84(this, 4); + subaddie_set_state(this, 4); break; case 4: player_getPosition(this->position); @@ -100,7 +100,7 @@ void chJigsawDance_setState(Actor * this, u32 arg1){ animctrl_start(this->animctrl, "chjigsawdance.c", 0x97); break; case 5: - func_80328A84(this, 5); + subaddie_set_state(this, 5); this->marker->propPtr->unk8_4 = 0; break; } diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index f2188fae..9438d729 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80328B8C(Actor *, s32, f32 , s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32 , s32); extern f32 func_80309B24(f32*); extern void func_80329904(ActorMarker*, s32, f32*); extern void func_80326310(Actor *); @@ -50,7 +50,7 @@ void __chJinjo_802CDBA8(ActorMarker *this, ActorMarker *other){ func_80311480(__chJinjo_getMeetDialogId(actorPtr->marker->unk14_20), 4, 0, 0, 0, 0); fileProgressFlag_set(FILEPROG_E_JINJO_TEXT, 1); } - func_80328B8C(actorPtr, 6, 0.0f , -1); + subaddie_set_state_with_direction(actorPtr, 6, 0.0f , -1); if(func_803463D4(ITEM_12_JINJOS, 1 << (this->unk14_20 + 6) ) == 0x1f) localPtr->unk4 = 1; actor_loopAnimation(actorPtr); @@ -128,9 +128,9 @@ void chJinjo_update(Actor * this){ case 1: if(randf() < 0.015){ if(sp60){ - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); }else{ - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); } actor_playAnimationOnce(this); }//L802CDF24 @@ -139,13 +139,13 @@ void chJinjo_update(Actor * this){ case 2: /* 46FA0 802CDF30 3C053F7D */ case 3: if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); } break; case 4: /* 46FD8 802CDF68 3C053F7D */ if(actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 1, 0.0f, -1); + subaddie_set_state_with_direction(this, 1, 0.0f, -1); }else{//L802CDF9C tmp_f0 = this->yaw; if(sp66 >= 0){ @@ -165,7 +165,7 @@ void chJinjo_update(Actor * this){ case 6:/* 47094 802CE024 02002025 */ __chJinjo_802CDC9C(this, sp66); if(actor_animationIsAt(this, 0.0f) && --(local->unk0) == 0){ - func_80328B8C(this, 7, 0.0f, -1); + subaddie_set_state_with_direction(this, 7, 0.0f, -1); actor_playAnimationOnce(this); if(local->unk4){ sp40[0] = this->position_x; @@ -270,14 +270,14 @@ void chJinjo_update(Actor * this){ if(sp50){ if(actor_animationIsAt(this, 0.96f) || actor_animationIsAt(this, 0.99f)){ - func_80328B8C(this, 8, 0.0f, -1); + subaddie_set_state_with_direction(this, 8, 0.0f, -1); actor_playAnimationOnce(this); } } break; }//L802CE5F0 if(this->state < 4 && !(((sp66 >= 0)? sp66: -sp66) <= 0x1000)){ - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); actor_playAnimationOnce(this); }//L802CE630 if(!func_803114B0()){ diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index 3bb1fa56..1f06a5fd 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -117,9 +117,9 @@ void func_802D9530(Actor *this){ Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other){ if(this->unk100->unk14_20 == 0xB8) - func_80328B8C(other, 3, 0.0001f, 1); + subaddie_set_state_with_direction(other, 3, 0.0001f, 1); } - func_80328B8C(this, 4, 0.0001f, 1); + subaddie_set_state_with_direction(this, 4, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); @@ -131,7 +131,7 @@ void func_802D9530(Actor *this){ void func_802D9600(Actor * this){ animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); this->marker->propPtr->unk8_3 = 0; } @@ -232,11 +232,11 @@ int func_802D997C(Actor *this){ void func_802D9ADC(Actor *this){ Actor *other = subaddie_getLinkedActor(this); if(this->unk100 && other && this->unk100->unk14_20 == 0xB8){ - func_80328B8C(other, 2, 0.0001f, 1); + subaddie_set_state_with_direction(other, 2, 0.0001f, 1); } this->marker->propPtr->unk8_3 = 1; animctrl_setSmoothTransition(this->animctrl, TRUE); - func_80328B8C(this, 2, 0.0001f, 1); + subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = func_8030D90C(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); @@ -248,14 +248,14 @@ void func_802D9ADC(Actor *this){ } void func_802D9BD8(Actor *this){ - func_80328A84(this, 5); + subaddie_set_state(this, 5); func_802D9658(this); func_8028F94C(2, this->position); func_802D997C(this); } void func_802D9C1C(Actor *this){ - func_80328B8C(this, 3, 0.0001f, 1); + subaddie_set_state_with_direction(this, 3, 0.0001f, 1); actor_loopAnimation(this); } @@ -310,7 +310,7 @@ void func_802D9D60(Actor *this){ if(this->unk100){ other = subaddie_getLinkedActor(this); if(other && this->unk100->unk14_20 == 0xB8){ - func_80328A84(other, 1); + subaddie_set_state(other, 1); } } } diff --git a/src/core2/ch/molehill.c b/src/core2/ch/molehill.c index dba736f6..d571b58a 100644 --- a/src/core2/ch/molehill.c +++ b/src/core2/ch/molehill.c @@ -79,7 +79,7 @@ void func_802DA740(Actor *this){ break; case 2: //L802DA7C4 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } else{ if(local->unk0 && actor_animationIsAt(this, 0.05f)){ @@ -89,7 +89,7 @@ void func_802DA740(Actor *this){ break; case 3: //L802DA838 if(actor_animationIsAt(this, 0.9999f)){ - func_80328B8C(this, 1, 0.0001f, 1); + subaddie_set_state_with_direction(this, 1, 0.0001f, 1); } else if(local->unk0){ if(actor_animationIsAt(this, 0.3f)){ diff --git a/src/core2/ch/overlaynocontroller.c b/src/core2/ch/overlaynocontroller.c index e409da22..e870582f 100644 --- a/src/core2/ch/overlaynocontroller.c +++ b/src/core2/ch/overlaynocontroller.c @@ -23,7 +23,7 @@ ActorInfo D_80368174 = { }; /* .bss */ -ActorMarker *D_8037DE90; +ActorMarker *chOverlayNoController_marker; /* .code */ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **vptr){ @@ -53,7 +53,7 @@ Actor *chOverlayNoController_draw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vt } void chOverlayNoController_freeMethod(Actor *this){ - D_8037DE90 = NULL; + chOverlayNoController_marker = NULL; } void chOverlayNoController_update(Actor *this) { @@ -61,24 +61,24 @@ void chOverlayNoController_update(Actor *this) { this->initialized = TRUE; this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); actor_playAnimationOnce(this); marker_setFreeMethod(this->marker, chOverlayNoController_freeMethod); } if (animctrl_isStopped(this->animctrl) != 0) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } } void __chOverlayNoController_spawn(void){ - if(D_8037DE90 == NULL){ - D_8037DE90 = func_8032813C(ACTOR_1DF_NO_CONTROLLER_OVERLAY, D_80368168, 0)->marker; + if(chOverlayNoController_marker == NULL){ + chOverlayNoController_marker = func_8032813C(ACTOR_1DF_NO_CONTROLLER_OVERLAY, D_80368168, 0)->marker; } } void chOverlayNoController_spawn(s32 arg0, s32 arg1){ - if(D_8037DE90 == NULL){ + if(chOverlayNoController_marker == NULL){ __spawnQueue_add_0(__chOverlayNoController_spawn); } } @@ -86,7 +86,7 @@ void chOverlayNoController_spawn(s32 arg0, s32 arg1){ void chOverlayNoController_func_802DD040(s32 arg0, s32 arg1) { ActorMarker *temp_a0; - temp_a0 = D_8037DE90; + temp_a0 = chOverlayNoController_marker; if (temp_a0 != 0) { func_80326310(marker_getActor(temp_a0)); } diff --git a/src/core2/ch/overlaypressstart.c b/src/core2/ch/overlaypressstart.c index 69971614..2777d9fa 100644 --- a/src/core2/ch/overlaypressstart.c +++ b/src/core2/ch/overlaypressstart.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void actor_predrawMethod(Actor *); extern void actor_postdrawMethod(ActorMarker *); extern Actor *func_8032813C(enum actor_e id, f32[3], s32); @@ -72,13 +72,13 @@ void chOverlayPressStart_update(Actor *this){ this->initialized = 1; this->depth_mode = MODEL_RENDER_DEPTH_NONE; actor_collisionOff(this); - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); actor_playAnimationOnce(this); marker_setFreeMethod(this->marker, chOverlayPressStart_func_802DCC78); } if(animctrl_isStopped(this->animctrl)){ - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } } diff --git a/src/core2/ch/shrapnel.c b/src/core2/ch/shrapnel.c index 3361715d..ad81168d 100644 --- a/src/core2/ch/shrapnel.c +++ b/src/core2/ch/shrapnel.c @@ -36,13 +36,13 @@ void chShrapnel_func_802D0A38(Actor *this){ else{ if(func_80329530(this, 600) && func_803292E0(this)){ this->unk28 = 0.0f; - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } } void chShrapnel_func_802D0AB8(Actor *this) { - func_80328B8C(this, 1, 0.0f, 0); + subaddie_set_state_with_direction(this, 1, 0.0f, 0); chShrapnel_func_802D0A00(this); func_80328CEC(this, (s32) this->yaw_ideal, 0x87, 0xAF); this->unk38_31 = 0x1E; @@ -167,7 +167,7 @@ void chshrapnel_update(Actor *this) { func_80328FB0(this, 4.0f); if (func_80329480(this)) { if (250.0 > ABS(player_position[1] - this->unk1C[1])) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 32750, this->position, 1250, 2500); this->unk28 = 4.0f; diff --git a/src/core2/ch/snowball.c b/src/core2/ch/snowball.c index dc6b679c..b5404a14 100644 --- a/src/core2/ch/snowball.c +++ b/src/core2/ch/snowball.c @@ -70,7 +70,7 @@ void __chSnowball_collisionCallback(Actor *this, bool water_collision) { func_8030E878(SFX_F_SMALL_WATER_SPLASH, randf2(0.8f, 1.2f), 32000, this->position, 1250.0f, 2500.0f); actor_collisionOff(this); func_80326310(this); - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } else{ func_8030E878(SFX_2F_ORANGE_SPLAT, 1.0f, 32000, this->position, 1250.0f, 2500.0f); diff --git a/src/core2/ch/snowman.c b/src/core2/ch/snowman.c index 69f3a3e8..4fab6ce3 100644 --- a/src/core2/ch/snowman.c +++ b/src/core2/ch/snowman.c @@ -4,7 +4,7 @@ extern int func_802592C4(f32[3], f32[3], f32); extern void func_802EFA20(ParticleEmitter *, f32, f32); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80328FB0(Actor *, f32); extern void func_803300C0(ActorMarker *, void *); @@ -133,13 +133,13 @@ void __chSnowman_spawnSnowballParticles(f32 position[3], s32 count){ void __chSnowman_enterIdle(Actor *this){ ActorLocal_chSirSlush *local = (ActorLocal_chSirSlush *) &this->local; - func_80328B8C(this, CHSNOWMAN_STATE_1_IDLE, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_1_IDLE, 0.01f, 1); actor_loopAnimation(this); local->unk4 = 0.4f; } void __chSnowman_enterDeath(Actor *this){ - func_80328B8C(this, CHSNOWMAN_STATE_3_DIE, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_3_DIE, 0.01f, 1); actor_playAnimationOnce(this); } @@ -272,7 +272,7 @@ void chSnowman_update(Actor *this){ && func_8028EE84() != BSWATERGROUP_2_UNDERWATER && !__chSnowman_CCW_playerInProtectedZone() ){ - func_80328B8C(this, CHSNOWMAN_STATE_2_ATTACK, 0.01f, 1); + subaddie_set_state_with_direction(this, CHSNOWMAN_STATE_2_ATTACK, 0.01f, 1); actor_playAnimationOnce(this); } } diff --git a/src/core2/ch/snowmanhat.c b/src/core2/ch/snowmanhat.c index aee78e6e..ad398225 100644 --- a/src/core2/ch/snowmanhat.c +++ b/src/core2/ch/snowmanhat.c @@ -27,7 +27,7 @@ void chSnowmanHat_update(Actor *this){ this->pitch -= 360.0f; if(this->position_y <= func_80309724(this->position)){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 32750, this->position, 2250, 4500); } break; diff --git a/src/core2/ch/termite.c b/src/core2/ch/termite.c index df22c6d9..8d423ca3 100644 --- a/src/core2/ch/termite.c +++ b/src/core2/ch/termite.c @@ -121,7 +121,7 @@ void __chTermite_ow(ActorMarker *marker, ActorMarker *other_marker){ Actor *this; this = marker_getActor(marker); - func_80328AC8(this, 6); + subaddie_set_state_forward(this, 6); } void __chTermite_die(ActorMarker *marker, ActorMarker *other_marker){ @@ -187,7 +187,7 @@ void chTermite_update(Actor *this) { } switch (this->state) { case 1: - if (func_80328BD4(this, 2, 0.0f, 1, 0.06f)) { + if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.06f)) { __chTermite_updateRandomRotationSpeed(this); __chTermite_updateRandomSpeed(this); this->unk28 = 0.0f; @@ -222,11 +222,11 @@ void chTermite_update(Actor *this) { } __chTermite_updateAnimationSpeed(this); func_80329030(this, 0); - func_80328BD4(this, 1, 0.0f, 1, 0.047f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.047f); return; case 6: if (actor_animationIsAt(this, 0.95f) != 0) { - func_80328AC8(this, 1); + subaddie_set_state_forward(this, 1); } break; } diff --git a/src/core2/ch/trainers.c b/src/core2/ch/trainers.c index 4f6082e7..9a8358bc 100644 --- a/src/core2/ch/trainers.c +++ b/src/core2/ch/trainers.c @@ -67,7 +67,7 @@ void chtrainers_update(Actor *this){ this->velocity[0] = this->yaw; this->velocity[1] = 0.0f; this->unk10_12 = !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && !func_803203FC(0x1); - func_80328A84(this, 0); + subaddie_set_state(this, 0); } if(!func_803203FC(0xF) && ability_isUnlocked(ABILITY_11_TURBO_TALON)){ @@ -92,14 +92,14 @@ void chtrainers_update(Actor *this){ case 1://L802CA630 this->velocity[2] -= time_getDelta(); if(this->velocity[2] <= 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L802CA670 if(player_stateTimer_get(STATE_TIMER_3_TURBO_TALON) == 0.0f){ this->velocity[2] = 1.0f; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; @@ -107,7 +107,7 @@ void chtrainers_update(Actor *this){ this->velocity[2] -= time_getDelta(); if(this->velocity[2] <= 0.0f){ this->unk10_12 = 1; - func_80328A84(this, 0); + subaddie_set_state(this, 0); } break; }//L802CA6F8 @@ -122,7 +122,7 @@ f32 chtrainers_getDuration(Actor *this){ } void chtrainers_pickup(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[2] = 1.0f; this->unk10_12 = 0; } diff --git a/src/core2/ch/wadingboots.c b/src/core2/ch/wadingboots.c index 713cac16..e3c77034 100644 --- a/src/core2/ch/wadingboots.c +++ b/src/core2/ch/wadingboots.c @@ -42,7 +42,7 @@ void chwadingboots_update(Actor *this){ this->initialized = TRUE; this->velocity[0] = this->yaw; this->unk10_12 = !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && !func_803203FC(0x1); - func_80328A84(this, 0); + subaddie_set_state(this, 0); } if(!func_803203FC(0x10) && ability_isUnlocked(ABILITY_E_WADING_BOOTS)){ @@ -78,14 +78,14 @@ void chwadingboots_update(Actor *this){ case 1://L802D6D34 this->velocity[1] -= time_getDelta(); if(this->velocity[1] <= 0.0f){ - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; case 2://L802D6D74 if(player_stateTimer_get(STATE_TIMER_2_LONGLEG) == 0.0f){ this->velocity[1] = 1.5f; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } break; @@ -93,7 +93,7 @@ void chwadingboots_update(Actor *this){ this->velocity[1] -= time_getDelta(); if(this->velocity[1] <= 0.0f){ this->unk10_12 = 1; - func_80328A84(this, 0); + subaddie_set_state(this, 0); } break; }//L802D6DFC @@ -108,7 +108,7 @@ f32 chwadingboots_802D6E4C(Actor *this){ } void chwadingboots_802D6E54(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); this->velocity[1] = 1.5f; this->unk10_12 = 0; } diff --git a/src/core2/code_13A00.c b/src/core2/code_13A00.c index e9334a8b..5ced3ba1 100644 --- a/src/core2/code_13A00.c +++ b/src/core2/code_13A00.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern void func_802F494C(void *, f32); extern void func_802F4884(void *, s32, f32); @@ -43,7 +44,7 @@ void func_8029AA3C(void){ else func_8029C304(2); - sp30 = ml_map_f(_get_horzVelocity(), 0.0f, 500.0f, 70.0f, 250.0f); + sp30 = ml_map_f(baphysics_get_horizontal_velocity(), 0.0f, 500.0f, 70.0f, 250.0f); func_8028E9C4(D_8037D194, sp34); sp34[1] = func_80294500(); pCtrl = func_802F4094(sp34, 8.0f); diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index 98e06cd1..1c38e6b5 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -4,6 +4,7 @@ #include "core2/yaw.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" +#include "core2/ba/physics.h" f32 func_8024DDD8(f32[3], f32); extern void func_8024E71C(s32, f32*); @@ -623,12 +624,12 @@ void func_8029C22C(void) { return; D_80364620 = D_80364620 ? FALSE : TRUE; - if (_get_horzVelocity() > 100.0f) { + if (baphysics_get_horizontal_velocity() > 100.0f) { if (D_80364620) { - func_80292864(func_80297A7C() - 20.0f, 20.0f); + func_80292864(baphysics_get_target_yaw() - 20.0f, 20.0f); } else{ - func_80292864(func_80297A7C() + 20.0f, 20.0f); + func_80292864(baphysics_get_target_yaw() + 20.0f, 20.0f); } } } @@ -660,7 +661,7 @@ void func_8029C3E8(f32 arg0, f32 arg1) { f32 sp28; _player_getPosition(sp30); - sp28 = ml_map_f(_get_horzVelocity(), 0.0f, 1000.0f, arg0, arg1); + sp28 = ml_map_f(baphysics_get_horizontal_velocity(), 0.0f, 1000.0f, arg0, arg1); sp2C = player_getYaw(); func_802589E4(sp3C, sp2C, sp28); sp3C[1] = 0.0f; @@ -764,11 +765,11 @@ enum bs_e func_8029C780(void){ return BS_5_JUMP; } -void func_8029C7F4(enum baanim_update_type_e arg0, enum yaw_state_e yaw_state, s32 arg2, s32 arg3){ +void func_8029C7F4(enum baanim_update_type_e arg0, enum yaw_state_e yaw_state, s32 arg2, BaPhysicsType arg3){ baanim_setUpdateType(arg0); yaw_setUpdateState(yaw_state); func_8029957C(arg2); - func_802978DC(arg3); + baphysics_set_type(arg3); } void func_8029C834(enum map_e map_id, s32 exit_id){ diff --git a/src/core2/code_1550.c b/src/core2/code_1550.c index 2cdb5de2..18274cc2 100644 --- a/src/core2/code_1550.c +++ b/src/core2/code_1550.c @@ -4,46 +4,66 @@ #include "animation.h" +typedef struct animation_file_cache_s{ + AnimationFile *ptr; + u16 exp_timer:15; + u16 persist:1; + u8 pad6[2]; +}AnimationFileCache; + AnimationFile *animBinCache_get(enum asset_e assest_id); /* .data */ -s16 D_803635C0[] = {0x1, 0x3, 0x5, 0xC, 0xE, 0x17, 0x18, 0x19, 0x1A, 0x1C, 0x1D, 0}; +s16 animBinCache_persistantList[] = { + ASSET_1_ANIM_BSCROUCH_ENTER, + ASSET_3_ANIM_BSWALK, + ASSET_5_ANIM_BSPUNCH, + ASSET_C_ANIM_BSWALK_RUN, + ASSET_E_ANIM_BSTURN, + ASSET_17_ANIM_BSBFLAP, + ASSET_18_ANIM_BSBFLAP_ENTER, + ASSET_19_ANIM_BSBPECK_ENTER, + ASSET_1A_ANIM_BSBPECK, + ASSET_1C_ANIM_BSBBARGE, + ASSET_1D_ANIM_BSBBUSTER, + 0 +}; /* .bss */ -AnimationFileCache D_8037A8C0[0x2CA]; +AnimationFileCache animBinCache[0x2CA]; /* .code */ -void func_802884E0(void){ +static void __animBinCache_initPersistent(void){ s16 *phi_v0; - for( phi_v0 = D_803635C0; *phi_v0 != 0; phi_v0++){ - D_8037A8C0[*phi_v0].unk4_0 = 1; + for( phi_v0 = animBinCache_persistantList; *phi_v0 != 0; phi_v0++){ + animBinCache[*phi_v0].persist = 1; } } -void animBinCache_loadAll(void){ +static void __animBinCache_loadAll(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk4_0){ + if(animBinCache[i].persist){ animBinCache_get(i); } } } AnimationFile *animBinCache_get(enum asset_e asset_id){ - if(!D_8037A8C0[asset_id].unk0){ - D_8037A8C0[asset_id].unk0 = (AnimationFile *) assetcache_get(asset_id); + if(animBinCache[asset_id].ptr == NULL){ + animBinCache[asset_id].ptr = (AnimationFile *) assetcache_get(asset_id); } - D_8037A8C0[asset_id].unk4_15 = 30; - return D_8037A8C0[asset_id].unk0; + animBinCache[asset_id].exp_timer = 30; + return animBinCache[asset_id].ptr; } void animBinCache_free(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0){ - assetcache_release(D_8037A8C0[i].unk0); + if(animBinCache[i].ptr){ + assetcache_release(animBinCache[i].ptr); } } } @@ -51,30 +71,35 @@ void animBinCache_free(void){ void animBinCache_init(void){ s32 i = 0; for(i = 0; i < 0x2CA; i++){ - D_8037A8C0[i].unk0 = NULL; - D_8037A8C0[i].unk4_15 = 0; - D_8037A8C0[i].unk4_0 = 0; + animBinCache[i].ptr = NULL; + animBinCache[i].exp_timer = 0; + animBinCache[i].persist = 0; } - func_802884E0(); - animBinCache_loadAll(); + __animBinCache_initPersistent(); + __animBinCache_loadAll(); } -void func_8028873C(s32 arg0){ +void animBinCache_flushStale(s32 persistant){ s32 i; - if(arg0){ + if(persistant){ for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && D_8037A8C0[i].unk4_0 && (D_8037A8C0[i].unk4_15 < 30)){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; - D_8037A8C0[i].unk4_0 = 0; + if( (animBinCache[i].ptr != NULL) + && (animBinCache[i].persist) + && (animBinCache[i].exp_timer < 30) + ){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; + animBinCache[i].persist = 0; } } - } - else{ + } else { for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && !D_8037A8C0[i].unk4_0 && (D_8037A8C0[i].unk4_15 < 30)){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; + if( (animBinCache[i].ptr != NULL) + && !animBinCache[i].persist + && (animBinCache[i].exp_timer < 30) + ){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; if(func_80254BC4(1)) break; } @@ -82,13 +107,13 @@ void func_8028873C(s32 arg0){ } } -void func_80288834(void){ +void animBinCache_update(void){ s32 i; for(i = 0; i < 0x2CA; i++){ - if(D_8037A8C0[i].unk0 && !D_8037A8C0[i].unk4_0){ - if(--D_8037A8C0[i].unk4_15 == 0){ - assetcache_release(D_8037A8C0[i].unk0); - D_8037A8C0[i].unk0 = NULL; + if((animBinCache[i].ptr != NULL) && !animBinCache[i].persist){ + if(--animBinCache[i].exp_timer == 0){ + assetcache_release(animBinCache[i].ptr); + animBinCache[i].ptr = NULL; } } } diff --git a/src/core2/code_33C30.c b/src/core2/code_33C30.c index 5e49c797..be14e397 100644 --- a/src/core2/code_33C30.c +++ b/src/core2/code_33C30.c @@ -29,13 +29,13 @@ bool func_802BAC1C(void) { } void func_802BAC58(void) { - f32 sp34[3]; - f32 sp28[3]; + f32 vp_position[3]; + f32 vp_rotation[3]; f32 sp1C[3]; - viewport_getPosition(sp34); - viewport_getRotation(sp28); - func_802BEA4C(sp28, sp34, 150.0f, sp1C); + viewport_getPosition(vp_position); + viewport_getRotation(vp_rotation); + func_802BEA4C(vp_rotation, vp_position, 150.0f, sp1C); if (D_8037D810 == NULL) { D_8037D810 = func_8032FBE4(sp1C, func_802BABC0, 1, 0x15D); } diff --git a/src/core2/code_379B0.c b/src/core2/code_379B0.c index 3c5a1f1b..f9d6f31e 100644 --- a/src/core2/code_379B0.c +++ b/src/core2/code_379B0.c @@ -42,11 +42,11 @@ void func_802BE940(void) D_8037DA30[2] = sp24[2]; } -void func_802BEA4C(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3]) { +void func_802BEA4C(f32 rotation[3], f32 position[3], f32 arg2, f32 dest[3]) { f32 sp24[3]; - func_80256E24(sp24, arg0[0], arg0[1], 0.0f, 0.0f, -arg2); - ml_vec3f_add(arg3, sp24, arg1); + func_80256E24(sp24, rotation[0], rotation[1], 0.0f, 0.0f, -arg2); + ml_vec3f_add(dest, sp24, position); } diff --git a/src/core2/code_39D0.c b/src/core2/code_39D0.c index 69c690d7..bd29d94a 100644 --- a/src/core2/code_39D0.c +++ b/src/core2/code_39D0.c @@ -4,6 +4,8 @@ #include "prop.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" + extern f32 func_8024DDD8(f32[3], f32); extern int func_80259254(f32 vec[3], f32 x, f32 z, f32 val); @@ -203,11 +205,11 @@ int player_shouldSlideTrot(void){ } bool func_8028B254(s32 arg0) { - return (func_8028B2E8() || (_get_vertVelocity() < 0.0f && (player_getYPosition() - func_80294438()) < (f32) arg0)); + return (func_8028B2E8() || (baphysics_get_vertical_velocity() < 0.0f && (player_getYPosition() - func_80294438()) < (f32) arg0)); } int func_8028B2E8(void){ - return D_8037BF60 && _get_vertVelocity() < 0.0f; + return D_8037BF60 && baphysics_get_vertical_velocity() < 0.0f; } int player_isSliding(void){ @@ -296,7 +298,7 @@ void func_8028B59C(void) { if (map_get() == MAP_6_TTC_NIPPERS_SHELL) { D_8037BF61 = FALSE; } - if (!sp24 && D_8037BF61 && (_get_vertVelocity() < -40.0)) { + if (!sp24 && D_8037BF61 && (baphysics_get_vertical_velocity() < -40.0)) { func_8029C0D0(); func_8030E58C(0xF, 0.7f); } diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 3882e774..b5018790 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -250,7 +250,7 @@ void chBeeSwarm_802CF518(Actor *this) { && func_8028EE84() == BSWATERGROUP_0_NONE && player_getTransformation() != TRANSFORM_6_BEE ) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } } @@ -259,7 +259,7 @@ void chBeeSwarm_802CF57C(Actor *this) { local = (ActorLocal_core2_47BD0 *) &this->local; if (!func_803292E0(this) || !func_80329530(this, 900) || func_8028EE84() != BSWATERGROUP_0_NONE) { - func_80328A84(this, 5); + subaddie_set_state(this, 5); func_802CEF54(this, local->unkC, 100.0f); } } @@ -375,7 +375,7 @@ void chBeeSwarm_update(Actor *this) { if (this->unk100 != NULL) { fileProgressFlag_set(FILEPROG_D_BEEHIVE_TEXT, TRUE); } - func_80328A84(this, (this->unk100 != NULL) ? 1 : 2); + subaddie_set_state(this, (this->unk100 != NULL) ? 1 : 2); this->unk60 = 0.0f; chBeeSwarm_802CF040(this); this->unk38_0 = func_803203FC(1) | func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE); @@ -415,7 +415,7 @@ void chBeeSwarm_update(Actor *this) { this->unk1C[2] = this->position[2] + sp7C[2] * 37.5; if (this->state != 6) { local->unk6 = this->state; - func_80328A84(this, 6); + subaddie_set_state(this, 6); } } chBeeSwarm_802CF1C8(this->unk1C, this->position, this->velocity, this->unk28, 100.0f, 0, &spA0); @@ -437,7 +437,7 @@ void chBeeSwarm_update(Actor *this) { if (this->state != 7) { local->unk7 = this->state; local->unk4 = local->unk0; - func_80328A84(this, 7); + subaddie_set_state(this, 7); } } } @@ -453,7 +453,7 @@ void chBeeSwarm_update(Actor *this) { fileProgressFlag_set(FILEPROG_8F_MET_BEE_INFESTED_BEEHIVE, TRUE); } if (chBeeSwarm_802CF5E4(this)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { func_802CEF54(this, local->unkC, 100.0f); @@ -473,7 +473,7 @@ void chBeeSwarm_update(Actor *this) { this->unk28 = 400.0f; if (ml_distance_vec3f(this->position, this->unk1C) < 100.0f) { func_802CEF54(this, spB4, 50.0f); - func_80328A84(this, 4); + subaddie_set_state(this, 4); } chBeeSwarm_802CF57C(this); break; @@ -500,19 +500,19 @@ void chBeeSwarm_update(Actor *this) { func_802CEF54(this, (s32 *) spB4, 50.0f); } if (ml_distance_vec3f(this->position, spB4) > 100.0f) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); } chBeeSwarm_802CF57C(this); break; case 5: if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); } chBeeSwarm_802CF518(this); break; case 6: if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { - func_80328A84(this, local->unk6); + subaddie_set_state(this, local->unk6); } break; case 7: @@ -525,7 +525,7 @@ void chBeeSwarm_update(Actor *this) { if (local->unk0 < local->unk4) { local->unk0++; } else { - func_80328A84(this, local->unk7); + subaddie_set_state(this, local->unk7); } } break; diff --git a/src/core2/code_4A6F0.c b/src/core2/code_4A6F0.c index d0904dc0..3d4d331e 100644 --- a/src/core2/code_4A6F0.c +++ b/src/core2/code_4A6F0.c @@ -124,7 +124,7 @@ void chMumbo_func_802D18B4(Actor *this) { player_is_within_range = chMumbo_withinHorzDistToPlayer(0, -107, 188); } if(player_is_within_range || func_803203FC(1) || func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); if( !fileProgressFlag_get(FILEPROG_11_HAS_MET_MUMBO) || (!fileProgressFlag_get(FILEPROG_DC_HAS_HAD_ENOUGH_TOKENS_BEFORE) && this->unk38_0) ) { @@ -166,7 +166,7 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 func_803463D4(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); this->unk38_31 = 0; } - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); return; case ASSET_DB0_DIALOG_MUMBO_MISTAKE_0: //L802D1AF8 @@ -180,14 +180,14 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 } case ASSET_DAE_DIALOG_MUMBO_TREX_START: //L802D1B48 - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); return; default: //L802D1B64 gcpausemenu_80314AC8(1); break; } - func_80328A84(this, 4); + subaddie_set_state(this, 4); } void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { @@ -206,7 +206,7 @@ void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { return; } gcpausemenu_80314AC8(1); - func_80328A84(this, 4U); + subaddie_set_state(this, 4U); return; } func_80311480(ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); @@ -232,10 +232,10 @@ void chMumbo_update(Actor *this) { this->unk60 = 0.0f; if (chMumbo_func_802D181C(0x201)) { this->unk60 = 1.0f; - func_80328A84(this, 7U); + subaddie_set_state(this, 7U); } else if (chMumbo_func_802D181C(0x202)) { this->unk60 = 2.0f; - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); } } @@ -281,7 +281,7 @@ void chMumbo_update(Actor *this) { && !func_803203FC(1) && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) ) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_D8F_DIALOG_MUMBO_MEET, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_11_HAS_MET_MUMBO, TRUE); break; @@ -292,13 +292,13 @@ void chMumbo_update(Actor *this) { && !func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) && this->unk38_0 ){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_DC_HAS_HAD_ENOUGH_TOKENS_BEFORE, TRUE); break; } - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -334,7 +334,7 @@ void chMumbo_update(Actor *this) { func_80311480(ASSET_DAE_DIALOG_MUMBO_TREX_START, 6, NULL, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_BA_HAS_SEEN_TREX_TEXT, 1); this->unk138_24 = TRUE; - func_80328A84(this, 3); + subaddie_set_state(this, 3); } else if ( sp44 && map_get() != MAP_7A_GL_CRYPT @@ -347,13 +347,13 @@ void chMumbo_update(Actor *this) { this->unk10_12 = D_8037DDF0; D_8037DDF0 = 7; fileProgressFlag_setN(FILEPROG_BB_MUMBO_MISTAKE_INDEX, ++sp40, 2); - func_80328A84(this, 5); + subaddie_set_state(this, 5); } else { if (this->unk38_31) { func_8025A6EC(SFX_2B_BULL_MOO_1, 28000); func_803463D4(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); } - func_80328A84(this, 5); + subaddie_set_state(this, 5); } gcpausemenu_80314AC8(0); @@ -412,17 +412,17 @@ void chMumbo_update(Actor *this) { } func_8025A7DC(COMUSIC_1D_MUMBO_TRANSFORMATION); if (player_getTransformation() != TRANSFORM_1_BANJO) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); chMumbo_func_802D1B8C(this, D_8037DDF0); break; } if (this->unk138_24) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); func_80311480(ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 6, NULL, this->marker, __chMumbo_textCallback, NULL); break; } gcpausemenu_80314AC8(1); - func_80328A84(this, 4); + subaddie_set_state(this, 4); } break; @@ -460,7 +460,7 @@ void chMumbo_update(Actor *this) { if (randf() < 0.4) { temp_f12 = (randf() - 0.5) * 0.95300000000000007 * 2; this->unk1C[0] = temp_f12 + ((temp_f12 >= 0.0f) ? 0.476 : -0.476); - func_80328AEC(this, 9); + subaddie_set_state_looped(this, 9); break; } if (0.6 < randf()) { @@ -471,7 +471,7 @@ void chMumbo_update(Actor *this) { case 9: //L802D2920 this->yaw += this->unk1C[0]; if (actor_animationIsAt(this, 0.99f)) { - func_80328AEC(this, 8); + subaddie_set_state_looped(this, 8); } break; } diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 9de5b232..84580db7 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -158,7 +158,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0xA0: case 0xFF: func_8030E540(SFX_82_METAL_BREAK); - func_80328A84(sp2C, 4); + subaddie_set_state(sp2C, 4); break; case 0x17D: @@ -172,7 +172,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_109_BREAKABLE_BRICK_WALL: func_8030E6D4(SFX_114_BRICKWALL_BREAKING); func_8030E510(SFX_11_WOOD_BREAKING_1, 28000); - func_80328AEC(sp2C, 9); + subaddie_set_state_looped(sp2C, 9); fileProgressFlag_set((sp2C->unkF4_8 == 1) ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN, TRUE); break; @@ -185,7 +185,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_224_BREAKABLE_FLOOR_COBWEB: func_8025A70C(COMUSIC_2B_DING_B); func_8030E6A4(SFX_129_SWOOSH, (sp2C->scale < 0.45) ? 1.0 : 0.8, 0x7FF8); - func_80328AEC(sp2C, 0xC); + subaddie_set_state_looped(sp2C, 0xC); func_802D2FB0(sp2C, 8, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); fileProgressFlag_set((sp2C->unkF4_8== 1) ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN, 1); break; @@ -193,7 +193,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_225_BREAKABLE_WALL_COBWEB: func_8025A70C(COMUSIC_2B_DING_B); func_8030E540(SFX_129_SWOOSH); - func_80328AEC(sp2C, 0xF); + subaddie_set_state_looped(sp2C, 0xF); func_802D2FB0(sp2C, 0xE, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); fileProgressFlag_set(FILEPROG_CA_COBWEB_BLOCKING_PURPLE_CAULDRON_BROKEN, 1); break; @@ -508,7 +508,7 @@ void func_802D4388(Actor *this){ switch(this->state){ case 0x12: //L802D4468 if(this->unk38_0 && mapSpecificFlags_get(0x1F)){ - func_80328B8C(this, 0x13, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x13, 0.0f, 1); actor_playAnimationOnce(this); func_8030E6D4(SFX_90_SWITCH_PRESS); } @@ -516,20 +516,20 @@ void func_802D4388(Actor *this){ case 0x13: //L802D44B0 if(0.66 <= animctrl_getAnimTimer(this->animctrl)){ - func_80328B8C(this, 0x14, 0.66f, 0); + subaddie_set_state_with_direction(this, 0x14, 0.66f, 0); } break; case 0x14: //L802D44F0 if(!this->unk38_0 || !mapSpecificFlags_get(0x1F)){ - func_80328B8C(this, 0x15, 0.66f, 0); + subaddie_set_state_with_direction(this, 0x15, 0.66f, 0); actor_playAnimationOnce(this); } break; case 0x15: //L802D4534 if(animctrl_getAnimTimer(this->animctrl) < 0.03){ - func_80328B8C(this, 0x12, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x12, 0.0f, 1); } break; }//L802D456C @@ -564,7 +564,7 @@ void func_802D4680(Actor *this){ switch(this->state){ case 0: if(150.0f < func_80258640(this->position, sp1C)){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); D_803676AC = 0; } break; @@ -628,7 +628,7 @@ void func_802D4928(Actor *this, s32 arg1, s32 arg2, s32 arg3) { ) && (arg2 != this->state) ) { - func_80328B8C(this, arg2, 0.0f, 1); + subaddie_set_state_with_direction(this, arg2, 0.0f, 1); actor_playAnimationOnce(this); } if( ( (((arg1 & 0xC00000) == 0) && !mapSpecificFlags_get(arg1 - 0)) @@ -637,7 +637,7 @@ void func_802D4928(Actor *this, s32 arg1, s32 arg2, s32 arg3) { ) && (arg2 == this->state) ) { - func_80328B8C(this, arg3, 0.0f, 1); + subaddie_set_state_with_direction(this, arg3, 0.0f, 1); actor_playAnimationOnce(this); } } @@ -658,7 +658,7 @@ void func_802D4AC0(Actor *this, s32 arg1, s32 arg2) { if( (((arg1 & 0x800000) && (fileProgressFlag_get(arg1 + 0xFF800000))) || ((arg1 & 0x400000) && (func_803203FC(arg1 + 0xFFC00000)))) && (fileProgressFlag_get(arg2)) && (this->animctrl == NULL) ) { - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); } func_802D4A9C(this, arg1); } diff --git a/src/core2/code_509D0.c b/src/core2/code_509D0.c index fa476cba..d4772c70 100644 --- a/src/core2/code_509D0.c +++ b/src/core2/code_509D0.c @@ -171,7 +171,7 @@ void func_802D7DE8(ActorMarker *marker, f32 arg1[3]) { } } func_8028F010(this->modelCacheIndex); - func_80328A84(this, 4); + subaddie_set_state(this, 4); var_f12 = this->position[1]; var_f14 = 28.0f; var_f18 = 0.0f; @@ -196,7 +196,7 @@ void func_802D8030(Actor *this){ local = (s32*)&this->local; *local = 1; this->marker->unkC = __chLevelCollectible_collide; - func_80328A84(this, 2); + subaddie_set_state(this, 2); } void __chLevelCollectible_returnObj(Actor *this) { @@ -252,7 +252,7 @@ void __chLevelCollectible_returnObj(Actor *this) { } } this->unk138_22 = this->unk138_21 = 0; - func_80328A84(this, 2); + subaddie_set_state(this, 2); } switch (this->marker->unk14_20) { case MARKER_1FD_BLUE_PRESENT_COLLECTIBLE: @@ -327,7 +327,7 @@ void chLevelCollectible_update(Actor *this){ } if(this->unk138_22){ func_8028F7D4(0.0f, 0.0f); - func_80328A84(this, 3); + subaddie_set_state(this, 3); } }//L802D85DC diff --git a/src/core2/code_53C10.c b/src/core2/code_53C10.c index 41386223..78c3aeef 100644 --- a/src/core2/code_53C10.c +++ b/src/core2/code_53C10.c @@ -89,7 +89,7 @@ void func_802DAE10(Actor *this){ void func_802DAE40(Actor *this) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_802DAE10(this); func_80328CEC(this, (s32) this->yaw_ideal, (s32) (this->yaw + 160.0f) % 360, (s32) (this->yaw + 200.0f) % 360); this->unk38_31 = 0x5A; @@ -142,13 +142,13 @@ bool func_802DAFBC(Actor *this) { } else if (temp_v0 & 8) { func_802DAE10(this); this->unk38_31 = 0x5A; - func_80328B8C(this, 2, sp44, 1); + subaddie_set_state_with_direction(this, 2, sp44, 1); func_80328CEC(this, (s32) this->yaw_ideal, 0xB3, 0xB4); this->unk38_0 = TRUE; } else { func_802DAE10(this); this->unk38_31 = 0x5A; - func_80328B8C(this, 8, sp44, 1); + subaddie_set_state_with_direction(this, 8, sp44, 1); func_80328CEC(this, (s32) this->yaw_ideal, 120, 180); } return TRUE; @@ -156,13 +156,13 @@ bool func_802DAFBC(Actor *this) { void func_802DB220(Actor *this) { if (func_80329530(this, 900) && func_803292E0(this)) { - func_80328A84(this, 6); + subaddie_set_state(this, 6); } } void func_802DB264(Actor *this) { if (!func_80329530(this, 900) || !func_803292E0(this)) { - func_80328A84(this, 1); + subaddie_set_state(this, 1); } } @@ -219,7 +219,7 @@ void func_802DB440(ActorMarker *marker, ActorMarker *other_marker) { void func_802DB4E0(ActorMarker *marker, s32 arg1){ Actor * actor = marker_getActor(marker); - func_80328B8C(actor, 9, 0.0f, 1); + subaddie_set_state_with_direction(actor, 9, 0.0f, 1); actor_playAnimationOnce(actor); actor_collisionOff(actor); actor->unk60 = randf2(3.0f, 6.0f); @@ -248,7 +248,7 @@ void func_802DB5A0(Actor *this) { local->unk38 = 0; this->unk16C_4 = TRUE; if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); return; } } @@ -261,7 +261,7 @@ void func_802DB5A0(Actor *this) { switch(this->state){ case 1://L802DB6B8 - if (func_80328B38(this, 2, 0.58f)) { + if (subaddie_maybe_set_state(this, 2, 0.58f)) { func_80328CEC(this, (s32) this->yaw, 0xA, 0x2D); func_802DAE10(this); } @@ -274,7 +274,7 @@ void func_802DB5A0(Actor *this) { if (phi_f14 >= 1.0) { phi_f14 -= 1.0; } - func_80328B8C(this, 2, phi_f14, 1); + subaddie_set_state_with_direction(this, 2, phi_f14, 1); this->yaw_ideal = this->yaw; func_802DAE10(this); } @@ -288,12 +288,12 @@ void func_802DB5A0(Actor *this) { func_80328CEC(this, this->yaw_ideal, 0xA, 0x14); } if (!(func_8023DB5C() & 7)) { - func_80328B38(this, 1, 0.02f); + subaddie_maybe_set_state(this, 1, 0.02f); } if( !(func_8023DB5C() & 0xF) && func_80329078(this, (s32) this->yaw_ideal, 0x96) ) { - if (func_80328B38(this, 3, 0.13f) != 0) { + if (subaddie_maybe_set_state(this, 3, 0.13f) != 0) { this->unk28 = randf2((f32)local->unk8, (f32)local->unk9); } } @@ -308,7 +308,7 @@ void func_802DB5A0(Actor *this) { func_80328FB0(this, 4.0f); if (func_80329480(this)) { this->unk10_12 = local->unkC_31; - func_80328A84(this, 4); + subaddie_set_state(this, 4); func_802DB2AC(this); } break; @@ -316,7 +316,7 @@ void func_802DB5A0(Actor *this) { case 3://L802DB930 func_80328FB0(this, 3.0f); func_802DB3B0(this); - if (!(func_8023DB5C() & 0xF) && (func_80328B38(this, 2, 0.08f))) { + if (!(func_8023DB5C() & 0xF) && (subaddie_maybe_set_state(this, 2, 0.08f))) { func_802DAE10(this); } func_802DB220(this); @@ -329,7 +329,7 @@ void func_802DB5A0(Actor *this) { } this->yaw_ideal = (f32) func_80329784(this); if (!func_803294B4(this, 0x21)) { - func_80328A84(this, 6); + subaddie_set_state(this, 6); } func_802DB264(this); if (actor_animationIsAt(this, 0.5f) != 0) { @@ -340,7 +340,7 @@ void func_802DB5A0(Actor *this) { if( (this->unk10_12 == 0) || (this->unk10_12 < local->unkC_31 && func_80329530(this, 0xFA)) ) { - func_80328A84(this, 7); + subaddie_set_state(this, 7); this->unk28 = (f32)local->unkA; this->unk38_31 = 0; } @@ -374,7 +374,7 @@ void func_802DB5A0(Actor *this) { this->unk60 -= time_getDelta(); break; } - func_80328B8C(this, 0xA, 0.0f, 1); + subaddie_set_state_with_direction(this, 0xA, 0.0f, 1); actor_playAnimationOnce(this); break; @@ -383,7 +383,7 @@ void func_802DB5A0(Actor *this) { func_802DB354(this); } if (animctrl_isStopped(this->animctrl)) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); actor_collisionOn(this); } diff --git a/src/core2/code_57C70.c b/src/core2/code_57C70.c index de3b0dc1..65ecac43 100644 --- a/src/core2/code_57C70.c +++ b/src/core2/code_57C70.c @@ -100,7 +100,7 @@ void func_802DEE1C(Actor *this) { sp4C = map_getLevel(map_get()); sp44 = sp4C == D_8037DFE4; if (sp44) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } switch(sp4C){ @@ -126,7 +126,7 @@ void func_802DEE1C(Actor *this) { switch(this->state){ case 1: if (animctrl_isStopped(this->animctrl)) { - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; @@ -140,7 +140,7 @@ void func_802DEE1C(Actor *this) { case 2: if(gctransition_8030BDC0()) { - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); } break; @@ -172,7 +172,7 @@ void func_802DF0C8(void) { sp1C = marker_getActor(D_8037DFE0); if (sp1C->state != 3) { - func_80328B8C(sp1C, 3, 0.0f, 1); + subaddie_set_state_with_direction(sp1C, 3, 0.0f, 1); actor_playAnimationOnce(sp1C); } } diff --git a/src/core2/code_59D40.c b/src/core2/code_59D40.c index 304c9856..0d0472ae 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/code_59D40.c @@ -69,7 +69,7 @@ void func_802E0CE0(Actor *this) { } } } - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); } } @@ -84,7 +84,7 @@ bool func_802E0DC0(f32 arg0[3]){ void func_802E0E88(Actor *this){ this->unk28 = 2.0f; - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); actor_playAnimationOnce(this); } @@ -111,7 +111,7 @@ void func_802E0F60(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); actor_collisionOff(this); FUNC_8030E8B4(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); - func_80328B8C(this, 9, 0.0f, 1); + subaddie_set_state_with_direction(this, 9, 0.0f, 1); actor_playAnimationOnce(this); } @@ -128,7 +128,7 @@ void func_802E1010(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); - func_80328B8C(this, 8, 0.0f, 1); + subaddie_set_state_with_direction(this, 8, 0.0f, 1); actor_playAnimationOnce(this); } @@ -190,7 +190,7 @@ void chsnacker_update(Actor *this) { switch(this->state){ case 1: //802E12C8 - if (func_80328BD4(this, 2, 0.0f, 1, 0.03f) != 0) { + if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.03f) != 0) { func_802E0CD0(this); } func_802E0CE0(this); @@ -203,7 +203,7 @@ void chsnacker_update(Actor *this) { if (func_80329480(this) != 0) { func_80328CEC(this, (s32) this->yaw, 0x5A, 0x96); } - func_80328BD4(this, 1, 0.0f, 1, 0.0075f); + subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); func_802E0CE0(this); break; @@ -214,7 +214,7 @@ void chsnacker_update(Actor *this) { func_80328FB0(this, 4.0f); func_80328FF0(this, 3.0f); if (func_80329480(this)) { - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); this->unk28 = 9.0f; } break; @@ -237,7 +237,7 @@ void chsnacker_update(Actor *this) { func_802E0CD0(this); func_80328CEC(this, (s32) this->yaw_ideal, 0x87, 0xAF); this->unk38_31 = 0x78; - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } func_8032CA80(this, (D_8037E62C) ? 15 : 9); @@ -246,7 +246,7 @@ void chsnacker_update(Actor *this) { case 8: //802E15BC if (animctrl_isStopped(this->animctrl)) { func_802E0CD0(this); - func_80328B8C(this, 2, 0.0f, 1); + subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } break; diff --git a/src/core2/code_654C0.c b/src/core2/code_654C0.c index e1fb20c7..ce0e8104 100644 --- a/src/core2/code_654C0.c +++ b/src/core2/code_654C0.c @@ -163,7 +163,7 @@ BKVertexList *vtxList_clone(BKVertexList *vtxList){ list_size = sizeof(BKVertexList) + vtxList->count*sizeof(Vtx); out_v0 = (BKVertexList *) malloc(list_size); - func_80254630(out_v0, vtxList, list_size); + wmemcpy(out_v0, vtxList, list_size); return out_v0; } diff --git a/src/core2/code_6B030.c b/src/core2/code_6B030.c index 43dfdd6c..c44c45e3 100644 --- a/src/core2/code_6B030.c +++ b/src/core2/code_6B030.c @@ -257,7 +257,7 @@ void *func_802F2AEC(void) { } temp_v0->unk0 = 0; temp_v0->unk4 = 0; - D_80380A58 = heap_get_size() - func_8025496C(); + D_80380A58 = heap_get_size() - heap_get_occupied_size(); return temp_v0; } @@ -302,7 +302,7 @@ void func_802F2D8C(Struct64s *arg0) { Struct65s *var_s0; if ((arg0 != NULL) && (arg0->unk4 != 0)) { - D_80380A58 = heap_get_size() - func_8025496C(); + D_80380A58 = heap_get_size() - heap_get_occupied_size(); for(var_s0 = arg0->unk0; var_s0 < arg0->unk0 + arg0->unk4; var_s0++){ if (var_s0->unk23 & 1) { if (var_s0->unk10(var_s0->unk0, (f32)var_s0->unk20, var_s0->unkC) == 0) { diff --git a/src/core2/code_6B30.c b/src/core2/code_6B30.c index cbdaec95..0c0d2bff 100644 --- a/src/core2/code_6B30.c +++ b/src/core2/code_6B30.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" extern Actor *func_8032813C(enum actor_e, f32[3], s32); @@ -75,10 +76,10 @@ enum hitbox_e func_8028DB14(ActorMarker *arg0){ break; case BS_5_JUMP://8028DCD8 case BS_3D_FALL_TUMBLING: - if(_get_vertVelocity() < 0.0f && !func_8028B2E8()) + if(baphysics_get_vertical_velocity() < 0.0f && !func_8028B2E8()) return HITBOX_A_FAST_FALLING; case BS_2F_FALL://8028DD10 - if(_get_vertVelocity() < -1400.0f && !func_8028B2E8()) + if(baphysics_get_vertical_velocity() < -1400.0f && !func_8028B2E8()) return HITBOX_A_FAST_FALLING; default://8028DD4C return HITBOX_0_NONE; diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 0d217387..98a2388d 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -5,6 +5,7 @@ #include "prop.h" #include "enums.h" +#include "core2/ba/physics.h" extern bool player_isInHorizontalRadius(f32[3], f32); @@ -539,7 +540,7 @@ BKCollisionTri *func_8028EF48(void){ } void player_getVelocity(f32 dst[3]){ - _get_velocity(dst); + baphysics_get_velocity(dst); } f32 func_8028EF88(void){ @@ -683,7 +684,7 @@ void func_8028F3D8(f32 arg0[3], f32 arg1, void(*arg2)(ActorMarker *), ActorMarke } void func_8028F408(f32 arg0[3]){ - func_80297BC4(arg0); + baphysics_set_goto_position(arg0); } bool func_8028F428(s32 arg0, ActorMarker *marker) { diff --git a/src/core2/code_72060.c b/src/core2/code_72060.c index 617fd087..0ab87595 100644 --- a/src/core2/code_72060.c +++ b/src/core2/code_72060.c @@ -101,7 +101,7 @@ void func_802F9114(void){ void func_802F9134(s32 gfx){ D_80369284 = D_80369284 - 1; if(gfx < D_80369284){ - func_80254630(D_80369280->unk1C + gfx, D_80369280->unk1C + D_80369284, sizeof(struct4Ds)); + wmemcpy(D_80369280->unk1C + gfx, D_80369280->unk1C + D_80369284, sizeof(struct4Ds)); } } diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index f525e021..73b822b0 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -2197,44 +2197,43 @@ bool func_803082D8(Cube *arg0, s32 *arg1, bool arg2, bool arg3) { #pragma GLOBAL_ASM("asm/nonmatchings/core2/code_7AF80/func_803083B0.s") #else s32 func_803083B0(s32 arg0) { - s32 temp_v0; s32 var_v0; - bool var_a2; Cube *var_s0; static s32 D_80382140; static Cube *D_80382144; if (arg0 == -1) { - D_80382144 = D_80381FA0.cube_list; + var_s0 = D_80381FA0.cube_list; + D_80382144 = var_s0; D_80382140 = 0; return 0; } + var_s0 = D_80382144; if (D_80382140 < D_80382144->prop2Cnt) { - temp_v0 = func_803082D8(var_s0, &D_80382140, (arg0 < 0) ^ 1, arg0 & 1); + if (D_80381FA0.cube_list && D_80381FA0.cube_list && D_80381FA0.cube_list ); + var_v0 = func_803082D8(var_s0, &D_80382140, arg0 >= 0, arg0 & 1); if (D_80382140 != 0) { - return temp_v0; - } - } - D_80382140 = 0; -loop_6: -loop_7: - var_s0++; - if (var_s0 >= D_80381FA0.cube_list + D_80381FA0.cubeCnt) { - D_80382144 = var_s0; - return -1; - } - if (0 < var_s0->prop2Cnt) { - var_v0 = func_803082D8(var_s0, &D_80382140, (arg0 < 0) ^ 1, arg0 & 1); - if (D_80382140 != 0) { - D_80382144 = var_s0; return var_v0; } - goto loop_6; } - goto loop_7; - return -1; + + D_80382140 = 0; + while(D_80382140 == 0) { + do{ + var_s0++; + if (var_s0 >= D_80381FA0.cube_list + D_80381FA0.cubeCnt) { + D_80382144 = var_s0; + return -1; + } + }while (0 >= var_s0->prop2Cnt); + + var_v0 = func_803082D8(var_s0, &D_80382140, arg0 >= 0, arg0 & 1); + + } + D_80382144 = var_s0; + return var_v0; } #endif diff --git a/src/core2/code_851D0.c b/src/core2/code_851D0.c index 0ffa85f3..a4fb0185 100644 --- a/src/core2/code_851D0.c +++ b/src/core2/code_851D0.c @@ -80,7 +80,7 @@ void func_8030C204(void){ void func_8030C27C(void){ switch(getGameMode()){ case GAME_MODE_8_BOTTLES_BONUS: - chBottlesBonus_Spawn(0, 0); + chBottlesBonus_spawn(0, 0); break; case GAME_MODE_A_SNS_PICTURE: func_802DF090(0, 0); diff --git a/src/core2/code_935F0.c b/src/core2/code_935F0.c index 6342de71..e8925dbe 100644 --- a/src/core2/code_935F0.c +++ b/src/core2/code_935F0.c @@ -142,7 +142,7 @@ void __chMinigame_setState(Actor *this, u32 arg1) { timedFunc_set_3(2.0f, (GenFunction_3)func_802E4078, MAP_8E_GL_FURNACE_FUN, 1, 1); break; } - func_80328A84(this, arg1); + subaddie_set_state(this, arg1); } void __chMinigame_free(Actor *this){ diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index e800f420..8a0d93ce 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" @@ -29,7 +30,7 @@ extern void __spawnQueue_add_5(GenFunction_5, s32, s32, s32, s32, s32); void func_8032A6A8(Actor *arg0); void func_8032ACA8(Actor *arg0); void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2); -void func_80328B8C(Actor * this, s32 arg1, f32 arg2, s32 arg3); +void subaddie_set_state_with_direction(Actor * this, s32 arg1, f32 arg2, s32 arg3); void func_8032BB88(Actor *this, s32 arg1, s32 arg2); int subaddie_playerIsWithinSphere(Actor *this, s32 dist); extern void func_8033A4A0(enum asset_e mode_id, f32, f32); @@ -757,7 +758,7 @@ void func_803272D0(f32 arg0[3], f32 arg1, s32 arg2, int (*arg3)(Actor *)){ func_803270B8(arg0, arg1, arg2, arg3, NULL); } -Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ +Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ ActorAnimationInfo * sp54; s32 i; f32 sp44[3]; @@ -778,9 +779,9 @@ Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ D_80383390->unk10_25 = 0; D_80383390->unk10_18 = 0; D_80383390->state = actorInfo->startAnimation; - D_80383390->position_x = (f32)(*position)[0]; - D_80383390->position_y = (f32)(*position)[1]; - D_80383390->position_z = (f32)(*position)[2]; + D_80383390->position_x = (f32)position[0]; + D_80383390->position_y = (f32)position[1]; + D_80383390->position_z = (f32)position[2]; D_80383390->unkF4_8 = 0; D_80383390->yaw = (f32) yaw; D_80383390->yaw_ideal = (f32) yaw; @@ -907,112 +908,112 @@ Actor *actor_new(s32 (* position)[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ for(i = 0; i < 0x0C; i++){ ((s32 *)D_80383390->unkBC)[i] = 0; } - if(flags & 1){ + if(flags & ACTOR_FLAG_UNKNOWN_0){ D_80383390->unk10_25 = func_80306DDC(position) + 1; if(D_80383390->unk10_25 == 0){ D_80383390->unk10_25 = 0; }else{ - sp44[0] = (f32)(*position)[0]; - sp44[1] = (f32)(*position)[1]; - sp44[2] = (f32)(*position)[2]; + sp44[0] = (f32)position[0]; + sp44[1] = (f32)position[1]; + sp44[2] = (f32)position[2]; D_80383390->unk10_18 = func_80307258(&sp44, D_80383390->unk10_25 - 1, 0) + 1; } }//L80327D30 - if(flags & 4){ + if(flags & ACTOR_FLAG_UNKNOWN_2){ D_80383390->unk10_1 = 0; } - if(flags & 8){ + if(flags & ACTOR_FLAG_UNKNOWN_3){ D_80383390->unkF4_30 = 1; } - if(flags & 2){ + if(flags & ACTOR_FLAG_UNKNOWN_1){ D_80383390->marker->unk44 = 1; } - else if(flags & 0x40){ + else if(flags & ACTOR_FLAG_UNKNOWN_6){ D_80383390->marker->unk44 = func_8034A2C8(); } - if(flags & 0x1000){ + if(flags & ACTOR_FLAG_UNKNOWN_12){ func_8033F738(D_80383390->marker); func_8034BFF8(D_80383390->marker); } D_80383390->unk148 = 0; - if(flags & 0x800){ + if(flags & ACTOR_FLAG_UNKNOWN_11){ D_80383390->unk148 = skeletalAnim_new(); } - if(flags & 0x4000){ + if(flags & ACTOR_FLAG_UNKNOWN_14){ D_80383390->marker->unk50 = func_803406B0(); } - if(flags & 0x10){ + if(flags & ACTOR_FLAG_UNKNOWN_4){ D_80383390->unk124_31 = -1; } - if(flags & 0x80){ + if(flags & ACTOR_FLAG_UNKNOWN_7){ D_80383390->unkF4_22 = 1; } - if(flags & 0x80000){ + if(flags & ACTOR_FLAG_UNKNOWN_19){ D_80383390->unk58_1 = 1; } - if(flags & 0x100){ + if(flags & ACTOR_FLAG_UNKNOWN_8){ D_80383390->unk130 = func_803255FC; } - if(flags & 0x200){ + if(flags & ACTOR_FLAG_UNKNOWN_9){ D_80383390->marker->unk40_21 = 1; } - if(flags & 0x8000){ + if(flags & ACTOR_FLAG_UNKNOWN_15){ D_80383390->marker->unk40_20 = 1; } - if(flags & 0x20000){ + if(flags & ACTOR_FLAG_UNKNOWN_17){ D_80383390->marker->unk40_22 = 1; } - if(flags & 0x400000){ + if(flags & ACTOR_FLAG_UNKNOWN_22){ D_80383390->marker->unk40_19 = 1; } - if(flags & 0x10000){ + if(flags & ACTOR_FLAG_UNKNOWN_16){ D_80383390->unk138_9 = 1; } - if(flags & 0x40000){ + if(flags & ACTOR_FLAG_UNKNOWN_18){ D_80383390->unk138_8 = 1; } - if(flags & 0x200000){ + if(flags & ACTOR_FLAG_UNKNOWN_21){ D_80383390->unk138_25 = 1; } - if(flags & 0x800000){ + if(flags & ACTOR_FLAG_UNKNOWN_23){ D_80383390->unk16C_3 = 1; } - if(flags & 0x1000000){ + if(flags & ACTOR_FLAG_UNKNOWN_24){ D_80383390->unk16C_2 = 1; } - if(flags & 0x2000000){ + if(flags & ACTOR_FLAG_UNKNOWN_25){ D_80383390->unk16C_1 = 1; } - if(flags & 0x4000000){ + if(flags & ACTOR_FLAG_UNKNOWN_26){ D_80383390->unk17C_31 = 1; } - if(flags & 0x2000){ + if(flags & ACTOR_FLAG_UNKNOWN_13){ D_80383390->unk138_29 = 1; } - if(flags & 0x100000){ + if(flags & ACTOR_FLAG_UNKNOWN_20){ D_80383390->unk58_2 = 0; } @@ -1151,30 +1152,30 @@ void func_80328478(f32 arg0[3], f32 arg1, f32 arg2){ arg0[2] += sp1C[2]; } -bool func_80328508(Actor *arg0, s32 arg1) +static bool __subaddie_set_state(Actor *this, s32 state) { ActorAnimationInfo *animInfo; s32 index; - arg0->state = arg1; - if (arg0->unk18 == 0) + this->state = state; + if (this->unk18 == 0) return FALSE; - animInfo = arg0->unk18 + arg1; + animInfo = this->unk18 + state; index = animInfo->index; if (1); if (index != 0){ - if (arg0->animctrl == NULL){ - arg0->animctrl = animctrl_new(0); - animctrl_reset(arg0->animctrl); + if (this->animctrl == NULL){ + this->animctrl = animctrl_new(0); + animctrl_reset(this->animctrl); } - animctrl_setIndex(arg0->animctrl, animInfo->index); - animctrl_setDuration(arg0->animctrl, animInfo->duration); - animctrl_setDirection(arg0->animctrl, mvmt_dir_forwards); + animctrl_setIndex(this->animctrl, animInfo->index); + animctrl_setDuration(this->animctrl, animInfo->duration); + animctrl_setDirection(this->animctrl, mvmt_dir_forwards); } - else if (arg0->animctrl) { - animctrl_setPlaybackType(arg0->animctrl, ANIMCTRL_STOPPED); - animctrl_setDirection(arg0->animctrl, mvmt_dir_forwards); + else if (this->animctrl) { + animctrl_setPlaybackType(this->animctrl, ANIMCTRL_STOPPED); + animctrl_setDirection(this->animctrl, mvmt_dir_forwards); } return TRUE; } @@ -1281,41 +1282,41 @@ int func_80328A2C(Actor *this, f32 arg1, s32 direction, f32 probability){ } } -void func_80328A84(Actor * arg0, u32 arg1){ - if(func_80328508(arg0, arg1) && arg0->animctrl){ - animctrl_start(arg0->animctrl, "subaddie.c", 0X6CA); +void subaddie_set_state(Actor * this, u32 arg1){ + if(__subaddie_set_state(this, arg1) && this->animctrl){ + animctrl_start(this->animctrl, "subaddie.c", 0X6CA); } } -void func_80328AC8(Actor * arg0, s32 arg1){ - func_80328B8C(arg0, arg1, 0.0f, 1); +void subaddie_set_state_forward(Actor * this, s32 arg1){ + subaddie_set_state_with_direction(this, arg1, 0.0f, 1); } -void func_80328AEC(Actor * arg0, u32 arg1){ - if(func_80328508(arg0, arg1) && arg0->animctrl){ - animctrl_setPlaybackType(arg0->animctrl, ANIMCTRL_LOOP); - func_803289EC(arg0, 0.0f, 1); +void subaddie_set_state_looped(Actor * this, u32 arg1){ + if(__subaddie_set_state(this, arg1) && this->animctrl){ + animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); + func_803289EC(this, 0.0f, 1); } } /* actor - maybe plays actor's animation with set probability */ -int func_80328B38(Actor *this, s32 myAnimId, f32 chance){ +int subaddie_maybe_set_state(Actor *this, s32 myAnimId, f32 chance){ if(randf() < chance){ - func_80328A84(this, myAnimId); + subaddie_set_state(this, myAnimId); return 1; } return 0; } -void func_80328B8C(Actor * this, s32 myAnimId, f32 arg2, s32 direction){ - if(func_80328508(this, myAnimId) && this->animctrl) +void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 arg2, s32 direction){ + if(__subaddie_set_state(this, myAnimId) && this->animctrl) func_803289EC(this, arg2, direction); } -int func_80328BD4(Actor * this, s32 myAnimId, f32 arg2, s32 arg3, f32 arg4){ - if(randf() < arg4){ - if(func_80328508(this, myAnimId) && this->animctrl){ - func_803285E8(this, arg2, arg3); +int subaddie_maybe_set_state_position_direction(Actor * this, s32 myAnimId, f32 start_position, s32 direction, f32 probability){ + if(randf() < probability){ + if(__subaddie_set_state(this, myAnimId) && this->animctrl){ + func_803285E8(this, start_position, direction); animctrl_start(this->animctrl, "subaddie.c", 0x705); } return 1; @@ -1323,14 +1324,14 @@ int func_80328BD4(Actor * this, s32 myAnimId, f32 arg2, s32 arg3, f32 arg4){ return 0; } -void func_80328C64(Actor * this, int arg1){ +void subaddie_set_ideal_yaw(Actor * this, int arg1){ int retVal = arg1; while(retVal < 0) retVal += 0x168; while(retVal >= 0x168) retVal -= 0x168; this->yaw_ideal = retVal; } -void func_80328CA8(Actor *arg0, s32 angle) { +void func_80328CA8(Actor *this, s32 angle) { s32 fixedAngle = angle; while (fixedAngle < 0) { fixedAngle += 360; @@ -1338,7 +1339,7 @@ void func_80328CA8(Actor *arg0, s32 angle) { while (fixedAngle >= 360) { fixedAngle -= 360; } - arg0->unk6C = fixedAngle; + this->unk6C = fixedAngle; } void func_80328CEC(Actor * this, s32 arg1, s32 min, s32 max){ @@ -1346,7 +1347,7 @@ void func_80328CEC(Actor * this, s32 arg1, s32 min, s32 max){ int abs; f12 = (randf() - 0.5)*(max - min)*2; abs = (0.0f <= f12) ? min : -min; - func_80328C64(this, abs + (arg1 + f12)); + subaddie_set_ideal_yaw(this, abs + (arg1 + f12)); } f32 func_80328DAC(Actor *this){ @@ -1574,11 +1575,11 @@ s32 func_8032970C(Actor *this){ return (s32) DIST_SQ_VEC3F(this->position, sp24); } -s32 func_80329784(Actor *arg0){ +s32 func_80329784(Actor *this){ f32 sp1C[3]; func_8028E964(sp1C); - return (s32)func_80257204(arg0->position[0], arg0->position[2], sp1C[0], sp1C[2]); + return (s32)func_80257204(this->position[0], this->position[2], sp1C[0], sp1C[2]); } s32 func_803297C8(Actor *arg0, f32 arg1[3]){ @@ -2225,7 +2226,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { s32 sp68; s32 sp64; s32 var_v0; - f32 sp5C; + f32 player_yaw; f32 sp50[3]; s32 sp4C; NodeProp *sp48; @@ -2282,7 +2283,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { this->unk164[sp64] = 0x63; } if ((sp64 == 2) && (sp70 != 0)) { - sp5C = player_getYaw(); + player_yaw = player_getYaw(); sp3C[0] = (s32) this->position[0]; sp3C[1] = (s32) this->position[1]; sp3C[2] = (s32) this->position[2]; @@ -2291,15 +2292,15 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { } func_8032EE0C(func_8032B38C, this); if (((s32)arg0->unk44 < 0) && ((sp50[0] != 0.0f) || (sp50[1] != 0.0f) || (sp50[2] != 0.0f))) { - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); } else if (this->unk16C_3 && func_803048E0(sp3C, &sp4C, &sp48, 3, (s32) (func_8033229C(arg0) * 4.0f))) { sp50[0] = (f32) sp48->x; sp50[1] = (f32) sp48->y; sp50[2] = (f32) sp48->z; - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); } else { sp38 = this->position[1] + func_8033229C(arg0); - __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, sp38), reinterpret_cast(s32, this->position[2]), reinterpret_cast(s32, sp5C)); + __spawnQueue_add_5((GenFunction_5)func_802C4260, sp70 + 0x15, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, sp38), reinterpret_cast(s32, this->position[2]), reinterpret_cast(s32, player_yaw)); } func_8032EE20(); } diff --git a/src/core2/code_A960.c b/src/core2/code_A960.c index 0ec1cd75..9fcc29eb 100644 --- a/src/core2/code_A960.c +++ b/src/core2/code_A960.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" void func_80291930(s32); @@ -20,7 +21,7 @@ void func_80291930(s32 arg0){ func_8029C984(); bs_setState(BS_5A_LOADZONE); baModel_setVisible(FALSE); - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); func_8029151C(6); } } diff --git a/src/core2/code_AD0.c b/src/core2/code_AD0.c index edd90769..933b0e5b 100644 --- a/src/core2/code_AD0.c +++ b/src/core2/code_AD0.c @@ -9,7 +9,7 @@ struct54s D_80379BA0[40]; /* .code */ void func_80287A60(struct54s *arg0){ - arg0->unk4 += arg0->unk0[arg0->unkC_24].unk1*0.03333333333333333*arg0->unk8; + arg0->unk4 += arg0->unk0[arg0->unkC_24].unk1*(1.0/30.0)*arg0->unk8; } void func_80287ACC(struct54s *arg0){ diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index 9c4917bb..c40de0e9 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -328,7 +328,7 @@ s32 func_80334ECC(void) { func_8033E1E0(); func_802F11E8(); animCache_update(); - func_80288834(); + animBinCache_update(); ncCamera_update(); func_803045D8(); func_80332E08(); diff --git a/src/core2/code_B850.c b/src/core2/code_B850.c index 467316c8..5520c05e 100644 --- a/src/core2/code_B850.c +++ b/src/core2/code_B850.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void ml_vec3f_assign(f32[3], f32, f32, f32); @@ -58,13 +60,13 @@ void func_80292974(f32 arg0, f32 arg1, f32 arg2){ void func_802929F8(void){ switch (D_80363790) { case 0: //L80292A2C - func_80292864(func_80297A7C() - 20.0f, 40.0f); + func_80292864(baphysics_get_target_yaw() - 20.0f, 40.0f); break; case 1: //L80292A2C - func_80292864(func_80297A7C() + 20.0f, 40.0f); + func_80292864(baphysics_get_target_yaw() + 20.0f, 40.0f); break; case 2: //L80292A94 - func_80292864(func_80297A7C(), 30.0f); + func_80292864(baphysics_get_target_yaw(), 30.0f); break; default: //L80292AC0 break; diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 78180a43..ad5d71b4 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -119,8 +119,8 @@ s32 func_80345FB4(enum item_e item, s32 diff, s32 arg2){ D_80385FE4 = 1; break; case ITEM_17_AIR: - sp30 = func_80301D24(oldVal); - sp2C = func_80301D24(sp28); + sp30 = fxairscore_time_to_count(oldVal); + sp2C = fxairscore_time_to_count(sp28); if(sp3C){ bs_checkInterrupt(0x11); D_80385FE4 = 1; diff --git a/src/core2/code_C0E60.c b/src/core2/code_C0E60.c index ef413b48..66ad4e7c 100644 --- a/src/core2/code_C0E60.c +++ b/src/core2/code_C0E60.c @@ -4,7 +4,7 @@ extern void func_80355C60(f32[3], f32); -void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *argB, s32 *argC, s32 *argD, s32 *argE, s32 *textureCount); +void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *frame_width, s32 *frame_height, s32 *texture_x, s32 *texture_y, s32 *textureCount); #define rare_gDPLoadMultiBlock(pkt, timg, tmem, rtile, fmt, siz, width, height, \ uls, ult, \ @@ -111,19 +111,19 @@ void func_80347FA4(s32 arg0, s32 arg1, s32 arg2, s32 tmem){} void func_80347FB8(s32 arg0){} -void func_80347FC0(Gfx **gfx, BKSprite *sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height){ +void func_80347FC0(Gfx **gfx, BKSprite *sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height){ s32 sp5C; s32 sp58; s32 sp54; s32 sp50; s32 sp4C = -1; - func_80348044(gfx, sprite, frame, tmem, rtile, arg5, arg6, cms, cmt, width, height, + func_80348044(gfx, sprite, frame, tmem, rtile, uls, ult, cms, cmt, width, height, &sp5C, &sp58, &sp54, &sp50, &sp4C ); } -void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 arg5, s32 arg6, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *argB, s32 *argC, s32 *argD, s32 *argE, s32 *textureCount) { +void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 uls, s32 ult, s32 cms, s32 cmt, s32 *width, s32 *height, s32 *frame_width, s32 *frame_height, s32 *texture_x, s32 *texture_y, s32 *textureCount) { BKSpriteFrame *sprite_frame; s32 palette_addr; BKSpriteTextureBlock *texture_block; @@ -136,8 +136,8 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 maskt; sprite_frame = spriteGetFramePtr(sprite, frame); - *argB = (s32) sprite_frame->w; - *argC = (s32) sprite_frame->h; + *frame_width = (s32) sprite_frame->w; + *frame_height = (s32) sprite_frame->h; if (*textureCount == -1) { *textureCount = (s32) sprite_frame->chunkCnt; } @@ -163,8 +163,8 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, for(var_a0 = 0; var_a0 < chunk_count; var_a0++) { texture_block = (s32)texture_block + (texture_block->w * texture_block->h) + sizeof(BKSpriteTextureBlock); } - *argD = texture_block->x; - *argE = texture_block->y; + *texture_x = texture_block->x; + *texture_y = texture_block->y; gDPSetTextureLUT((*gfx)++, G_TT_RGBA16); gDPLoadTLUT_pal256((*gfx)++, palette_addr); } else { @@ -175,15 +175,15 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, if ((D_8038607C == 0) || (tmem == D_80386078)) { D_80386078 = tmem; D_80386070 = sprite_frame; - D_80386080 = arg5; - D_80386084 = arg6; + D_80386080 = uls; + D_80386084 = ult; D_80386088 = rtile; sp144 = 0; } else { D_80386094 = tmem; D_80386074 = sprite_frame; - D_8038609C = arg5; - D_803860A0 = arg6; + D_8038609C = uls; + D_803860A0 = ult; D_803860A4 = rtile; sp144 = 1; } @@ -226,52 +226,52 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, } if ( sprite->type & SPRITE_TYPE_I4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 4; } else { D_80386098 = (s32) D_80386098 >> 4; } } else if (sprite->type & SPRITE_TYPE_IA4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 4; } else { D_80386098 = (s32) D_80386098 >> 4; } } else if (sprite->type & SPRITE_TYPE_I8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_I, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 3; } else { D_80386098 = (s32) D_80386098 >> 3; } } else if (sprite->type & SPRITE_TYPE_IA8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_IA, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 3; } else { D_80386098 = (s32) D_80386098 >> 3; } } else if (sprite->type & SPRITE_TYPE_RGBA16) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_16b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_16b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 2; } else { D_80386098 = (s32) D_80386098 >> 2; } } else if (sprite->type & SPRITE_TYPE_RGBA32) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_32b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, G_IM_SIZ_32b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); if (sp144 == 0) { D_8038607C = (s32) D_8038607C >> 1; } else { D_80386098 = (s32) D_80386098 >> 1; } } else if (sprite->type & SPRITE_TYPE_CI4) { - rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock_4b((*gfx)++, timg, tmem, rtile, G_IM_FMT_RGBA, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = D_8038607C >> 4; } else if (sprite->type & SPRITE_TYPE_CI8) { - rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_8b, *width, *height, arg5, arg6, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); + rare_gDPLoadMultiBlock((*gfx)++, timg, tmem, rtile, G_IM_FMT_CI, G_IM_SIZ_8b, *width, *height, uls, ult, 0, cms, cmt, masks, maskt, G_TX_NOLOD, G_TX_NOLOD); D_8038607C = (s32) D_8038607C >> 3; } if( D_8038607C != 0 diff --git a/src/core2/code_C4320.c b/src/core2/code_C4320.c index ae851f9e..4a9f688c 100644 --- a/src/core2/code_C4320.c +++ b/src/core2/code_C4320.c @@ -63,7 +63,7 @@ Struct_core2_C4320_0 *D_80386114; //current attract demo ptr s32 D_80386118; s32 D_8038611C; bool D_80386120; -s32 D_80386124; +s32 D_80386124; //stored_gameFile_index f32 D_80386128; /* .code */ diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index 56768d07..391a2cd3 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -1,6 +1,8 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); extern f32 func_8031C5D4(struct0*); @@ -324,7 +326,7 @@ void func_80293F0C(void){ if ((D_8037C274 == 3) && func_8031C594(D_8037C200) && (D_8037C218[1] > (func_8031C5E4(D_8037C200) - 70.0f))) { D_8037C218[1] = func_8031C5E4(D_8037C200) - 70.0f; D_8037C27E = 1; - player_setYVelocity(1.0f); + baphysics_set_vertical_velocity(1.0f); } func_80293668(); player_setPosition(D_8037C218); @@ -352,14 +354,14 @@ void func_80293F0C(void){ if(D_8037C278 && D_8037C218[1] < (func_8031C5E4(D_8037C200) - 70.0f)){ func_80294384(3); - if(D_8037C279 && _get_vertVelocity() < 0.0f) { - player_setYVelocity(-1.0f); + if(D_8037C279 && baphysics_get_vertical_velocity() < 0.0f) { + baphysics_set_vertical_velocity(-1.0f); } } else if(D_8037C279){ func_80294390(); - if (_get_vertVelocity() < 0.0f) { - player_setYVelocity(-1.0f); + if (baphysics_get_vertical_velocity() < 0.0f) { + baphysics_set_vertical_velocity(-1.0f); } } else { func_80294384(1); diff --git a/src/core2/code_D5FD0.c b/src/core2/code_D5FD0.c index 5475ed18..780e7c87 100644 --- a/src/core2/code_D5FD0.c +++ b/src/core2/code_D5FD0.c @@ -60,7 +60,7 @@ void func_8035CF60(ActorMarker * marker, s32 arg1) { Actor *actor; actor = marker_getActor(marker); - func_80328B8C(actor, 5, 0.0f, 1); + subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); actor_collisionOff(actor); diff --git a/src/core2/code_D6600.c b/src/core2/code_D6600.c index 1cf0ed81..cafb0c8f 100644 --- a/src/core2/code_D6600.c +++ b/src/core2/code_D6600.c @@ -64,22 +64,22 @@ void func_8035D65C(Actor *this) { } if (func_80329530(this, 500) && func_8028B470() && func_8035D608(this)) { this->unk28 = 2.0f; - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); } } void func_8035D6FC(Actor *this) { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); this->unk28 = 2.0f; - func_80328C64(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); + subaddie_set_ideal_yaw(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); func_80328CA8(this, (s32) func_8035D590(randf2(-45.0f, 45.0f) + (360.0f - this->pitch))); this->unk38_31 = 0x78; } void func_8035D7CC(Actor *this) { - func_80328B8C(this, 3, 0.0f, -1); + subaddie_set_state_with_direction(this, 3, 0.0f, -1); this->unk28 = 2.0f; - func_80328C64(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); + subaddie_set_ideal_yaw(this, (s32) (randf2(-45.0f, 45.0f) + (this->yaw + 180.0f))); func_80328CA8(this, (s32) func_8035D590(randf2(-45.0f, 45.0f) + (360.0f - this->pitch))); } @@ -87,7 +87,7 @@ void func_8035D88C(ActorMarker *marker, ActorMarker *other_marker){ Actor *this; this = marker_getActor(marker); - func_80328B8C(this, 7, 0.0f, -1); + subaddie_set_state_with_direction(this, 7, 0.0f, -1); actor_playAnimationOnce(this); FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 0.8f, 30000, this->position, 1500, 3000); actor_collisionOff(this); @@ -132,7 +132,7 @@ void func_8035DA1C(Actor *this) { LOCAL_D6600(this)->unk4 =(map_get() == MAP_71_GL_STATUE_ROOM) ? 8 : 0xf; if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { this->unk28 = 0.0f; - func_80328B8C(this, 1, 0.0f, 1); + subaddie_set_state_with_direction(this, 1, 0.0f, 1); } func_8032CA80(this, LOCAL_D6600(this)->unk4); marker_setCollisionScripts(this->marker, func_8035D8F0, NULL, func_8035D88C); @@ -151,7 +151,7 @@ void func_8035DA1C(Actor *this) { func_80328FB0(this, 0.5f); func_80328FF0(this, 0.5f); func_8032CA80(this, LOCAL_D6600(this)->unk4); - if (func_80328B38(this, 2, 0.05f) && !func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { + if (subaddie_maybe_set_state(this, 2, 0.05f) && !func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)) { this->unk28 = 4.0f; } func_8035D65C(this); @@ -161,7 +161,7 @@ void func_8035DA1C(Actor *this) { func_80328FB0(this, 0.5f); func_80328FF0(this, 0.5f); if (func_80329480(this) && randf() < 0.01) { - func_80328C64(this, (s32)(this->yaw + randf2(-45.0f, 45.0f))); + subaddie_set_ideal_yaw(this, (s32)(this->yaw + randf2(-45.0f, 45.0f))); } if (func_8032944C(this) && randf() < 0.01) { func_80328CA8(this, (s32)func_8035D590(this->pitch + randf2(-45.0f, 45.0f))); @@ -173,7 +173,7 @@ void func_8035DA1C(Actor *this) { if (sp3C & 2) { func_80328CA8(this, 0); } - if (func_80328BD4(this, 1, 0.0f, 1, 0.005f)) { + if (subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.005f)) { this->unk28 = 2.0f; } func_8035D65C(this); @@ -184,20 +184,20 @@ void func_8035DA1C(Actor *this) { func_80328FF0(this, 3.0f); func_8032CA80(this, LOCAL_D6600(this)->unk4); if (func_80329480(this) && func_8032944C(this)) { - func_80328B8C(this, 2, 0.0f, -1); + subaddie_set_state_with_direction(this, 2, 0.0f, -1); this->unk28 = 4.0f; } break; case 4://L8035DDB8 func_803297FC(this, &sp40, &sp44); - func_80328C64(this, (s32) sp44); + subaddie_set_ideal_yaw(this, (s32) sp44); func_80328CA8(this, (s32) func_8035D590(sp40)); func_80328FB0(this, 10.0f); func_80328FF0(this, 10.0f); func_8032CA80(this, LOCAL_D6600(this)->unk4); if (func_80329480(this) && func_8032944C(this)) { - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); this->unk28 = 10.5f; } break; @@ -209,16 +209,16 @@ void func_8035DA1C(Actor *this) { case 5://L8035DE84 this->marker->unk14_20 = MARKER_173_CHUMP_FISH_2; func_803297FC(this, &sp40, &sp44); - func_80328C64(this, (s32) sp44); + subaddie_set_ideal_yaw(this, (s32) sp44); func_80328CA8(this, (s32) func_8035D590(sp40)); func_80328FB0(this, 10.0f); func_80328FF0(this, 10.0f); sp38 = func_80329530(this, 0x12C); if ((this->state == 5) && sp38) { - func_80328B8C(this, 6, 0.0f, -1); + subaddie_set_state_with_direction(this, 6, 0.0f, -1); } if ((this->state == 6) && !sp38) { - func_80328B8C(this, 5, 0.0f, -1); + subaddie_set_state_with_direction(this, 5, 0.0f, -1); } if ((func_8032CA80(this, LOCAL_D6600(this)->unk4) & ~2)) { func_8035D7CC(this); diff --git a/src/core2/code_D89E0.c b/src/core2/code_D89E0.c index f49bf696..829f4546 100644 --- a/src/core2/code_D89E0.c +++ b/src/core2/code_D89E0.c @@ -38,13 +38,13 @@ ActorInfo D_803730D8 = { /* .code */ void func_8035F970(Actor *this){ - func_80328A84(this, 1); + subaddie_set_state(this, 1); actor_loopAnimation(this); } void func_8035F99C(Actor *this){ if(!func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ - func_80328B8C(this, 2, 0.01f, 1); + subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_playAnimationOnce(this); this->unk28 = 5.0f; FUNC_8030E8B4(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 0x4e2, 0x9c4); @@ -52,30 +52,30 @@ void func_8035F99C(Actor *this){ } void func_8035FA0C(Actor *this){ - func_80328A84(this, 3); + subaddie_set_state(this, 3); actor_loopAnimation(this); this->unk28 = 5.0f; } void func_8035FA48(Actor *this){ - func_80328A84(this, 4); + subaddie_set_state(this, 4); actor_loopAnimation(this); } void func_8035FA74(Actor *this){ ActorLocal_Core2_D89E0 *local = (ActorLocal_Core2_D89E0 *)&this->local; this->yaw_ideal = local->unk4; - func_80328A84(this, 5); + subaddie_set_state(this, 5); actor_loopAnimation(this); } void func_8035FAA8(Actor *this){ - func_80328B8C(this, 6, 0.99f, 0); + subaddie_set_state_with_direction(this, 6, 0.99f, 0); actor_playAnimationOnce(this); } void func_8035FAE0(Actor *this){ - func_80328B8C(this, 7, 0.01f, 1); + subaddie_set_state_with_direction(this, 7, 0.01f, 1); actor_loopAnimation(this); this->yaw += 180.0f; this->unk28 = 20.0f; @@ -483,7 +483,7 @@ void func_80360828(Actor *this){ func_8032CA80(this, this->unk38_0 ? 0x13 : 0x4); if(func_8035FC98(this, this->velocity_x * sp34)){ this->position_y = func_80309724(this->position); - func_80328B8C(this, 8, 0.01f, 1); + subaddie_set_state_with_direction(this, 8, 0.01f, 1); actor_playAnimationOnce(this); func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200); } diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 56592191..992fbcdc 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -9,7 +9,7 @@ extern f32 func_802944A8(void); f32 D_8037C2A0[3]; //recoil_target_position f32 D_8037C2B0[3]; //talk_target_position f32 D_8037C2C0[3]; //throw_target_position -f32 D_8037C2CC; //turbo_duration +f32 s_turbo_duration; enum transformation_e D_8037C2D0; f32 D_8037C2D8[3]; f32 D_8037C2E4; @@ -61,7 +61,7 @@ void get_throw_target_position(f32 dst[3]){ } f32 get_turbo_duration(void){ - return D_8037C2CC; + return s_turbo_duration; } enum transformation_e func_80294A4C(void){ @@ -89,7 +89,7 @@ void set_throw_target_position(f32 src[3]) } void set_turbo_duration(f32 arg0){ - D_8037C2CC = arg0; + s_turbo_duration = arg0; } void func_80294AF4(enum transformation_e xform){ diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 854ac1c8..6ecde024 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -4,6 +4,7 @@ #include "bsint.h" #include "bs_funcs.h" #include "core2/statetimer.h" +#include "core2/ba/physics.h" u8 D_80363820 = 0; @@ -200,7 +201,7 @@ void func_80295914(void){ bs_clearState(); func_80295DD0(); func_80296C30(); - func_802976E4(); + baphysics_init(); func_80297C78(); pitch_reset(); climbClear(); @@ -286,7 +287,7 @@ void func_80295C14(void){ func_8029B174(); func_8029533C(); //dive_cooldown_update bs_updateState(); - func_80297744(); + baphysics_update(); func_8029858C(); func_802932EC(); func_80293F0C(); diff --git a/src/core2/code_EE40.c b/src/core2/code_EE40.c index 169c2c61..b9b06f9d 100644 --- a/src/core2/code_EE40.c +++ b/src/core2/code_EE40.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" /* .bss */ struct{ @@ -38,7 +39,7 @@ void func_80295E74(void){ func_8029B6F0(); } else{ - func_802978DC(7); + baphysics_set_type(BA_PHYSICS_FREEZE); } } } diff --git a/src/core2/code_EF50.c b/src/core2/code_EF50.c index 6392b6bf..e344f9bf 100644 --- a/src/core2/code_EF50.c +++ b/src/core2/code_EF50.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/ba/physics.h" + extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); extern f32 player_getYaw(void); extern void chJigsawDance_setState(Actor *, s32); @@ -488,8 +490,8 @@ void func_80296608(void){ } } - func_80297970(0.0f); - func_80297A0C(0); + baphysics_set_target_horizontal_velocity(0.0f); + baphysics_set_velocity(0); break; case BS_INTR_25: //L80296B54 sp2C = 2; diff --git a/src/core2/code_FD60.c b/src/core2/code_FD60.c deleted file mode 100644 index b0a3a545..00000000 --- a/src/core2/code_FD60.c +++ /dev/null @@ -1,432 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#define _SQ3v1(v) (v[0] * v[0] + v[1] * v[1] + v[2] * v[2]) - -extern f32 ml_sin_deg(f32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); -extern void func_80256D0C(f32, f32, f32, f32, f32, f32 *, f32 *, f32 *); -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); -extern f32 climbGetRadius(void); -extern f32 func_8029CED0(void); - -void func_80297A0C(f32 arg0[3]); -void gravity_reset(void); -void func_80297B3C(void); -void func_80297B94(void); - - -/* .data */ -f32 D_80364440 = -2700.0f; //defaultGravity -f32 D_80364444 = -4000.0f; - -/* .bss */ -s32 D_8037C4A0; -f32 D_8037C4A8[3]; -f32 D_8037C4B8[3]; //velocity? -f32 D_8037C4C8[3]; -f32 D_8037C4D8[3]; -f32 D_8037C4E4; -f32 D_8037C4E8; //gravity -f32 D_8037C4EC; -f32 D_8037C4F0; -f32 D_8037C4F4; //angle -f32 D_8037C4F8; -f32 D_8037C4FC; -f32 D_8037C500; - -struct { - u8 unk0; - u8 pad1[0x3]; - f32 unk4[3]; - f32 unk10[3]; - f32 unk1C; - f32 unk20; -} D_8037C508; - -/* .code */ -void func_80296CF0(void){ - f32 sp84[3]; - f32 sp78[3]; - f32 sp6C[3]; - f32 sp60[3]; - f32 sp54[3]; - f32 sp48[3]; - f32 sp44; - f32 sp40; - - - func_80256D0C(0.0f, D_8037C4F4, 0.0f, 0.0f, D_8037C4F0, &D_8037C4C8[0], &D_8037C4C8[1], &D_8037C4C8[2]); - sp6C[0] = D_8037C4B8[0];\ - sp6C[1] = 0.0f;\ - sp6C[2] = D_8037C4B8[2]; - // sp6C[1] = D_8037C4B8[1]; - - ml_vec3f_copy(sp60, D_8037C4C8); - sp60[1] = 0.0f; - if(func_80294548()){ - func_80294480(sp54); - ml_vec3f_normalize_copy(sp48, sp60); - sp44 = ml_dotProduct_vec3f(sp48, sp54); - sp40 = get_slope_timer(); - if(sp44 != 0.0f){ - if(sp44 < 0){ - //sp44 = 0.0f; - if(func_8028B3B4()){ - sp40 = ml_map_f(sp40, 0.0f, 1.0f, sp44*0.5, -1.0f); - } - else{//L80296E3C - sp40 = 0.5*sp44; - }//L80296E54 - ml_vec3f_scale(sp60, 1.0 + sp40); - } - else{//L80296E84 - sp40 = sp44*0.2; - ml_vec3f_scale(sp60, sp40 + 1.0); - } - }//L80296EBC - }//L80296EBC - - ml_vec3f_scale_copy(sp84, sp60, func_8029CED0()); - ml_vec3f_scale_copy(sp78, sp6C, func_8029CED0()); - ml_vec3f_diff(sp84, sp78); - ml_vec3f_scale(sp84, time_getDelta()/0.0333333); - D_8037C4B8[0] += sp84[0];\ - D_8037C4B8[1] += sp84[1];\ - D_8037C4B8[2] += sp84[2]; - - sp6C[0] = D_8037C4B8[0]; - sp6C[2] = D_8037C4B8[2]; - ml_vec3f_scale_copy(D_8037C4D8, sp6C, 1.0f); - if(mlAbsF(D_8037C4B8[0]) < 0.0001) - D_8037C4B8[0] = 0; - - if(mlAbsF(D_8037C4B8[2]) < 0.0001) - D_8037C4B8[2] = 0; - - D_8037C4B8[1] = D_8037C4B8[1] + time_getDelta()*D_8037C4E8 ; - if(D_8037C4B8[1] < D_8037C4EC) - D_8037C4B8[1] = D_8037C4EC; - - D_8037C4D8[1] = D_8037C4D8[1] + D_8037C4B8[1]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_80297094(void){ - f32 sp24[3]; - ml_vec3f_diff_copy(sp24, D_8037C4C8, D_8037C4B8); - ml_vec3f_scale(sp24, time_getDelta()*D_8037C4F8); - if(_SQ3v1(sp24) < 0.02){ - ml_vec3f_copy(D_8037C4B8, D_8037C4C8); - } - else{ - D_8037C4B8[0] += sp24[0];\ - D_8037C4B8[1] += sp24[1];\ - D_8037C4B8[2] += sp24[2]; - } - D_8037C4D8[0] = D_8037C4B8[0];\ - D_8037C4D8[1] = D_8037C4B8[1];\ - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale( D_8037C4D8, time_getDelta()); - - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802971DC(void){ - D_8037C4B8[1] = D_8037C4B8[1] + time_getDelta()*D_8037C4E8; - if(D_8037C4B8[1] < D_8037C4EC) - D_8037C4B8[1] = D_8037C4EC; - - D_8037C4D8[0] = D_8037C4B8[0];\ - D_8037C4D8[1] = D_8037C4B8[1];\ - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - - D_8037C4A8[0] += D_8037C4D8[0];\ - D_8037C4A8[1] += D_8037C4D8[1];\ - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802972AC(void){ - f32 sp34[3]; - f32 sp28[3]; - - climbGetBottom(sp28); - D_8037C4A8[0] = sp28[0]; - D_8037C4A8[2] = sp28[2]; - func_80256E24(sp34, 0.0f, yaw_get(), 0.0f, 0.0f, -climbGetRadius()); - - D_8037C4B8[2] = 0.0f; - D_8037C4A8[0] += sp34[0];\ - D_8037C4A8[1] += sp34[1];\ - D_8037C4A8[2] += sp34[2]; - - - D_8037C4B8[0] = D_8037C4C8[0] = D_8037C4C8[2] = D_8037C4B8[2]; - func_80297094(); -} - -void func_8029737C(void){ - D_8037C4D8[0] = D_8037C4B8[0]; - D_8037C4D8[1] = D_8037C4B8[1]; - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0]; - D_8037C4A8[1] += D_8037C4D8[1]; - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_8029740C(void){ - D_8037C4D8[0] = D_8037C4B8[0]; - D_8037C4D8[1] = D_8037C4B8[1]; - D_8037C4D8[2] = D_8037C4B8[2]; - ml_vec3f_clear(D_8037C4B8); - ml_vec3f_scale(D_8037C4D8, time_getDelta()); - D_8037C4A8[0] += D_8037C4D8[0]; - D_8037C4A8[1] += D_8037C4D8[1]; - D_8037C4A8[2] += D_8037C4D8[2]; -} - -void func_802974A0(void){ - f32 sp2C; - - switch(D_8037C508.unk0){ - case 0: //L80297628 - break; - case 1: //L802974E8 - D_8037C508.unk0 = 2; - _player_getPosition(D_8037C508.unk4); - D_8037C508.unk20 = 0.0f; - func_80297A0C(0); - break; - case 2: //L80297510 - D_8037C508.unk20 += time_getDelta(); - sp2C = ml_map_f(D_8037C508.unk20, 0.0f, D_8037C508.unk1C, 0.0f, 1.0f); - ml_vec3f_copy(D_8037C4B8, D_8037C4A8); - D_8037C4A8[0] = ml_interpolate_f(sp2C, D_8037C508.unk4[0], D_8037C508.unk10[0]); - D_8037C4A8[1] = ml_interpolate_f(sp2C, D_8037C508.unk4[1], D_8037C508.unk10[1]); - D_8037C4A8[2] = ml_interpolate_f(sp2C, D_8037C508.unk4[2], D_8037C508.unk10[2]); - ml_vec3f_diff_copy(D_8037C4B8, D_8037C4A8, D_8037C4B8); - ml_vec3f_scale(D_8037C4B8, 1.0/time_getDelta()); - if(1.0 == sp2C){ - func_80297A0C(0); - D_8037C508.unk0 = 3; - } - break; - case 3: //L80297628 - break; - } -} - -void func_80297638(void){ - f32 temp_f0; - - D_8037C500 += time_getDelta(); - temp_f0 = func_80257A44(D_8037C500, 1.2f); - temp_f0 = ml_sin_deg(temp_f0*360.0f); - D_8037C4A8[1] = 5.0*temp_f0 + D_8037C4FC; -} - -void func_802976C0(f32 arg0[3]){ - ml_vec3f_copy(arg0, D_8037C4D8); -} - -void func_802976E4(void){ - D_8037C4A0 = 0; - ml_vec3f_clear(D_8037C4B8); - ml_vec3f_clear(D_8037C4C8); - ml_vec3f_clear(D_8037C4D8); - ml_vec3f_clear(D_8037C4A8); - D_8037C4E4 = 0.0f; - func_80297B3C(); -} - -void func_80297744(void){ - _player_getPosition(D_8037C4A8); - switch(D_8037C4A0){ - case 0xc: //L80297780 - func_802974A0(); - break; - case 0xb: //L80297790 - func_80297638(); - break; - case 0x8: //L802977A0 - func_8029737C(); - break; - case 0x1: //L802977B0 - func_802971DC(); - break; - case 0x9: //L802977C0 - func_80297094(); - break; - case 0x2: //L802977D0 - func_8029797C(yaw_getIdeal()); - func_80296CF0(); - break; - case 0x5: //L802977F0 - func_8029797C(mlNormalizeAngle(yaw_getIdeal() + 180.0f)); - func_80296CF0(); - break; - case 0x3: //L80297820 - func_80296CF0(); - break; - case 0x4: //L80297830 - func_8029740C(); - break; - case 0x6: //L80297840 - if(0.0f < func_8029B2E8()){ - func_8029797C(func_8029B33C()); - } - func_80296CF0(); - break; - case 0xa: //L80297880 - func_802972AC(); - break; - case 0: - default: - break; - } - player_setPosition(D_8037C4A8); -} - -void func_802978A4(void){ - func_80297970(0.0f); - D_8037C4B8[0] = D_8037C4B8[2] = 0.0f; -} - -void func_802978DC(int arg0){ - if(arg0 == 0xB && arg0 != D_8037C4A0){ - D_8037C4FC = D_8037C4A8[1]; - D_8037C500 = 0.0f; - } - if(arg0 == 0xC){ - D_8037C508.unk0 = 1; - } - D_8037C4A0 = arg0; -} - -void func_80297930(f32 arg0[3]){ - if(arg0) - ml_vec3f_copy(D_8037C4C8, arg0); - else - ml_vec3f_clear(D_8037C4C8); -} - -void func_80297970(f32 arg0){ - D_8037C4F0 = arg0; -} - -void func_8029797C(f32 arg0){ - D_8037C4F4 = mlNormalizeAngle(arg0); -} - -void player_setYVelocity(f32 arg0){ - D_8037C4B8[1] = arg0; -} - -void func_802979AC(f32 arg0, f32 arg1) -{ func_80256D0C(0.0f, arg0, 0.0f, 0.0f, arg1, &D_8037C4B8[0], &D_8037C4B8[1], &D_8037C4B8[2]); -} - -void func_80297A0C(f32 arg0[3]){ - if(arg0) - ml_vec3f_copy(D_8037C4B8, arg0); - else - ml_vec3f_clear(D_8037C4B8); -} - -f32 func_80297A4C(void){ - return D_8037C4E8; -} - -s32 func_80297A58(void){ - return D_8037C4A0; -} - -f32 func_80297A64(void){ - return D_8037C4F0; -} - -f32 func_80297A70(void){ - return D_8037C4C8[1]; -} - -f32 func_80297A7C(void){ - return D_8037C4F4; -} - -void _get_velocity(f32 dst[3]){ - ml_vec3f_copy(dst, D_8037C4B8); -} - -f32 _get_vertVelocity(void){ - return D_8037C4B8[1]; -} - -f32 _get_horzVelocity(void){ - return gu_sqrtf(D_8037C4B8[0]*D_8037C4B8[0] + D_8037C4B8[2]*D_8037C4B8[2]); -} - -f32 func_80297AF0(void){ - f32 temp_f2; - f32 temp_f0; - f32 temp_f12; - - temp_f2 = _get_horzVelocity(); - temp_f0 = func_80297A64(); - - if(temp_f2 < temp_f0){ - temp_f12 = temp_f2/temp_f0; - } - else{ - temp_f12 = 1.0f; - } - return temp_f12; -} - -void func_80297B3C(void){ - gravity_reset(); - func_80297B94(); -} - -void func_80297B64(f32 arg0){ - D_8037C4F8 = arg0; -} - -void gravity_reset(void){ - gravity_set(D_80364440); -} - -void func_80297B94(void){ - func_80297BF8(D_80364444); -} - -void func_80297BB8(f32 arg0){ - D_8037C508.unk1C = arg0; -} - -void func_80297BC4(f32 src[3]) -{ ml_vec3f_copy(D_8037C508.unk10, src); -} - -void gravity_set(f32 arg0){ - D_8037C4E8 = arg0; -} - -void func_80297BF8(f32 arg0){ - D_8037C4EC = arg0; -} - -int func_80297C04(f32 arg0){ - return D_8037C4B8[0]*D_8037C4B8[0] + D_8037C4B8[2]*D_8037C4B8[2] <= (arg0*arg0); -} - -int func_80297C48(void){ - return D_8037C508.unk0 == 3; -} diff --git a/src/core2/fx/airscore.c b/src/core2/fx/airscore.c index 16c23fc2..a36e10bf 100644 --- a/src/core2/fx/airscore.c +++ b/src/core2/fx/airscore.c @@ -2,11 +2,14 @@ #include "functions.h" #include "variables.h" +#define AIRSCORE_COUNT (6) +#define FXAIRSCORE_SCALE (0.68f) + extern f32 func_802FB0E4(struct8s *); /* .data */ -BKSprite *D_8036A960 = NULL; -Gfx D_8036A968[] ={ +static BKSprite *s_sprite = NULL; +static Gfx s_fxairscore_context[] ={ gsDPPipeSync(), gsSPClearGeometryMode(G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH), gsSPSetGeometryMode(G_SHADE | G_TEXTURE_GEN_LINEAR | G_SHADING_SMOOTH), @@ -18,12 +21,12 @@ Gfx D_8036A968[] ={ }; /* .bss */ -s32 D_80381F50; +s32 s_freeze; f32 D_80381F54; f32 D_80381F58; -f32 D_80381F5C; -f32 D_80381F60; -f32 D_80381F68[6]; +static f32 s_texture_scale; +static f32 s_active_count; +f32 D_80381F68[AIRSCORE_COUNT]; struct7s D_80381F80; /* .code */ @@ -32,65 +35,67 @@ void func_803016F0(void) { D_80381F58 = -272.0f; D_80381F54 = 1.0f; - D_80381F50 = 0; - for(i = 0; i < 6; i++){ + s_freeze = 0; + for(i = 0; i < AIRSCORE_COUNT; i++){ D_80381F68[i] = -64.0f; } } -void fxairscore_free(s32 arg0, struct8s *arg1) { - if (D_8036A960 != NULL) { - func_8033BD4C(D_8036A960); - D_8036A960 = NULL; +void fxairscore_free(s32 arg0, struct7s *arg1) { + if (s_sprite != NULL) { + func_8033BD4C(s_sprite); + s_sprite = NULL; } func_803016F0(); } struct7s *fxairscore_new(s32 arg0) { func_803016F0(); - D_80381F5C = 0.68f; + s_texture_scale = FXAIRSCORE_SCALE; return &D_80381F80; } void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx) { - f32 temp_f16; - f32 var_f14; - s32 spD4; - s32 spD0; - s32 var_s4; + f32 y; + f32 x; + s32 texture_width; + s32 texture_height; + s32 i_part; s32 var_s6; - s32 var_v0; - s32 var_v1; + s32 v_x; + s32 v_y; - if (D_8036A960 != 0) { - gSPDisplayList((*gfx)++, D_8036A968); - func_80347FC0(gfx, D_8036A960, 0, 0, 0, 0, 0, 2, 2, &spD4, &spD0); + if (s_sprite != 0) { + gSPDisplayList((*gfx)++, s_fxairscore_context); + func_80347FC0(gfx, s_sprite, 0, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height); func_8024C7B8(gfx, mtx); - for(var_s4 = 0; var_s4 < 6; var_s4++){ - if ((var_s4 != 0) && (var_s4 != 5)) { - var_s6 = (var_s4 & 1) ? var_s4 + 1 : var_s4 - 1; + //render all 6 air pieces + for(i_part = 0; i_part < AIRSCORE_COUNT; i_part++){ + if ((i_part != 0) && (i_part != 5)) { + var_s6 = (i_part & 1) ? i_part + 1 : i_part - 1; } else { - var_s6 = var_s4; + var_s6 = i_part; } gDPPipeSync((*gfx)++); - if ((f32) (5 - var_s4) < D_80381F60) { + if ((f32) (5 - i_part) < s_active_count) { gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0xFF); } else { gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78); } - temp_f16 = func_802FB0E4(arg1); - temp_f16 = (-40.0f + temp_f16); - var_f14 = (temp_f16 + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); - temp_f16 = (((var_s4 * 15.5) + 78.0) - ((f32) framebuffer_height / 2)); - var_f14 = (var_s4 & 1) ? var_f14 + 5.0f : var_f14 - 5.0f; + x = func_802FB0E4(arg1); + x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); + y = ((78 + (i_part * 15.5)) - ((f32) framebuffer_height / 2)); + + //stagger x position + x = (i_part & 1) ? x + 5.0f : x - 5.0f; gSPVertex((*gfx)++, *vtx, 4, 0); - for(var_v1 = 0; var_v1 < 2; var_v1++){ - for(var_v0 = 0; var_v0 < 2; var_v0++){ - (*vtx)->v.ob[0] = ((((spD4 * D_80381F5C) * (f32) var_v0) - ((spD4 * D_80381F5C) / 2)) + var_f14) * 4.0f; - (*vtx)->v.ob[1] = ((((spD0 * D_80381F5C) / 2) - ((spD0 * D_80381F5C) * ((f32)var_v1))) + temp_f16) * 4.0f; + for(v_y = 0; v_y < 2; v_y++){ + for(v_x = 0; v_x < 2; v_x++){ + (*vtx)->v.ob[0] = (x + (((texture_width * s_texture_scale) * v_x) - ((texture_width * s_texture_scale) / 2))) * 4.0f; + (*vtx)->v.ob[1] = (y + (((texture_height * s_texture_scale) / 2) - (texture_height * s_texture_scale) * v_y)) * 4.0f; (*vtx)->v.ob[2] = -0x14; - (*vtx)->v.tc[0] = ((spD4 - 1) * var_v0) << 6; - (*vtx)->v.tc[1] = ((spD0 - 1) * var_v1) << 6; + (*vtx)->v.tc[0] = ((texture_width - 1) * v_x) << 6; + (*vtx)->v.tc[1] = ((texture_height - 1) * v_y) << 6; (*vtx)++; } } @@ -110,7 +115,7 @@ bool func_80301CE0(f32 arg0, s32 arg1, s32 arg2){ return arg0 < D_80381F68[arg1 + 1]; } -s32 func_80301D24(s32 time) { +s32 fxairscore_time_to_count(s32 time) { s32 minutes; s32 var_v0; @@ -119,28 +124,28 @@ s32 func_80301D24(s32 time) { return MIN(6, minutes); } -s32 func_80301DBC(s32 minutes) { - return (s32) (minutes * 60 * 60) / 6; +s32 fxairscore_count_to_time(s32 count) { + return (s32) (count * 60 * 60) / 6; } -void fxairscore_update(enum item_e arg0, struct7s *arg1) { +void fxairscore_update(enum item_e item_id, struct7s *arg1) { s32 temp_s0; s32 var_s0; temp_s0 = func_802FB0D4(arg1); - if (D_80381F50 == 0) { - D_80381F60 = (f32) func_80301D24(itemPrint_getValue(arg0)); + if (!s_freeze) { + s_active_count = (f32) fxairscore_time_to_count(itemPrint_getValue(item_id)); } switch (temp_s0) { case 2: break; - case 1: - if (D_8036A960 == NULL) { - D_8036A960 = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB); + case 1: //load sprite + if (s_sprite == NULL) { + s_sprite = (BKSprite *)assetcache_get(ASSET_7E5_SPRITE_WATER_HONEYCOMB); } break; case 0: - fxairscore_free(arg0, arg1); + fxairscore_free(item_id, arg1); break; } if (temp_s0 != 0) { diff --git a/src/core2/fx/common2score.c b/src/core2/fx/common2score.c index 575a5590..9b33d919 100644 --- a/src/core2/fx/common2score.c +++ b/src/core2/fx/common2score.c @@ -131,8 +131,8 @@ struct8s D_80369960[] = { void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ s32 tmp_s2 = 0; s32 tmp_s4; - s32 spAC; - s32 spA8; + s32 texture_width; + s32 texture_height; f32 tmp_f26; f32 f2; @@ -148,15 +148,15 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(arg0->unk20 == ITEM_0_HOURGLASS_TIMER){ tmp_s2 = 0xC; } - func_80347FC0(gfx, arg0->unk50, ((s32)arg0->unk60 + tmp_s2)%arg0->unk2C, 0, 0, 0, 0, 2, 2, &spAC, &spA8); - tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && spAC == 0x10) ? 1.0f : 0.0f; + func_80347FC0(gfx, arg0->unk50, ((s32)arg0->unk60 + tmp_s2)%arg0->unk2C, 0, 0, 0, 0, 2, 2, &texture_width, &texture_height); + tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && texture_width == 0x10) ? 1.0f : 0.0f; for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528 for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){// - (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((spAC*arg0->unk40*tmp_s2 - spAC*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; - (*vtx)->v.ob[1] = ((((spA8*arg0->unk40/2 - spA8*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; + (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; + (*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; (*vtx)->v.ob[2] = -0x14; - (*vtx)->v.tc[0] = ((spAC -1) * tmp_s2) << 6; - (*vtx)->v.tc[1] = ((spA8 -1) * tmp_s4) << 6; + (*vtx)->v.tc[0] = ((texture_width -1) * tmp_s2) << 6; + (*vtx)->v.tc[1] = ((texture_height -1) * tmp_s4) << 6; if(arg0->unk20 == ITEM_C_NOTE){ if(tmp_s4 == 0){ (*vtx)->v.cn[0] = 0xff; diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index 501ffbbb..7ec16720 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "actor.h" #include "prop.h" diff --git a/src/cutscenes/code_6730.c b/src/cutscenes/code_6730.c index 8ef17943..caa0b1dc 100644 --- a/src/cutscenes/code_6730.c +++ b/src/cutscenes/code_6730.c @@ -84,7 +84,7 @@ void func_8038CCA8(Actor *this){ case 1: this->unk60 = MAX(0.0, this->unk60 - sp24); if(0.0f == this->unk60){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); actor_playAnimationOnce(this); } break; diff --git a/src/cutscenes/code_6C90.c b/src/cutscenes/code_6C90.c index 5933f4d7..cee45e44 100644 --- a/src/cutscenes/code_6C90.c +++ b/src/cutscenes/code_6C90.c @@ -85,7 +85,7 @@ void func_8038D218(Actor *this){ case 1: this->unk60 = MAX(0.0, this->unk60 - sp24); if(0.0f == this->unk60){ - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); actor_playAnimationOnce(this); } break; diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index cbfbb936..717c9549 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -5,7 +5,7 @@ extern void viewport_getPosition(f32 (*)[3]); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80386654(f32 arg0, f32 (*arg1)[4], f32 (*arg2)[4]); extern void func_80324CFC(f32, enum comusic_e, s32); extern void func_80387470(Actor *, f32 [3], f32, f32, f32, f32, f32); @@ -208,7 +208,7 @@ void func_8038C840(Actor *this){ case 1: //8038C92C animctrl_setAnimTimer(this->animctrl, 0.0f); if(this->unk60 < 0.0) - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); else//L8038C974 this->unk60 -= sp74; @@ -219,7 +219,7 @@ void func_8038C840(Actor *this){ func_8030E878(SFX_105_EYRIE_YAWN, randf2(0.95f, 1.05f), 32000, this->position, 1000.0f, 5000.0f); if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); func_8030E878(0x3ee, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); } break; @@ -289,14 +289,14 @@ void func_8038C840(Actor *this){ if(sp48){ if(actor_animationIsAt(this, 0.96f)){ - func_80328B8C(this, 4, 0.0f, -1); + subaddie_set_state_with_direction(this, 4, 0.0f, -1); actor_playAnimationOnce(this); } } else{//L8038CD68 if(actor_animationIsAt(this, 0.9f)){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); FUNC_8030E8B4(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); func_80324D54(0.1f, SFX_C1_BUZZBOMB_ATTACK, 0.85f, 32000, this->position, 5000.0f, 12000.0f); func_8034A174(this->marker->unk44, 0x1f, this->position); @@ -356,7 +356,7 @@ void func_8038D014(Actor *this){ this->alpha_124_19 = 0x7d; actor_setOpacity(this, this->alpha_124_19); this->scale = (f64)this->scale + this->scale; - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); func_80343DEC(this); }//L8038D0B8 diff --git a/src/fight/chbossjinjobase.c b/src/fight/chbossjinjobase.c index e8eab233..6f32d6ed 100644 --- a/src/fight/chbossjinjobase.c +++ b/src/fight/chbossjinjobase.c @@ -66,7 +66,7 @@ void func_8038D428(ActorMarker *arg0, ActorMarker *arg1) { func_8025A70C(COMUSIC_2B_DING_B); temp_v0->unk38_31++; if (temp_v0->unk38_31 >= 3) { - func_80328A84(temp_v0, 3); + subaddie_set_state(temp_v0, 3); chstonejinjo_breakOpen(temp_v0->unk100); func_8038D3DC(temp_v0, 0x19A, -100.0f, 0.0f, 1.2f); func_80324D54(1.2f, SFX_90_SWITCH_PRESS, 1.0f, 32000, temp_v0->position, 1000.0f, 2000.0f); @@ -158,7 +158,7 @@ void func_8038D568(Actor *this){ } else{//L8038D8E0 - func_80328A84(this, 2); + subaddie_set_state(this, 2); func_8030DA44(this->unk44_31); this->unk44_31 = 0; func_8030DA44(local->unk0); diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 9d96c82d..1840fae5 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -691,7 +691,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) switch(phase_id) { case 0: - func_80328B8C(actor, 1, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 1, 0.0001f, 1); timed_setStaticCameraToNode(0.0f, 0); timed_exitStaticCamera(2.0f); timed_setStaticCameraToNode(2.0f, 1); @@ -699,7 +699,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 1: - func_80328B8C(actor, 2, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 2, 0.0001f, 1); func_8030E878(SFX_EA_GRUNTY_LAUGH_1, randf2(0.95f, 1.05f), 32000, actor->position, 5000.0f, 12000.0f); local->unk5 = 0x0; actor->unk1C_x = D_803927D0[(local->unk5)][0]; @@ -717,7 +717,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 2: - func_80328B8C(actor, 0xE, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0xE, 0.0001f, 1); local->unk5 = 0x8; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -727,7 +727,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) case 3: - func_80328B8C(actor, 0x15, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0x15, 0.0001f, 1); local->unk5 = 0xC; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -736,7 +736,7 @@ void chfinalboss_setPhase(ActorMarker *this, u32 phase_id) return; case 4: - func_80328B8C(actor, 0x1C, 0.0001f, 1); + subaddie_set_state_with_direction(actor, 0x1C, 0.0001f, 1); local->unk5 = 0x10; actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; @@ -906,7 +906,7 @@ void chfinalboss_phase1_setState(Actor *this, s32 next_state) { sp40 = func_8023DB5C(); sp3C = animctrl_getAnimTimer(this->animctrl); local->phase = 1; - func_80328B8C(this, next_state, 0.0001f, 1); + subaddie_set_state_with_direction(this, next_state, 0.0001f, 1); actor_loopAnimation(this); func_80386600(this->marker, 0); if (next_state != 9) { @@ -1201,7 +1201,7 @@ void chfinalboss_phase2_setState(Actor *this, s32 arg1){ local = (ActorLocal_fight_180 *)&this->local; sp28 = func_8023DB5C(); local->phase = 2; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); actor_loopAnimation(this); switch (arg1) { case 14: @@ -1382,7 +1382,7 @@ void chfinalboss_phase3_setState(Actor *this, s32 arg1) { local = (ActorLocal_fight_180 *)&this->local; local->phase = 3; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); switch (arg1) { case 21: if((local->unk5 + 1) < 0x10) { @@ -1584,7 +1584,7 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { local = (ActorLocal_fight_180 *)&this->local; sp48 = animctrl_getAnimTimer(this->animctrl); local->phase = 4; - func_80328B8C(this, arg1, 0.0001f, 1); + subaddie_set_state_with_direction(this, arg1, 0.0001f, 1); switch (arg1) { case 28: animctrl_setAnimTimer(this->animctrl, sp48); @@ -1847,10 +1847,10 @@ void chfinalboss_phase4_update(ActorMarker *marker) { } } -void func_80328B8C(Actor *, s32, f32, s32); +void subaddie_set_state_with_direction(Actor *, s32, f32, s32); void func_8038AC50(ActorMarker *arg0) { - func_80328B8C(marker_getActor(arg0), 0x24, 0.0001f, 1); + subaddie_set_state_with_direction(marker_getActor(arg0), 0x24, 0.0001f, 1); } void chfinalboss_phase5_setState(Actor *this, s32 next_state) { @@ -1863,7 +1863,7 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { local = (ActorLocal_fight_180 *)&this->local; sp28 = 0x12; local->phase = 5; - func_80328B8C(this, next_state, 0.0001f, 1); + subaddie_set_state_with_direction(this, next_state, 0.0001f, 1); switch (next_state) { case 35: func_80311480(randi2(0, 5) + 0x114F, 4, NULL, NULL, NULL, NULL); diff --git a/src/fight/chjinjonator.c b/src/fight/chjinjonator.c index 2dd49514..7ec97b7b 100644 --- a/src/fight/chjinjonator.c +++ b/src/fight/chjinjonator.c @@ -3,7 +3,7 @@ #include "variables.h" extern f32 func_8038C288(void); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80324CFC(f32, s32, s32); extern void func_802F9E44(s32, f32, f32, f32, f32); extern void func_80387470(Actor *, f32 [3], f32, f32, f32, f32, f32); @@ -132,7 +132,7 @@ void chjinjonator_spawnAttackParticles(Actor *this, s32 arg1){ void chjinjonator_803903C4(Actor *this){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 7, 0.001f, 1); + subaddie_set_state_with_direction(this, 7, 0.001f, 1); actor_loopAnimation(this); } @@ -183,7 +183,7 @@ void chjinjonator_update(Actor *this){ animctrl_setAnimTimer(this->animctrl, 0.0f); this->unk60 -= sp58; if(this->unk60 < 0.0){ - func_80328B8C(this, 2, 0.001f, 1); + subaddie_set_state_with_direction(this, 2, 0.001f, 1); actor_playAnimationOnce(this); } break; @@ -199,7 +199,7 @@ void chjinjonator_update(Actor *this){ } if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 3, 0.001f, 1); + subaddie_set_state_with_direction(this, 3, 0.001f, 1); actor_playAnimationOnce(this); func_8030E394(this->unk44_31); func_8030DA44(this->unk44_31); @@ -216,7 +216,7 @@ void chjinjonator_update(Actor *this){ }//L803907A0 if(320.0f == this->position_y){ - func_80328B8C(this, 4, 0.001f, 1); + subaddie_set_state_with_direction(this, 4, 0.001f, 1); actor_loopAnimation(this); local->unk4 = func_8038C288(); } @@ -224,7 +224,7 @@ void chjinjonator_update(Actor *this){ case 4: //803907D4 chjinjonator_80390278(this); - func_80328B8C(this, 5, 0.001f, 1); + subaddie_set_state_with_direction(this, 5, 0.001f, 1); actor_playAnimationOnce(this); break; @@ -232,7 +232,7 @@ void chjinjonator_update(Actor *this){ chjinjonator_80390278(this); if(actor_animationIsAt(this, 0.998f)){ animctrl_setSmoothTransition(this->animctrl, FALSE); - func_80328B8C(this, 6, 0.0001f, 1); + subaddie_set_state_with_direction(this, 6, 0.0001f, 1); actor_loopAnimation(this); if(this->unk44_31 == 0){ local->unk18 = 0.1f; @@ -314,7 +314,7 @@ void chjinjonator_update(Actor *this){ } if(actor_animationIsAt(this, 0.999f)){ - func_80328B8C(this, 0xA, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xA, 0.001f, 1); actor_loopAnimation(this); local->unk20 = 0xE; } @@ -332,7 +332,7 @@ void chjinjonator_update(Actor *this){ if(local->unk20 <= 0){ s32 text_id; - func_80328B8C(this, 0xB, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xB, 0.001f, 1); actor_playAnimationOnce(this); func_802BB41C(0); text_id = 0x115e + randi2(0,5); @@ -345,7 +345,7 @@ void chjinjonator_update(Actor *this){ FUNC_8030E624(SFX_17B_AIRPLANE_FALLING, 1.0f, 32000); FUNC_8030E624(SFX_147_GRUNTY_SPELL_ATTACK_2, 1.0f, 32000); animctrl_setSmoothTransition(this->animctrl, 0); - func_80328B8C(this, 0xC, 0.001f, 1); + subaddie_set_state_with_direction(this, 0xC, 0.001f, 1); actor_playAnimationOnce(this); this->velocity[2] = 0.0f; this->velocity[1] = 0.0f; @@ -389,10 +389,10 @@ void chjinjonator_attack(ActorMarker *marker, s32 hit_count, bool mirrored) { animctrl_setSmoothTransition(temp_s0->animctrl, 1); actor_playAnimationOnce(temp_s0); if (&D_8039203C[hit_count] >= D_80392060) { - func_80328B8C(temp_s0, 9, 0.001f, 1); + subaddie_set_state_with_direction(temp_s0, 9, 0.001f, 1); return; } - func_80328B8C(temp_s0, 8, 0.001f, 1); + subaddie_set_state_with_direction(temp_s0, 8, 0.001f, 1); animctrl_setDuration(temp_s0->animctrl, (f32) (1.75 - 0.11 * local->unk24)); } diff --git a/src/fight/chjinjonatorbase.c b/src/fight/chjinjonatorbase.c index 6c71414e..acfe971e 100644 --- a/src/fight/chjinjonatorbase.c +++ b/src/fight/chjinjonatorbase.c @@ -86,7 +86,7 @@ void func_8038E120(ActorMarker * marker, ActorMarker *arg1){ remaining = local->unk0[0] + local->unk0[1] + local->unk0[2] + local->unk0[3]; if( remaining <= 0){ func_8038C148(); - func_80328A84(actor, 3); + subaddie_set_state(actor, 3); chstonejinjo_breakOpen(actor->unk100); } }//L8038E24C @@ -185,7 +185,7 @@ void chjinjonatorbase_update(Actor *this){ other->position_z = sp38[2] + other->position_z; } else{//L8038E6FC - func_80328A84(this, 2); + subaddie_set_state(this, 2); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000); func_8030E394(this->unk44_31); func_8030DA44(this->unk44_31); diff --git a/src/fight/chspellfireball.c b/src/fight/chspellfireball.c index c633e457..232e6f9d 100644 --- a/src/fight/chspellfireball.c +++ b/src/fight/chspellfireball.c @@ -214,7 +214,7 @@ void func_8038F084(ActorMarker *marker){ chbossjinjo_spawnParticles(actor, 0x712, ASSET_6C3_SPRITE_SMOKE_GREEN, 1.6f); } local->unk0 = 0.66f; - func_80328A84(actor, 2); + subaddie_set_state(actor, 2); }//L8038F39C } diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index 91c0529f..31698801 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -4,7 +4,7 @@ #include "fight.h" extern Actor *actorArray_findActorFromActorId(); -extern void func_80328B8C(Actor*, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor*, s32, f32, s32); extern f32 chbossjinjo_8038D268(void); void chstonejinjo_update(Actor *); @@ -100,7 +100,7 @@ void chstonejinjo_update(Actor *this) { } } if (actor_animationIsAt(this, 0.999f)) { - func_80328B8C(this, 3, 0.99999f, 1); + subaddie_set_state_with_direction(this, 3, 0.99999f, 1); actor_playAnimationOnce(this); func_80326310(this); } @@ -116,7 +116,7 @@ void chstonejinjo_breakOpen(ActorMarker *marker){ f32 sp24[3]; if(actor->state != 2){ - func_80328B8C(actor, 2, 0.0f, 1); + subaddie_set_state_with_direction(actor, 2, 0.0f, 1); actor_playAnimationOnce(actor); animctrl_setDuration(actor->animctrl, actor->unk1C[0]); SPAWNQUEUE_ADD_1(chstonejinjo_spawnJinjo, actor->marker); diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index e9d9555e..02c34607 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -51,7 +51,7 @@ void func_8038BADC(ActorMarker *marker, enum asset_e text_id, s32 arg2) { func_80311480(0xD38, 0xC, this->position, this->marker, func_8038BADC, NULL); return; } - func_80328A84(this, 1); + subaddie_set_state(this, 1); } void func_8038BBC0(Actor *this) { @@ -181,14 +181,14 @@ void chBrentilda_update(Actor *this) { if (!fileProgressFlag_get(FILEPROG_96_MET_BRENTILDA)) { func_80311480(ASSET_10A1_DIALOG_BRENTILDA_MEET, 0xA, this->position, this->marker, func_8038BADC, NULL); fileProgressFlag_set(FILEPROG_96_MET_BRENTILDA, TRUE); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; } if (func_8028EFC8() && (sp78[FACE_BUTTON(BUTTON_B)] == 1)) { this->unk10_12++; this->unk10_12 %= 3; func_80311174(local->unk0 + this->unk10_12, 0xB, this->position, this->marker, func_8038BADC, NULL, func_8038BA30); - func_80328A84(this, 2); + subaddie_set_state(this, 2); return; } } else { @@ -197,13 +197,13 @@ void chBrentilda_update(Actor *this) { break; case 2: if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 3); + subaddie_set_state(this, 3); return; } break; case 3: if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 2); + subaddie_set_state(this, 2); } break; } diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index 6e1ca3af..14806538 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -80,7 +80,7 @@ enum file_progress_e chWarpCauldron_getPairedFileProgressFlagIndex(Actor *this){ } void func_8038A704(Actor *this){ - func_80328B8C(this, 3, 0.99f, 1); + subaddie_set_state_with_direction(this, 3, 0.99f, 1); } void func_8038A730(Actor *this, f32 *arg1, enum sfx_e arg2, enum sfx_e arg3, u32 arg4) { @@ -158,7 +158,7 @@ void func_8038AB90(Actor *this, s32 arg1, s32 arg2, enum sfx_e sfx_id, f32 sfx_t func_80324D2C(7.0f, COMUSIC_8C_JINJONATOR_POWERUP); } this->unk10_12 = 0; - func_80328AC8(this, arg1); + subaddie_set_state_forward(this, arg1); actor_playAnimationOnce(this); func_8028FCBC(); if (sfx_id != SFX_0_BLOOP) { @@ -235,7 +235,7 @@ void chWarpCauldron_update(Actor *this) { this->unk38_31 = randi2(0, phi_v0 - sp4C); } this->scale = 1.8f; - func_80328B8C(this, 6, 0.99f, 1); + subaddie_set_state_with_direction(this, 6, 0.99f, 1); func_802D09B8(this, 2); } if (fileProgressFlag_get(chWarpCauldron_getFileProgressFlagIndex(this))) { @@ -270,7 +270,7 @@ void chWarpCauldron_update(Actor *this) { case 1: //L8038B0F4 if (func_8038A690(this)) { func_8028F918(2); - func_80328AC8(this, 2); + subaddie_set_state_forward(this, 2); this->unk38_0 = FALSE; func_8038A96C(this, 1); func_802BAFE4(D_80393620[this->unkF4_8 - 1].unk3); diff --git a/src/lair/code_0.c b/src/lair/code_0.c index 9e852965..b24a7d0a 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -13,7 +13,7 @@ extern void func_802D4830(Actor *, s32, f32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_80324CFC(f32, enum comusic_e, s32); extern int actor_animationIsAt(Actor *, f32); -extern void func_80328B8C(Actor *, s32, f32, s32); +extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_8033A45C(s32, s32); extern void func_8034E0FC(void *, s32); extern void *func_8034C2C4(ActorMarker *, s32); @@ -231,7 +231,7 @@ void chFloorCobweb_update(Actor *this) { if (actor_animationIsAt(this, 0.95f)) { - func_80328B8C(this, 0xD, 0.98f, 1); + subaddie_set_state_with_direction(this, 0xD, 0.98f, 1); func_80326310(this); } } @@ -255,7 +255,7 @@ void chWallCobweb_update(Actor *this) { if (actor_animationIsAt(this, 0.9f)) { - func_80328B8C(this, 0x10, 0.98f, 1); + subaddie_set_state_with_direction(this, 0x10, 0.98f, 1); func_80326310(this); } } @@ -284,7 +284,7 @@ void lair_func_80386550(Actor *this) if (actor_animationIsAt(this, 0.95f)) { func_80326310(this); - func_80328B8C(this, 10, 0.98f, 1); + subaddie_set_state_with_direction(this, 10, 0.98f, 1); this->pitch = 270.0f; } @@ -1083,7 +1083,7 @@ void func_80388524(Actor *this) { switch(this->modelCacheIndex){ case ACTOR_2E5_DOOR_OF_GRUNTY: //L80388880 if (fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) && (this->state == 0x19)) { - func_80328B8C(this, 0x1B, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x1B, 0.999f, 1); } break; @@ -1167,7 +1167,7 @@ void func_80388524(Actor *this) { case 0x2E5: switch (this->state) { case 0x19: //L80388B34 - func_80328B8C(this, 0x1A, 0.0f, 1); + subaddie_set_state_with_direction(this, 0x1A, 0.0f, 1); func_8025A6EC(JINGLE_END_OF_INTRO, -1); break; @@ -1179,7 +1179,7 @@ void func_80388524(Actor *this) { func_8030E6D4(SFX_1B_EXPLOSION_1); } if (actor_animationIsAt(this, 0.97f)) { - func_80328B8C(this, 0x1B, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x1B, 0.999f, 1); fileProgressFlag_set(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN, 1); func_8030E6D4(SFX_6C_LOCKUP_CLOSING); } @@ -1577,7 +1577,7 @@ void func_80389898(Actor *this) { if (this->unk10_12) { - func_80328AC8(this, 0x13); + subaddie_set_state_forward(this, 0x13); actor_playAnimationOnce(this); fileProgressFlag_set(FILEPROG_9E_CRYPT_COFFIN_LID_OPEN, TRUE); } @@ -1606,7 +1606,7 @@ void func_80389934(Actor *this) this->unk16C_4 = TRUE; if (fileProgressFlag_get(FILEPROG_A2_GV_LOBBY_COFFIN_OPEN)) - func_80328B8C(this, 0x18, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x18, 0.999f, 1); } switch (this->state) @@ -1617,7 +1617,7 @@ void func_80389934(Actor *this) { this->unk1C[0] = 25; - func_80328AC8(this, 0x16); + subaddie_set_state_forward(this, 0x16); fileProgressFlag_set(FILEPROG_A2_GV_LOBBY_COFFIN_OPEN, TRUE); } @@ -1627,7 +1627,7 @@ void func_80389934(Actor *this) { if (--this->unk1C[0] == 0) { - func_80328AC8(this, 0x17); + subaddie_set_state_forward(this, 0x17); actor_playAnimationOnce(this); FUNC_8030E624(SFX_3F6_UNKNOWN, 0.6f, 32000); func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); @@ -1639,7 +1639,7 @@ void func_80389934(Actor *this) { if (actor_animationIsAt(this, 0.95f)) { - func_80328B8C(this, 0x18, 0.999f, 1); + subaddie_set_state_with_direction(this, 0x18, 0.999f, 1); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 26000,); } @@ -1701,7 +1701,7 @@ f32 func_80389AAC(Actor *this, f32 a1) } case 3: { - func_80328A84(this, 5); + subaddie_set_state(this, 5); break; } @@ -1744,7 +1744,7 @@ void func_80389D08(Actor *this) { if (this->unk60) { - func_80328AC8(this, 4); + subaddie_set_state_forward(this, 4); this->unk38_31 = 0; this->unk60 = 0; diff --git a/src/lair/code_86F0.c b/src/lair/code_86F0.c index 5c012432..18a94488 100644 --- a/src/lair/code_86F0.c +++ b/src/lair/code_86F0.c @@ -369,7 +369,7 @@ void func_8038F350(Actor *this, s32 next_state){ this->unk60 = 3.0f; break; } - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); } diff --git a/src/lair/code_A4A0.c b/src/lair/code_A4A0.c index 0ff29525..23fd075b 100644 --- a/src/lair/code_A4A0.c +++ b/src/lair/code_A4A0.c @@ -51,7 +51,7 @@ void func_80390890(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_lair_A4A0 *)&this->local; - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); actor_playAnimationOnce(this); func_8030E878(SFX_C2_GRUBLIN_EGH, local->unkC_27*0.1 + 0.8, 32000, this->position, 1250.0f, 2500.0f); __spawnQueue_add_4((GenFunction_4)func_802C4140, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); diff --git a/src/lair/code_A810.c b/src/lair/code_A810.c index 5279a86e..c8fcbcd9 100644 --- a/src/lair/code_A810.c +++ b/src/lair/code_A810.c @@ -58,7 +58,7 @@ void func_80390D3C(Actor *this, s32 val) ActorLocal_lair_A810 *local; local = (ActorLocal_lair_A810 *)&this->local; - func_80328A84(this, val); + subaddie_set_state(this, val); switch (val) { diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index e6094496..36289cd6 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -210,7 +210,7 @@ void func_80391810(Actor *this, s32 next_state) { func_803917DC(); break; } - func_80328A84(this, next_state); + subaddie_set_state(this, next_state); } diff --git a/src/lair/code_BBD0.c b/src/lair/code_BBD0.c index 78637d1b..f59a9139 100644 --- a/src/lair/code_BBD0.c +++ b/src/lair/code_BBD0.c @@ -81,7 +81,7 @@ void func_8039217C(Actor *this) { switch(this->state){ case 1: //L803921F4 if (randf() < 0.01) { - func_80328A84(this, 2U); + subaddie_set_state(this, 2U); } break; @@ -96,13 +96,13 @@ void func_8039217C(Actor *this) { func_80392014(this, SFX_20_METAL_CLANK_1, 0.95f, 1.05f, 15000); } if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 1U); + subaddie_set_state(this, 1U); } break; case 3: //L803922FC if (randf() < 0.01) { - func_80328A84(this, 4U); + subaddie_set_state(this, 4U); } break; @@ -114,29 +114,29 @@ void func_8039217C(Actor *this) { func_80392014(this, SFX_9_SQUEAKY_TOY, 1.25f, 1.35f, 28000); } if (actor_animationIsAt(this, 0.999f)) { - func_80328A84(this, 3U); + subaddie_set_state(this, 3U); } break; case 5: //L803923C0 if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE)) { - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); break; } if (mapSpecificFlags_get(9)) { mapSpecificFlags_set(5, 0); - func_80328A84(this, 8U); + subaddie_set_state(this, 8U); break; } if ((randf() < 0.1) || mapSpecificFlags_get(5)) { this->unk38_0 = mapSpecificFlags_get(5); this->unk60 = randf2(2.0f, 4.0f); - func_80328A84(this, 6U); + subaddie_set_state(this, 6U); func_803920E0(this, SFX_134_FREEZING_SHIVER, 1.1f, 1.2f, 15000, this->unk60); break; } if (randf() < 0.1) { - func_80328A84(this, 7U); + subaddie_set_state(this, 7U); } break; @@ -146,13 +146,13 @@ void func_8039217C(Actor *this) { break; } if (actor_animationIsAt(this, 0.999f) || (mapSpecificFlags_get(5) != this->unk38_0)) { - func_80328A84(this, 5U); + subaddie_set_state(this, 5U); } break; case 7: //L8039255C if ((actor_animationIsAt(this, 0.999f)) || (mapSpecificFlags_get(5) != this->unk38_0)) { - func_80328A84(this, 5U); + subaddie_set_state(this, 5U); } break; diff --git a/src/lair/code_C1C0.c b/src/lair/code_C1C0.c index 7ec635a5..d2666612 100644 --- a/src/lair/code_C1C0.c +++ b/src/lair/code_C1C0.c @@ -46,7 +46,7 @@ void func_80392690(ActorMarker *marker, enum asset_e text_id, s32 arg2){ this = marker_getActor(marker); func_8030E6D4(SFX_EA_GRUNTY_LAUGH_1); - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); actor_loopAnimation(this); this->yaw_ideal = 79.0f; animctrl_setTransitionDuration(this->animctrl, 0.4f); @@ -72,17 +72,17 @@ void func_80392700(Actor *this) { func_8028F94C(2, this->position); func_80311480(0x103F, 0x2A, this->position, this->marker, func_80392690, func_80392610); mapSpecificFlags_set(6, 0); - func_80328B8C(this, 3, 0.0f, 1); + subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); } if ((this->state == 3) && (actor_animationIsAt(this, 0.999f) != 0)) { - func_80328B8C(this, 4, 0.0f, 1); + subaddie_set_state_with_direction(this, 4, 0.0f, 1); actor_loopAnimation(this); } if (this->state == 5) { func_80328FB0(this, 12.0f); if (func_80329480(this) != 0) { - func_80328B8C(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, 5, 0.0f, 1); this->marker->unk2C_2 = TRUE; } }