diff --git a/include/core1/core1.h b/include/core1/core1.h index 5fb6b7b6..2d9d7277 100644 --- a/include/core1/core1.h +++ b/include/core1/core1.h @@ -20,12 +20,52 @@ #include "core1/viewport.h" #include "core1/vimgr.h" + +/* need to sort out in individual header files */ + void mlMtx_apply_vec3f(f32[3], f32[3]); void func_80252C08(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]); void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]); f32 ml_cos_deg(f32); f32 ml_sin_deg(f32); +void func_80250530(s32 arg0, u16 chan_mask, f32 arg2); +int func_802585E0(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ); + +void func_8025A104(enum comusic_e arg0, s32 arg1); +void func_8025A55C(s32 arg0, s32 arg1, s32 arg2); +s32 func_8025A864(enum comusic_e track_id); +void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3); +int func_8025AD7C(enum comusic_e arg0); +int func_8025ADBC(enum comusic_e arg0); + + +/* src/core1/code_7090.c */ + +void core1_7090_alloc(void); +void core1_7090_release(void); +void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volume); +void core1_7090_freeSfxSource(int idx); + + +/* src/core1/code_CE60.c */ + +void core1_ce60_setChanMask(s32 chan_mask); +void core1_ce60_setChanMaskWithValue(s32 chan_mask, f32 arg1); +bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance); +f32 core1_ce60_getPlayerDistance(f32 x, f32 z); +bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx); +void core1_ce60_func_8024A9EC(s32 arg0); +void core1_ce60_func_8024AAB0(void); +void core1_ce60_func_8024ADF0(bool arg0); +void core1_ce60_func_8024AE74(void); +void core1_ce60_resetState(void); +void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface); +void core1_ce60_func_8024AF48(void); +void core1_ce60_incOrDecCounter(bool increment); +void core1_ce60_func_8024BD40(s32 arg0, s32 arg1); + + /* src/core1/depthbuffer.c */ diff --git a/include/core2/core2.h b/include/core2/core2.h index 7fe1faca..d97b2744 100644 --- a/include/core2/core2.h +++ b/include/core2/core2.h @@ -12,4 +12,7 @@ void func_8035179C_copyPosition(Struct68s* arg0, f32 arg1[3]); void func_80351814(Struct68s *arg0, f32 arg1[3]); f32 func_80351830(Struct68s *arg0); + +extern void sfxsource_setSampleRate(u8, s32); + #endif diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index d90bddcc..3c65d117 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -84,7 +84,7 @@ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){ func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } } diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index e39ab5d4..51460355 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -201,7 +201,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ case 0xc29://L80388DC4 func_8025A6EC(COMUSIC_3A_FP_BOGGY_RACE, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_802BE720(); local->unk0 = partEmitMgr_newEmitter(16); local->unk4 = partEmitMgr_newEmitter(16); diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index c3da8851..3ce1b78e 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -199,7 +199,7 @@ void func_8038D3D8(void){ comusic_8025AB44(COMUSIC_68_TWINKLY_MINIGAME, 0, 4000); func_8025AABC(COMUSIC_68_TWINKLY_MINIGAME); func_8025A58C(-1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8038D41C(ActorMarker *marker){ @@ -265,7 +265,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){ this->unk1C[1] = 0.0f; func_8025A6EC(COMUSIC_68_TWINKLY_MINIGAME, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); this->unk1C[2] = 428571.0f; func_8025AEA0(0x68, (s32)this->unk1C[2]); subaddie_set_state_with_direction(this, 3, 0.001f, 1); diff --git a/src/FP/racectrl.c b/src/FP/racectrl.c index 8f917310..3c7875c4 100644 --- a/src/FP/racectrl.c +++ b/src/FP/racectrl.c @@ -69,7 +69,7 @@ void func_8038ABDC(void){ comusic_8025AB44(COMUSIC_3A_FP_BOGGY_RACE, 0, 4000); func_8025AABC(COMUSIC_3A_FP_BOGGY_RACE); func_8025A58C(-1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8038AC20(s32 gate_indx, s32 arg1){ diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index c57cab94..a54c37aa 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); typedef struct { f32 unk0[3]; @@ -75,13 +75,13 @@ void func_80386620(Actor *this){ } void func_8038678C(void){ - func_80244BB0(3, 0x85, 0x7ff8, 1.0f); - func_80244BB0(4, 0x85, 0x7ff8, 1.0f); + core1_7090_initSfxSource(3, 0x85, 0x7ff8, 1.0f); + core1_7090_initSfxSource(4, 0x85, 0x7ff8, 1.0f); } void func_803867CC(void){ - func_80244C78(3); - func_80244C78(4); + core1_7090_freeSfxSource(3); + core1_7090_freeSfxSource(4); } void func_803867F4(void){ @@ -167,7 +167,7 @@ void chAncientOne_update(Actor *this){ if(this->unkF4_8 < 5){ D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE; func_802BAFE4(GV_D_80390C20[this->unkF4_8 - 1]); - func_80244BB0(2, 0x86, 0x7ff8, 0.3f); + core1_7090_initSfxSource(2, 0x86, 0x7ff8, 0.3f); timedFunc_set_0(0.45f, func_8038678C); }//L80386DB0 @@ -190,7 +190,7 @@ void chAncientOne_update(Actor *this){ }//L80386D80 } if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){ - func_80244C78(2); + core1_7090_freeSfxSource(2); timedFunc_set_0(0.5f, func_803867CC); } }//L80386DB0 diff --git a/src/GV/code_7FF0.c b/src/GV/code_7FF0.c index f6a6403e..0be0329d 100644 --- a/src/GV/code_7FF0.c +++ b/src/GV/code_7FF0.c @@ -4,7 +4,7 @@ #include "variables.h" #include "actor.h" -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); extern void func_802D3D54(Actor *this); extern void func_802D3D74(Actor *this); extern Actor *func_80325F2C(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); @@ -231,7 +231,7 @@ void func_8038E648(Actor *this){ func_802BAFE4(2); subaddie_set_state(this, 6); this->unk38_31 = 600; - func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f); func_802D68F0(25); item_set(ITEM_6_HOURGLASS, 1); } @@ -243,7 +243,7 @@ void func_8038E648(Actor *this){ subaddie_set_state(this, 7); this->pitch = 90.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(0); + core1_7090_freeSfxSource(0); } break; @@ -251,7 +251,7 @@ void func_8038E648(Actor *this){ this->unk38_31 -= time_getDelta(); if(this->unk38_31 == 0){ subaddie_set_state(this, 8); - func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f); } break; @@ -262,7 +262,7 @@ void func_8038E648(Actor *this){ this->pitch = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(5, FALSE); - func_80244C78(0); + core1_7090_freeSfxSource(0); volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED); } break; @@ -296,7 +296,7 @@ void func_8038E97C(Actor *this){ this->position_y += 130.0; this->unk38_31 = 30; subaddie_set_state(this, 8); - func_80244BB0(1, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6A, 0x7ff8, 0.3f); } }//L8038EA6C @@ -314,7 +314,7 @@ void func_8038E97C(Actor *this){ this->unk38_31 -= 1; if(this->unk38_31 == 0){ subaddie_set_state(this, 1); - func_80244C78(1); + core1_7090_freeSfxSource(1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); } @@ -330,7 +330,7 @@ void chKazooieDoor_update(Actor *this){ func_8025A6EC(COMUSIC_2B_DING_B, -1); func_802BAFE4(3); subaddie_set_state(this, 6); - func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f); this->unk1C[1] = this->position_y + 210.0f; this->unk1C[0] = this->position_y; } @@ -342,7 +342,7 @@ void chKazooieDoor_update(Actor *this){ if(this->unk1C[1] <= this->position_y){ subaddie_set_state(this, 7); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(1); + core1_7090_freeSfxSource(1); this->unk38_31 = 450; } break; @@ -351,7 +351,7 @@ void chKazooieDoor_update(Actor *this){ this->unk38_31--; if(this->unk38_31 == 0){ subaddie_set_state(this, 8); - func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f); } break; @@ -362,7 +362,7 @@ void chKazooieDoor_update(Actor *this){ this->position_y = this->unk1C[0]; subaddie_set_state(this, 1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(1); + core1_7090_freeSfxSource(1); mapSpecificFlags_set(6, FALSE); } break; diff --git a/src/MM/ch/chimpystump.c b/src/MM/ch/chimpystump.c index 7266e0d2..8e6ba542 100644 --- a/src/MM/ch/chimpystump.c +++ b/src/MM/ch/chimpystump.c @@ -8,7 +8,7 @@ /* external function declarations */ void func_80353064(f32 *, f32); void func_802BB3DC(s32, f32, f32); -void func_80244BB0(s32, s32, s32, f32); +void core1_7090_initSfxSource(s32, s32, s32, f32); /* public function declarations */ void chchimpystump_update(Actor *this); @@ -33,7 +33,7 @@ void __chchimpystump_updateShaking(Actor *this) { if (this->unk10_12 == 0) { this->unk10_12 = 1; func_802BB3DC(1, 3.0f, 1.0f); - func_80244BB0(0, 0x6A, 0x7FF8, 0.2f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.2f); }//L80386D0C this->position_x = ((globalTimer_getTime() & 1) * 2) ^ (s32) this->position_x; @@ -67,7 +67,7 @@ void chchimpystump_update(Actor *this) { this->position_y = this->actor_specific_1_f; subaddie_set_state(this, CHIMPY_STUMP_STATE_3_RAISED); func_802BB41C(1); - func_80244C78(0); + core1_7090_freeSfxSource(0); } if ((globalTimer_getTime() & 3) == 2) { diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index 642a84c3..b57abd13 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -33,7 +33,7 @@ extern ActorInfo D_8038BEFC; extern ActorInfo D_80367E70; extern ActorInfo D_80372C3C; -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); extern void func_8025AE0C(s32, f32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void *func_80309B48(f32[3], f32[3], f32[3], u32); @@ -307,7 +307,7 @@ void func_80388BDC(Actor *this) { if(mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN)) { func_802BAFE4(0x21); subaddie_set_state(this, 6); - func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_2_UNKNOWN, FALSE); func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1); func_8025AE0C(2000, 3.0f); @@ -320,7 +320,7 @@ void func_80388BDC(Actor *this) { subaddie_set_state(this, 7U); this->yaw = 270.0f; func_8030E540(0x7F); - func_80244C78(0); + core1_7090_freeSfxSource(0); func_802D68F0(0xE); item_set(6, 1); } @@ -341,7 +341,7 @@ void func_80388BDC(Actor *this) { func_802BAFE4(0x23); } subaddie_set_state(this, 8); - func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); } break; case 8: @@ -351,7 +351,7 @@ void func_80388BDC(Actor *this) { this->yaw = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_0_UNKNOWN, FALSE); - func_80244C78(0); + core1_7090_freeSfxSource(0); if (!this->unk38_31) { func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); func_8025AE0C(0x7D0, 2.5f); diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index ec5c51ab..e0100939 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -213,13 +213,13 @@ static void __chNipper_updateFunc(Actor *this){ if(0.0f == this->velocity_x && xVelocity){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 5000); func_8032BB88(this, 0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } else if(!xVelocity && 0.0f != this->velocity_x){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300); func_8025AABC(COMUSIC_12_TTC_NIPPER); func_8032BB88(this, -1, 300); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } this->velocity_x = xVelocity; } diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index 1d700a20..6447b8bf 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -24,7 +24,6 @@ u8 func_8025F4A0(ALCSPlayer *, u8); void func_8025F3F0(ALCSPlayer *, f32, f32); u16 func_80250474(s32 arg0); -void func_8024AF48(void); void func_8024FB8C(void); /* .data */ @@ -603,7 +602,7 @@ u16 func_80250474(s32 arg0){ D_80282110[i].unk10 = -1.0f; } osSetIntMask(sp1C); - func_8024AF48(); + core1_ce60_func_8024AF48(); if(D_802762C0 == -1){ D_802762C0 = 0xFFFF; } diff --git a/src/core1/code_7090.c b/src/core1/code_7090.c index 96420e52..d0208dd8 100644 --- a/src/core1/code_7090.c +++ b/src/core1/code_7090.c @@ -3,69 +3,60 @@ #include "functions.h" #include "variables.h" -extern void sfxsource_setSampleRate(u8, s32); -extern void func_8030E2C4(u8); +s16 *D_802758E0 = NULL; - -typedef struct struct_27_s{ - s16 unk0; - u8 pad2[0x12]; -}struct27s; - -s16 * D_802758E0 = NULL; - -void func_80244C78(int arg0); - -/* .code */ -void func_80244AB0(void){ +void core1_7090_alloc(void) { int i; - if(D_802758E0) + + if (D_802758E0) return; - D_802758E0 = (struct16s *) malloc(10*sizeof(s16)); - for(i = 0; i < 10; i++){ + D_802758E0 = (s16 *) malloc(10 * sizeof(s16)); + + for (i = 0; i < 10; i++) { D_802758E0[i] = 0; } } -void func_80244B3C(void){ +void core1_7090_release(void) { int i; - if(!D_802758E0) + if (!D_802758E0) return; - for(i = 0; i < 10; i++){ - if(D_802758E0[i]) - func_8030E394((u8)D_802758E0[i]); + for (i = 0; i < 10; i++) { + if (D_802758E0[i]) + func_8030E394(D_802758E0[i]); } + free(D_802758E0); D_802758E0 = NULL; - } -void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){ - s32 i; - u8 indx; - if(func_8030ED70(lookup_getSfxId(arg1))){ - i = sfxsource_createSfxsourceAndReturnIndex(); - indx = i; - if(i){ - sfxsource_setSfxId(indx, lookup_getSfxId(arg1)); - sfxsource_playSfxAtVolume(indx, arg3); - sfxsource_setSampleRate(indx, arg2); - func_8030E2C4(indx); - func_80244C78(arg0); - D_802758E0[arg0] = indx; +void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volume) { + u8 sfx_source_index; + + if (func_8030ED70(lookup_getSfxId(lookup_idx))) { + sfx_source_index = sfxsource_createSfxsourceAndReturnIndex(); + + if (sfx_source_index) { + sfxsource_setSfxId(sfx_source_index, lookup_getSfxId(lookup_idx)); + sfxsource_playSfxAtVolume(sfx_source_index, volume); + sfxsource_setSampleRate(sfx_source_index, sample_rate); + func_8030E2C4(sfx_source_index); + core1_7090_freeSfxSource(idx); + D_802758E0[idx] = sfx_source_index; } } - else{ - func_8030E6A4(lookup_getSfxId(arg1), arg3, arg2); + else { + func_8030E6A4(lookup_getSfxId(lookup_idx), volume, sample_rate); } } -void func_80244C78(int arg0){ - if(D_802758E0[arg0]){ - func_8030DA44(D_802758E0[arg0]); +void core1_7090_freeSfxSource(int idx) { + if (D_802758E0[idx]) { + func_8030DA44(D_802758E0[idx]); } - D_802758E0[arg0] = 0; + + D_802758E0[idx] = 0; } diff --git a/src/core1/code_CE60.c b/src/core1/code_CE60.c index 43a5fa26..5a0c698a 100644 --- a/src/core1/code_CE60.c +++ b/src/core1/code_CE60.c @@ -3,536 +3,512 @@ #include "functions.h" #include "variables.h" -typedef struct { +typedef struct bounding_box_s { s16 x_min; s16 x_max; s16 y_min; s16 y_max; s16 z_min; s16 z_max; -} Struct_Core1_CE60_0s; +} BoundingBox; -void func_80250530(s32, u16 chan_mask, f32); - -/* .data */ -s32 D_80275C10 = -1; -s32 D_80275C14 = 0; -u8 D_80275C18 = 0; -u8 D_80275C1C = 0; -Struct_Core1_CE60_0s D_80275C20[] = { - {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34}, - {0xF95C, 0xFE73, 0xDCD8, 0x2328, 0xE69C, 0xF711}, - {0xFA83, 0xFFAB, 0xDCD8, 0x2328, 0xE886, 0xEFFB}, - {0xEA84, 0xF85B, 0xDCD8, 0x2328, 0xF830, 0xFD90}, - {0xFEC0, 0x0140, 0x05DC, 0x0960, 0xE890, 0xFE7B}, - {0xFD44, 0x05D8, 0xFD44, 0x06C2, 0xFC2E, 0x03D2}, - {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34} +static s32 D_80275C10 = -1; +static s32 D_80275C14 = 0; +static u8 D_80275C18 = FALSE; +static u8 D_80275C1C = FALSE; +static BoundingBox sBoundingBoxes[] = { + { -6000, -1580, -9000, 9000, -6200, -1228 }, + { -1700, -397, -9000, 9000, -6500, -2287 }, + { -1405, -85, -9000, 9000, -6010, -4101 }, + { -5500, -1957, -9000, 9000, -2000, -624 }, + { -320, 320, 1500, 2400, -6000, -389 }, + { -700, 1496, -700, 1730, -978, 978 }, + { -6000, -1580, -9000, 9000, -6200, -1228 } }; -/* .bss */ -s32 D_802806F0; -int D_802806F4; -s32 D_802806F8[4]; -s32 D_80280708[4]; +static s32 sUnusedCounter; // is only incremented and decremented, but not used +static bool D_802806F4; +static s32 sPlayerPosition[4]; +static enum comusic_e sTrackId[4]; - -/* .code */ -void func_8024A880(s32 chan_mask){ +void core1_ce60_setChanMask(s32 chan_mask) { func_80250530(0, chan_mask, 3.0f); } -void func_8024A8AC(s32 chan_mask, f32 arg1){ - func_80250530(0, chan_mask, arg1); +void core1_ce60_setChanMaskWithValue(s32 chan_mask, f32 value) { + func_80250530(0, chan_mask, value); } -int func_8024A8DC(s32 arg0, s32 arg1, s32 arg2){ - return (arg0 - D_802806F8[0])*(arg0 - D_802806F8[0]) + (arg1 - D_802806F8[2])*(arg1 - D_802806F8[2]) < arg2*arg2; +bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance) { + return (x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2]) < distance * distance; } -f32 func_8024A928(f32 arg0, f32 arg1){ - return gu_sqrtf((arg0 - D_802806F8[0])*(arg0 - D_802806F8[0]) + (arg1 - D_802806F8[2])*(arg1 - D_802806F8[2])); +f32 core1_ce60_getPlayerDistance(f32 x, f32 z) { + return gu_sqrtf((x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2])); } -int func_8024A984(s32 arg0){ - func_802585E0(D_802806F8, D_80275C20[arg0].x_min, D_80275C20[arg0].y_min, D_80275C20[arg0].z_min, D_80275C20[arg0].x_max, D_80275C20[arg0].y_max, D_80275C20[arg0].z_max); +bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx) { + return func_802585E0(sPlayerPosition, + sBoundingBoxes[box_idx].x_min, sBoundingBoxes[box_idx].y_min, sBoundingBoxes[box_idx].z_min, + sBoundingBoxes[box_idx].x_max, sBoundingBoxes[box_idx].y_max, sBoundingBoxes[box_idx].z_max + ); } -void func_8024A9EC(s32 arg0){ - if(!func_8025ADBC(D_80280708[0]) && D_80280708[2]){ - func_8025A104(D_80280708[0], 0); +void core1_ce60_func_8024A9EC(s32 arg0) { + if (!func_8025ADBC(sTrackId[0]) && sTrackId[2]) { + func_8025A104(sTrackId[0], 0); } - func_8025A55C(D_80280708[2], arg0 ? arg0 : 0x1f4, 4 ); - if(func_8025AD7C(D_80280708[1]) || D_80280708[3]){ - func_8025ABB8(D_80280708[1], D_80280708[3], arg0 ? arg0 : 0x1f4, 4 ); - }//L8024AA94 - func_8025A864(D_80280708[1]); + + func_8025A55C(sTrackId[2], arg0 ? arg0 : 0x1f4, 4); + + if (func_8025AD7C(sTrackId[1]) || sTrackId[3]) { + func_8025ABB8(sTrackId[1], sTrackId[3], arg0 ? arg0 : 0x1f4, 4 ); + } + + func_8025A864(sTrackId[1]); } -void func_8024AAB0(void){ - f32 plyr_pos[3]; //sp34 - f32 sp30; +void core1_ce60_func_8024AAB0(void) { + f32 player_position[3]; + f32 player_distance; - player_getPosition_s32(&D_802806F8); - player_getPosition(plyr_pos); - D_80280708[0] = func_8032274C(); - D_80280708[1] = func_80322758(); - D_80280708[2] = D_80280708[3] = 0; - if(0 <= D_80280708[0]) - D_80280708[2] = func_80250034(D_80280708[0]); - if(0 <= D_80280708[1]) - D_80280708[3] = func_80250034(D_80280708[1]); - switch(map_get()){ - case MAP_7_TTC_TREASURE_TROVE_COVE: //L8024ABA8 - D_80280708[2] = ml_map_f(4700 - D_802806F8[1], 0.0f, 900.0f, 0.0f, D_80280708[2]); - D_80280708[3] = ml_map_f(4700 - D_802806F8[1], 0.0f, 900.0f, D_80280708[3], 0.0f); + player_getPosition_s32(sPlayerPosition); + player_getPosition(player_position); + + sTrackId[0] = func_8032274C(); + sTrackId[1] = func_80322758(); + sTrackId[2] = sTrackId[3] = COMUSIC_0_DING_A; + + if (0 <= sTrackId[0]) + sTrackId[2] = func_80250034(sTrackId[0]); + + if (0 <= sTrackId[1]) + sTrackId[3] = func_80250034(sTrackId[1]); + + switch (map_get()) { + case MAP_7_TTC_TREASURE_TROVE_COVE: + sTrackId[2] = ml_map_f(4700 - sPlayerPosition[1], 0.0f, 900.0f, 0.0f, sTrackId[2]); + sTrackId[3] = ml_map_f(4700 - sPlayerPosition[1], 0.0f, 900.0f, sTrackId[3], 0.0f); break; - case MAP_B_CC_CLANKERS_CAVERN: // - sp30 = func_8024A928(13909.0f, -26.0f); - D_80280708[2] = ml_map_f(sp30, 1500.0f, 1800.0f, 0.0f, D_80280708[2]); - D_80280708[3] = ml_map_f(sp30, 1500.0f, 1800.0f, D_80280708[3], 0.0f); + + case MAP_B_CC_CLANKERS_CAVERN: + player_distance = core1_ce60_getPlayerDistance(13909.0f, -26.0f); + sTrackId[2] = ml_map_f(player_distance, 1500.0f, 1800.0f, 0.0f, sTrackId[2]); + sTrackId[3] = ml_map_f(player_distance, 1500.0f, 1800.0f, sTrackId[3], 0.0f); break; - case MAP_1_SM_SPIRAL_MOUNTAIN: //L8024ACC4 - if(func_8024A984(4)) - D_80280708[2] = 0; - else - D_80280708[3] = 0; - break; - case MAP_1B_MMM_MAD_MONSTER_MANSION: //L8024ACE4 - if(func_80309D58(plyr_pos, 1)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1_SM_SPIRAL_MOUNTAIN: + if (core1_ce60_isPlayerInsideBoundingBox(4)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_41_FP_BOGGYS_IGLOO: //L8024AD08 - if( jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) - || (levelSpecificFlags_get(LEVEL_FLAG_11_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_12_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_13_FP_UNKNOWN)) - ){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1B_MMM_MAD_MONSTER_MANSION: + if (func_80309D58(player_position, 1)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_1D_MMM_CELLAR: //L8024AD58 - if(sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && D_802806F8[0] >= 0x23A){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_41_FP_BOGGYS_IGLOO: + if (jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) || + (levelSpecificFlags_get(LEVEL_FLAG_11_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_12_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_13_FP_UNKNOWN))) + { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_7F_FP_WOZZAS_CAVE: //L8024AD8C - if(sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && func_8024A8DC(0x619, 0x97a, 0x69a)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1D_MMM_CELLAR: + if (sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && sPlayerPosition[0] >= 0x23A) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_45_CCW_AUTUMN: //L8024ADC0 - case MAP_46_CCW_WINTER: //L8024ADC0 - if(func_8024A984(5)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_7F_FP_WOZZAS_CAVE: + if (sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(0x619, 0x97a, 0x69a)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - }//L8024ADE0 + + case MAP_45_CCW_AUTUMN: + case MAP_46_CCW_WINTER: + if (core1_ce60_isPlayerInsideBoundingBox(5)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; + } + break; + } } -void func_8024ADF0(s32 arg0){ - func_8024AAB0(); - if(arg0) +void core1_ce60_func_8024ADF0(bool arg0) { + core1_ce60_func_8024AAB0(); + + if (arg0) func_8025A9D4(); - if(0 < D_80280708[0] && 0 < D_80280708[2]) - func_8025A104(D_80280708[0], D_80280708[2]); + if (0 < sTrackId[0] && 0 < sTrackId[2]) + func_8025A104(sTrackId[0], sTrackId[2]); - if(0 < D_80280708[1] && 0 < D_80280708[3]) - func_8025A6CC(D_80280708[1], D_80280708[3]); + if (0 < sTrackId[1] && 0 < sTrackId[3]) + func_8025A6CC(sTrackId[1], sTrackId[3]); } -void func_8024AE74(void){ - D_802806F0 = 0; +void core1_ce60_func_8024AE74(void) { + sUnusedCounter = 0; D_80275C10 = -1; D_80275C14 = 0; - D_80275C1C = D_80275C18 = func_8024A8DC(0xb43, -0x2918, 0x1950) ? 1 : 0; + D_80275C1C = D_80275C18 = core1_ce60_isPlayerInRange(2883, -10520, 6480) ? TRUE : FALSE; } -void func_8024AED8(void){ +void core1_ce60_resetState(void) { D_80275C10 = -1; D_80275C14 = 0; - D_80275C18 = 0; - D_80275C1C = 0; + D_80275C18 = FALSE; + D_80275C1C = FALSE; } -void func_8024AF00(s32 arg0, s32 arg1){ - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(arg0); - } - else{ - func_8024A880(arg1); +void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface) { + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(chan_mask_underwater); + } else { + core1_ce60_setChanMask(chan_mask_surface); } } -void func_8024AF48(void){ - - if(!D_802806F4) return; - if(volatileFlag_get(VOLATILE_FLAG_1)) return; - if(volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) return; - if(func_802D686C()) return; - if(player_isDead()) return; - if(gctransition_8030BDC0()) return; - if(getGameMode() == GAME_MODE_A_SNS_PICTURE) return; +void core1_ce60_func_8024AF48(void) { + if (!D_802806F4 || + volatileFlag_get(VOLATILE_FLAG_1) || + volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE) || + func_802D686C() || + player_isDead() || + gctransition_8030BDC0() || + getGameMode() == GAME_MODE_A_SNS_PICTURE) + { + return; + } + + player_getPosition_s32(sPlayerPosition); + core1_ce60_func_8024AAB0(); - player_getPosition_s32(D_802806F8); - func_8024AAB0(); switch(map_get()){ - case MAP_2_MM_MUMBOS_MOUNTAIN: // L8024B000 - if(func_8024A8DC(-4450, 4550, 1900) ||func_8024A8DC(-0x1777, 0x1820, 0x26c)){ - func_8024A880(0x1cc0); - } - else if(func_8024A8DC(0x119F, -0x760, 0x7d0)){ - func_8024A880(0xb0c0); - } - else if(func_8024A8DC(0x12c, -0x35a, 0x898)){ - func_8024A880(0x513f); - } - else{ - func_8024AF00(0x200, 0x103f); + case MAP_2_MM_MUMBOS_MOUNTAIN: + if (core1_ce60_isPlayerInRange(-4450, 4550, 1900) || core1_ce60_isPlayerInRange(-6007, 6176, 620)) { + core1_ce60_setChanMask(0x1cc0); + } else if (core1_ce60_isPlayerInRange(4511, -1888, 2000)) { + core1_ce60_setChanMask(0xb0c0); + } else if (core1_ce60_isPlayerInRange(300, -858, 2200)) { + core1_ce60_setChanMask(0x513f); + } else { + core1_ce60_setChanMaskFromWaterState(0x200, 0x103f); } break; - case MAP_7_TTC_TREASURE_TROVE_COVE: // L8024B094 - func_8024A9EC(0); - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x600); - } - else if(func_8024A8DC(-0x12C, 0x58c, 0x866) - || (func_8024A8DC(-0x12c, 0x58c, 0xc1c) - && D_802806F8[1] < 0x514 - && !func_8024A8DC(-0x49, 0x2c43, 0x1c0c) - && !func_8024A8DC(0x6c8, 0xe04, 0x1c7) - && !func_8024A8DC(0x564, 0xf9a, 0x190) - ) - ){ - func_8024A880(0x7800); - } - else{ - func_8024A880(0x60ff); + case MAP_7_TTC_TREASURE_TROVE_COVE: + core1_ce60_func_8024A9EC(0); + + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x600); + } else if (core1_ce60_isPlayerInRange(-300, 1420, 2150) || + (core1_ce60_isPlayerInRange(-300, 1420, 3100) && + sPlayerPosition[1] < 1300 && + !core1_ce60_isPlayerInRange(-73, 11331, 7180) && + !core1_ce60_isPlayerInRange(1736, 3588, 455) && + !core1_ce60_isPlayerInRange(1380, 3994, 400))) + { + core1_ce60_setChanMask(0x7800); + } else { + core1_ce60_setChanMask(0x60ff); } break; - case MAP_B_CC_CLANKERS_CAVERN: // L8024B158 - func_8024A9EC(0); - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - if(!(D_802806F8[1] < 0x28b)){ - func_8024A8AC(0x8180, 5.0f); + case MAP_B_CC_CLANKERS_CAVERN: + core1_ce60_func_8024A9EC(0); + + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + if(!(sPlayerPosition[1] < 651)) { + core1_ce60_setChanMaskWithValue(0x8180, 5.0f); + } else { + core1_ce60_setChanMaskWithValue(0x3e00, 5.0f); } - else{ - func_8024A8AC(0x3e00, 5.0f); + } else { + core1_ce60_setChanMask(0x407f); + } + break; + + case MAP_12_GV_GOBIS_VALLEY: + if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ + core1_ce60_setChanMask(0x8020); + } else if (core1_ce60_isPlayerInRange(-3990, 5670, 3700)){ + core1_ce60_setChanMask(0x797f); + } else { + core1_ce60_setChanMask(0x67fe); + } + break; + + case MAP_3_UNUSED: + core1_ce60_setChanMaskFromWaterState(0x1800, 0x67fe); + break; + + case MAP_5_TTC_BLUBBERS_SHIP: + core1_ce60_setChanMaskFromWaterState(0x600, 0x7800); + break; + + case MAP_1_SM_SPIRAL_MOUNTAIN: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x9000); + } else { + if (chmole_learnedAllSpiralMountainAbilities()) { + core1_ce60_func_8024A9EC(0); } - } - else{ - func_8024A880(0x407f); + + core1_ce60_setChanMask(0x6fff); } break; - case MAP_12_GV_GOBIS_VALLEY:// L8024B1BC - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8020); - } - else if(func_8024A8DC(-0xf96, 0x1626, 0xe74)){ - func_8024A880(0x797f); - } - else{ - func_8024A880(0x67fe); - } + case MAP_21_CC_WITCH_SWITCH_ROOM: + case MAP_22_CC_INSIDE_CLANKER: + case MAP_23_CC_GOLDFEATHER_ROOM: + core1_ce60_setChanMaskFromWaterState(0x3c00, 0x61ff); break; - case MAP_3_UNUSED: // L8024B214 - func_8024AF00(0x1800, 0x67fe); + case MAP_25_MMM_WELL: + case MAP_2F_MMM_WATERDRAIN_BARREL: + core1_ce60_setChanMaskFromWaterState(0x1000, 0xcfff); break; - case MAP_5_TTC_BLUBBERS_SHIP: // L8024B228 - func_8024AF00(0x600, 0x7800); + case MAP_13_GV_MEMORY_GAME: + case MAP_14_GV_SANDYBUTTS_MAZE: + case MAP_15_GV_WATER_PYRAMID: + case MAP_16_GV_RUBEES_CHAMBER: + case MAP_1A_GV_INSIDE_JINXY: + core1_ce60_setChanMaskFromWaterState(0x3ffe, 0x4ffe); break; - case MAP_1_SM_SPIRAL_MOUNTAIN: // L8024B23C - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x9000); - } - else{ - if(chmole_learnedAllSpiralMountainAbilities()) - func_8024A9EC(0); - func_8024A880(0x6fff); - } - break; - - case MAP_21_CC_WITCH_SWITCH_ROOM:// L8024B288 - case MAP_22_CC_INSIDE_CLANKER:// L8024B288 - case MAP_23_CC_GOLDFEATHER_ROOM:// L8024B288 - func_8024AF00(0x3c00, 0x61ff); - break; - - case MAP_25_MMM_WELL:// L8024B29C - case MAP_2F_MMM_WATERDRAIN_BARREL:// L8024B29C - func_8024AF00(0x1000, 0xcfff); - break; - - case MAP_13_GV_MEMORY_GAME:// L8024B2B0 - case MAP_14_GV_SANDYBUTTS_MAZE:// L8024B2B0 - case MAP_15_GV_WATER_PYRAMID:// L8024B2B0 - case MAP_16_GV_RUBEES_CHAMBER:// L8024B2B0 - case MAP_1A_GV_INSIDE_JINXY:// L8024B2B0 - func_8024AF00(0x3ffe, 0x4ffe); - break; - - case MAP_1B_MMM_MAD_MONSTER_MANSION:// L8024B2C4 - if( !mapSpecificFlags_get(1) - && !func_8025AD7C(COMUSIC_4_MMM_CLOCK_VERSION) - && !func_8025AD7C(COMUSIC_3C_MINIGAME_LOSS) - ){ - func_8024A9EC(0); + case MAP_1B_MMM_MAD_MONSTER_MANSION: + if (!mapSpecificFlags_get(1) && !func_8025AD7C(COMUSIC_4_MMM_CLOCK_VERSION) && !func_8025AD7C(COMUSIC_3C_MINIGAME_LOSS)) { + core1_ce60_func_8024A9EC(0); } - func_8024A880((mapSpecificFlags_get(1) ? 0x2000: 0) + 0xcfff); + core1_ce60_setChanMask((mapSpecificFlags_get(1) ? 0x2000 : 0) + 0xcfff); break; - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: // L8024B328 - if( func_8024A8DC(0x762, -0x542, 0x578) - || func_8024A8DC(-0x85, 0x7d8, 0x384) - || func_8024A8DC(-0xe2d, -0x217, 0x578) - ){ - func_8024A8AC(0x2f4f, 2.0f); - } - else{ - func_8024A8AC(0x6f4f, 2.0f); + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + if (core1_ce60_isPlayerInRange(1890, -1346, 1400) || core1_ce60_isPlayerInRange(-133, 2008, 900) || core1_ce60_isPlayerInRange(-3629, -535, 1400)) { + core1_ce60_setChanMaskWithValue(0x2f4f, 2.0f); + } else { + core1_ce60_setChanMaskWithValue(0x6f4f, 2.0f); } break; - case MAP_31_RBB_RUSTY_BUCKET_BAY:// L8024B38C - if( (-4200 <= D_802806F8[0] && D_802806F8[0] < -3700) - && (-900 <= D_802806F8[2] && D_802806F8[2] < 900) - ){ - func_8024A880(0x51ff); - } - else{ - func_8024AF00(0x800, 0x71bf); + case MAP_31_RBB_RUSTY_BUCKET_BAY: + if ((-4200 <= sPlayerPosition[0] && sPlayerPosition[0] < -3700) && (-900 <= sPlayerPosition[2] && sPlayerPosition[2] < 900)) { + core1_ce60_setChanMask(0x51ff); + } else { + core1_ce60_setChanMaskFromWaterState(0x800, 0x71bf); } break; - case MAP_35_RBB_WAREHOUSE:// L8024B3E8 - case MAP_36_RBB_BOATHOUSE:// L8024B3E8 - case MAP_37_RBB_CONTAINER_1:// L8024B3E8 - case MAP_38_RBB_CONTAINER_3:// L8024B3E8 - case MAP_3E_RBB_CONTAINER_2:// L8024B3E8 - func_8024AF00(0x800, 0xfe); + case MAP_35_RBB_WAREHOUSE: + case MAP_36_RBB_BOATHOUSE: + case MAP_37_RBB_CONTAINER_1: + case MAP_38_RBB_CONTAINER_3: + case MAP_3E_RBB_CONTAINER_2: + core1_ce60_setChanMaskFromWaterState(0x800, 0xfe); break; - case MAP_40_CCW_HUB:// L8024B3FC - if(func_8024A8DC(0, 0, 0x802)){ - func_8024A8AC(7, 2.0f); - } - else if(0x5aa <= D_802806F8[2]){ - func_8024A8AC(0x407, 2.0f); - } - else if(D_802806F8[0] < -0x5a9){ - func_8024A8AC(0x707, 2.0f); - } - else if(D_802806F8[2] < -0x5a9){ - func_8024A8AC(0x1067, 2.0f); - } - else if(0x5aa <= D_802806F8[0]) { - func_8024A8AC(0x7007, 2.0f); + case MAP_40_CCW_HUB: + if (core1_ce60_isPlayerInRange(0, 0, 2050)) { + core1_ce60_setChanMaskWithValue(7, 2.0f); + } else if (1450 <= sPlayerPosition[2]){ + core1_ce60_setChanMaskWithValue(0x407, 2.0f); + } else if (sPlayerPosition[0] < -1449) { + core1_ce60_setChanMaskWithValue(0x707, 2.0f); + } else if (sPlayerPosition[2] < -1449) { + core1_ce60_setChanMaskWithValue(0x1067, 2.0f); + } else if (1450 <= sPlayerPosition[0]) { + core1_ce60_setChanMaskWithValue(0x7007, 2.0f); } break; - case MAP_A_TTC_SANDCASTLE: // L8024B4AC - func_8024AF00(0xCE, 0x3C); + case MAP_A_TTC_SANDCASTLE: + core1_ce60_setChanMaskFromWaterState(0xCE, 0x3C); break; - case MAP_43_CCW_SPRING:// L8024B4C0 - func_8024AF00(0x400, 0x7bbf); + case MAP_43_CCW_SPRING: + core1_ce60_setChanMaskFromWaterState(0x400, 0x7bbf); break; - case MAP_45_CCW_AUTUMN:// L8024B4D4 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x600); - } - else{ - func_8024A9EC(0); - func_8024A880(0x7BEF); + case MAP_45_CCW_AUTUMN: + if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x600); + } else { + core1_ce60_func_8024A9EC(0); + core1_ce60_setChanMask(0x7BEF); } break; - case MAP_54_UNUSED:// L8024B510 - case MAP_55_UNUSED:// L8024B510 - case MAP_57_UNUSED:// L8024B510 - case MAP_58_UNUSED:// L8024B510 - case MAP_59_UNUSED:// L8024B510 - func_8024AF00(0xc, 0x307b); + case MAP_54_UNUSED: + case MAP_55_UNUSED: + case MAP_57_UNUSED: + case MAP_58_UNUSED: + case MAP_59_UNUSED: + core1_ce60_setChanMaskFromWaterState(0xc, 0x307b); break; - case MAP_56_UNUSED:// L8024B524 - func_8024AF00(0x10, 0x4f6f); + case MAP_56_UNUSED: + core1_ce60_setChanMaskFromWaterState(0x10, 0x4f6f); break; - case MAP_27_FP_FREEZEEZY_PEAK:// L8024B538 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x400); - } - else if( mapSpecificFlags_get(0) && !jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)){ - func_8024A880(0x4bff); - } - else{ - func_8024A880(0x43ff); + case MAP_27_FP_FREEZEEZY_PEAK: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x400); + } else if (mapSpecificFlags_get(0) && !jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)) { + core1_ce60_setChanMask(0x4bff); + } else { + core1_ce60_setChanMask(0x43ff); } break; - case MAP_65_CCW_SPRING_WHIPCRACK_ROOM:// L8024B59C - func_8024A880(0x107); + case MAP_65_CCW_SPRING_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x107); break; - case MAP_66_CCW_SUMMER_WHIPCRACK_ROOM:// L8024B5AC - func_8024A880(0x1C7); + case MAP_66_CCW_SUMMER_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x1C7); break; - case MAP_67_CCW_AUTUMN_WHIPCRACK_ROOM:// L8024B5BC - func_8024A880(0xC07); + case MAP_67_CCW_AUTUMN_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0xC07); break; - case MAP_68_CCW_WINTER_WHIPCRACK_ROOM:// L8024B5CC - func_8024A880(0x1407); + case MAP_68_CCW_WINTER_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x1407); break; - case MAP_5E_CCW_SPRING_NABNUTS_HOUSE:// L8024B5DC - func_8024A880(0x41fe); + case MAP_5E_CCW_SPRING_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x41fe); break; - case MAP_5F_CCW_SUMMER_NABNUTS_HOUSE:// L8024B5EC - func_8024A880(0x71fe); + case MAP_5F_CCW_SUMMER_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x71fe); break; - case MAP_60_CCW_AUTUMN_NABNUTS_HOUSE:// L8024B5FC - func_8024A880(0x7fe); + case MAP_60_CCW_AUTUMN_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x7fe); break; - case MAP_61_CCW_WINTER_NABNUTS_HOUSE:// L8024B60C - func_8024A880(0xbfe); + case MAP_61_CCW_WINTER_NABNUTS_HOUSE: + core1_ce60_setChanMask(0xbfe); break; - case MAP_63_CCW_AUTUMN_NABNUTS_WATER_SUPPLY:// L8024B61C - func_8024AF00(1, 0x7fe); + case MAP_63_CCW_AUTUMN_NABNUTS_WATER_SUPPLY: + core1_ce60_setChanMaskFromWaterState(1, 0x7fe); break; - case MAP_64_CCW_WINTER_NABNUTS_WATER_SUPPLY:// L8024B630 - func_8024AF00(1, 0xbfe); + case MAP_64_CCW_WINTER_NABNUTS_WATER_SUPPLY: + core1_ce60_setChanMaskFromWaterState(1, 0xbfe); break; - case MAP_69_GL_MM_LOBBY:// L8024B644 - if(func_8024A8DC(0xdb6, -0x65e, 0x4e2)) - func_8024A880(0x7c00); - else - func_8024A880(0x41ff); - break; - - case MAP_6A_GL_TTC_AND_CC_PUZZLE:// L8024B67C - if(0x2b8 <= D_802806F8[1] && func_8024A8DC(-0x615, -0x389, 0x1dd)){ - func_8024A880(0x8e40); - } - else if(func_8024A8DC(0x5dc, -0x37a, 0x226) || func_8024A8DC(0x754, -0x453, 0x172)){ - func_8024A880(0xf040); - } - else{ - func_8024A880(0x81ff); + case MAP_69_GL_MM_LOBBY: + if (core1_ce60_isPlayerInRange(3510, -1630, 1250)) { + core1_ce60_setChanMask(0x7c00); + } else { + core1_ce60_setChanMask(0x41ff); } break; - case MAP_6B_GL_180_NOTE_DOOR:// L8024B704 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8800); + case MAP_6A_GL_TTC_AND_CC_PUZZLE: + if (696 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-1557, -905, 477)) { + core1_ce60_setChanMask(0x8e40); + } else if (core1_ce60_isPlayerInRange(1500, -890, 550) || core1_ce60_isPlayerInRange(1876, -1107, 370)) { + core1_ce60_setChanMask(0xf040); + } else { + core1_ce60_setChanMask(0x81ff); } - else if(func_8024A8DC(0x10eb, 0x4f5, 0x730)) { - func_8024A880(0x8640); - } - else if(func_8024A8DC(-0x526, 0x777, 0x125) || func_8024A8DC(-0x515, 0x878, 0xea)){ - func_8024A880(0xf000); - }else{ - func_8024A880(0x81bf); + break; + + case MAP_6B_GL_180_NOTE_DOOR: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8800); + } else if (core1_ce60_isPlayerInRange(4331, 1269, 1840)) { + core1_ce60_setChanMask(0x8640); + } else if (core1_ce60_isPlayerInRange(-1318, 1911, 293) || core1_ce60_isPlayerInRange(-1301, 2168, 234)) { + core1_ce60_setChanMask(0xf000); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_6C_GL_RED_CAULDRON_ROOM:// L8024B794 - func_8024A880(0x81bf); + case MAP_6C_GL_RED_CAULDRON_ROOM: + core1_ce60_setChanMask(0x81bf); break; - case MAP_6D_GL_TTC_LOBBY:// L8024B7A4 - func_8024A880(0xf000); + case MAP_6D_GL_TTC_LOBBY: + core1_ce60_setChanMask(0xf000); break; - case MAP_70_GL_CC_LOBBY:// L8024B7B4 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8100); - } - else if(func_8024A8DC(-0x19d6, -0x1d3, 0x71e)){ - func_8024A880(0xf047); - } - else{ - func_8024A880(0x8e41); + case MAP_70_GL_CC_LOBBY: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8100); + } else if (core1_ce60_isPlayerInRange(-6614, -467, 1822)) { + core1_ce60_setChanMask(0xf047); + } else { + core1_ce60_setChanMask(0x8e41); } break; - case MAP_6E_GL_GV_LOBBY:// L8024B80C - if(func_8024A8DC(0, -0x1996, 0xe42)){ - func_8024A880(0xfe00); - } - else{ - func_8024A880(0x81ff); + case MAP_6E_GL_GV_LOBBY: + if (core1_ce60_isPlayerInRange(0, -6550, 3650)) { + core1_ce60_setChanMask(0xfe00); + } else { + core1_ce60_setChanMask(0x81ff); } break; - case MAP_6F_GL_FP_LOBBY:// L8024B844 - if(0xe75 <= D_802806F8[2]){ - func_8024A880(0xe040); - } - else{ - func_8024A880(0x81bf); + case MAP_6F_GL_FP_LOBBY: + if (3701 <= sPlayerPosition[2]){ + core1_ce60_setChanMask(0xe040); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_74_GL_GV_PUZZLE:// L8024B878 - if(func_8024A8DC(-0xa49, -0x1f, 0x203)){ - func_8024A880(0xe600); - } - else{ - func_8024A880(0x81ff); + case MAP_74_GL_GV_PUZZLE: + if (core1_ce60_isPlayerInRange(-2633, -31, 515)) { + core1_ce60_setChanMask(0xe600); + } else { + core1_ce60_setChanMask(0x81ff); } break; - case MAP_75_GL_MMM_LOBBY:// L8024B8B0 - case MAP_7A_GL_CRYPT:// L8024B8B0 - func_8024A880(0xd800); + case MAP_75_GL_MMM_LOBBY: + case MAP_7A_GL_CRYPT: + core1_ce60_setChanMask(0xd800); break; - case MAP_71_GL_STATUE_ROOM:// L8024B8C0 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x200); - } - else if(func_8024A8DC(-0xf0e, -0x15a, 0x302)){ - func_8024A880(0x9c00); - } - else{ - func_8024A880(0x81bf); + case MAP_71_GL_STATUE_ROOM: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x200); + } else if (core1_ce60_isPlayerInRange(-3854, -346, 770)) { + core1_ce60_setChanMask(0x9c00); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_72_GL_BGS_LOBBY:// L8024B918 - if(D_80275C10 == -1 && D_80275C18 == 0){ + case MAP_72_GL_BGS_LOBBY: + if (D_80275C10 == -1 && D_80275C18 == FALSE) { D_80275C10 = func_802F9AA8(0x410); func_802F9F80(D_80275C10, 3.0f, 16777216.0f, 0.0f); func_802FA060(D_80275C10, 3500, 3500, 0.0f); @@ -540,120 +516,116 @@ void func_8024AF48(void){ D_80275C14 = func_802F9AA8(0x411); func_802F9F80(D_80275C14, 3.0f, 16777216.0f, 0.0f); func_802FA060(D_80275C14, 3500, 3500, 0.0f); - }//L8024B9BC + } - if(D_80275C1C != D_80275C18){ + if (D_80275C1C != D_80275C18) { D_80275C1C = D_80275C18; - if(D_80275C18){ + if (D_80275C18) { func_802F9FD0(D_80275C10, 0.0f, 0.0f, 3.0f); func_802F9FD0(D_80275C14, 0.0f, 0.0f, 3.0f); D_80275C10 = -1; D_80275C14 = 0; } - }//L8024BA2C - if(func_8024A8DC(0xb43, -0x2918, 0x1950)){ - D_80275C18 = 1; - func_8024A880(0xe040); } - else{ - D_80275C18 = 0; - func_8024A880(0x9c00); + + if (core1_ce60_isPlayerInRange(2883, -10520, 6480)) { + D_80275C18 = TRUE; + core1_ce60_setChanMask(0xe040); + } else { + D_80275C18 = FALSE; + core1_ce60_setChanMask(0x9c00); } break; - case MAP_76_GL_640_NOTE_DOOR:// L8024BA70 - func_8024AF00(0x8200, 0x81bf); + case MAP_76_GL_640_NOTE_DOOR: + core1_ce60_setChanMaskFromWaterState(0x8200, 0x81bf); break; - case MAP_77_GL_RBB_LOBBY:// L8024BA84 - func_8024AF00(0x8200, 0xf000); + case MAP_77_GL_RBB_LOBBY: + core1_ce60_setChanMaskFromWaterState(0x8200, 0xf000); break; - case MAP_78_GL_RBB_AND_MMM_PUZZLE:// L8024BA98 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8200); - } - else if(0x15a <= D_802806F8[1] && func_8024A8DC(-0x89a, 0x21a, 0x368)){ - func_8024A880(0x8C00); - } - else if(func_8024A8DC(-0x36, 0x14, 0xa5c)){ - func_8024A880(0x81bf); - } - else{ - func_8024A880(0xf000); + case MAP_78_GL_RBB_AND_MMM_PUZZLE: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8200); + } else if (346 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-2202, 538, 872)) { + core1_ce60_setChanMask(0x8C00); + } else if (core1_ce60_isPlayerInRange(-54, 20, 2652)) { + core1_ce60_setChanMask(0x81bf); + } else { + core1_ce60_setChanMask(0xf000); } break; - case MAP_79_GL_CCW_LOBBY:// L8024BB2C - if(0x31c <= D_802806F8[1] && D_802806F8[1] < 0x44c && func_8024A8DC(0x1c, 0x11c9, 0x431)) - func_8024A880(0x81bf); - else if(-4 <= D_802806F8[1] && D_802806F8[1] < 0x168 && func_8024A8DC(0x87, 0x1373, 0x86c)) - func_8024A880(0x81bf); + case MAP_79_GL_CCW_LOBBY: + if(796 <= sPlayerPosition[1] && sPlayerPosition[1] < 1100 && core1_ce60_isPlayerInRange(28, 4553, 1073)) { + core1_ce60_setChanMask(0x81bf); + } else if (-4 <= sPlayerPosition[1] && sPlayerPosition[1] < 360 && core1_ce60_isPlayerInRange(135, 4979, 2156)) { + core1_ce60_setChanMask(0x81bf); + } else { + core1_ce60_setChanMask(0x9e00); + } + break; + + case MAP_80_GL_FF_ENTRANCE: + if(sPlayerPosition[2] < 0x4e2) + core1_ce60_setChanMask(0xe040); else - func_8024A880(0x9e00); + core1_ce60_setChanMask(0x9e00); break; - case MAP_80_GL_FF_ENTRANCE:// L8024BBBC - if(D_802806F8[2] < 0x4e2) - func_8024A880(0xe040); - else - func_8024A880(0x9e00); + case MAP_7F_FP_WOZZAS_CAVE: + core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(1561, 2426, 1690)) ? 0x7ff8 : 0); + core1_ce60_setChanMaskFromWaterState(0x20, 0x1f); break; - case MAP_7F_FP_WOZZAS_CAVE:// L8024BBF0 - func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && func_8024A8DC(0x619, 0x97a, 0x69a))? 0x7ff8 : 0); - func_8024AF00(0x20, 0x1f); + case MAP_8B_RBB_ANCHOR_ROOM: + core1_ce60_setChanMaskFromWaterState(0x800, 0x51ff); break; - case MAP_8B_RBB_ANCHOR_ROOM:// L8024BC40 - func_8024AF00(0x800, 0x51ff); + case MAP_34_RBB_ENGINE_ROOM: + core1_ce60_setChanMaskFromWaterState(0x800, 0x43fe); break; - case MAP_34_RBB_ENGINE_ROOM:// L8024BC54 - func_8024AF00(0x800, 0x43fe); - break; - - case MAP_91_FILE_SELECT:// L8024BC68 - if(!func_802C5A30()){ - func_8024A8AC(0x200, 0.5f); - } - else{ - func_8024A8AC(0x1ff, 0.5f); + case MAP_91_FILE_SELECT: + if (!func_802C5A30()) { + core1_ce60_setChanMaskWithValue(0x200, 0.5f); + } else { + core1_ce60_setChanMaskWithValue(0x1ff, 0.5f); } break; - case MAP_8C_SM_BANJOS_HOUSE:// L8024BC9C - func_8024A8AC(0x1ff, 0.5f); + case MAP_8C_SM_BANJOS_HOUSE: + core1_ce60_setChanMaskWithValue(0x1ff, 0.5f); break; - case MAP_1D_MMM_CELLAR:// L8024BCB0 - func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(D_802806F8[0] < 0x23a))? 0x7ff8 : 0); + case MAP_1D_MMM_CELLAR: + core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(sPlayerPosition[0] < 570)) ? 0x7ff8 : 0); break; - case MAP_46_CCW_WINTER:// L8024BCF0 - func_8024A9EC(0); + case MAP_46_CCW_WINTER: + core1_ce60_func_8024A9EC(0); break; - }//L8024BCF8 -} - -void func_8024BD08(s32 arg0){ - if(arg0){ - D_802806F0++; - } - else{ - D_802806F0--; } } -void func_8024BD40(s32 arg0, s32 arg1){ - if(arg1 == 3){ +void core1_ce60_incOrDecCounter(bool increment) { + if (increment) { + sUnusedCounter++; } - else{ - if(arg1 == 2){ - D_802806F4 = TRUE; - } - else{ - D_802806F4 = FALSE; - } + else { + sUnusedCounter--; + } +} + +void core1_ce60_func_8024BD40(s32 arg0, s32 arg1) { + if (arg1 == 3) + return; + + if (arg1 == 2) { + D_802806F4 = TRUE; + } + else { + D_802806F4 = FALSE; } } diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index 86fb00a1..157e963b 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -440,7 +440,7 @@ void bsant_die_update(void){ } void bsant_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index a862f573..aa7f1b42 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -464,7 +464,7 @@ void func_802A8098(void) { void func_802A82D4(void) { func_802906A4(1); func_80291548(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOn(); if (bs_getNextState() != BS_5A_LOADZONE) { func_80346CE8(); diff --git a/src/core2/bs/bWhirl.c b/src/core2/bs/bWhirl.c index 55780af8..cda6162c 100644 --- a/src/core2/bs/bWhirl.c +++ b/src/core2/bs/bWhirl.c @@ -39,7 +39,7 @@ static void __bsbwhirl_end(void){ func_8029B0C0(); func_8029E070(0); func_8025A55C(-1, 0xfa0, 0xd); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A7DC(COMUSIC_25_USING_GOLD_FEATHERS); } baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); @@ -86,7 +86,7 @@ void bsbwhirl_enter_init(void){ func_8029B324(1, 1.0f); func_8029E070(1); D_8037D3B0 = 0.0f; - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 0xfa0, 0xd); func_8025A6EC(0x25, 0x6d60); func_80299BD4(); diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 8b7eddb9..3acc4ccd 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -469,7 +469,7 @@ void func_802A1DD8(void){ } void func_802A1F2C(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); func_80291548(); func_80292EA4(); @@ -508,7 +508,7 @@ void func_802A2014(void){ void func_802A2054(void){ baMarker_collisionOn(); func_8025A2FC(-1, 0xFA0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_80291548(); func_80298A64(); } @@ -519,7 +519,7 @@ void func_802A2098(void){ yaw_setIdeal(func_8029B41C()); func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0, 0xFA0); func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); func_8029151C(0xC); diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index b0fd9ba7..df29eaeb 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -490,7 +490,7 @@ void bscroc_die_update(void){ } void bscroc_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/die.c b/src/core2/bs/die.c index 8b11a0e9..8ea676c6 100644 --- a/src/core2/bs/die.c +++ b/src/core2/bs/die.c @@ -124,7 +124,7 @@ void bsdie_update(void){ } void bsdie_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); func_8029E070(0); pitch_setIdeal(0.0f); diff --git a/src/core2/bs/jig.c b/src/core2/bs/jig.c index 7f183e11..13f9d8d0 100644 --- a/src/core2/bs/jig.c +++ b/src/core2/bs/jig.c @@ -32,7 +32,7 @@ void bsjig_jiggy_init(void){ yaw_setIdeal(func_8029B41C()); //face camera func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0,0xfa0); tmp = (item_getCount(ITEM_E_JIGGY) == 9); if(tmp == 0) //weird if... @@ -106,7 +106,7 @@ void bsjig_jiggy_end(void){ if(bs_getNextState() != BS_34_JIG_NOTEDOOR){ func_8025A2FC(-1, 0xfa0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } baMarker_collisionOn(); if( jiggyscore_total() == 100 @@ -148,7 +148,7 @@ void bsjig_jiggy_interrupt(void){ void bsjig_notedoor_end(void){ baMarker_collisionOn(); func_8025A2FC(-1, 0xfa0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8029E070(0); func_80291548(); if( D_8037D4B2 @@ -174,7 +174,7 @@ void bsjig_notedoor_init(void){ func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); if(bs_getPrevState() != BS_44_JIG_JIGGY){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0,0xfa0); } func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE,-1); diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index f4a8dd22..29868e48 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -524,7 +524,7 @@ void bspumpkin_die_update(void){ void bspumpkin_die_end(void) { func_802B229C(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/timeout.c b/src/core2/bs/timeout.c index 67666b5f..1c159e76 100644 --- a/src/core2/bs/timeout.c +++ b/src/core2/bs/timeout.c @@ -17,7 +17,7 @@ void func_802B6270(void){ ncDynamicCamD_func_802BF2C0(80.0f); func_8025A58C(0,0xfa0); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8029E070(1); baMarker_collisionOff(); } @@ -42,7 +42,7 @@ void func_802B6314(void){ void func_802B63C8(void){ func_80292EA4(); func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_802B63F8(void){ @@ -58,7 +58,7 @@ void func_802B63F8(void){ ncDynamicCamD_func_802BF2C0(80.0f); func_8025A58C(0,0xfa0); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOff(); func_8029E3C0(0, 2.9f); } @@ -71,6 +71,6 @@ void func_802B64D0(void){ void func_802B6500(void){ func_8029E070(0); func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A904(); } diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 61f9191d..e52915b2 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -508,7 +508,7 @@ void bswalrus_die_update(void){ } void bswalrus_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); @@ -732,7 +732,7 @@ void bswalrus_timeout_init(void) { ncDynamicCamD_func_802BF2C0(60.0f); func_8025A58C(0, 4000); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOff(); func_8029E3C0(0, 2.9f); func_802B813C(); @@ -749,7 +749,7 @@ void func_802B9830(void) { void func_802B9880(void) { func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A904(); func_80292EA4(); func_802B80D0(); diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index df850953..938cd45e 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -173,7 +173,7 @@ void chJinjo_update(Actor * this){ sp40[1] += 50.0f; jiggy_spawn(10*level_get()-9, sp40); }//L802CE0CC - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8032BB88(this, 0, 4000); if(local->unk4){ func_8025A6EC(COMUSIC_30_5TH_JINJO_COLLECTED, 28000); @@ -248,7 +248,7 @@ void chJinjo_update(Actor * this){ func_80326310(this); if(local->unk4 == 0){ func_8032BB88(this, -1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } }//L802CE518 @@ -263,7 +263,7 @@ void chJinjo_update(Actor * this){ if(local->unk4 && actor_animationIsAt(this,0.95f)){ func_8032BB88(this, -1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } }//L802CE598 diff --git a/src/core2/ch/snacker.c b/src/core2/ch/snacker.c index eef36918..e00e1fbd 100644 --- a/src/core2/ch/snacker.c +++ b/src/core2/ch/snacker.c @@ -374,10 +374,10 @@ void chSnacker_spawn(void) { } if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) == 0) { func_8032BB88(snacker, 5000, 750); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A6EC(COMUSIC_34_SNACKER_DANGER, 0); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } s_chSnacker_spawnTimer = 0.0f; func_8032CA80(snacker, s_chSnacker_inRbb ? 15 : 9); diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index 9d2fe7b6..2b183758 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -823,7 +823,7 @@ void func_8029C984(void){ func_8025AB00(); func_8025A2FC(0, 4000); comusic_playTrack(COMUSIC_1A_DEATH); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } s32 func_8029C9C0(s32 arg0){ @@ -885,7 +885,7 @@ void func_8029CB84(void){ void func_8029CBC4(void){ func_8025A55C(-1, 4000, 0xc); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8029CBF4(void){ @@ -920,7 +920,7 @@ void func_8029CCC4(void){ if(jiggyscore_total() == 100 && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){ func_8028F918(2); } - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 0xC); func_8025A6EC(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); timedFunc_set_0(4.0f, func_8029CBF4); diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index de55cb86..fd3bd13a 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -458,7 +458,7 @@ void func_8030D778(void){ void func_8030D86C(void){ func_8030D750(); - func_80244AB0(); + core1_7090_alloc(); func_8030EDAC(0.0f, 1.0f); } @@ -472,7 +472,7 @@ void func_8030D8B4(void){ } void func_8030D8DC(void){ - func_80244B3C(); + core1_7090_release(); func_8030D778(); func_8030D8B4(); } diff --git a/src/core2/code_956B0.c b/src/core2/code_956B0.c index 1b547460..9036e561 100644 --- a/src/core2/code_956B0.c +++ b/src/core2/code_956B0.c @@ -128,7 +128,7 @@ void func_8031CB50(enum map_e map_id, s32 exit_id, s32 arg2) { if ((func_803226E8(map_id) != sp1C) && (func_80322914() == 0)) { func_8025A388(0, 0x4E2); func_8025AB00(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } if (func_802E4A08()) { func_802E40D0(map_id, exit_id); @@ -287,7 +287,7 @@ void warp_gvEnterWaterPyramidLower(s32 arg0, s32 arg1) { void warp_gvEnterRubeePyramid(s32 arg0, s32 arg1) { item_set(ITEM_6_HOURGLASS, 0); - func_80244C78(1); + core1_7090_freeSfxSource(1); func_8031CC8C(arg0, 0x1607); } @@ -297,7 +297,7 @@ void warp_gvEnterMatchingPyramid(s32 arg0, s32 arg1) { } void warp_gvEnterWaterPyramidUpper(s32 arg0, s32 arg1) { - func_80244C78(0); + core1_7090_freeSfxSource(0); volatileFlag_set(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED, 1); func_8031CC8C(arg0, 0x1502); } @@ -536,7 +536,7 @@ void func_8031DAA8(enum map_e arg0, s32 arg1) { void func_8031DAE0(s32 arg0, s32 arg1) { if (mapSpecificFlags_get(2) == 0) { volatileFlag_set(VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED, 1); - func_80244C78(0); + core1_7090_freeSfxSource(0); mapSpecificFlags_set(2, 1); func_8025A6EC(COMUSIC_3B_MINIGAME_VICTORY, 0x6D60); func_8028F918(1); diff --git a/src/core2/code_9A9D0.c b/src/core2/code_9A9D0.c index 55070648..8bf8298f 100644 --- a/src/core2/code_9A9D0.c +++ b/src/core2/code_9A9D0.c @@ -34,12 +34,12 @@ void func_803219F4(s32 arg0){ switch(D_80383310){ case 2: //L80321A30 func_8025A55C(-1, 4000, 7); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); comusic_8025AB44(COMUSIC_58_WADING_BOOTS, 0, 4000); func_8025AABC(COMUSIC_58_WADING_BOOTS); break; case 4: //L80321A6C - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){ func_8025A55C(-1, 4000, 7); } @@ -48,7 +48,7 @@ void func_803219F4(s32 arg0){ break; case 3: //L80321AC0 func_8025A55C(-1, 4000, 7); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 4000); func_8025AABC(COMUSIC_95_BBONUS_A); break; @@ -60,7 +60,7 @@ void func_803219F4(s32 arg0){ switch(D_80383310){ case 2: //L80321B28 - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); func_8025A6EC(COMUSIC_58_WADING_BOOTS, -1); func_8025A8B8(COMUSIC_58_WADING_BOOTS, 1); @@ -72,7 +72,7 @@ void func_803219F4(s32 arg0){ else{ D_80383314 = COMUSIC_57_TURBO_TRAINERS; } - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){ func_8025A55C(0, 4000, 7); } @@ -81,7 +81,7 @@ void func_803219F4(s32 arg0){ break; case 3: //L80321BDC func_803228D8(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); func_8025A6EC(COMUSIC_95_BBONUS_A, -1); func_8025A8B8(COMUSIC_95_BBONUS_A, 1); diff --git a/src/core2/code_9B650.c b/src/core2/code_9B650.c index 85e648eb..11d194bd 100644 --- a/src/core2/code_9B650.c +++ b/src/core2/code_9B650.c @@ -233,13 +233,13 @@ void func_8032278C(s32 arg0, s32 arg1) { D_8036E2B4 = 0; if (D_80383348 == 0) { if ((temp_v0 & 1) != 0) { - func_8024ADF0(0); + core1_ce60_func_8024ADF0(FALSE); } else { - func_8024ADF0(1); + core1_ce60_func_8024ADF0(TRUE); } } else { D_80383348 = 0; - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } } if ((arg0 == 1) && (arg1 == 2)) { @@ -253,7 +253,7 @@ void func_8032278C(s32 arg0, s32 arg1) { void func_803228D8(void){ if(!D_80383348){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); D_80383348 = TRUE; } } diff --git a/src/core2/code_9C170.c b/src/core2/code_9C170.c index 4f3ecf7f..e1b6cf60 100644 --- a/src/core2/code_9C170.c +++ b/src/core2/code_9C170.c @@ -7,20 +7,20 @@ u8 D_80383370; /* .code */ void func_80323100(void){ - func_8024AED8(); + core1_ce60_resetState(); } void func_80323120(void){ - func_8024AE74(); + core1_ce60_func_8024AE74(); } void func_80323140(s32 arg0, s32 arg1){ - func_8024BD40(arg0, arg1); + core1_ce60_func_8024BD40(arg0, arg1); func_8032278C(arg0, arg1); } void func_80323170(void){ - func_8024AF48(); + core1_ce60_func_8024AF48(); } void func_80323190(void){ diff --git a/src/core2/code_ABC00.c b/src/core2/code_ABC00.c index d70fad02..3df108c1 100644 --- a/src/core2/code_ABC00.c +++ b/src/core2/code_ABC00.c @@ -142,7 +142,7 @@ s32 s_jiggylist_current_index; /* .code */ void func_80332B90(void){ - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_80332BB0(void) { @@ -245,7 +245,7 @@ void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]) { temp_v0->init(&temp_v0->unk10); jiggyscore_setSpawned(jiggy_id, TRUE); if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != JIGGY_3E_GV_GRABBA) && (jiggy_id != JIGGY_0B_TTC_JINJO)) { - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 5); func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); timedFunc_set_0(3.5f, func_80332BB0); diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index bca9b0aa..d68df107 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -181,7 +181,7 @@ void func_80334910(void) { if (func_80322914() == 0) { func_8024F7C4(func_803226E8(D_803835D0.map_4)); } - func_80244B3C(); + core1_7090_release(); AnimTextureListCache_free(); func_80322FDC(); func_8033BD6C(); @@ -197,7 +197,7 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { func_80335110(1); func_80335128(1); func_802D2CB8(); - func_80244AB0(); + core1_7090_alloc(); if (map_get() == MAP_8E_GL_FURNACE_FUN) { func_8038E7C4(); } diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index 7f1cb672..bd022358 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern void func_80250530(s32, u16, f32); extern void sfxsource_setSampleRate(u8, s32); extern bool func_80323240(struct56s *, f32, f32[3]); extern f32 func_803234FC(struct56s *, f32, f32); diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index dc6141d9..051ccef8 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -67,8 +67,6 @@ extern s32 ability_getAllLearned(void); // get unlocked moves bitfield extern s32 item_getCount(s32); // item count get extern void item_adjustByDiffWithoutHud(s32, s32); // item count set -extern void func_80250530(s32, u16, f32); - extern void func_8025A55C(s32, s32, s32); extern void func_80324CFC(f32, s16, s16);