diff --git a/include/core1/ucode.h b/include/core1/ucode.h index fb96ba3f2..4215a09ff 100644 --- a/include/core1/ucode.h +++ b/include/core1/ucode.h @@ -2,11 +2,12 @@ #define BANJO_KAZOOIE_CORE1_UCODE_H #include +#include "bool.h" void ucode_load(void); void ucode_stub1(void); // does nothing void ucode_stub2(void); // performs dummy read on PI -s32 ucode_stub3(void); // returns always 0 +bool ucode_stub3(void); // returns always 0 void ucode_getPtrAndSize(void **ptr, u32 *size); #endif diff --git a/include/core2/core2.h b/include/core2/core2.h index f2c9a1731..621545e01 100644 --- a/include/core2/core2.h +++ b/include/core2/core2.h @@ -15,6 +15,7 @@ #include "core2/mapspecificflags.h" #include "core2/picturebox.h" #include "core2/playerposition.h" +#include "core2/spawnqueue.h" #include "core2/vla.h" diff --git a/include/core2/spawnqueue.h b/include/core2/spawnqueue.h new file mode 100644 index 000000000..0eb9729ef --- /dev/null +++ b/include/core2/spawnqueue.h @@ -0,0 +1,98 @@ +#ifndef BANJO_KAZOOIE_CORE2_SPAWNQUEUE_H +#define BANJO_KAZOOIE_CORE2_SPAWNQUEUE_H + +#include +#include "enums.h" + +typedef Actor *(*spawnqueue_add_0_callback_f)(void); +//typedef Actor *(*spawnqueue_add_1_callback_f)(s32); +typedef Actor *(*spawnqueue_add_1_callback_f)(uintptr_t); +//typedef Actor *(*spawnqueue_add_2_callback_f)(s32, s32); +typedef Actor *(*spawnqueue_add_2_callback_f)(uintptr_t, uintptr_t); +//typedef Actor *(*spawnqueue_add_3_callback_f)(s32, s32, s32); +typedef Actor *(*spawnqueue_add_3_callback_f)(uintptr_t, uintptr_t, uintptr_t); +//typedef Actor *(*spawnqueue_add_4_callback_f)(s32, s32, s32, s32); +typedef Actor *(*spawnqueue_add_4_callback_f)(uintptr_t, uintptr_t, uintptr_t, uintptr_t); +//typedef Actor *(*spawnqueue_add_5_callback_f)(s32, s32, s32, s32, s32); +typedef Actor *(*spawnqueue_add_5_callback_f)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); + +typedef struct spawnqueue_function_s { + union { + spawnqueue_add_0_callback_f func0; + spawnqueue_add_1_callback_f func1; + spawnqueue_add_2_callback_f func2; + spawnqueue_add_3_callback_f func3; + spawnqueue_add_4_callback_f func4; + spawnqueue_add_5_callback_f func5; + }; +// s32 args[5]; + uintptr_t args[5]; + s32 arg_count; +} SpawnQueueFunction; + +void spawnQueue_init(void); +void spawnQueue_reset(void); +void spawnQueue_free(void); +void spawnQueue_func_802C39D4(void); +void spawnQueue_func_802C3A18(void); +void spawnQueue_flush(void); +void spawnQueue_unlock(void); +void spawnQueue_lock(void); + +void spawnQueue_add_0(spawnqueue_add_0_callback_f func); +//void spawnQueue_add_1(spawnqueue_add_1_callback_f func, s32 arg1); +void spawnQueue_add_1(spawnqueue_add_1_callback_f func, uintptr_t arg1); +//void spawnQueue_add_2(spawnqueue_add_2_callback_f func, s32 arg1, s32 arg2); +void spawnQueue_add_2(spawnqueue_add_2_callback_f func, uintptr_t arg1, uintptr_t arg2); +//void spawnQueue_add_3(spawnqueue_add_3_callback_f func, s32 arg1, s32 arg2, s32 arg3); +void spawnQueue_add_3(spawnqueue_add_3_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3); +//void spawnQueue_add_4(spawnqueue_add_4_callback_f func, s32 arg1, s32 arg2, s32 arg3, s32 arg4); +void spawnQueue_add_4(spawnqueue_add_4_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4); +//void spawnQueue_add_5(spawnqueue_add_5_callback_f func, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5); +void spawnQueue_add_5(spawnqueue_add_5_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5); + +//Actor *spawnQueue_actor_f32(s32 actor_id, s32 x, s32 y, s32 z); +Actor *spawnQueue_actor_f32(s32 actor_id, uintptr_t x, uintptr_t y, uintptr_t z); +//Actor *spawnQueue_actor_s16(s32 actor_id, s32 x, s32 y, s32 z); +Actor *spawnQueue_actor_s16(uintptr_t actor_id, uintptr_t x, uintptr_t y, uintptr_t z); +//Actor *spawnQueue_actor_s32(s32 actor_id, s32 x, s32 y, s32 z); +Actor *spawnQueue_actor_s32(uintptr_t actor_id, uintptr_t x, uintptr_t y, uintptr_t z); +//Actor *spawnQueue_bundle_f32(s32 bundle_id, s32 x, s32 y, s32 z); +Actor *spawnQueue_bundle_f32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z); +//Actor *spawnQueue_bundleWithYaw_f32(s32 bundle_id, s32 x, s32 y, s32 z, s32 yaw); +Actor *spawnQueue_bundleWithYaw_f32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z, uintptr_t yaw); +//Actor *spawnQueue_bundle_s32(s32 bundle_id, s32 x, s32 y, s32 z); +Actor *spawnQueue_bundle_s32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z); +//Actor *spawnQueue_bundle_s32_2(enum bundle_e bundle_id, s32 x, s32 y, s32 z); // unused +Actor *spawnQueue_bundle_s32_2(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z); // unused + +void spawnQueue_defrag(void); + +#define SPAWNQUEUE_ADD_0(func) spawnQueue_add_0((spawnqueue_add_0_callback_f) (func)) +#define SPAWNQUEUE_ADD_1(func, arg1) spawnQueue_add_1((spawnqueue_add_1_callback_f) (func), (arg1)) +#define SPAWNQUEUE_ADD_2(func, arg1, arg2) spawnQueue_add_2((spawnqueue_add_2_callback_f) (func), (arg1), (arg2)) +#define SPAWNQUEUE_ADD_3(func, arg1, arg2, arg3) spawnQueue_add_3((spawnqueue_add_3_callback_f) (func), (arg1), (arg2), (arg3)) +#define SPAWNQUEUE_ADD_4(func, arg1, arg2, arg3, arg4) spawnQueue_add_4((spawnqueue_add_4_callback_f) (func), (arg1), (arg2), (arg3), (arg4)) +#define SPAWNQUEUE_ADD_5(func, arg1, arg2, arg3, arg4, arg5) spawnQueue_add_5((spawnqueue_add_5_callback_f) (func), (arg1), (arg2), (arg3), (arg4), (arg5)) + +#define SPAWNQUEUE_ADD_ACTOR_F32(actor_id, x, y, z) spawnQueue_add_4((spawnqueue_add_4_callback_f) spawnQueue_actor_f32, (actor_id), *((s32 *) (&(x))), *((s32 *) (&(y))), *((s32 *) (&(z)))) +#define SPAWNQUEUE_ADD_ACTOR_S16(actor_id, x, y, z) spawnQueue_add_4((spawnqueue_add_4_callback_f) spawnQueue_actor_s16, (actor_id), *((s32 *) (&(x))), *((s32 *) (&(y))), *((s32 *) (&(z)))) +#define SPAWNQUEUE_ADD_ACTOR_S32(actor_id, x, y, z) spawnQueue_add_4((spawnqueue_add_4_callback_f) spawnQueue_actor_s32, (actor_id), (x), (y), (z)) +#define SPAWNQUEUE_ADD_BUNDLE_F32(bundle_id, x, y, z) spawnQueue_add_4((spawnqueue_add_4_callback_f) spawnQueue_bundle_f32, (bundle_id), *((s32 *) (&(x))), *((s32 *) (&(y))), *((s32 *) (&(z)))) +#define SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(bundle_id, x, y, z, yaw) spawnQueue_add_5((spawnqueue_add_5_callback_f) spawnQueue_bundleWithYaw_f32, (bundle_id), *((s32 *) (&(x))), *((s32 *) (&(y))), *((s32 *) (&(z))), *((s32 *) (&(yaw)))) + +void lair_addSpawnableActors(void); +void fight_addSpawnableActors(void); +void cutscene_addSpawnableActors(void); +void SM_addSpawnableActors(void); +void MMM_addSpawnableActors(void); +void CC_addSpawnableActors(void); +void GV_addSpawnableActors(void); +void TTC_addSpawnableActors(void); +void MM_addSpawnableActors(void); +void BGS_addSpawnableActors(void); +void RBB_addSpawnableActors(void); +void FP_addSpawnableActors(void); +void CCW_addSpawnableActors(void); + +#endif diff --git a/include/functions.h b/include/functions.h index 4b3ba24de..b2781c0b4 100644 --- a/include/functions.h +++ b/include/functions.h @@ -550,18 +550,6 @@ void func_80293D48(f32, f32); // --- core2/spline_pathfollow.c --- void func_80343DEC(Actor *self); -// --- core2/spawnqueue.c --- -Actor *spawnQueue_actor_f32(enum actor_e actor_id, uintptr_t x, uintptr_t y, uintptr_t z); -Actor *spawnQueue_actor_s32(uintptr_t actor_id, uintptr_t x, uintptr_t y, uintptr_t z); -Actor *spawnQueue_actor_s16(uintptr_t actor_id, uintptr_t x, uintptr_t y, uintptr_t z); -void __spawnQueue_add_0(GenFunction_0); -void __spawnQueue_add_1(GenFunction_1, uintptr_t); -void __spawnQueue_add_2(GenFunction_2, uintptr_t, uintptr_t); -void __spawnQueue_add_3(GenFunction_3, uintptr_t, uintptr_t, uintptr_t); -void __spawnQueue_add_4(GenFunction_4, uintptr_t, uintptr_t, uintptr_t, uintptr_t); -void __spawnQueue_add_5(GenFunction_5, uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); -#define SPAWNQUEUE_ADD_1(method, arg0) __spawnQueue_add_1((GenFunction_1) (method), reinterpret_cast(uintptr_t, (arg0))) - // --- core2/fx/commonParticle.c --- void commonParticle_add(ActorMarker *arg0, s32 arg1, FuncUnk40 arg2); int commonParticle_new(enum common_particle_e particle_id, int arg1); @@ -644,7 +632,7 @@ void gSPInvalidateTexCache(Gfx* pkt, uintptr_t texAddr); int ResourceMgr_OTRSigCheck(char* imgData); // --- BGS/bgsspawnqueue.c --- -void bgs_updateSpawnableActors(void); +void BGS_addSpawnableActors(void); // --- BGS/ch/croctus.c --- void BGS_func_803885DC(void); @@ -689,7 +677,7 @@ void chMrVileMinigame_newPiece(ActorMarker *game_marker, ActorMarker *piece_mark void chMrVileMinigame_removePiece(ActorMarker *game_marker, ActorMarker *piece_marker); // --- CC/ccspawnqueue.c --- -void CC_func_80387DA0(void); +void CC_addSpawnableActors(void); // --- CC/ch/clankertoothext.c --- void CC_func_803870E0(void); @@ -719,7 +707,7 @@ s32 maClankerRings_isMinigameActive(void); void maClankerRings_passRing(s32); // --- CCW/ccwspawnqueue.c --- -void CCW_func_8038DB6C(void); +void CCW_addSpawnableActors(void); // --- CCW/nabnut_winter.c --- void chAutumnOutsideNabnut_getPosition(f32 dst[3]); @@ -737,7 +725,7 @@ void chZubbaFight_zubbaDisappear(ActorMarker *marker); void chZubbaFight_zubbaScore(ActorMarker *marker, s32 *score, s32 *total); // --- FP/fpspawnqueue.c --- -void FP_func_80391324(void); +void FP_addSpawnableActors(void); // --- FP/ch/boggy2.c --- void func_8038A09C(f32 arg0[3]); @@ -781,7 +769,7 @@ void func_80391994(void); // --- GV/gvspawnqueue.c --- s32 code7FF0_getMagicCarpetState(Actor *arg0, s32 arg1); -void GV_func_8038F154(void); +void GV_addSpawnableActors(void); // --- GV/ch/ancientone.c --- void GV_func_80387118(void); @@ -841,7 +829,7 @@ void gv_waterCtrl_init(void); void gv_waterCtrl_update(void); // --- MM/mmspawnqueue.c --- -void MM_func_803888B0(void); +void MM_addSpawnableActors(void); // --- MM/ch/hut.c --- void mm_resetHuts(void); @@ -857,7 +845,7 @@ void func_803892A8(ActorMarker **ptr); void chjujuhitbox_setJuju(Actor *self, s32 slave_id, Actor *slavePtr); // --- MMM/mmmspawnqueue.c --- -void MMM_func_803890E0(void); +void MMM_addSpawnableActors(void); // --- MMM/organ_tiles.c --- void func_8038B5D8(Struct5Fs *arg0, Struct68s *arg1, s32 arg2, s32 arg3); @@ -905,7 +893,7 @@ void func_803895B0(s32 arg0); void func_8038966C(void); // --- RBB/rbbspawnqueue.c --- -void RBB_func_80386C48(void); +void RBB_addSpawnableActors(void); // --- RBB/ch/eggtoll1.c --- void func_8038685C(ActorMarker *marker); @@ -926,14 +914,14 @@ void rbb_propellorCtrl_update(void); bool codeBF0_shouldSpawnQuarrieHoneyComb(ActorMarker *marker); // --- SM/smspawnqueue.c --- -void SM_resetSpawnableActors(); +void SM_addSpawnableActors(); void codeF0_breakAbilitiesIfChecksumsFail(); // --- SM/model_visibility.c --- void code2900_checkSMChecksums(void); // --- TTC/actor_spawninit.c --- -void code26D0_resetSpawnableActorsForTTC(void); +void TTC_addSpawnableActors(void); // --- TTC/ch/leaky.c --- bool chLeaky_eggCollision(ActorMarker *marker); @@ -2795,15 +2783,6 @@ void func_802FBDFC(void); // --- core2/scorequeue/queue_major_items.c --- bool func_802FC390(void); -// --- core2/spawnqueue.c --- -void spawnQueue_flush(void); -void spawnQueue_free(void); -void spawnQueue_func_802C3A18(void); -void spawnQueue_lock(void); -void spawnQueue_malloc(void); -void spawnQueue_reset(void); -void spawnQueue_unlock(void); - // --- core2/spline_bezier.c --- // --- core2/fx/commonParticle.c --- @@ -2914,13 +2893,13 @@ void func_8034C97C(void); void func_8034C9B0(int arg0); // --- cutscenes/cutscenesspawnqueue.c --- -void cutscene_func_8038C4E0(void); +void cutscene_addSpawnableActors(void); // --- fight/fight.c --- void fight_addSpawnableActors(void); // --- lair/lairspawnqueue.c --- -void lair_func_8038A0C4(void); +void lair_addSpawnableActors(void); // --- lair/ch/brentilda.c --- void gzquiz_initGruntyQuestions(void); @@ -3057,9 +3036,6 @@ int savedata_8033CE40(void *buffer); int savedata_8033CC98(s32 filenum, void *buffer); void savedata_clear(void *savedata); -// --- core2/spawnqueue.c --- -void spawnQueue_defrag(void); - // --- port/MemShims.c --- void bkmemcpy64(void *dest, void *src, s32 size); void bkmemset64(void *dest, s32 value, s32 size); diff --git a/src/BGS/bgsspawnqueue.c b/src/BGS/bgsspawnqueue.c index b0d4accbc..f9b9329e9 100644 --- a/src/BGS/bgsspawnqueue.c +++ b/src/BGS/bgsspawnqueue.c @@ -35,7 +35,7 @@ extern ActorInfo gChLargeCrocodile; extern ActorInfo gChLongSwampSwitch; extern ActorInfo gChShortSwampSwitch; -void bgs_updateSpawnableActors(void){ +void BGS_addSpawnableActors(void) { spawnableActorList_add(&gChCroctus, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&gChFlibbit, 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); spawnableActorList_add(&gChPinkEggLargest, actor_new, ACTOR_FLAG_UNKNOWN_10); @@ -66,5 +66,3 @@ void bgs_updateSpawnableActors(void){ spawnableActorList_add(&gChLongSwampSwitch, actor_new, ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&gChShortSwampSwitch, actor_new, ACTOR_FLAG_UNKNOWN_3); } - - diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index ab8dbaf05..b03003427 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -77,7 +77,7 @@ void func_80387E00(ActorMarker *arg0){ Actor * this = marker_getActor(arg0); func_803262E4(this); - __spawnQueue_add_2((GenFunction_2)func_80387D18, reinterpret_cast(uintptr_t, arg0), 0x1E); + SPAWNQUEUE_ADD_2(func_80387D18, reinterpret_cast(uintptr_t, arg0), 0x1E); } void func_80387E40(ActorMarker * arg0){ @@ -109,7 +109,7 @@ void chCroctus_activateNextCroctus(ActorMarker *caller, enum asset_e text_id, s3 // func_80324DBC(3.4f, VER_SELECT(ASSET_C87_DIALOG_CROCTUS_SECOND_SPAWN, 0x9CA, 0, 0), 0xE, NULL, NULL, chCroctus_activateNextCroctus, NULL); if (EventSystem_Should(VB_PLAY_PUZZLE_CUTSCENE, true, this)) timed_setStaticCameraToNode(0.8f, 9); if (EventSystem_Should(VB_PLAY_PUZZLE_DIALOG, true, this)) func_80324DBC(3.4f, VER_SELECT(ASSET_C87_DIALOG_CROCTUS_SECOND_SPAWN, 0x9CA, 0, 0), 0xE, NULL, NULL, chCroctus_activateNextCroctus, NULL); - __spawnQueue_add_2((GenFunction_2) func_80387D18, reinterpret_cast(uintptr_t, this->marker), 0x46); + SPAWNQUEUE_ADD_2(func_80387D18, reinterpret_cast(uintptr_t, this->marker), 0x46); } else{ // timed_exitStaticCamera(0.0f); @@ -190,7 +190,7 @@ void chCroctus_update(Actor *this){ } else { timedFunc_set_1(0.8f, (GenFunction_1)chCroctus_jiggySpawn, reinterpret_cast(uintptr_t, this->marker)); } - __spawnQueue_add_2((GenFunction_2)func_80387D18, reinterpret_cast(uintptr_t, this->marker), 0x46); + SPAWNQUEUE_ADD_2(func_80387D18, reinterpret_cast(uintptr_t, this->marker), 0x46); } } }//L80388348 diff --git a/src/BGS/ch/mudhut.c b/src/BGS/ch/mudhut.c index 59b46127f..f8f20db0e 100644 --- a/src/BGS/ch/mudhut.c +++ b/src/BGS/ch/mudhut.c @@ -11,7 +11,6 @@ extern void player_stateTimer_set(enum state_timer_e, f32); extern f32 player_stateTimer_get(enum state_timer_e); -Actor *spawnQueue_bundle_f32(u32,f32,f32,f32); void subaddie_set_state(Actor *, u32); /* local declarations */ @@ -124,10 +123,10 @@ void chMudHut_update(Actor *this){ if(hut_id == 5){ coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } - __spawnQueue_add_1((GenFunction_1)chMudHut_spawnExplosion, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chMudHut_spawnExplosion, (uintptr_t)this->marker); if (hut_id < 5) { - __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, chBGSMudHutDrops[hut_id], reinterpret_cast(s32, diffPos[0]), reinterpret_cast(s32, diffPos[1]), reinterpret_cast(s32, diffPos[2])); + SPAWNQUEUE_ADD_BUNDLE_F32(chBGSMudHutDrops[hut_id], diffPos[0], diffPos[1], diffPos[2]); } else { jiggy_spawn(JIGGY_23_BGS_HUTS, diffPos); diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index c0a76e531..35787394e 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -102,7 +102,7 @@ void chPinkEgg_collision(ActorMarker *this, ActorMarker *other_marker){ thisActor->unk124_6 = 0; CALL_EVENT(OnPuzzleStep, ANCHOR_PUZZLE_BGS_PINKEGG, 1 << ((ActorLocal_PinkEgg *) &thisActor->local)->actorId); // [port] if(D_803906C4[(tmp = (ActorLocal_PinkEgg *) &thisActor->local)->actorId] != 0){ - __spawnQueue_add_2((GenFunction_2)chPinkEgg_spawnNext, (uintptr_t)thisActor->marker, tmp->actorId); + SPAWNQUEUE_ADD_2(chPinkEgg_spawnNext, (uintptr_t)thisActor->marker, tmp->actorId); } else { // jiggy_spawn(JIGGY_21_BGS_PINKEGG, thisActor->position); // coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); diff --git a/src/BGS/ch/swampswitch.c b/src/BGS/ch/swampswitch.c index 37ed2fc63..8a54192c2 100644 --- a/src/BGS/ch/swampswitch.c +++ b/src/BGS/ch/swampswitch.c @@ -44,11 +44,7 @@ void chLongSwampSwitch_jiggySpawn(void) { jiggy_spawn(JIGGY_20_BGS_ELEVATED_WALKWAY, elevated_walkway_jiggy_position); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, - reinterpret_cast(s32, elevated_walkway_jiggy_position[0]), - reinterpret_cast(s32, elevated_walkway_jiggy_position[1]), - reinterpret_cast(s32, elevated_walkway_jiggy_position[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, elevated_walkway_jiggy_position[0], elevated_walkway_jiggy_position[1], elevated_walkway_jiggy_position[2]); } } void chLongSwampSwitch_update(Actor *this){ @@ -99,11 +95,7 @@ void chShortSwampSwitch_jiggySpawn(void){ jiggy_spawn(JIGGY_25_BGS_MAZE, maze_jiggy_position); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, - reinterpret_cast(s32, maze_jiggy_position[0]), - reinterpret_cast(s32, maze_jiggy_position[1]), - reinterpret_cast(s32, maze_jiggy_position[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, maze_jiggy_position[0], maze_jiggy_position[1], maze_jiggy_position[2]); } } void chShortSwampSwitch_update(Actor *this){ diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 77ea20faf..9bbb7bae2 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -125,7 +125,7 @@ void chTanktup_update(Actor *this) { if (local->unk0[sp44] == 0) { - __spawnQueue_add_3((GenFunction_3)func_8038F470, reinterpret_cast(uintptr_t, this->marker), local->unk0[sp44], sp44); + SPAWNQUEUE_ADD_3(func_8038F470, reinterpret_cast(uintptr_t, this->marker), local->unk0[sp44], sp44); } } diff --git a/src/CC/ccspawnqueue.c b/src/CC/ccspawnqueue.c index 0fde30a96..9301d4994 100644 --- a/src/CC/ccspawnqueue.c +++ b/src/CC/ccspawnqueue.c @@ -26,9 +26,7 @@ extern ActorInfo chCCGrate1; extern ActorInfo chCCGrate2; extern ActorInfo chCCGrate3; -/* .code */ -void CC_func_80387DA0(void) -{ +void CC_addSpawnableActors(void) { spawnableActorList_add(&maClankersScrew, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_7 ); spawnableActorList_add(&chCCGrate1, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); spawnableActorList_add(&chCCGrate2, actor_new, ACTOR_FLAG_UNKNOWN_16 | ACTOR_FLAG_UNKNOWN_7 ); diff --git a/src/CCW/ccwspawnqueue.c b/src/CCW/ccwspawnqueue.c index a87248220..30661e9c6 100644 --- a/src/CCW/ccwspawnqueue.c +++ b/src/CCW/ccwspawnqueue.c @@ -173,8 +173,7 @@ void code_76C0_ccwGnawtysStuffUpdate(Actor *this){ } } -void CCW_func_8038DB6C(void) -{ +void CCW_addSpawnableActors(void) { spawnableActorList_add(&chZubbaDoorSummer, actor_new, ACTOR_FLAG_UNKNOWN_7); spawnableActorList_add(&chZubbaDoorAutumn, actor_new, ACTOR_FLAG_UNKNOWN_7); spawnableActorList_add(&chZubbaHoneyLump, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8); diff --git a/src/CCW/ch/grublinhood.c b/src/CCW/ch/grublinhood.c index 0e1ffac87..23561b70b 100644 --- a/src/CCW/ch/grublinhood.c +++ b/src/CCW/ch/grublinhood.c @@ -61,7 +61,7 @@ void __chgrublinhood_die(ActorMarker* marker, s32 arg1) { sfx_playFadeShorthandDefault(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); pCtrl = partEmitMgr_newEmitter(1); __chgrublinhood_emitHat(pCtrl, actor, ASSET_52D_MODEL_GRUBLIN_HOOD_HAT); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32,actor->position_x), reinterpret_cast(s32,actor->position_y), reinterpret_cast(s32,actor->position_z)); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, actor->position[0], actor->position[1], actor->position[2]); actor_collisionOff(actor); actor->has_met_before = true; } diff --git a/src/CCW/ch/zubbahoneylump.c b/src/CCW/ch/zubbahoneylump.c index e9180e887..8dba1ea2a 100644 --- a/src/CCW/ch/zubbahoneylump.c +++ b/src/CCW/ch/zubbahoneylump.c @@ -212,7 +212,7 @@ void chZubbaFight_update(Actor *this) { break; } - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_29B_ZUBBA, reinterpret_cast(s32, sp4C[0]), reinterpret_cast(s32, sp4C[1]), reinterpret_cast(s32, sp4C[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_29B_ZUBBA, sp4C[0], sp4C[1], sp4C[2]); local->spawnedZubbaCount++; } local->unkC = randf2(0.5 - ((local->zubbasDefeated / 10) * 0.4), 1.0 - ((local->zubbasDefeated / 10) * 0.8)); diff --git a/src/CCW/eyrie_baby.c b/src/CCW/eyrie_baby.c index 3a4a69d01..4ce4f7237 100644 --- a/src/CCW/eyrie_baby.c +++ b/src/CCW/eyrie_baby.c @@ -116,7 +116,7 @@ void func_80389700(ActorMarker *marker, enum asset_e text_id, s32 arg2) { void func_80389740(ActorMarker *marker) { Actor *this = marker_getActor(marker); if (this->marker->unk14_21) { - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x30C, reinterpret_cast(s32, chEyrieBabyThrowPosition[0]), reinterpret_cast(s32, chEyrieBabyThrowPosition[1]), reinterpret_cast(s32, chEyrieBabyThrowPosition[2])); + SPAWNQUEUE_ADD_ACTOR_F32(0x30C, chEyrieBabyThrowPosition[0], chEyrieBabyThrowPosition[1], chEyrieBabyThrowPosition[2]); } } diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index a1156ddc6..2223fb3e9 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -127,7 +127,7 @@ void func_8038794C(Actor *this){ if(jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1)){ if(!jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3) && !jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3)){ - __spawnQueue_add_1((GenFunction_1)func_80387760, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80387760, (uintptr_t)this->marker); } this->unk38_31 = 0; actor_collisionOff(this); @@ -206,7 +206,7 @@ void func_8038794C(Actor *this){ case 5://L80387D90 if(jiggyscore_isCollected(JIGGY_2A_FP_BOGGY_1)){ this->unk38_31 = 0; - __spawnQueue_add_1((GenFunction_1)func_80387760, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80387760, (uintptr_t)this->marker); } break; } diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index b396f2c96..5843b25d9 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -420,7 +420,7 @@ void func_803896FC(Actor *this){ maSlalom_linkBoggy(this->marker); this->unk38_31 = 0; func_80388C88(this); - __spawnQueue_add_0(func_803895E0); + SPAWNQUEUE_ADD_0(func_803895E0); if(jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){ local->unk19 = 2; this->unk4C = 900.0f; @@ -578,7 +578,7 @@ void func_803896FC(Actor *this){ case 1: //L80389F78 if(this->unk38_31 == 2){ if(jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){ - __spawnQueue_add_1((GenFunction_1)func_80388F54, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80388F54, (uintptr_t)this->marker); maSlalom_unlinkBoggy(); marker_despawn(this->marker); } diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index 305209221..4f4ed382a 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -245,7 +245,7 @@ void chTwinkly_setUpMinigame(ActorMarker *caller, enum asset_e text_id, s32 arg2 Actor *this = marker_getActor(caller); if(!volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)){ subaddie_set_state(this, 6); - __spawnQueue_add_1((GenFunction_1)chTwinkly_spawnFirstMuncher, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chTwinkly_spawnFirstMuncher, (uintptr_t)this->marker); } } diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index 9ce530d30..9d79f8583 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -358,7 +358,7 @@ void chTwinklyBox_update(Actor *this){ chTwinklyBox_openBox(this); if(actor_animationIsAt(this, 0.999f)) - __spawnQueue_add_1((GenFunction_1)chTwinklyBox_spawnTwinkly, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chTwinklyBox_spawnTwinkly, (uintptr_t)this->marker); if(this->velocity[0] != 0.0f) break; @@ -371,7 +371,7 @@ void chTwinklyBox_update(Actor *this){ item_set(ITEM_6_HOURGLASS, TRUE); this->unk38_31 = 0xA; item_set(ITEM_24_TWINKLY_SCORE, this->unk38_31); - __spawnQueue_add_1((GenFunction_1)chTwinklyBox_spawnSecondAndThirdMuncher, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chTwinklyBox_spawnSecondAndThirdMuncher, (uintptr_t)this->marker); this->lifetime_value = 0.0f; func_80347A14(0); func_802FAD64(ITEM_14_HEALTH); @@ -412,7 +412,7 @@ void chTwinklyBox_update(Actor *this){ if(0.96 < anctrl_getAnimTimer(this->anctrl)){ if(this->lifetime_value <= 0.0){ - __spawnQueue_add_1((GenFunction_1)chTwinklyBox_spawnTwinkly, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chTwinklyBox_spawnTwinkly, (uintptr_t)this->marker); this->lifetime_value = 2.9f; } else{ diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 60ee5abcd..4caff2584 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -206,7 +206,7 @@ void chWozza_update(Actor *this){ this->position[0] = local->unkC[0];\ this->position[1] = local->unkC[1];\ this->position[2] = local->unkC[2]; - __spawnQueue_add_1((GenFunction_1)chWozza_spawnJiggy, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chWozza_spawnJiggy, (uintptr_t)this->marker); local->unk30 = false; } }//L8038F910 diff --git a/src/FP/ch/xmastree.c b/src/FP/ch/xmastree.c index 8ddf274b3..39b3150d2 100644 --- a/src/FP/ch/xmastree.c +++ b/src/FP/ch/xmastree.c @@ -99,8 +99,8 @@ void chXmasTree_update(Actor *this){ sfxSource_setunk43_7ByIndex(this->unk44_31, 3); sfxsource_setSampleRate(this->unk44_31, 28000); } - __spawnQueue_add_0(chXmasTree_spawnSwitch); - __spawnQueue_add_1((GenFunction_1)chXmasTree_spawnStar, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_0(chXmasTree_spawnSwitch); + SPAWNQUEUE_ADD_1(chXmasTree_spawnStar, (uintptr_t)this->marker); if(fileProgressFlag_get(FILEPROG_13_COMPLETED_TWINKLIES_MINIGAME)){ chXmasTree_setLightsOn(this); mapSpecificFlags_set(2, false); diff --git a/src/FP/fpspawnqueue.c b/src/FP/fpspawnqueue.c index bf98e1dec..8f22168b3 100644 --- a/src/FP/fpspawnqueue.c +++ b/src/FP/fpspawnqueue.c @@ -153,8 +153,7 @@ void func_803912EC(Actor *this){ } -void FP_func_80391324(void) -{ +void FP_addSpawnableActors(void) { spawnableActorList_add(&gSnowmanButton, actor_new, ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&D_80391BB0, actor_new, ACTOR_FLAG_UNKNOWN_1 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5); spawnableActorList_add(&D_80391C18, actor_new, ACTOR_FLAG_UNKNOWN_2 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_19 | ACTOR_FLAG_UNKNOWN_20); diff --git a/src/FP/ma/slalom.c b/src/FP/ma/slalom.c index 028763bc4..c698fe359 100644 --- a/src/FP/ma/slalom.c +++ b/src/FP/ma/slalom.c @@ -127,7 +127,7 @@ void __maSlalom_spawnGate(s32 indx, s32 arg1){ } void maSlalom_spawnGate(s32 indx, s32 arg1){ - __spawnQueue_add_2((GenFunction_2)__maSlalom_spawnGate, indx, arg1); + SPAWNQUEUE_ADD_2(__maSlalom_spawnGate, indx, arg1); } void __maSlalom_despawnGate(s32 indx){ @@ -176,7 +176,7 @@ void __maSlalom_spawnBridge(s32 indx){ } void maSlalom_spawnBridge(s32 indx){ - __spawnQueue_add_1((GenFunction_1)__maSlalom_spawnBridge, indx); + SPAWNQUEUE_ADD_1(__maSlalom_spawnBridge, indx); } void maSlalom_spawnAllBridges(void){ @@ -451,7 +451,7 @@ void maSlalom_start(void){ maSlalom_spawnGate(NUM_GATES - 1, 2); maSlalom_spawnAllBridges(); if(jiggyscore_isSpawned(JIGGY_30_FP_BOGGY_2) || jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){ - __spawnQueue_add_0(__maSlalom_spawnTrainers); + SPAWNQUEUE_ADD_0(__maSlalom_spawnTrainers); } Me.playerGate = -1; diff --git a/src/FP/ma/snowbutton.c b/src/FP/ma/snowbutton.c index 51a1c895b..d83a81617 100644 --- a/src/FP/ma/snowbutton.c +++ b/src/FP/ma/snowbutton.c @@ -62,19 +62,11 @@ void maSnowButton_update(void){ CALL_EVENT(OnPuzzleWin, ANCHOR_PUZZLE_FP_SNOWBUTTONS); // [port] // gcStaticCamera_activate(0x11); // jiggy_spawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, Me.spawn_pos); -// __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, -// reinterpret_cast(s32, Me.spawn_pos[0]), -// reinterpret_cast(s32, Me.spawn_pos[1]), -// reinterpret_cast(s32, Me.spawn_pos[2]) -// ); +// SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, Me.spawn_pos[0], Me.spawn_pos[1], Me.spawn_pos[2]); if (EventSystem_Should(VB_PLAY_PUZZLE_CUTSCENE, true, NULL)) gcStaticCamera_activate(0x11); if (EventSystem_Should(VB_SPAWN_PUZZLE_JIGGY, true, NULL)) { jiggy_spawn(JIGGY_2D_FP_SNOWMAN_BUTTONS, Me.spawn_pos); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, - reinterpret_cast(s32, Me.spawn_pos[0]), - reinterpret_cast(s32, Me.spawn_pos[1]), - reinterpret_cast(s32, Me.spawn_pos[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, Me.spawn_pos[0], Me.spawn_pos[1], Me.spawn_pos[2]); } } // * WARNING * :maSnowButton.c: Jigsaw 45 CANNOT find it's bootup marker point diff --git a/src/FP/ma/snowy.c b/src/FP/ma/snowy.c index 172e12fa6..27aa53a34 100644 --- a/src/FP/ma/snowy.c +++ b/src/FP/ma/snowy.c @@ -62,19 +62,11 @@ void maSnowy_update(void){ CALL_EVENT(OnPuzzleWin, ANCHOR_PUZZLE_FP_SLUSHES); // [port] // gcStaticCamera_activate(0x12); // jiggy_spawn(JIGGY_31_FP_SIR_SLUSH, Me.spawn_pos); -// __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, -// reinterpret_cast(s32, Me.spawn_pos[0]), -// reinterpret_cast(s32, Me.spawn_pos[1]), -// reinterpret_cast(s32, Me.spawn_pos[2]) -// ); +// SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, Me.spawn_pos[0], Me.spawn_pos[1], Me.spawn_pos[2]); if (EventSystem_Should(VB_PLAY_PUZZLE_CUTSCENE, true, NULL)) gcStaticCamera_activate(0x12); if (EventSystem_Should(VB_SPAWN_PUZZLE_JIGGY, true, NULL)) { jiggy_spawn(JIGGY_31_FP_SIR_SLUSH, Me.spawn_pos); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, - reinterpret_cast(s32, Me.spawn_pos[0]), - reinterpret_cast(s32, Me.spawn_pos[1]), - reinterpret_cast(s32, Me.spawn_pos[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, Me.spawn_pos[0], Me.spawn_pos[1], Me.spawn_pos[2]); } } // * WARNING * :masnowy.c: Jigsaw 49 CANNOT find it's bootup marker point diff --git a/src/GV/carpet1.c b/src/GV/carpet1.c index 3204281c0..0e9167fcf 100644 --- a/src/GV/carpet1.c +++ b/src/GV/carpet1.c @@ -69,7 +69,7 @@ void func_8038A948(Actor *this){ this->initialized = true; this->marker->propPtr->unk8_3 = true; actor_collisionOff(this); - __spawnQueue_add_1((GenFunction_1)func_8038A8CC, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_8038A8CC, (uintptr_t)this->marker); this->velocity_y = 0.0f; } } @@ -85,7 +85,7 @@ void GV_func_8038A9C0(Actor *this){ this->volatile_initialized = true; this->marker->propPtr->unk8_3 = true; actor_collisionOff(this); - __spawnQueue_add_1((GenFunction_1)func_8038A8CC, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_8038A8CC, (uintptr_t)this->marker); sp24 = subaddie_getLinkedActor(this); this->unk1C[1] = this->unk48; this->pitch = 0.0f; diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index f94f0005c..d78c25e37 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -90,7 +90,7 @@ void func_803867F4(void){ gcStaticCamera_activate(4); if(nodeProp_findPositionFromActorId(0x148, sp24)){ jiggy_spawn(JIGGY_46_GV_ANCIENT_ONES, sp24); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x4C, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, sp24[0], sp24[1], sp24[2]); } } @@ -185,10 +185,10 @@ void chAncientOne_update(Actor *this){ this->position_z += (sp38 & 2) ? 0xC : -0xC; if(this->actorTypeSpecificField != 1){ if(sp38 == 6){ - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x4C, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, sp34), reinterpret_cast(s32, this->position_z)); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, this->position[0], sp34, this->position[2]); } if(sp38 == 4 && this->position_y < LOCAL_CH_ANCIENT_ONE(this)->unk1C - 600.0f){ - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x11f, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, sp34), reinterpret_cast(s32, this->position_z)); + SPAWNQUEUE_ADD_ACTOR_F32(0x11F, this->position[0], sp34, this->position[2]); }//L80386D80 } if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){ diff --git a/src/GV/ch/grabba.c b/src/GV/ch/grabba.c index 64e1c96d2..71853e801 100644 --- a/src/GV/ch/grabba.c +++ b/src/GV/ch/grabba.c @@ -211,9 +211,7 @@ void chGrabba_update(Actor *this){ this->unk38_31 = 0; D_80391A80 = this->state; func_802BB3DC(0, 14.0f, 0.92f); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x11f, - reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z) - ); + SPAWNQUEUE_ADD_ACTOR_F32(0x11f, this->position[0], this->position[1], this->position[2]); } break; diff --git a/src/GV/ch/mummum.c b/src/GV/ch/mummum.c index dbc6ad01b..5508fd938 100644 --- a/src/GV/ch/mummum.c +++ b/src/GV/ch/mummum.c @@ -48,7 +48,7 @@ void chMumMum_die(ActorMarker *arg0, s32 arg1) { func_802DAD8C(partEmitMgr_newEmitter(2), this, ASSET_4C8_MODEL_MUMMUM_ARM); chMumMum_deathParticles(partEmitMgr_newEmitter(1), this, ASSET_4CB_MODEL_MUMMUM_BODY); sfx_playFadeShorthandDefault(SFX_119_FISH_DEATH, 0.8f, 32000, this->position, 1250, 2500); - __spawnQueue_add_4((GenFunction_4) spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, this->position[0], this->position[1], this->position[2]); marker_despawn(arg0); } diff --git a/src/GV/gvspawnqueue.c b/src/GV/gvspawnqueue.c index e40df207b..67d4d16df 100644 --- a/src/GV/gvspawnqueue.c +++ b/src/GV/gvspawnqueue.c @@ -483,7 +483,7 @@ void func_8038F028(NodeProp *arg0, ActorMarker *arg1, s32 arg2, s32 arg3){ sp24[0] = (f32)arg1->propPtr->position_x; sp24[1] = (f32)arg1->propPtr->position_y; sp24[2] = (f32)arg1->propPtr->position_z; - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x4e, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2])); + SPAWNQUEUE_ADD_ACTOR_F32(0x4e, sp24[0], sp24[1], sp24[2]); coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 22000); if(mapSpecificFlags_get(arg3)){ timedFunc_set_0(2.0f, func_8038F004); @@ -500,8 +500,7 @@ void func_8038F130(NodeProp *arg0, ActorMarker *arg1){ func_8038F028(arg0, arg1, 1, 0); //JINXY egg flags? } -void GV_func_8038F154(void) -{ +void GV_addSpawnableActors(void) { spawnableActorList_add(&chToots, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&chAncientOne, actor_new, ACTOR_FLAG_UNKNOWN_1 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&Gobi1, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_11); diff --git a/src/GV/magiccarpet2.c b/src/GV/magiccarpet2.c index bbe7a21b2..df7428176 100644 --- a/src/GV/magiccarpet2.c +++ b/src/GV/magiccarpet2.c @@ -85,7 +85,7 @@ void chmagiccarpet2_update(Actor *this){ if(!this->volatile_initialized){ this->volatile_initialized = TRUE; actor_collisionOff(this); - __spawnQueue_add_1((GenFunction_1)func_8038A2C0, reinterpret_cast(uintptr_t, this->marker)); + SPAWNQUEUE_ADD_1(func_8038A2C0, reinterpret_cast(uintptr_t, this->marker)); this->velocity[0] = 0.0f; } diff --git a/src/MM/ch/conga.c b/src/MM/ch/conga.c index 98abbc25a..ce8496643 100644 --- a/src/MM/ch/conga.c +++ b/src/MM/ch/conga.c @@ -239,7 +239,7 @@ void chConga_update(Actor *this) { if (0.0f != this->velocity_x) { this->velocity_x -= 1.0f; if(0.0f == this->velocity_x){ - __spawnQueue_add_1((GenFunction_1)func_80387100, reinterpret_cast(uintptr_t, this->marker)); + SPAWNQUEUE_ADD_1(func_80387100, reinterpret_cast(uintptr_t, this->marker)); } } @@ -399,6 +399,6 @@ void chConga_update(Actor *this) { || (this->state == CONGA_STATE_TARGET_BANJO && actor_animationIsAt(this, 0.468f))) { vec3fArray_get_vec3i(this->marker->unk44, 5, (s32 *)&this->local); // [port] writes 3 s32 into actor local - __spawnQueue_add_1((GenFunction_1)__chConga_sendOrangeProjectile, reinterpret_cast(uintptr_t, this->marker)); //spawn orange + SPAWNQUEUE_ADD_1(__chConga_sendOrangeProjectile, reinterpret_cast(uintptr_t, this->marker)); //spawn orange } } diff --git a/src/MM/ch/hut.c b/src/MM/ch/hut.c index cb21c94db..c8e192f68 100644 --- a/src/MM/ch/hut.c +++ b/src/MM/ch/hut.c @@ -11,7 +11,6 @@ /* extern function declarations */ void bundle_setYaw(f32); -Actor *spawnQueue_bundle_f32(s32, s32, s32, s32); /* public function declarations */ Actor *chhut_draw(ActorMarker *, Gfx **, Mtx **, Vtx **); @@ -91,15 +90,15 @@ void chhut_update(Actor *this) { sfxsource_playHighPriority(SFX_5B_HEAVY_STUFF_FALLING); subaddie_set_state(this, HUT_STATE_1_DAMAGED); actor_playAnimationOnce(this); -// __spawnQueue_add_1((GenFunction_1) __chhut_spawnExplosion, (uintptr_t)this->marker); +// SPAWNQUEUE_ADD_1(__chhut_spawnExplosion, (uintptr_t)this->marker); if (EventSystem_Should(VB_MM_HUT_SPAWN_EXPLOSION, true, this)) { - __spawnQueue_add_1((GenFunction_1) __chhut_spawnExplosion, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(__chhut_spawnExplosion, (uintptr_t)this->marker); } bundle_setYaw(this->yaw); CALL_EVENT(OnHutSmashed, this, &mm_hut_smash_count); // [port] if (mm_hut_smash_count < 5) { - __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, D_803898D8[mm_hut_smash_count], *(s32 * )(&diff_pos[0]), *(s32 * )(&diff_pos[1]), *(s32 * )(&diff_pos[2])); + SPAWNQUEUE_ADD_BUNDLE_F32(D_803898D8[mm_hut_smash_count], diff_pos[0], diff_pos[1], diff_pos[2]); } else { jiggy_spawn(JIGGY_5_MM_HUTS, diff_pos); diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index d33222eb5..08b0dc0f9 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -110,7 +110,7 @@ void __chjuju_spawnJiggy(s32 x, s32 y, s32 z, s32 yaw) { } void __chjuju_solvePuzzle(s32 x, s32 y, s32 z, s32 yaw) { - __spawnQueue_add_4((GenFunction_4) __chjuju_spawnJiggy, x, y, z, yaw); + SPAWNQUEUE_ADD_4(__chjuju_spawnJiggy, x, y, z, yaw); func_802BB3DC(0, 10.0f, 0.8f); gcpausemenu_80314AC8(1); } diff --git a/src/MM/ch/jujuhitbox.c b/src/MM/ch/jujuhitbox.c index d334bc78a..78d5f4ebe 100644 --- a/src/MM/ch/jujuhitbox.c +++ b/src/MM/ch/jujuhitbox.c @@ -73,7 +73,7 @@ void func_80388BEC(NodeProp *node, ActorMarker *marker) { CALL_EVENT(OnPuzzleStep, ANCHOR_PUZZLE_MM_JUJU, (1 << ((ActorLocal_JujuHitbox *) &closest_actor->local)->unk4) - 1); // [port] func_803892A8(((ActorLocal_JujuHitbox *) &closest_actor->local)->jujus); func_80353580(marker); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0x58, *(s32 *)&position[0], *(s32 *)&position[1], *(s32 *)&position[2]); + SPAWNQUEUE_ADD_ACTOR_F32(0x58, position[0], position[1], position[2]); } } } @@ -129,7 +129,7 @@ void chjujuhitbox_update(Actor *this) { if (!this->volatile_initialized) { this->volatile_initialized = true; - __spawnQueue_add_2((GenFunction_2) __chjujuhitbox_initialize_all, (uintptr_t)this->marker, jujuCtlPtr->unk4); + SPAWNQUEUE_ADD_2(__chjujuhitbox_initialize_all, (uintptr_t)this->marker, jujuCtlPtr->unk4); __chjujuhitbox_playRubbingSfx(this); return; } diff --git a/src/MM/mmspawnqueue.c b/src/MM/mmspawnqueue.c index ffb84d88f..83c7a9db1 100644 --- a/src/MM/mmspawnqueue.c +++ b/src/MM/mmspawnqueue.c @@ -17,7 +17,7 @@ extern ActorInfo chjujuInfo; extern ActorInfo chOrangePadInfo; extern ActorInfo chlmonkeyInfo; -void MM_func_803888B0(void){ +void MM_addSpawnableActors(void) { 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); diff --git a/src/MMM/ch/portraitchompa.c b/src/MMM/ch/portraitchompa.c index 05fc2d505..c78bd5356 100644 --- a/src/MMM/ch/portraitchompa.c +++ b/src/MMM/ch/portraitchompa.c @@ -206,7 +206,7 @@ void chChompa_update(Actor *this) { this->volatile_initialized = true; this->unk16C_0 = true; marker_setCollisionScripts(this->marker, NULL, __chChompa_hit, __chChompa_die); - __spawnQueue_add_1((GenFunction_1) __chChompa_spawnPortrait, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(__chChompa_spawnPortrait, (uintptr_t)this->marker); chChompa_setState(this, this->state < CHOMPA_STATE_5_DYING ? CHOMPA_STATE_1_IDLE : CHOMPA_STATE_6_DEAD); }//L803880B4 diff --git a/src/MMM/ch/skeleton.c b/src/MMM/ch/skeleton.c index 305975263..659c8288a 100644 --- a/src/MMM/ch/skeleton.c +++ b/src/MMM/ch/skeleton.c @@ -50,7 +50,7 @@ void chLimbo_die(ActorMarker *marker, s32 arg1) { func_802DAD8C(partEmitMgr_newEmitter(2), this, ASSET_4CD_MODEL_LIMBO_ARM); func_8035CCA0(partEmitMgr_newEmitter(4), this, ASSET_4D0_MODEL_LIMBO_BONE); sfx_playFadeShorthandDefault(SFX_119_FISH_DEATH, 1.0f, 32000, this->position, 1250, 2500); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, this->position[0], this->position[1], this->position[2]); marker_despawn(marker); } diff --git a/src/MMM/mmmspawnqueue.c b/src/MMM/mmmspawnqueue.c index af42317b7..c3c6cea51 100644 --- a/src/MMM/mmmspawnqueue.c +++ b/src/MMM/mmmspawnqueue.c @@ -411,7 +411,7 @@ void chMMMWindow_update(Actor *this) { chTumblar_checkMMMChecksums(); } -void MMM_func_803890E0(void){ +void MMM_addSpawnableActors(void) { spawnableActorList_add(&chShackDoor, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&chMansionDoor, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&chCellarHatch, actor_new, ACTOR_FLAG_NONE); diff --git a/src/RBB/ch/bossboombox.c b/src/RBB/ch/bossboombox.c index 9559cb277..417eff52e 100644 --- a/src/RBB/ch/bossboombox.c +++ b/src/RBB/ch/bossboombox.c @@ -379,22 +379,12 @@ void chBossBoomBox_setState(Actor *this, s32 new_state){ spawn_position[0] = this->position_x + 200.0f * local->unk0->spawnPositionDelta; spawn_position[1] = this->position_y + 80.0f * local->unk0->spawnPositionDelta; spawn_position[2] = this->position_z; - __spawnQueue_add_4( - (GenFunction_4)spawnQueue_actor_f32, - local->unk0->actorId + 1, - reinterpret_cast(s32, spawn_position[0]), - reinterpret_cast(s32, spawn_position[1]), - reinterpret_cast(s32, spawn_position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(local->unk0->actorId + 1, spawn_position[0], spawn_position[1], spawn_position[2]); spawn_position[0] = this->position_x - 200.0f * local->unk0->spawnPositionDelta; spawn_position[1] = this->position_y + 80.0f * local->unk0->spawnPositionDelta; spawn_position[2] = this->position_z; - __spawnQueue_add_4( - (GenFunction_4)spawnQueue_actor_f32, - local->unk0->actorId + 1, - reinterpret_cast(s32, spawn_position[0]), - reinterpret_cast(s32, spawn_position[1]), - reinterpret_cast(s32, spawn_position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(local->unk0->actorId + 1, spawn_position[0], spawn_position[1], spawn_position[2]); } }//L8038D378 diff --git a/src/RBB/ch/bossboomboxctrl.c b/src/RBB/ch/bossboomboxctrl.c index c29948315..9a1eeb70d 100644 --- a/src/RBB/ch/bossboomboxctrl.c +++ b/src/RBB/ch/bossboomboxctrl.c @@ -33,7 +33,7 @@ void chBossBoomBoxCtrl_update(Actor *this){ { marker_despawn(this->marker); } else { - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_281_BOSS_BOOM_BOX_LARGEST, reinterpret_cast(s32,this->position_x), reinterpret_cast(s32,this->position_y), reinterpret_cast(s32,this->position_z)); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_281_BOSS_BOOM_BOX_LARGEST, this->position[0], this->position[1], this->position[2]); __chBossBoomBoxCtrl_setState(this, BOSS_BOOM_BOX_CTRL_STATE_1_INIT); } }//L8038DEF4 diff --git a/src/RBB/rbbspawnqueue.c b/src/RBB/rbbspawnqueue.c index 6a0116d6e..bd3a5738e 100644 --- a/src/RBB/rbbspawnqueue.c +++ b/src/RBB/rbbspawnqueue.c @@ -186,7 +186,7 @@ void func_80386BF8(Actor *arg0){ func_802D4A9C(arg0, 0); } -void RBB_func_80386C48(void){ +void RBB_addSpawnableActors(void) { spawnableActorList_add(&chBellBuoy, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_14); spawnableActorList_add(&chRBBEggToll, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&chCageUpSwitch, actor_new, ACTOR_FLAG_UNKNOWN_7); diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index 7260ee904..4599adc81 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -59,7 +59,7 @@ static s32 __chAttackTutorial_spawnEnemyActor(Actor *this, s32 already_killed_en : ACTOR_164_COLLYWOBBLE_THE_CAULIFLOWER_A; } - __spawnQueue_add_2((GenFunction_2)__chAttackTutorial_spawnEnemyActorForMarker, (uintptr_t)this->marker, sp1C); + SPAWNQUEUE_ADD_2(__chAttackTutorial_spawnEnemyActorForMarker, (uintptr_t)this->marker, sp1C); return 0; } diff --git a/src/SM/ch/smbottles.c b/src/SM/ch/smbottles.c index b505e0039..4d7ee7586 100644 --- a/src/SM/ch/smbottles.c +++ b/src/SM/ch/smbottles.c @@ -495,7 +495,7 @@ void chSmBottles_update(Actor *this) { }//L80389B20 if (!this->volatile_initialized) { - __spawnQueue_add_1((GenFunction_1) __chSmBottles_spawnMolehill, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(__chSmBottles_spawnMolehill, (uintptr_t)this->marker); this->volatile_initialized = true; }//L80389B4C diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index e6945b6cb..bbc9c87cc 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -6,7 +6,6 @@ #include extern f32 mapModel_getFloorY(f32*); -extern Actor * spawnQueue_bundle_f32(s32, f32, f32, f32); extern void timed_mapSpecificFlags_setTrue(f32 time, enum sm_specific_flags flag); extern void subaddie_set_state_with_direction(Actor* , s32, f32, s32); @@ -222,7 +221,7 @@ static void __chVegetables_vegetableDeathParticles(Actor* this) { if (EventSystem_Should(VB_SPAWN_EMPTY_HONEYCOMB, this->unk38_31, HONEYCOMB_17_SM_COLLIWOBBLE)) { this->position_y += 100.0f; func_802CA1CC(HONEYCOMB_17_SM_COLLIWOBBLE); - __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, BUNDLE_1F_SM_EMPTY_HONEYCOMB, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z)); + SPAWNQUEUE_ADD_BUNDLE_F32(BUNDLE_1F_SM_EMPTY_HONEYCOMB, this->position[0], this->position[1], this->position[2]); CALL_EVENT(OnHoneycombDropSpawn, HONEYCOMB_17_SM_COLLIWOBBLE, BUNDLE_1F_SM_EMPTY_HONEYCOMB, this->position_x, this->position_y, this->position_z); } diff --git a/src/SM/quarrie.c b/src/SM/quarrie.c index b507342cd..ae621cc3b 100644 --- a/src/SM/quarrie.c +++ b/src/SM/quarrie.c @@ -6,7 +6,6 @@ #include "prop.h" void func_803869A0(Actor*, f32, f32); -Actor *spawnQueue_bundle_f32(s32, f32, f32, f32); void SM_func_80386EF4(Actor *this); void SM_func_80386A00(Actor *this); @@ -115,7 +114,7 @@ void SM_func_80386D68(Actor *this){ // if (this->partnerActor && codeBF0_shouldSpawnQuarrieHoneyComb(this->partnerActor)) { if (EventSystem_Should(VB_SPAWN_EMPTY_HONEYCOMB, this->partnerActor && codeBF0_shouldSpawnQuarrieHoneyComb(this->partnerActor), HONEYCOMB_18_SM_QUARRIES)) { func_802CA1CC(HONEYCOMB_18_SM_QUARRIES); - __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, BUNDLE_1F_SM_EMPTY_HONEYCOMB, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + SPAWNQUEUE_ADD_BUNDLE_F32(BUNDLE_1F_SM_EMPTY_HONEYCOMB, this->position[0], this->position[1], this->position[2]); CALL_EVENT(OnHoneycombDropSpawn, HONEYCOMB_18_SM_QUARRIES, BUNDLE_1F_SM_EMPTY_HONEYCOMB, this->position[0], this->position[1], this->position[2]); } diff --git a/src/SM/smspawnqueue.c b/src/SM/smspawnqueue.c index 45e81f3b1..00fb028ba 100644 --- a/src/SM/smspawnqueue.c +++ b/src/SM/smspawnqueue.c @@ -131,8 +131,7 @@ static bool __codeF0_areCrcsValid(){ return true; } -void SM_resetSpawnableActors() -{ +void SM_addSpawnableActors() { spawnableActorList_add(&gQuarrie, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); spawnableActorList_add(&gCodeBF0, actor_new, ACTOR_FLAG_UNKNOWN_7); spawnableActorList_add(&gChAttackTutorial, actor_new, ACTOR_FLAG_NONE); diff --git a/src/TTC/actor_spawninit.c b/src/TTC/actor_spawninit.c index 03c0128f7..8aa671ed2 100644 --- a/src/TTC/actor_spawninit.c +++ b/src/TTC/actor_spawninit.c @@ -90,9 +90,7 @@ ActorInfo gPalmTree = { 0, 0, 0.0f, 0 }; -/* .code */ -void code26D0_resetSpawnableActorsForTTC(void) -{ +void TTC_addSpawnableActors(void) { spawnableActorList_add(&gBlubberShipTopHatch, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&gLighthouseDoor, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&gChNipper, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_20 | ACTOR_FLAG_UNKNOWN_26); @@ -138,7 +136,7 @@ static void __code26D0_spawnLighthouseB(uintptr_t arg0){ static void __code26D0_lighthouseAUpdateFunc(Actor *this){ __code26D0_genericUpdateFunc(this); if(!this->volatile_initialized){ - __spawnQueue_add_1((GenFunction_1)__code26D0_spawnLighthouseB, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(__code26D0_spawnLighthouseB, (uintptr_t)this->marker); this->volatile_initialized = true; } } diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index d660c7574..225bdc6b4 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -62,7 +62,7 @@ static void __chBlubber_showTextCallback2(ActorMarker *caller, enum asset_e text // if(nodeProp_findPositionFromActorId(ACTOR_14B_TTC_BLUBBER_UNKNOWN, sp24)){ if(EventSystem_Should(VB_SPAWN_PUZZLE_JIGGY, nodeProp_findPositionFromActorId(ACTOR_14B_TTC_BLUBBER_UNKNOWN, sp24), marker_getActor(caller))){ jiggy_spawn(JIGGY_14_TTC_BLUBBER, sp24); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, sp24[0]), reinterpret_cast(s32, sp24[1]), reinterpret_cast(s32, sp24[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, sp24[0], sp24[1], sp24[2]); } } diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index 62b32e784..bff377915 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -5,7 +5,6 @@ #include "bk_math.h" #include "port/Patches/Patches.h" -extern Actor *spawnQueue_bundle_f32(s32, s32, s32, s32); extern ActorProp * func_80320EB0(ActorMarker *, f32, s32); static void __chClam_updateFunc(Actor *this); @@ -247,7 +246,7 @@ static void __chClam_playerDropsItem(enum bundle_e bundle_id, enum item_e item_i player_getPosition(position); bundle_setYaw(randf2(0.0f, 359.0f)); - __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, bundle_id, reinterpret_cast(s32, position[0]), reinterpret_cast(s32, position[1]), reinterpret_cast(s32, position[2])); + SPAWNQUEUE_ADD_BUNDLE_F32(bundle_id, position[0], position[1], position[2]); item_dec(item_id); } diff --git a/src/TTC/ch/treasure.c b/src/TTC/ch/treasure.c index 3ae54cf0d..e03dd2388 100644 --- a/src/TTC/ch/treasure.c +++ b/src/TTC/ch/treasure.c @@ -23,7 +23,7 @@ ActorInfo gChTreasure = { /* .code */ static void __chTreasure_die(ActorMarker *marker, ActorMarker *otherMarker){ Actor *this = marker_getActor(marker); - __spawnQueue_add_4((GenFunction_4) spawnQueue_actor_f32, 0x4C, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(0x4C, this->position[0], this->position[1], this->position[2]); func_802EE278(this, 3, 0xf, 0x3C, 0.2f, 1.2f); func_803115C4(VER_SELECT(0xA19, 0x919, 0, 0)); jiggy_spawn(JIGGY_11_TTC_RED_X, this->position); diff --git a/src/TTC/ch/treasurehunt.c b/src/TTC/ch/treasurehunt.c index 6f1163862..842f19931 100644 --- a/src/TTC/ch/treasurehunt.c +++ b/src/TTC/ch/treasurehunt.c @@ -128,8 +128,8 @@ static void __chTreasurehunt_checkStepProgress(s32 currentStep){ chtreasureHunt_puzzleCurrentStep++; CALL_EVENT(OnPuzzleStep, ANCHOR_PUZZLE_TTC_XHUNT, (1 << chtreasureHunt_puzzleCurrentStep) - 1); // [port] - __spawnQueue_add_0(__chTreasurehunt_spawnActorForNextStep); - __spawnQueue_add_0(__chTreasurehunt_spawnRedXForNextStep); + SPAWNQUEUE_ADD_0(__chTreasurehunt_spawnActorForNextStep); + SPAWNQUEUE_ADD_0(__chTreasurehunt_spawnRedXForNextStep); } } @@ -162,7 +162,7 @@ void chTreasurehunt_checkStepProgress5(NodeProp *this, ActorMarker *arg1){ particleTargetPosition[1] = (f32)this->position_y; particleTargetPosition[2] = (f32)this->position_z; particleTargetPosition[1] = mapModel_getFloorY(particleTargetPosition); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, 0xF4, reinterpret_cast(s32, particleTargetPosition[0]), reinterpret_cast(s32, particleTargetPosition[1]), reinterpret_cast(s32, particleTargetPosition[2])); + SPAWNQUEUE_ADD_ACTOR_F32(0xF4, particleTargetPosition[0], particleTargetPosition[1], particleTargetPosition[2]); particleEmitter = partEmitMgr_newEmitter(3); particleEmitter_setRGB(particleEmitter, sChTreasurehuntParticleRGB); particleEmitter_setSprite(particleEmitter, ASSET_700_SPRITE_DUST); diff --git a/src/core1/ucode.c b/src/core1/ucode.c index 3e78ffcd1..a696bc912 100644 --- a/src/core1/ucode.c +++ b/src/core1/ucode.c @@ -33,8 +33,8 @@ void ucode_stub2(void) { #endif } -s32 ucode_stub3(void) { - return 0; +bool ucode_stub3(void) { + return FALSE; } void ucode_getPtrAndSize(void **ptr, u32 *size) { diff --git a/src/core2/actor_array.c b/src/core2/actor_array.c index c519c033a..e89ec3236 100644 --- a/src/core2/actor_array.c +++ b/src/core2/actor_array.c @@ -24,7 +24,6 @@ extern void func_802F2C78(Struct64s *); extern void func_802F2D8C(Struct64s *); f32 func_80257204(f32, f32, f32, f32); -extern Actor *spawnQueue_bundleWithYaw_f32(enum bundle_e bundle_id, s32 x, s32 y, s32 z, s32 yaw); f32 func_8033229C(ActorMarker *); f32 player_getYaw(void); extern void func_8032B3A0(Actor *, ActorMarker *); @@ -1002,8 +1001,8 @@ Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ suLastBaddie->marker->unk50 = func_803406B0(); } - if(flags & ACTOR_FLAG_UNKNOWN_4){ - suLastBaddie->unk124_31 = -1; + if (flags & ACTOR_FLAG_UNKNOWN_4) { + suLastBaddie->unk124_31 = 0xFFF; } if(flags & ACTOR_FLAG_UNKNOWN_7){ @@ -1955,13 +1954,13 @@ void actors_applyFromSavestate(void *savestate_ptr, ActorListSaveState *savestat // only used for GV Jinxy Head 2 void func_8032A5F8(void) { - Actor *var_s0; + Actor *i_actor; if (suBaddieActorArray != NULL) { - for(var_s0 = &suBaddieActorArray->data[0]; var_s0 < &suBaddieActorArray->data[suBaddieActorArray->cnt]; var_s0++){ - if (var_s0->unk124_31 == 0xfff) { - var_s0->unk124_31 = 0; - func_8032A6A8(var_s0); + for (i_actor = &suBaddieActorArray->data[0]; i_actor < &suBaddieActorArray->data[suBaddieActorArray->cnt]; i_actor++) { + if (i_actor->unk124_31 == 0xFFF) { + i_actor->unk124_31 = 0; + func_8032A6A8(i_actor); } } } @@ -1969,19 +1968,18 @@ void func_8032A5F8(void) { // only used by GV Jinxy Head 2 void func_8032A6A8(Actor *arg0) { - f32 var_f0; - f32 var_f2; - Actor *var_v0; - + f32 var_f0, var_f2; + Actor *i_actor; if (arg0->unk44_14 != -1) { var_f0 = 1.0f; - for(var_v0 = &suBaddieActorArray->data[0]; var_v0 < &suBaddieActorArray->data[suBaddieActorArray->cnt]; var_v0++){ - if ((arg0->unk44_14 == var_v0->unk44_14) && (arg0 != var_v0)) { - var_f2 = var_v0->unk48; + + for (i_actor = &suBaddieActorArray->data[0]; i_actor < &suBaddieActorArray->data[suBaddieActorArray->cnt]; i_actor++) { + if ((arg0->unk44_14 == i_actor->unk44_14) && (arg0 != i_actor)) { + var_f2 = i_actor->unk48; if ((var_f2 <= var_f0) && (arg0->unk48 <= var_f2)) { - if (var_v0->secondaryId != 0) { - arg0->unk124_31 = var_v0->secondaryId; + if (i_actor->secondaryId != 0) { + arg0->unk124_31 = i_actor->secondaryId; var_f0 = var_f2; } } @@ -1992,17 +1990,18 @@ void func_8032A6A8(Actor *arg0) { // only used by GV Jinxy Head 2 Actor *func_8032A7AC(Actor *arg0) { - Actor *var_a0; + Actor *i_actor; if (arg0->unk124_31 != 0) { if (suBaddieActorArray != NULL) { - for(var_a0 = &suBaddieActorArray->data[0]; var_a0 < &suBaddieActorArray->data[suBaddieActorArray->cnt]; var_a0++){ - if (arg0->unk124_31 == var_a0->secondaryId) { - return var_a0; + for (i_actor = &suBaddieActorArray->data[0]; i_actor < &suBaddieActorArray->data[suBaddieActorArray->cnt]; i_actor++) { + if (arg0->unk124_31 == i_actor->secondaryId) { + return i_actor; } } } } + return NULL; } @@ -2265,12 +2264,12 @@ void func_8032B258(Actor *this, enum collision_e arg1) { vec3fArray_get_vec3f( this->marker->unk44, 0x20, sp38); } if (((uintptr_t)this->marker->unk44 > 1) && ((sp38[0] != 0.0f) || (sp38[1] != 0.0f) || (sp38[2] != 0.0f))) { - __spawnQueue_add_5((GenFunction_5) spawnQueue_bundleWithYaw_f32, this->unk138_27 + BUNDLE_15__JIGGY, reinterpret_cast(s32, sp38[0]), reinterpret_cast(s32, sp38[1]), reinterpret_cast(s32, sp38[2]), reinterpret_cast(s32, sp44)); + SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(this->unk138_27 + BUNDLE_15__JIGGY, sp38[0], sp38[1], sp38[2], sp44); return; } else{ sp34 = this->position[1] + 50.0f; - __spawnQueue_add_5((GenFunction_5)spawnQueue_bundleWithYaw_f32, this->unk138_27 + BUNDLE_15__JIGGY, reinterpret_cast(s32,this->position[0]), reinterpret_cast(s32,sp34), reinterpret_cast(s32,this->position[2]), reinterpret_cast(s32,sp44)); + SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(this->unk138_27 + BUNDLE_15__JIGGY, this->position[0], sp34, this->position[2], sp44); } } } @@ -2315,13 +2314,14 @@ void func_8032B4DC(Actor *this, ActorMarker *arg1, s32 arg2) { void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, CollisionParams *arg2) { Actor *this; - s32 sp70; - s32 sp6C; - s32 sp68; + s32 drop_bundle_num; + s32 unk_bit_7; + s32 hits_to_trigger; enum marker_collision_func_type_e sp64; - s32 var_v0; + s32 remaining_health; f32 player_yaw; f32 sp50[3]; +// s32 sp4C; Cube *sp4C; NodeProp *sp48; s32 sp3C[3]; @@ -2329,42 +2329,44 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, CollisionParams *arg2) s32 pad; this = marker_getActor(arg0); - sp70 = collision_getDropBundleNum(arg2); + drop_bundle_num = collision_getDropBundleNum(arg2); // [port] unkBit7 is 3 bits wide, but each bundle group holds only 5 spread variants -// sp6C = collision_getUnkBit7(arg2); - sp6C = MIN(collision_getUnkBit7(arg2), 5); - sp68 = collision_getHitsToTrigger(arg2); +// unk_bit_7 = collision_getUnkBit7(arg2); + unk_bit_7 = MIN(collision_getUnkBit7(arg2), 5); + hits_to_trigger = collision_getHitsToTrigger(arg2); sp64 = collision_getNextState(arg2); if (((baiFrame_getState() != 3) && func_8028F1E0()) || (collision_getDamageToPlayer(arg2) == 0)) { if (sp64 == 0) { - if ((sp68 != 0) || (arg1->id == 0)) { - if (sp68 <= 0) { - sp68 = 1; + if ((hits_to_trigger != 0) || (arg1->id == 0)) { + if (hits_to_trigger <= 0) { + hits_to_trigger = 1; } } else{ return; } } - if (sp68 != 0) { - var_v0 = MAX(0 , (this->unk164[sp64] - (100 / sp68))); - if ((this->unk164[sp64] = var_v0) && (sp68 >= 2)) { - sp6C /= 2; + if (hits_to_trigger != 0) { + remaining_health = MAX(0 , (this->unk164[sp64] - (100 / hits_to_trigger))); + if ((this->unk164[sp64] = remaining_health) && (hits_to_trigger >= 2)) { + unk_bit_7 /= 2; } } -// if (sp6C != 0) { - if (EventSystem_Should(VB_ENEMY_BECOME_BUNDLE, sp6C != 0, this->actor_info->actorId)) { +// if (unk_bit_7 != 0) { + if (EventSystem_Should(VB_ENEMY_BECOME_BUNDLE, unk_bit_7 != 0, this->actor_info->actorId)) { bundle_setYaw(func_80257204(arg0->propPtr->position_x, arg0->propPtr->position_z, arg1->propPtr->position_x, arg1->propPtr->position_z) + 90.0f); - D_8036E564 = sp6C; + D_8036E564 = unk_bit_7; if (this->unk138_25) { - __bundle_spawnFromFirstActor(sp6C + BUNDLE_21__ICECUBE_B, this); + __bundle_spawnFromFirstActor(unk_bit_7 + BUNDLE_21__ICECUBE_B, this); } else { - if ((this->marker->id < 0x1A1) || (this->marker->id >= 0x1A5)) { - __bundle_spawnFromFirstActor(sp6C + BUNDLE_18__HONEYCOMB, this); + if ((this->marker->id < MARKER_1A1_BOSS_BOOM_BOX_LARGEST) || + (this->marker->id >= MARKER_1A5_SANDYBUTT_EGG_TOLL)) + { + __bundle_spawnFromFirstActor(unk_bit_7 + BUNDLE_18__HONEYCOMB, this); } } } - if (sp68 != 0) { + if (hits_to_trigger != 0) { if ((sp64 == 2) && this->unk16C_1) { func_8032B3A0(this, arg1); } @@ -2379,7 +2381,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, CollisionParams *arg2) if (sp64 != 2) { this->unk164[sp64] = 0x63; } - if ((sp64 == 2) && (sp70 != 0)) { + if ((sp64 == 2) && (drop_bundle_num != 0)) { player_yaw = player_getYaw(); sp3C[0] = (s32) this->position[0]; sp3C[1] = (s32) this->position[1]; @@ -2389,21 +2391,21 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, CollisionParams *arg2) } func_8032EE0C((GenFunction_2)func_8032B38C, (uintptr_t)this); if (((uintptr_t)arg0->unk44 > 1) && ((sp50[0] != 0.0f) || (sp50[1] != 0.0f) || (sp50[2] != 0.0f))) { // [port] N64 used (s32)<0; unk44 is 0=NULL, 1=flag, or valid ptr - __spawnQueue_add_5((GenFunction_5)spawnQueue_bundleWithYaw_f32, sp70 + BUNDLE_15__JIGGY, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); + SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(drop_bundle_num + BUNDLE_15__JIGGY, sp50[0], sp50[1], sp50[2], player_yaw); } else if (this->unk16C_3 && func_803048E0(sp3C, &sp4C, &sp48, 3, (s32) (func_8033229C(arg0) * 4.0f))) { sp50[0] = (f32) sp48->position_x; sp50[1] = (f32) sp48->position_y; sp50[2] = (f32) sp48->position_z; - __spawnQueue_add_5((GenFunction_5)spawnQueue_bundleWithYaw_f32, sp70 + BUNDLE_15__JIGGY, reinterpret_cast(s32, sp50[0]), reinterpret_cast(s32, sp50[1]), reinterpret_cast(s32, sp50[2]), reinterpret_cast(s32, player_yaw)); + SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(drop_bundle_num + BUNDLE_15__JIGGY, sp50[0], sp50[1], sp50[2], player_yaw); } else { sp38 = this->position[1] + func_8033229C(arg0); - __spawnQueue_add_5((GenFunction_5)spawnQueue_bundleWithYaw_f32, sp70 + BUNDLE_15__JIGGY, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, sp38), reinterpret_cast(s32, this->position[2]), reinterpret_cast(s32, player_yaw)); + SPAWNQUEUE_ADD_BUNDLE_WITH_YAW_F32(drop_bundle_num + BUNDLE_15__JIGGY, this->position[0], sp38, this->position[2], player_yaw); } func_8032EE20(); } marker_callCollisionFunc(arg0, arg1, sp64); } - if ((sp64 != 0) && (sp6C != 0)) { + if ((sp64 != 0) && (unk_bit_7 != 0)) { sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 25984, this->position, (s32)((500.0f + func_8033229C(arg0)) * 0.5), (s32)((500.0f + func_8033229C(arg0)) * 5)); } } diff --git a/src/core2/actor_cubepropsystem.c b/src/core2/actor_cubepropsystem.c index 1d5b5ecc1..55e7155f8 100644 --- a/src/core2/actor_cubepropsystem.c +++ b/src/core2/actor_cubepropsystem.c @@ -19,7 +19,6 @@ #define MARKER_BITMAP_BYTES (MARKER_POOL_SIZE / 8) extern f32 vtxList_getGlobalNorm(BKVertexList *); -extern void spawnQueue_func_802C39D4(void); extern bool func_80340020(Struct83s *, f32[3], f32[3], f32, f32 *, BKVertexList *, f32[3], f32[3]); extern void func_80340200(Struct83s *, f32[3], f32[3], f32, f32[3], s16[3], BKVertexList *, f32[3]); extern s32 bkmodelunk14list_func_802EBAE0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, f32 arg4[3], AnimMtxList *arg5, f32 arg6[3], f32 arg7, f32 arg8[3]); diff --git a/src/core2/ba/carriedobj.c b/src/core2/ba/carriedobj.c index 3d666a454..fb92a6ff7 100644 --- a/src/core2/ba/carriedobj.c +++ b/src/core2/ba/carriedobj.c @@ -50,7 +50,7 @@ void bacarriedobj_spawn(enum actor_e actor_id){ bacarry_set_marker(marker); } else{ - __spawnQueue_add_1((GenFunction_1)__bscarriedobj_spawnMethod, baMarker_getCarriedObjectActorId()); + SPAWNQUEUE_ADD_1(__bscarriedobj_spawnMethod, baMarker_getCarriedObjectActorId()); } } diff --git a/src/core2/ba/hazards.c b/src/core2/ba/hazards.c index a02c8a472..3241b5979 100644 --- a/src/core2/ba/hazards.c +++ b/src/core2/ba/hazards.c @@ -61,7 +61,7 @@ void spawnPiranhaParticles(void) { } void triggerSwampHazardEffects(void) { - __spawnQueue_add_0(&spawnPiranhaParticles); + SPAWNQUEUE_ADD_0(spawnPiranhaParticles); FUNC_8030E624(SFX_A_BANJO_LANDING_05, 1.0f, 28000); sfxSource_triggerCallbackByIndex(hazardSfxId); sfxsource_setSfxId(hazardSfxId, SFX_6D_CROC_BITE); diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index b32b38a5f..705b6780d 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -170,7 +170,7 @@ void __baMarker_8028B9A8(uintptr_t arg0){ } void __baMarker_8028BA00(s32 arg0){ - __spawnQueue_add_1((GenFunction_1)__baMarker_8028B9A8, (uintptr_t)arg0); + SPAWNQUEUE_ADD_1(__baMarker_8028B9A8, (uintptr_t)arg0); } @@ -573,7 +573,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ if(EventSystem_Should(VB_JINJO_JINGLE_LOOK_AT, comusic_isTrackQueued(COMUSIC_30_5TH_JINJO_COLLECTED))){ __baMarker_8028B8DC(); } - __spawnQueue_add_4((GenFunction_4)__baMarker_8028B904, reinterpret_cast(u32, other_prop->actorProp.position_x), reinterpret_cast(u32, other_prop->actorProp.position_y), reinterpret_cast(u32, other_prop->actorProp.position_z), jiggy_id); + SPAWNQUEUE_ADD_4(__baMarker_8028B904, reinterpret_cast(u32, other_prop->actorProp.position_x), reinterpret_cast(u32, other_prop->actorProp.position_y), reinterpret_cast(u32, other_prop->actorProp.position_z), jiggy_id); marker_despawn(marker); } } @@ -606,7 +606,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ case 0x54: //L8028C820 coMusicPlayer_playMusic(COMUSIC_19_LOW_PITCH_FLUTES, 28000); func_803012F8(); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_s16, 0x4E, reinterpret_cast(u32, other_prop->actorProp.position_x), reinterpret_cast(u32, other_prop->actorProp.position_y), reinterpret_cast(u32, other_prop->actorProp.position_z)); + SPAWNQUEUE_ADD_ACTOR_S16(0x4E, other_prop->actorProp.position_x, other_prop->actorProp.position_y, other_prop->actorProp.position_z); marker_despawn(marker); break; @@ -786,7 +786,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ baflag_set(BA_FLAG_E_TOUCHING_WADING_BOOTS); func_802A6388(chwadingboots_802D6E4C(actor)); bs_checkInterrupt(BS_INTR_1B); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_s16, 0x4E, reinterpret_cast(u32, other_prop->actorProp.position_x), reinterpret_cast(u32, other_prop->actorProp.position_y), reinterpret_cast(u32, other_prop->actorProp.position_z)); + SPAWNQUEUE_ADD_ACTOR_S16(0x4E, other_prop->actorProp.position_x, other_prop->actorProp.position_y, other_prop->actorProp.position_z); chwadingboots_802D6E54(actor); break; @@ -810,7 +810,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ baflag_set(BA_FLAG_10_TOUCHING_TURBO_TRAINERS); set_turbo_duration(chtrainers_getDuration(actor)); bs_checkInterrupt(BS_INTR_1A); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_s16, 0x4E, reinterpret_cast(u32, other_prop->actorProp.position_x), reinterpret_cast(u32, other_prop->actorProp.position_y), reinterpret_cast(u32, other_prop->actorProp.position_z)); + SPAWNQUEUE_ADD_ACTOR_S16(0x4E, other_prop->actorProp.position_x, other_prop->actorProp.position_y, other_prop->actorProp.position_z); chtrainers_pickup(actor); break; diff --git a/src/core2/ba/model.c b/src/core2/ba/model.c index 0d736b1db..d10818038 100644 --- a/src/core2/ba/model.c +++ b/src/core2/ba/model.c @@ -146,12 +146,7 @@ void baModel_reset(void){ if(!player_shouldPlayLevelEntrance()) baModel_updateModel(); player_getPosition(plyr_pos); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, - ACTOR_17_PLAYER_SHADOW, - reinterpret_cast(s32, plyr_pos[0]), - reinterpret_cast(s32, plyr_pos[1]), - reinterpret_cast(s32, plyr_pos[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_17_PLAYER_SHADOW, plyr_pos[0], plyr_pos[1], plyr_pos[2]); } void baModel_free(void){ diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 4f4037470..27b24e921 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -31,8 +31,8 @@ void chBeehive_die(ActorMarker *this, ActorMarker *other){ actor_playAnimationOnce(actor); this->collidable = false; actor->unk138_27 = 3; - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, actor->position[0]), reinterpret_cast(s32, actor->position[1]), reinterpret_cast(s32, actor->position[2])); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4A_WOOD_EXPLOSION, reinterpret_cast(s32, actor->position[0]), reinterpret_cast(s32, actor->position[1]), reinterpret_cast(s32, actor->position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, actor->position[0], actor->position[1], actor->position[2]); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4A_WOOD_EXPLOSION, actor->position[0], actor->position[1], actor->position[2]); actor->marker->propPtr->unk8_3 = 0; func_803115C4(VER_SELECT(ASSET_D96_DIALOG_BEEHIVE_MEET, 0x0A14, 0, 0)); func_803115C4(VER_SELECT(ASSET_DA6_DIALOG_BEEHIVE_WITH_BEES, 0x0A24, 0, 0)); diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index 3a9917a5f..80217aa7a 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -561,7 +561,7 @@ void __chBottlesBonus_spawn(void){ void chBottlesBonus_spawn(s32 arg0, s32 arg1){ if(chBottlesBonusMarker == NULL){ - __spawnQueue_add_0(__chBottlesBonus_spawn); + SPAWNQUEUE_ADD_0(__chBottlesBonus_spawn); } } diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index 3df405c25..572902edc 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -192,7 +192,7 @@ void __chCrab_die(ActorMarker *marker, ActorMarker *other){ is_black_snippet = this->modelCacheIndex == ACTOR_F2_BLACK_SNIPPET; sfx_playFadeShorthandDefault(SFX_79_TICKER_DEATH, 1.0f, 32750, this->position, 950, 1900); sfx_playFadeShorthandDefault(SFX_79_TICKER_DEATH, 1.0f, 28000, this->position, 950, 1900); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, this->position[0], this->position[1], this->position[2]); this->lifetime_value = 5.0f; marker->collidable = FALSE; this->unk138_27 = 1; diff --git a/src/core2/ch/gloop.c b/src/core2/ch/gloop.c index 2fee4d88e..e19daf64d 100644 --- a/src/core2/ch/gloop.c +++ b/src/core2/ch/gloop.c @@ -83,7 +83,7 @@ void chgloop_update(Actor *this){ sp34[2] = this->position[2]; } if(subaddie_playerIsWithinSphereAndActive(this, 1900)){ - __spawnQueue_add_4((GenFunction_4)chgloop_spawnBubble, reinterpret_cast(s32, sp34[0]), reinterpret_cast(s32, sp34[1]), reinterpret_cast(s32, sp34[2]), reinterpret_cast(s32, this->yaw)); + SPAWNQUEUE_ADD_4(chgloop_spawnBubble, reinterpret_cast(s32, sp34[0]), reinterpret_cast(s32, sp34[1]), reinterpret_cast(s32, sp34[2]), reinterpret_cast(s32, this->yaw)); } func_8030E9C4(SFX_3ED_BUBBLE_POP, randf()/2 + 0.6, 32000, this->position, 100.0f, 3000.0f); diff --git a/src/core2/ch/goldfeather.c b/src/core2/ch/goldfeather.c index c30c097e1..5e6f200f3 100644 --- a/src/core2/ch/goldfeather.c +++ b/src/core2/ch/goldfeather.c @@ -90,5 +90,5 @@ void func_802D8B20(enum actor_e actor_id){ } void func_802D8BE4(bool gold_feather){ - __spawnQueue_add_1((GenFunction_1)func_802D8B20, (!gold_feather) ? ACTOR_1FF_SPENT_RED_FEATHER : ACTOR_200_SPENT_GOLD_FEATHER); + SPAWNQUEUE_ADD_1(func_802D8B20, (!gold_feather) ? ACTOR_1FF_SPENT_RED_FEATHER : ACTOR_200_SPENT_GOLD_FEATHER); } diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 56404858a..cc698d2e4 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -227,7 +227,7 @@ void __chicecube_die(ActorMarker *marker, ActorMarker *other_marker){ func_8035A04C(actor->position, 12, ASSET_505_MODEL_ICECUBE_CHUNK, actor->scale); func_8035A228(actor->position, 6, ASSET_700_SPRITE_DUST, actor->scale); if(actor->actorTypeSpecificField != 1){ - __spawnQueue_add_1((GenFunction_1)__chicecube_spawnHalfCubes, (uintptr_t)actor->marker); + SPAWNQUEUE_ADD_1(__chicecube_spawnHalfCubes, (uintptr_t)actor->marker); } marker_despawn(actor->marker); } diff --git a/src/core2/ch/jiggy.c b/src/core2/ch/jiggy.c index f2b51a304..41f4643be 100644 --- a/src/core2/ch/jiggy.c +++ b/src/core2/ch/jiggy.c @@ -53,8 +53,8 @@ void playJiggyDestroyedSoundsAndReset(ActorMarker *marker, u32 resetSwitchFlag) } void spawnJiggyDestroyedEffects(u32 x, u32 y, u32 z, u32 resetSwitchFlag) { - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_s32, ACTOR_4C_STEAM, x, y, z); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_s32, ACTOR_14F_DESTROYED_JIGGY, x, y, z); + SPAWNQUEUE_ADD_ACTOR_S32(ACTOR_4C_STEAM, x, y, z); + SPAWNQUEUE_ADD_ACTOR_S32(ACTOR_14F_DESTROYED_JIGGY, x, y, z); mapSpecificFlags_set(resetSwitchFlag, TRUE); } diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index 7891f7dbc..4d47d2f8d 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -374,7 +374,7 @@ void chmole_update(Actor *this){ nodeprop_getPosition(node_prop, this->unk1C); } // Spawns molehill - __spawnQueue_add_1((GenFunction_1)chmole_spawnMolehill, reinterpret_cast(uintptr_t, this->marker)); + SPAWNQUEUE_ADD_1(chmole_spawnMolehill, reinterpret_cast(uintptr_t, this->marker)); this->marker->propPtr->unk8_3 = FALSE; this->marker->collidable = FALSE; this->initialized = TRUE; diff --git a/src/core2/ch/snacker.c b/src/core2/ch/snacker.c index 4877b0dee..163ad3dd6 100644 --- a/src/core2/ch/snacker.c +++ b/src/core2/ch/snacker.c @@ -397,7 +397,7 @@ void chsnacker_setControlState(SnackerCtlState control_state) { s_chSnacker_spawnTimer += dt; if ((s_chSnacker_respawnDelay_s < s_chSnacker_spawnTimer) && (control_state != SNACKER_CTL_STATE_0_INACTIVE)) { if (EventSystem_Should(VB_DISABLE_SNACKER, true)) { - __spawnQueue_add_0(chSnacker_spawn); + SPAWNQUEUE_ADD_0(chSnacker_spawn); } s_chSnacker_respawnDelay_s = 1.0f; } diff --git a/src/core2/ch/snowman.c b/src/core2/ch/snowman.c index 6d3f7ca16..e94e58a60 100644 --- a/src/core2/ch/snowman.c +++ b/src/core2/ch/snowman.c @@ -184,7 +184,7 @@ void __chSnowman_deathCallback(ActorMarker *marker, ActorMarker *other_marker){ sfx_playFadeShorthandDefault(SFX_3EA_BANJO_GUH_HUH, 1.0f, 30000, actor->position, 1500, 4500); sfx_playFadeShorthandDefault(SFX_2F_ORANGE_SPLAT, 1.0f, 30000, actor->position, 1500, 4500); - __spawnQueue_add_1((GenFunction_1)__chSnowman_spawnHat, (uintptr_t)actor->marker); + SPAWNQUEUE_ADD_1(__chSnowman_spawnHat, (uintptr_t)actor->marker); // if(gsworld_getMap() == MAP_27_FP_FREEZEEZY_PEAK) if(gsworld_getMap() == MAP_27_FP_FREEZEEZY_PEAK){ maSnowy_decRemaining(); @@ -316,7 +316,7 @@ void chSnowman_update(Actor *this){ && local->unkB ){ func_8030E878(SFX_8F_SNOWBALL_FLYING, randf2(0.95f, 1.05f), 30000, this->position, 800.0f, 3050.0f); - __spawnQueue_add_1((GenFunction_1)__chSnowman_spawnSnowball, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(__chSnowman_spawnSnowball, (uintptr_t)this->marker); local->unk9 = false; } diff --git a/src/core2/fx/badShad.c b/src/core2/fx/badShad.c index 772146ec9..de9441f94 100644 --- a/src/core2/fx/badShad.c +++ b/src/core2/fx/badShad.c @@ -146,7 +146,7 @@ void func_802D729C(Actor *actor, f32 arg1){ return; } if(!actor->unk104){ - __spawnQueue_add_2((GenFunction_2)func_802D71A0, (uintptr_t)actor->marker, reinterpret_cast(s32, arg1)); + SPAWNQUEUE_ADD_2(func_802D71A0, (uintptr_t)actor->marker, reinterpret_cast(s32, arg1)); return; } diff --git a/src/core2/fx/banjokazooiesign.c b/src/core2/fx/banjokazooiesign.c index 10398096e..1a1319f51 100644 --- a/src/core2/fx/banjokazooiesign.c +++ b/src/core2/fx/banjokazooiesign.c @@ -79,7 +79,7 @@ void gcBanjoKazooieSign_spawn(void) { void func_802DC9A4(s32 arg0, s32 arg1){ if(gcBanjoKazooieSignMarker == NULL){ - __spawnQueue_add_0(gcBanjoKazooieSign_spawn); + SPAWNQUEUE_ADD_0(gcBanjoKazooieSign_spawn); } } diff --git a/src/core2/fx/effect_jiggy.c b/src/core2/fx/effect_jiggy.c index 711b94de1..0524e5ffd 100644 --- a/src/core2/fx/effect_jiggy.c +++ b/src/core2/fx/effect_jiggy.c @@ -14,7 +14,7 @@ void func_80347C80(Struct81s *arg0){ } void func_80347CC8(Struct81s *arg0){ - __spawnQueue_add_1((GenFunction_1)func_80347C80, (uintptr_t)arg0); + SPAWNQUEUE_ADD_1(func_80347C80, (uintptr_t)arg0); } void func_80347CF4(Struct81s *arg0) { diff --git a/src/core2/fx/effect_jiggy_spawn.c b/src/core2/fx/effect_jiggy_spawn.c index 7a83e79f8..610586654 100644 --- a/src/core2/fx/effect_jiggy_spawn.c +++ b/src/core2/fx/effect_jiggy_spawn.c @@ -15,7 +15,7 @@ void func_80347B10(Struct81s *arg0){ } void func_80347B54(Struct81s *arg0){ - __spawnQueue_add_1((GenFunction_1)func_80347B10, (uintptr_t)arg0); + SPAWNQUEUE_ADD_1(func_80347B10, (uintptr_t)arg0); } void func_80347B80(Struct81s *arg0) { diff --git a/src/core2/fx/shrapnel.c b/src/core2/fx/shrapnel.c index d467a4ef1..c3a26044f 100644 --- a/src/core2/fx/shrapnel.c +++ b/src/core2/fx/shrapnel.c @@ -119,7 +119,7 @@ void chShrapnel_explode(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); sfx_playFadeShorthandDefault(SFX_1B_EXPLOSION_1, 1.0f, 32736, this->position, 1250, 2500); - __spawnQueue_add_1((GenFunction_1)chShrapnel_spawnExplodeActor, (uintptr_t)this); + SPAWNQUEUE_ADD_1(chShrapnel_spawnExplodeActor, (uintptr_t)this); chShrapnel_emitExplosion(this); chShrapnel_emitSmoke(this); chShrapnel_emitBodyParts(this, ASSET_53A_MODEL_SHRAPNAL_PIECE_EYE, 2); diff --git a/src/core2/gameSelect.c b/src/core2/gameSelect.c index 7a041e68d..456e6b299 100644 --- a/src/core2/gameSelect.c +++ b/src/core2/gameSelect.c @@ -361,7 +361,7 @@ void gameSelect_update(Actor *this){ } if(!this->initialized){ - __spawnQueue_add_1((GenFunction_1)spawnGameSelectProps, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(spawnGameSelectProps, (uintptr_t)this->marker); func_802C7318(this); this->unk130 = func_802C71F0; if(game_number == CH_GAME_SELECT_SAVEFILE_0_BED){ diff --git a/src/core2/gc/gameoversign.c b/src/core2/gc/gameoversign.c index 9e63caa9e..3d2dd4c65 100644 --- a/src/core2/gc/gameoversign.c +++ b/src/core2/gc/gameoversign.c @@ -87,7 +87,7 @@ void gcGameOverSign_spawn(void) { void func_802DC528(NodeProp *arg0, ActorMarker *arg1){ if(D_8037DE40 == NULL){ - __spawnQueue_add_0(gcGameOverSign_spawn); + SPAWNQUEUE_ADD_0(gcGameOverSign_spawn); } } diff --git a/src/core2/gc/overlaycopyright.c b/src/core2/gc/overlaycopyright.c index 132d5f048..6052a8c50 100644 --- a/src/core2/gc/overlaycopyright.c +++ b/src/core2/gc/overlaycopyright.c @@ -42,7 +42,7 @@ void __chOverlayCopyright_spawn(void) { void chOverlayCopyright_spawn(s32 arg0, s32 arg1){ if(chOverlayCopyrightMarker == NULL){ - __spawnQueue_add_0(__chOverlayCopyright_spawn); + SPAWNQUEUE_ADD_0(__chOverlayCopyright_spawn); } } diff --git a/src/core2/gc/overlaynocontroller.c b/src/core2/gc/overlaynocontroller.c index 6a1de1668..427a53f82 100644 --- a/src/core2/gc/overlaynocontroller.c +++ b/src/core2/gc/overlaynocontroller.c @@ -85,7 +85,7 @@ void __chOverlayNoController_spawn(void){ void chOverlayNoController_spawn(s32 arg0, s32 arg1){ if(chOverlayNoController_marker == NULL){ - __spawnQueue_add_0(__chOverlayNoController_spawn); + SPAWNQUEUE_ADD_0(__chOverlayNoController_spawn); } } diff --git a/src/core2/gc/overlaypressstart.c b/src/core2/gc/overlaypressstart.c index c9b54cfd8..2e8205185 100644 --- a/src/core2/gc/overlaypressstart.c +++ b/src/core2/gc/overlaypressstart.c @@ -95,7 +95,7 @@ void __chOverlayPressStart_spawn(void){ void chOverlayPressStart_spawn(NodeProp *arg0, ActorMarker *arg1){ if(D_8037DE80 == NULL){ - __spawnQueue_add_0(__chOverlayPressStart_spawn); + SPAWNQUEUE_ADD_0(__chOverlayPressStart_spawn); } } diff --git a/src/core2/map/gsworld.c b/src/core2/map/gsworld.c index 79cdd9758..fc3325cb7 100644 --- a/src/core2/map/gsworld.c +++ b/src/core2/map/gsworld.c @@ -249,7 +249,7 @@ void gsworld_set(enum map_e map, s32 exit, bool reload) { itemPrint_init(); } dialogBin_initialize(); - spawnQueue_malloc(); + spawnQueue_init(); func_803329AC(); lensflare_init(); func_80323190(); diff --git a/src/core2/mumboshandwithpicture.c b/src/core2/mumboshandwithpicture.c index f6b66d60e..093a791bb 100644 --- a/src/core2/mumboshandwithpicture.c +++ b/src/core2/mumboshandwithpicture.c @@ -174,7 +174,7 @@ void func_802DF04C(void){ void func_802DF090(s32 arg0, s32 arg1){ if(D_8037DFE0 == NULL){ - __spawnQueue_add_0(func_802DF04C); + SPAWNQUEUE_ADD_0(func_802DF04C); } } diff --git a/src/core2/nc/camera_nodemanager.c b/src/core2/nc/camera_nodemanager.c index 8086d3afa..224eecad5 100644 --- a/src/core2/nc/camera_nodemanager.c +++ b/src/core2/nc/camera_nodemanager.c @@ -365,7 +365,7 @@ void func_802BC2CC(s32 arg0) { viewport_setPosition_vec3f(D_8037D908); viewport_setRotation_vec3f(D_8037D918); viewport_update(); - __spawnQueue_add_2((GenFunction_2)func_802BC2A0, (uintptr_t)sp24, (uintptr_t)sp20); + SPAWNQUEUE_ADD_2(func_802BC2A0, (uintptr_t)sp24, (uintptr_t)sp20); if (ncCameraType == CAMERA_TYPE_2_DYNAMIC) { func_802BE720(); if (sp1C != 0x63) { diff --git a/src/core2/quiz/game.c b/src/core2/quiz/game.c index f79a3c000..71b55c91a 100644 --- a/src/core2/quiz/game.c +++ b/src/core2/quiz/game.c @@ -873,11 +873,7 @@ void func_802D4D3C(enum actor_e arg0, enum actor_e arg1) { func_8030E6D4(SFX_1B_EXPLOSION_1); } else{ - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, - reinterpret_cast(s32, sp5C[0]), - reinterpret_cast(s32, sp5C[1]), - reinterpret_cast(s32, sp5C[2]) - ); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, sp5C[0], sp5C[1], sp5C[2]); } } } diff --git a/src/core2/sfx/soundsource.c b/src/core2/sfx/soundsource.c index 06f8c5e02..27c21a813 100644 --- a/src/core2/sfx/soundsource.c +++ b/src/core2/sfx/soundsource.c @@ -116,10 +116,5 @@ void func_802D096C(s32 arg0, s32 arg1, s32 arg2, s32 arg3){ } void func_802D09B8(Actor *this, s32 arg1){ - __spawnQueue_add_4((GenFunction_4)func_802D096C, - reinterpret_cast(s32, this->position[0]), - reinterpret_cast(s32, this->position[1]), - reinterpret_cast(s32, this->position[2]), - arg1 - ); + SPAWNQUEUE_ADD_4(func_802D096C, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2]), arg1); } diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index e96bb70bb..abf7f17f4 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -1,18 +1,14 @@ // BanjoDecomp: core2/spawnqueue.c #include -#include "core1/core1.h" #include "functions.h" #include "port/ShipUtils.h" // BK_LOG_* -#include "variables.h" +#include "core1/core1.h" +#include "core2/core2.h" #include "actor.h" #include "prop.h" -#include "functions.h" #include "core2/ch/snacker.h" #include "port/Patches/Patches.h" // GraphicsPatches_GetDrawDistanceSetting -void spawnQueue_unlock(void); -void spawnQueue_lock(void); - Actor *func_802D7558(s32 *, s32, ActorInfo*, u32); Actor *func_802D75B4(s32 *, s32, ActorInfo*, u32); Actor *func_802D7610(s32 *, s32, ActorInfo*, u32); @@ -160,26 +156,10 @@ extern ActorInfo lairBottlesDialog; extern ActorInfo D_803732E0; extern ActorInfo D_80373DC0; - -typedef struct function_queue_s{ - union { - void (* func0)(void); - void (* func1)(uintptr_t); - void (* func2)(uintptr_t, uintptr_t); - void (* func3)(uintptr_t, uintptr_t, uintptr_t); - void (* func4)(uintptr_t, uintptr_t, uintptr_t, uintptr_t); - void (* func5)(uintptr_t, uintptr_t, uintptr_t, uintptr_t, uintptr_t); - }; - uintptr_t arg[5]; - s32 arg_cnt; -}FunctionQueue; - -/* .data */ -u8 spawnQueueLock = 0; +u8 spawnQueueLock = FALSE; u8 spawnQueueLength = 0; -FunctionQueue *spawnQueue = NULL; +SpawnQueueFunction *spawnQueue = NULL; -/* .code */ // [port] N64 used 15 entries, sized for the N64's draw distance. // Scales with the Draw Distance enhancement. #define SPAWN_QUEUE_DEFAULT_SIZE 15 @@ -195,44 +175,49 @@ static u32 __spawnQueue_getMax(void) { return sSpawnQueueMax; } -void spawnQueue_malloc(void){ +void spawnQueue_init(void) { #if 0 - u32 tmp = __spawnQueue_getMax(); - spawnQueue = (FunctionQueue *) bk_malloc(tmp * sizeof(FunctionQueue)); + u32 max_length = (gsworld_getMap() == MAP_90_GL_BATTLEMENTS)? 50 : 15; + spawnQueue = (SpawnQueueFunction *) bk_malloc(max_length * sizeof(SpawnQueueFunction)); #endif u32 base = (gsworld_getMap() == MAP_90_GL_BATTLEMENTS) ? SPAWN_QUEUE_GL_SIZE : SPAWN_QUEUE_DEFAULT_SIZE; // [port] The setting, not the render-time level: this runs during a map load, where // GraphicsPatches_GetDrawDistanceLevel() clamps to 1x and would under-size the queue for the // gameplay that follows. sSpawnQueueMax = base * (u32) GraphicsPatches_GetDrawDistanceSetting(); - spawnQueue = (FunctionQueue *) bk_malloc(sSpawnQueueMax * sizeof(FunctionQueue)); + spawnQueue = (SpawnQueueFunction *) bk_malloc(sSpawnQueueMax * sizeof(SpawnQueueFunction)); } -void spawnQueue_reset(void){ - enum overlay_e loaded_asm_file = overlayManager_getLoadedID(); +void spawnQueue_reset(void) { + enum overlay_e overlay_id = overlayManager_getLoadedID(); + spawnQueue_lock(); spawnQueueLength = 0; + chmumbo_func_802D1724(); chSnacker_initialize(); - switch(loaded_asm_file){ + + switch (overlay_id) { case OVERLAY_2_WHALE: CC_func_803870E0(); break; + case OVERLAY_4_DESERT: GV_func_80387118(); break; + case OVERLAY_5_BEACH: break; + case OVERLAY_7_SWAMP: BGS_func_803885DC(); break; - default: - break; } func_80305D38(); func_803062D0(); func_80325F8C(); + spawnableActorList_new(); spawnableActorList_add(&D_80367160, actor_new, ACTOR_FLAG_NONE); //cutscene Trigger? spawnableActorList_add(&D_803675F0, actor_new, ACTOR_FLAG_UNKNOWN_6); @@ -373,64 +358,77 @@ void spawnQueue_reset(void){ spawnableActorList_addIfMapVisited(&chClucker, actor_new, ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_23 |ACTOR_FLAG_UNKNOWN_25, MAP_40_CCW_HUB); //clucker spawnableActorList_addIfMapVisited(&chScarabBeetle, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_11 | ACTOR_FLAG_UNKNOWN_25, MAP_12_GV_GOBIS_VALLEY); //scarab spawnableActorList_addIfMapVisited(&chSnowman, actor_new, ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_25, MAP_27_FP_FREEZEEZY_PEAK); //sirslush - switch(loaded_asm_file){ - default: - break; + + switch (overlay_id) { case OVERLAY_D_WITCH: - lair_func_8038A0C4(); + lair_addSpawnableActors(); break; + case OVERLAY_E_BATTLE: fight_addSpawnableActors(); break; + case OVERLAY_C_INTRO: - cutscene_func_8038C4E0(); + cutscene_addSpawnableActors(); break; + case OVERLAY_B_TRAINING: - SM_resetSpawnableActors(); + SM_addSpawnableActors(); break; + case OVERLAY_3_HAUNTED: - MMM_func_803890E0(); + MMM_addSpawnableActors(); break; + case OVERLAY_2_WHALE: - CC_func_80387DA0(); + CC_addSpawnableActors(); break; + case OVERLAY_4_DESERT: - GV_func_8038F154(); + GV_addSpawnableActors(); break; + case OVERLAY_5_BEACH: - code26D0_resetSpawnableActorsForTTC(); + TTC_addSpawnableActors(); break; + case OVERLAY_6_JUNGLE: - MM_func_803888B0(); + MM_addSpawnableActors(); break; + case OVERLAY_7_SWAMP: - bgs_updateSpawnableActors(); + BGS_addSpawnableActors(); break; + case OVERLAY_8_SHIP: - RBB_func_80386C48(); + RBB_addSpawnableActors(); break; + case OVERLAY_9_SNOW: - FP_func_80391324(); + FP_addSpawnableActors(); spawnableActorList_add(&chBluePresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&chGreenPresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&chRedPresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); break; + case OVERLAY_A_TREE: - CCW_func_8038DB6C(); + CCW_addSpawnableActors(); break; } - CALL_EVENT(OnSpawnableActorsReset, loaded_asm_file); // [port] + CALL_EVENT(OnSpawnableActorsReset, overlay_id); // [port] - if(ucode_stub3() == 0 || loaded_asm_file == 0 ){ + if (!ucode_stub3() || (overlay_id == OVERLAY_0_CORE2)) { cubeList_spawnActors(); } + func_80305990(1); func_8032A5F8(); + spawnQueue_unlock(); } -void spawnQueue_free(void){ +void spawnQueue_free(void) { spawnableActorList_free(); actorArray_free(); func_80305D94(); @@ -438,48 +436,58 @@ void spawnQueue_free(void){ spawnQueue = NULL; spawnQueueLength = 0; sSpawnQueueMax = 0; // [port] no capacity without an allocation - } -void spawnQueue_func_802C39D4(void){ +void spawnQueue_func_802C39D4(void) { func_803268B4(); - if(!levelSpecificFlags_validateCRC2()){ + +#if ANTI_TAMPER + if (!levelSpecificFlags_validateCRC2()) { eeprom_writeBlocks(0, 0, (void *)(uintptr_t) PHYS_TO_K0(0x00749530), EEPROM_MAXBLOCKS); } +#endif } -void spawnQueue_func_802C3A18(void){ +void spawnQueue_func_802C3A18(void) { func_803283BC(); } -void spawnQueue_flush(void){ - s32 i; +void spawnQueue_flush(void) { + int i; spawnQueue_lock(); - for(i = 0; i < spawnQueueLength; i++){ - switch(spawnQueue[i].arg_cnt){ + + for (i = 0; i < spawnQueueLength; i++) { + switch (spawnQueue[i].arg_count) { case 0: spawnQueue[i].func0(); break; + case 1: - spawnQueue[i].func1(spawnQueue[i].arg[0]); + spawnQueue[i].func1(spawnQueue[i].args[0]); break; + case 2: - spawnQueue[i].func2(spawnQueue[i].arg[0], spawnQueue[i].arg[1]); + spawnQueue[i].func2(spawnQueue[i].args[0], spawnQueue[i].args[1]); break; + case 3: - spawnQueue[i].func3(spawnQueue[i].arg[0], spawnQueue[i].arg[1], spawnQueue[i].arg[2]); + spawnQueue[i].func3(spawnQueue[i].args[0], spawnQueue[i].args[1], spawnQueue[i].args[2]); break; + case 4: - spawnQueue[i].func4(spawnQueue[i].arg[0], spawnQueue[i].arg[1], spawnQueue[i].arg[2], spawnQueue[i].arg[3]); + spawnQueue[i].func4(spawnQueue[i].args[0], spawnQueue[i].args[1], spawnQueue[i].args[2], spawnQueue[i].args[3]); break; + case 5: - spawnQueue[i].func5(spawnQueue[i].arg[0], spawnQueue[i].arg[1], spawnQueue[i].arg[2], spawnQueue[i].arg[3], spawnQueue[i].arg[4]); + spawnQueue[i].func5(spawnQueue[i].args[0], spawnQueue[i].args[1], spawnQueue[i].args[2], spawnQueue[i].args[3], spawnQueue[i].args[4]); break; + default: break; } } + spawnQueueLength = 0; func_803283D4(); } @@ -492,88 +500,94 @@ void spawnQueue_lock(void) { spawnQueueLock = TRUE; } -void __spawnQueue_add_0(GenFunction_0 arg0){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func0 = arg0; - spawnQueue[spawnQueueLength].arg_cnt = 0; +void spawnQueue_add_0(spawnqueue_add_0_callback_f func) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func0 = func; + spawnQueue[spawnQueueLength].arg_count = 0; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_0 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_0 entry", max_length); } } -void __spawnQueue_add_1(GenFunction_1 arg0, uintptr_t arg1){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func1 = arg0; - spawnQueue[spawnQueueLength].arg[0] = arg1; - spawnQueue[spawnQueueLength].arg_cnt = 1; +void spawnQueue_add_1(spawnqueue_add_1_callback_f func, uintptr_t arg1) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func1 = func; + spawnQueue[spawnQueueLength].args[0] = arg1; + spawnQueue[spawnQueueLength].arg_count = 1; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_1 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_1 entry", max_length); } } -void __spawnQueue_add_2(GenFunction_2 arg0, uintptr_t arg1, uintptr_t arg2){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func2 = arg0; - spawnQueue[spawnQueueLength].arg[0] = arg1; - spawnQueue[spawnQueueLength].arg[1] = arg2; - spawnQueue[spawnQueueLength].arg_cnt = 2; +void spawnQueue_add_2(spawnqueue_add_2_callback_f func, uintptr_t arg1, uintptr_t arg2) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func2 = func; + spawnQueue[spawnQueueLength].args[0] = arg1; + spawnQueue[spawnQueueLength].args[1] = arg2; + spawnQueue[spawnQueueLength].arg_count = 2; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_2 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_2 entry", max_length); } } -void __spawnQueue_add_3(GenFunction_3 arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func3 = arg0; - spawnQueue[spawnQueueLength].arg[0] = arg1; - spawnQueue[spawnQueueLength].arg[1] = arg2; - spawnQueue[spawnQueueLength].arg[2] = arg3; - spawnQueue[spawnQueueLength].arg_cnt = 3; +void spawnQueue_add_3(spawnqueue_add_3_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func3 = func; + spawnQueue[spawnQueueLength].args[0] = arg1; + spawnQueue[spawnQueueLength].args[1] = arg2; + spawnQueue[spawnQueueLength].args[2] = arg3; + spawnQueue[spawnQueueLength].arg_count = 3; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_3 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_3 entry", max_length); } } -void __spawnQueue_add_4(GenFunction_4 arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func4 = arg0; - spawnQueue[spawnQueueLength].arg[0] = arg1; - spawnQueue[spawnQueueLength].arg[1] = arg2; - spawnQueue[spawnQueueLength].arg[2] = arg3; - spawnQueue[spawnQueueLength].arg[3] = arg4; - spawnQueue[spawnQueueLength].arg_cnt = 4; +void spawnQueue_add_4(spawnqueue_add_4_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func4 = func; + spawnQueue[spawnQueueLength].args[0] = arg1; + spawnQueue[spawnQueueLength].args[1] = arg2; + spawnQueue[spawnQueueLength].args[2] = arg3; + spawnQueue[spawnQueueLength].args[3] = arg4; + spawnQueue[spawnQueueLength].arg_count = 4; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_4 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_4 entry", max_length); } } -void __spawnQueue_add_5(GenFunction_5 arg0, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5){ - u32 tmp = __spawnQueue_getMax(); - if(tmp > spawnQueueLength){ // [port] decomp used !=; < also holds if length ever exceeds tmp - spawnQueue[spawnQueueLength].func5 = arg0; - spawnQueue[spawnQueueLength].arg[0] = arg1; - spawnQueue[spawnQueueLength].arg[1] = arg2; - spawnQueue[spawnQueueLength].arg[2] = arg3; - spawnQueue[spawnQueueLength].arg[3] = arg4; - spawnQueue[spawnQueueLength].arg[4] = arg5; - spawnQueue[spawnQueueLength].arg_cnt = 5; +void spawnQueue_add_5(spawnqueue_add_5_callback_f func, uintptr_t arg1, uintptr_t arg2, uintptr_t arg3, uintptr_t arg4, uintptr_t arg5) { + u32 max_length = __spawnQueue_getMax(); + + if (max_length > spawnQueueLength) { // [port] decomp used !=; < also holds if length ever exceeds max_length + spawnQueue[spawnQueueLength].func5 = func; + spawnQueue[spawnQueueLength].args[0] = arg1; + spawnQueue[spawnQueueLength].args[1] = arg2; + spawnQueue[spawnQueueLength].args[2] = arg3; + spawnQueue[spawnQueueLength].args[3] = arg4; + spawnQueue[spawnQueueLength].args[4] = arg5; + spawnQueue[spawnQueueLength].arg_count = 5; spawnQueueLength++; } else { - BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_5 entry", tmp); + BK_LOG_DEBUG("spawnQueue FULL (%d entries): dropped add_5 entry", max_length); } } -Actor *spawnQueue_actor_f32(enum actor_e actor_id, uintptr_t x, uintptr_t y, uintptr_t z) { +Actor *spawnQueue_actor_f32(s32 actor_id, uintptr_t x, uintptr_t y, uintptr_t z) { f32 position[3]; position[0] = reinterpret_cast(f32, x); position[1] = reinterpret_cast(f32, y); @@ -602,7 +616,7 @@ Actor *spawnQueue_bundle_f32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uint position[0] = reinterpret_cast(f32, x); position[1] = reinterpret_cast(f32, y); position[2] = reinterpret_cast(f32, z); - return bundle_spawn_f32(reinterpret_cast(s32, bundle_id), position); + return bundle_spawn_f32(reinterpret_cast(enum bundle_e, bundle_id), position); } Actor *spawnQueue_bundleWithYaw_f32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z, uintptr_t yaw) { @@ -611,7 +625,7 @@ Actor *spawnQueue_bundleWithYaw_f32(uintptr_t bundle_id, uintptr_t x, uintptr_t position[1] = reinterpret_cast(f32, y); position[2] = reinterpret_cast(f32, z); bundle_setYaw(reinterpret_cast(f32, yaw)); - return bundle_spawn_f32(reinterpret_cast(s32, bundle_id), position); + return bundle_spawn_f32(reinterpret_cast(enum bundle_e, bundle_id), position); } Actor *spawnQueue_bundle_s32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z) { @@ -619,7 +633,7 @@ Actor *spawnQueue_bundle_s32(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uint position[0] = reinterpret_cast(s32, x); position[1] = reinterpret_cast(s32, y); position[2] = reinterpret_cast(s32, z); - return bundle_spawn_s32(reinterpret_cast(s32, bundle_id), position); + return bundle_spawn_s32(reinterpret_cast(enum bundle_e, bundle_id), position); } Actor *spawnQueue_bundle_s32_2(uintptr_t bundle_id, uintptr_t x, uintptr_t y, uintptr_t z) { @@ -631,8 +645,7 @@ Actor *spawnQueue_bundle_s32_2(uintptr_t bundle_id, uintptr_t x, uintptr_t y, ui } void spawnQueue_defrag(void) { - FunctionQueue *arg0 = spawnQueue; - if (arg0 != NULL) { - spawnQueue = (FunctionQueue *) defrag(spawnQueue); + if (spawnQueue) { + spawnQueue = (SpawnQueueFunction *) defrag(spawnQueue); } } diff --git a/src/core2/sprite/rendertex.c b/src/core2/sprite/rendertex.c index df54d589f..578e43040 100644 --- a/src/core2/sprite/rendertex.c +++ b/src/core2/sprite/rendertex.c @@ -85,7 +85,7 @@ void func_80347DF0(Struct81s *arg0){ } void func_80347E34(Struct81s *arg0){ - __spawnQueue_add_1((GenFunction_1) func_80347DF0, (uintptr_t)arg0); + SPAWNQUEUE_ADD_1(func_80347DF0, (uintptr_t)arg0); } void func_80347E60(Struct81s *arg0) { diff --git a/src/cutscenes/cutscenesspawnqueue.c b/src/cutscenes/cutscenesspawnqueue.c index af69cf930..f1d34cc3f 100644 --- a/src/cutscenes/cutscenesspawnqueue.c +++ b/src/cutscenes/cutscenesspawnqueue.c @@ -607,7 +607,7 @@ ActorInfo D_8038E6D4 = }; -void cutscene_func_8038C4E0(void){ +void cutscene_addSpawnableActors(void) { spawnableActorList_add(&D_8038DC90, actor_new, ACTOR_FLAG_UNKNOWN_6); spawnableActorList_add(&D_8038DCFC, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&D_8038DCD8, actor_new, ACTOR_FLAG_UNKNOWN_13); diff --git a/src/cutscenes/theendsign.c b/src/cutscenes/theendsign.c index 3b1665620..b5b30a851 100644 --- a/src/cutscenes/theendsign.c +++ b/src/cutscenes/theendsign.c @@ -49,7 +49,7 @@ void func_802DC6E4(void) { void func_802DC748(NodeProp *arg0, ActorMarker *arg1){ if(D_8037DE50 == NULL){ - __spawnQueue_add_0(func_802DC6E4); + SPAWNQUEUE_ADD_0(func_802DC6E4); } } diff --git a/src/fight/chbossjinjobase.c b/src/fight/chbossjinjobase.c index c870f8196..1c248865a 100644 --- a/src/fight/chbossjinjobase.c +++ b/src/fight/chbossjinjobase.c @@ -114,9 +114,9 @@ void chBossJinjoBase_update(Actor *this) { this->velocity_y = 100.0f; func_802BB3DC(0, 8.0f, 0.92f); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_3AD_JINJONATOR_STATUE_BASE_ACTIVATOR, *(s32*)&this->unk1C[0], *(s32*)&this->unk1C[1], *(s32*)&this->unk1C[2]); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_3AD_JINJONATOR_STATUE_BASE_ACTIVATOR, this->unk1C[0], this->unk1C[1], this->unk1C[2]); chBossJinjoBase_createSmokeParticles(this->unk1C, 0x10); - SPAWNQUEUE_ADD_1(chbossjinjobase_spawnStoneJinjo, this->marker); + SPAWNQUEUE_ADD_1(chbossjinjobase_spawnStoneJinjo, reinterpret_cast(uintptr_t, this->marker)); } else { if(this->state == CHBOSSJINJOBASE_STATE_1_RAISE) { diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index aea11de37..08c2163e3 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -377,7 +377,7 @@ void chfinalboss_func_80386F5C(ActorMarker * arg0, f32 arg1[3], f32 arg2, f32 ar D_80392758[2] = (f32) arg1[2]; D_80392768[1] = arg2; D_80392768[2] = arg3; - SPAWNQUEUE_ADD_1(chfinalboss_func_80386EC0, arg0); + SPAWNQUEUE_ADD_1(chfinalboss_func_80386EC0, reinterpret_cast(uintptr_t, arg0)); } void chfinalboss_func_80386FD8(s32 arg0) { @@ -432,10 +432,10 @@ void chfinalboss_throwObject(ActorMarker *marker, f32 arg1[3], f32 arg2, s32 arg } if (arg3 == 0) { CALL_EVENT(OnFinalBossFireballThrow, arg2); // [port] - SPAWNQUEUE_ADD_1(chfinalboss_func_80386FD8, marker); + SPAWNQUEUE_ADD_1(chfinalboss_func_80386FD8, reinterpret_cast(uintptr_t, marker)); } else{ - SPAWNQUEUE_ADD_1(chfinalboss_func_80387074, marker); + SPAWNQUEUE_ADD_1(chfinalboss_func_80387074, reinterpret_cast(uintptr_t, marker)); } } @@ -826,7 +826,7 @@ void chfinalboss_phase1_setState(Actor *this, s32 next_state) { case FINALBOSS_STATE_D_PHASE1_HIT: func_8030E878(SFX_131_GRUNTY_WEEEGH, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); if ((s32) local->hits >= 4) { - SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, this->marker); + SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, reinterpret_cast(uintptr_t, this->marker)); chfinalboss_func_80388110(this->marker, 0, 0); } break; @@ -1093,7 +1093,7 @@ void chfinalboss_phase2_setState(Actor *this, s32 arg1){ } void chfinalboss_phase2_endTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { - SPAWNQUEUE_ADD_1(chfinalboss_spawnFlightPad, marker); + SPAWNQUEUE_ADD_1(chfinalboss_spawnFlightPad, reinterpret_cast(uintptr_t, marker)); } void chfinalboss_phase2_update(ActorMarker *marker) { @@ -1214,7 +1214,7 @@ void __chfinalboss_spawnStatue(enum ch_bossjinjo_e statue_id) { } void chfinalboss_spawnStatue(s32 statue_id) { - SPAWNQUEUE_ADD_1(__chfinalboss_spawnStatue, statue_id); + SPAWNQUEUE_ADD_1(__chfinalboss_spawnStatue, reinterpret_cast(s32, statue_id)); } void __chfinalboss_spawnSpellBarrier(ActorMarker *marker) { @@ -1227,7 +1227,7 @@ void __chfinalboss_spawnSpellBarrier(ActorMarker *marker) { } void chfinalboss_spawnSpellBarrier(ActorMarker *arg0) { - SPAWNQUEUE_ADD_1(__chfinalboss_spawnSpellBarrier, arg0); + SPAWNQUEUE_ADD_1(__chfinalboss_spawnSpellBarrier, reinterpret_cast(uintptr_t, arg0)); } void chfinalboss_phase3_endTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { @@ -1275,7 +1275,7 @@ void chfinalboss_phase3_setState(Actor *this, s32 next_state) { } void chfinalboss_dropHealth(ActorMarker *marker) { - SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, marker); + SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, reinterpret_cast(uintptr_t, marker)); } void chfinalboss_phase3_update(ActorMarker *marker) { @@ -1446,7 +1446,7 @@ void chfinalboss_phase4_setState(Actor *this, s32 next_state) { case FINALBOSS_STATE_21_PHASE4_FALL: FUNC_8030E624(SFX_131_GRUNTY_WEEEGH, 1.0f, 32000); timed_playSfx(0.6f, SFX_61_CARTOONY_FALL, 1.0f, 32000); - SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, this->marker); + SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, reinterpret_cast(uintptr_t, this->marker)); FUNC_8030E624(SFX_D9_WOODEN_CRATE_BREAKING_1, 1.0f, 32000); chfinalboss_func_80386628(this->marker, 0); chfinalboss_createBroomstickParticles(this->position, ASSET_552_MODEL_BROOMSTICK_PIECE_HEAD, 1); @@ -2052,7 +2052,7 @@ void chfinalboss_collisionPassive(ActorMarker *marker, ActorMarker *other_marker local->hits++; chfinalboss_phase3_setState(this, FINALBOSS_STATE_19_PHASE3_WEEEGH); if (local->hits == 4) { - SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, this->marker); + SPAWNQUEUE_ADD_1(__chfinalboss_dropHealth, reinterpret_cast(uintptr_t, this->marker)); } } break; @@ -2123,7 +2123,7 @@ void chfinalboss_update(Actor *this){ __chFinalBossJinjoStatueMarker[i] = NULL; } - __spawnQueue_add_1((GenFunction_1) chfinalboss_spawnShadow, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(chfinalboss_spawnShadow, (uintptr_t)this->marker); chfinalboss_setPhase(this->marker, FINALBOSS_PHASE_0_INTRO); local->hits = 0; chfinalboss_func_80386600(this->marker, 0); diff --git a/src/fight/chjinjonatorbase.c b/src/fight/chjinjonatorbase.c index b0da1fe0f..52866d429 100644 --- a/src/fight/chjinjonatorbase.c +++ b/src/fight/chjinjonatorbase.c @@ -75,7 +75,7 @@ void chjinjonatorbase_spawnActivator(ActorMarker *marker) { Actor *sp24 = marker_getActor(marker); func_802BB3DC(0, 18.0f, 0.92f); - __spawnQueue_add_4((GenFunction_4) spawnQueue_actor_f32, ACTOR_3AD_JINJONATOR_STATUE_BASE_ACTIVATOR, *(u32 *)(&sp24->unk1C_x), *(u32 *)(&sp24->unk1C_y), *(u32 *)(&sp24->unk1C_z)); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_3AD_JINJONATOR_STATUE_BASE_ACTIVATOR, sp24->unk1C[0], sp24->unk1C[1], sp24->unk1C[2]); chjinjonatorbase_createSmokeParticles(sp24->unk1C, 16); } @@ -136,7 +136,7 @@ void chjinjonatorbase_update(Actor *this){ timedFunc_set_1(this->lifetime_value* 0.28, (GenFunction_1) chjinjonatorbase_spawnActivator, (uintptr_t)this->marker); timedFunc_set_1(this->lifetime_value* 0.46, (GenFunction_1) chjinjonatorbase_spawnActivator, (uintptr_t)this->marker); timedFunc_set_1(this->lifetime_value* 0.58, (GenFunction_1) chjinjonatorbase_spawnActivator, (uintptr_t)this->marker); - SPAWNQUEUE_ADD_1(chjinjonatorbase_spawnStoneJinjo, this->marker); + SPAWNQUEUE_ADD_1(chjinjonatorbase_spawnStoneJinjo, reinterpret_cast(uintptr_t, this->marker)); } else { if(this->state == CHBOSSJINJOBASE_STATE_1_RAISE) { diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index 67800d687..1ab2be553 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -117,7 +117,7 @@ void chstonejinjo_breakOpen(ActorMarker *marker) { subaddie_set_state_with_direction(actor_stonejinjo, STONEJINJO_STATE_2_BREAK_OPEN, 0.0f, 1); actor_playAnimationOnce(actor_stonejinjo); anctrl_setDuration(actor_stonejinjo->anctrl, actor_stonejinjo->unk1C[0]); - SPAWNQUEUE_ADD_1(chstonejinjo_spawnJinjo, actor_stonejinjo->marker); + SPAWNQUEUE_ADD_1(chstonejinjo_spawnJinjo, reinterpret_cast(uintptr_t, actor_stonejinjo->marker)); if (!fileProgressFlag_get(FILEPROG_D1_HAS_ACTIVATED_A_JINJO_STATUE_IN_FINAL_FIGHT) && actor_stonejinjo->actorTypeSpecificField != BOSSJINJO_5_JINJONATOR) { camera_node = 48 + actor_stonejinjo->actorTypeSpecificField * 2; diff --git a/src/fight/fight.c b/src/fight/fight.c index c22543b63..919fb4a14 100644 --- a/src/fight/fight.c +++ b/src/fight/fight.c @@ -6,8 +6,7 @@ #include "fight.h" #include "actor.h" -void fight_addSpawnableActors(void) -{ +void fight_addSpawnableActors(void) { spawnableActorList_add(&chSpellFireball, actor_new, ACTOR_FLAG_UNKNOWN_2 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15 | ACTOR_FLAG_UNKNOWN_20); spawnableActorList_add(&chGreenBlast, actor_new, ACTOR_FLAG_UNKNOWN_2 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15 | ACTOR_FLAG_UNKNOWN_20); spawnableActorList_add(&chFinalBoss, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_20 | ACTOR_FLAG_UNKNOWN_21); diff --git a/src/lair/ch/gruntling.c b/src/lair/ch/gruntling.c index ce3125ac1..0d92317d1 100644 --- a/src/lair/ch/gruntling.c +++ b/src/lair/ch/gruntling.c @@ -33,10 +33,16 @@ void chGruntling_die(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (Humanoid_Baddies_Actor *)&this->local; - subaddie_set_state_with_direction(this, 5, 0.0f, 1); + subaddie_set_state_with_direction(this, CHHUMANOIDBADDIE_STATE_5_DIE, 0.0f, 1); actor_playAnimationOnce(this); - func_8030E878(SFX_C2_GRUBLIN_EGH, local->baddieSpecific*0.1 + 0.8, 32000, this->position, 1250.0f, 2500.0f); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, reinterpret_cast(s32, this->position[0]), reinterpret_cast(s32, this->position[1]), reinterpret_cast(s32, this->position[2])); + func_8030E878( + SFX_C2_GRUBLIN_EGH, + local->baddieSpecific * 0.1 + 0.8, // 1.0, 0.9, 0.8 + 32000, + this->position, + 1250.0f, + 2500.0f); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, this->position[0], this->position[1], this->position[2]); actor_collisionOff(this); this->has_met_before = true; } diff --git a/src/lair/ff_lava_fireball.c b/src/lair/ff_lava_fireball.c index a71313ac8..fb03da93a 100644 --- a/src/lair/ff_lava_fireball.c +++ b/src/lair/ff_lava_fireball.c @@ -84,7 +84,7 @@ void func_80390D3C(Actor *this, s32 val) this->unk1C[2] = this->position_z; } - __spawnQueue_add_1((GenFunction_1)func_80390C00, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80390C00, (uintptr_t)this->marker); break; } @@ -94,7 +94,7 @@ void func_80390D3C(Actor *this, s32 val) this->unk1C[1] = this->position_y; this->unk1C[2] = this->position_z; - __spawnQueue_add_1((GenFunction_1)func_80390CB4, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80390CB4, (uintptr_t)this->marker); break; } diff --git a/src/lair/lairspawnqueue.c b/src/lair/lairspawnqueue.c index d3b446b72..66518d424 100644 --- a/src/lair/lairspawnqueue.c +++ b/src/lair/lairspawnqueue.c @@ -1121,8 +1121,7 @@ void func_80387F1C(void) if (nodeProp_findPositionFromActorId(400, tmp)) { jiggy_spawn(JIGGY_35_LAIR_CC_WITCH_SWITCH, tmp); - // FIXME: macro? - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4C_STEAM, *(s32 *)&tmp[0], *(s32 *)&tmp[1], *(s32 *)&tmp[2]); + SPAWNQUEUE_ADD_ACTOR_F32(ACTOR_4C_STEAM, tmp[0], tmp[1], tmp[2]); } } @@ -1177,7 +1176,7 @@ void func_803880BC(Actor *this) } this->unk1C[0] = 0; - __spawnQueue_add_1((GenFunction_1)func_80387E94, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_80387E94, (uintptr_t)this->marker); if (volatileFlag_get(VOLATILE_FLAG_BC_WITCH_SWITCH_PRESSED_CC) && !fileProgressFlag_get(FILEPROG_9A_CC_WITCH_SWITCH_PRESSED)) FUNC_8030E624(SFX_3F6_RUBBING, 0.75f, 30000); @@ -1907,7 +1906,7 @@ void func_8038982C(Actor *this) this->initialized = true; if (!fileProgressFlag_get(FILEPROG_9E_CRYPT_COFFIN_LID_OPEN)) - __spawnQueue_add_1((GenFunction_1)func_803897D4, (uintptr_t)this->marker); + SPAWNQUEUE_ADD_1(func_803897D4, (uintptr_t)this->marker); } } @@ -2189,8 +2188,7 @@ void func_8038A0A4(Actor *this) func_80389FA8(this, FILEPROG_CE_GRATE_TO_MMM_PUZZLE_OPEN); } -void lair_func_8038A0C4(void) -{ +void lair_addSpawnableActors(void) { spawnableActorList_add(&D_80392F40, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15 | ACTOR_FLAG_UNKNOWN_16); spawnableActorList_add(&D_80392F64, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15 | ACTOR_FLAG_UNKNOWN_16); spawnableActorList_add(&D_803932E8, actor_new, ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); diff --git a/src/port/Enhancements/Events/Hooks/Events.h b/src/port/Enhancements/Events/Hooks/Events.h index b2a80bd75..281d2e86c 100644 --- a/src/port/Enhancements/Events/Hooks/Events.h +++ b/src/port/Enhancements/Events/Hooks/Events.h @@ -268,7 +268,7 @@ typedef enum VBehaviorID { // A hit enemy dropping its bundle. // #### `result` // ```c - // sp6C != 0 + // unk_bit_7 != 0 // ``` // #### `args` // - `s32` (the enemy's actor id, promoted from `s16`) diff --git a/src/port/Network/Anchor/FightSync.c b/src/port/Network/Anchor/FightSync.c index 6bfb63c67..f982a250f 100644 --- a/src/port/Network/Anchor/FightSync.c +++ b/src/port/Network/Anchor/FightSync.c @@ -351,7 +351,7 @@ static void FightSync_CatchupTick(Actor* boss) { if (sFightNetSnap.pad && !sFightNetCatchupPadDone) { sFightNetCatchupPadDone = 1; - __spawnQueue_add_1((GenFunction_1)chfinalboss_spawnFlightPad, 0); + SPAWNQUEUE_ADD_1(chfinalboss_spawnFlightPad, 0); } if (sFightNetSnap.barrier && !sFightNetCatchupBarrierDone) { sFightNetCatchupBarrierDone = 1; @@ -483,9 +483,9 @@ void FightSync_ApplyEvent(s32 ev, s32 a, s32 b, const f32 v0[3], const f32 v1[3] D_80392778[i] = v2[i]; } if (a == 2) { - __spawnQueue_add_1((GenFunction_1)chfinalboss_func_80386EC0, 0); + SPAWNQUEUE_ADD_1(chfinalboss_func_80386EC0, 0); } else if (a == 1) { - __spawnQueue_add_1((GenFunction_1)chfinalboss_func_80387074, 0); + SPAWNQUEUE_ADD_1(chfinalboss_func_80387074, 0); } break; @@ -493,7 +493,7 @@ void FightSync_ApplyEvent(s32 ev, s32 a, s32 b, const f32 v0[3], const f32 v1[3] if (!FightSync_IsFollower()) { return; } - __spawnQueue_add_1((GenFunction_1)chfinalboss_spawnFlightPad, 0); + SPAWNQUEUE_ADD_1(chfinalboss_spawnFlightPad, 0); break; case FIGHT_EV_PAD_DESPAWN: diff --git a/src/port/Network/Anchor/Packets/CarryThrow.cpp b/src/port/Network/Anchor/Packets/CarryThrow.cpp index 8a2deab43..721cd8c31 100644 --- a/src/port/Network/Anchor/Packets/CarryThrow.cpp +++ b/src/port/Network/Anchor/Packets/CarryThrow.cpp @@ -192,7 +192,7 @@ void CarryThrow_SetCarried(u32 clientId, s32 markerId, f32 offset[3], f32 yawOff sRemoteCarry[slot].marker = NULL; sRemoteCarry[slot].throwPending = 0; setPose(slot, offset, yawOffset); - __spawnQueue_add_2(spawnMethod, markerId, clientId); + SPAWNQUEUE_ADD_2(spawnMethod, markerId, clientId); } static void remoteThrow(u32 clientId, s32 markerId, f32 start[3], f32 target[3]) { @@ -213,7 +213,7 @@ static void remoteThrow(u32 clientId, s32 markerId, f32 start[3], f32 target[3]) return; } sRemoteCarry[slot].clientId = clientId; - __spawnQueue_add_2(spawnMethod, markerId, clientId); + SPAWNQUEUE_ADD_2(spawnMethod, markerId, clientId); } sRemoteCarry[slot].markerId = markerId; sRemoteCarry[slot].throwPending = 1; diff --git a/src/port/Network/Anchor/Packets/HutSmash.cpp b/src/port/Network/Anchor/Packets/HutSmash.cpp index ce9c0b1c8..5807ad76b 100644 --- a/src/port/Network/Anchor/Packets/HutSmash.cpp +++ b/src/port/Network/Anchor/Packets/HutSmash.cpp @@ -20,7 +20,6 @@ extern enum bundle_e chBGSMudHutDrops[6]; s32 gsworld_getUnk0(); void __chhut_spawnExplosion(ActorMarker* self); void chMudHut_spawnExplosion(ActorMarker* self); -Actor* spawnQueue_bundle_f32(u32 bundle, f32 x, f32 y, f32 z); } /** @@ -66,8 +65,7 @@ static void dropRecordedBundle(Actor* hut, int32_t loot, bool fullBundle) { f32 pos[3] = { hut->position_x, hut->position_y + (mm ? 125.0f : 130.0f), hut->position_z }; u32 bits[3]; memcpy(bits, pos, sizeof(bits)); - __spawnQueue_add_4((GenFunction_4)spawnQueue_bundle_f32, mm ? kMmHutDrops[loot] : chBGSMudHutDrops[loot], bits[0], - bits[1], bits[2]); + SPAWNQUEUE_ADD_4(spawnQueue_bundle_f32, mm ? kMmHutDrops[loot] : chBGSMudHutDrops[loot], bits[0], bits[1], bits[2]); } static void replaySmash(Actor* hut, int32_t loot) { @@ -78,7 +76,7 @@ static void replaySmash(Actor* hut, int32_t loot) { subaddie_set_state(hut, HUT_STATE_1_DAMAGED); actor_playAnimationOnce(hut); if (EventSystem_Should(VB_MM_HUT_SPAWN_EXPLOSION, true, hut)) { - __spawnQueue_add_1((GenFunction_1)__chhut_spawnExplosion, (uintptr_t)hut->marker); + SPAWNQUEUE_ADD_1(__chhut_spawnExplosion, (uintptr_t)hut->marker); } bundle_setYaw(hut->yaw); } else { @@ -89,7 +87,7 @@ static void replaySmash(Actor* hut, int32_t loot) { if (loot == 5 && Anchor_InEarshot(hut->position)) { coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } - __spawnQueue_add_1((GenFunction_1)chMudHut_spawnExplosion, (uintptr_t)hut->marker); + SPAWNQUEUE_ADD_1(chMudHut_spawnExplosion, (uintptr_t)hut->marker); } dropRecordedBundle(hut, loot, true); } diff --git a/src/port/Network/Anchor/Packets/SpawnHoneycomb.cpp b/src/port/Network/Anchor/Packets/SpawnHoneycomb.cpp index fbbc21e57..ddf55ffc0 100644 --- a/src/port/Network/Anchor/Packets/SpawnHoneycomb.cpp +++ b/src/port/Network/Anchor/Packets/SpawnHoneycomb.cpp @@ -54,6 +54,6 @@ void Anchor::HandlePacket_SpawnHoneycomb(nlohmann::json& payload) { const f32 pos[3] = { payload.at("x").get(), payload.at("y").get(), payload.at("z").get() }; u32 bits[3]; memcpy(bits, pos, sizeof(bits)); - __spawnQueue_add_5(spawnDrop, (uintptr_t)honeycombId, (uintptr_t)payload.at("bundle").get(), bits[0], bits[1], - bits[2]); + SPAWNQUEUE_ADD_5(spawnDrop, (uintptr_t)honeycombId, (uintptr_t)payload.at("bundle").get(), bits[0], bits[1], + bits[2]); } diff --git a/src/port/Network/Anchor/Puzzles/TreasureTroveCove.cpp b/src/port/Network/Anchor/Puzzles/TreasureTroveCove.cpp index 6f7dd4c28..ed0964067 100644 --- a/src/port/Network/Anchor/Puzzles/TreasureTroveCove.cpp +++ b/src/port/Network/Anchor/Puzzles/TreasureTroveCove.cpp @@ -58,8 +58,8 @@ static void TreasureHuntTick() { if (chtreasureHunt_puzzleCurrentStep < 5) { chtreasureHunt_puzzleCurrentStep++; - __spawnQueue_add_0(__chTreasurehunt_spawnActorForNextStep); - __spawnQueue_add_0(__chTreasurehunt_spawnRedXForNextStep); + SPAWNQUEUE_ADD_0(__chTreasurehunt_spawnActorForNextStep); + SPAWNQUEUE_ADD_0(__chTreasurehunt_spawnRedXForNextStep); } else { chtreasureHunt_puzzleCurrentStep++; if (!jiggyscore_isSpawned(JIGGY_11_TTC_RED_X) && !jiggyscore_isCollected(JIGGY_11_TTC_RED_X)) { @@ -67,9 +67,8 @@ static void TreasureHuntTick() { sTreasurePosition[1] = sChTreasurehunt_stepPositions[5][1]; sTreasurePosition[2] = sChTreasurehunt_stepPositions[5][2]; sTreasurePosition[1] = mapModel_getFloorY(sTreasurePosition); - __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_F4_BURIED_TREASURE, - *(s32*)&sTreasurePosition[0], *(s32*)&sTreasurePosition[1], - *(s32*)&sTreasurePosition[2]); + SPAWNQUEUE_ADD_4(spawnQueue_actor_f32, ACTOR_F4_BURIED_TREASURE, *(s32*)&sTreasurePosition[0], + *(s32*)&sTreasurePosition[1], *(s32*)&sTreasurePosition[2]); } } } diff --git a/src/port/Rando/CustomObject/CustomObject.cpp b/src/port/Rando/CustomObject/CustomObject.cpp index 4ae59ef57..4cc988721 100644 --- a/src/port/Rando/CustomObject/CustomObject.cpp +++ b/src/port/Rando/CustomObject/CustomObject.cpp @@ -319,8 +319,8 @@ void CustomObject::ResolveCustomActorCollisionEX(RandoCheckId randoCheckId) { Rando::StaticData::Checks[shuffledObject.shuffledCheckId].worldId); if (jiggyCheckId != RC_UNKNOWN) { - __spawnQueue_add_4((GenFunction_4)SpawnJinjoJiggy, jiggyCheckId, (uintptr_t)spawnPosition[0], - (uintptr_t)spawnPosition[1], (uintptr_t)spawnPosition[2]); + SPAWNQUEUE_ADD_4(SpawnJinjoJiggy, jiggyCheckId, (uintptr_t)spawnPosition[0], + (uintptr_t)spawnPosition[1], (uintptr_t)spawnPosition[2]); } } } diff --git a/src/port/Romhack/RomhackRegistration.cpp b/src/port/Romhack/RomhackRegistration.cpp index d552c55d5..6dba4c11f 100644 --- a/src/port/Romhack/RomhackRegistration.cpp +++ b/src/port/Romhack/RomhackRegistration.cpp @@ -55,7 +55,7 @@ constexpr RomhackPort kRomhackPorts[] = { // spawnQueue_reset's case for the snow overlay. void AddSnowSpawnableActors() { - FP_func_80391324(); + FP_addSpawnableActors(); spawnableActorList_add(&chBluePresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&chGreenPresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); spawnableActorList_add(&chRedPresentCollectible, actor_new, ACTOR_FLAG_UNKNOWN_3); @@ -67,13 +67,13 @@ struct OverlaySpawnList { }; constexpr OverlaySpawnList kOverlaySpawnLists[] = { - { OVERLAY_D_WITCH, lair_func_8038A0C4 }, { OVERLAY_E_BATTLE, fight_addSpawnableActors }, - { OVERLAY_C_INTRO, cutscene_func_8038C4E0 }, { OVERLAY_B_TRAINING, SM_resetSpawnableActors }, - { OVERLAY_3_HAUNTED, MMM_func_803890E0 }, { OVERLAY_2_WHALE, CC_func_80387DA0 }, - { OVERLAY_4_DESERT, GV_func_8038F154 }, { OVERLAY_5_BEACH, code26D0_resetSpawnableActorsForTTC }, - { OVERLAY_6_JUNGLE, MM_func_803888B0 }, { OVERLAY_7_SWAMP, bgs_updateSpawnableActors }, - { OVERLAY_8_SHIP, RBB_func_80386C48 }, { OVERLAY_9_SNOW, AddSnowSpawnableActors }, - { OVERLAY_A_TREE, CCW_func_8038DB6C }, + { OVERLAY_D_WITCH, lair_addSpawnableActors }, { OVERLAY_E_BATTLE, fight_addSpawnableActors }, + { OVERLAY_C_INTRO, cutscene_addSpawnableActors }, { OVERLAY_B_TRAINING, SM_addSpawnableActors }, + { OVERLAY_3_HAUNTED, MMM_addSpawnableActors }, { OVERLAY_2_WHALE, CC_addSpawnableActors }, + { OVERLAY_4_DESERT, GV_addSpawnableActors }, { OVERLAY_5_BEACH, TTC_addSpawnableActors }, + { OVERLAY_6_JUNGLE, MM_addSpawnableActors }, { OVERLAY_7_SWAMP, BGS_addSpawnableActors }, + { OVERLAY_8_SHIP, RBB_addSpawnableActors }, { OVERLAY_9_SNOW, AddSnowSpawnableActors }, + { OVERLAY_A_TREE, CCW_addSpawnableActors }, }; // Romhacks globalize the overlays: any actor can spawn on any map, so every overlay's actors join the spawnable list.