diff --git a/.gitignore b/.gitignore index 8eec04ef..f397079b 100644 --- a/.gitignore +++ b/.gitignore @@ -65,6 +65,7 @@ ctx.c nonmatchings/ undefined_syms_auto* undefined_funcs_auto* +.DS_STORE #progress reports *.csv diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 325f4c4a..c398432b 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -181,7 +181,7 @@ segments: - [0xF54BE0, c, ucode] - [0xF54CE0, c, lookup] - [0xF54D20, c, ml] - - [0xF58860, c, code_1BE90] + - [0xF58860, c, musicplayer] - [0xF59F60, c, stub_1D590] - [0xF59F90, hasm, code_1D5C0] - [0xF59FA0, c, code_1D5D0] @@ -385,7 +385,7 @@ segments: - [0xF75640, .data, memory] - [0xF75670, .data, lookup] - [0xF75D60, .data, ml] - - [0xF75EE0, .data, code_1BE90] + - [0xF75EE0, .data, musicplayer] - [0xF75EF0, .data, code_1D5D0] - [0xF75F10, .data, sns] - [0xF75F20, .data, data_1E820] @@ -423,7 +423,7 @@ segments: - [0xF77230, .rodata, overlaymanager] - [0xF772B0, .rodata, mlmtx] - [0xF772D0, .rodata, ml] - - [0xF773D0, .rodata, code_1BE90] + - [0xF773D0, .rodata, musicplayer] - [0xF77400, .rodata, code_1D5D0] - [0xF77460, .rodata, audio/n_synthesizer] - [0xF77470, .rodata, audio/n_csplayer] @@ -543,7 +543,7 @@ segments: # - [0xF647A0, c, code_EE40] #DONE # - [0xF648B0, c, code_EF50] #DONE # - [0xF656C0, c, ba/physics] #DONE - # - [0xF66630, c, code_10CD0] #DONE + # - [0xF66630, c, bs/iFrame] #DONE # - [0xF66700, c, pitch] #DONE # - [0xF669A0, c, code_11040] #DONE # - [0xF66BB0, c, climb] #DONE @@ -563,7 +563,7 @@ segments: # - [0xF69920, c, bastick] #DONE # - [0xF69D80, c, code_14420] #DONE # - [0xF6B880, c, code_15F20] #DONE - # - [0xF6B970, c, code_16010] #DONE + # - [0xF6B970, c, hazards] #DONE # - [0xF6C5C0, c, code_16C60] #DONE # - [0xF6CB50, c, batimer] #DONE # - [0xF6CDB0, c, bs/ant] #DONE @@ -651,7 +651,7 @@ segments: # - [0xF914E0, c, spawnqueue] #DONE # - [0xF92D30, c, ch/gameSelect] #DONE # - [0xF94430, c, code_3EAD0] #DONE - # - [0xF94590, c, code_3EC30] #DONE + # - [0xF94590, c, ch/explosionripple] #DONE # - [0xF94640, c, ch/bubble] #DONE # - [0xF94850, c, ch/bigbutt] #DONE # - [0xF95A50, c, code_400F0] #DONE @@ -685,7 +685,7 @@ segments: # - [0xFA5DF0, c, code_50490] #DONE # - [0xFA60B0, c, ch/climbBase] #DONE # - [0xFA6330, c, code_509D0] #DONE - # - [0xFA7100, c, code_517A0] #DONE + # - [0xFA7100, c, ch/piranhaWaterParticles] #DONE # - [0xFA72B0, c, code_51950] #DONE # - [0xFA75F0, c, ch/collectible] #DONE # - [0xFA7BF0, c, ch/mole] #DONE @@ -730,9 +730,9 @@ segments: # - [0xFBC6F0, c, code_66D90] #DONE # - [0xFBC910, c, code_66FB0] #DONE # - [0xFBCDF0, c, gc/bound] #DONE - # - [0xFBCFB0, c, code_67650] #DONE + # - [0xFBCFB0, c, dustemitter] #DONE # - [0xFBD300, c, particle] #DONE - # - [0xFBF8C0, c, code_69F60] #DONE + # - [0xFBF8C0, c, particleemittermanager] #DONE # - [0xFBFE10, c, code_6A4B0] # - [0xFC0850, c, code_6AEF0] #DONE # - [0xFC0990, c, code_6B030] #DONE @@ -823,7 +823,7 @@ segments: # - [0x100C030, c, string] #DONE # - [0x100C5C0, c, code_B6C60] #DONE # - [0x100C640, c, time] #DONE - # - [0x100C800, c, code_B6EA0] #DONE + # - [0x100C800, c, commonParticle] #DONE # - [0x100D480, c, coords] #DONE # - [0x100D8A0, c, code_B7F40] #DONE # - [0x100D980, c, code_B8020] #DONE @@ -865,7 +865,7 @@ segments: # - [0x101F860, c, code_C9F00] #DONE # - [0x10209B0, c, code_CB050] #DONE # - [0x1020F70, c, code_CB610] #DONE - # - [0x1021200, c, code_CB8A0] #DONE + # - [0x1021200, c, commonParticleTypeMap] #DONE # - [0x1021550, c, code_CBBF0] #DONE # - [0x1021670, c, code_CBD10] #DONE # - [0x1021B40, c, code_CC1E0] #DONE @@ -874,7 +874,7 @@ segments: # - [0x1023040, c, code_CD6E0] #DONE # - [0x1024630, c, code_CECD0] #DONE # - [0x10249F0, c, code_CF090] #DONE - # - [0x1024D40, c, code_CF3E0] #DONE + # - [0x1024D40, c, progressDialog] #DONE # - [0x1024F50, c, code_CF5F0] #DONE # - [0x1025140, c, ch/clankerwhipcrack] #DONE # - [0x10253C0, c, ch/code_CFA60] #DONE @@ -950,7 +950,7 @@ segments: # - [0x1034790, .data, spawnqueue] # - [0x10347A0, .data, ch/gameSelect] # - [0x1034900, .data, code_3EAD0] - # - [0x1034980, .data, code_3EC30] + # - [0x1034980, .data, ch/explosionripple] # - [0x10349B0, .data, ch/bubble] # - [0x10349E0, .data, ch/bigbutt] # - [0x1034AC0, .data, code_400F0] @@ -984,7 +984,7 @@ segments: # - [0x1036450, .data, code_50490] # - [0x10364F0, .data, ch/climbBase] # - [0x1036520, .data, code_509D0] - # - [0x1036630, .data, code_517A0] + # - [0x1036630, .data, ch/piranhaWaterParticles] # - [0x1036660, .data, code_51950] # - [0x10366D0, .data, ch/collectible] # - [0x1036740, .data, ch/mole] @@ -1014,7 +1014,7 @@ segments: # - [0x1037220, .data, code_66D90] # - [0x1037230, .data, code_66FB0] # - [0x10372B0, .data, gc/bound] - # - [0x1037300, .data, code_67650] + # - [0x1037300, .data, dustemitter] # - [0x1037310, .data, particle] # - [0x10373A0, .data, code_6A4B0] # - [0x1037470, .data, code_6AEF0] @@ -1078,7 +1078,7 @@ segments: # - [0x103F3F0, .data, code_B5040] # - [0x103F490, .data, code_B62B0] # - [0x10407F0, .data, time] - # - [0x1040800, .data, code_B6EA0] + # - [0x1040800, .data, commonParticle] # - [0x1040830, .data, code_B7F40] # - [0x1040840, .data, code_B9770] # - [0x1040890, .data, code_BD100] @@ -1096,7 +1096,7 @@ segments: # - [0x1041090, .data, code_CD6E0] # - [0x10410C0, .data, code_CECD0] # - [0x10410D0, .data, code_CF090] - # - [0x1041100, .data, code_CF3E0] + # - [0x1041100, .data, progressDialog] # - [0x10411C0, .data, code_CF5F0] # - [0x10411E0, .data, ch/clankerwhipcrack] # - [0x1041210, .data, ch/code_CFA60] @@ -1144,7 +1144,7 @@ segments: # - [0x1043180, .rodata, abilityprogress] # - [0x10431B0, .rodata, code_EF50] # - [0x1043350, .rodata, ba/physics] - # - [0x10433B0, .rodata, code_10CD0] + # - [0x10433B0, .rodata, bs/iFrame] # - [0x10433C0, .rodata, pitch] # - [0x10433F0, .rodata, code_11040] # - [0x1043400, .rodata, climb] @@ -1157,7 +1157,7 @@ segments: # - [0x10436C0, .rodata, code_12F30] # - [0x10436E0, .rodata, bastick] # - [0x10436F0, .rodata, code_14420] - # - [0x1043770, .rodata, code_16010] + # - [0x1043770, .rodata, hazards] # - [0x1043BD0, .rodata, code_16C60] # - [0x1043C70, .rodata, bs/ant] # - [0x1043CA0, .rodata, bs/bBarge] @@ -1247,7 +1247,7 @@ segments: # - [0x1045710, .rodata, ch/badShad] # - [0x1045720, .rodata, code_50490] # - [0x1045730, .rodata, code_509D0] - # - [0x1045770, .rodata, code_517A0] + # - [0x1045770, .rodata, ch/piranhaWaterParticles] # - [0x1045780, .rodata, code_51950] # - [0x1045790, .rodata, ch/mole] # - [0x1045830, .rodata, code_53C10] @@ -1269,7 +1269,7 @@ segments: # - [0x1045AE0, .rodata, code_5C870] # - [0x1045B50, .rodata, code_5FD90] # - [0x1045B60, .rodata, code_66FB0] - # - [0x1045B70, .rodata, code_67650] + # - [0x1045B70, .rodata, dustemitter] # - [0x1045B80, .rodata, particle] # - [0x1045BA0, .rodata, code_6A4B0] # - [0x1045BB0, .rodata, code_6B030] @@ -1407,7 +1407,7 @@ segments: # - [0x0106C980, .bss, code_EE40] # - [0x0106C980, .bss, code_EF50] # - [0x0106C980, .bss, ba/physics] - # - [0x0106C980, .bss, code_10CD0] + # - [0x0106C980, .bss, bs/iFrame] # - [0x0106C980, .bss, pitch] # - [0x0106C980, .bss, code_11040] # - [0x0106C980, .bss, climb] @@ -1427,7 +1427,7 @@ segments: # - [0x0106C980, .bss, bastick] # - [0x0106C980, .bss, code_14420] # - [0x0106C980, .bss, code_15F20] - # - [0x0106C980, .bss, code_16010] + # - [0x0106C980, .bss, hazards] # - [0x0106C980, .bss, code_16C60] # - [0x0106C980, .bss, batimer] # - [0x0106C980, .bss, bs/ant] @@ -1530,9 +1530,9 @@ segments: # - [0x0106C980, .bss, code_654C0] # - [0x0106C980, .bss, code_66D90] # - [0x0106C980, .bss, gc/bound] - # - [0x0106C980, .bss, code_67650] + # - [0x0106C980, .bss, dustemitter] # - [0x0106C980, .bss, particle] - # - [0x0106C980, .bss, code_69F60] + # - [0x0106C980, .bss, particleemittermanager] # - [0x0106C980, .bss, code_6AEF0] # - [0x0106C980, .bss, code_6B030] # - [0x0106C980, .bss, fx/ripple] @@ -1606,7 +1606,7 @@ segments: # - [0x0106C980, .bss, code_B62B0] # - [0x0106C980, .bss, code_B6C60] # - [0x0106C980, .bss, time] - # - [0x0106C980, .bss, code_B6EA0] + # - [0x0106C980, .bss, commonParticle] # - [0x0106C980, .bss, code_B8020] # - [0x0106C980, .bss, code_B8860] # - [0x0106C980, .bss, code_B9770] @@ -1624,7 +1624,7 @@ segments: # - [0x0106C980, .bss, code_C97F0] # - [0x0106C980, .bss, code_C9E70] # - [0x0106C980, .bss, code_C9F00] - # - [0x0106C980, .bss, code_CB8A0] + # - [0x0106C980, .bss, commonParticleTypeMap] # - [0x0106C980, .bss, code_CBBF0] # - [0x0106C980, .bss, code_CD0A0] # - [0x0106C980, .bss, code_CD6E0] @@ -1913,7 +1913,7 @@ segments: # # - [0x106EAA0, c, ch/frogminigame] #DONE # # - [0x106F160, c, ch/yellowflibbit] #DONE # # - [0x10709B0, c, ch/mudhut] #DONE -# # - [0x1070DD0, c, ch/code_8A60] #DONE +# # - [0x1070DD0, c, ch/swampswitch] #DONE # # - [0x1071160, c, code_8DF0] #DONE # # - [0x10713F0, c, ch/tanktup] # # - [0x1071AC0, c, code_9750] #DONE @@ -1931,7 +1931,7 @@ segments: # # - [0x1072A60, .data, ch/yellowflibbit] # # - [0x1072AA0, .data, crc] # # - [0x1072AB0, .data, ch/mudhut] -# # - [0x1072B10, .data, ch/code_8A60] +# # - [0x1072B10, .data, ch/swampswitch] # # - [0x1072BA0, .data, ch/tanktup] # # - [0x1072BD0, .data, code_9750] # # - [0x1072CF0, .data, ch/bigalligator] @@ -1946,7 +1946,7 @@ segments: # # - [0x1073010, .rodata, ch/frogminigame] # # - [0x1073020, .rodata, ch/yellowflibbit] # # - [0x1073110, .rodata, ch/mudhut] -# # - [0x1073120, .rodata, ch/code_8A60] +# # - [0x1073120, .rodata, ch/swampswitch] # # - [0x1073130, .rodata, ch/tanktup] # # - [0x1073140, .rodata, code_9750] # # - [0x1073150, .rodata, ch/leafboat] @@ -2194,7 +2194,7 @@ segments: # # - [0x109C310, c, ch/cauldron] #DONE # # - [0x109D6B0, c, ch/brentilda] #DONE # # - [0x109DF40, c, code_5ED0] #DONE -# # - [0x10A0760, c, code_86F0] #DONE +# # - [0x10A0760, c, jigsawpicture] #DONE # # - [0x10A1CB0, c, code_9C40] #DONE # # - [0x10A21E0, c, code_A170] #DONE # # - [0x10A24A0, c, code_A430] #DONE @@ -2208,7 +2208,7 @@ segments: # # - [0x10A51A0, .data, ch/cauldron] # # - [0x10A5390, .data, ch/brentilda] # # - [0x10A53E0, .data, code_5ED0] -# # - [0x10A6430, .data, code_86F0] +# # - [0x10A6430, .data, jigsawpicture] # # - [0x10A64E0, .data, code_9C40] # # - [0x10A6560, .data, code_A170] # # - [0x10A6600, .data, code_A430] @@ -2222,7 +2222,7 @@ segments: # # - [0x10A6C80, .rodata, ch/cauldron] # # - [0x10A6D10, .rodata, ch/brentilda] # # - [0x10A6D40, .rodata, code_5ED0] -# # - [0x10A6E50, .rodata, code_86F0] +# # - [0x10A6E50, .rodata, jigsawpicture] # # - [0x10A6EC0, .rodata, code_9C40] # # - [0x10A6EF0, .rodata, code_A4A0] # # - [0x10A6F30, .rodata, code_A810] diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index ae115637..f27b9d75 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -161,7 +161,7 @@ segments: - [0xF20500, c, code_72B0] - [0xF211B0, c, code_7F60] - [0xF21EA0, c, code_8C50] - - [0xF22F80, c, code_9D30] + - [0xF22F80, c, debugtext] - [0xF23E00, c, framebufferdraw] - [0xF260B0, c, code_CE60] - [0xF275B0, c, vimgr] @@ -182,7 +182,7 @@ segments: - [0xF31460, c, ucode] - [0xF31560, c, lookup] - [0xF315A0, c, ml] - - [0xF350E0, c, code_1BE90] + - [0xF350E0, c, musicplayer] - [0xF367E0, c, stub_1D590] - [0xF36810, hasm, code_1D5C0] - [0xF36820, c, code_1D5D0] @@ -373,7 +373,7 @@ segments: - [0xF51120, bin, data_37ED0] #unreferenced - [0xF51130, .data, code_7F60] - [0xF51140, .data, code_8C50] - - [0xF51280, .data, code_9D30] + - [0xF51280, .data, debugtext] - [0xF51430, .data, framebufferdraw] - [0xF51440, .data, code_CE60] - [0xF514B0, .data, vimgr] @@ -386,7 +386,7 @@ segments: - [0xF51DC0, .data, memory] - [0xF51DF0, .data, lookup] - [0xF524E0, .data, ml] - - [0xF52660, .data, code_1BE90] + - [0xF52660, .data, musicplayer] - [0xF52670, .data, code_1D5D0] - [0xF52690, .data, sns] - [0xF526A0, .data, data_1E820] @@ -416,7 +416,7 @@ segments: - [0xF52E90, .rodata, code_5650] - [0xF52EF0, .rodata, code_72B0] - [0xF52F10, .rodata, code_7F60] - - [0xF52F30, .rodata, code_9D30] + - [0xF52F30, .rodata, debugtext] - [0xF52F50, .rodata, code_CE60] - [0xF53220, .rodata, viewport] - [0xF532A0, .rodata, pfsmanager] @@ -425,7 +425,7 @@ segments: - [0xF539D0, .rodata, overlaymanager] - [0xF53A50, .rodata, mlmtx] - [0xF53A70, .rodata, ml] - - [0xF53B70, .rodata, code_1BE90] + - [0xF53B70, .rodata, musicplayer] - [0xF53BA0, .rodata, code_1D5D0] - [0xF53C00, .rodata, audio/n_synthesizer] - [0xF53C10, .rodata, audio/n_csplayer] @@ -543,7 +543,7 @@ segments: - [0xF647A0, c, code_EE40] - [0xF648B0, c, code_EF50] - [0xF656C0, c, ba/physics] - - [0xF66630, c, code_10CD0] + - [0xF66630, c, bs/iFrame] - [0xF66700, c, pitch] - [0xF669A0, c, code_11040] - [0xF66BB0, c, climb] @@ -563,7 +563,7 @@ segments: - [0xF69920, c, bastick] - [0xF69D80, c, code_14420] - [0xF6B880, c, code_15F20] - - [0xF6B970, c, code_16010] # baswamp? + - [0xF6B970, c, hazards] # baswamp? - [0xF6C5C0, c, code_16C60] - [0xF6CB50, c, batimer] - [0xF6CDB0, c, bs/ant] @@ -651,7 +651,7 @@ segments: - [0xF914E0, c, spawnqueue] - [0xF92D30, c, ch/gameSelect] - [0xF94430, c, code_3EAD0] - - [0xF94590, c, code_3EC30] + - [0xF94590, c, ch/explosionripple] - [0xF94640, c, ch/bubble] - [0xF94850, c, ch/bigbutt] - [0xF95A50, c, code_400F0] @@ -685,7 +685,7 @@ segments: - [0xFA5DF0, c, code_50490] - [0xFA60B0, c, ch/climbBase] - [0xFA6330, c, code_509D0] - - [0xFA7100, c, code_517A0] + - [0xFA7100, c, ch/piranhaWaterParticles] - [0xFA72B0, c, code_51950] - [0xFA75F0, c, ch/collectible] - [0xFA7BF0, c, ch/mole] @@ -730,9 +730,9 @@ segments: - [0xFBC6F0, c, code_66D90] - [0xFBC910, c, code_66FB0] - [0xFBCDF0, c, gc/bound] - - [0xFBCFB0, c, code_67650] + - [0xFBCFB0, c, dustemitter] - [0xFBD300, c, particle] - - [0xFBF8C0, c, code_69F60] + - [0xFBF8C0, c, particleemittermanager] - [0xFBFE10, c, code_6A4B0] - [0xFC0850, c, code_6AEF0] - [0xFC0990, c, code_6B030] @@ -823,7 +823,7 @@ segments: - [0x100C030, c, string] - [0x100C5C0, c, code_B6C60] - [0x100C640, c, time] - - [0x100C800, c, code_B6EA0] + - [0x100C800, c, commonParticle] - [0x100D480, c, coords] - [0x100D8A0, c, code_B7F40] - [0x100D980, c, code_B8020] @@ -865,7 +865,7 @@ segments: - [0x101F860, c, code_C9F00] - [0x10209B0, c, code_CB050] - [0x1020F70, c, code_CB610] - - [0x1021200, c, code_CB8A0] + - [0x1021200, c, commonParticleTypeMap] - [0x1021550, c, code_CBBF0] - [0x1021670, c, code_CBD10] - [0x1021B40, c, code_CC1E0] @@ -874,7 +874,7 @@ segments: - [0x1023040, c, code_CD6E0] - [0x1024630, c, code_CECD0] - [0x10249F0, c, code_CF090] - - [0x1024D40, c, code_CF3E0] + - [0x1024D40, c, progressDialog] - [0x1024F50, c, code_CF5F0] - [0x1025140, c, ch/clankerwhipcrack] - [0x10253C0, c, ch/code_CFA60] @@ -949,7 +949,7 @@ segments: - [0x1034790, .data, spawnqueue] - [0x10347A0, .data, ch/gameSelect] - [0x1034900, .data, code_3EAD0] - - [0x1034980, .data, code_3EC30] + - [0x1034980, .data, ch/explosionripple] - [0x10349B0, .data, ch/bubble] - [0x10349E0, .data, ch/bigbutt] - [0x1034AC0, .data, code_400F0] @@ -983,7 +983,7 @@ segments: - [0x1036450, .data, code_50490] - [0x10364F0, .data, ch/climbBase] - [0x1036520, .data, code_509D0] - - [0x1036630, .data, code_517A0] + - [0x1036630, .data, ch/piranhaWaterParticles] - [0x1036660, .data, code_51950] - [0x10366D0, .data, ch/collectible] - [0x1036740, .data, ch/mole] @@ -1013,7 +1013,7 @@ segments: - [0x1037220, .data, code_66D90] - [0x1037230, .data, code_66FB0] - [0x10372B0, .data, gc/bound] - - [0x1037300, .data, code_67650] + - [0x1037300, .data, dustemitter] - [0x1037310, .data, particle] - [0x10373A0, .data, code_6A4B0] - [0x1037470, .data, code_6AEF0] @@ -1077,7 +1077,7 @@ segments: - [0x103F3F0, .data, code_B5040] - [0x103F490, .data, code_B62B0] - [0x10407F0, .data, time] - - [0x1040800, .data, code_B6EA0] + - [0x1040800, .data, commonParticle] - [0x1040830, .data, code_B7F40] - [0x1040840, .data, code_B9770] - [0x1040890, .data, code_BD100] @@ -1095,7 +1095,7 @@ segments: - [0x1041090, .data, code_CD6E0] - [0x10410C0, .data, code_CECD0] - [0x10410D0, .data, code_CF090] - - [0x1041100, .data, code_CF3E0] + - [0x1041100, .data, progressDialog] - [0x10411C0, .data, code_CF5F0] - [0x10411E0, .data, ch/clankerwhipcrack] - [0x1041210, .data, ch/code_CFA60] @@ -1142,7 +1142,7 @@ segments: - [0x1043180, .rodata, abilityprogress] - [0x10431B0, .rodata, code_EF50] - [0x1043350, .rodata, ba/physics] - - [0x10433B0, .rodata, code_10CD0] + - [0x10433B0, .rodata, bs/iFrame] - [0x10433C0, .rodata, pitch] - [0x10433F0, .rodata, code_11040] - [0x1043400, .rodata, climb] @@ -1155,7 +1155,7 @@ segments: - [0x10436C0, .rodata, code_12F30] - [0x10436E0, .rodata, bastick] - [0x10436F0, .rodata, code_14420] - - [0x1043770, .rodata, code_16010] + - [0x1043770, .rodata, hazards] - [0x1043BD0, .rodata, code_16C60] - [0x1043C70, .rodata, bs/ant] - [0x1043CA0, .rodata, bs/bBarge] @@ -1245,7 +1245,7 @@ segments: - [0x1045710, .rodata, ch/badShad] - [0x1045720, .rodata, code_50490] - [0x1045730, .rodata, code_509D0] - - [0x1045770, .rodata, code_517A0] + - [0x1045770, .rodata, ch/piranhaWaterParticles] - [0x1045780, .rodata, code_51950] - [0x1045790, .rodata, ch/mole] - [0x1045830, .rodata, code_53C10] @@ -1267,7 +1267,7 @@ segments: - [0x1045AE0, .rodata, code_5C870] - [0x1045B50, .rodata, code_5FD90] - [0x1045B60, .rodata, code_66FB0] - - [0x1045B70, .rodata, code_67650] + - [0x1045B70, .rodata, dustemitter] - [0x1045B80, .rodata, particle] - [0x1045BA0, .rodata, code_6A4B0] - [0x1045BB0, .rodata, code_6B030] @@ -1405,7 +1405,7 @@ segments: - [0x1048560, .bss, code_EE40] - [0x1048560, .bss, code_EF50] - [0x1048560, .bss, ba/physics] - - [0x1048560, .bss, code_10CD0] + - [0x1048560, .bss, bs/iFrame] - [0x1048560, .bss, pitch] - [0x1048560, .bss, code_11040] - [0x1048560, .bss, climb] @@ -1425,7 +1425,7 @@ segments: - [0x1048560, .bss, bastick] - [0x1048560, .bss, code_14420] - [0x1048560, .bss, code_15F20] - - [0x1048560, .bss, code_16010] + - [0x1048560, .bss, hazards] - [0x1048560, .bss, code_16C60] - [0x1048560, .bss, batimer] - [0x1048560, .bss, bs/ant] @@ -1528,9 +1528,9 @@ segments: - [0x1048560, .bss, code_654C0] - [0x1048560, .bss, code_66D90] - [0x1048560, .bss, gc/bound] - - [0x1048560, .bss, code_67650] + - [0x1048560, .bss, dustemitter] - [0x1048560, .bss, particle] - - [0x1048560, .bss, code_69F60] + - [0x1048560, .bss, particleemittermanager] - [0x1048560, .bss, code_6AEF0] - [0x1048560, .bss, code_6B030] - [0x1048560, .bss, fx/ripple] @@ -1604,7 +1604,7 @@ segments: - [0x1048560, .bss, code_B62B0] - [0x1048560, .bss, code_B6C60] - [0x1048560, .bss, time] - - [0x1048560, .bss, code_B6EA0] + - [0x1048560, .bss, commonParticle] - [0x1048560, .bss, code_B8020] - [0x1048560, .bss, code_B8860] - [0x1048560, .bss, code_B9770] @@ -1622,7 +1622,7 @@ segments: - [0x1048560, .bss, code_C97F0] - [0x1048560, .bss, code_C9E70] - [0x1048560, .bss, code_C9F00] - - [0x1048560, .bss, code_CB8A0] + - [0x1048560, .bss, commonParticleTypeMap] - [0x1048560, .bss, code_CBBF0] - [0x1048560, .bss, code_CD0A0] - [0x1048560, .bss, code_CD6E0] @@ -1911,7 +1911,7 @@ segments: - [0x106EAA0, c, ch/frogminigame] - [0x106F160, c, ch/yellowflibbit] - [0x10709B0, c, ch/mudhut] - - [0x1070DD0, c, ch/code_8A60] + - [0x1070DD0, c, ch/swampswitch] - [0x1071160, c, code_8DF0] - [0x10713F0, c, ch/tanktup] - [0x1071AC0, c, code_9750] @@ -1929,7 +1929,7 @@ segments: - [0x1072A60, .data, ch/yellowflibbit] - [0x1072AA0, .data, crc] - [0x1072AB0, .data, ch/mudhut] - - [0x1072B10, .data, ch/code_8A60] + - [0x1072B10, .data, ch/swampswitch] - [0x1072BA0, .data, ch/tanktup] - [0x1072BD0, .data, code_9750] - [0x1072CF0, .data, ch/bigalligator] @@ -1944,7 +1944,7 @@ segments: - [0x1073010, .rodata, ch/frogminigame] - [0x1073020, .rodata, ch/yellowflibbit] - [0x1073110, .rodata, ch/mudhut] - - [0x1073120, .rodata, ch/code_8A60] + - [0x1073120, .rodata, ch/swampswitch] - [0x1073130, .rodata, ch/tanktup] - [0x1073140, .rodata, code_9750] - [0x1073150, .rodata, ch/leafboat] @@ -2192,7 +2192,7 @@ segments: - [0x109C310, c, ch/cauldron] - [0x109D6B0, c, ch/brentilda] - [0x109DF40, c, code_5ED0] - - [0x10A0760, c, code_86F0] + - [0x10A0760, c, jigsawpicture] - [0x10A1CB0, c, code_9C40] - [0x10A21E0, c, code_A170] - [0x10A24A0, c, code_A430] @@ -2206,7 +2206,7 @@ segments: - [0x10A51A0, .data, ch/cauldron] - [0x10A5390, .data, ch/brentilda] - [0x10A53E0, .data, code_5ED0] - - [0x10A6430, .data, code_86F0] + - [0x10A6430, .data, jigsawpicture] - [0x10A64E0, .data, code_9C40] - [0x10A6560, .data, code_A170] - [0x10A6600, .data, code_A430] @@ -2220,7 +2220,7 @@ segments: - [0x10A6C80, .rodata, ch/cauldron] - [0x10A6D10, .rodata, ch/brentilda] - [0x10A6D40, .rodata, code_5ED0] - - [0x10A6E50, .rodata, code_86F0] + - [0x10A6E50, .rodata, jigsawpicture] - [0x10A6EC0, .rodata, code_9C40] - [0x10A6EF0, .rodata, code_A4A0] - [0x10A6F30, .rodata, code_A810] diff --git a/include/bsint.h b/include/bsint.h index e1e1c19d..9cda8136 100644 --- a/include/bsint.h +++ b/include/bsint.h @@ -39,7 +39,7 @@ enum bs_interrupt_e { BS_INTR_1C, BS_INTR_1D, BS_INTR_1E, - BS_INTR_1F, + BS_INTR_1F_HAZARD, BS_INTR_20, BS_INTR_21, BS_INTR_22, diff --git a/include/core1/pfsmanager.h b/include/core1/pfsmanager.h index 09ff9e02..1bceff62 100644 --- a/include/core1/pfsmanager.h +++ b/include/core1/pfsmanager.h @@ -36,7 +36,7 @@ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2); void controller_copyFaceButtons(s32 controller_index, s32 dst[6]); void pfsManager_getFirstControllerFaceButtonState(s32 controller_index, s32 dst[6]); s32 func_8024E5E8(s32 arg0, s32 arg1); -s32 func_8024E60C(s32 controller_index, s32 dst[3]); +s32 controller_copySideButtons(s32 controller_index, s32 dst[3]); s32 func_8024E640(s32 controller_index, s32 dst[3]); f32 func_8024E668(s32 controller_index); s32 controller_getStartButton(s32 controller_index); diff --git a/include/core2/abilityprogress.h b/include/core2/abilityprogress.h new file mode 100644 index 00000000..e437a936 --- /dev/null +++ b/include/core2/abilityprogress.h @@ -0,0 +1,15 @@ +enum ability_used { + ABILITY_USED_JUMP = 0x0, + ABILITY_USED_FLAP = 0x1, + ABILITY_USED_FLIP = 0x2, + ABILITY_USED_SWIM = 0x3, + ABILITY_USED_CLIMB = 0x4, + ABILITY_USED_BEAK_BARGE = 0x5, + ABILITY_USED_SLIDE = 0x6, + ABILITY_USED_EGG = 0x7, + ABILITY_USED_FLY = 0x8, + ABILITY_USED_SHOCK = 0x9, + ABILITY_USED_PECK = 0xA, + ABILITY_USED_CLAW = 0xB, + ABILITY_USED_TWIRL = 0xC +}; diff --git a/include/core2/commonParticle.h b/include/core2/commonParticle.h new file mode 100644 index 00000000..cfd8a8e3 --- /dev/null +++ b/include/core2/commonParticle.h @@ -0,0 +1,75 @@ +#ifndef CORE2_COMMON_PARTICLE_H +#define CORE2_COMMON_PARTICLE_H + +#include +#include "functions.h" +#include "variables.h" +#include "core2/anim/sprite.h" + +#define PARTICLE_LIMIT 40 + +typedef s32 (*FuncUnk40)(ActorMarker *, s32, f32[3]); + +enum common_particle_e { + COMMON_PARTICLE_1_EGG_HEAD = 1, + COMMON_PARTICLE_2 = 2, + COMMON_PARTICLE_3 = 3, + COMMON_PARTICLE_4_EGG_ASS = 4, + COMMON_PARTICLE_5 = 5, + COMMON_PARTICLE_6 = 6, + COMMON_PARTICLE_7 = 7, + COMMON_PARTICLE_8_JIGGY_SHINE = 8, + COMMON_PARTICLE_9 = 9, + COMMON_PARTICLE_A = 10, + COMMON_PARTICLE_B = 11, + COMMON_PARTICLE_C = 12, + COMMON_PARTICLE_D = 13, + COMMON_PARTICLE_E = 14, + COMMON_PARTICLE_F = 15, + COMMON_PARTICLE_10 = 16, + COMMON_PARTICLE_11 = 17 +}; + +typedef struct particle_struct_s { + f32 unk0; + f32 unk4; + f32 unk8; + f32 unkC; + f32 unk10; + f32 unk14; + u8 pad18[8]; + s32 unk20; + s32 unk24; + s32 unk28; + u8 pad24[0x4]; + ActorMarker *marker_30; + AnimSprite *animSprite; + ActorMarker *actorMarker; + s32 unk3C; + FuncUnk40 unk40; + u8 isInUse; + u8 projectileIndex; + u8 typeMapIndex; + u8 unk47; +} CommonParticle; + +ActorMarker *commonParticle_getCurrentActorMarker(void); +FuncUnk40 func_8033E888(void); +u8 commonParticle_getCurrentProjectileIndex(void); +AnimSprite *commonParticle_getCurrentAnimSprite(void); +CommonParticle *commonParticle_getCurrentParticle(void); +void commonParticle_setCurrentInUseFalse(void); +void projectile_setSprite(u8, enum asset_e); +void func_8033FC34(u8, s32); +void projectile_setColor(u8, s32, s32, s32); +void func_8033FCD8(u8, s32); +void projectile_setRotation(u8, f32[3]); +void projectile_addRoll(u8, f32); +void projectile_setPosition(u8, f32[3]); +void func_8033FFE4(u8, s32, s32); +void func_80344E18(u8, s32); +void func_80344E3C(u8, f32[3]); +void func_80344D94(u8, f32[3]); +void func_80344EE4(u8, f32, f32); + +#endif diff --git a/include/core2/dustemitter.h b/include/core2/dustemitter.h new file mode 100644 index 00000000..5cf1d3a1 --- /dev/null +++ b/include/core2/dustemitter.h @@ -0,0 +1,10 @@ +#define EMITTER_COUNT 3 +#define EMITTER_CAPACITY 0x20 + +enum dust_emitter_type_e { + DUST_EMITTER_TYPE_DUST = 0, + DUST_EMITTER_TYPE_BREAK_DUST = 1 +}; + +extern void dustEmitter_empty(ParticleEmitter *); +extern void dustEmitter_emit(f32[3], f32[3], s32[4], bool, f32, f32, s32, s32, enum dust_emitter_type_e); diff --git a/include/core2/particle.h b/include/core2/particle.h index 081b1338..82702819 100644 --- a/include/core2/particle.h +++ b/include/core2/particle.h @@ -12,7 +12,7 @@ void particleEmitter_setAlpha(ParticleEmitter *this, s32 alpha); void particleEmitter_setSfx(ParticleEmitter *this, enum sfx_e sfx_id, s32 arg2); void func_802EFA04(ParticleEmitter *this, f32); void particleEmitter_setParticleCallback(ParticleEmitter *this, void (*arg1)(ParticleEmitter *this, f32 pos[3])); -void func_802EFA20(ParticleEmitter *this, f32, f32); +void particleEmitter_func_802EFA20(ParticleEmitter *this, f32, f32); void func_802EFA34(ParticleEmitter *this, f32); void func_802EFA40(ParticleEmitter *this, f32 (*)[3]); void particleEmitter_func_802EFA78(ParticleEmitter *this, s32 arg1); diff --git a/include/core2/particleemittermanager.h b/include/core2/particleemittermanager.h new file mode 100644 index 00000000..82938af2 --- /dev/null +++ b/include/core2/particleemittermanager.h @@ -0,0 +1,20 @@ +#define MAX_EMITTER_COUNT 16 // Effectively reduced by 1, as 0 is saved for an in-progress initialization and empty + +typedef struct { + f32 freeTime; + ParticleEmitter *emitter; + u32 isActive: 1; + u32 capacity: 10; + u32 padding: 21; +} EmitterData; + +ParticleEmitter *pem_getEmitterByIndex(u8 index); +u8 pem_newEmitter(s32 count); +void pem_freeAll(void); +void pem_setAllInactive(void); +void pem_free(u8 arg0); +void pem_updateAll(void); +void pem_freeEmitters(void); +void pem_defragAll(void); +void pem_freeDependencies(void); +void pem_initDependencies(void); diff --git a/include/core2/statetimer.h b/include/core2/statetimer.h index 0d15969f..e05a05dd 100644 --- a/include/core2/statetimer.h +++ b/include/core2/statetimer.h @@ -9,7 +9,7 @@ enum state_timer_e{ STATE_TIMER_1_THROW = 1, STATE_TIMER_2_LONGLEG, STATE_TIMER_3_TURBO_TALON, - STATE_TIMER_4_UNKNOWN, + STATE_TIMER_4_IFRAME, STATE_TIMER_5_UNKNOWN, //slide timer STATE_TIMER_6_UNKNOWN //trot slide timer }; diff --git a/include/core2/staticcamera.h b/include/core2/staticcamera.h new file mode 100644 index 00000000..42ff1a1b --- /dev/null +++ b/include/core2/staticcamera.h @@ -0,0 +1,5 @@ +enum static_camera_id_s { + MM_ORANGE_PAD_JIGGY_SPAWN_TOP = 0xE, + MM_ORANGE_PAD_JIGGY_SPAWN_LEFT = 0xF, + MM_ORANGE_PAD_JIGGY_SPAWN_RIGHT = 0x10 +}; diff --git a/include/enums.h b/include/enums.h index 40c97a4a..d3caed64 100644 --- a/include/enums.h +++ b/include/enums.h @@ -29,7 +29,7 @@ enum file_progress_e { FILEPROG_C_EXTRA_LIFE_TEXT, FILEPROG_D_BEEHIVE_TEXT, FILEPROG_E_JINJO_TEXT, - FILEPROG_F_HAS_TOUCHED_PIRAHANA_WATER, + FILEPROG_F_HAS_TOUCHED_PIRANHA_WATER, FILEPROG_10_HAS_TOUCHED_SAND_EEL_SAND, FILEPROG_11_HAS_MET_MUMBO, FILEPROG_12_HAS_TRANSFORMED_BEFORE, @@ -129,7 +129,7 @@ enum file_progress_e { FILEPROG_92_PAID_WALRUS_COST, FILEPROG_93_PAID_CROC_COST, FILEPROG_94_PAID_BEE_COST, - FILEPROG_95_UNKNOWN, + FILEPROG_95_UNUSED_UNKNOWN_ITEM_COLLECT, FILEPROG_96_MET_BRENTILDA, FILEPROG_97_ENTERED_LAIR_TEXT, FILEPROG_98_EXITED_LEVEL_TEXT, @@ -438,15 +438,17 @@ enum level_flags_e LEVEL_FLAG_19_FP_UNKNOWN = 0x19, LEVEL_FLAG_1A_UNKNOWN, LEVEL_FLAG_1B_MMM_UNKNOWN, - LEVEL_FLAG_1C_MM_UNKNOWN, - LEVEL_FLAG_1D_TTC_UNKNOWN, - LEVEL_FLAG_1E_CC_UNKNOWN, - LEVEL_FLAG_1F_BGS_UNKNOWN, - LEVEL_FLAG_20_FP_UNKNOWN, - LEVEL_FLAG_21_GV_UNKNOWN, - LEVEL_FLAG_22_MMM_UNKNOWN, - LEVEL_FLAG_23_RBB_UNKNOWN, - LEVEL_FLAG_24_CCW_UNKNOWN, + + LEVEL_FLAG_1C_MM_OPEN = 0x1C, // See jigsawpicture.c + LEVEL_FLAG_1D_TTC_OPEN, + LEVEL_FLAG_1E_CC_OPEN, + LEVEL_FLAG_1F_BGS_OPEN, + LEVEL_FLAG_20_FP_OPEN, + LEVEL_FLAG_21_GV_OPEN, + LEVEL_FLAG_22_MMM_OPEN, + LEVEL_FLAG_23_RBB_OPEN, + LEVEL_FLAG_24_CCW_OPEN, + LEVEL_FLAG_25_CCW_UNKNOWN, LEVEL_FLAG_26_FP_UNKNOWN, LEVEL_FLAG_27_RBB_UNKNOWN, @@ -464,12 +466,14 @@ enum level_flags_e LEVEL_FLAG_33_MMM_UNKNOWN, LEVEL_FLAG_34_UNKNOWN, + LEVEL_FLAG_35_UNKNOWN = 0x35, + LEVEL_FLAG_38_CCW_UNKNOWN = 0x38, LEVEL_FLAG_3C_LAIR_UNKNOWN = 0x3C, LEVEL_FLAG_3D_LAIR_UNKNOWN, LEVEL_FLAG_3E_UNKNOWN, - LEVEL_FLAG_3F_LAIR_UNKNOWN + LEVEL_FLAG_3F_LAIR_GRUNTY_DOOR_OPEN }; enum transformation_e @@ -1446,10 +1450,10 @@ enum sfx_e SFX_191_STATIC, SFX_3E9_UNKNOWN = 0x3e9, //bsbwhirl - SFX_3EA_UNKNOWN, //chjig + SFX_3EA_BANJO_GUH_HUH, //chjig SFX_3EB_UNKNOWN, //bstimeout SFX_3EC_CCW_DOOR_OPENING, //ccw and GV opening - SFX_3ED, + SFX_3ED_BUBBLE_POP, SFX_3EE, SFX_3EF, SFX_3F0_FLIBBIT_TALKING, @@ -1481,7 +1485,7 @@ enum sfx_e SFX_414_XMAS_GIFT_TALKING, SFX_415_UNKNOWN, //xmas tree SFX_416, - SFX_417_UNKNOWN, //lair/func_8038EB94, double health + SFX_417_DOUBLE_HEALTH_UPGRADE, SFX_419_UNKNOWN = 0x419, SFX_41A_UNKNOWN = 0x41a @@ -1890,7 +1894,7 @@ enum actor_e ACTOR_F0_PINK_EGG_SMALLEST, ACTOR_F1_LEAF_BOAT, ACTOR_F2_BLACK_SNIPPET, - + ACTOR_F3_EXPLOSION_RIPPLE, ACTOR_F4_BURIED_TREASURE = 0xF4, ACTOR_F5_MUTIE_SNIPPET, ACTOR_F6_BIG_ALLIGATOR, @@ -1993,6 +1997,8 @@ enum actor_e ACTOR_181_SCARF_SLED = 0x181, ACTOR_182_RACE_SLED = 0x182, + ACTOR_188_PIRANHA_WATER_PARTICLES = 0x188, + ACTOR_198_BANJOS_BED = 0x198, ACTOR_199_BANJOS_CHAIR, ACTOR_19A_BANJOS_STOVE, @@ -2276,7 +2282,7 @@ enum bundle_e { BUNDLE_1D__HONEYCOMB, BUNDLE_1E__JIGGY, BUNDLE_1F_SM_EMPTY_HONEYCOMB, - BUNDLE_20__UNKOWN, + BUNDLE_20__UNKNOWN, BUNDLE_21__ICECUBE_B, BUNDLE_22__HONEYCOMB, BUNDLE_23__HONEYCOMB, @@ -2285,46 +2291,45 @@ enum bundle_e { BUNDLE_26__HONEYCOMB }; -enum bs_e -{ - BS_0_NONE = 0, +enum bs_e { + BS_0_NONE = 0x0, BS_1_IDLE = 0x1, - BS_2_WALK_SLOW, + BS_2_WALK_SLOW = 0x2, BS_WALK = 0x3, BS_4_WALK_FAST = 0x4, - BS_5_JUMP, + BS_5_JUMP = 0x5, BS_CLAW = 0x6, BS_CROUCH = 0x7, - BS_8_BTROT_JUMP, - BS_9_EGG_HEAD, - BS_A_EGG_ASS, - BS_B_UNKOWN, + BS_8_BTROT_JUMP = 0x8, + BS_9_EGG_HEAD = 0x9, + BS_A_EGG_ASS = 0xA, + BS_B_UNKOWN = 0xB, BS_SKID = 0xC, - BS_D_TIMEOUT, - BS_E_OW, - BS_F_BBUSTER, + BS_D_TIMEOUT = 0xD, + BS_E_OW = 0xE, + BS_F_BBUSTER = 0xF, BS_BFLAP = 0x10, - BS_11_BPECK, - BS_12_BFLIP, - BS_BBARGE = 0x13, - BS_14_BTROT_ENTER, - BS_15_BTROT_IDLE, - BS_16_BTROT_WALK, - BS_17_BTROT_EXIT , - BS_18_FLY_KNOCKBACK, + BS_11_BPECK = 0x11, + BS_12_BFLIP = 0x12, + BS_BBARGE = 0x13, + BS_14_BTROT_ENTER = 0x14, + BS_15_BTROT_IDLE = 0x15, + BS_16_BTROT_WALK = 0x16, + BS_17_BTROT_EXIT = 0x17, + BS_18_FLY_KNOCKBACK = 0x18, BS_1A_WONDERWING_ENTER = 0x1A, - BS_1B_WONDERWING_IDLE, - BS_1C_WONDERWING_WALK, - BS_1D_WONDERWING_JUMP, - BS_1E_WONDERWING_EXIT, + BS_1B_WONDERWING_IDLE = 0x1B, + BS_1C_WONDERWING_WALK = 0x1C, + BS_1D_WONDERWING_JUMP = 0x1D, + BS_1E_WONDERWING_EXIT = 0x1E, BS_WALK_CREEP = 0x1F, BS_20_LANDING = 0x20, BS_BSHOCK_CHARGE = 0x21, BS_BSHOCK_JUMP = 0x22, - BS_23_FLY_ENTER, - BS_24_FLY, - BS_25_LONGLEG_ENTER, + BS_23_FLY_ENTER = 0x23, + BS_24_FLY = 0x24, + BS_25_LONGLEG_ENTER = 0x25, BS_26_LONGLEG_IDLE = 0x26, BS_LONGLEG_WALK = 0x27, BS_LONGLEG_JUMP = 0x28, @@ -2338,89 +2343,87 @@ enum bs_e BS_30_DIVE_ENTER = 0x30, BS_ROLL = 0x31, BS_SLIDE = 0x32, - //unk33, + BS_34_JIG_NOTEDOOR = 0x34, - BS_35_ANT_IDLE, + BS_35_ANT_IDLE = 0x35, BS_ANT_WALK = 0x36, BS_ANT_JUMP = 0x37, - BS_38_ANT_FALL, - BS_39_DIVE_A, - BS_3A_CARRY_IDLE, - BS_3B_CARRY_WALK, - BS_3C_TALK, - BS_3D_FALL_TUMBLING, - BS_3E_ANT_OW, - BS_3F, - BS_40_PUMPKIN_FLUSH, - BS_41_DIE, - BS_42_DINGPOT, - BS_43_ANT_DIE, - BS_44_JIG_JIGGY, - BS_45_BTROT_SLIDE, - //unk46 - //unk47 + BS_38_ANT_FALL = 0x38, + BS_39_DIVE_A = 0x39, + BS_3A_CARRY_IDLE = 0x3A, + BS_3B_CARRY_WALK = 0x3B, + BS_3C_TALK = 0x3C, + BS_3D_FALL_TUMBLING = 0x3D, + BS_3E_ANT_OW = 0x3E, + BS_3F = 0x3F, + BS_40_PUMPKIN_FLUSH = 0x40, + BS_41_DIE = 0x41, + BS_42_DINGPOT = 0x42, + BS_43_ANT_DIE = 0x43, + BS_44_JIG_JIGGY = 0x44, + BS_45_BTROT_SLIDE = 0x45, + + BS_48_PUMPKIN_IDLE = 0x48, BS_49_PUMPKIN_WALK = 0x49, BS_4A_PUMPKIN_JUMP = 0x4A, BS_4B_PUMPKIN_FALL = 0x4B, - BS_4C_LANDING_IN_WATER = 0x4c, + BS_4C_LANDING_IN_WATER = 0x4C, BS_4D_PUMPKIN_OW = 0x4D, BS_4E_PUMPKIN_DIE = 0x4E, - BS_4F_CLIMB_IDLE, - BS_50_CLIMB_MOVE, - BS_51_CLIMB_EXIT, - //unk52 //tumblar??? a.k.a bssurf + BS_4F_CLIMB_IDLE = 0x4F, + BS_50_CLIMB_MOVE = 0x50, + BS_51_CLIMB_EXIT = 0x51, + BS_52_UNKNOWN = 0x52, //tumblar??? a.k.a bssurf BS_53_TIMEOUT = 0x53, BS_54_SWIM_DIE = 0x54, BS_LONGLEG_SLIDE = 0x55, BS_56_RECOIL = 0x56, BS_57_BOMB_END = 0x57, - BS_58_BEAKBOMB_CRASH, + BS_58_BEAKBOMB_CRASH = 0x58, BS_59_BFLY_UNK59 = 0x59, BS_5A_LOADZONE = 0x5A, BS_CARRY_THROW = 0x5B, - + + BS_5E_CROC_IDLE = 0x5E, BS_CROC_WALK = 0x5F, BS_CROC_JUMP = 0x60, BS_61_CROC_FALL = 0x61, BS_62_LONGLEG_LOCKED = 0x62, - BS_CROC_OW = 0x63, - BS_CROC_DIE = 0x64, + BS_CROC_OW = 0x63, + BS_CROC_DIE = 0x64, BS_67_WALRUS_IDLE = 0x67, BS_WALRUS_WALK = 0x68, BS_WALRUS_JUMP = 0x69, BS_6A_WALRUS_FALL = 0x6A, - BS_6B_BEE_LOCKED, - //unk0x6B //[107] = "Locked", -- Bee, Mumbo Transform Cutscene + BS_6B_BEE_LOCKED = 0x6B, //[107] = "Locked", -- Bee, Mumbo Transform Cutscene BS_WALRUS_OW = 0x6C, BS_WALRUS_DIE = 0x6D, BS_6E_CROC_BITE = 0x6E, BS_CROC_EAT_BAD = 0x6F, BS_70_CROC_EAT_GOOD = 0x70, BS_71_BTROT_FALL = 0x71, - BS_SPLAT = 0x72, //get up after fall damage - BS_73_UNKNOWN = 0x73, - BS_74_UNKNOWN = 0x74, - BS_75_UNKNOWN = 0x75, - //0x73 locked_cutscene - //0x74 locked jiggypad, xform, bottles - //0x75 locked bottles + BS_SPLAT = 0x72, // Getting up after fall damage + BS_73_UNKNOWN = 0x73, // locked_cutscene + BS_74_UNKNOWN = 0x74, // locked jiggypad, xform, bottles + BS_75_UNKNOWN = 0x75, // locked bottles BS_76_BFLY_LOCKED = 0x76, - BS_77_SWIM_LOCKED = 0x77, //0x77 locked swim - BS_78_DIVE_LOCKED = 0x78,//0x78 locked dive - BS_79_BTROT_LOCKED, - BS_WALK_MUD, - BS_BTROT_OW, - BS_7C_SLED, - BS_7D_WALRUS_SLED, - BS_7E_WALRUS_SLED, + BS_77_SWIM_LOCKED = 0x77, + BS_78_DIVE_LOCKED = 0x78, + BS_79_BTROT_LOCKED = 0x79, + BS_WALK_MUD = 0x7A, + BS_BTROT_OW = 0x7B, + BS_7C_SLED = 0x7C, + BS_7D_WALRUS_SLED = 0x7D, + BS_7E_WALRUS_SLED = 0x7E, BS_7F_DIVE_OW = 0x7F, - BS_80_WALRUS_SLED_LOSE, + BS_80_WALRUS_SLED_LOSE = 0x80, BS_81_WALRUS_SLED_LOCKED = 0x81, - BS_82_WALRUS_SLED_LOSE_IN_AIR, + BS_82_WALRUS_SLED_LOSE_IN_AIR = 0x82, + BS_85_BEE_IDLE = 0x85, BS_BEE_WALK = 0x86, @@ -2429,32 +2432,32 @@ enum bs_e BS_BEE_OW = 0x89, BS_BEE_DIE = 0x8A, - BS_BEE_FLY = 0x8c, + BS_BEE_FLY = 0x8C, BS_8D_CROC_LOCKED = 0x8D, - BS_8E_ANT_LOCKED = 0x8E, //"Locked", -- Jiggy podium, Bottles' text outside Mumbo's + BS_8E_ANT_LOCKED = 0x8E, // "Locked", -- Jiggy podium, Bottles' text outside Mumbo's BS_8F_PUMPKIN_LOCKED = 0x8F, BS_FLY_OW = 0x91, - BS_92_ANT_DRONE, - BS_93_PUMPKIN_DRONE, - BS_94_CROC_DRONE, - BS_95_WALRUS_DRONE, - BS_96_SWIM_LOCKED, - BS_97_DIVE_LOCKED, - BS_98_WALK_DRONE, - BS_99_BFLY_DRONE, - BS_9A_BTROT_DRONE, + BS_92_ANT_DRONE = 0x92, + BS_93_PUMPKIN_DRONE = 0x93, + BS_94_CROC_DRONE = 0x94, + BS_95_WALRUS_DRONE = 0x95, + BS_96_SWIM_LOCKED = 0x96, + BS_97_DIVE_LOCKED = 0x97, + BS_98_WALK_DRONE = 0x98, + BS_99_BFLY_DRONE = 0x99, + BS_9A_BTROT_DRONE = 0x9A, BS_9B_LONGLEG_DRONE = 0x9B, BS_9C_WALRUS_SLED_DRONE = 0x9C, BS_9D_BEE_DRONE = 0x9D, - BS_9E_CLIMB_LOCKED, + BS_9E_CLIMB_LOCKED = 0x9E, BS_ANT_BOUNCE = 0x9F, BS_PUMPKIN_BOUNCE = 0xA0, BS_CROC_BOUNCE = 0xA1, BS_WALRUS_BOUNCE = 0xA2, BS_BEE_BOUNCE = 0xA3, BS_A4_WONDERWING_DRONE = 0xA4, - BS_A5_WONDERWING_UNKA5 + BS_A5_WONDERWING_UNKA5 = 0xA5 }; enum sm_specific_flags { @@ -2467,7 +2470,7 @@ enum sm_specific_flags { SM_SPECIFIC_FLAG_7 = 0x7, // cauliflower dead? SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED, - SM_SPECIFIC_FLAG_A, + SM_SPECIFIC_FLAG_A_ABILITY_FLIP_UNLOCKED, SM_SPECIFIC_FLAG_C = 0xC, // learned all attack moves @@ -2483,7 +2486,7 @@ enum mm_specific_flags { MM_SPECIFIC_FLAG_3_CHIMPY_HAS_LEAVED, MM_SPECIFIC_FLAG_4_SHAKE, - MM_SPECIFIC_FLAG_6_UNKNOWN = 0x6, + MM_SPECIFIC_FLAG_CONGA_WARNED_BLOCKS = 0x6, MM_SPECIFIC_FLAG_8_HIT_WITH_ORANGE = 0x8, MM_SPECIFIC_FLAG_9_JUJU_HAS_HALF_TURNED, @@ -2501,6 +2504,21 @@ enum ttc_specific_flags { TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN = 0x7 }; +enum bgs_specific_flags { + BGS_SPECIFIC_FLAG_1 = 1, + BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_RESET = 2, + BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING = 3, + BGS_SPECIFIC_FLAG_WALKWAY_JIGGY = 4, + BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_SWITCH_PRESSED = 5, + BGS_SPECIFIC_FLAG_7 = 7, + BGS_SPECIFIC_FLAG_8 = 8, + BGS_SPECIFIC_FLAG_MAZE_JIGGY_SWITCH_PRESSED = 9, + BGS_SPECIFIC_FLAG_A = 0xA, + BGS_SPECIFIC_FLAG_MAZE_JIGGY_RESET = 0xB, + BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING = 0xC, + BGS_SPECIFIC_FLAG_MAZE_JIGGY = 0xD +}; + enum mmm_specific_flags { MMM_SPECIFIC_FLAG_0_UNKNOWN, MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN, @@ -2508,7 +2526,7 @@ enum mmm_specific_flags { MMM_SPECIFIC_FLAG_3_UNKNOWN, MMM_SPECIFIC_FLAG_4_UNKNOWN, MMM_SPECIFIC_FLAG_5_UNKNOWN, - MMM_SPECIFIC_FLAG_6_UNKNOWN, + MMM_SPECIFIC_FLAG_CONGA_WARNED_BLOCKS, MMM_SPECIFIC_FLAG_7_UNKNOWN }; @@ -4203,6 +4221,8 @@ enum asset_e ASSET_89D_ZOOMBOX_SPRITE = 0x89D, + ASSET_89F_MODEL_ORANGE_PARTICLE = 0x89F, + ASSET_8A0_SPRITE_WATER_DROP = 0x8A0, ASSET_A0B_DIALOG_BLUBBER_FIRST_MEET = 0xA0B, @@ -4222,7 +4242,7 @@ enum asset_e ASSET_A1F_DIALOG_SHOCKJUMP_LEARN = VER_SELECT(0xa1f, 0x91f, 0, 0), ASSET_A20_DIALOG_FLY_LEARN, - ASSET_A21_DIALOG_BLUBBER_MEET, + ASSET_A21_DIALOG_BLUBBER_TREASURE_MEET, ASSET_A22_DIALOG_FLY_REFRESHER, ASSET_A23_DIALOG_SHOCKJUMP_REFRESHER, ASSET_A24_DIALOG_JUMP_PAD_DISCOVERED, @@ -4257,6 +4277,8 @@ enum asset_e ASSET_A84_DIALOG_TURBOTRAINERS_LEARN, ASSET_A85_DIALOG_TURBOTRAINERS_REFRESHER, + ASSET_A88_DIALOG_GRUNTY_GV_MISS_TRAPDOOR = 0xA88, + ASSET_AD3_DIALOG_UNKNOWN = 0xad3, ASSET_AD4_DIALOG_UNKNOWN, ASSET_AD5_DIALOG_UNKNOWN, @@ -4269,6 +4291,8 @@ enum asset_e ASSET_ADE_DIALOG_LOGGO_AS_BEAR, ASSET_ADF_DIALOG_ENTER_LOGGO, ASSET_AE0_DIALOG_EXIT_LOGGO, + ASSET_AE1_DIALOG_GRUNTY_MMM_THORNS, + ASSET_AE2_DIALOG_GRUNTY_MMM_MISS_CHRUCH_DOOR, ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE = 0xb37, ASSET_B38_DIALOG_CONGA_DEFEAT, @@ -4276,7 +4300,7 @@ enum asset_e ASSET_B3A_DIALOG_CONGA_HITS_PLAYER, ASSET_B3B_DIALOG_CONGA_ORANGE_PAD_JIGGY, ASSET_B3C_DIALOG_CONGA_MEET, - + ASSET_B3D_DIALOG_CONGA_DONT_TOUCH_BLOCKS, ASSET_B3E_DIALOG_CONGA_MEET_AS_TERMITE = VER_SELECT(0xb3e, 0x95c, 0, 0), ASSET_B3F_DIALOG_CHIMPY_MEET, ASSET_B40_DIALOG_CHIMPY_COMPLETE, @@ -4285,20 +4309,25 @@ enum asset_e ASSET_B43_DIALOG_TERMITE_MEET_AS_BEAR, ASSET_B44_DIALOG_JUJU_MEET, ASSET_B45_DIALOG_JIGGY_COLLECT_10, - - ASSET_B47_DIALOG_EGGS_LEARN = 0xb47, + ASSET_B46_DIALOG_COLLECT_ORANGE, + ASSET_B47_DIALOG_EGGS_LEARN = 0xB47, ASSET_B48_DIALOG_BEAKBUSTER_LEARN, ASSET_B49_DIALOG_TALON_TROT_LEARN, ASSET_B4A_DIALOG_TALON_TROT_REFRESHER, ASSET_B4B_DIALOG_EGGS_REFRESHER, ASSET_B4C_DIALOG_BEAKBUSTER_REFRESHER, - ASSET_B4D_DIALOG_UNKNOWN, + ASSET_B4D_DIALOG_BOTTLES_SLIPPERY, ASSET_B4E_DIALOG_BOTTLES_ALL_MM_MOVES_LEARNED = 0xB4E, - ASSET_B51_DIALOG_BOTTLES_HOW_TO_EXIT_LEVEL = 0xb51, + ASSET_B50_DIALOG_BOTTLES_UNUSED_UNKNOWN_ITEM_COLLECT = 0xB50, + ASSET_B51_DIALOG_BOTTLES_HOW_TO_EXIT_LEVEL = 0xB51, ASSET_B9F_DIALOG_UNKNOWN = 0xb9f, + ASSET_BA0_DIALOG_GRUNTY_RBB_RED_HOT_OVENS = 0xBA0, + ASSET_BA1_DIALOG_GRUNTY_RBB_WATER_SWIM = 0xBA1, + ASSET_BA2_DIALOG_GRUNTY_RBB_WATER_DIVE = 0xBA2, + ASSET_BA3_DIALOG_GRUNTY_RBB_OILY_SCUM_UNUSED = 0xBA3, ASSET_BFF_DIALOG_UNKNOWN = 0xbff, @@ -4311,6 +4340,8 @@ enum asset_e ASSET_C09_DIALOG_UNKNOWN, ASSET_C0A_DIALOG_UNKNOWN, + ASSET_C11_DIALOG_FREEZING_WATER = 0xC11, + ASSET_C15_DIALOG_TWINKLIE_MINIGAME_LOST = 0xc15, ASSET_C17_DIALOG_UNKNOWN = 0xC17, @@ -4318,8 +4349,8 @@ enum asset_e ASSET_C19_DIALOG_UNKNOWN, ASSET_C1A_DIALOG_UNKNOWN, - ASSET_C1E_DIALOG_UNKNOWN = 0xc1e, - ASSET_C1F_DIALOG_UNKNOWN, + ASSET_C1E_DIALOG_BOGGY_LOOK_FOR_PRESENTS = 0xc1e, + ASSET_C1F_DIALOG_BOGGY_NEEDS_SLEEP, ASSET_C20_DIALOG_PRESENT_COLLECTIBLE_MEET_BLUE = 0xC20, ASSET_C21_DIALOG_PRESENT_COLLECTIBLE_MEET_GREEN, @@ -4358,11 +4389,14 @@ enum asset_e text_flibbits_defeat = 0xc82, text_flibbits_return = 0xc83, + ASSET_C85_DIALOG_PIRANHA_WATER = 0xC85, ASSET_C86_DIALOG_UNKNOWN = 0xc86, ASSET_C88_DIALOG_LONGLEG_LEARN = 0xC88, ASSET_C89_DIALOG_LONGLEG_REFRESHER, ASSET_C8A_DIALOG_BOTTLES_ALL_BGS_MOVES_LEARNED, + ASSET_C8B_DIALOG_GRUNTY_BGS_MISS_WALKWAY_JIGGY, + ASSET_C8C_DIALOG_GRUNTY_BGS_MISS_MAZE_JIGGY, ASSET_C8D_DIALOG_MR_VILE_EXTRA_CHALLENGE_INTRO = 0xC8D, ASSET_C8E_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_1, @@ -4379,6 +4413,10 @@ enum asset_e ASSET_CC7_DIALOG_UNKNOWN = 0xcc7, + ASSET_CE6_DIALOG_GRUNTY_MMM_BRAMBLES = 0xCE6, + ASSET_CE7_DIALOG_GRUNTY_CCW_ICY_WATER_SWIM = 0xCE7, + ASSET_CE8_DIALOG_GRUNTY_CCW_ICY_WATER_UNUSED = 0xCE8, + ASSET_D2B_DIALOG_UNKNOWN = 0xd2b, ASSET_D32_DIALOG_MUTANT_CRAB_MEET = 0xD32, @@ -4387,7 +4425,7 @@ enum asset_e ASSET_D35_DIALOG_WONDERWING_LEARN, ASSET_D36_DIALOG_WONDERWING_REFRESHER, ASSET_D37_DIALOG_BOTTLES_ALL_CC_MOVES_LEARNED, - ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, + ASSET_D38_DIALOG_EMPTY, ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH, ASSET_D8F_DIALOG_MUMBO_MEET = 0xD8F, @@ -4403,6 +4441,14 @@ enum asset_e ASSET_D99_DIALOG_JINJO_MEET_GREEN, ASSET_D9A_DIALOG_JINJO_MEET_PINK, ASSET_D9B_DIALOG_JINJO_MEET_ORANGE, + ASSET_D9C_DIALOG_MUSIC_NOTE_MEET, + ASSET_D9D_DIALOG_MUMBO_TOKEN_MEET, + ASSET_D9E_DIALOG_BLUE_EGG_MEET, + ASSET_D9F_DIALOG_RED_FEATHER_MEET, + ASSET_DA0_DIALOG_GOLD_FEATHER_MEET, + ASSET_DA1_DIALOG_HONEYCOMB_MEET, + ASSET_DA2_DIALOG_EMPTY_HONEYCOMB_MEET, + ASSET_DA3_DIALOG_EXTRA_LIFE_MEET, ASSET_DA5_DIALOG_WADINGBOOTS_MEET = 0xDA5, ASSET_DA6_DIALOG_BEEHIVE_WITH_BEES, @@ -4421,6 +4467,7 @@ enum asset_e ASSET_DB3_DIALOG_SNS_EGG_1_TEXT = VER_SELECT(0xdb3, 0xa31, 0, 0), ASSET_DB4_DIALOG_SNS_EGG_2_TEXT, ASSET_DB5_DIALOG_ICE_KEY_TEXT, + ASSET_DB6_DIALOG_MUMBO_WISHYWASHY, ASSET_DF3_DIALOG_BOTTLES_INTRODUCTION = 0xDF3, ASSET_DF4_DIALOG_BOTTLES_CAMERA_CONTROL_LEARN, @@ -4431,16 +4478,16 @@ enum asset_e ASSET_DF9_DIALOG_BOTTLES_UNKNOWN, ASSET_DFA_DIALOG_BOTTLES_JUMP_REFRESHER, ASSET_DFB_DIALOG_BOTTLES_DIVE_LEARN, - ASSET_DFC_DIALOG_UNKNOWN, + ASSET_DFC_BOTTLES_UNDERWATER_TUTORIAL, ASSET_DFD_DIALOG_BOTTLES_SWIM_LEARN, ASSET_DFE_DIALOG_BOTTLES_DIVE_REFRESHER, ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN, ASSET_E00_DIALOG_BOTTLES_ATTACK_REFRESHER = 0xE00, ASSET_E01_DIALOG_BOTTLES_CLIMB_LEARN, - ASSET_E02_DIALOG_UNKNOWN, + ASSET_E02_DIALOG_BOTTLES_CLIMB_OTHER, ASSET_E03_DIALOG_BOTTLES_CLIMB_REFRESHER, ASSET_E04_DIALOG_BOTTLES_BEAK_BARGE_LEARN, - ASSET_E05_DIALOG_UNKNOWN, + ASSET_E05_DIALOG_BOTTLES_KAZOOIE_BARGE, ASSET_E06_DIALOG_BOTTLES_BEAK_BARGE_REFRESHER, ASSET_E07_DIALOG_BOTTLES_UNKNOWN, ASSET_E08_DIALOG_BOTTLES_FIND_ANOTHER_MOLEHILL, @@ -4473,11 +4520,14 @@ enum asset_e ASSET_E24_DIALOG_UNKNOWN = 0xE24, ASSET_E35_DIALOG_BOTTLES_BONUS_REMINDER = VER_SELECT(0xE35, 0xa77, 0, 0), - + ASSET_E36_DIALOG_BOTTLES_NO_BONUS = 0xE36, ASSET_E37_DIALOG_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN = 0xE37, // Talk to bottles after beating furnace fun ASSET_E38_DIALOG_CHEATING_ERASE_SAVE_CONFIRMATION, ASSET_E57_DIALOG_FIRST_JIGGY = VER_SELECT(0xF57, 0xabd, 0, 0), + ASSET_F58_DIALOG_FIRST_PICTURE_INSTRUCTION = 0xF58, + ASSET_F59_DIALOG_FIRST_PICTURE_FIRST_PIECE_ALREADY_OBTAINED = 0xF59, + ASSET_F5A_DIALOG_FIRST_PICTURE_FIRST_PIECE_OBTAINED_AFTER = 0xF5A, ASSET_F5B_DIALOG_MUMBO_MAGIC_GET_WEAK_FULL = 0xF5b, ASSET_F5C_DIALOG_MUMBO_MAGIC_GET_WEAK_ABREV, @@ -4491,16 +4541,48 @@ enum asset_e ASSET_F79_DIALOG_UNKNOWN = 0xf79, ASSET_F7A_DIALOG_UNKNOWN, + ASSET_F7B_DIALOG_BOTTLES_JIGSAW_PICTURE_MEET, - ASSET_FAD_DIALOG_UNKNOWN = 0xfad, + ASSET_FA8_EGG_CHEAT_ACTIVATION = 0xFA8, + ASSET_FA9_RED_FEATHER_CHEAT_ACTIVATION, + ASSET_FAA_GOLD_FEATHER_CHEAT_ACTIVATION, + ASSET_F7C_DIALOG_BOTTLES_REMOVE_PIECE_INSTRUCTIONS = 0xF7C, + ASSET_F7D_DIALOG_BOTTLES_EXPLAINS_PLACE_ALL = 0xF7D, + + ASSET_FAB_DIALOG_GRUNTY_DOOR_NEED_JIGGIES = 0xFAB, + + ASSET_FAD_DIALOG_DINGPOT_MEET = 0xFAD, + + ASSET_FBC_DIALOG_BOTTLES_OUT_OF_JIGGIES = 0xFBC, + ASSET_FBD_DIALOG_GRUNTY_NOT_ENOUGH_NOTES = 0xFBD, ASSET_FBE_DIALOG_CHEATING_ERASE_SAVE_WARNING = 0xFBE, ASSET_FBF_DIALOG_ERASED_SAVE, - ASSET_10A1_DIALOG_BRENTILDA_MEET = 0x10A1, - ASSET_10A2_DIALOG_UNKNOWN, + ASSET_FC0_DIALOG_GRUNTY_DOOR_HAVE_JIGGIES = 0xFC0, - ASSET_10E7_DIALOG_UNKNOWN = 0x10E7, + ASSET_1032_DIALOG_FF_FIRST_ANSWER_CORRECT = 0x1032, + ASSET_1033_DIALOG_FF_NEXT_ANSWER_CORRECT, + ASSET_1034_DIALOG_FF_GRUNTY_ANSWER_CORRECT, + ASSET_1035_DIALOG_FF_FIRST_ANSWER_WRONG, + ASSET_1036_DIALOG_FF_NEXT_ANSWER_WRONG, + ASSET_1037_DIALOG_FF_CHOICE_IS_YOURS_UNUSED, + ASSET_1038_DIALOG_FF_GET_HONEYCOMB, + ASSET_1039_DIALOG_FF_GET_EXTRA_LIFE, + ASSET_103A_DIALOG_FF_GET_JOKER, + ASSET_103B_DIALOG_FF_USE_JOKER, + ASSET_103C_DIALOG_FF_LOW_HEALTH, + ASSET_103D_DIALOG_FF_LOW_HEALTH_ON_SKULL, + + ASSET_10A1_DIALOG_BRENTILDA_MEET = 0x10A1, + ASSET_10A2_DIALOG_BRENTILDA_HEAL, + + ASSET_10E7_DIALOG_FINALBOSS_ENTERING_1 = 0x10E7, + ASSET_10E8_DIALOG_FINALBOSS_ENTERING_2 = 0x10E8, + ASSET_10E9_DIALOG_FINALBOSS_ENTERING_3 = 0x10E9, + ASSET_10EA_DIALOG_FINALBOSS_ENTERING_4 = 0x10E9, + ASSET_10EB_DIALOG_FINALBOSS_ENTERING_5 = 0x10E9, + ASSET_10EC_DIALOG_FINALBOSS_ENTERING_6 = 0x10EC, ASSET_10ED_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1 = 0x10ED, ASSET_10EE_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_2, @@ -5320,11 +5402,6 @@ enum ff_question_type_e{ FFQT_4_MINIGAME }; -enum common_particle_e{ - COMMON_PARTICLE_1_EGG_HEAD = 1, - COMMON_PARTICLE_4_EGG_ASS = 4 -}; - enum bsgroup_e { BSGROUP_0_NONE, BSGROUP_1_INTR, @@ -5400,4 +5477,13 @@ enum vegetable_e { VEGETABLE_3_COLLY_WOBBLE }; +enum static_camera_id_e { + STATIC_CAMERA_D_WALKWAY_JIGGY_DESTROY = 0xD, + STATIC_CAMERA_1E_MAZE_JIGGY_DESTROY = 0x1E +}; + +enum ba_timer_id { + BA_TIMER_HAZARDS = 4 +}; + #endif diff --git a/include/functions.h b/include/functions.h index f8f15848..bc28e861 100644 --- a/include/functions.h +++ b/include/functions.h @@ -31,7 +31,7 @@ extern f32 fabsf(f32); _SHIFTL((vol*1023), 21, 11) + _SHIFTL(sample_rate >> 5, 11, 10) + _SHIFTL(sfx_e, 0, 11)\ ) -#define FUNC_8030E8B4(sfx_e, vol, sample_rate, position, e, f) func_8030E8B4(\ +#define sfx_playFadeShorthandDefault(sfx_e, vol, sample_rate, position, e, f) sfx_playFadeShorthand(\ _SHIFTL((vol*1023), 21, 11) + _SHIFTL(sample_rate >> 5, 11, 10) + _SHIFTL(sfx_e, 0, 11), \ position, \ _SHIFTL(e, 0, 16) + _SHIFTL(f, 16, 16)\ @@ -90,7 +90,7 @@ s32 bs_getState(void); s32 bs_getNextState(void); void bs_updateState(void); s32 bs_checkInterrupt(enum bs_interrupt_e arg0); -void func_8029A86C(s32 arg0); +void bs_setInterruptResponse(s32 arg0); enum bs_interrupt_e bs_getInterruptType(void); /* vla - variable length array*/ @@ -216,7 +216,7 @@ OSMesgQueue *pfsManager_getFrameReplyQ(void); void baMotor_80250D94(f32, f32, f32); -void func_8025A6EC(enum comusic_e, s32); +void coMusicPlayer_playMusic(enum comusic_e, s32); void comusic_playTrack(enum comusic_e); void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2); @@ -251,13 +251,13 @@ void baeyes_openSingleEye(s32, f32); void bafalldamage_start(void); void func_80293D48(f32, f32); f32 func_80294438(void); -f32 func_80294500(void); +f32 floor_getCurrentFloorYPosition(void); BKCollisionTri *func_802946F0(void); void func_80294980(f32 arg0[3]); f32 get_slope_timer(void); f32 get_turbo_duration(void); void func_80295C08(void (* arg0)(void)); -void func_80297CCC(f32); +void bsiFrame_startWithValue(f32); f32 pitch_getIdeal(void); void pitch_setAngVel(f32, f32); void func_80298528(f32); @@ -314,7 +314,7 @@ void func_802D6264(f32, enum map_e, s32, s32, s32, enum file_progress_e); Actor *func_802DC7E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void particleEmitter_emitN(ParticleEmitter *, int); -void func_802EFA20(ParticleEmitter *, f32, f32); +void particleEmitter_func_802EFA20(ParticleEmitter *, f32, f32); ParticleEmitter *partEmitMgr_defragEmitter(ParticleEmitter *); ParticleEmitter *func_802F4094(f32[3], f32); @@ -330,28 +330,28 @@ BKModelBin *func_8030A428(s32); u8 sfxsource_createSfxsourceAndReturnIndex(void); void sfxsource_setSfxId(u8 indx, enum sfx_e uid); void sfxsource_playSfxAtVolume(u8, f32); -void func_8030DD14(u8, int); +void sfxSource_setunk43_7ByIndex(u8, int); void sfxsource_set_position(u8, f32[3]); void func_8030DFF0(u8, s32); void func_8030E04C(u8, f32, f32, f32); void func_8030E0FC(u8, f32, f32, f32); f32 func_8030E200(u8); -void func_8030E2C4(u8); -void func_8030E394(u8 indx); +void sfxSource_func_8030E2C4(u8); +void sfxSource_triggerCallbackByIndex(u8 indx); void sfxsource_playHighPriority(enum sfx_e uid); void func_8030E4E4(enum sfx_e uid); -void sfxsource_play(enum sfx_e uid, s32 sample_rate); -void func_8030E540(enum sfx_e uid); +void gcsfx_playAtSampleRate(enum sfx_e uid, s32 sample_rate); +void gcsfx_play(enum sfx_e uid); void func_8030E560(enum sfx_e uid, s32 arg1); void func_8030E58C(enum sfx_e uid, f32 arg1); void func_8030E5F4(enum sfx_e uid, f32 arg1); void func_8030E624(u32); -void func_8030E6A4(enum sfx_e uid, f32 arg1, s32 arg2); +void gcsfx_playWithPitch(enum sfx_e uid, f32 pitch, s32 arg2); void func_8030E6D4(enum sfx_e uid); void func_8030E704(enum sfx_e uid); void func_8030E760(enum sfx_e uid, f32 arg1, s32 arg2); void func_8030E878(enum sfx_e uid, f32 arg1, u32 arg2, f32 arg3[3], f32 arg4, f32 arg5); -void func_8030E8B4(u32,f32 [3], u32); +void sfx_playFadeShorthand(u32,f32 [3], u32); void func_8030E988(enum sfx_e uid, f32 arg1, u32 arg2, f32 arg3[3], f32 arg4, f32 arg5); void func_8030E9C4(enum sfx_e uid, f32 arg1, u32 arg2, f32 arg3[3], f32 arg4, f32 arg5); void func_8030EAAC(enum sfx_e uid, f32 arg1, s32 arg2, s32 arg3); @@ -450,7 +450,7 @@ void sfxsource_set_fade_distances(u8, f32, f32); void func_8030DB04(u8, s32, f32 position[3], f32, f32); -void func_802E4078(enum map_e map, s32 exit, s32 transition); +void transitionToMap(enum map_e map, s32 exit, s32 transition); void levelSpecificFlags_set(s32, s32); void func_803228D8(void); @@ -479,7 +479,7 @@ void __spawnQueue_add_1(GenFunction_1, s32); void func_802FAD64(enum item_e); void nodeprop_getPosition(NodeProp *, f32[3]); -bool gcdialog_showText(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32)); +bool gcdialog_showDialog(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32)); void ability_unlock(enum ability_e); extern void func_802EE278(Actor *, s32, s32, s32, f32, f32); diff --git a/include/music.h b/include/music.h index 6d5f5ae0..ac5992b5 100644 --- a/include/music.h +++ b/include/music.h @@ -11,7 +11,7 @@ typedef struct struct_B_s{ f32 unk10; } structBs; -typedef struct music_track_s{ +typedef struct music_track_s { s16 unk0; u8 unk2; u8 unk3; @@ -25,10 +25,9 @@ typedef struct music_track_s{ u8 unk192[0xE]; } MusicTrack; -typedef struct music_track_meta_s{ +typedef struct music_track_meta_s { char *name; - u16 unk4; - // u8 pad6[2]; -}MusicTrackMeta; + u16 volume; +} MusicTrackMeta; #endif diff --git a/include/prop.h b/include/prop.h index 4b304747..5e4e2520 100644 --- a/include/prop.h +++ b/include/prop.h @@ -87,7 +87,7 @@ typedef struct actorMarker_s{ MarkerCollisionFunc dieFunc; s32 unk20; ActorUpdateFunc actorUpdateFunc; - s32 unk28; + s32 commonParticleIndex; u32 actrArrayIdx:11; //unk2C u32 pitch:9; u32 roll:9; @@ -99,7 +99,7 @@ typedef struct actorMarker_s{ s16 unk38[3]; u16 pad3E_15:1; u16 modelId:13; - u16 unk3E_1:1; + u16 isBanjoOnTop: TRUE; u16 unk3E_0:1; //scaled u32 unk40_31:4; u32 unk40_27:4; @@ -200,7 +200,7 @@ typedef struct actor_s{ f32 unk74; u32 unk78_31:9; u32 unk78_22:9; - u32 unk78_13:12; //default_spawn_yaw? + u32 secondaryId:12; //default_spawn_yaw? This seems to be a different ID to differentiate actors that are the same- IE orange switches or tolls u32 stored_anctrl_forwards:1; //animCtrlDirection u32 stored_anctrl_smoothTransistion:1; //animCtrlSmoothTransition union @@ -230,12 +230,13 @@ typedef struct actor_s{ u32 unkF4_22:1; u32 initialized:1; //unkF4_21; u32 unkF4_20:12; - u32 unkF4_8:9; /* jinjo id in final fight. + u32 actorTypeSpecificField:9; /* jinjo id in final fight. * Is used to determine file progress related stuff, can also be a file_progress_e + * Also related to jigsaw pictures, as an id for each */ f32 stored_anctrl_subrangeMin; //animCtrl_SubRangeStart f32 stored_anctrl_subrangeMax; //animCtrl_SubRangeEnd - ActorMarker *unk100; // child actor marker ? + ActorMarker *partnerActor; // child actor marker ? Calling this "partner" since it seems to relate to actors that are "paired" and not necessarily parent/child ActorMarker *unk104; Struct62s *unk108; // void ( *unk108)(struct actorMarker_s *, s32); //saved from marker->collisionFunc diff --git a/include/structs.h b/include/structs.h index b0a2d953..a9199bf8 100644 --- a/include/structs.h +++ b/include/structs.h @@ -252,7 +252,7 @@ typedef struct struct_8_s{ typedef struct struct_11_s{ f32 unk0; f32 unk4; - s32 unk8; + s32 volume; s32 unkC; s16 track_id; //trackId s16 unk12; @@ -268,10 +268,10 @@ typedef struct struct_12_s{ s32 unk1; } struct12s; -typedef struct struct_13_s{ +typedef struct dialog_s { s32 cmd; u8* str; -}struct13s; +} BKDialog; typedef struct struct_14_s{ s16 unk0; diff --git a/manual_syms.pal.txt b/manual_syms.pal.txt index b928bb49..b4579dcc 100644 --- a/manual_syms.pal.txt +++ b/manual_syms.pal.txt @@ -65,11 +65,11 @@ func_80293F0C = 0x80293d2c; func_80294438 = 0x80294258; func_80294480 = 0x802942a0; -func_80294500 = 0x80294320; +floor_getCurrentFloorYPosition = 0x80294320; func_8029453C = 0x8029435c; func_80294548 = 0x80294368; func_80294554 = 0x80294374; -func_80294574 = 0x80294394; +floor_isCurrentFloorunk59 = 0x80294394; func_80294610 = 0x80294430; func_802946F0 = 0x80294510; bacarry_reset_marker = 0x80294700; @@ -104,7 +104,7 @@ baphysics_set_target_horizontal_velocity = 0x802977b0; baphysics_get_velocity = 0x802978c8; baphysics_get_vertical_velocity = 0x802978ec; baphysics_set_goto_position = 0x80297a04; -func_80297C6C = 0x80297aac; +bsiFrame_getState = 0x80297aac; pitch_setIdeal = 0x80297d7c; pitch_applyIdeal = 0x80297dc4; pitch_get = 0x80297dd8; @@ -145,7 +145,7 @@ func_8029C0D0 = 0x8029bf10; func_8029C834 = 0x8029c674; func_8029CDA0 = 0x8029cbe0; func_8029CF20 = 0x8029cd60; -func_8029D66C = 0x8029d4ac; +isPlayerInHazard = 0x8029d4ac; bsant_inSet = 0x8029e3d8; bsbbarge_hitboxActive = 0x8029f484; bsbbuster_hitboxActive = 0x8029fa98; @@ -168,7 +168,7 @@ bsswim_inset = 0x802b5594; bstwirl_hitboxActive = 0x802b68b0; func_802B6F9C = 0x802b6e0c; bswalrus_inSledSet = 0x802b8000; -func_802BAFE4 = 0x802bae54; +gcStaticCamera_activate = 0x802bae54; func_802BB360 = 0x802bb1d0; func_802BB378 = 0x802bb1e8; func_802BB3AC = 0x802bb21c; @@ -182,7 +182,7 @@ spawnQueue_func_802C3A18 = 0x802C3898; spawnQueue_flush = 0x802c38b8; __spawnQueue_add_4 = 0x802c3d84; spawnQueue_actor_s16 = 0x802c400c; -func_802C5A30 = 0x802c5b20; +gameSelect_getGameNumber = 0x802c5b20; chjiggy_getJiggyId = 0x802c8248; func_802C9C14 = 0x802c9dd4; func_802CA1C4 = 0x802ca384; @@ -214,7 +214,7 @@ func_802E3580 = 0x802E3770; dummy_func_802E35D0 = 0x802E37C0; func_802E35D8 = 0x802E37c8; game_draw = 0x802E417c; -func_802E4078 = 0x802e4268; +transitionToMap = 0x802e4268; func_802E4170 = 0x802E4360; func_802E4214 = 0x802E4404; func_802E4384 = 0x802e4574; @@ -246,8 +246,8 @@ freelist_new = 0x802ede64; freelist_freeElement = 0x802edebc; freelist_defrag = 0x802edee0; func_802EE354 = 0x802ee534; -func_802EE6CC = 0x802ee8ac; -func_802F1294 = 0x802f1474; +dustEmitter_emit = 0x802ee8ac; +pem_freeEmitters = 0x802f1474; fxSparkle_emptyHoneycomb = 0x802f38bc; fxSparkle_honeycomb = 0x802f391c; fxSparkle_musicNote = 0x802f397c; @@ -282,18 +282,18 @@ sfxsource_freeSfxsourceByIndex = 0x8030dbe4; sfxsource_setSfxId = 0x8030dc20; sfxsource_setSampleRate = 0x8030dc5c; sfxsource_playSfxAtVolume = 0x8030dd54; -func_8030E2C4 = 0x8030e464; +sfxSource_func_8030E2C4 = 0x8030e464; sfxsource_playHighPriority = 0x8030e624; func_8030E58C = 0x8030e72c; func_8030E624 = 0x8030e7c4; -func_8030E6A4 = 0x8030e844; +gcsfx_playWithPitch = 0x8030e844; func_8030E6D4 = 0x8030e874; func_8030ED70 = 0x8030ef10; -func_8030E394 = 0x8030e534; +sfxSource_triggerCallbackByIndex = 0x8030e534; func_803012F8 = 0x803014d8; fxairscore_count_to_time = 0x80301f5c; -gcdialog_showText = 0x803116cc; -func_803114B0 = 0x803116fc; +gcdialog_showDialog = 0x803116cc; +gcdialog_hasCurrentTextId = 0x803116fc; gcpausemenu_80314AC8 = 0x80314e1c; func_8031B908 = 0x8031bce8; @@ -395,9 +395,9 @@ func_8034B9BC = 0x8034be20; func_8034BB48 = 0x8034bfac; func_8034C630 = 0x8034ca90; func_8034E698 = 0x8034eaf8; -func_8035644C = 0x803568ac; -func_8035646C = 0x803568cc; -volatileFlag_setAndTriggerDialog_4 = 0x803569a0; +progressDialog_showDialogMaskZero = 0x803568ac; +progressDialog_showDialogMaskFour = 0x803568cc; +progressDialog_setAndTriggerDialog_4 = 0x803569a0; core2_TEXT_END = 0x80363a00; diff --git a/src/BGS/ch/code_2270.c b/src/BGS/ch/code_2270.c index 874cfff8..9b8afb62 100644 --- a/src/BGS/ch/code_2270.c +++ b/src/BGS/ch/code_2270.c @@ -65,11 +65,11 @@ void chTiptup_activateTimer(ActorMarker *this){ } void chTiptup_sfxCorrectHit(void){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } void chTiptup_sfxIncorrectHit(void){ - func_8025A6EC(COMUSIC_2C_BUZZER, 28000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 28000); } void chTiptup_textEvent(ActorMarker *this, enum asset_e text_id, s32 arg2){ @@ -147,14 +147,14 @@ void chTiptup_setState(Actor *this, s32 arg1){ this->has_met_before = TRUE; if (unqPtr->unkA == 0) { - gcdialog_showText(ASSET_C72_DIALOG_UNKNOWN, 0xe, this->position, this->marker, chTiptup_textEvent, 0); + gcdialog_showDialog(ASSET_C72_DIALOG_UNKNOWN, 0xe, this->position, this->marker, chTiptup_textEvent, 0); } else { - gcdialog_showText(ASSET_C74_DIALOG_UNKNOWN, 0xf, this->position, this->marker, chTiptup_textEvent, 0); + gcdialog_showDialog(ASSET_C74_DIALOG_UNKNOWN, 0xf, this->position, this->marker, chTiptup_textEvent, 0); } } else { - gcdialog_showText(D_80390854[unqPtr->unkA], 0xf, this->position, this->marker, chTiptup_textEvent, 0); + gcdialog_showDialog(D_80390854[unqPtr->unkA], 0xf, this->position, this->marker, chTiptup_textEvent, 0); } } if(this->state == 3){ @@ -206,7 +206,7 @@ void chTiptup_setState(Actor *this, s32 arg1){ }//L80388D8C if(this->state == 6){ if(unqPtr->unkA == 3){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } func_80324E38(0.5f, 3); timed_setStaticCameraToNode(1.5f, 1); @@ -235,7 +235,7 @@ void chTiptup_choirHitReaction(ActorMarker *this, s32 arg1){ thisActor = marker_getActor(this); unqPtr = (ActorLocal_Tiptup *)&thisActor->local; if((s32)unqPtr->unk0 >= (s32) vector_size(unqPtr->unk4)){ - if(!mapSpecificFlags_get(0) && gcdialog_showText(ASSET_C76_DIALOG_UNKNOWN, 0, 0, 0, 0, 0)) + if(!mapSpecificFlags_get(0) && gcdialog_showDialog(ASSET_C76_DIALOG_UNKNOWN, 0, 0, 0, 0, 0)) mapSpecificFlags_set(0,1); }else{ tmp = (Struct_BGS_2270_0s *)vector_at(unqPtr->unk4, unqPtr->unk0); @@ -245,7 +245,7 @@ void chTiptup_choirHitReaction(ActorMarker *this, s32 arg1){ else{ func_8028F55C(1, thisActor->marker); timedFunc_set_0(0.5f, chTiptup_sfxIncorrectHit); - if(!mapSpecificFlags_get(1) && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) && gcdialog_showText(0xc75, 0, NULL, NULL, NULL, NULL)) + if(!mapSpecificFlags_get(1) && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) && gcdialog_showDialog(0xc75, 0, NULL, NULL, NULL, NULL)) mapSpecificFlags_set(1,TRUE); } } @@ -342,7 +342,7 @@ void chTiptup_update(Actor *this){ if(this->state == 6){ if(ml_vec3f_distance(this->position, player_position) < 300.0f && !unqPtr->unk8){ unqPtr->unk8 = 1; - gcdialog_showText(0xc7d, 4, 0, 0, 0, 0); + gcdialog_showDialog(0xc7d, 4, 0, 0, 0, 0); } } } diff --git a/src/BGS/ch/code_8A60.c b/src/BGS/ch/code_8A60.c deleted file mode 100644 index 0b6b181b..00000000 --- a/src/BGS/ch/code_8A60.c +++ /dev/null @@ -1,108 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern void timedFunc_set_0(f32, void (*)(void)); - -void chLongSwampSwitch_update(Actor *this); -void chShortSwampSwitch_update(Actor *this); - -ActorAnimationInfo chSwampSwitchAnimations[] = { - {0x00, 0.0f}, - {0x00, 0.0f}, - {ASSET_D4_ANIM_SWITCH_DOWN, 0.15f}, - {ASSET_D5_ANIM_SWITCH_UP, 0.5f}, - {0x00, 0.0f}, - {0x00, 0.0f}, - {ASSET_D4_ANIM_SWITCH_DOWN, 0.15f}, - {ASSET_D5_ANIM_SWITCH_UP, 0.5f}, - {ASSET_D5_ANIM_SWITCH_UP, 1e+8f} -}; -ActorInfo chLongSwampSwitch = {MARKER_F5_BGS_ELEVATED_WALKWAY_SWITCH, ACTOR_14E_BGS_ELEVATED_WALKWAY_SWITCH, ASSET_3F5_BGS_JIGGY_SWITCH, 1, chSwampSwitchAnimations, chLongSwampSwitch_update, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; -ActorInfo chShortSwampSwitch = {MARKER_FD_BGS_MAZE_SWITCH, ACTOR_1FB_BGS_MAZE_SWITCH, ASSET_3F5_BGS_JIGGY_SWITCH, 1, chSwampSwitchAnimations, chShortSwampSwitch_update, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; - -void chLongSwampSwitch_jiggySpawn(void){ - f32 sp24[3]; - - if(nodeProp_findPositionFromActorId(0x14d, sp24)){ - jiggy_spawn(JIGGY_20_BGS_ELEVATED_WALKWAY, 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]) - ); - } -} - -void chLongSwampSwitch_update(Actor *this){ - func_8038EA90(); - if(mapSpecificFlags_get(7)){ - mapSpecificFlags_set(7, 0); - if(!mapSpecificFlags_get(3) || (item_getCount(0) > 0)){ - func_802D68F0(45); - } - } - if(!mapSpecificFlags_get(5)){ - func_802D4928(this, 1, 6, 7); //something with switch collision - } - if(mapSpecificFlags_get(2)){ - this->velocity_x = 0.0f; - mapSpecificFlags_set(3,0); - mapSpecificFlags_set(4,0); - mapSpecificFlags_set(1,0); - mapSpecificFlags_set(2,0); - } - if( this->velocity_x == 0.0f && mapSpecificFlags_get(1)){ - this->velocity_x = 1.0f; - func_802BAFE4(0xc); - timedFunc_set_0(1.2f, chLongSwampSwitch_jiggySpawn); - } //L8038EFB4 - if( this->velocity_x != 0.0f && !mapSpecificFlags_get(3) && func_802BB270()){ - mapSpecificFlags_set(3,1); - func_802D68F0(45); //adjusts timer - item_set(ITEM_6_HOURGLASS,1); - } //L8038EFB4 -} - -void chShortSwampSwitch_jiggySpawn(void){ - f32 sp24[3]; - - if(nodeProp_findPositionFromActorId(0x1fc, sp24)){ - jiggy_spawn(JIGGY_25_BGS_MAZE, 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]) - ); - } -} - -void chShortSwampSwitch_update(Actor *this){ - func_8038EA90(); - if(mapSpecificFlags_get(8)){ - mapSpecificFlags_set(8, 0); - if(!mapSpecificFlags_get(0xC) || (item_getCount(0) > 0)){ - func_802D68F0(10); - } - } - if(!mapSpecificFlags_get(9)){ - func_802D4928(this, 0xA, 6, 7); - } - if(mapSpecificFlags_get(0xB)){ - this->velocity_x = 0.0f; - mapSpecificFlags_set(0xC,0); - mapSpecificFlags_set(0xD,0); - mapSpecificFlags_set(0xA,0); - mapSpecificFlags_set(0xB,0); - } - if( this->velocity_x == 0.0f && mapSpecificFlags_get(0xA)){ - this->velocity_x = 1.0f; - func_802BAFE4(0x1D); - timedFunc_set_0(1.2f, chShortSwampSwitch_jiggySpawn); - } //L8038EFB4 - if( this->velocity_x != 0.0f && !mapSpecificFlags_get(0xC) && func_802BB270()){ - mapSpecificFlags_set(0xC,1); - func_802D68F0(10); //adjusts timer - item_set(ITEM_6_HOURGLASS,1); - } //L8038EFB4 -} diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index f8b7b4cf..8acd0167 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -9,7 +9,7 @@ extern void func_803289EC(Actor *, f32, s32); extern void func_80326310(Actor *); extern void actor_setOpacity(Actor *, s32); extern void __spawnQueue_add_2(void (*)(s32, s32), s32, s32); -extern void func_802BAFE4(s32 arg0); +extern void gcStaticCamera_activate(s32 arg0); @@ -37,7 +37,7 @@ ActorInfo D_80390804 ={MARKER_FC_CROCTUS, ACTOR_1FA_CROCTUS, ASSET_425_MODEL_CRO /* .code */ void func_80387C90(Actor *arg0){ - anctrl_setDuration(arg0->anctrl, 0.4 + 0.9999999999999999 * ((f32)(5 - arg0->unkF4_8) * 0.25)); + anctrl_setDuration(arg0->anctrl, 0.4 + 0.9999999999999999 * ((f32)(5 - arg0->actorTypeSpecificField) * 0.25)); } void func_80387D18(ActorMarker * arg0, u32 arg1){ @@ -47,7 +47,7 @@ void func_80387D18(ActorMarker * arg0, u32 arg1){ this = marker_getActor(arg0); nextActPtr = spawn_child_actor(0x6A, &this); nextActPtr->state = 2; - nextActPtr->unkF4_8 = 0x8C; + nextActPtr->actorTypeSpecificField = 0x8C; nextActPtr->lifetime_value = 3.0f; nextActPtr->unk38_31 = arg1; if(arg0); @@ -64,9 +64,9 @@ void *func_80387D90(ActorMarker * arg0){ spawnPos[1] = this->position_y; spawnPos[2] = this->position_z; marker->propPtr->unk8_3 = 0; - func_802BAFE4(0x19); + gcStaticCamera_activate(0x19); jiggy_spawn(JIGGY_22_CROCTUS, spawnPos); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); } void func_80387E00(s32 arg0){ @@ -94,8 +94,8 @@ void func_80387E68(ActorMarker *caller, enum asset_e text_id, s32 arg2){ func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); subaddie_set_state_with_direction(this, 5, 0.79f, 1); func_80326310(this); //did not disappear when moved, after cutscene still there with collision but broken - bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE; - timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->unkF4_8])); + bgs_D_803907B8[this->actorTypeSpecificField]->propPtr->unk8_4 = TRUE; + timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->actorTypeSpecificField])); timed_setStaticCameraToNode(0.8f, 9); func_80324DBC(3.4f, 0xC87, 0xE, NULL, NULL, func_80387E68, NULL); __spawnQueue_add_2((GenFunction_2) func_80387D18, reinterpret_cast(s32, this->marker), 0x46); @@ -115,16 +115,16 @@ void func_80387FD4(Actor *this){ return; } this->volatile_initialized = TRUE; - if(bgs_D_803907B8[this->unkF4_8 - 1] == 0){ - bgs_D_803907B8[this->unkF4_8 - 1] = this->marker; - for(j = this->unkF4_8; j < 6; j++){ + if(bgs_D_803907B8[this->actorTypeSpecificField - 1] == 0){ + bgs_D_803907B8[this->actorTypeSpecificField - 1] = this->marker; + for(j = this->actorTypeSpecificField; j < 6; j++){ if(bgs_D_803907B8[j] != NULL){ bgs_D_803907B8[j]->propPtr->unk8_4 = FALSE; actor_setOpacity(marker_getActor(bgs_D_803907B8[j]), 0); } }//L803880C8 - for( j = this->unkF4_8 - 2; j >= 0 && bgs_D_803907B8[j] == NULL; j--); + for( j = this->actorTypeSpecificField - 2; j >= 0 && bgs_D_803907B8[j] == NULL; j--); if(j >= 0){ @@ -140,10 +140,10 @@ void func_80387FD4(Actor *this){ if(this->unk38_31){ if ((this->state != 5) && (this->state != 6)) { - func_8025A6EC(COMUSIC_2B_DING_B, 28000); //TODO ISSUE HERE - if (this->unkF4_8 == 1) { + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); + if (this->actorTypeSpecificField == 1) { func_8028F94C(2, this->position); - gcdialog_showText(ASSET_C86_DIALOG_UNKNOWN, 0xE, this->position, this->marker, func_80387E68, NULL); + gcdialog_showDialog(ASSET_C86_DIALOG_UNKNOWN, 0xE, this->position, this->marker, func_80387E68, NULL); subaddie_set_state_with_direction(this, 6, 0.79f, 1); } else { timed_playSfx(0.4f, SFX_C9_PAUSEMENU_ENTER, 1.0f, 32000); //0.4f @@ -151,15 +151,15 @@ void func_80387FD4(Actor *this){ func_80324CFC(0.4f, COMUSIC_43_ENTER_LEVEL_GLITTER, 22000); func_80324D2C(4.5f, COMUSIC_43_ENTER_LEVEL_GLITTER); subaddie_set_state_with_direction(this, 5, 0.79f, 1); - if (this->unkF4_8 == 5) { + if (this->actorTypeSpecificField == 5) { timedFunc_set_1(0.9f, (GenFunction_1) func_80387E40, (s32) this->marker); } else { func_80326310(this); } - if (this->unkF4_8 < 5) { - bgs_D_803907B8[this->unkF4_8]->propPtr->unk8_4 = TRUE; - timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->unkF4_8])); - func_802BAFE4(D_803907B0[this->unkF4_8-1]); + if (this->actorTypeSpecificField < 5) { + bgs_D_803907B8[this->actorTypeSpecificField]->propPtr->unk8_4 = TRUE; + timedFunc_set_1(1.1f, (GenFunction_1)func_80387E00, reinterpret_cast(s32, bgs_D_803907B8[this->actorTypeSpecificField])); + gcStaticCamera_activate(D_803907B0[this->actorTypeSpecificField-1]); } else { timedFunc_set_1(0.8f, (GenFunction_1)func_80387D90, (s32) this->marker); } @@ -187,7 +187,7 @@ void func_80387FD4(Actor *this){ case 3:// L80388434 this->lifetime_value += time_getDelta(); - if( this->lifetime_value >= 0.13 + 0.7/4 * (5 - this->unkF4_8)){ + if( this->lifetime_value >= 0.13 + 0.7/4 * (5 - this->actorTypeSpecificField)){ subaddie_set_state_with_direction(this, 4, 0.62f, 1); func_80387C90(this); this->lifetime_value = 0.0f; @@ -207,7 +207,7 @@ void func_80387FD4(Actor *this){ && !anctrl_isPlayedForwards(this->anctrl) && func_802BB270() ){ - func_8030E6A4(SFX_C8_CRUNCH, randf2(0.93f, 1.07f), 22000); + gcsfx_playWithPitch(SFX_C8_CRUNCH, randf2(0.93f, 1.07f), 22000); } break; @@ -227,6 +227,6 @@ void BGS_func_803885DC(void){ Actor *func_8038860C(ActorMarker *this, Gfx** gdl, Mtx ** mptr, Vtx **vtx){ Actor *thisActor; thisActor = marker_getActor(this); - func_8033A45C(1, thisActor->unkF4_8); + func_8033A45C(1, thisActor->actorTypeSpecificField); return actor_draw(this, gdl, mptr, vtx); } diff --git a/src/BGS/ch/flibbit.c b/src/BGS/ch/flibbit.c index 158abdc8..2c1dcabd 100644 --- a/src/BGS/ch/flibbit.c +++ b/src/BGS/ch/flibbit.c @@ -215,7 +215,7 @@ void func_80386AEC(Actor *this, s32 next_state) { } if (next_state == 5) { - FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500); skeletalAnim_set(this->unk148, ASSET_288_ANIM_FLIBBIT_OW, 0.1f, 0.65f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); this->position[1] = mapModel_getFloorY(this->position); @@ -224,7 +224,7 @@ void func_80386AEC(Actor *this, s32 next_state) { if (next_state == 6) { skeletalAnim_set(this->unk148, ASSET_112_ANIM_FLIBBIT_DIE, 0.2f, 0.4f); - FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500); this->marker->collidable = FALSE; this->unk10_1 = FALSE; local->unk14 = 1000.0f; @@ -232,7 +232,7 @@ void func_80386AEC(Actor *this, s32 next_state) { if (next_state == 7) { skeletalAnim_set(this->unk148, ASSET_113_ANIM_FLIBBIT_DEAD, 0.2f, 1.0f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); - FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); } if (next_state == 8) { func_80326310(this); diff --git a/src/BGS/ch/frogminigame.c b/src/BGS/ch/frogminigame.c index dc292ab2..1a36d663 100644 --- a/src/BGS/ch/frogminigame.c +++ b/src/BGS/ch/frogminigame.c @@ -56,10 +56,10 @@ void chFrogMinigame_setState(Actor * arg0, u32 next_state){ mapSpecificFlags_set(0x10, 1); if(!fileProgressFlag_get(FILEPROG_1B_MET_YELLOW_FLIBBITS)){ fileProgressFlag_set(FILEPROG_1B_MET_YELLOW_FLIBBITS, 1); - gcdialog_showText(text_flibbits_meet, 0xf, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); + gcdialog_showDialog(text_flibbits_meet, 0xf, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); }else{ if(!arg0->bgs_6730.unk8){ - gcdialog_showText(text_flibbits_return, 0x4, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); + gcdialog_showDialog(text_flibbits_return, 0x4, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); } else{ __chFrogMinigame_textCallback(arg0->marker, text_flibbits_return, 0); @@ -71,7 +71,7 @@ void chFrogMinigame_setState(Actor * arg0, u32 next_state){ s0->unk0 = 1; if(!s0->unk4){ func_8025A58C(0, 400); - func_8025A6EC(MUSIC_BGS_FLIBBIT_FIGHT, 30000); + coMusicPlayer_playMusic(MUSIC_BGS_FLIBBIT_FIGHT, 30000); s0->unk4 = 1; } else{ @@ -93,7 +93,7 @@ void chFrogMinigame_setState(Actor * arg0, u32 next_state){ } if (next_state == 4) { - gcdialog_showText(text_flibbits_defeat, 0xf, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); + gcdialog_showDialog(text_flibbits_defeat, 0xf, arg0->position, arg0->marker, __chFrogMinigame_textCallback, 0); } if(next_state == 5){ diff --git a/src/BGS/ch/leafboat.c b/src/BGS/ch/leafboat.c index 4e92abb6..71fc3ea5 100644 --- a/src/BGS/ch/leafboat.c +++ b/src/BGS/ch/leafboat.c @@ -41,7 +41,7 @@ Actor *chLeafBoat_draw(ActorMarker *this, Gfx** gdl, Mtx** mtx, Vtx **vtx){ } void func_8038FD88(ActorMarker *this, ActorMarker *other){ - this->unk3E_1 = 1; + this->isBanjoOnTop = 1; } void chLeafBoat_update(Actor *this){ @@ -155,7 +155,7 @@ void chLeafBoat_update(Actor *this){ _player_getPosition(player_position); if( func_80294660() == 0x100 && func_8028F20C() - && this->marker->unk3E_1 + && this->marker->isBanjoOnTop ){ sp44 = local->unk54[0] - player_position[0]; sp40 = local->unk54[2] - player_position[2]; @@ -184,7 +184,7 @@ void chLeafBoat_update(Actor *this){ } this->unk10_12 = 0; } - this->marker->unk3E_1 = 0; + this->marker->isBanjoOnTop = 0; local->unk18[1] = 10 * sinf((((this->lifetime_value * local->unk6C) / 180.0) * BAD_PI)); this->unk1C[0] = 4.5 * cosf((((this->lifetime_value * local->unk6C) / 180.0) * BAD_PI)); diff --git a/src/BGS/ch/mudhut.c b/src/BGS/ch/mudhut.c index a5f3fa99..07c5d4e5 100644 --- a/src/BGS/ch/mudhut.c +++ b/src/BGS/ch/mudhut.c @@ -103,12 +103,12 @@ void chMudHut_update(Actor *this){ diffPos[2] = this->position_z; diffPos[1] += 130.0; - FUNC_8030E8B4(SFX_5B_HEAVY_STUFF_FALLING, 1.0f, 28000, this->position, 0x12C, 0xBB8); + sfx_playFadeShorthandDefault(SFX_5B_HEAVY_STUFF_FALLING, 1.0f, 28000, this->position, 0x12C, 0xBB8); subaddie_set_state(this, 2); this->marker->propPtr->unk8_3 = 0; actor_playAnimationOnce(this); if(tmp == 5){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } __spawnQueue_add_1((GenFunction_1)chMudHut_spawnExplosion, reinterpret_cast(s32, this->marker)); diff --git a/src/BGS/ch/pinkegg.c b/src/BGS/ch/pinkegg.c index fbe9d792..d390ca15 100644 --- a/src/BGS/ch/pinkegg.c +++ b/src/BGS/ch/pinkegg.c @@ -84,7 +84,7 @@ void chPinkEgg_collision(ActorMarker *this, ActorMarker *other_marker){ thisActor = marker_getActor(this); this->propPtr->unk8_3 = 0; - sfxsource_play(SFX_AA_BGS_EGG_BREAKING_1, 28000); + gcsfx_playAtSampleRate(SFX_AA_BGS_EGG_BREAKING_1, 28000); subaddie_set_state(thisActor, 3); actor_playAnimationOnce(thisActor); this->collidable = FALSE; @@ -93,7 +93,7 @@ void chPinkEgg_collision(ActorMarker *this, ActorMarker *other_marker){ __spawnQueue_add_2(chPinkEgg_spawnNext, thisActor->marker, tmp->unk0); } else { jiggy_spawn(JIGGY_21_BGS_PINKEGG, thisActor->position); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } } diff --git a/src/BGS/ch/swampswitch.c b/src/BGS/ch/swampswitch.c new file mode 100644 index 00000000..9c2b0bbc --- /dev/null +++ b/src/BGS/ch/swampswitch.c @@ -0,0 +1,128 @@ +#include +#include "functions.h" +#include "variables.h" + +extern void timedFunc_set_0(f32, void (*)(void)); + +void chLongSwampSwitch_update(Actor *this); +void chShortSwampSwitch_update(Actor *this); + +ActorAnimationInfo chSwampSwitchAnimations[] = { + { 0x00, 0.0f }, + { 0x00, 0.0f }, + { ASSET_D4_ANIM_SWITCH_DOWN, 0.15f }, + { ASSET_D5_ANIM_SWITCH_UP, 0.5f }, + { 0x00, 0.0f }, + { 0x00, 0.0f }, + { ASSET_D4_ANIM_SWITCH_DOWN, 0.15f }, + { ASSET_D5_ANIM_SWITCH_UP, 0.5f }, + { ASSET_D5_ANIM_SWITCH_UP, 1e+8f } +}; + +ActorInfo chLongSwampSwitch = { + MARKER_F5_BGS_ELEVATED_WALKWAY_SWITCH, ACTOR_14E_BGS_ELEVATED_WALKWAY_SWITCH, ASSET_3F5_BGS_JIGGY_SWITCH, + 1, chSwampSwitchAnimations, chLongSwampSwitch_update, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0 }; +ActorInfo chShortSwampSwitch = { MARKER_FD_BGS_MAZE_SWITCH, ACTOR_1FB_BGS_MAZE_SWITCH, ASSET_3F5_BGS_JIGGY_SWITCH, + 1, chSwampSwitchAnimations, chShortSwampSwitch_update, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; + +void chLongSwampSwitch_jiggySpawn(void) { + f32 sp24[3]; + + if (!nodeProp_findPositionFromActorId(0x14d, sp24)) { + return; + } + + jiggy_spawn(JIGGY_20_BGS_ELEVATED_WALKWAY, 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]) + ); +} + +void chLongSwampSwitch_update(Actor *this){ + func_8038EA90(); + + // If the switch has been pressed, hitting it again resets the timer + if (mapSpecificFlags_get(BGS_SPECIFIC_FLAG_7)) { + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_7, FALSE); + if (!mapSpecificFlags_get(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING) || (item_getCount(ITEM_0_HOURGLASS_TIMER) > 0)) { + func_802D68F0(45); + } + } + + if (!mapSpecificFlags_get(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_SWITCH_PRESSED)) { + func_802D4928(this, BGS_SPECIFIC_FLAG_1, 6, 7); //something with switch collision + } + + if (mapSpecificFlags_get(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_RESET)) { + this->velocity_x = 0.0f; + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_1, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_RESET, FALSE); + } + + if (this->velocity_x == 0.0f && mapSpecificFlags_get(BGS_SPECIFIC_FLAG_1)) { + this->velocity_x = 1.0f; + gcStaticCamera_activate(0xc); + timedFunc_set_0(1.2f, chLongSwampSwitch_jiggySpawn); + } //L8038EFB4 + + if (this->velocity_x != 0.0f && !mapSpecificFlags_get(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING) && func_802BB270()) { + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING, TRUE); + func_802D68F0(45); //adjusts timer + item_set(ITEM_6_HOURGLASS, 1); + } //L8038EFB4 +} + +void chShortSwampSwitch_jiggySpawn(void){ + f32 sp24[3]; + + if (!nodeProp_findPositionFromActorId(0x1fc, sp24)) { + return; + } + + jiggy_spawn(JIGGY_25_BGS_MAZE, 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]) + ); +} + +void chShortSwampSwitch_update(Actor *this){ + func_8038EA90(); + + if (mapSpecificFlags_get(BGS_SPECIFIC_FLAG_8)) { + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_8, 0); + + if (!mapSpecificFlags_get(BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING) || (item_getCount(ITEM_0_HOURGLASS_TIMER) > 0)) { + func_802D68F0(10); + } + } + + if (!mapSpecificFlags_get(BGS_SPECIFIC_FLAG_MAZE_JIGGY_SWITCH_PRESSED)) { + func_802D4928(this, BGS_SPECIFIC_FLAG_A, 6, 7); + } + + if (mapSpecificFlags_get(BGS_SPECIFIC_FLAG_MAZE_JIGGY_RESET)) { + this->velocity_x = 0.0f; + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_MAZE_JIGGY, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_A, FALSE); + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_MAZE_JIGGY_RESET, FALSE); + } + + if (this->velocity_x == 0.0f && mapSpecificFlags_get(BGS_SPECIFIC_FLAG_A)) { + this->velocity_x = 1.0f; + gcStaticCamera_activate(0x1D); + timedFunc_set_0(1.2f, chShortSwampSwitch_jiggySpawn); + } //L8038EFB4 + + if (this->velocity_x != 0.0f && !mapSpecificFlags_get(BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING) && func_802BB270()) { + mapSpecificFlags_set(BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING, TRUE); + func_802D68F0(10); //adjusts timer + item_set(ITEM_6_HOURGLASS,1); + } //L8038EFB4 +} diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 5fa62ccc..9cd0e755 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -142,7 +142,7 @@ void func_8038F6A4(Actor *this) { if ((((ml_vec3f_distance(local->unk18, sp48) < 250.0f) && (ml_vec3f_distance(local->unk18, sp48) > 80.0f)) && (!player_movementGroup())) && (player_getTransformation() == TRANSFORM_1_BANJO)) { - gcdialog_showText(0xC7E, 0, 0, 0, 0, 0); + gcdialog_showDialog(0xC7E, 0, 0, 0, 0, 0); this->has_met_before = TRUE; } } @@ -163,7 +163,7 @@ void func_8038F6A4(Actor *this) if ((!this->unk138_23) && (!local->unk14)) { - if (gcdialog_showText(0xC80, 0, 0, 0, 0, 0)) + if (gcdialog_showDialog(0xC80, 0, 0, 0, 0, 0)) { this->unk138_23 = 1; } @@ -175,7 +175,7 @@ void func_8038F6A4(Actor *this) func_8038F610(this); if (actor_animationIsAt(this, 0.6f) && local->unk14) { - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_8028F94C(2, local->unk18); } if (actor_animationIsAt(this, 0.99f)) @@ -214,7 +214,7 @@ void func_8038F6A4(Actor *this) func_8028F918(0); if (jiggyscore_isCollected(JIGGY_26_BGS_TANKTUP) == 0) { - gcdialog_showText(0xC7F, 0xF, this->position, this->marker, func_8038F5E4, 0); + gcdialog_showDialog(0xC7F, 0xF, this->position, this->marker, func_8038F5E4, 0); } else { diff --git a/src/BGS/ch/yellowflibbit.c b/src/BGS/ch/yellowflibbit.c index 50e7810a..4a84784d 100644 --- a/src/BGS/ch/yellowflibbit.c +++ b/src/BGS/ch/yellowflibbit.c @@ -45,7 +45,7 @@ void func_8038D1E0(Actor *this) { particleEmitter_setParticleVelocityRange(temp_s0, -70.0f, 50.0f, -70.0f, 70.0f, 100.0f, 70.0f); particleEmitter_setParticleLifeTimeRange(temp_s0, 3.0f, 4.0f); particleEmitter_emitN(temp_s0, 4); - FUNC_8030E8B4(SFX_30_MAGIC_POOF, 1.0f, 25000, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_30_MAGIC_POOF, 1.0f, 25000, this->position, 500, 2500); } s32 func_8038D2F4(Actor *this, f32 *arg1, bool arg2) { @@ -239,7 +239,7 @@ void func_8038D9D0(Actor *this, s32 next_state) { local->unk1C = 1.0f; } if (next_state == 8) { - FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_8E_GRUNTLING_DAMAGE, 1.5f, 32200, this->position, 500, 2500); skeletalAnim_set(this->unk148, ASSET_288_ANIM_FLIBBIT_OW, 0.1f, 0.65f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); this->position[1] = mapModel_getFloorY(this->position); @@ -247,7 +247,7 @@ void func_8038D9D0(Actor *this, s32 next_state) { } if (next_state == 9) { skeletalAnim_set(this->unk148, ASSET_112_ANIM_FLIBBIT_DIE, 0.2f, 0.4f); - FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_115_BUZZBOMB_DEATH, 1.0f, 32200, this->position, 500, 2500); this->marker->collidable = FALSE; this->unk10_1 = FALSE; func_8038CEA0(); @@ -256,7 +256,7 @@ void func_8038D9D0(Actor *this, s32 next_state) { if (next_state == 0xA) { skeletalAnim_set(this->unk148, ASSET_113_ANIM_FLIBBIT_DEAD, 0.2f, 1.0f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); - FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); } if (next_state == 0xB) { func_80326310(this); diff --git a/src/BGS/ch/yumblie.c b/src/BGS/ch/yumblie.c index 11a90129..5b2c38ef 100644 --- a/src/BGS/ch/yumblie.c +++ b/src/BGS/ch/yumblie.c @@ -74,7 +74,7 @@ void chyumblie_set_state(Actor* this, enum chyumblie_state_e next_state){ skeletalAnim_set(this->unk148, (s0->unk4)? ASSET_12A_ANIM_GRUMBLIE_IDLE : ASSET_127_ANIM_YUMBLIE_IDLE, 0.1f, randf2(0.5f, 1.0f)); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_1_LOOP); if(s0->unk4){ - func_8030E6A4(SFX_C4_TWINKLY_MUNCHER_GRR,randf2(1.0f, 1.2), 30000); + gcsfx_playWithPitch(SFX_C4_TWINKLY_MUNCHER_GRR,randf2(1.0f, 1.2), 30000); }else{ func_8030E878(SFX_C3_HEGH,randf2(1.0f, 1.2), 30000, this->position, 500.0f, 3000.0f); } diff --git a/src/BGS/code_3030.c b/src/BGS/code_3030.c index ddbca14c..1127c88c 100644 --- a/src/BGS/code_3030.c +++ b/src/BGS/code_3030.c @@ -41,7 +41,7 @@ void chChoirTurtle_setState(Actor *this, s32 next_state) { timed_playSfx(0.8333333, SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF); } if (next_state == 3) { - func_8030E6A4(SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF); + gcsfx_playWithPitch(SFX_86_TIPTUP_CHORUS_AH, local->unk8, 0x7FFF); skeletalAnim_set(this->unk148, ASSET_12F_ANIM_CHOIR_TURTLE_HURT, 0.1f, 1.75f); skeletalAnim_setCallback_1(this->unk148, 0.9f, (GenFunction_1)chChoirTurtle_returnState, (s32)this->marker); if (local->tiptup_marker != NULL) { diff --git a/src/BGS/code_3420.c b/src/BGS/code_3420.c index f4c19a33..d7ef72a1 100644 --- a/src/BGS/code_3420.c +++ b/src/BGS/code_3420.c @@ -221,7 +221,7 @@ void func_80389C58(ActorMarker *marker) { this = marker_getActor(marker); local = (ActorLocal_BGS_3420 *)&this->local; BGS_func_80389850(this, 0); - gcdialog_showText(D_80390984[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389BF8, NULL); + gcdialog_showDialog(D_80390984[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389BF8, NULL); } void BGS_func_80389CD8(ActorMarker *marker, enum asset_e text_id, s32 arg2){ @@ -241,9 +241,9 @@ void func_80389D20(ActorMarker *marker) { local = (ActorLocal_BGS_3420 *)&this->local; BGS_func_80389850(this, 0); if (local->unkC == local->unkD) { - gcdialog_showText(D_803909A4[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, BGS_func_80389CD8, NULL); + gcdialog_showDialog(D_803909A4[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, BGS_func_80389CD8, NULL); } else { - gcdialog_showText(D_803909C0[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, BGS_func_80389CD8, NULL); + gcdialog_showDialog(D_803909C0[local->unkC], 0xF, chVile_getPostion(local->vile_marker), this->marker, BGS_func_80389CD8, NULL); } func_80347A14(0); } @@ -265,7 +265,7 @@ void func_80389E40(ActorMarker *marker) { local = (ActorLocal_BGS_3420 *)&this->local; BGS_func_80389850(this, 1); - gcdialog_showText(0xC6B, 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389DF8, NULL); + gcdialog_showDialog(0xC6B, 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389DF8, NULL); } void func_80389EAC(ActorMarker *marker, enum asset_e text_id, s32 arg2){ @@ -293,7 +293,7 @@ void func_80389F08(ActorMarker *marker) { var_s2 = actorArray_actorCount(ACTOR_49_EXTRA_LIFE); vile = marker_getActor(local->vile_marker); if (var_s2 > 0) { - func_8025A6EC(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8); + coMusicPlayer_playMusic(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8); } for(i = 0; i < 3; i++){ if (var_s2 < 3) { @@ -305,7 +305,7 @@ void func_80389F08(ActorMarker *marker) { item_inc(ITEM_16_LIFE); } } - gcdialog_showText(0xC98, 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389EAC, NULL); + gcdialog_showDialog(0xC98, 0xF, chVile_getPostion(local->vile_marker), this->marker, func_80389EAC, NULL); } @@ -327,22 +327,22 @@ void func_8038A068(Actor *this, s32 next_state) { func_8038C3B0(local->vile_marker); if (local->unkC == 3) { if (local->unkD >= 4) { - gcdialog_showText(0xC91, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); + gcdialog_showDialog(0xC91, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); } else { - gcdialog_showText((local->unkC == local->unkD) ? 0xC8D : 0xC90, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); + gcdialog_showDialog((local->unkC == local->unkD) ? 0xC8D : 0xC90, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); } } else { - gcdialog_showText((local->unkC == local->unkD) ? 0xC63 : 0xC6C, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); + gcdialog_showDialog((local->unkC == local->unkD) ? 0xC63 : 0xC6C, 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389B48, NULL); } } if (next_state == 3) { - gcdialog_showText(D_803909DC[local->unkC], 4, chVile_getPostion(local->vile_marker), this->marker, func_80389B98, NULL); + gcdialog_showDialog(D_803909DC[local->unkC], 4, chVile_getPostion(local->vile_marker), this->marker, func_80389B98, NULL); } if (next_state == 4) { if (local->unkC == local->unkD) { - gcdialog_showText(BGS_D_803909F8[local->unkC], 0xE | ((BGS_D_803909F8[local->unkC] == 0xC8E) ? 1 : 0) | 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389BC8, NULL); + gcdialog_showDialog(BGS_D_803909F8[local->unkC], 0xE | ((BGS_D_803909F8[local->unkC] == 0xC8E) ? 1 : 0) | 0xE, chVile_getPostion(local->vile_marker), this->marker, func_80389BC8, NULL); } else { - gcdialog_showText(D_80390A18[local->unkC], 0xF , chVile_getPostion(local->vile_marker), this->marker, func_80389BC8, NULL); + gcdialog_showDialog(D_80390A18[local->unkC], 0xF , chVile_getPostion(local->vile_marker), this->marker, func_80389BC8, NULL); } func_80347A14(0); } @@ -367,7 +367,7 @@ void func_8038A068(Actor *this, s32 next_state) { mapSpecificFlags_set(6, TRUE); func_8038C3DC(local->vile_marker); func_8025A58C(0, 4000); - timedFunc_set_2(1.0f, (GenFunction_2)func_8025A6EC, COMUSIC_55_BGS_MR_VILE, 28000); + timedFunc_set_2(1.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_55_BGS_MR_VILE, 28000); } } if (this->state == 5) { @@ -383,28 +383,28 @@ void func_8038A068(Actor *this, s32 next_state) { if (next_state == 6) { func_8038C3B0(local->vile_marker); func_80324E38(0.0f, 3); - timedFunc_set_2(1.0f, (GenFunction_2)func_8025A6EC, COMUSIC_3C_MINIGAME_LOSS, 28000); + timedFunc_set_2(1.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_3C_MINIGAME_LOSS, 28000); timedFunc_set_0(4.0f, (GenFunction_0)func_8038A044); timedFunc_set_1(4.0f, (GenFunction_1)func_80389C58, (s32) this->marker); } if (next_state == 8) { func_8038C3B0(local->vile_marker); func_80324E38(0.0f, 3); - timedFunc_set_2(1.0f, (GenFunction_2)func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000); + timedFunc_set_2(1.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_3B_MINIGAME_VICTORY, 28000); timedFunc_set_0(3.0f, (GenFunction_0)func_8038A044); timedFunc_set_1(3.0f, (GenFunction_1)func_80389D20, (s32) this->marker); } if (next_state == 9) { func_8038C3B0(local->vile_marker); func_80324E38(0.0f, 3); - timedFunc_set_2(1.0f, (GenFunction_2)func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000); + timedFunc_set_2(1.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_3B_MINIGAME_VICTORY, 28000); timedFunc_set_0(3.0f, (GenFunction_0)func_8038A044); timedFunc_set_1(3.0f, (GenFunction_1)func_80389E40, (s32) this->marker); } if (next_state == 0xA) { func_8038C3B0(local->vile_marker); func_80324E38(0.5f, 3); - timedFunc_set_2(1.0f, (GenFunction_2) func_8025A6EC, COMUSIC_3B_MINIGAME_VICTORY, 28000); + timedFunc_set_2(1.0f, (GenFunction_2) coMusicPlayer_playMusic, COMUSIC_3B_MINIGAME_VICTORY, 28000); timedFunc_set_1(3.0f, (GenFunction_1) func_80389F08, (s32) this->marker); } if (next_state == 7) { @@ -434,7 +434,7 @@ void chvilegame_player_consume_piece(Actor *this) { local->player_score++; if (local->player_score == 35) { item_inc(ITEM_16_LIFE); - func_8025A6EC(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8); + coMusicPlayer_playMusic(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FF8); } timedFunc_set_1(0.0f, (GenFunction_1)func_802FDCB8, ITEM_1A_PLAYER_VILE_SCORE); timedFunc_set_1(0.5f, (GenFunction_1)func_802FDCB8, ITEM_1A_PLAYER_VILE_SCORE); diff --git a/src/BGS/code_9750.c b/src/BGS/code_9750.c index 23c2b403..85ecb85d 100644 --- a/src/BGS/code_9750.c +++ b/src/BGS/code_9750.c @@ -71,7 +71,7 @@ void BGS_func_8038FB84(ActorMarker *this, ActorMarker *other_marker){ Actor *thisActor; thisActor = marker_getActor(this); - FUNC_8030E8B4( SFX_87_TANKTUP_OOOHW, 1.0f, 32750, thisActor->position, 1000, 3000); + sfx_playFadeShorthandDefault( SFX_87_TANKTUP_OOOHW, 1.0f, 32750, thisActor->position, 1000, 3000); timedFunc_set_2(0.65f, (GenFunction_2) func_8038FB40, (s32) this, (s32) other_marker); func_8038F51C(thisActor); this->collidable = FALSE; @@ -85,7 +85,7 @@ void func_8038FBF8(Actor *this){ } if(this->state == 2){ if(anctrl_isAt(this->anctrl, 0.65f)){ - func_8030E540(SFX_7C_CHEBOOF); + gcsfx_play(SFX_7C_CHEBOOF); } if(anctrl_isStopped(this->anctrl)){ marker_despawn(this->marker); diff --git a/src/CC/code_0.c b/src/CC/code_0.c index a19ffa4f..043ab26e 100644 --- a/src/CC/code_0.c +++ b/src/CC/code_0.c @@ -97,7 +97,7 @@ void func_803864D4(Actor *this){ {//L80386734 sp2C = local->unk8/1.0; if(local->unkC && 0.6 < sp2C){ - FUNC_8030E8B4(SFX_91_METALLIC_SOUND, 1.0, 32000, this->position, 100, 6000); + sfx_playFadeShorthandDefault(SFX_91_METALLIC_SOUND, 1.0, 32000, this->position, 100, 6000); local->unkC = 0; }//L80386798 sin_result = sinf(((sp2C*90.0)/180.0)*BAD_PI); diff --git a/src/CC/code_1B90.c b/src/CC/code_1B90.c index d5fcd5bf..aaa1c25f 100644 --- a/src/CC/code_1B90.c +++ b/src/CC/code_1B90.c @@ -47,10 +47,10 @@ void func_8038803C(s32 arg0){ func_80387FE8(); D_80389F90.unk8 = 1.0f; } - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } else{//L803880BC - func_8025A6EC(COMUSIC_2C_BUZZER, 28000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 28000); } } @@ -84,7 +84,7 @@ void func_8038817C(void){ D_80389F90.unk4 += sp20; player_getPosition(sp24); if(ml_timer_update(&D_80389F90.unk8, sp20)){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_80324E38(0.0f, 3); timed_setStaticCameraToNode(2.0f, 0); timedJiggySpawn(2.1f, JIGGY_1C_CC_RINGS, D_80389BF0); @@ -104,7 +104,7 @@ void func_8038817C(void){ || (D_80389F90.unk0 < 9 && item_empty(ITEM_6_HOURGLASS)) ){ func_80387FE8(); - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 28000); func_803880D4(); func_80388104(); } diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index 8ae8ca4e..168ef897 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -78,7 +78,7 @@ void func_803884A8(s32 arg0, f32 arg1, s32 arg2, s32 arg3){ void func_80388518(s32 arg0){ s32 sp24; if(D_80389FA0.unk21 == 2){ - func_8030E394(D_80389FA0.sfxsourceIdx); + sfxSource_triggerCallbackByIndex(D_80389FA0.sfxsourceIdx); func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.6f, 20000); func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 20000); func_8030E760(SFX_7F_HEAVYDOOR_SLAM, 0.9f, 20000); @@ -94,9 +94,9 @@ void func_80388518(s32 arg0){ func_8030DD90(D_80389FA0.sfxsourceIdx, 0); sfxsource_playSfxAtVolume(D_80389FA0.sfxsourceIdx, 1.0f); sfxsource_setSfxId(D_80389FA0.sfxsourceIdx, SFX_7D_ANCHOR_LIFTING); - func_8030DD14(D_80389FA0.sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(D_80389FA0.sfxsourceIdx, 3); sfxsource_setSampleRate(D_80389FA0.sfxsourceIdx, 27000); - func_8030E2C4(D_80389FA0.sfxsourceIdx); + sfxSource_func_8030E2C4(D_80389FA0.sfxsourceIdx); } if(D_80389FA0.unk21 == 3){ @@ -308,10 +308,10 @@ void func_80388ED4(s32 arg0){ f32 sp1C[3]; func_8034A174(D_80389FA0.unk34, 5, sp1C); if(arg0 != 0){ - FUNC_8030E8B4(SFX_91_METALLIC_SOUND, 0.7f, 32675, sp1C, 100, 6000); + sfx_playFadeShorthandDefault(SFX_91_METALLIC_SOUND, 0.7f, 32675, sp1C, 100, 6000); } else{ - FUNC_8030E8B4(SFX_82_METAL_BREAK, 0.9f, 24000, sp1C, 100, 6000); + sfx_playFadeShorthandDefault(SFX_82_METAL_BREAK, 0.9f, 24000, sp1C, 100, 6000); } D_80389FA0.unk8 = 1.0f; } @@ -338,11 +338,11 @@ void CC_func_80388F4C(void){ if(D_80389FA0.unk21 == 3){ func_8034A174(D_80389FA0.unk34, 5, sp54); if(sp60 < sp64){ - FUNC_8030E8B4(SFX_7E_CREAKY_DOOR_OPENING, 0.6f, 32300, sp54, 1000, 5000); + sfx_playFadeShorthandDefault(SFX_7E_CREAKY_DOOR_OPENING, 0.6f, 32300, sp54, 1000, 5000); }//L80389058 if(sp64 < 0.3 && 0.3 <= sp60){ - FUNC_8030E8B4(SFX_7E_CREAKY_DOOR_OPENING, 0.5f, 32300, sp54, 1000, 5000); + sfx_playFadeShorthandDefault(SFX_7E_CREAKY_DOOR_OPENING, 0.5f, 32300, sp54, 1000, 5000); } }//L8038909C @@ -360,7 +360,7 @@ void CC_func_80388F4C(void){ if(D_80389FA0.unk20 && skeletalAnim_getAnimId(D_80389FA0.unk0) != ASSET_C4_ANIM_CLANKER_BITE){ skeletalAnim_set(D_80389FA0.unk0, ASSET_C4_ANIM_CLANKER_BITE, 1.0f, 10.0f); if(!D_80389FA0.unk48){ - gcdialog_showText(ASSET_D2B_DIALOG_UNKNOWN, 0xE, D_80389FA0.unk28, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_D2B_DIALOG_UNKNOWN, 0xE, D_80389FA0.unk28, NULL, NULL, NULL); D_80389FA0.unk48 = TRUE; } }//L8038918C diff --git a/src/CC/code_3400.c b/src/CC/code_3400.c index e728c5d5..1dd6ffe3 100644 --- a/src/CC/code_3400.c +++ b/src/CC/code_3400.c @@ -42,7 +42,7 @@ void func_803897F0(Actor *this, s32 next_state){ FUNC_8030E624(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000); if(next_state == 2){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, -1); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, -1); FUNC_8030E624(SFX_3F6_RUBBING, 0.9f, 29000); local->unk4 = 0.0f; } @@ -55,7 +55,7 @@ void func_803897F0(Actor *this, s32 next_state){ } void func_80389890(ActorMarker *marker, ActorMarker *other_marker){ - func_8025A6EC(COMUSIC_2B_DING_B, -1); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, -1); } void func_803898BC(ActorMarker *marker, ActorMarker *other_marker){ diff --git a/src/CC/code_530.c b/src/CC/code_530.c index 4e3c342c..d93e6cc4 100644 --- a/src/CC/code_530.c +++ b/src/CC/code_530.c @@ -37,20 +37,20 @@ void CC_func_80386920(Actor *this, s32 next_state){ local->unk14 = 0.0f; if(this->state == 2 || this->state == 3 || this->state == 4){ - func_8030E394(local->sfxsourceIdx); + sfxSource_triggerCallbackByIndex(local->sfxsourceIdx); } if(next_state == 2 || next_state == 3 || next_state == 4){ func_8030DD90(local->sfxsourceIdx, 1); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.3f); sfxsource_setSfxId(local->sfxsourceIdx, 0x3ec); - func_8030DD14(local->sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 3); sfxsource_setSampleRate(local->sfxsourceIdx, 28000); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); } if(next_state == 2 || next_state == 4){ - func_8025A6EC(COMUSIC_2B_DING_B, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7fff); player_getPosition(sp28); TUPLE_COPY(sp20, sp28); fxSparkle_giantGoldFeather(&sp20); @@ -58,7 +58,7 @@ void CC_func_80386920(Actor *this, s32 next_state){ if(next_state == 4){ CC_func_8038868C(); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); } if(this->state == 4) diff --git a/src/CC/code_BF0.c b/src/CC/code_BF0.c index 7c9f8afd..5b6cb0bb 100644 --- a/src/CC/code_BF0.c +++ b/src/CC/code_BF0.c @@ -35,7 +35,7 @@ void CC_func_80386FE0(Actor *this, s32 next_state){ this->state = next_state; local->unk8 = 0.0f; if(this->state == 2){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } else if(this->state == 3){ if(prev_state == 2){ @@ -121,13 +121,13 @@ void func_803870F8(Actor *this){ if(local->egg_count == 3){ CC_func_80386FE0(this, 2); }else{ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } else if(this->state == 2 && 1.0f <= local->unk8){ flagCnt = levelSpecificFlags_get(LEVEL_FLAG_0_CC_TOKEN_TOOTH_OPEN) + levelSpecificFlags_get(LEVEL_FLAG_1_CC_JIGGY_TOOTH_OPEN); if(!jiggyscore_isCollected(JIGGY_1B_CC_TOOTH)){ - gcdialog_showText((local->unk0 == 1)? ((flagCnt == 0)? 0xd30 : 0xd31) : ((flagCnt == 0)? 0xd2e : 0xd2f), 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog((local->unk0 == 1)? ((flagCnt == 0)? 0xd30 : 0xd31) : ((flagCnt == 0)? 0xd2e : 0xd2f), 4, NULL, NULL, NULL, NULL); } CC_func_80386FE0(this, 3); }//L80387474 diff --git a/src/CCW/ch/grublinhood.c b/src/CCW/ch/grublinhood.c index 28ff9fb5..dcac6acf 100644 --- a/src/CCW/ch/grublinhood.c +++ b/src/CCW/ch/grublinhood.c @@ -84,7 +84,7 @@ void __chgrublinhood_die(ActorMarker* marker, s32 arg1) { subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); - FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); + 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)); @@ -185,10 +185,10 @@ void chgrublinhood_update(Actor *this) { func_802DB5A0(this); if (this->state == 5) { if (actor_animationIsAt(this, 0.18f)) { - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); } if (actor_animationIsAt(this, 0.7f)) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); } } } diff --git a/src/CCW/ch/vacationtexttrigger.c b/src/CCW/ch/vacationtexttrigger.c index 77fcebf4..5f1b14f2 100644 --- a/src/CCW/ch/vacationtexttrigger.c +++ b/src/CCW/ch/vacationtexttrigger.c @@ -37,7 +37,7 @@ void chVacationTextTrigger_update(Actor* this) { // Start dialog if player is within trigger if (__playerIsWithinTrigger(0, -107, 188) != 0) { - gcdialog_showText(0xDA9, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xDA9, 4, NULL, NULL, NULL, NULL); volatileFlag_set(VOLATILE_FLAG_13_HAS_TRIGGERED_MUMBO_VACATION_TEXT, 1); } } diff --git a/src/CCW/code_0.c b/src/CCW/code_0.c index 3cb0b8ca..d33c704d 100644 --- a/src/CCW/code_0.c +++ b/src/CCW/code_0.c @@ -10,7 +10,7 @@ ActorInfo D_8038EB74 = { 0x1AC, 0x29A, 0x445, 0x0, NULL, func_803864B8, NULL, ac /* .code */ void CCW_func_803863F0(Actor *this, s32 next_state){ if(next_state == 2){ - FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 1.0f, 32000, this->position, 500, 3000); + sfx_playFadeShorthandDefault(SFX_2F_ORANGE_SPLAT, 1.0f, 32000, this->position, 500, 3000); levelSpecificFlags_set(LEVEL_FLAG_10_CCW_UNKNOWN, TRUE); marker_despawn(this->marker); } diff --git a/src/CCW/code_14B0.c b/src/CCW/code_14B0.c index 55ec10e5..fffd1472 100644 --- a/src/CCW/code_14B0.c +++ b/src/CCW/code_14B0.c @@ -79,7 +79,7 @@ void CCW_func_80387A40(Actor *this) { local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); local->unk18[0] = local->unk18[1] = local->unk18[2] = 0.0f; sfxsource_setSfxId(local->sfxsourceIdx, 0x3FA); - func_8030DD14(local->sfxsourceIdx, 2); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 2); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.9f); sfxsource_setSampleRate(local->sfxsourceIdx, 0); func_803878A0(this, 1); @@ -116,13 +116,13 @@ void CCW_func_80387A40(Actor *this) { func_8030DBFC(local->sfxsourceIdx, 0.8f, 0.9f, 0.05f); sfxsource_set_fade_distances(local->sfxsourceIdx, 500.0f, 1500.0f); sfxsource_set_position(local->sfxsourceIdx, this->position); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); sfxsource_setSampleRate(local->sfxsourceIdx, 2000.0f + 8000.0f*(LENGTH_VEC3F(local->unk18)/ local->unk8)); if (!mapSpecificFlags_get(local->unk4->unk2)) { player_getPosition(sp44); if (sp44[2] > -600.0f) { if (!local->unk4->unk3 || !jiggyscore_isCollected(local->unk4->unk3) ) { - gcdialog_showText(local->unk4->unk4, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(local->unk4->unk4, 4, NULL, NULL, NULL, NULL); mapSpecificFlags_set(local->unk4->unk2, TRUE); } } diff --git a/src/CCW/code_160.c b/src/CCW/code_160.c index 5cf55c23..62dc19c6 100644 --- a/src/CCW/code_160.c +++ b/src/CCW/code_160.c @@ -31,7 +31,7 @@ void CCW_func_80386550(ActorMarker *marker){ if (local->unk0 != NULL) { actor_collisionOn(marker_getActor(local->unk0)); } - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 28000); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 28000); } void func_803865C4(ActorMarker* marker, enum asset_e text_id, s32 arg2) { @@ -45,9 +45,9 @@ void func_803865F4(Actor *this, s32 next_state) { local->unkC = 0.0f; if (next_state == 2) { if (!volatileFlag_getAndSet(VOLATILE_FLAG_B5, 1)) { - gcdialog_showText(0xCE2, 4, NULL, this->marker, func_803865C4, NULL); + gcdialog_showDialog(0xCE2, 4, NULL, this->marker, func_803865C4, NULL); } else { - gcdialog_showText(0xCE3, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCE3, 4, NULL, NULL, NULL, NULL); func_803865F4(this, 3); return; } @@ -56,7 +56,7 @@ void func_803865F4(Actor *this, s32 next_state) { if (next_state == 3) { local->unkC = 0.1f; func_8025A58C(0, 4000); - func_8025A6EC(COMUSIC_4B_CCW_ZUBBA_FIGHT, 30000); + coMusicPlayer_playMusic(COMUSIC_4B_CCW_ZUBBA_FIGHT, 30000); } if (next_state == 4) { @@ -65,11 +65,11 @@ void func_803865F4(Actor *this, s32 next_state) { volatileFlag_set(VOLATILE_FLAG_3, 0); volatileFlag_set(VOLATILE_FLAG_5_FF_MINIGAME_WON, 1); } else { - gcdialog_showText(0xCE4, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCE4, 4, NULL, NULL, NULL, NULL); func_8025A58C(-1, 400); comusic_8025AB44(COMUSIC_4B_CCW_ZUBBA_FIGHT, 0, 400); func_8025AABC(COMUSIC_4B_CCW_ZUBBA_FIGHT); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_80324E38(0.0f, 3); timed_setStaticCameraToNode(2.0f, 4); timedFunc_set_1(2.0f, (GenFunction_1)CCW_func_80386550, (s32) this->marker); diff --git a/src/CCW/code_1B20.c b/src/CCW/code_1B20.c index f2de6732..a5b6da78 100644 --- a/src/CCW/code_1B20.c +++ b/src/CCW/code_1B20.c @@ -53,7 +53,7 @@ void func_80387F64(Actor *this, s32 next_state){ } if (next_state == 2) { if (map_get() == MAP_43_CCW_SPRING) { - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); } fileProgressFlag_set(local->unk0->unk8, TRUE); skeletalAnim_set(this->unk148, local->unk0->unk4, 0.0f, 6.0f); @@ -91,7 +91,7 @@ bool func_80388260(ActorMarker *marker, s32 arg1){ } void CCW_func_80388278(ActorMarker *marker, ActorMarker *other_marker) { - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } void func_803882A4(ActorMarker* marker, ActorMarker *other_marker) { diff --git a/src/CCW/code_2270.c b/src/CCW/code_2270.c index b6040616..e1d82999 100644 --- a/src/CCW/code_2270.c +++ b/src/CCW/code_2270.c @@ -48,7 +48,7 @@ void CCW_func_8038868C(Actor *this, s32 next_state) { } if (next_state == 2) { if (local->unk0->unk4 != 0) { - gcdialog_showText(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); } skeletalAnim_set(this->unk148, ASSET_FC_ANIM_GOBI_SPITTING, 0.2f, 3.0f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); @@ -73,7 +73,7 @@ void CCW_func_8038868C(Actor *this, s32 next_state) { } if (next_state == 5) { if (local->unk0->unk6 != 0) { - gcdialog_showText((s32) local->unk0->unk6, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog((s32) local->unk0->unk6, 4, NULL, NULL, NULL, NULL); } skeletalAnim_set(this->unk148, ASSET_FD_ANIM_GOBI2_GETTING_UP, 0.23f, 0.5f); timed_setStaticCameraToNode(0.0f, 3); @@ -163,7 +163,7 @@ void chGobiCCW_update(Actor *this) { player_getPosition(sp48); if (ml_vec3f_distance(this->position, sp48) < 600.0f) { if (local->unk0->unk2 != 0) { - gcdialog_showText((s32) local->unk0->unk2, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog((s32) local->unk0->unk2, 4, NULL, NULL, NULL, NULL); } this->has_met_before = TRUE; } @@ -192,10 +192,10 @@ void chGobiCCW_update(Actor *this) { if (skeletalAnim_getAnimId(this->unk148) == ASSET_177_ANIM_GOBI_SLEEP) { skeletalAnim_getProgressRange(this->unk148, &sp44, &sp40); if ((sp44 < 0.1) && (0.1 <= (f64) sp40)) { - FUNC_8030E8B4(SFX_5E_BANJO_PHEWWW, 0.8f, 15000, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_5E_BANJO_PHEWWW, 0.8f, 15000, this->position, 500, 1500); } if ((sp44 < 0.8) && (0.8 <= (f64) sp40)) { - FUNC_8030E8B4(SFX_5D_BANJO_RAAOWW, 0.8f, 15000, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_5D_BANJO_RAAOWW, 0.8f, 15000, this->position, 500, 1500); } } diff --git a/src/CCW/code_2B00.c b/src/CCW/code_2B00.c index fdff16c8..7e8eb07a 100644 --- a/src/CCW/code_2B00.c +++ b/src/CCW/code_2B00.c @@ -112,12 +112,12 @@ void func_803891B0(void* marker) { func_8030DD90(actor->unk44_31, 0); sfxsource_setSampleRate(actor->unk44_31, 0x2AF8); sfxsource_playSfxAtVolume(actor->unk44_31, 0.3f); - func_8030E2C4(actor->unk44_31); + sfxSource_func_8030E2C4(actor->unk44_31); } void func_8038921C(void* marker) { Actor* actor = marker_getActor(reinterpret_cast(ActorMarker*, marker)); - func_8030E394(actor->unk44_31); + sfxSource_triggerCallbackByIndex(actor->unk44_31); sfxsource_freeSfxsourceByIndex(actor->unk44_31); actor->unk44_31 = 0U; FUNC_8030E624(SFX_6C_LOCKUP_CLOSING, 1.0f, 25000); diff --git a/src/CCW/code_3050.c b/src/CCW/code_3050.c index 87d96456..c0e777eb 100644 --- a/src/CCW/code_3050.c +++ b/src/CCW/code_3050.c @@ -13,7 +13,7 @@ void func_80389440(Actor *this, s32 next_state) { void *temp_v0; if (next_state == 2) { - sfxsource_play(SFX_AA_BGS_EGG_BREAKING_1, 28000); + gcsfx_playAtSampleRate(SFX_AA_BGS_EGG_BREAKING_1, 28000); this->marker->propPtr->unk8_3 = FALSE; fileProgressFlag_set(FILEPROG_E6_SPRING_EYRIE_HATCHED, TRUE); skeletalAnim_set(this->unk148, 0x187, 0.0f, 2.0f); diff --git a/src/CCW/code_3310.c b/src/CCW/code_3310.c index 6b905198..b7c2a4d3 100644 --- a/src/CCW/code_3310.c +++ b/src/CCW/code_3310.c @@ -153,14 +153,14 @@ void func_803897B8(Actor *this, s32 next_state) { skeletalAnim_set(this->unk148, local->unk0->unk14, 0.5f, 8.5f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); if (local->unk0->map_id == MAP_43_CCW_SPRING) { - gcdialog_showText(0xCD6, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCD6, 4, NULL, NULL, NULL, NULL); skeletalAnim_setCallback_0(this->unk148, 0.65f, &func_80389798); } if (local->unk0->map_id == MAP_44_CCW_SUMMER) { - gcdialog_showText(0xCD9, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCD9, 4, NULL, NULL, NULL, NULL); } if (local->unk0->map_id == MAP_45_CCW_AUTUMN) { - gcdialog_showText(0xCDB, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCDB, 4, NULL, NULL, NULL, NULL); } local->unk8 = local->unk0->unk18; } @@ -274,7 +274,7 @@ void CCW_func_80389BFC(Actor *this) { if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_vec3f_distance(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) { player_setThrowTargetPosition(D_8038FDE0); if ((local->unk0->map_id == MAP_44_CCW_SUMMER) && (local->unk4 == 0)) { - gcdialog_showText(0xCD8, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCD8, 4, NULL, NULL, NULL, NULL); } local->unk4++; if (local->unk4 < local->unk0->unk25) { diff --git a/src/CCW/code_3DA0.c b/src/CCW/code_3DA0.c index 494876a8..b3cb9fe2 100644 --- a/src/CCW/code_3DA0.c +++ b/src/CCW/code_3DA0.c @@ -54,7 +54,7 @@ void chcaterpillar_setState(Actor *this, s32 next_state) { local->unk24 = 0.0f; } if (next_state == 4) { - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); marker_despawn(this->marker); } if (next_state == 5) { @@ -153,10 +153,10 @@ void chcaterpillar_update(Actor *this){ if(ml_vec3f_distance(this->position, sp74) < 50.0f){ func_8028F030(ACTOR_2A2_CATERPILLAR); if(!volatileFlag_get(VOLATILE_FLAG_B2)){ - gcdialog_showText(ASSET_CC7_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_CC7_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); volatileFlag_set(VOLATILE_FLAG_B2, TRUE); } - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 0x1f4, 0x9c4); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 0x1f4, 0x9c4); marker_despawn(this->marker); } }//L8038A794 diff --git a/src/CCW/code_4530.c b/src/CCW/code_4530.c index 21b29100..ecd076d0 100644 --- a/src/CCW/code_4530.c +++ b/src/CCW/code_4530.c @@ -44,7 +44,7 @@ void func_8038A950(Actor *this, s32 next_state) { skeletalAnim_set(this->unk148, 0x199, 0.0f, 6.5f); } if (next_state == 2) { - gcdialog_showText(0xCDC, 0xA, this->position, this->marker, func_8038A920, NULL); + gcdialog_showDialog(0xCDC, 0xA, this->position, this->marker, func_8038A920, NULL); } if (next_state == 3) { skeletalAnim_set(this->unk148, 0x19A, 0.0f, 7.0f); diff --git a/src/CCW/code_4960.c b/src/CCW/code_4960.c index 502868cd..4a25f65c 100644 --- a/src/CCW/code_4960.c +++ b/src/CCW/code_4960.c @@ -28,7 +28,7 @@ Struct_CCW_4960_0 D_8038F254[] = { /* .code */ void func_8038AD50(Actor *this, s32 next_state) { if (next_state == 2) { - gcdialog_showText(0xCDD, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCDD, 0, NULL, NULL, NULL, NULL); if (this->state == 1) { mapSpecificFlags_set(6, 0); timed_setStaticCameraToNode(0.0f, 1); diff --git a/src/CCW/code_4D00.c b/src/CCW/code_4D00.c index 757f50dc..35fe0352 100644 --- a/src/CCW/code_4D00.c +++ b/src/CCW/code_4D00.c @@ -90,7 +90,7 @@ void func_8038B19C(Actor *this) { } if (!this->has_met_before && func_803292E0(this)) { this->has_met_before = TRUE; - gcdialog_showText(0xCC8, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCC8, 0, NULL, NULL, NULL, NULL); } func_8028E668(this->position, 300.0f, -50.0f, 120.0f); } diff --git a/src/CCW/code_50D0.c b/src/CCW/code_50D0.c index dc55433e..745dc256 100644 --- a/src/CCW/code_50D0.c +++ b/src/CCW/code_50D0.c @@ -92,7 +92,7 @@ void func_8038B87C(Actor *this) { } if (!this->has_met_before && func_803292E0(this)) { this->has_met_before = TRUE; - gcdialog_showText(0xCC9, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCC9, 0, NULL, NULL, NULL, NULL); } func_8028E668(this->position, 300.0f, -50.0f, 120.0f); } diff --git a/src/CCW/code_5540.c b/src/CCW/code_5540.c index ed9cb535..58fca6f6 100644 --- a/src/CCW/code_5540.c +++ b/src/CCW/code_5540.c @@ -49,7 +49,7 @@ void chnabnut_setState(Actor *this, s32 next_state) { skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); func_80324E38(0.0f, 3); timed_setStaticCameraToNode(0.0f, 0xB); - gcdialog_showText(0xCCC, 0x20, this->position, NULL, NULL, NULL); + gcdialog_showDialog(0xCCC, 0x20, this->position, NULL, NULL, NULL); } if (next_state == NABNUT_STATE_4_THANK_PLAYER) { @@ -135,13 +135,13 @@ void chnabnut_update(Actor *this) { player_getPosition(sp30); if (!this->has_met_before && (ml_vec3f_distance(this->position, sp30) < 400.0f)) { this->has_met_before = TRUE; - gcdialog_showText(0xCCA, 0xE, this->position, NULL, NULL, NULL); + gcdialog_showDialog(0xCCA, 0xE, this->position, NULL, NULL, NULL); } if (item_getCount(ITEM_23_ACORNS) > 0) { func_80258A4C(this->position, this->yaw - 90.0f, sp30, &sp2C, &sp28, &sp24); this->yaw += sp24 * 10.0f; } - if (this->has_met_before && !func_803114B0()) { + if (this->has_met_before && !gcdialog_hasCurrentTextId()) { player_setCarryObjectPoseInCylinder(this->position, 500.0f, 200.0f, ACTOR_2A9_ACORN, &this); if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_vec3f_distance(this->position, sp30) < 300.0f) && player_throwCarriedObject()) { player_setThrowTargetPosition(D_8038F350); @@ -149,7 +149,7 @@ void chnabnut_update(Actor *this) { if (local->returned_acorn_count == 6) { chnabnut_setState(this, NABNUT_STATE_2_WAIT); } else if (item_getCount(ITEM_23_ACORNS) == 1) { - gcdialog_showText(0xCCB, 0x20, this->position, NULL, NULL, NULL); + gcdialog_showDialog(0xCCB, 0x20, this->position, NULL, NULL, NULL); } } } diff --git a/src/CCW/code_5BF0.c b/src/CCW/code_5BF0.c index 00d826ca..d065ad6c 100644 --- a/src/CCW/code_5BF0.c +++ b/src/CCW/code_5BF0.c @@ -116,7 +116,7 @@ void func_8038C41C(Actor *this) { player_getPosition(sp2C); if (!this->has_met_before && (ml_vec3f_distance(this->position, sp2C) < 400.0f)) { this->has_met_before = TRUE; - gcdialog_showText(0xCCD, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCCD, 0, NULL, NULL, NULL, NULL); } } } diff --git a/src/CCW/code_61E0.c b/src/CCW/code_61E0.c index fcab4dd8..6ec292b9 100644 --- a/src/CCW/code_61E0.c +++ b/src/CCW/code_61E0.c @@ -43,7 +43,7 @@ void CCW_func_8038C6A0(Actor *this, s32 next_state) { local->unk18 = 0.0f; } if (next_state == 4) { - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); marker_despawn(this->marker); } if (next_state == 5) { @@ -75,7 +75,7 @@ void func_8038C7A8(Actor *this) { player_getPosition(sp38); if (ml_vec3f_distance(this->position, sp38) < 50.0f) { func_8028F030(0x2A9); - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 25000, this->position, 500, 2500); CCW_func_8038C6A0(this, 5); } } diff --git a/src/CCW/code_6620.c b/src/CCW/code_6620.c index 6a0d691b..ff3d4775 100644 --- a/src/CCW/code_6620.c +++ b/src/CCW/code_6620.c @@ -120,7 +120,7 @@ void func_8038CC4C(Actor *this) { player_getPosition(sp38); if (ml_vec3f_distance(this->position, sp38) < 900.0f) { if (local->unk0->map_id != MAP_46_CCW_WINTER || func_8028F2FC()) { - gcdialog_showText(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); this->has_met_before = TRUE; } } diff --git a/src/CCW/code_6AC0.c b/src/CCW/code_6AC0.c index beef5702..bd4bf18d 100644 --- a/src/CCW/code_6AC0.c +++ b/src/CCW/code_6AC0.c @@ -61,7 +61,7 @@ void func_8038CEB0(Actor *this, s32 next_state) { this->marker->propPtr->unk8_3 = FALSE; skeletalAnim_set(this->unk148, 0x1A7, 0.2f, 3.0f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); - gcdialog_showText(0xCD0, 0x24, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCD0, 0x24, NULL, NULL, NULL, NULL); } if (next_state == 3) { skeletalAnim_set(this->unk148, 0x1A8, 0.2f, 0.5f); @@ -117,7 +117,7 @@ void func_8038CFB4(Actor *this) { if (!this->has_met_before) { player_getPosition(sp60); if (ml_vec3f_distance(this->position, sp60) < 900.0f) { - gcdialog_showText(0xCCF, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xCCF, 4, NULL, NULL, NULL, NULL); this->has_met_before = TRUE; } } diff --git a/src/CCW/code_6EC0.c b/src/CCW/code_6EC0.c index f4a772f6..6e5ef1e7 100644 --- a/src/CCW/code_6EC0.c +++ b/src/CCW/code_6EC0.c @@ -71,10 +71,10 @@ void func_8038D368(Actor *this) { player_getPosition(plyr_pos); if (ml_vec3f_distance(this->position, plyr_pos) < 600.0f) { if (!jiggyscore_isCollected(JIGGY_4B_CCW_GNAWTY)) { - gcdialog_showText(local->unk0->unk2, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(local->unk0->unk2, 4, NULL, NULL, NULL, NULL); } else { if (local->unk0->unk4) { - gcdialog_showText(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(local->unk0->unk4, 4, NULL, NULL, NULL, NULL); } } this->has_met_before = TRUE; diff --git a/src/CCW/code_7BF0.c b/src/CCW/code_7BF0.c index d828d014..63222273 100644 --- a/src/CCW/code_7BF0.c +++ b/src/CCW/code_7BF0.c @@ -97,7 +97,7 @@ void func_8038E0C8(Actor *this) { this->unk38_31--; break; } - if( func_80329530(this, 0x2A8) + if( subaddie_playerIsWithinSphereAndActive(this, 0x2A8) && (this->unk38_31 == 0) && (player_getTransformation() == TRANSFORM_1_BANJO) ) { @@ -114,7 +114,7 @@ void func_8038E0C8(Actor *this) { || actor_animationIsAt(this, 0.47f) || actor_animationIsAt(this, 0.78f) ) { - FUNC_8030E8B4(SFX_80_YUMYUM_CLACK, 1.0f, 32000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_80_YUMYUM_CLACK, 1.0f, 32000, this->position, 1500, 3000); } break; } diff --git a/src/CCW/code_950.c b/src/CCW/code_950.c index e2f2e842..8b4db45e 100644 --- a/src/CCW/code_950.c +++ b/src/CCW/code_950.c @@ -43,13 +43,13 @@ void chwasp_setState(Actor *this, s32 next_state) { } } if (next_state == 3) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200, this->position, 500, 3000); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200, this->position, 500, 3000); func_80324D54(randf2(0.1f, 0.4f), 0x3FC, randf2(0.95f, 1.1f), 32000, this->position, 500.0f, 3000.0f); actor_collisionOff(this); } if (next_state == 4) { skeletalAnim_set(this->unk148, ASSET_171_ANIM_ZUBBA_DIE, 0.1f, 0.2f); - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200, this->position, 500, 3000); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200, this->position, 500, 3000); func_80324D54(0.1f, 0x66, randf2(1.6f, 1.7f), 32000, this->position, 500.0f, 3000.0f); func_803867C8(local->unk4); actor_collisionOff(this); @@ -117,7 +117,7 @@ void chwasp_update(Actor *this) { local->unk4 = 0; local->unk14 = 1000.0f; sfxsource_setSfxId(local->sfxsourceIdx, 0x3FA); - func_8030DD14(local->sfxsourceIdx, 2); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 2); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.9f); sfxsource_setSampleRate(local->sfxsourceIdx, 0); marker_setCollisionScripts(this->marker, func_80387124, NULL, CCW_func_80387150); @@ -210,6 +210,6 @@ void chwasp_update(Actor *this) { } sfxsource_set_fade_distances(local->sfxsourceIdx, 500.0f, 1500.0f); sfxsource_set_position(local->sfxsourceIdx, this->position); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); sfxsource_setSampleRate(local->sfxsourceIdx, (s32) ((local->unk18 / local->unk14) * 10000.0f)); } diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index cde70256..6f779dcf 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -50,7 +50,7 @@ Struct_FP_3E00 D_80391E80[] ={ void func_8038A1F0(Actor **this_ptr, enum marker_e carried_obj_marker_id, enum actor_e actor_id, enum actor_e arg3){ player_setCarryObjectPoseInHorizontalRadius((*this_ptr)->position, 600.0f, actor_id, this_ptr); - if (!func_80329530(*this_ptr, 400)) { + if (!subaddie_playerIsWithinSphereAndActive(*this_ptr, 400)) { return; } @@ -79,10 +79,10 @@ void func_8038A274(Actor *this){ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){ if(text_id == 0xc19){ - func_802BAFE4(0x25); + gcStaticCamera_activate(0x25); jiggy_spawn(JIGGY_2E_FP_PRESENTS, FP_D_80391E74); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); - func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); + coMusicPlayer_playMusic(COMUSIC_5B_FP_IGLOO_HAPPY, 25000); func_8025A58C(0, 4000); core1_ce60_incOrDecCounter(FALSE); } @@ -134,13 +134,13 @@ void func_8038A384(Actor *this){ switch(this->state){ case 1://L8038A5B0 - if(!levelSpecificFlags_get(LEVEL_FLAG_19_FP_UNKNOWN) && func_80329530(this, 0xfa)){ + if(!levelSpecificFlags_get(LEVEL_FLAG_19_FP_UNKNOWN) && subaddie_playerIsWithinSphereAndActive(this, 0xfa)){ if(player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT){ if(sp34 == 0 && !jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3) && !jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3) ){ - if (gcdialog_showText(ASSET_C1A_DIALOG_UNKNOWN, 0x2a, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_C1A_DIALOG_UNKNOWN, 0x2a, NULL, NULL, NULL, NULL)) { levelSpecificFlags_set(LEVEL_FLAG_19_FP_UNKNOWN, TRUE); } } @@ -164,23 +164,23 @@ void func_8038A384(Actor *this){ if(levelSpecificFlags_get(D_80391E80[sp3C].unk0)){ subaddie_set_state_with_direction(this, 2, 0.001f, 1); if (sp38 == ASSET_C19_DIALOG_UNKNOWN) { - gcdialog_showText(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL); + gcdialog_showDialog(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL); } else { - gcdialog_showText(sp38, 0x3, this->position, this->marker, func_8038A318, NULL); + gcdialog_showDialog(sp38, 0x3, this->position, this->marker, func_8038A318, NULL); } } else{//L8038A73C func_8038A1F0(&this, D_80391E80[sp3C].unk4, D_80391E80[sp3C].unk8, D_80391E80[sp3C].unkC); if( actor_animationIsAt(this, 0.45f) - && !func_803114B0() + && !gcdialog_hasCurrentTextId() ){ func_8030E878(SFX_B1_BOGGY_KID_CRYING, randf2(0.9f, 1.1f), 32000, this->position, 150.0f, 700.0f); } }//L8038A7DC break; case 2://L8038A7C0 - if(!func_803114B0()){ + if(!gcdialog_hasCurrentTextId()){ func_8038A274(this); } break; diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index 0c7b375f..bc759535 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -49,7 +49,7 @@ Actor *func_803875E0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_803876A4(Actor *this){ subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); - FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 32000, this->position, 1250, 2500); } void func_803876F8(Actor *this){ @@ -86,7 +86,7 @@ void func_80387828(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); if (text_id == 0xc00) { - gcdialog_showText(ASSET_C2B_DIALOG_UNKNOWN, 0xf, NULL, this->marker, NULL, func_803877A8); + gcdialog_showDialog(ASSET_C2B_DIALOG_UNKNOWN, 0xf, NULL, this->marker, NULL, func_803877A8); } } @@ -147,9 +147,9 @@ void func_8038794C(Actor *this){ break; }//L80387B38 - if(!this->has_met_before && func_80329530(this, 0x1f4)){ + if(!this->has_met_before && subaddie_playerIsWithinSphereAndActive(this, 0x1f4)){ if(!player_movementGroup() || player_movementGroup() == BSGROUP_8_TROT){ - if (gcdialog_showText(ASSET_BFF_DIALOG_UNKNOWN, 0x2a, this->position, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_BFF_DIALOG_UNKNOWN, 0x2a, this->position, NULL, NULL, NULL)) { for (i = 0; i < 5; i++) { timedFunc_set_1(D_80391BEC[i], (GenFunction_1) func_8038787C, (s32) this->marker); } @@ -162,19 +162,19 @@ void func_8038794C(Actor *this){ case 2://L80387BEC func_8028FC8C(this->position); if(actor_animationIsAt(this, 0.1f)){ - FUNC_8030E8B4(SFX_F6_BLUBBER_TALKING_2, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_F6_BLUBBER_TALKING_2, 1.0f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.24f)){//L80387C2C - FUNC_8030E8B4(SFX_A0_COUGHING, 0.7f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_A0_COUGHING, 0.7f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.52f)){//L80387C60 - FUNC_8030E8B4(SFX_A0_COUGHING, 0.67f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_A0_COUGHING, 0.67f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.61f)){//L80387C94 - FUNC_8030E8B4(SFX_A0_COUGHING, 0.64f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_A0_COUGHING, 0.64f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.69f)){//L80387CC8 - FUNC_8030E8B4(SFX_A0_COUGHING, 0.61f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_A0_COUGHING, 0.61f, 32000, this->position, 1250, 2500); }//L80387CF4 if(actor_animationIsAt(this, 0.9999f)){ diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index 060c0be2..18a843a9 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -124,10 +124,10 @@ void func_80388A50(Actor *this){ void func_80388A94(Actor *this){ func_80388A50(this); if(mapSpecificFlags_get(6)){ - gcdialog_showText(ASSET_C0A_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C0A_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); } else{ - gcdialog_showText(ASSET_C09_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C09_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); } } @@ -136,15 +136,15 @@ void func_80388B18(Actor *this, u8 arg1){ if(player_getTransformation() == TRANSFORM_4_WALRUS){ func_80388A50(this); if(mapSpecificFlags_get(5)){ - gcdialog_showText(ASSET_C05_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C05_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); } else{ - gcdialog_showText(ASSET_C02_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C02_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); } } else{//L80388BB8 if(!volatileFlag_get(VOLATILE_FLAG_B3)){ - if(gcdialog_showText(ASSET_C01_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ + if(gcdialog_showDialog(ASSET_C01_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ volatileFlag_set(VOLATILE_FLAG_B3, TRUE); func_80388A50(this); } @@ -154,7 +154,7 @@ void func_80388B18(Actor *this, u8 arg1){ else{//L80388C08 if(player_getTransformation() == TRANSFORM_4_WALRUS){ if(!volatileFlag_get(VOLATILE_FLAG_B4)){ - if(gcdialog_showText(ASSET_C08_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ + if(gcdialog_showDialog(ASSET_C08_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ volatileFlag_set(VOLATILE_FLAG_B4, TRUE); func_80388A50(this); } @@ -180,12 +180,12 @@ bool FP_func_80388CA0(Actor *this){ if(player_movementGroup() != BSGROUP_0_NONE && player_movementGroup() != BSGROUP_8_TROT) return FALSE; - if( !func_80329530(this, 1100) ){ + if( !subaddie_playerIsWithinSphereAndActive(this, 1100) ){ local->unk18 = TRUE; } sp20 = this->unk10_12; - this->unk10_12 = func_80329530(this, 0x1C2); + this->unk10_12 = subaddie_playerIsWithinSphereAndActive(this, 0x1C2); return (sp20 == 0 && this->unk10_12 && local->unk18); } @@ -199,7 +199,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ case 0xc06: case 0xc28: case 0xc29://L80388DC4 - func_8025A6EC(COMUSIC_3A_FP_BOGGY_RACE, 25000); + coMusicPlayer_playMusic(COMUSIC_3A_FP_BOGGY_RACE, 25000); func_8025A58C(0, 4000); core1_ce60_incOrDecCounter(FALSE); func_802BE720(); @@ -262,7 +262,7 @@ void func_80388F90(Actor *this){ func_8030DB04(this->unk44_31, 32000, this->position, 1000.0f, 4000.0f); sfxsource_playSfxAtVolume(this->unk44_31, local->unk8); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } bool func_80388FE8(Actor *this, f32 arg1, f32 arg2){ @@ -467,24 +467,24 @@ void func_803896FC(Actor *this){ else if(!jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2) && player_movementGroup() == BSGROUP_C_WALRUS_SLED){ FP_func_803888E4(this); } - else if( func_80329530(this, 0x1C2) + else if( subaddie_playerIsWithinSphereAndActive(this, 0x1C2) && player_movementGroup() == BSGROUP_0_NONE && func_8028F20C() && func_8028EFC8() && sp3C[FACE_BUTTON(BUTTON_B)] == 1 - && !func_803114B0() + && !gcdialog_hasCurrentTextId() ){ if( local->unk19 == 1 && player_getTransformation() != TRANSFORM_4_WALRUS && volatileFlag_get(VOLATILE_FLAG_B3) ){ - gcdialog_showText(ASSET_C01_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C01_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); } else if( local->unk19 == 2){ if( player_getTransformation() == TRANSFORM_4_WALRUS && volatileFlag_get(VOLATILE_FLAG_B4) ){ - gcdialog_showText(ASSET_C08_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showDialog(ASSET_C08_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); } else if( player_getTransformation() != TRANSFORM_4_WALRUS){ func_80388A94(this); diff --git a/src/FP/ch/boggy3.c b/src/FP/ch/boggy3.c index f35780ac..de6d7c61 100644 --- a/src/FP/ch/boggy3.c +++ b/src/FP/ch/boggy3.c @@ -26,7 +26,7 @@ Actor *func_80390290(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if(this->unk38_31) return this; - if(func_803114C4() == 0xC1F || func_803114C4() == 0xC1E){ + if(gcdialog_getCurrentTextId() == 0xC1F || gcdialog_getCurrentTextId() == 0xC1E){ sp18 = 1; } func_8033A45C(1, 0); @@ -73,18 +73,18 @@ void func_80390388(Actor *this){ this->has_met_before = TRUE; } - if( func_80329530(this, 0xFA) + if( subaddie_playerIsWithinSphereAndActive(this, 0xFA) && (player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT) ){ if(0.0f == this->unk1C[0] && func_80390334()){ - if(gcdialog_showText(ASSET_C1F_DIALOG_UNKNOWN, 0xb, this->position, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_C1F_DIALOG_BOGGY_NEEDS_SLEEP, 0xb, this->position, NULL, NULL, NULL)){ this->has_met_before = TRUE; this->unk1C[0] = 1.0f; } } else{ if( !this->has_met_before ){ - if(gcdialog_showText(ASSET_C1E_DIALOG_UNKNOWN, 0x2b, this->position, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_C1E_DIALOG_BOGGY_LOOK_FOR_PRESENTS, 0x2b, this->position, NULL, NULL, NULL)){ this->has_met_before = TRUE; } } diff --git a/src/FP/ch/cavewozza.c b/src/FP/ch/cavewozza.c index 9d5f25b1..7f26343c 100644 --- a/src/FP/ch/cavewozza.c +++ b/src/FP/ch/cavewozza.c @@ -49,11 +49,11 @@ void func_80390630(Actor *this){ this->yaw_ideal = (f32)func_80329784(this); func_80328FB0(this, 1.0f); - if(!func_803114B0()){ + if(!gcdialog_hasCurrentTextId()){ if( actor_animationIsAt(this, 0.09f) || actor_animationIsAt(this, 0.19f) ){ - FUNC_8030E8B4(SFX_88_WOZZA_NOISE, 1.0f, 22000, this->position, 500, 2000); + sfx_playFadeShorthandDefault(SFX_88_WOZZA_NOISE, 1.0f, 22000, this->position, 500, 2000); } if( actor_animationIsAt(this, 0.68f) @@ -62,21 +62,21 @@ void func_80390630(Actor *this){ || actor_animationIsAt(this, 0.92f) ){ - FUNC_8030E8B4(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000); + sfx_playFadeShorthandDefault(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000); } } - if (func_80329530(this, 350)) { + if (subaddie_playerIsWithinSphereAndActive(this, 350)) { if (player_getTransformation() == TRANSFORM_4_WALRUS) { if (!levelSpecificFlags_get(LEVEL_FLAG_31_FP_UNKNOWN)) { - if (gcdialog_showText(ASSET_C27_DIALOG_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_C27_DIALOG_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { levelSpecificFlags_set(LEVEL_FLAG_31_FP_UNKNOWN, TRUE); } } } else { if (!levelSpecificFlags_get(LEVEL_FLAG_32_FP_UNKNOWN)) { - if (gcdialog_showText(ASSET_C26_DIALOG_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_C26_DIALOG_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { levelSpecificFlags_set(LEVEL_FLAG_32_FP_UNKNOWN, TRUE); } } diff --git a/src/FP/ch/scarfsled.c b/src/FP/ch/scarfsled.c index e4f658fb..400a3bbd 100644 --- a/src/FP/ch/scarfsled.c +++ b/src/FP/ch/scarfsled.c @@ -58,7 +58,7 @@ void __chScarfSled_func_8038655C(Actor *this){ this->unk10_12 = FALSE; if(!tmp_bool){ if(tmp != 0){ - func_8030E6A4(SFX_19_BANJO_LANDING_08, func_8030E200(this->unk44_31), 0x55f0); + gcsfx_playWithPitch(SFX_19_BANJO_LANDING_08, func_8030E200(this->unk44_31), 0x55f0); } } else{ @@ -67,7 +67,7 @@ void __chScarfSled_func_8038655C(Actor *this){ func_8030E0FC(this->unk44_31, 0.9f, 1.5f, 1.2f); } this->unk10_12 = TRUE; - func_8030E2C4(*((u8*)this + 0x44)); + sfxSource_func_8030E2C4(*((u8*)this + 0x44)); } } diff --git a/src/FP/ch/snowmanbutton.c b/src/FP/ch/snowmanbutton.c index 6d3c1593..8390f402 100644 --- a/src/FP/ch/snowmanbutton.c +++ b/src/FP/ch/snowmanbutton.c @@ -52,7 +52,7 @@ void FP_func_80386BEC(Actor *this){ player_getPosition(plyr_pos); subaddie_set_state_with_direction(this, 2, 0.01f, 1); actor_collisionOff(this); - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); FUNC_8030E624(SFX_90_SWITCH_PRESS, 1.0f, 32000); maSnowButton_decRemaining(); particleEmitter_setRGB(pCtrl, D_80391B44); @@ -78,7 +78,7 @@ void FP_func_80386CF8(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - this->pitch += (f32)(this->unkF4_8 - 1); + this->pitch += (f32)(this->actorTypeSpecificField - 1); } if(!this->volatile_initialized){ diff --git a/src/FP/ch/twinkly.c b/src/FP/ch/twinkly.c index a72a0aa7..ff599604 100644 --- a/src/FP/ch/twinkly.c +++ b/src/FP/ch/twinkly.c @@ -106,7 +106,7 @@ void func_8038C260(f32 position[3], s32 count, enum asset_e model_id){ particleEmitter_setFade(pCtrl, 0.0f, 0.3f); particleEmitter_func_802EF9F8(pCtrl, 0.6f); particleEmitter_func_802EFA18(pCtrl, 0); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setSfx(pCtrl, SFX_7B_ICE_BREAKING_1, 8000); particleEmitter_emitN(pCtrl, count); } @@ -232,10 +232,10 @@ void func_8038C8F0(ActorMarker *marker){ s32 pad; this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); - other = marker_getActor(this->unk100); + other = marker_getActor(this->partnerActor); muncher = actor_spawnWithYaw_f32(ACTOR_337_TWINKLY_MUNCHER, D_80392070, 170); - muncher->unk100 = other->marker; - muncher->unkF4_8 = 1; + muncher->partnerActor = other->marker; + muncher->actorTypeSpecificField = 1; if(pad); } @@ -255,7 +255,7 @@ void func_8038C9A0(Actor *this){ if(this->marker->id == 0x200){ sp30 = func_8034C2C4(this->marker, 0x190); } - other = marker_getActor(this->unk100); + other = marker_getActor(this->partnerActor); if(!this->volatile_initialized){ this->volatile_initialized = TRUE; @@ -279,7 +279,7 @@ void func_8038C9A0(Actor *this){ if(1.0f == other->unk1C[1]){ func_8038C398(this->position, this->marker->id); - FUNC_8030E8B4(SFX_7B_ICE_BREAKING_1, 1.0f, 32000, this->position, 0x6d6, 0xdac);\ + sfx_playFadeShorthandDefault(SFX_7B_ICE_BREAKING_1, 1.0f, 32000, this->position, 0x6d6, 0xdac);\ marker_despawn(this->marker); return; } @@ -326,7 +326,7 @@ void func_8038C9A0(Actor *this){ if(other->unk38_31 != 0){ other->unk38_31--; } - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); marker_despawn(this->marker); } break; @@ -336,11 +336,11 @@ void func_8038C9A0(Actor *this){ if(this->unk1C[1] <= this->position_y){ this->position_y = this->unk1C[1]; if(!fileProgressFlag_get(FILEPROG_82_MET_TWINKLIES)){ - gcdialog_showText(0xc12, 0x2a, this->position, this->marker, func_8038C94C, NULL); + gcdialog_showDialog(0xc12, 0x2a, this->position, this->marker, func_8038C94C, NULL); fileProgressFlag_set(FILEPROG_82_MET_TWINKLIES, TRUE); } else{ - gcdialog_showText(0xc25, 0x2b, this->position, this->marker, func_8038C94C, NULL); + gcdialog_showDialog(0xc25, 0x2b, this->position, this->marker, func_8038C94C, NULL); } subaddie_set_state(this, 5); this->pitch -= 3.0f; diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index 42588153..232cfd7f 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -176,8 +176,8 @@ void func_8038D294(ActorMarker *marker){ func_8038CF54(this->position, 12, ASSET_4D4_MODEL_TWINKLY_BOX_PAPER_SHARD); func_8038D01C(this->position, 12, ASSET_700_SPRITE_DUST); this->velocity[1] = 0.0f; - FUNC_8030E8B4(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, 1000, 3500); - gcdialog_showText(0xc13, 0, NULL, NULL, NULL, NULL); + sfx_playFadeShorthandDefault(SFX_30_MAGIC_POOF, 1.0f, 32000, this->position, 1000, 3500); + gcdialog_showDialog(0xc13, 0, NULL, NULL, NULL, NULL); } void func_8038D324(Actor *this){ @@ -210,9 +210,9 @@ void func_8038D41C(ActorMarker *marker){ Actor *actor; actor = actor_spawnWithYaw_f32(ACTOR_337_TWINKLY_MUNCHER, D_80392354, 170); - actor->unk100 = _marker; + actor->partnerActor = _marker; actor = actor_spawnWithYaw_f32(ACTOR_337_TWINKLY_MUNCHER, D_80392360, 170); - actor->unk100 = _marker; + actor->partnerActor = _marker; if(pad[0]); } @@ -233,7 +233,7 @@ void func_8038D474(ActorMarker *marker){ } actor->unk1C[0] += 1.0; child = spawn_child_actor(D_8039236C[(s32)actor->unk1C[0]], &actor); - child->unk100 = actor->marker; + child->partnerActor = actor->marker; } void func_8038D51C(ActorMarker *marker){ @@ -263,7 +263,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){ func_8028F490(D_8039237C); func_8028F8F8(7, 1); this->unk1C[1] = 0.0f; - func_8025A6EC(COMUSIC_68_TWINKLY_MINIGAME, 25000); + coMusicPlayer_playMusic(COMUSIC_68_TWINKLY_MINIGAME, 25000); func_8025A58C(0, 4000); core1_ce60_incOrDecCounter(FALSE); this->unk1C[2] = 428571.0f; @@ -316,7 +316,7 @@ void func_8038D6C8(Actor *this){ switch (this->state) { case 1: //L8038D89C - if(!func_80329530(this, 800)) + if(!subaddie_playerIsWithinSphereAndActive(this, 800)) break; if(!(globalTimer_getTime() & 1)) @@ -346,7 +346,7 @@ void func_8038D6C8(Actor *this){ || actor_animationIsAt(this, 0.63f) || actor_animationIsAt(this, 0.81f) ){ - FUNC_8030E8B4(SFX_98_DEAF_THUD, 1.0f, 32000, this->position, 400, 2000); + sfx_playFadeShorthandDefault(SFX_98_DEAF_THUD, 1.0f, 32000, this->position, 400, 2000); } break; @@ -382,7 +382,7 @@ void func_8038D6C8(Actor *this){ func_8025AEA0(COMUSIC_68_TWINKLY_MINIGAME, (s32)this->unk1C[2]); if(item_getCount(ITEM_24_TWINKLY_SCORE) == 0){ subaddie_set_state_with_direction(this, 1, 0.001f, 1); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_8038D3D8(); func_80324E38(0.0f, 3); timedFunc_set_1(1.3f, (GenFunction_1)func_8038D51C, (s32)this->marker); @@ -397,7 +397,7 @@ void func_8038D6C8(Actor *this){ actor_playAnimationOnce(this); this->unk38_31 = 0; item_set(ITEM_6_HOURGLASS, FALSE); - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 28000); func_8028F8F8(7, FALSE); this->unk1C[1] = 1.0f; func_8038D3D8(); @@ -426,7 +426,7 @@ bool func_8038DD14(void){ bool func_8038DD34(ActorMarker *marker){ Actor *this = marker_getActor(marker); - if(func_80329530(this, 800)) + if(subaddie_playerIsWithinSphereAndActive(this, 800)) return TRUE; return FALSE; } diff --git a/src/FP/ch/twinklymuncher.c b/src/FP/ch/twinklymuncher.c index 1d451fd2..2ae1d40c 100644 --- a/src/FP/ch/twinklymuncher.c +++ b/src/FP/ch/twinklymuncher.c @@ -59,8 +59,8 @@ void func_8038DEB8(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); if(this->state != 1 && this->state != 5){ func_8038DE78(this); - FUNC_8030E8B4(SFX_87_TANKTUP_OOOHW, 1.6f, 32000, this->position, 1250, 2500); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 26000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_87_TANKTUP_OOOHW, 1.6f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 26000, this->position, 1250, 2500); } } @@ -108,10 +108,10 @@ void func_8038E094(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; anctrl_setAnimTimer(this->anctrl, 0.99999f); this->lifetime_value = 0.0f; - if(this->unkF4_8 == 1){ + if(this->actorTypeSpecificField == 1){ func_8038DDC8(this); } - if(this->unkF4_8 == 2){ + if(this->actorTypeSpecificField == 2){ if(volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) && gcparade_8031B4F4() == -2){ func_8038DDC8(this); } @@ -121,13 +121,13 @@ void func_8038E094(Actor *this){ } } }//L8038E180 - if(this->unk100){ - sp38 = marker_getActor(this->unk100); + if(this->partnerActor){ + sp38 = marker_getActor(this->partnerActor); if(sp38->unk1C[1] == 1.0f){ - if(this->unkF4_8 == 1 && !fileProgressFlag_get(FILEPROG_13_COMPLETED_TWINKLIES_MINIGAME)){ + if(this->actorTypeSpecificField == 1 && !fileProgressFlag_get(FILEPROG_13_COMPLETED_TWINKLIES_MINIGAME)){ if(this->state != 6 && this->state != 7 && 0.0f == this->velocity[0]){ timed_setStaticCameraToNode(0.5f, 0xd); - gcdialog_showText(ASSET_C15_DIALOG_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL); + gcdialog_showDialog(ASSET_C15_DIALOG_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL); this->velocity[0] = 1.0f; subaddie_set_state_with_direction(this, 6, 0.03f, 1); actor_loopAnimation(this); @@ -173,10 +173,10 @@ void func_8038E094(Actor *this){ } if(actor_animationIsAt(this, 0.15f)) - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.35f)) - FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 1.2f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C4_TWINKLY_MUNCHER_GRR, 1.2f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.97f)) func_8038DE08(this); @@ -197,11 +197,11 @@ void func_8038E094(Actor *this){ if(sp38 && sp38->marker->id == this->unk38_31){ if(actor_animationIsAt(this, 0.23)){ func_8038C398(sp38->position, sp38->marker->id); - FUNC_8030E8B4(SFX_110_TWINKLY_DEATH, 1.0f, 32000, this->position, 1250, 2500); - FUNC_8030E8B4(SFX_27_JINJO_HI, 1.6f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_110_TWINKLY_DEATH, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_27_JINJO_HI, 1.6f, 32000, this->position, 1250, 2500); func_80324D54(0.35f, SFX_110_TWINKLY_DEATH, 1.0f, 32000, this->position, 1250.0f, 2500.0f); marker_despawn(sp38->marker); - if( !mapSpecificFlags_get(0xa) && gcdialog_showText(0xc16, 0, NULL, NULL, NULL, NULL)){ + if( !mapSpecificFlags_get(0xa) && gcdialog_showDialog(0xc16, 0, NULL, NULL, NULL, NULL)){ mapSpecificFlags_set(0xa, TRUE); } } diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 04e03964..cbd2f40c 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -101,7 +101,7 @@ void func_8038F41C(Actor *this){ } void func_8038F454(Actor *this){ - if(!mapSpecificFlags_get(7) && player_movementGroup() != BSGROUP_A_FLYING && func_80329530(this, 1000) ){ + if(!mapSpecificFlags_get(7) && player_movementGroup() != BSGROUP_A_FLYING && subaddie_playerIsWithinSphereAndActive(this, 1000) ){ mapSpecificFlags_set(7, TRUE); subaddie_set_state(this, 2); actor_loopAnimation(this); @@ -136,7 +136,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){ this->yaw_ideal = (f32) func_803297C8(this, arg1); func_80328FB0(this, arg3); if(actor_animationIsAt(this, 0.9f)){ - FUNC_8030E8B4(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000); + sfx_playFadeShorthandDefault(SFX_3F2_UNKNOWN, 0.8f, 24000, this->position, 500, 2000); } this->actor_specific_1_f = (1.0f- sp24)*arg2; func_80329054(this, 2); @@ -164,8 +164,8 @@ void FP_func_8038F758(ActorMarker *marker){ s32 pad; jiggy->yaw = this->yaw; - this->unk100 = jiggy->marker; - jiggy->unk100 = this->marker; + this->partnerActor = jiggy->marker; + jiggy->partnerActor = this->marker; } @@ -222,13 +222,13 @@ void FP_func_8038F7AC(Actor *this){ break; } - if(func_80329530(this, 1300) && player_getTransformation() == TRANSFORM_4_WALRUS){ + if(subaddie_playerIsWithinSphereAndActive(this, 1300) && player_getTransformation() == TRANSFORM_4_WALRUS){ subaddie_set_state_with_direction(this, 8, 0.02f, 1); actor_loopAnimation(this); break; } - if(func_80329530(this, 1000) && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)){ + if(subaddie_playerIsWithinSphereAndActive(this, 1000) && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)){ func_8038F454(this); break; } @@ -246,7 +246,7 @@ void FP_func_8038F7AC(Actor *this){ break; case 4: //L8038FAD0 - if(!func_80329530(this, 2000) && player_movementGroup() != BSGROUP_A_FLYING){ + if(!subaddie_playerIsWithinSphereAndActive(this, 2000) && player_movementGroup() != BSGROUP_A_FLYING){ func_8038F560(this); break; } @@ -267,13 +267,13 @@ void FP_func_8038F7AC(Actor *this){ case 6: //L8038FBA8 FP_func_8038F6C4(this, local->unk18, 1.0f); - if( func_80329530(this, 1700) ) break; + if( subaddie_playerIsWithinSphereAndActive(this, 1700) ) break; if( player_movementGroup() == BSGROUP_A_FLYING ) break; func_8038F560(this); if(!local->unk30){ - if(gcdialog_showText(0xc1d, 0x20, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(0xc1d, 0x20, NULL, NULL, NULL, NULL)){ local->unk30 = TRUE; } } @@ -283,7 +283,7 @@ void FP_func_8038F7AC(Actor *this){ if(!FP_func_8038F6C4(this, local->unkC, 4.5f)) break; - if(func_80329530(this, 1000) || player_movementGroup() == BSGROUP_A_FLYING){ + if(subaddie_playerIsWithinSphereAndActive(this, 1000) || player_movementGroup() == BSGROUP_A_FLYING){ func_8038F528(this); break; } @@ -299,8 +299,8 @@ void FP_func_8038F7AC(Actor *this){ break; } - if(func_80329530(this, 500) && !this->has_met_before){ - if(gcdialog_showText(0xc1c, 0xAA, this->position, this->marker, func_8038F330, func_8038F3C4)){ + if(subaddie_playerIsWithinSphereAndActive(this, 500) && !this->has_met_before){ + if(gcdialog_showDialog(0xc1c, 0xAA, this->position, this->marker, func_8038F330, func_8038F3C4)){ timed_setStaticCameraToNode(0.0f, 0x2E); this->has_met_before = TRUE; } @@ -317,13 +317,13 @@ void FP_func_8038F7AC(Actor *this){ func_8038F598(this, 2.0f); - if(!func_803114B0()){ + if(!gcdialog_hasCurrentTextId()){ if( actor_animationIsAt(this, 0.02f) || actor_animationIsAt(this, 0.14f) || actor_animationIsAt(this, 0.28f) || actor_animationIsAt(this, 0.42f) ){ - FUNC_8030E8B4(SFX_88_WOZZA_NOISE, 1.0f, 32000, this->position, 500, 2000); + sfx_playFadeShorthandDefault(SFX_88_WOZZA_NOISE, 1.0f, 32000, this->position, 500, 2000); } } break; diff --git a/src/FP/ch/wozzasjig.c b/src/FP/ch/wozzasjig.c index 403cca8d..b5152d1c 100644 --- a/src/FP/ch/wozzasjig.c +++ b/src/FP/ch/wozzasjig.c @@ -47,8 +47,8 @@ void func_8038FF54(Actor *this){ this->marker->propPtr->unk8_3 = FALSE; actor_collisionOff(this); - if(this->unk100){ - other = marker_getActor(this->unk100); + if(this->partnerActor){ + other = marker_getActor(this->partnerActor); if(this->state != 9){ if(other->state == 9){ subaddie_set_state_with_direction(this, 9, 0.01f, 1); diff --git a/src/FP/ch/xmastree.c b/src/FP/ch/xmastree.c index 99f93506..cf86da31 100644 --- a/src/FP/ch/xmastree.c +++ b/src/FP/ch/xmastree.c @@ -43,7 +43,7 @@ void __chXmasTree_80386F3C(void){ levelSpecificFlags_set(LEVEL_FLAG_29_FP_UNKNOWN, TRUE); func_803228D8(); volatileFlag_set(VOLATILE_FLAG_E, 1); - func_802E4078(MAP_53_FP_CHRISTMAS_TREE, 1, 0); + transitionToMap(MAP_53_FP_CHRISTMAS_TREE, 1, 0); } void __chXmasTree_80386F84(Actor * this){ @@ -67,9 +67,9 @@ void __chXmasTree_spawnStar(void *marker){ void __chXmasTree_80387038(Actor *this){ if(func_8030E3FC(this->unk44_31)) - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); sfxsource_playSfxAtVolume(this->unk44_31, randf2(0.9f, 1.1f)); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } void __chXmasTree_8038709C(Actor *this){ @@ -95,7 +95,7 @@ void chXmasTree_update(Actor *this){ if(this->unk44_31 == 0){ this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_415_UNKNOWN); - func_8030DD14(this->unk44_31, 3); + sfxSource_setunk43_7ByIndex(this->unk44_31, 3); sfxsource_setSampleRate(this->unk44_31, 28000); } __spawnQueue_add_0(__chXmasTree_spawnSwitch); @@ -126,9 +126,9 @@ void chXmasTree_update(Actor *this){ subaddie_set_state(this, 3); this->lifetime_value = 2.0f; - func_8025A6EC(COMUSIC_61_XMAS_TREE_LIGHTS_UP, 28000); - func_802BAFE4(0x1A); - gcdialog_showText(0xC14, 0, NULL, NULL, NULL, NULL); + coMusicPlayer_playMusic(COMUSIC_61_XMAS_TREE_LIGHTS_UP, 28000); + gcStaticCamera_activate(0x1A); + gcdialog_showDialog(0xC14, 0, NULL, NULL, NULL, NULL); break; case 3: // L803872F0 @@ -178,8 +178,8 @@ void chXmasTree_update(Actor *this){ this->lifetime_value = 0.1f; if(!maSlalom_isActive()){ if(!mapSpecificFlags_get(9) || mapSpecificFlags_get(1)){ - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000); - func_802BAFE4(0x1a); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 28000); + gcStaticCamera_activate(0x1a); this->lifetime_value = 2.0f; } } diff --git a/src/FP/ch/xmastreeeggtoll.c b/src/FP/ch/xmastreeeggtoll.c index 42b6cf9a..dba28e9a 100644 --- a/src/FP/ch/xmastreeeggtoll.c +++ b/src/FP/ch/xmastreeeggtoll.c @@ -61,7 +61,7 @@ void func_80390D58(f32 position[3]){ void func_80390E78(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); - FUNC_8030E8B4(SFX_96_HOTSAND_EEL_HISS, 1.0f, 32000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_96_HOTSAND_EEL_HISS, 1.0f, 32000, this->position, 1000, 2000); } void func_80390EB0(Actor *this){ @@ -71,7 +71,7 @@ void func_80390EB0(Actor *this){ marker_setCollisionScripts(this->marker, func_80390E78, NULL, NULL); } - if(viewport_func_8024DB50(this->position, 150.0f) || func_80329530(this, 1200)) + if(viewport_func_8024DB50(this->position, 150.0f) || subaddie_playerIsWithinSphereAndActive(this, 1200)) { if( !(globalTimer_getTime() & 3) && randf() < 0.2){ func_80390C70(this->position); diff --git a/src/FP/ch/xmastreeice.c b/src/FP/ch/xmastreeice.c index bdee2e83..c7d995e7 100644 --- a/src/FP/ch/xmastreeice.c +++ b/src/FP/ch/xmastreeice.c @@ -38,7 +38,7 @@ void func_80390944(f32 position[3], s32 cnt, enum asset_e model_id){ particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_80392754); particleEmitter_func_802EF9F8(pCtrl, 0.6f); particleEmitter_func_802EFA18(pCtrl, 0); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setSfx(pCtrl, SFX_7B_ICE_BREAKING_1, 8000); particleEmitter_emitN(pCtrl, cnt); } @@ -65,14 +65,14 @@ void func_80390ABC(ActorMarker *marker){ func_80390944(this->position, 0xA, 0x4D3); func_80390A30(this->position, 6, ASSET_700_SPRITE_DUST); func_8030E6D4(SFX_B6_GLASS_BREAKING_1); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); this->unk38_31 = 1; } void func_80390B2C(ActorMarker *marker){ Actor *this = marker_getActor(marker); func_803228D8(); - func_802E4078(MAP_27_FP_FREEZEEZY_PEAK, 0xd, 0); + transitionToMap(MAP_27_FP_FREEZEEZY_PEAK, 0xd, 0); marker_despawn(this->marker); } diff --git a/src/FP/ch/xmastreestar.c b/src/FP/ch/xmastreestar.c index eafa7a0a..e00dc212 100644 --- a/src/FP/ch/xmastreestar.c +++ b/src/FP/ch/xmastreestar.c @@ -42,7 +42,7 @@ void func_8038EC5C(Actor *this){ this->unk38_31++; this->lifetime_value = 0.33f; if(this->unk38_31 < 4){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } diff --git a/src/FP/ch/xmastreeswitch.c b/src/FP/ch/xmastreeswitch.c index 12be8994..d053502b 100644 --- a/src/FP/ch/xmastreeswitch.c +++ b/src/FP/ch/xmastreeswitch.c @@ -40,7 +40,7 @@ void func_8038E7CC(ActorMarker *this_marker, ActorMarker *other_marker){ if(this->state == 2){ this->unk38_31++; if(this->unk38_31 < 4){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } } diff --git a/src/FP/code_19E0.c b/src/FP/code_19E0.c index 09cedd84..8e1576d0 100644 --- a/src/FP/code_19E0.c +++ b/src/FP/code_19E0.c @@ -127,7 +127,7 @@ void func_803881AC(Actor *this){ if(0.0f == this->velocity_x) return; }else{ - if(!func_80329530(this, 2000) && !maSlolam_WithinRadiusOfBoggy(this->position, 2000)) + if(!subaddie_playerIsWithinSphereAndActive(this, 2000) && !maSlolam_WithinRadiusOfBoggy(this->position, 2000)) return; this->marker->collidable = TRUE; this->unk124_6 = TRUE; @@ -142,11 +142,11 @@ void func_803881AC(Actor *this){ } if( 1.0f == this->velocity_x && func_80387EE4(this)){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); - maSlalom_setPlayerGate(this->unkF4_8); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); + maSlalom_setPlayerGate(this->actorTypeSpecificField); } if(func_80388000(this)){ - maSlalom_setBoggyGate(this->unkF4_8); + maSlalom_setBoggyGate(this->actorTypeSpecificField); } } diff --git a/src/FP/code_1FF0.c b/src/FP/code_1FF0.c index 8d5b95ae..69ea8d95 100644 --- a/src/FP/code_1FF0.c +++ b/src/FP/code_1FF0.c @@ -70,7 +70,7 @@ void func_80388584(Actor *this){ } } else{//L80388694 - if(!func_80329530(this, 2000)&& !maSlolam_WithinRadiusOfBoggy(this->position, 2000)) + if(!subaddie_playerIsWithinSphereAndActive(this, 2000)&& !maSlolam_WithinRadiusOfBoggy(this->position, 2000)) return; this->marker->collidable = TRUE; this->unk124_6 = TRUE; diff --git a/src/FP/code_B4D0.c b/src/FP/code_B4D0.c index 4bb71c44..51bb2786 100644 --- a/src/FP/code_B4D0.c +++ b/src/FP/code_B4D0.c @@ -35,6 +35,6 @@ void func_8039195C(void){ void func_80391994(void){ if(map_get() == MAP_7F_FP_WOZZAS_CAVE){ func_8030DB04(Me.sound, 22000, Me.position, 400.0f, 1200.0f); - func_8030E2C4(Me.sound); + sfxSource_func_8030E2C4(Me.sound); } } diff --git a/src/FP/ma/slalom.c b/src/FP/ma/slalom.c index 48f3f645..62f81783 100644 --- a/src/FP/ma/slalom.c +++ b/src/FP/ma/slalom.c @@ -107,8 +107,8 @@ void __maSlalom_spawnGate(s32 indx, s32 arg1){ a1->unk38_31 = 1; a2->unk38_31 = 1; - a1->unkF4_8 = indx + 1; - a2->unkF4_8 = indx + 1; + a1->actorTypeSpecificField = indx + 1; + a2->actorTypeSpecificField = indx + 1; meActiveFlags[indx].marker = a1->marker; meDummyFlags[indx].marker = a2->marker; @@ -279,7 +279,7 @@ void maSlalom_win(void){ player_stateTimer_set(STATE_TIMER_3_TURBO_TALON, 2.0f); } func_8028F918(1); - func_8025A6EC(COMUSIC_3B_MINIGAME_VICTORY, 28000); + coMusicPlayer_playMusic(COMUSIC_3B_MINIGAME_VICTORY, 28000); FP_func_8038AB60(0); func_8038ABDC(); timed_setStaticCameraToNode(0.0f, 1); @@ -293,7 +293,7 @@ void maSlalom_lose(void){ pntBoggy = marker_getActor(Me.boggyLink); pntBoggy->unk38_31 = 1; - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 28000); FP_func_8038AB60(0); func_8038ABDC(); if(!jiggyscore_isCollected(JIGGY_30_FP_BOGGY_2)){ @@ -407,7 +407,7 @@ void maSlalom_linkActiveFlag(ActorMarker *marker){ Actor *actor = marker_getActor(marker); s32 num; - num = actor->unkF4_8 - 1; + num = actor->actorTypeSpecificField - 1; if(num < NUM_GATES){ meActiveFlags[num].marker = actor->marker; meActiveFlags[num].position[0] = actor->position[0]; @@ -421,7 +421,7 @@ void maSlalom_linkDummyFlag(ActorMarker *marker){ Actor *actor = marker_getActor(marker); s32 num; - num = actor->unkF4_8 - 1; + num = actor->actorTypeSpecificField - 1; if(num < NUM_GATES){ meDummyFlags[num].marker = actor->marker; meDummyFlags[num].position[0] = actor->position[0]; @@ -538,7 +538,7 @@ void maSlalom_setBoggyGate(s32 gate_num){ FP_func_8038AB60(0); if(!player_isDead()){ func_8028F918(2); - gcdialog_showText(0xc10, 0x20, NULL, NULL, maSlalom_dialogCallback, NULL); + gcdialog_showDialog(0xc10, 0x20, NULL, NULL, maSlalom_dialogCallback, NULL); }//L8038BD40 Me.state = MA_SLALOM_STATE_4_LOSE; break; @@ -546,7 +546,7 @@ void maSlalom_setBoggyGate(s32 gate_num){ case 3: if(!Me.hasBeenThreeBehind && !player_isDead()){ Me.hasBeenThreeBehind = 1; - gcdialog_showText(0xc0f, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xc0f, 0x20, NULL, NULL, NULL, NULL); }//L8038BD94 func_8025AEA0(0x3a, 0x411aa); break; @@ -554,7 +554,7 @@ void maSlalom_setBoggyGate(s32 gate_num){ case 2: if(!Me.hasBeenTwoBehind && !player_isDead()){ Me.hasBeenTwoBehind = 1; - gcdialog_showText(0xc0e, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xc0e, 0x20, NULL, NULL, NULL, NULL); }//L8038BDF0 func_8025AEA0(0x3a, 0x493e0); break; diff --git a/src/FP/ma/snowbutton.c b/src/FP/ma/snowbutton.c index d183f1d1..3d1d5023 100644 --- a/src/FP/ma/snowbutton.c +++ b/src/FP/ma/snowbutton.c @@ -47,7 +47,7 @@ void maSnowButton_update(void){ case MA_SNOW_BUTTON_STATE_1_ACTIVE: if(Me.remainingButtonCount <= 0){ Me.state = MA_SNOW_BUTTON_STATE_2_WIN; - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); Me.delay = 0; } break; @@ -56,7 +56,7 @@ void maSnowButton_update(void){ if(!(Me.delay < 30)){ if(Me.jiggySpawnerExists){ - func_802BAFE4(0x11); + 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]), diff --git a/src/FP/ma/snowy.c b/src/FP/ma/snowy.c index c49d6c43..2e636ea5 100644 --- a/src/FP/ma/snowy.c +++ b/src/FP/ma/snowy.c @@ -58,7 +58,7 @@ void maSnowy_update(void){ case MA_SNOWY_STATE_2_WIN: if(Me.delay >= 75){ if(Me.jiggySpawnerExists){ - func_802BAFE4(0x12); + 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]), diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index c8f39daa..a2bedb8b 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -65,9 +65,9 @@ void func_80386620(Actor *this){ D_80390C28[phi_s1 + 1] = D_80390C28[phi_s1 + 2]; D_80390C28[phi_s1 + 2] = temp_a0; temp_v0_3 = marker_getActor(D_80390C28[phi_s1 + 1]); - temp_v0_3->unkF4_8 = phi_s1 + 2; + temp_v0_3->actorTypeSpecificField = phi_s1 + 2; temp_v0_3 = marker_getActor(D_80390C28[phi_s1 + 2]); - temp_v0_3->unkF4_8 = phi_s1 + 3; + temp_v0_3->actorTypeSpecificField = phi_s1 + 3; } phi_s1 = (phi_s1 == 2) ? 0 : phi_s1 + 1; phi_s2 <<= 1; @@ -86,7 +86,7 @@ void func_803867CC(void){ void func_803867F4(void){ f32 sp24[3]; - func_802BAFE4(4); + 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])); @@ -98,7 +98,7 @@ void func_80386850(ActorMarker *caller_marker, enum asset_e text_id, s32 arg2){ if(text_id == 0xA80){ subaddie_set_state_with_direction(caller, 2, 0.0f, 1); actor_playAnimationOnce(caller); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); timedFunc_set_0(1.0f, func_803867F4); } } @@ -119,13 +119,13 @@ void chAncientOne_update(Actor *this){ } } if(!this->initialized){ - if(D_80390C28[this->unkF4_8 - 1]) + if(D_80390C28[this->actorTypeSpecificField - 1]) return; LOCAL_CH_ANCIENT_ONE(this)->unk1C = this->position_y; this->position_y -= 1100.0f; - D_80390C28[this->unkF4_8 - 1] = this->marker; - if(this->unkF4_8 != 1){ + D_80390C28[this->actorTypeSpecificField - 1] = this->marker; + if(this->actorTypeSpecificField != 1){ this->marker->propPtr->unk8_4 = FALSE; } this->marker->propPtr->unk8_3 = TRUE; @@ -144,12 +144,12 @@ void chAncientOne_update(Actor *this){ this->position_y = LOCAL_CH_ANCIENT_ONE(this)->unk1C; if( sp40 == (LOCAL_CH_ANCIENT_ONE(this)->unk4_31 ^ 1)){ if((sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]) < (f32)LOCAL_CH_ANCIENT_ONE(this)->unk4_30){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); for(sp38= 7; sp38< 0xC && mapSpecificFlags_get(sp38);sp38++); mapSpecificFlags_set(sp38, TRUE); if(sp38== 0xB){ if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){ - gcdialog_showText(ASSET_A80_DIALOG_ANICIENT_ONES_DONE, 0xE, NULL, this->marker, func_80386850, NULL); + gcdialog_showDialog(ASSET_A80_DIALOG_ANICIENT_ONES_DONE, 0xE, NULL, this->marker, func_80386850, NULL); } else{ func_80386850(this->marker, 0xA80, -1); @@ -158,15 +158,16 @@ void chAncientOne_update(Actor *this){ else { if(sp38== 7){ if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){ - gcdialog_showText(ASSET_A7F_DIALOG_ANICIENT_ONES_MEET, 0x4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A7F_DIALOG_ANICIENT_ONES_MEET, 0x4, NULL, NULL, NULL, NULL); } } subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_playAnimationOnce(this); - if(this->unkF4_8 < 5){ - D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE; - func_802BAFE4(GV_D_80390C20[this->unkF4_8 - 1]); + + if(this->actorTypeSpecificField < 5){ + D_80390C28[this->actorTypeSpecificField]->propPtr->unk8_4 = TRUE; + gcStaticCamera_activate(GV_D_80390C20[this->actorTypeSpecificField - 1]); core1_7090_initSfxSource(2, 0x86, 0x7ff8, 0.3f); timedFunc_set_0(0.45f, func_8038678C); @@ -181,7 +182,7 @@ void chAncientOne_update(Actor *this){ this->position_y += 18.0; this->position_x += (sp38 & 1) ? 0x17 : -0x17; this->position_z += (sp38 & 2) ? 0xC : -0xC; - if(this->unkF4_8 != 1){ + 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)); } diff --git a/src/GV/ch/gobi1.c b/src/GV/ch/gobi1.c index 5d27ceef..8f2d7cf3 100644 --- a/src/GV/ch/gobi1.c +++ b/src/GV/ch/gobi1.c @@ -63,7 +63,7 @@ void chGobi1_setState(Actor *this, s32 next_state){ } if(this->state == 6){ - FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); + sfx_playFadeShorthandDefault(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); skeletalAnim_set(this->unk148, 0x241, 0.2f, 0.5f); } } @@ -140,14 +140,14 @@ void chGobi1_update(Actor *this){ sp6C = 5; if(ml_timer_update(&local->unkC, tick)) - FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 32000, this->position, 1500, 2500); + sfx_playFadeShorthandDefault(SFX_84_GOBI_CRYING, 0.9f, 32000, this->position, 1500, 2500); if(ml_timer_update(&local->unk10, tick)){ for(i = 0; i < 2; i++){ sfxsource_setSfxId(local->unk0[i], SFX_3F9_UNKNOWN); - func_8030DD14(local->unk0[i], 3); + sfxSource_setunk43_7ByIndex(local->unk0[i], 3); sfxsource_setSampleRate(local->unk0[i], 32000); - func_8030E2C4(local->unk0[i]); + sfxSource_func_8030E2C4(local->unk0[i]); } } @@ -177,10 +177,10 @@ void chGobi1_update(Actor *this){ if(this->state == 1 || this->state == 2){ if( !this->has_met_before - && func_80329530(this, 250) - && !func_80329530(this, 80) + && subaddie_playerIsWithinSphereAndActive(this, 250) + && !subaddie_playerIsWithinSphereAndActive(this, 80) && func_8028F2A0() - && gcdialog_showText(0xa73, 0, NULL, NULL, NULL, NULL) + && gcdialog_showDialog(0xa73, 0, NULL, NULL, NULL, NULL) ){ this->has_met_before = TRUE; } diff --git a/src/GV/ch/gobi2.c b/src/GV/ch/gobi2.c index 9e78e898..77da5e72 100644 --- a/src/GV/ch/gobi2.c +++ b/src/GV/ch/gobi2.c @@ -108,7 +108,7 @@ void chGobi2_setState(Actor *this, s32 next_state){ } if(next_state == 8){ - FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); + sfx_playFadeShorthandDefault(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); skeletalAnim_set(this->unk148, ASSET_242_ANIM_GOBI_RELAXING, 0.2f, 0.5f); } @@ -201,9 +201,9 @@ void chGobi2_update(Actor *this){ if(this->state == 2){ if(!this->has_met_before){ - if(func_80329530(this, 0xFA) && !func_80329530(this, 0x50)){ + if(subaddie_playerIsWithinSphereAndActive(this, 0xFA) && !subaddie_playerIsWithinSphereAndActive(this, 0x50)){ if(func_8028F2A0()){ - if(gcdialog_showText(ASSET_A75_DIALOG_GOBI2_MEET, 0, this->position, NULL, NULL, NULL)) + if(gcdialog_showDialog(ASSET_A75_DIALOG_GOBI2_MEET, 0, this->position, NULL, NULL, NULL)) this->has_met_before = TRUE; } } diff --git a/src/GV/ch/gobi3.c b/src/GV/ch/gobi3.c index 3633cbae..03391066 100644 --- a/src/GV/ch/gobi3.c +++ b/src/GV/ch/gobi3.c @@ -72,7 +72,7 @@ void chGobi3_setState(Actor *this, s32 next_state){ if(next_state == 5){ skeletalAnim_set(this->unk148, 0xd9, 0.5f, 4.0f); - gcdialog_showText(ASSET_A77_DIALOG_GOBI3_DONE, 0xe, this->position, this->marker, __chGobi3_runaway, NULL); + gcdialog_showDialog(ASSET_A77_DIALOG_GOBI3_DONE, 0xe, this->position, this->marker, __chGobi3_runaway, NULL); } if(next_state == 4){ @@ -85,7 +85,7 @@ void chGobi3_setState(Actor *this, s32 next_state){ } if(next_state == 7){ - FUNC_8030E8B4(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); + sfx_playFadeShorthandDefault(SFX_84_GOBI_CRYING, 0.9f, 20000, this->position, 1500, 2500); skeletalAnim_set(this->unk148, ASSET_242_ANIM_GOBI_RELAXING, 0.2f, 0.5f); } diff --git a/src/GV/ch/gobirock.c b/src/GV/ch/gobirock.c index 1e275d4b..fa39dd6b 100644 --- a/src/GV/ch/gobirock.c +++ b/src/GV/ch/gobirock.c @@ -41,7 +41,7 @@ void __chGobiRock_setState(Actor *this, s32 next_state){ FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.5f, 9000); FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.7f, 9000); FUNC_8030E624(SFX_9B_BOULDER_BREAKING_1, 0.9f, 9000); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_802F066C(local->unkC, local->unk0); particleEmitter_emitN(local->unkC, 10); func_802F053C(local->unk10, local->unk0); diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 12dab302..aecebcdf 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -38,8 +38,8 @@ int func_8038D920(Actor *this, f32 arg1){ f32 sp20[3]; f32 sp1C; - this->unkF4_8 = 20; - sp1C = (f32)(this->unkF4_8 + 25); + this->actorTypeSpecificField = 20; + sp1C = (f32)(this->actorTypeSpecificField + 25); player_getPosition(sp20); ml_vec3f_diff_copy(sp2C, this->position, sp20); return this->position_y < sp20[1] && sp20[1] <= arg1 && sp2C[0]*sp2C[0] + sp2C[2]*sp2C[2] < sp1C*sp1C; @@ -62,7 +62,7 @@ Actor *func_8038DA18(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ sp38[1] = this->position_y; } if(func_8038D920(this, sp38[1])){ - player_setClimbParams(sp2C, sp38, (f32)this->unkF4_8, 2); + player_setClimbParams(sp2C, sp38, (f32)this->actorTypeSpecificField, 2); } return this; @@ -96,7 +96,7 @@ void func_8038DB88(Actor *this){ tmp = this->unk44_31; if(tmp){ if(func_8030E3FC(tmp)){ - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); } sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; @@ -148,11 +148,11 @@ void func_8038DBDC(Actor *this){ if(actor_animationIsAt(this, 0.2f) && this->unk44_31 == 0){ this->unk44_31 = func_8030ED2C(0x3F7, 3); this->unk1C[1] = 1.0f; - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); }//L8038DE08 if(actor_animationIsAt(this, 0.7f)){ func_8038DB88(this); - FUNC_8030E8B4(SFX_3F8_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_3F8_UNKNOWN, 1.0f, 32000, this->position, 1250, 2500); } } break; @@ -177,16 +177,16 @@ void func_8038DBDC(Actor *this){ } else{ if(actor_animationIsAt(this, 0.04f)) - FUNC_8030E8B4(SFX_7C_CHEBOOF, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_7C_CHEBOOF, 1.0f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.04f)) - FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2C_PULLING_NOISE, 1.0f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.33f)) - FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2C_PULLING_NOISE, 1.2f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.66f)) - FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.4f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2C_PULLING_NOISE, 1.4f, 32000, this->position, 1250, 2500); } break; case 5: //8038DFC8 @@ -202,7 +202,7 @@ void func_8038DBDC(Actor *this){ if(!this->unk44_31){ this->unk44_31 = func_8030ED2C(SFX_2C_PULLING_NOISE, 3); this->unk1C[1] = 1.9f; - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } } else{//L8038E070 @@ -216,7 +216,7 @@ void func_8038DBDC(Actor *this){ } else{ if(actor_animationIsAt(this, 0.42f)) - sfxsource_play(SFX_7C_CHEBOOF, 32000); + gcsfx_playAtSampleRate(SFX_7C_CHEBOOF, 32000); tmp = this->unk44_31; if(tmp && func_8030E3FC(tmp)){ if(1.0 < this->unk1C[1]){ diff --git a/src/GV/ch/mazectrl.c b/src/GV/ch/mazectrl.c index a5380640..5aef27df 100644 --- a/src/GV/ch/mazectrl.c +++ b/src/GV/ch/mazectrl.c @@ -65,7 +65,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ local->unk8 = 0.0f; if(next_state == 2){ func_8025A58C(0, 4000); - func_8025A6EC(COMUSIC_26_GV_SANDYBUTT_DANGER, 30000); + coMusicPlayer_playMusic(COMUSIC_26_GV_SANDYBUTT_DANGER, 30000); item_set(ITEM_0_HOURGLASS_TIMER, 0xdd3); item_set(ITEM_6_HOURGLASS, TRUE); func_8038F520(1.0f); @@ -85,7 +85,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ } if (!levelSpecificFlags_get(LEVEL_FLAG_16_GV_UNKNOWN)) { - gcdialog_showText(ASSET_A82_DIALOG_SANDYBUTT_START_MAZE, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A82_DIALOG_SANDYBUTT_START_MAZE, 4, NULL, NULL, NULL, NULL); levelSpecificFlags_set(LEVEL_FLAG_16_GV_UNKNOWN, TRUE); } }//L8038F794 @@ -99,7 +99,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ if(next_state == 3){ func_80324E38(0.0f, 3); - timedFunc_set_2(0.0f, (GenFunction_2)func_8025A6EC, COMUSIC_3E_SANDYBUTT_FAILURE, 0x7FFF); + timedFunc_set_2(0.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_3E_SANDYBUTT_FAILURE, 0x7FFF); timedFunc_set_2(1.0f, (GenFunction_2)__chMazeCtrl_markerSetState, reinterpret_cast(s32, this->marker), 6); timedFunc_set_2(2.0f, (GenFunction_2)__chMazeCtrl_markerSetState, reinterpret_cast(s32, this->marker), 4); }//L8038F850 @@ -132,10 +132,10 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ if(next_state == 5){ func_8038F56C(0.0f); if(++local->unk4 == 1) - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); if(!levelSpecificFlags_get(LEVEL_FLAG_17_GV_UNKNOWN)){ - gcdialog_showText(ASSET_A83_DIALOG_SANDYBUTT_DONE, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A83_DIALOG_SANDYBUTT_DONE, 4, NULL, NULL, NULL, NULL); levelSpecificFlags_set(LEVEL_FLAG_17_GV_UNKNOWN, TRUE); } } @@ -178,7 +178,7 @@ void chMazeCtrl_update(Actor *this){ if (!levelSpecificFlags_get(LEVEL_FLAG_15_GV_UNKNOWN) && ml_timer_update(&local->unk8, sp34) - && gcdialog_showText(ASSET_A81_DIALOG_SANDYBUTT_ENTER, 0, NULL, NULL, NULL, NULL) + && gcdialog_showDialog(ASSET_A81_DIALOG_SANDYBUTT_ENTER, 0, NULL, NULL, NULL, NULL) ) { levelSpecificFlags_set(LEVEL_FLAG_15_GV_UNKNOWN, TRUE); } diff --git a/src/GV/ch/sarcophagus.c b/src/GV/ch/sarcophagus.c index 6af500e2..a9c06e9c 100644 --- a/src/GV/ch/sarcophagus.c +++ b/src/GV/ch/sarcophagus.c @@ -2,8 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_802EE6CC(f32[3], s32[4], s32[4], s32, f32, f32, s32, s32, s32); - +#include "core2/dustemitter.h" void chSarcophagus_update(Actor *this); void chSarcophagus_updateSNS(Actor *this); @@ -43,8 +42,8 @@ void GV_func_803894B0(Actor *this){ } void func_80389518(Actor *this){ - func_802EE6CC(this->unk1C, D_80390E88, D_80390E78, 0, - 0.55f, 50.0f, 0xDC, 0x168, 0 + dustEmitter_emit(this->unk1C, D_80390E88, D_80390E78, 0, + 0.55f, 50.0f, 0xDC, 0x168, DUST_EMITTER_TYPE_DUST ); } @@ -71,10 +70,10 @@ void chSarcophagus_update(Actor *this){ if(!this->initialized){ GV_func_803894B0(this); } - if(func_80329530(this, 500) && func_8038957C(this)){ + if(subaddie_playerIsWithinSphereAndActive(this, 500) && func_8038957C(this)){ subaddie_set_state_with_direction(this, 2, 0.01f, 1); - FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); - FUNC_8030E8B4(SFX_3F6_RUBBING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_3F6_RUBBING, 1.0f, 32000, this->position, 1250, 2500); } break; @@ -84,7 +83,7 @@ void chSarcophagus_update(Actor *this){ && actor_animationIsAt(this, 0.1f) && !jiggyscore_isCollected(JIGGY_41_GV_MAZE) ){ - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7fff); this->unk38_31 = 1; } if(actor_animationIsAt(this, 0.5f)){ @@ -93,10 +92,10 @@ void chSarcophagus_update(Actor *this){ break; case 3: //L80389788 - if(!func_80329530(this, 700)){ + if(!subaddie_playerIsWithinSphereAndActive(this, 700)){ subaddie_set_state_with_direction(this, 4, 0.5f, 1); - FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); - FUNC_8030E8B4(SFX_3F6_RUBBING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_3F6_RUBBING, 1.0f, 32000, this->position, 1250, 2500); } break; case 4: //L803897E4 @@ -113,7 +112,7 @@ void chSarcophagus_update(Actor *this){ subaddie_set_state_with_direction(this, 1, 0.01f, 1); } else if(actor_animationIsAt(this, 0.9f)){ - FUNC_8030E8B4(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_7F_HEAVYDOOR_SLAM, 1.0f, 32000, this->position, 1250, 2500); } break; }//L803898A8 @@ -133,8 +132,8 @@ void chSarcophagus_updateSNS(Actor *this){ this->unk1C[0] -= 1.0f; if(this->unk1C[0] == 0.0f){ subaddie_set_state_with_direction(this, 5, 0.01f, 1); - FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 0.5f, 32000, this->position, 1250, 2500); - FUNC_8030E8B4(SFX_3F6_RUBBING, 0.5f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_6B_LOCKUP_OPENING, 0.5f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_3F6_RUBBING, 0.5f, 32000, this->position, 1250, 2500); } } else{//L803899C0 diff --git a/src/GV/ch/toots.c b/src/GV/ch/toots.c index dd8e87e9..8590d097 100644 --- a/src/GV/ch/toots.c +++ b/src/GV/ch/toots.c @@ -60,7 +60,7 @@ void chtoots_update(Actor *this){ else if(this->unk38_31 != 0){ this->unk38_31--; if(this->unk38_31 == 6){ - FUNC_8030E8B4(SFX_DD_JINJO_TALKING, 1.0f, 20000, this->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_DD_JINJO_TALKING, 1.0f, 20000, this->position, 1500, 4500); } } else{ diff --git a/src/GV/ch/trunker.c b/src/GV/ch/trunker.c index 6c22d026..0ad21a0e 100644 --- a/src/GV/ch/trunker.c +++ b/src/GV/ch/trunker.c @@ -70,11 +70,11 @@ void chTrucker_update(Actor *this){ }//L803891D8 if( this->state == 1 && !this->has_met_before - && func_80329530(this, 250) - && !func_80329530(this, 80) + && subaddie_playerIsWithinSphereAndActive(this, 250) + && !subaddie_playerIsWithinSphereAndActive(this, 80) && func_8028F2A0() ){ - gcdialog_showText(ASSET_A71_DIALOG_TRUNKER_MEET, 0xe, this->position, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A71_DIALOG_TRUNKER_MEET, 0xe, this->position, NULL, NULL, NULL); this->has_met_before = TRUE; }//L80389254 diff --git a/src/GV/code_3630.c b/src/GV/code_3630.c index 2cf8fb0b..01607508 100644 --- a/src/GV/code_3630.c +++ b/src/GV/code_3630.c @@ -29,7 +29,7 @@ void func_80389A20(ActorMarker *caller, enum asset_e text_id, s32 arg2){ } void func_80389A60(Actor *this){ - gcdialog_showText(ASSET_A70_DIALOG_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); + gcdialog_showDialog(ASSET_A70_DIALOG_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); this->has_met_before = TRUE; subaddie_set_state(this, 5); } @@ -62,8 +62,8 @@ void func_80389B1C(Actor *this){ anctrl_setTransitionDuration(this->anctrl, 0.15f); if(this->state == 1 || this->state == 2){ - if(! this->has_met_before && func_80329530(this, 250) && !func_80329530(this, 0x50)){ - gcdialog_showText(ASSET_A6F_DIALOG_CHARMER_MEET, 0xe, this->position, NULL, NULL, NULL); + if(! this->has_met_before && subaddie_playerIsWithinSphereAndActive(this, 250) && !subaddie_playerIsWithinSphereAndActive(this, 0x50)){ + gcdialog_showDialog(ASSET_A6F_DIALOG_CHARMER_MEET, 0xe, this->position, NULL, NULL, NULL); this->has_met_before = TRUE; mapSpecificFlags_set(0, TRUE); } @@ -83,7 +83,7 @@ void func_80389B1C(Actor *this){ || actor_animationIsAt(this, 0.51f) || actor_animationIsAt(this, 0.57f) ){ - FUNC_8030E8B4(SFX_8_BANJO_LANDING_04, 3.802f, 8000, this->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_8_BANJO_LANDING_04, 3.802f, 8000, this->position, 1500, 4500); } if( actor_animationIsAt(this, 0.4f)){ @@ -102,7 +102,7 @@ void func_80389B1C(Actor *this){ case 3: //L80389E14 if( actor_animationIsAt(this, 0.2f)){ func_8025A58C(500, 400); - func_8025A6EC(COMUSIC_27_GV_RUBEES_SONG, 28000); + coMusicPlayer_playMusic(COMUSIC_27_GV_RUBEES_SONG, 28000); } if( actor_animationIsAt(this, 0.99f)){ diff --git a/src/GV/code_3BB0.c b/src/GV/code_3BB0.c index 1eab7428..7ad08215 100644 --- a/src/GV/code_3BB0.c +++ b/src/GV/code_3BB0.c @@ -45,14 +45,14 @@ void func_80389FA0(f32 position[3]){ } void GV_func_8038A084(Actor *this){ - if(this->unkF4_8 == 6 && !this->volatile_initialized){ + if(this->actorTypeSpecificField == 6 && !this->volatile_initialized){ this->volatile_initialized = TRUE; if( jiggyscore_isCollected(JIGGY_42_GV_WATER_PYRAMID) && this->yaw == 1.0f){ this->unk38_31 = TRUE; } } - if(this->unkF4_8 == 6 + if(this->actorTypeSpecificField == 6 && viewport_func_8024DB50(this->position, 50.0f) && !this->unk38_31 && randf() < 0.2 diff --git a/src/GV/code_3D90.c b/src/GV/code_3D90.c index 8609b887..820a0d1a 100644 --- a/src/GV/code_3D90.c +++ b/src/GV/code_3D90.c @@ -35,10 +35,10 @@ Actor *func_8038A180(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ if( this->unk54 == 0.0f && this->unk48 != this->unk1C[1] && this_marker->unk14_21 - && func_80329530(this, 3000) + && subaddie_playerIsWithinSphereAndActive(this, 3000) ){ - func_8033E73C(this->marker, 6, func_80329904); - func_8033E3F0(0xc, this->marker->unk14_21); + commonParticle_add(this->marker, 6, func_80329904); + commonParticle_new(0xc, this->marker->unk14_21); } } return this; @@ -60,7 +60,7 @@ void func_8038A2C0(void *this_marker){ s32 pad; func_8032AA58(shadow, this->scale); - this->unk100 = shadow->marker; + this->partnerActor = shadow->marker; } void func_8038A314(Actor *this){} @@ -74,7 +74,7 @@ void func_8038A31C(Actor *this){ this->velocity[0] = 0.0f; } - if(this->unk100) + if(this->partnerActor) sp24 = subaddie_getLinkedActor(this); this->unk1C[1] = this->unk48; @@ -141,7 +141,7 @@ void func_8038A31C(Actor *this){ }//L8038A6A4 this->unk124_11 = 0x3; this->pitch = 0.0f; - if(this->unk100 && sp24 && this->unk100->id == MARKER_AF_MAGIC_CARPET_SHADOW){ + if(this->partnerActor && sp24 && this->partnerActor->id == MARKER_AF_MAGIC_CARPET_SHADOW){ sp24->position_x = this->position_x; sp24->position_y = mapModel_getFloorY(this->position) + 60.0f; sp24->position_z = this->position_z; diff --git a/src/GV/code_43B0.c b/src/GV/code_43B0.c index 22796191..bb1de44b 100644 --- a/src/GV/code_43B0.c +++ b/src/GV/code_43B0.c @@ -33,8 +33,8 @@ Actor *func_8038A7A0(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ && this_marker->unk14_21 && this->unk48 != this->unk1C[2] ){ - func_8033E73C(this->marker, 5, func_80329904); - func_8033E3F0(0xa, this->marker->unk14_21); + commonParticle_add(this->marker, 5, func_80329904); + commonParticle_new(0xa, this->marker->unk14_21); this->unk38_31++; } @@ -56,7 +56,7 @@ void func_8038A8CC(ActorMarker *this_marker){ Actor *shadow = spawn_child_actor(ACTOR_122_MAGIC_CARPET_SHADOW, &this); s32 pad; - this->unk100 = shadow->marker; + this->partnerActor = shadow->marker; shadow->position_y = mapModel_getFloorY(this->position); shadow->unk1C[0] = func_8038A860(shadow, this); shadow->yaw = this->yaw; @@ -91,7 +91,7 @@ void GV_func_8038A9C0(Actor *this){ this->yaw = 90.0f; } - if(this->unk100) + if(this->partnerActor) sp24 = subaddie_getLinkedActor(this); if(this->velocity_y != 0.0f){ @@ -101,7 +101,7 @@ void GV_func_8038A9C0(Actor *this){ } this->unk1C[2] = this->unk1C[1]; this->unk1C[1] = this->unk48; - if(this->unk100 != NULL && sp24 != NULL && this->unk100->id == MARKER_AF_MAGIC_CARPET_SHADOW){ + if(this->partnerActor != NULL && sp24 != NULL && this->partnerActor->id == MARKER_AF_MAGIC_CARPET_SHADOW){ sp24->unk1C[0] = func_8038A860(sp24, this); } } diff --git a/src/GV/code_4740.c b/src/GV/code_4740.c index b538e809..94fbc178 100644 --- a/src/GV/code_4740.c +++ b/src/GV/code_4740.c @@ -167,7 +167,7 @@ void func_8038B124(Actor *this){ if(this->unk44_31 == 0){ this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3EC_CCW_DOOR_OPENING); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 0.1f); sfxsource_setSampleRate(this->unk44_31, 32000); } @@ -184,7 +184,7 @@ void func_8038B124(Actor *this){ }//L8038B33C if( this->unk1C[1] == 0.0 - && func_80329530(this, 0x320) + && subaddie_playerIsWithinSphereAndActive(this, 0x320) && func_803292E0(this) ){ anctrl_setSmoothTransition(this->anctrl, 0); @@ -207,7 +207,7 @@ void func_8038B124(Actor *this){ break; case 2: //L8038B430 - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); if(0.98 < anctrl_getAnimTimer(this->anctrl)){ func_8038AF10(this); } @@ -218,13 +218,13 @@ void func_8038B124(Actor *this){ break; case 3: //L8038B494 - func_8030E2C4(this->unk44_31); - if(func_80329530(this, 175)){ + sfxSource_func_8030E2C4(this->unk44_31); + if(subaddie_playerIsWithinSphereAndActive(this, 175)){ subaddie_set_state_with_direction(this, 4, 0.00001f, 1); actor_loopAnimation(this); this->unk1C[0] = 1.0f; } - else if(!func_80329530(this, 1100) || !func_8038AF78(this, 8.0f, 16.0f)){ + else if(!subaddie_playerIsWithinSphereAndActive(this, 1100) || !func_8038AF78(this, 8.0f, 16.0f)){ subaddie_set_state_with_direction(this, 8, 0.00001f, 1); actor_playAnimationOnce(this); this->unk1C[0] = 1.0f; diff --git a/src/GV/code_5570.c b/src/GV/code_5570.c index fe99e317..f254e661 100644 --- a/src/GV/code_5570.c +++ b/src/GV/code_5570.c @@ -49,7 +49,7 @@ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ Actor *this = marker_getActor(caller); subaddie_set_state_with_direction(this, 5, 0.01f, 1); actor_loopAnimation(this); - func_802BAFE4(0x13); + gcStaticCamera_activate(0x13); FUNC_8030E624(SFX_8D_BOGGY_OHWW, 0.9f, 32000); timedFunc_set_0(2.5f, func_8038B960); D_80391A80 = this->state; @@ -58,12 +58,12 @@ void func_8038B988(ActorMarker *caller, enum asset_e text_id, s32 arg2){ void func_8038BA08(Actor *this){ subaddie_set_state_with_direction(this, 6, 0.01f, 1); actor_loopAnimation(this); - this->unk100 = NULL; + this->partnerActor = NULL; D_80391A80 = 3; if(player_movementGroup() == BSGROUP_6_TURBO_TALON_TRAINERS) player_stateTimer_set(STATE_TIMER_3_TURBO_TALON, 0.0f); - gcdialog_showText(ASSET_A79_DIALOG_GRABBA_DEFEAT, 0xf, this->position, this->marker, func_8038B988, NULL); + gcdialog_showDialog(ASSET_A79_DIALOG_GRABBA_DEFEAT, 0xf, this->position, this->marker, func_8038B988, NULL); comusic_8025AB44(COMUSIC_57_TURBO_TRAINERS, 7000, 700); } @@ -84,7 +84,7 @@ s32 func_8038BAA4(Actor *jiggy){ } int func_8038BB24(Actor *this){ - if(func_80329530(this, 1560) && !func_80329530(this, 1380)){ + if(subaddie_playerIsWithinSphereAndActive(this, 1560) && !subaddie_playerIsWithinSphereAndActive(this, 1380)){ return TRUE; } else{ @@ -100,8 +100,8 @@ void func_8038BB6C(Actor *jiggy, ActorMarker * grabba_marker) grabba = marker_getActor(tmp); grabba_local = (ActorLocal_Grabba *)&grabba->local; - grabba->unk100 = jiggy->marker; - grabba_local->unk0 = grabba->unk100->unk5C; + grabba->partnerActor = jiggy->marker; + grabba_local->unk0 = grabba->partnerActor->unk5C; jiggy->unk10_1 = TRUE; grabba->unk1C[2] = (f32)func_8038BAA4(jiggy); if(jiggyscore_isCollected((s32)grabba->unk1C[2])){ @@ -174,13 +174,13 @@ void GV_func_8038BEA0(Actor *this){ if(this->unk44_31 == 0){ this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3EC_CCW_DOOR_OPENING); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 0.1f); sfxsource_setSampleRate(this->unk44_31, 32000); } - if(this->unk100 == NULL){ - this->unk100 = func_8032B16C(JIGGY_3E_GV_GRABBA); - local->unk0 = this->unk100 != NULL ? this->unk100->unk5C : NULL; + if(this->partnerActor == NULL){ + this->partnerActor = func_8032B16C(JIGGY_3E_GV_GRABBA); + local->unk0 = this->partnerActor != NULL ? this->partnerActor->unk5C : NULL; } subaddie_set_state_with_direction(this, this->state, 0.01f, 1); this->unk58_0 = FALSE; @@ -211,13 +211,13 @@ void GV_func_8038BEA0(Actor *this){ subaddie_set_state_with_direction(this, 3, 0.01f, 1); actor_loopAnimation(this); D_80391A80 = this->state; - if(this->unk100){ - this->unk100->collidable = TRUE; + if(this->partnerActor){ + this->partnerActor->collidable = TRUE; } } else{ if(anctrl_getAnimTimer(this->anctrl) < 0.55){ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); if(randf() < 0.6){ func_8038BC7C(this->position, 0xA); } @@ -226,7 +226,7 @@ void GV_func_8038BEA0(Actor *this){ break; case 3: //L8038C1CC - if(this->unk100 && this->unk100->unk5C != local->unk0){ + if(this->partnerActor && this->partnerActor->unk5C != local->unk0){ func_8038BA08(this); } else if(this->unk38_31 >= 0xC){ @@ -235,7 +235,7 @@ void GV_func_8038BEA0(Actor *this){ D_80391A80 = this->state; func_802BB3DC(0, 12.0f, 0.92f); } - else if(func_80329530(this, 600)){ + else if(subaddie_playerIsWithinSphereAndActive(this, 600)){ if(player_movementGroup() == BSGROUP_6_TURBO_TALON_TRAINERS){ this->unk38_31++; } @@ -245,7 +245,7 @@ void GV_func_8038BEA0(Actor *this){ } else{ if(!this->has_met_before){ - if(gcdialog_showText(ASSET_A78_DIALOG_GRABBA_MEET, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_A78_DIALOG_GRABBA_MEET, 0, NULL, NULL, NULL, NULL)){ this->has_met_before = TRUE; } } @@ -253,7 +253,7 @@ void GV_func_8038BEA0(Actor *this){ break; case 4: //L8038C304 - if(this->unk100 && this->unk100->unk5C != local->unk0){ + if(this->partnerActor && this->partnerActor->unk5C != local->unk0){ func_8038BA08(this); } else if(actor_animationIsAt(this, 0.89f)){ @@ -263,20 +263,20 @@ void GV_func_8038BEA0(Actor *this){ } else{ if(0.35 < anctrl_getAnimTimer(this->anctrl)){ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); if(randf() < 0.6){ func_8038BC7C(this->position, 5); } } if(actor_animationIsAt(this, 0.4f)){ - if(this->unk100){ - this->unk100->collidable = FALSE; + if(this->partnerActor){ + this->partnerActor->collidable = FALSE; func_8030E878(SFX_3F5_UNKNOWN, randf2(0.95f, 1.05f), 32000, this->position, 1250.0f, 2500.0f); } if(!this->unk138_23){ - if(gcdialog_showText(ASSET_A7A_DIALOG_GRABBA_TOO_FAST, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_A7A_DIALOG_GRABBA_TOO_FAST, 0, NULL, NULL, NULL, NULL)){ this->unk138_23 = TRUE; } } @@ -291,7 +291,7 @@ void GV_func_8038BEA0(Actor *this){ func_8038C748(); } else{ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); this->position_y -= 7.0; if(globalTimer_getTime() & 1){ sp38[0] = this->position_x; @@ -304,7 +304,7 @@ void GV_func_8038BEA0(Actor *this){ break; }//L8038C528 - if(this->unk100 && this->unk100->unk5C == local->unk0){ + if(this->partnerActor && this->partnerActor->unk5C == local->unk0){ Actor *tmp_v0; tmp_v0 = subaddie_getLinkedActor(this); if(this->marker->unk14_21){ diff --git a/src/GV/code_6370.c b/src/GV/code_6370.c index 3a11efbe..6744ab27 100644 --- a/src/GV/code_6370.c +++ b/src/GV/code_6370.c @@ -55,7 +55,7 @@ void func_8038C760(Actor *this, s32 arg1){ func_80324E38(6.5f, 0); } else{ - timedFunc_set_2(3.5f, (GenFunction_2)func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); + timedFunc_set_2(3.5f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); timedFunc_set_3(3.5f, (GenFunction_3)fileProgressFlag_setN, FILEPROG_F8_KING_SANDYBUTT_PYRAMID_STATE, arg1, 2); timed_exitStaticCamera(6.0f); func_80324E38(6.0f, 0); @@ -79,10 +79,10 @@ void func_8038C8A0(Actor *this, s32 next_state){ if(next_state == 4 || next_state == 5){ local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(local->sfxsourceIdx, SFX_3EC_CCW_DOOR_OPENING); - func_8030DD14(local->sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 3); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.8f); sfxsource_setSampleRate(local->sfxsourceIdx, 0); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); }//L8038C9B8 if(next_state == 2){ @@ -111,13 +111,13 @@ void func_8038C8A0(Actor *this, s32 next_state){ skeletalAnim_setProgress(this->unk148, 0.99f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); if(next_state == 4 || next_state == 5) - FUNC_8030E8B4(SFX_DE_WOOD_SQUEAK, 1.0f, 32675, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_DE_WOOD_SQUEAK, 1.0f, 32675, this->position, 500, 1500); }//L8038CB20 if(next_state == 6){ func_80324E38(0.0f, 3); skeletalAnim_set(this->unk148, ASSET_F0_ANIM_MINI_SHPYNX_EATING, 0.0f, 3.0f); - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } if(next_state == 7){ @@ -288,7 +288,7 @@ void func_8038CC98(Actor *this){ func_8038C8A0(this, 6); } else{ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } } diff --git a/src/GV/code_7060.c b/src/GV/code_7060.c index c477acb1..3ed422e1 100644 --- a/src/GV/code_7060.c +++ b/src/GV/code_7060.c @@ -73,7 +73,7 @@ void func_8038D47C(Actor *this){ player_getPosition(sp3C); if(player_movementGroup() == BSGROUP_0_NONE){ if( ml_vec3f_distance(sp3C, this->unk1C) < 100.0f || ml_vec3f_distance(sp3C, this->velocity) < 100.0f){ - if(gcdialog_showText(ASSET_A7B_DIALOG_JINXY_MEET, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_A7B_DIALOG_JINXY_MEET, 0, NULL, NULL, NULL, NULL)){ mapSpecificFlags_set(0x14, 1); } } @@ -90,7 +90,7 @@ void func_8038D47C(Actor *this){ mapSpecificFlags_set(0xF, TRUE); func_8028F918(2); subaddie_set_state_forward(this, 3); - func_802BAFE4(0); + gcStaticCamera_activate(0); } break; case 2: //L8038D78C @@ -102,7 +102,7 @@ void func_8038D47C(Actor *this){ } if( actor_animationIsAt(this, 0.99f) ){ if(--this->unk38_31 == 0){ - gcdialog_showText(ASSET_A7C_DIALOG_JINXY_ONE_EGG, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A7C_DIALOG_JINXY_ONE_EGG, 4, NULL, NULL, NULL, NULL); mapSpecificFlags_set(0x14, TRUE); subaddie_set_state_forward(this, 1); } diff --git a/src/GV/code_7D50.c b/src/GV/code_7D50.c index f4476b9d..48d6d6eb 100644 --- a/src/GV/code_7D50.c +++ b/src/GV/code_7D50.c @@ -11,7 +11,7 @@ struct { /* .code */ void func_8038E140(void){ GV_D_80391AB0.unk0++; - func_8025A6EC(COMUSIC_2B_DING_B, 26000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 26000); } s32 func_8038E178(void){ diff --git a/src/GV/code_7DB0.c b/src/GV/code_7DB0.c index 290a4369..6fc3dcfa 100644 --- a/src/GV/code_7DB0.c +++ b/src/GV/code_7DB0.c @@ -39,16 +39,16 @@ void func_8038E1A8(Actor *this){ } else{ if(actor_animationIsAt(this, 0.2f)) - FUNC_8030E8B4(SFX_4C_LIP_SMACK, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_4C_LIP_SMACK, 1.0f, 32000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.4f)) - FUNC_8030E8B4(SFX_4C_LIP_SMACK, 1.0f, 26000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_4C_LIP_SMACK, 1.0f, 26000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.6f)) - FUNC_8030E8B4(SFX_4C_LIP_SMACK, 1.0f, 20000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_4C_LIP_SMACK, 1.0f, 20000, this->position, 1250, 2500); if(actor_animationIsAt(this, 0.8f)) - FUNC_8030E8B4(SFX_97_BLUBBER_BURPS, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_97_BLUBBER_BURPS, 1.0f, 32000, this->position, 1250, 2500); } break; }//L8038E2E8 diff --git a/src/GV/code_7FF0.c b/src/GV/code_7FF0.c index 1694e790..82258485 100644 --- a/src/GV/code_7FF0.c +++ b/src/GV/code_7FF0.c @@ -215,7 +215,7 @@ void func_8038E4DC(Actor *this){ else{ if(!mapSpecificFlags_get(4)){ mapSpecificFlags_set(4, TRUE); - func_802BAFE4(1); + gcStaticCamera_activate(1); } } } @@ -228,7 +228,7 @@ void func_8038E648(Actor *this){ case 1: //L8038E690 this->pitch = 0.0f; if(mapSpecificFlags_get(5)){ - func_802BAFE4(2); + gcStaticCamera_activate(2); subaddie_set_state(this, 6); this->unk38_31 = 600; core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f); @@ -242,7 +242,7 @@ void func_8038E648(Actor *this){ if(90.0f <= this->pitch){ subaddie_set_state(this, 7); this->pitch = 90.0f; - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); core1_7090_freeSfxSource(0); } break; @@ -260,10 +260,10 @@ void func_8038E648(Actor *this){ if(this->pitch <= 0.0f){ subaddie_set_state(this, 1); this->pitch = 0.0f; - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(5, FALSE); core1_7090_freeSfxSource(0); - volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED); + progressDialog_setAndTriggerDialog_0(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED); } break; }//L8038E904: @@ -315,7 +315,7 @@ void func_8038E97C(Actor *this){ if(this->unk38_31 == 0){ subaddie_set_state(this, 1); core1_7090_freeSfxSource(1); - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); } } @@ -327,8 +327,8 @@ void chKazooieDoor_update(Actor *this){ switch(this->state){ case 1: //L8038EB98 if(mapSpecificFlags_get(6)){ - func_8025A6EC(COMUSIC_2B_DING_B, -1); - func_802BAFE4(3); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, -1); + gcStaticCamera_activate(3); subaddie_set_state(this, 6); core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f); this->unk1C[1] = this->position_y + 210.0f; @@ -341,7 +341,7 @@ void chKazooieDoor_update(Actor *this){ this->position_z -= 1.3319999999999999; if(this->unk1C[1] <= this->position_y){ subaddie_set_state(this, 7); - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); core1_7090_freeSfxSource(1); this->unk38_31 = 450; } @@ -361,7 +361,7 @@ void chKazooieDoor_update(Actor *this){ if(this->position_y <= this->unk1C[0]){ this->position_y = this->unk1C[0]; subaddie_set_state(this, 1); - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); core1_7090_freeSfxSource(1); mapSpecificFlags_set(6, FALSE); } @@ -435,7 +435,7 @@ void chKazooieTarget_update(Actor *this){ } void func_8038F004(void){ - func_8025A6EC(SFX_2D_KABOING, 0x7fff); + coMusicPlayer_playMusic(SFX_2D_KABOING, 0x7fff); } void func_8038F028(UNK_TYPE(s32) arg0, ActorMarker *arg1, s32 arg2, s32 arg3){ @@ -449,7 +449,7 @@ void func_8038F028(UNK_TYPE(s32) arg0, ActorMarker *arg1, s32 arg2, s32 arg3){ sp24[1] = (f32)arg1->propPtr->y; sp24[2] = (f32)arg1->propPtr->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])); - func_8025A6EC(COMUSIC_2B_DING_B, 22000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 22000); if(mapSpecificFlags_get(arg3)){ timedFunc_set_0(2.0f, func_8038F004); } diff --git a/src/GV/code_9C10.c b/src/GV/code_9C10.c index 5389e16e..b64c198e 100644 --- a/src/GV/code_9C10.c +++ b/src/GV/code_9C10.c @@ -32,7 +32,7 @@ void func_80390000(s32 arg0){ if(GV_D_80391AD0 == 2){ levelSpecificFlags_set(LEVEL_FLAG_6_GV_UNKNOWN, FALSE); func_803228D8(); - func_802E4078(MAP_15_GV_WATER_PYRAMID, 1, 0); + transitionToMap(MAP_15_GV_WATER_PYRAMID, 1, 0); } } diff --git a/src/GV/matchinggame.c b/src/GV/matchinggame.c index 0c19443b..6ee0f7d9 100644 --- a/src/GV/matchinggame.c +++ b/src/GV/matchinggame.c @@ -94,7 +94,7 @@ void __matchingGame_setState(s32 next_state){ volatileFlag_set(VOLATILE_FLAG_5_FF_MINIGAME_WON, 1); } else{ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); if(matchingGame.mummy_marker){ func_8035D490(matchingGame.mummy_marker); } @@ -187,7 +187,7 @@ void gv_matchingGame_update(void){ if( func_8034DC78(matchingGame.tile_a->unk4) == 1 && func_8034DC78(matchingGame.tile_b->unk4) == 1){ if(0.0f < matchingGame.unkC){ if(0.6 < matchingGame.unkC && matchingGame.unkC - dt <= 0.6){ - func_8025A6EC(COMUSIC_2C_BUZZER, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 0x7fff); }//L803906AC matchingGame.unkC -= dt; if(matchingGame.unkC <= 0.0f){ @@ -210,7 +210,7 @@ void gv_matchingGame_update(void){ __matchingGame_setState(4); //end game state } else{ - func_8025A6EC(COMUSIC_2B_DING_B, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7fff); } matchingGame.tile_a = matchingGame.tile_b = NULL; }//L803907E4 diff --git a/src/GV/waterctrl.c b/src/GV/waterctrl.c index 2c5e913a..1234a62e 100644 --- a/src/GV/waterctrl.c +++ b/src/GV/waterctrl.c @@ -40,7 +40,7 @@ void __waterCtrl_setState(s32 arg0){ levelSpecificFlags_set(LEVEL_FLAG_6_GV_UNKNOWN, TRUE); func_803228D8(); volatileFlag_set(VOLATILE_FLAG_E, 1); - func_802E4078(MAP_12_GV_GOBIS_VALLEY, 0, 0); + transitionToMap(MAP_12_GV_GOBIS_VALLEY, 0, 0); } } diff --git a/src/MM/ch/conga.c b/src/MM/ch/conga.c index 865b2fde..adb5918d 100644 --- a/src/MM/ch/conga.c +++ b/src/MM/ch/conga.c @@ -3,6 +3,9 @@ #include "functions.h" #include "variables.h" #include + +#include "conga.h" + #ifndef MIN #define MIN(s,t) ((s)<(t)?(s):(t)) #endif @@ -19,16 +22,16 @@ void timed_exitStaticCamera(f32); Actor *actor_spawnWithYaw_s32(s32 actor_id, s32 position[3], s32 yaw); void MM_func_80387F44(void); -void func_803876D0(Actor *); +void chConga_update(Actor *); -typedef struct chconga_s{ +typedef struct chconga_s { TUPLE(s32, orangeSpawnPosition); s32 unkC; s32 unk10; u8 pad14[0x4]; s32 unk18; s32 unk1C; -}ActorLocal_Conga; +} ActorLocal_Conga; /* .data */ @@ -44,9 +47,9 @@ ActorAnimationInfo chCongaAnimations[9] = { {ASSET_52_ANIM_CONGA_OW, 1.0f} }; -ActorInfo chcongaInfo = { MARKER_7_CONGA, ACTOR_8_CONGA, ASSET_35C_MODEL_CONGA, +ActorInfo chCongaInfo = { MARKER_7_CONGA, ACTOR_8_CONGA, ASSET_35C_MODEL_CONGA, 1, chCongaAnimations, - func_803876D0, actor_update_func_80326224, actor_draw, + chConga_update, actor_update_func_80326224, actor_draw, 0, 0x333, 0.0f, 0 }; @@ -87,7 +90,7 @@ void func_80386FB0(Actor *this){ void __chConga_playRandomNoise(void){ if( (globalTimer_getTime() & 0xF) == 0xB && 0.85 < randf () - && !func_803114B0() + && !gcdialog_hasCurrentTextId() ){ func_8030E58C(((s32)(randf ()*256.0f) & 1)? SFX_22_KONGA_NOISE_1: SFX_23_KONGA_NOISE_2, 1.0f); } @@ -99,7 +102,7 @@ void func_8038708C(Actor *this, s32 anim_id){ } void func_803870D0(Actor *this, ActorMarker *arg1){ - marker_getActor(arg1)->unk100 = this->marker; + marker_getActor(arg1)->partnerActor = this->marker; } void func_80387100(ActorMarker *this){ @@ -140,7 +143,7 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ ){ func_8038708C(actorPtr, 2); if(actorPtr->unk38_31 == 1){ - gcdialog_showText(ASSET_B39_DIALOG_CONGA_HIT_BY_EGG, 4, actorPtr->position, 0, 0, 0); + gcdialog_showDialog(ASSET_B39_DIALOG_CONGA_HIT_BY_EGG, 4, actorPtr->position, 0, 0, 0); } } } @@ -148,7 +151,7 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ } int func_803872EC(void){ - s32 text_id = func_803114C4(); + s32 text_id = gcdialog_getCurrentTextId(); return text_id == ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE || text_id == ASSET_B38_DIALOG_CONGA_DEFEAT @@ -209,13 +212,15 @@ void __chConga_sendOrangeProjectile(ActorMarker *congaMarker){ } } -void func_803876D0(Actor *this){ +void chConga_update(Actor *this) { + f32 unused; NodeProp *node_prop; s32 sp3C; - this->marker->propPtr->unk8_3 = (timedFuncQueue_is_empty(this))?1:0; - if(!this->initialized){ + this->marker->propPtr->unk8_3 = timedFuncQueue_is_empty(this) ? 1 : 0; + + if (!this->initialized) { ((ActorLocal_Conga *)&this->local)->unkC = 1; this->unk16C_0 = 1; this->initialized = TRUE; @@ -225,152 +230,173 @@ void func_803876D0(Actor *this){ ((ActorLocal_Conga *)&this->local)->unk1C = nodeprop_getRadius(node_prop); nodeprop_getPosition_s32(node_prop, &((ActorLocal_Conga *)&this->local)->unk10); } - if(0.0f == this->actor_specific_1_f){ + + if (0.0f == this->actor_specific_1_f) { this->actor_specific_1_f = (actorArray_findActorFromMarkerId(MARKER_36_ORANGE_COLLECTIBLE) != NULL)? 2.0f: 1.0f; } - if(0.0f != this->velocity_x){ + + if (0.0f != this->velocity_x) { this->velocity_x -= 1.0f; if(0.0f == this->velocity_x){ __spawnQueue_add_1((GenFunction_1)func_80387100, (s32)this->marker); } } + marker_setCollisionScripts(this->marker, NULL, NULL, func_80387168); - if( !func_80329530(this, 2100) + + if (!subaddie_playerIsWithinSphereAndActive(this, 2100) && this->state != 2 - && this->state != 8 - ){ + && this->state != 8) { + if(this->state > 3 && this->state < 8){ actor_loopAnimation(this); subaddie_set_state_with_direction(this, 1, 0.76f, 1); } + return; } - sp3C = func_80329530(this, 1000); - if( func_8032A9E4(((ActorLocal_Conga *)&this->local)->unk10, ((ActorLocal_Conga *)&this->local)->unk18, ((ActorLocal_Conga *)&this->local)->unk1C) + sp3C = subaddie_playerIsWithinSphereAndActive(this, 1000); + + if (func_8032A9E4(((ActorLocal_Conga *)&this->local)->unk10, ((ActorLocal_Conga *)&this->local)->unk18, ((ActorLocal_Conga *)&this->local)->unk1C) && !this->unk138_23 - && gcdialog_showText(ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE, 0, 0, 0, 0, 0) - ){ + && gcdialog_showDialog(ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE, 0, 0, 0, 0, 0)) { this->unk138_23 = 1; mapSpecificFlags_set(MM_SPECIFIC_FLAG_A_UNKNOWN, TRUE); }//L803878F8 - if( sp3C && !this->has_met_before){ - if(gcdialog_showText((player_getTransformation()== TRANSFORM_2_TERMITE) ? ASSET_B3E_DIALOG_CONGA_MEET_AS_TERMITE : ASSET_B3C_DIALOG_CONGA_MEET, 0, this->position, 0,0,0)){ + if (sp3C && !this->has_met_before) { + if (gcdialog_showDialog((player_getTransformation()== TRANSFORM_2_TERMITE) ? ASSET_B3E_DIALOG_CONGA_MEET_AS_TERMITE : ASSET_B3C_DIALOG_CONGA_MEET, 0, this->position, 0,0,0)) { this->has_met_before = TRUE; } } //L80387968 - switch(this->state){ - case 1://80387990 + switch (this->state) { + case CONGA_STATE_IDLE://80387990 actor_loopAnimation(this); func_80386FB0(this); __chConga_playRandomNoise(); + if(actor_animationIsAt(this, 0.0f) || actor_animationIsAt(this, 0.45f)){ if(randf() < 0.2){ anctrl_setDirection(this->anctrl, anctrl_isPlayedForwards(this->anctrl)?0:1); }; }//L80387A18 - if(actor_animationIsAt(this, 0.66f)){ - subaddie_maybe_set_state_position_direction(this, 6, 0, 1, 0.38f); + + if (actor_animationIsAt(this, 0.66f)) { + subaddie_maybe_set_state_position_direction(this, CONGA_STATE_BEAT_CHEST_STOP, 0, 1, 0.38f); } - if( sp3C + + if (sp3C && player_movementGroup() != BSGROUP_1_INTR && !__chConga_isPlayerNearCongaTree(this) && timedFuncQueue_is_empty() && !func_8032A9E4(((ActorLocal_Conga *)&this->local)->unk10, ((ActorLocal_Conga *)&this->local)->unk18, ((ActorLocal_Conga *)&this->local)->unk1C) - && !func_803872EC() - ){ - subaddie_set_state_with_direction(this, 4, 0.0f, 1); + && !func_803872EC()) { + + subaddie_set_state_with_direction(this, CONGA_STATE_TARGET_GROUND, 0.0f, 1); }//L80387AC0 - if( player_movementGroup() != BSGROUP_1_INTR + + if (player_movementGroup() != BSGROUP_1_INTR && __chConga_isPlayerNearCongaTree(this) && this->unk38_31 != 0 - && !func_803872EC() - ){ - subaddie_set_state_with_direction(this, 7, 0.0f, 1); + && !func_803872EC()) { + + subaddie_set_state_with_direction(this, CONGA_STATE_TARGET_BANJO, 0.0f, 1); } break; - case 6: //L80387B24 + case CONGA_STATE_BEAT_CHEST_STOP: //L80387B24 ((ActorLocal_Conga *)&this->local)->unkC = 1; actor_playAnimationOnce(this); __chConga_playRandomNoise(); - if( anctrl_isPlayedForwards(this->anctrl) == TRUE - && actor_animationIsAt(this, 0.0f) - ){ - subaddie_set_state_with_direction(this, 5, 0.0f, 1); - } - else if( !anctrl_isPlayedForwards(this->anctrl) - && actor_animationIsAt(this, 0.001f) - ){ - subaddie_set_state_with_direction(this, 1, 0.76f, 1); + + if (anctrl_isPlayedForwards(this->anctrl) == TRUE + && actor_animationIsAt(this, 0.0f)) { + + subaddie_set_state_with_direction(this, CONGA_STATE_BEAT_CHEST, 0.0f, 1); + } else if (!anctrl_isPlayedForwards(this->anctrl) + && actor_animationIsAt(this, 0.001f)) { + subaddie_set_state_with_direction(this, CONGA_STATE_IDLE, 0.76f, 1); } + break; - case 5: //L80387BC0 + case CONGA_STATE_BEAT_CHEST: //L80387BC0 ((ActorLocal_Conga *)&this->local)->unkC = 1; actor_loopAnimation(this); __chConga_playRandomNoise(); - if( actor_animationIsAt(this, 0.99f)){ - subaddie_maybe_set_state_position_direction(this, 6, 0.999f, 0, sp3C ? 1.0 : 0.4); + + if (actor_animationIsAt(this, 0.99f)) { + subaddie_maybe_set_state_position_direction(this, CONGA_STATE_BEAT_CHEST_STOP, 0.999f, 0, sp3C ? 1.0 : 0.4); }//L80387C30 - if( actor_animationIsAt(this, 0.9f) - || actor_animationIsAt(this, 0.4f) - ){ + + if (actor_animationIsAt(this, 0.9f) + || actor_animationIsAt(this, 0.4f)) { func_8030E6D4(SFX_3FB_UNKNOWN); } + break; - case 4: //L80387C74 - if(actor_animationIsAt(this, 0.6f)){ + case CONGA_STATE_TARGET_GROUND: //L80387C74 + if (actor_animationIsAt(this, 0.6f)) { func_8030E58C(SFX_2_CLAW_SWIPE, 0.7f); } + func_80386FB0(this); - if( !sp3C + + if (!sp3C || player_is_in_jiggy_jig() || __chConga_isPlayerNearCongaTree(this) || !timedFuncQueue_is_empty() - || func_803872EC() - ){ - subaddie_set_state_with_direction(this, 1, 0.0f, 1); + || func_803872EC()) { + + subaddie_set_state_with_direction(this, CONGA_STATE_IDLE, 0.0f, 1); } + break; - case 2: //L80387D0C + case CONGA_STATE_HIT: //L80387D0C actor_playAnimationOnce(this); - if(actor_animationIsAt(this, 0.99f)){ - subaddie_set_state_with_direction(this, 1, 0.0f, 1); + if (actor_animationIsAt(this, 0.99f)) { + subaddie_set_state_with_direction(this, CONGA_STATE_IDLE, 0.0f, 1); } + break; - case 8: //L80387D4C + case CONGA_STATE_ROAR: //L80387D4C actor_playAnimationOnce(this); - if(actor_animationIsAt(this, 0.99f)){ - subaddie_set_state_with_direction(this, 3, 0.0f, 1); - gcdialog_showText(ASSET_B38_DIALOG_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); + + if (actor_animationIsAt(this, 0.99f)) { + subaddie_set_state_with_direction(this, CONGA_STATE_MOPEY, 0.0f, 1); + gcdialog_showDialog(ASSET_B38_DIALOG_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); } + break; - case 3: //L80387DB8 + case CONGA_STATE_MOPEY: //L80387DB8 actor_loopAnimation(this); - if(jiggyscore_isCollected(JIGGY_A_MM_CONGA)){ - subaddie_set_state_with_direction(this, 1, 0.0f, 1); + + if (jiggyscore_isCollected(JIGGY_A_MM_CONGA)) { + subaddie_set_state_with_direction(this, CONGA_STATE_IDLE, 0.0f, 1); } + break; - case 7: //L80387DF0 - if(this->unk10_12 == 0){ - if(actor_animationIsAt(this, 0.97f)){ + case CONGA_STATE_TARGET_BANJO: //L80387DF0 + if (this->unk10_12 == 0) { + if (actor_animationIsAt(this, 0.97f)) { ((ActorLocal_Conga *)&this->local)->unkC = 1; - subaddie_set_state_with_direction(this, 6, 0.0f, 1); + subaddie_set_state_with_direction(this, CONGA_STATE_BEAT_CHEST_STOP, 0.0f, 1); } } + break; }//L80387E38 - if( (this->state == 4 && actor_animationIsAt(this, 0.56f)) - || (this->state == 7 && actor_animationIsAt(this, 0.468f)) - ){ + + if ((this->state == CONGA_STATE_TARGET_GROUND && actor_animationIsAt(this, 0.56f)) + || (this->state == CONGA_STATE_TARGET_BANJO && actor_animationIsAt(this, 0.468f))) { + func_8034A1B4(this->marker->unk44, 5, &this->local); __spawnQueue_add_1((GenFunction_1)__chConga_sendOrangeProjectile, (s32)this->marker); //spawn orange } diff --git a/src/MM/ch/conga.h b/src/MM/ch/conga.h new file mode 100644 index 00000000..e49e6694 --- /dev/null +++ b/src/MM/ch/conga.h @@ -0,0 +1,10 @@ +enum conga_state_s { + CONGA_STATE_IDLE = 1, + CONGA_STATE_HIT = 2, + CONGA_STATE_MOPEY = 3, // After defeat, waiting for Banjo to collect the jiggy + CONGA_STATE_TARGET_GROUND = 4, + CONGA_STATE_BEAT_CHEST = 5, + CONGA_STATE_BEAT_CHEST_STOP = 6, // Though depending on the animation, he'll go back to beating his chest + CONGA_STATE_TARGET_BANJO = 7, // Targeting Banjo when he's at eye level + CONGA_STATE_ROAR = 8 // When Conga is defeated +}; diff --git a/src/MM/ch/grublin.c b/src/MM/ch/grublin.c index 752cc8fd..016c1530 100644 --- a/src/MM/ch/grublin.c +++ b/src/MM/ch/grublin.c @@ -53,7 +53,7 @@ void func_803889A0(ActorMarker *this, s32 arg1){ actorPtr = marker_getActor(this); subaddie_set_state_with_direction(actorPtr, 5, 0.0f, 1); actor_playAnimationOnce(actorPtr); - FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actorPtr->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actorPtr->position, 1250, 2500); actor_collisionOff(actorPtr); } @@ -82,10 +82,10 @@ void func_80388A80(Actor *this) { func_802DB5A0(this); if (this->state == 5) { if (actor_animationIsAt(this, 0.18f)) { - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); } if (actor_animationIsAt(this, 0.7f)) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); } } } diff --git a/src/MM/ch/hut.c b/src/MM/ch/hut.c index 13f2f2d1..b429d3d4 100644 --- a/src/MM/ch/hut.c +++ b/src/MM/ch/hut.c @@ -15,7 +15,7 @@ Actor *chhut_draw(ActorMarker *, Gfx **, Mtx **, Vtx **); void chhut_update(Actor *); /* .bss */ -extern s32 mm_hut_smash_count; //mm_hut_smash_count +extern s32 mmhut_smashCount; //mmhut_smashCount /* .data */ enum chhut_state_e { @@ -94,14 +94,14 @@ void chhut_update(Actor *this) { __spawnQueue_add_1((GenFunction_1) __chhut_spawnExplosion, (s32) this->marker); bundle_setYaw(this->yaw); - 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])); + if (mmhut_smashCount < 5) { + __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, D_803898D8[mmhut_smashCount], *(s32 * )(&diff_pos[0]), *(s32 * )(&diff_pos[1]), *(s32 * )(&diff_pos[2])); } else { jiggy_spawn(JIGGY_5_MM_HUTS, diff_pos); } - mm_hut_smash_count = (mm_hut_smash_count + 1) % 6; + mmhut_smashCount = (mmhut_smashCount + 1) % 6; } break; @@ -119,7 +119,7 @@ void chhut_update(Actor *this) { } void mm_resetHuts(void) { - mm_hut_smash_count = 0; + mmhut_smashCount = 0; } ActorInfo chhutInfo = { diff --git a/src/MM/ch/juju.c b/src/MM/ch/juju.c index dcaf1f9b..79dcc9b1 100644 --- a/src/MM/ch/juju.c +++ b/src/MM/ch/juju.c @@ -135,10 +135,10 @@ void func_803892A8(ActorMarker **ptr) { if (i == 3) { gcpausemenu_80314AC8(0); timedFunc_set_4(1.25f, __chjuju_solvePuzzle, jujuPtr->next_pos_x, jujuPtr->next_pos_y, jujuPtr->next_pos_z, actorPtr->yaw); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x6d60); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x6d60); } else {//L80389384 - func_8025A6EC(COMUSIC_2B_DING_B, 0x7fff); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7fff); } for (s2 = 3, j = i + 1; j < 4; s2 += 5, j++) { diff --git a/src/MM/ch/jujuhitbox.c b/src/MM/ch/jujuhitbox.c index 9b567542..32230361 100644 --- a/src/MM/ch/jujuhitbox.c +++ b/src/MM/ch/jujuhitbox.c @@ -137,8 +137,8 @@ void chjujuhitbox_update(Actor *this) { return; } - if (func_80329530(this, 0xfa) && !func_80329530(this, 0x50) && !player_movementGroup()) { - if (!this->has_met_before && gcdialog_showText(ASSET_B44_DIALOG_JUJU_MEET, 0, 0, 0, NULL, NULL)) { + if (subaddie_playerIsWithinSphereAndActive(this, 0xfa) && !subaddie_playerIsWithinSphereAndActive(this, 0x50) && !player_movementGroup()) { + if (!this->has_met_before && gcdialog_showDialog(ASSET_B44_DIALOG_JUJU_MEET, 0, 0, 0, NULL, NULL)) { this->has_met_before = TRUE; } } diff --git a/src/MM/ch/lmonkey.c b/src/MM/ch/lmonkey.c index a986bcdf..f08be030 100644 --- a/src/MM/ch/lmonkey.c +++ b/src/MM/ch/lmonkey.c @@ -43,7 +43,7 @@ ActorInfo chlmonkeyInfo = { void __chlmonkey_updateBringOrange(Actor **this_ptr) { player_setCarryObjectPoseInHorizontalRadius((*this_ptr)->position, 800.0f, ACTOR_29_ORANGE_COLLECTIBLE, this_ptr); - if (func_80329530(*this_ptr, 345) && + if (subaddie_playerIsWithinSphereAndActive(*this_ptr, 345) && bacarry_get_markerId() == MARKER_36_ORANGE_COLLECTIBLE && player_throwCarriedObject()) { @@ -67,7 +67,7 @@ void __chlmonkey_playRandomNoise(Actor *this) { if (sNoiseCooldown < 0 && randf() < 0.2) { sNoiseCooldown = 6; - func_8030E6A4(((random_noise < 0.5) ? SFX_58_CHIMPY_NOISE_1 : SFX_59_CHIMPY_NOISE_2), randf() * 0.25 + 0.85, scaled_noise_volume); + gcsfx_playWithPitch(((random_noise < 0.5) ? SFX_58_CHIMPY_NOISE_1 : SFX_59_CHIMPY_NOISE_2), randf() * 0.25 + 0.85, scaled_noise_volume); } } @@ -98,7 +98,7 @@ void chlmonkey_update(Actor *this) { func_80343DEC(this); } else {//L80388630 - if (func_80329530(this, 700) && !func_803114B0()) { + if (subaddie_playerIsWithinSphereAndActive(this, 700) && !gcdialog_hasCurrentTextId()) { __chlmonkey_playRandomNoise(this); }//L8038865C @@ -108,7 +108,7 @@ void chlmonkey_update(Actor *this) { subaddie_set_state(this, LMONKEY_STATE_4_LEAVING); if (!jiggyscore_isCollected(JIGGY_9_MM_CHIMPY)) { - gcdialog_showText(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chlmonkey_complete, NULL); + gcdialog_showDialog(ASSET_B40_DIALOG_CHIMPY_COMPLETE, 0xE, this->position, this->marker, __chlmonkey_complete, NULL); } else {//L803886E8 __chlmonkey_complete(this->marker, ASSET_B40_DIALOG_CHIMPY_COMPLETE, -1); @@ -117,12 +117,12 @@ void chlmonkey_update(Actor *this) { else { __chlmonkey_updateBringOrange(&this); - if (func_80329530(this, 345) && - !func_80329530(this, 150) && + if (subaddie_playerIsWithinSphereAndActive(this, 345) && + !subaddie_playerIsWithinSphereAndActive(this, 150) && !item_getCount(ITEM_19_ORANGE) && !this->has_met_before) { - gcdialog_showText(ASSET_B3F_DIALOG_CHIMPY_MEET, 0xe, this->position, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_B3F_DIALOG_CHIMPY_MEET, 0xe, this->position, NULL, NULL, NULL); this->has_met_before = TRUE; }//L80388774 diff --git a/src/MM/ch/orange.c b/src/MM/ch/orange.c index 60925a33..cc97b618 100644 --- a/src/MM/ch/orange.c +++ b/src/MM/ch/orange.c @@ -30,7 +30,7 @@ f32 D_80389A00[3] = {0.0f, 0.0f, 0.0f}; void __chorange_collisionCallback(ActorMarker *marker, ActorMarker *other_marker) { if (!player_isDead() && !mapSpecificFlags_get(MM_SPECIFIC_FLAG_8_HIT_WITH_ORANGE) && - gcdialog_showText(ASSET_B3A_DIALOG_CONGA_HITS_PLAYER, 0, 0, 0, NULL, NULL)) { + gcdialog_showDialog(ASSET_B3A_DIALOG_CONGA_HITS_PLAYER, 0, 0, 0, NULL, NULL)) { mapSpecificFlags_set(MM_SPECIFIC_FLAG_8_HIT_WITH_ORANGE, TRUE); } diff --git a/src/MM/ch/orangepad.c b/src/MM/ch/orangepad.c index 288583e8..847a29cf 100644 --- a/src/MM/ch/orangepad.c +++ b/src/MM/ch/orangepad.c @@ -2,87 +2,93 @@ #include "functions.h" #include "variables.h" -/* extern functions */ -void actor_update_func_80326224(Actor *); -void func_80329904(ActorMarker *, s32, void *); -extern void func_802EFA20(ParticleEmitter *, f32, f32); +#include "core2/staticcamera.h" -/* public functions */ -void chorangepad_update(Actor *); +#include "conga.h" +#include "orangepad.h" -/* .data */ -ActorInfo chorangepadInfo = { +extern void func_80329904(ActorMarker *, s32, void *); + +void chOrangePad_update(Actor *); + +ActorInfo chOrangePadInfo = { MARKER_66_ORANGE_PAD, ACTOR_57_ORANGE_PAD, ASSET_2EB_MODEL_ORANGE_PAD, 0, NULL, - chorangepad_update, actor_update_func_80326224, actor_draw, + chOrangePad_update, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0 }; -/*.code */ -void __chorangepad_spawnJiggy(s32 x, s32 y, s32 z) { +void spawnJiggy(s32 x, s32 y, s32 z) { f32 pos[3]; + TUPLE_ASSIGN(pos, x, y, z); jiggy_spawn(JIGGY_8_MM_ORANGE_PADS, pos); } -void func_80386444(ActorMarker *marker) { +void handleOrangeCollision(ActorMarker *marker) { f32 distance_to_orange_pad; Actor *closest_orange_pad; f32 position[3]; ParticleEmitter *p_ctrl; - s32 temp_a0; + s32 camera_id; position[0] = marker->propPtr->x; position[1] = marker->propPtr->y; position[2] = marker->propPtr->z; - closest_orange_pad = actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, 1, &distance_to_orange_pad); + closest_orange_pad = actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, ORANGE_PAD_STATE_HIT, &distance_to_orange_pad); - if (closest_orange_pad && !(500.0f < distance_to_orange_pad)) { - closest_orange_pad->state = 1; - - if (actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, 1, &distance_to_orange_pad)) { - func_8025A6EC(COMUSIC_2B_DING_B, 22000); - } - else { - temp_a0 = (closest_orange_pad->unk78_13 == 0x106) ? 0x10 - : (closest_orange_pad->unk78_13 == 0x76) ? 0xf - : 0xe; - - func_802BAFE4(temp_a0); - position[1] += 50.0f; - timedFunc_set_3(0.6f, (GenFunction_3) __chorangepad_spawnJiggy, (s32) position[0], (s32) position[1], (s32) position[2]); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); - - if (!jiggyscore_isCollected(JIGGY_8_MM_ORANGE_PADS)) { - gcdialog_showText(0xB3B, 4, NULL, NULL, NULL, NULL); - } - }// L803865D8 - - // Emmit sparkles - p_ctrl = partEmitMgr_newEmitter(30); - particleEmitter_setPosition(p_ctrl, closest_orange_pad->position); - particleEmitter_setModel(p_ctrl, 0x89f); - particleEmitter_setStartingScaleRange(p_ctrl, 0.09f, 0.19f); - particleEmitter_setFinalScaleRange(p_ctrl, 0.0f, 0.0f); - particleEmitter_setParticleVelocityRange(p_ctrl, -200.0f, 500.0f, -200.0f, 200.0f, 700.0f, 200.0f); - particleEmitter_setAccelerationRange(p_ctrl, 0.0f, -1200.0f, 0.0f, 0.0f, -1200.0f, 0.0f); - particleEmitter_setAngularVelocityRange(p_ctrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); - particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f); - particleEmitter_setParticleLifeTimeRange(p_ctrl, 4.0f, 4.0f); - particleEmitter_func_802EF9F8(p_ctrl, 0.01f); - particleEmitter_func_802EFA18(p_ctrl, 3); - func_802EFA20(p_ctrl, 1.0f, 1.3f); - particleEmitter_emitN(p_ctrl, 30); + if (!closest_orange_pad || 500.0f < distance_to_orange_pad) { + return; } + + closest_orange_pad->state = ORANGE_PAD_STATE_HIT; + + if (actorArray_findClosestActorFromActorId(position, ACTOR_57_ORANGE_PAD, ORANGE_PAD_STATE_HIT, &distance_to_orange_pad)) { + // There are still other pads on the ground, play progress ding + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 22000); + } else { // No more pads, dispense jiggy + camera_id = (closest_orange_pad->secondaryId == ORANGE_PAD_RIGHT) ? MM_ORANGE_PAD_JIGGY_SPAWN_RIGHT + : (closest_orange_pad->secondaryId == ORANGE_PAD_LEFT) ? MM_ORANGE_PAD_JIGGY_SPAWN_LEFT + : MM_ORANGE_PAD_JIGGY_SPAWN_TOP; + + gcStaticCamera_activate(camera_id); + + position[1] += 50.0f; + timedFunc_set_3(0.6f, (GenFunction_3) spawnJiggy, (s32) position[0], (s32) position[1], (s32) position[2]); + + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + + if (!jiggyscore_isCollected(JIGGY_8_MM_ORANGE_PADS)) { + gcdialog_showDialog(ASSET_B3B_DIALOG_CONGA_ORANGE_PAD_JIGGY, 4, NULL, NULL, NULL, NULL); + } + } + + // Spawn orange particles + p_ctrl = partEmitMgr_newEmitter(ORANGE_PARTICLE_COUNT); + + particleEmitter_setPosition(p_ctrl, closest_orange_pad->position); + particleEmitter_setModel(p_ctrl, ASSET_89F_MODEL_ORANGE_PARTICLE); + particleEmitter_setStartingScaleRange(p_ctrl, 0.09f, 0.19f); + particleEmitter_setFinalScaleRange(p_ctrl, 0.0f, 0.0f); + particleEmitter_setParticleVelocityRange(p_ctrl, -200.0f, 500.0f, -200.0f, 200.0f, 700.0f, 200.0f); + particleEmitter_setAccelerationRange(p_ctrl, 0.0f, -1200.0f, 0.0f, 0.0f, -1200.0f, 0.0f); + particleEmitter_setAngularVelocityRange(p_ctrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); + particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f); + particleEmitter_setParticleLifeTimeRange(p_ctrl, 4.0f, 4.0f); + particleEmitter_func_802EF9F8(p_ctrl, 0.01f); + particleEmitter_func_802EFA18(p_ctrl, 3); + particleEmitter_func_802EFA20(p_ctrl, 1.0f, 1.3f); + + particleEmitter_emitN(p_ctrl, ORANGE_PARTICLE_COUNT); } -void func_80386744(s32 arg0, ActorMarker *arg1) { - func_80386444(arg1); +void chOrangePad_handleOrangeCollision(s32 _, ActorMarker *marker) { + handleOrangeCollision(marker); } -void chorangepad_update(Actor *this) { - Actor *closest_actor; +void chOrangePad_update(Actor *this) { + Actor *conga; f32 unused; f32 min_distance; @@ -90,41 +96,41 @@ void chorangepad_update(Actor *this) { this->marker->propPtr->unk8_3 = 1; actor_collisionOff(this); this->initialized = TRUE; - }//L803867B0 + } if (!this->volatile_initialized) { - this->unk100 = actorArray_findClosestActorFromActorId(this->position, 8, -1, &min_distance)->marker; + this->partnerActor = actorArray_findClosestActorFromActorId(this->position, ACTOR_8_CONGA, -1, &min_distance)->marker; this->volatile_initialized = TRUE; - }//L803867E0 - - if (this->unk100) { - closest_actor = marker_getActor(this->unk100); } - if (func_80329530(this, 0x28) && - !player_movementGroup() && - !mapSpecificFlags_get(MM_SPECIFIC_FLAG_6_UNKNOWN) && - closest_actor->state != 3) { + if (this->partnerActor) { + conga = marker_getActor(this->partnerActor); + } - if (gcdialog_showText(0xb3d, 0, NULL, NULL, NULL, NULL)) { - mapSpecificFlags_set(MM_SPECIFIC_FLAG_6_UNKNOWN, TRUE); + if (subaddie_playerIsWithinSphereAndActive(this, CONGA_WARN_DISTANCE) + && !player_movementGroup() + && !mapSpecificFlags_get(MM_SPECIFIC_FLAG_CONGA_WARNED_BLOCKS) + && conga->state != CONGA_STATE_MOPEY) { + + if (gcdialog_showDialog(ASSET_B3D_DIALOG_CONGA_DONT_TOUCH_BLOCKS, 0, NULL, NULL, NULL, NULL)) { + mapSpecificFlags_set(MM_SPECIFIC_FLAG_CONGA_WARNED_BLOCKS, TRUE); } } - if (this->state == 1) { + if (this->state == ORANGE_PAD_STATE_HIT) { if (this->lifetime_value < 72.0f) { - func_8033E73C(this->marker, 5, func_80329904); - func_8033E3F0(9, this->marker->unk14_21); + commonParticle_add(this->marker, 5, func_80329904); + commonParticle_new(9, this->marker->unk14_21); } - this->lifetime_value = MIN(255.0, this->lifetime_value + 7.0); + // Tick up respawn by 7 every update + this->lifetime_value = MIN(ORANGE_PAD_HIT_LIFETIME, this->lifetime_value + ORANGE_PAD_LIFETIME_INCREMENT); - if (255.0 == this->lifetime_value) { + if (ORANGE_PAD_HIT_LIFETIME == this->lifetime_value) { marker_despawn(this->marker); } - } - else { - }//L80386928 + } else { } // Can't remove the else ;.; + // If hit, then fade out actor_setOpacity(this, 0xFF - (s32) this->lifetime_value); -}//*/ +} diff --git a/src/MM/ch/orangepad.h b/src/MM/ch/orangepad.h new file mode 100644 index 00000000..5fbbba35 --- /dev/null +++ b/src/MM/ch/orangepad.h @@ -0,0 +1,13 @@ +#define ORANGE_PARTICLE_COUNT 30 +#define CONGA_WARN_DISTANCE 0x28 +#define ORANGE_PAD_HIT_LIFETIME 255.0 +#define ORANGE_PAD_LIFETIME_INCREMENT 7.0 + +enum orange_pad_state_e { + ORANGE_PAD_STATE_HIT = 1 +}; + +enum orange_pad_ids { + ORANGE_PAD_LEFT = 0x76, + ORANGE_PAD_RIGHT = 0x106 +}; diff --git a/src/MM/code_24C0.c b/src/MM/code_24C0.c index c50426a7..d8522a33 100644 --- a/src/MM/code_24C0.c +++ b/src/MM/code_24C0.c @@ -9,21 +9,21 @@ extern ActorInfo chhutInfo; extern ActorInfo chchimpystump; extern ActorInfo chgrublinInfo; -extern ActorInfo chcongaInfo; +extern ActorInfo chCongaInfo; extern ActorInfo chorangeInfo; extern ActorInfo chjujuhitboxInfo; extern ActorInfo chjujuInfo; -extern ActorInfo chorangepadInfo; +extern ActorInfo chOrangePadInfo; extern ActorInfo chlmonkeyInfo; void MM_func_803888B0(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); - spawnableActorList_add( &chcongaInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_5); + spawnableActorList_add( &chCongaInfo, actor_new, ACTOR_FLAG_UNKNOWN_25 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_5); spawnableActorList_add( &chorangeInfo, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add( &chjujuhitboxInfo, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add( &chjujuInfo, actor_new, ACTOR_FLAG_UNKNOWN_14 | ACTOR_FLAG_UNKNOWN_2); - spawnableActorList_add( &chorangepadInfo, actor_new, ACTOR_FLAG_UNKNOWN_6); + spawnableActorList_add( &chOrangePadInfo, actor_new, ACTOR_FLAG_UNKNOWN_6); spawnableActorList_add( &chlmonkeyInfo, actor_new, ACTOR_FLAG_UNKNOWN_8); } diff --git a/src/MMM/ch/loggo.c b/src/MMM/ch/loggo.c index 95dff097..34f69d79 100644 --- a/src/MMM/ch/loggo.c +++ b/src/MMM/ch/loggo.c @@ -41,7 +41,7 @@ void __chLoggo_collide(ActorMarker *this_marker, ActorMarker *other_marker) { Actor *this = marker_getActor(this_marker); if ((player_getTransformation() == TRANSFORM_3_PUMPKIN) && !fileProgressFlag_get(FILEPROG_89_ENTERED_LOGGO_AS_PUMPKIN)) { - if (gcdialog_showText(ASSET_ADF_DIALOG_ENTER_LOGGO, 0x2B, this->position, this->marker, &__chLoggo_textCallback, 0) != 0) { + if (gcdialog_showDialog(ASSET_ADF_DIALOG_ENTER_LOGGO, 0x2B, this->position, this->marker, &__chLoggo_textCallback, 0) != 0) { actor_collisionOff(this); fileProgressFlag_set(FILEPROG_89_ENTERED_LOGGO_AS_PUMPKIN, TRUE); } @@ -55,7 +55,7 @@ void __chLoggo_collide(ActorMarker *this_marker, ActorMarker *other_marker) { } if ((player_getTransformation() == TRANSFORM_1_BANJO) && !fileProgressFlag_get(FILEPROG_88_TRIED_LOGGO_AS_BEAR)) { - if (gcdialog_showText(ASSET_ADE_DIALOG_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_ADE_DIALOG_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) { fileProgressFlag_set(FILEPROG_88_TRIED_LOGGO_AS_BEAR, TRUE); } } @@ -81,7 +81,7 @@ void chLoggo_update(Actor *this) { this->lifetime_value = 0.0f; if (!fileProgressFlag_get(FILEPROG_8A_EXITED_LOGGO) && levelSpecificFlags_get(LEVEL_FLAG_33_MMM_UNKNOWN)) { - if (gcdialog_showText(ASSET_AE0_DIALOG_EXIT_LOGGO, 4, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_AE0_DIALOG_EXIT_LOGGO, 4, NULL, NULL, NULL, NULL)) { fileProgressFlag_set(FILEPROG_8A_EXITED_LOGGO, TRUE); } } @@ -89,7 +89,7 @@ void chLoggo_update(Actor *this) { switch (this->state) { case LOGGO_STATE_1_IDLE: - sp34 = func_803114B0() ? 12000 : 0; + sp34 = gcdialog_hasCurrentTextId() ? 12000 : 0; if (actor_animationIsAt(this, 0.09f)) { func_8030E878(SFX_109_LOGGO_LID_CLAP, randf2(0.975f, 1.025f), MAX(0, 22000 - sp34), this->position, 400.0f, 1000.0f); @@ -115,7 +115,7 @@ void chLoggo_update(Actor *this) { case LOGGO_STATE_2_FLUSHING: if (actor_animationIsAt(this, 0.46f)) { this->marker->propPtr->unk8_3 = FALSE; - FUNC_8030E8B4(SFX_92_TOILET_FLUSH, 1.0f, 32000, this->position, 600, 1500); + sfx_playFadeShorthandDefault(SFX_92_TOILET_FLUSH, 1.0f, 32000, this->position, 600, 1500); levelSpecificFlags_set(LEVEL_FLAG_33_MMM_UNKNOWN, TRUE); ml_vec3f_assign(position, this->position_x - 50.0f, this->position_y + 50.0f, this->position_z); func_8028F6E4(BS_INTR_2F_LOGGO, position); diff --git a/src/MMM/ch/napper.c b/src/MMM/ch/napper.c index 496637db..5e0ece46 100644 --- a/src/MMM/ch/napper.c +++ b/src/MMM/ch/napper.c @@ -63,7 +63,7 @@ void func_80386ACC(ActorMarker *this_marker, ActorMarker *other_marker){ Actor *this = marker_getActor(this_marker); if(!this->has_met_before){ - if(gcdialog_showText(0xad8, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(0xad8, 0, NULL, NULL, NULL, NULL)){ this->has_met_before = TRUE; } } @@ -201,8 +201,8 @@ void chnapper_update(Actor *this){ } if(sp70 < 0.35 && 0.35 <= sp74){ - if(!func_803114B0()){ - func_8030E6A4(SFX_3F5_UNKNOWN, randf2(0.9f, 1.1f), 0x7fff); + if(!gcdialog_hasCurrentTextId()){ + gcsfx_playWithPitch(SFX_3F5_UNKNOWN, randf2(0.9f, 1.1f), 0x7fff); } } }//L803870F8 diff --git a/src/MMM/code_16B0.c b/src/MMM/code_16B0.c index 82411909..65d3b7fd 100644 --- a/src/MMM/code_16B0.c +++ b/src/MMM/code_16B0.c @@ -73,8 +73,8 @@ void chChompa_setState(Actor *this, s32 next_state) { skeletalAnim_set(this->unk148, 0x23e, 0.0f, 2.5f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); - if (this->unk100) { - chPortrait_break(this->unk100, tmp + 0.55); + if (this->partnerActor) { + chPortrait_break(this->partnerActor, tmp + 0.55); } FUNC_8030E624(SFX_3EF, 1.1f, 25000); @@ -104,7 +104,7 @@ void __chChompa_spwanPortrait(ActorMarker *marker) { enum asset_e portrait_id; Actor *portrait; - switch (this->unkF4_8) { + switch (this->actorTypeSpecificField) { case 0x32: portrait_id = ACTOR_382_PORTRAIT_OF_GRUNTY; break; @@ -130,7 +130,7 @@ void __chChompa_spwanPortrait(ActorMarker *marker) { portrait = spawn_child_actor(portrait_id, &this); portrait->yaw = this->yaw; - this->unk100 = portrait->marker; + this->partnerActor = portrait->marker; portrait->unk10_1 = FALSE; } @@ -167,7 +167,7 @@ void __chChompa_emitBones(f32 position[3], s32 count, enum asset_e model_id) { particleEmitter_setAngularVelocityRange(pCtrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); particleEmitter_func_802EF9F8(pCtrl, 0.4f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setSfx(pCtrl, SFX_2F_ORANGE_SPLAT, 16000); particleEmitter_setDrawMode(pCtrl, 2); particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038BB70); @@ -256,7 +256,7 @@ void chChompa_update(Actor *this) { (anim_prev_progress < 0.32 && 0.32 <= anim_progress) || (anim_prev_progress < 0.53 && 0.53 <= anim_progress) ) { - func_8030E6A4(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_6D_CROC_BITE, randf2(0.95f, 1.05f), 32000); } if (anim_prev_progress < 0.9 && 0.9 <= anim_progress) { diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index d694e2f9..e66e5089 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -4,6 +4,8 @@ #include "variables.h" #include "actor.h" +#include "core2/dustemitter.h" + extern ActorInfo D_8038BC28; extern ActorInfo D_8038BCDC; extern ActorInfo D_8038BC4C; @@ -35,7 +37,6 @@ extern ActorInfo D_80372C3C; 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); void func_802D3D54(Actor *this); @@ -264,7 +265,7 @@ Actor *func_80388994(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp90[0] = sp84[0] + (sp78[0] - sp84[0]) * randf(); sp90[1] = sp84[1]; sp90[2] = sp84[2] + (sp78[2] - sp84[2]) * randf(); - func_802EE6CC(sp90, sp6C, D_8038BE20, 1, 0.3f, 50.0f, 0xB4, randi2(0x82, 0xC8), 0); + dustEmitter_emit(sp90, sp6C, D_8038BE20, 1, 0.3f, 50.0f, 0xB4, randi2(0x82, 0xC8), DUST_EMITTER_TYPE_DUST); } } return this; @@ -305,11 +306,11 @@ void func_80388BDC(Actor *this) { case 1: this->yaw = 0.0f; if(mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN)) { - func_802BAFE4(0x21); + gcStaticCamera_activate(0x21); subaddie_set_state(this, 6); core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_2_UNKNOWN, FALSE); - func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1); + coMusicPlayer_playMusic(COMUSIC_4_MMM_CLOCK_VERSION, -1); func_8025AE0C(2000, 3.0f); } break; @@ -319,7 +320,7 @@ void func_80388BDC(Actor *this) { if ((this->yaw <= 270.0f) && (this->yaw > 260.0f)) { subaddie_set_state(this, 7U); this->yaw = 270.0f; - func_8030E540(0x7F); + gcsfx_play(0x7F); core1_7090_freeSfxSource(0); func_802D68F0(0xE); item_set(6, 1); @@ -336,9 +337,9 @@ void func_80388BDC(Actor *this) { || ((this->unk38_31) && (this->lifetime_value == 0.0f)) ) { if (!this->unk38_31) { - func_802BAFE4(0x22); + gcStaticCamera_activate(0x22); } else { - func_802BAFE4(0x23); + gcStaticCamera_activate(0x23); } subaddie_set_state(this, 8); core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); @@ -349,16 +350,16 @@ void func_80388BDC(Actor *this) { if ((this->yaw >= 0.0f) && (this->yaw < 10.0f)) { subaddie_set_state(this, 1U); this->yaw = 0.0f; - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_0_UNKNOWN, FALSE); core1_7090_freeSfxSource(0); if (!this->unk38_31) { - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); func_8025AE0C(0x7D0, 2.5f); } this->unk38_31 = 0; this->lifetime_value = 0.0f; - volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED); + progressDialog_setAndTriggerDialog_0(VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED); } break; } diff --git a/src/MMM/code_2F60.c b/src/MMM/code_2F60.c index 3bf536c3..386357eb 100644 --- a/src/MMM/code_2F60.c +++ b/src/MMM/code_2F60.c @@ -97,5 +97,5 @@ void chPortrait_break(ActorMarker *marker, f32 anim_duration) { actor_playAnimationOnce(this); anctrl_setDuration(this->anctrl, anim_duration); this->unk38_31 = 1; - FUNC_8030E8B4(SFX_129_SWOOSH, 1.0f, 32000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_129_SWOOSH, 1.0f, 32000, this->position, 1000, 2000); } diff --git a/src/MMM/code_3420.c b/src/MMM/code_3420.c index ee84b37c..37d9aa41 100644 --- a/src/MMM/code_3420.c +++ b/src/MMM/code_3420.c @@ -178,8 +178,8 @@ void func_803898EC() { } void func_80389910() { - gcdialog_showText(ASSET_AD5_DIALOG_UNKNOWN, 0xE, NULL, NULL, MMM_func_80389810, NULL); - timedFunc_set_2(0.0f, (GenFunction_2)func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + gcdialog_showDialog(ASSET_AD5_DIALOG_UNKNOWN, 0xE, NULL, NULL, MMM_func_80389810, NULL); + timedFunc_set_2(0.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); timed_setStaticCameraToNode(2.0f, 0); timedFunc_set_0(2.1f, MMM_func_803898A0); timedFunc_set_0(6.0f, func_803898EC); @@ -189,7 +189,7 @@ void func_80389910() { void func_803899BC(void){ func_80324E38(0.0f, 3); - timedFunc_set_2(0.0f, (GenFunction_2)func_8025A6EC, COMUSIC_38_MOTZAND_BEATEN, 0x7fff); + timedFunc_set_2(0.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_38_MOTZAND_BEATEN, 0x7fff); timedFunc_set_0(2.25f, func_80389910); } @@ -199,10 +199,10 @@ void organMinigame_setState(s32 next_state){ if (next_state == 2) { if (Me.pattern == 0) { Me.pattern = 1; - gcdialog_showText(ASSET_AD3_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showDialog(ASSET_AD3_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } else {//L80389A84 - gcdialog_showText(ASSET_AD6_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showDialog(ASSET_AD6_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } }//L80389A9C @@ -219,13 +219,13 @@ void organMinigame_setState(s32 next_state){ }//L80389AF4 if(next_state == 4){ - gcdialog_showText(ASSET_ADD_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showDialog(ASSET_ADD_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(Me.motzhand_marker); } if(next_state == 5){ Me.pattern++; - gcdialog_showText(ASSET_AD4_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showDialog(ASSET_AD4_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(Me.motzhand_marker); } diff --git a/src/MMM/code_3D50.c b/src/MMM/code_3D50.c index 3a0fc831..beee9c56 100644 --- a/src/MMM/code_3D50.c +++ b/src/MMM/code_3D50.c @@ -140,7 +140,7 @@ void MMM_func_8038A54C(Struct_MMM_3D50_0 *arg0, s32 arg1){ arg0->unk3 = arg1; arg0->unk4 = 0.0f; if(arg1 == 1 && v0 != arg1){ - func_8025A6EC(COMUSIC_2C_BUZZER, 32000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 32000); } } @@ -194,10 +194,10 @@ void func_8038A82C(Struct_MMM_3D50_0 * arg0){ if( iPtr->unk0[iPtr->unk4] == 0){ func_8038A140(5); chTumblar_congratulate(MMM_D_8038C510.unkC, MMM_D_8038C510.unk10); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); } else{ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } } diff --git a/src/MMM/code_47D0.c b/src/MMM/code_47D0.c index abc70857..dc2e343d 100644 --- a/src/MMM/code_47D0.c +++ b/src/MMM/code_47D0.c @@ -88,10 +88,10 @@ void chTumblar_init(Struct_MMM_47D0_0 *arg0, Struct68s *arg1) { sfxsource_index = func_80351758_getSfxsourceIndex(arg1); sfxsource_setSfxId(sfxsource_index, SFX_3EC_CCW_DOOR_OPENING); - func_8030DD14(sfxsource_index, 3); + sfxSource_setunk43_7ByIndex(sfxsource_index, 3); sfxsource_playSfxAtVolume(sfxsource_index, 0.6f); sfxsource_setSampleRate(sfxsource_index, 0); - func_8030E2C4(sfxsource_index); + sfxSource_func_8030E2C4(sfxsource_index); func_8035179C_copyPosition(arg1, position); distance_to_jiggy = 500.0f; @@ -119,7 +119,7 @@ void __chTumblar_congratulationTextCallback(ActorMarker *marker, enum asset_e te } void chTumblar_congratulate(Struct_MMM_47D0_0 *arg0, s32 arg1) { - gcdialog_showText(ASSET_ADB_DIALOG_UNKNOWN, 4, NULL, arg0->jiggy_marker, __chTumblar_congratulationTextCallback, NULL); + gcdialog_showDialog(ASSET_ADB_DIALOG_UNKNOWN, 4, NULL, arg0->jiggy_marker, __chTumblar_congratulationTextCallback, NULL); arg0->state = TUMBLAR_STATE_1_CONGRATULATING; } @@ -212,7 +212,7 @@ void chTumblar_update(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 tick) { func_8035179C_copyPosition(arg1, position); if (!mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN) && arg0->state == TUMBLAR_STATE_0_IDLE && ml_vec3f_horizontal_distance_zero_likely(position, plyr_pos) < 250.0f) { - if (gcdialog_showText(ASSET_ADA_DIALOG_UNKNOWN, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_ADA_DIALOG_UNKNOWN, 0, NULL, NULL, NULL, NULL)) { mapSpecificFlags_set(0, TRUE); } } @@ -221,6 +221,6 @@ void chTumblar_update(Struct_MMM_47D0_0 *arg0, Struct68s *arg1, f32 tick) { arg0->state = TUMBLAR_STATE_2_BREAKING; arg0->timer = 0.0f; mapSpecificFlags_set(MMM_SPECIFIC_FLAG_TUMBLAR_BROKEN, FALSE); - FUNC_8030E8B4(SFX_11B_TUMBLAR_DISAPPEARING_1, 1.0f, 30000, position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_11B_TUMBLAR_DISAPPEARING_1, 1.0f, 30000, position, 500, 2500); } } diff --git a/src/MMM/code_5000.c b/src/MMM/code_5000.c index 7a055263..5f32292a 100644 --- a/src/MMM/code_5000.c +++ b/src/MMM/code_5000.c @@ -75,12 +75,12 @@ void func_8038B630(Struct5Fs *arg0, Struct68s *arg1){ sp20 = alCents2Ratio(func_80389BBC()*100); phi_s0 = func_80351758_getSfxsourceIndex(arg1); - func_8030E394(phi_s0); + sfxSource_triggerCallbackByIndex(phi_s0); sfxsource_playSfxAtVolume(phi_s0, sp20); sfxsource_setSfxId(phi_s0, 0x3f3); - func_8030DD14(phi_s0, 3); + sfxSource_setunk43_7ByIndex(phi_s0, 3); sfxsource_setSampleRate(phi_s0, 0x7fff); - func_8030E2C4(phi_s0); + sfxSource_func_8030E2C4(phi_s0); arg0->unk14 = 1.5f; if(pad); @@ -104,7 +104,7 @@ void func_8038B72C(Struct5Fs *arg0, Struct68s * arg1) { void func_8038B754(Struct5Fs *arg0, Struct68s * arg1){ func_8038B590(arg0, arg1); arg0->unkC = 1.0f; - func_8025A6EC(COMUSIC_2C_BUZZER, 28000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 28000); } void func_8038B790(Struct5Fs *arg0, Struct68s *arg1, f32 arg2) { diff --git a/src/MMM/code_DC0.c b/src/MMM/code_DC0.c index dc038274..d562b920 100644 --- a/src/MMM/code_DC0.c +++ b/src/MMM/code_DC0.c @@ -66,7 +66,7 @@ void chFlowerpot_update(Actor *this) { case FLOWER_POT_STATE_2_FLOWERED: if (actor_animationIsAt(this, 0.2f)) { - FUNC_8030E8B4(SFX_12F_THAAANK_YOOOUUU, 1.0f, 30000, this->position, 300, 2000); + sfx_playFadeShorthandDefault(SFX_12F_THAAANK_YOOOUUU, 1.0f, 30000, this->position, 300, 2000); } break; } diff --git a/src/RBB/ch/anchorctrl.c b/src/RBB/ch/anchorctrl.c index fb20866b..21d2d4a8 100644 --- a/src/RBB/ch/anchorctrl.c +++ b/src/RBB/ch/anchorctrl.c @@ -69,6 +69,6 @@ void chAnchorCtrl_update(Actor *this){ timed_exitStaticCamera(0.0f); func_80324E38(0.0f, 0); timedFunc_set_0(0.0f, func_803228D8); - timedFunc_set_3(0.0f, (GenFunction_3)func_802E4078, MAP_8B_RBB_ANCHOR_ROOM, 2, 0); + timedFunc_set_3(0.0f, (GenFunction_3)transitionToMap, MAP_8B_RBB_ANCHOR_ROOM, 2, 0); }//L8038C2E4 } diff --git a/src/RBB/ch/anchorswitch.c b/src/RBB/ch/anchorswitch.c index cbd771a7..7f1abf8e 100644 --- a/src/RBB/ch/anchorswitch.c +++ b/src/RBB/ch/anchorswitch.c @@ -23,7 +23,7 @@ void __chAnchorSwitch_setState(Actor *this, s32 arg1){ levelSpecificFlags_set(LEVEL_FLAG_30_RBB_UNKNOWN, TRUE); volatileFlag_set(VOLATILE_FLAG_E, 1); timedFunc_set_0(1.0f, func_803228D8); - timedFunc_set_3(1.0f, (GenFunction_3)func_802E4078, MAP_31_RBB_RUSTY_BUCKET_BAY, 0, 0); + timedFunc_set_3(1.0f, (GenFunction_3)transitionToMap, MAP_31_RBB_RUSTY_BUCKET_BAY, 0, 0); } } this->state = arg1; diff --git a/src/RBB/ch/axle.c b/src/RBB/ch/axle.c index 2444deca..25779753 100644 --- a/src/RBB/ch/axle.c +++ b/src/RBB/ch/axle.c @@ -63,7 +63,7 @@ void func_80388EB8(Actor *this, s32 arg1){ s32 sp30; if(this->state == 2) - FUNC_8030E8B4(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000, this->position, 1000, 2300); + sfx_playFadeShorthandDefault(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000, this->position, 1000, 2300); this->state = arg1; local->unk24 = 0.0f; @@ -90,7 +90,7 @@ void func_80388EB8(Actor *this, s32 arg1){ local->unk10[2] = this->roll + 360.0f; local->unk1C = 0.0f; - FUNC_8030E8B4(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000, this->position, 900, 1800); + sfx_playFadeShorthandDefault(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000, this->position, 900, 1800); }//L803890A8 } diff --git a/src/RBB/ch/bellbuoy.c b/src/RBB/ch/bellbuoy.c index 981e54c4..66915fcd 100644 --- a/src/RBB/ch/bellbuoy.c +++ b/src/RBB/ch/bellbuoy.c @@ -74,7 +74,7 @@ void func_8038DF6C(Actor* this){ } if(ml_timer_update(&local->unk24[1], sp68)){ local->unk24[1] = randf2(1.5f, 2.5f); - FUNC_8030E8B4(SFX_40E_UNKNOWN, 1.5f, 20000, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_40E_UNKNOWN, 1.5f, 20000, this->position, 500, 1500); }//L8038E118 if(ml_timer_update(&local->unk24[2], sp68)){ diff --git a/src/RBB/ch/bossboombox.c b/src/RBB/ch/bossboombox.c index 3b323421..cd3b7625 100644 --- a/src/RBB/ch/bossboombox.c +++ b/src/RBB/ch/bossboombox.c @@ -4,7 +4,7 @@ extern void actor_predrawMethod(Actor *); extern void actor_postdrawMethod(ActorMarker *); -extern void func_8030E394(u8); +extern void sfxSource_triggerCallbackByIndex(u8); extern int func_803342AC(f32 (*)[3], f32(*)[3], f32); extern void particleEmitter_setModel(ParticleEmitter *, s32); @@ -303,7 +303,7 @@ void RBB_func_8038CC9C(Actor *this, s32 new_state){ if(this->state == 2){ func_8025A58C(0, 0xfa0); - func_8025A6EC(COMUSIC_62_RBB_BOOMBOX, -1); + coMusicPlayer_playMusic(COMUSIC_62_RBB_BOOMBOX, -1); func_8025AABC(COMUSIC_62_RBB_BOOMBOX); skeletalAnim_set(this->unk148, ASSET_146_ANIM_BOSS_BOOMBOX_APPEAR, 0.0f, 2.4f); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); @@ -367,7 +367,7 @@ void RBB_func_8038CC9C(Actor *this, s32 new_state){ } else{//L8038D220 timedFunc_set_3(0.0f, (GenFunction_3)chbossboombox_respawnJiggy, (s32)this->position_x, (s32)this->position_y, (s32)this->position_z); - gcdialog_showText(ASSET_B9F_DIALOG_UNKNOWN, 4, 0, 0, 0, 0); + gcdialog_showDialog(ASSET_B9F_DIALOG_UNKNOWN, 4, 0, 0, 0, 0); } }//L8038D278 } @@ -439,7 +439,7 @@ void func_8038D5BC(ActorMarker *marker, ActorMarker *arg1){ Actor *actor = marker_getActor(marker); ActorLocal_RBB_5F80 *local = (ActorLocal_RBB_5F80 *) &actor->local; - func_8030E6A4(0x3f5, local->unk0->unk10, 0x4e20); + gcsfx_playWithPitch(0x3f5, local->unk0->unk10, 0x4e20); RBB_func_8038CC9C(actor, 4); func_8038C8A8(actor); } @@ -474,8 +474,8 @@ void func_8038D7E8(ActorMarker *marker, s32 arg1){ Actor *actor = marker_getActor(marker); ActorLocal_RBB_5F80 *local = (ActorLocal_RBB_5F80 *) &actor->local; - FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 20000, actor->position, 1000, 2000); - func_8030E6A4(SFX_D7_GRABBA_DEATH, local->unk0->unk10, 0x7530); + sfx_playFadeShorthandDefault(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 20000, actor->position, 1000, 2000); + gcsfx_playWithPitch(SFX_D7_GRABBA_DEATH, local->unk0->unk10, 0x7530); local->unk4 += (arg1) ? 1 : 5; if(local->unk4 >= local->unk0->unkC) RBB_func_8038CC9C(actor, 5); diff --git a/src/RBB/ch/cog.c b/src/RBB/ch/cog.c index d4169333..1bc1a8c3 100644 --- a/src/RBB/ch/cog.c +++ b/src/RBB/ch/cog.c @@ -56,9 +56,9 @@ void func_80388C20(Actor *this){ sfxsource_set_position(local->sfxsourceIdx, this->position); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.5f); sfxsource_setSfxId(local->sfxsourceIdx, SFX_9F_GENERATOR_RUNNING); - func_8030DD14(local->sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 3); sfxsource_setSampleRate(local->sfxsourceIdx, 0); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); }//L80388CFC if(this->state == 0){ if(this->modelCacheIndex == 0x17B){ diff --git a/src/RBB/ch/dolphin.c b/src/RBB/ch/dolphin.c index 97beefa0..90aa7e6b 100644 --- a/src/RBB/ch/dolphin.c +++ b/src/RBB/ch/dolphin.c @@ -86,10 +86,10 @@ void func_8038B900(Actor *this){ if(this->state == 1){ if( !this->has_met_before - && func_80329530(this, 0x258) + && subaddie_playerIsWithinSphereAndActive(this, 0x258) && !player_movementGroup() ){ - gcdialog_showText(0xb9b, 4, 0, 0, 0, 0); + gcdialog_showDialog(0xb9b, 4, 0, 0, 0, 0); this->has_met_before = TRUE; } } diff --git a/src/RBB/ch/eggtoll1.c b/src/RBB/ch/eggtoll1.c index 07f44abc..6b74705d 100644 --- a/src/RBB/ch/eggtoll1.c +++ b/src/RBB/ch/eggtoll1.c @@ -105,15 +105,15 @@ void func_803866F4(Actor *this, s32 arg1){ if(arg1 == 2){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); local = (ActorLocal_RBB_0 *) &this->local; local->unkC = 3; } if(arg1 == 3){ local->unk8++; - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); func_80324E38(0.0f, 3); - timedFunc_set_2(0.5f, (GenFunction_2) func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + timedFunc_set_2(0.5f, (GenFunction_2) coMusicPlayer_playMusic, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); timedFunc_set_1(1.0f, (GenFunction_1) func_803865D0, (s32)this->marker); }//L803867D4 if(arg1 == 4){ @@ -152,10 +152,10 @@ void func_803868F0(Actor *this){ local->unk4 = 0; local->unk8 = 0; local->unkC = 0; - local->unk4 = (this->unk78_13 == 0x15)? 0: local->unk4; - local->unk4 = (this->unk78_13 == 0x13)? 1: local->unk4; - local->unk4 = (this->unk78_13 == 0x14)? 2: local->unk4; - local->unk4 = (this->unk78_13 == 0xB)? 3: local->unk4; + local->unk4 = (this->secondaryId == 0x15)? 0: local->unk4; + local->unk4 = (this->secondaryId == 0x13)? 1: local->unk4; + local->unk4 = (this->secondaryId == 0x14)? 2: local->unk4; + local->unk4 = (this->secondaryId == 0xB)? 3: local->unk4; func_803866F4(this, 1); } RBB_func_803863F0(this, 0); diff --git a/src/RBB/ch/enginefan.c b/src/RBB/ch/enginefan.c index 5cae5a11..837f1774 100644 --- a/src/RBB/ch/enginefan.c +++ b/src/RBB/ch/enginefan.c @@ -173,7 +173,7 @@ void func_8038944C(Actor *this){ || (sp50[i] < 180.0f && 180.0f <= sp44[i]) || (sp50[i] < 360.0f && 360.0f <= sp44[i]) ){ - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.4f, 23000, this->position, 50, 1000); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 0.4f, 23000, this->position, 50, 1000); } } this->pitch += (360.0f <= this->pitch)? -360 : 0; diff --git a/src/RBB/ch/grimlet.c b/src/RBB/ch/grimlet.c index 411b4d24..6de402be 100644 --- a/src/RBB/ch/grimlet.c +++ b/src/RBB/ch/grimlet.c @@ -133,7 +133,7 @@ void func_80388620(Actor *this){ func_80258A4C(this->position, (this->yaw + -90.0f) + local->unk0, plyr_pos, &sp60, &sp5C, &sp58); local->unk0 += (sp58*200.0f)*sp50; if(1.0f < local->unk14 && (sp58 < -0.1 || 0.1 < sp58)){ - func_8030E6A4(SFX_D0_GRIMLET_SQUEAK, mlAbsF(sp58) * 0.1 + 0.9, 0x4e20); + gcsfx_playWithPitch(SFX_D0_GRIMLET_SQUEAK, mlAbsF(sp58) * 0.1 + 0.9, 0x4e20); local->unk14 = 0.0f; } } @@ -174,7 +174,7 @@ void func_80388620(Actor *this){ && 0.55 <= sp48 && !local->unk5 ){ - FUNC_8030E8B4(SFX_20_METAL_CLANK_1, 1.0f, 32000, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_20_METAL_CLANK_1, 1.0f, 32000, this->position, 500, 2500); } if(skeletalAnim_getLoopCount(this->unk148) > 0) diff --git a/src/RBB/ch/propellor.c b/src/RBB/ch/propellor.c index 3662d03a..637af278 100644 --- a/src/RBB/ch/propellor.c +++ b/src/RBB/ch/propellor.c @@ -76,7 +76,7 @@ void chPropellor_update(Actor *this){ func_803300C0(this->marker, func_80389B44); marker_setFreeMethod(this->marker, __chPropellor_free); func_80389B80(this, 1.0f); - if(this->unk78_13 == 0x1C){ + if(this->secondaryId == 0x1C){ local->unk8 = 0; this->position_x = 7625.5f; this->position_y = -1950.0f; @@ -99,7 +99,7 @@ void chPropellor_update(Actor *this){ timed_exitStaticCamera(4.5f); func_80324E38(4.5f, 0); timedFunc_set_2(4.5f, (GenFunction_2)levelSpecificFlags_set, local->unk8 ? 0x4 : 0x3, 0); - timedFunc_set_3(4.5f, (GenFunction_3)func_802E4078, MAP_34_RBB_ENGINE_ROOM, !local->unk8 ? 3 : 2, 0); + timedFunc_set_3(4.5f, (GenFunction_3)transitionToMap, MAP_34_RBB_ENGINE_ROOM, !local->unk8 ? 3 : 2, 0); func_803228D8(); } }//L80389EA8 diff --git a/src/RBB/ch/propellorswitch.c b/src/RBB/ch/propellorswitch.c index 25eaa6ae..7a8d55b7 100644 --- a/src/RBB/ch/propellorswitch.c +++ b/src/RBB/ch/propellorswitch.c @@ -49,7 +49,7 @@ void __chPropellorSwitch_setState(Actor *this, s32 arg1){ levelSpecificFlags_set(local->unk0->unk8, 1); func_803228D8(); timedFunc_set_1(1.1f, (GenFunction_1)func_8028F9DC, 2); - timedFunc_set_3(1.1f, (GenFunction_3)func_802E4078, MAP_31_RBB_RUSTY_BUCKET_BAY, 0, 0); + timedFunc_set_3(1.1f, (GenFunction_3)transitionToMap, MAP_31_RBB_RUSTY_BUCKET_BAY, 0, 0); }else{ levelSpecificFlags_set(local->unk0->unkA, 1); } @@ -98,7 +98,7 @@ void chPropellorSwitch_update(Actor *this){ this->marker->propPtr->unk8_3 = 1; this->marker->actorFreeFunc = chPropellorSwitch_free; this->volatile_initialized = TRUE; - local->unk0 = &D_80390720[((this->unk78_13 == 2) ? 0:1)]; + local->unk0 = &D_80390720[((this->secondaryId == 2) ? 0:1)]; if(local->unk0->unk6 == 0) local->unk4 = NULL; else diff --git a/src/RBB/ch/whistlectrl.c b/src/RBB/ch/whistlectrl.c index 1e93f09e..095f7553 100644 --- a/src/RBB/ch/whistlectrl.c +++ b/src/RBB/ch/whistlectrl.c @@ -32,16 +32,16 @@ void __chWhistleCtrl_soundWhistle(void){ } void __chWhistleCtrl_correct(void){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } void __chWhistleCtrl_wrong(ActorMarker *marker){ - func_8025A6EC(COMUSIC_2C_BUZZER, 28000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 28000); func_8028F530(0xD); } void __chWhistleCtrl_complete(void){ - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 28000); func_80324E38(1.0f, 3); timed_setStaticCameraToNode(2.0f, 10); timedFunc_set_0(2.2f, __chWhistleCtrl_soundWhistle); diff --git a/src/RBB/code_1570.c b/src/RBB/code_1570.c index c8ba5368..3ae21b76 100644 --- a/src/RBB/code_1570.c +++ b/src/RBB/code_1570.c @@ -206,7 +206,7 @@ void func_803881E8(Actor *this, s32 arg1){ if(this->state == 2){ RBB_func_80387960(0.05f); timedFunc_set_2(0.05f, (GenFunction_2)func_80387BEC, 0x19f, 0x1f4); - timedFunc_set_2(0.1f, (GenFunction_2)func_8025A6EC, COMUSIC_2B_DING_B, 28000); + timedFunc_set_2(0.1f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2B_DING_B, 28000); func_80324E38(0.2f, 3); timed_setStaticCameraToNode(1.1f, 7); timedFunc_set_1(1.6f, (GenFunction_1)func_80388154, (s32)this->marker); diff --git a/src/RBB/code_9670.c b/src/RBB/code_9670.c index 3cc5211c..6b336e10 100644 --- a/src/RBB/code_9670.c +++ b/src/RBB/code_9670.c @@ -26,7 +26,7 @@ void RBB_func_8038FA60(ActorMarker *marker){ void func_8038FA9C(Actor *this, s32 arg1){ if(arg1 == 3){ func_80324E38(0.0f, 3); - timedFunc_set_2(1.0f, (GenFunction_2)func_8025A6EC, COMUSIC_2B_DING_B, 28000); + timedFunc_set_2(1.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2B_DING_B, 28000); timed_setStaticCameraToNode(1.8f, 1); timedFunc_set_1(2.0f, (GenFunction_1) RBB_func_8038FA60, (s32)this->marker); timed_exitStaticCamera(5.0f); diff --git a/src/RBB/code_CA0.c b/src/RBB/code_CA0.c index 23d47471..02bf061d 100644 --- a/src/RBB/code_CA0.c +++ b/src/RBB/code_CA0.c @@ -150,7 +150,7 @@ void func_8038756C(Actor *this, s32 arg1){ func_8034DDF0(temp_v0, sp50, sp44, 0.1f, 1); timedFunc_set_2(0.1f, (GenFunction_2)func_8038711C, 0x19d, 0x1f4); - timedFunc_set_2(0.1f, (GenFunction_2)func_8025A6EC, COMUSIC_2B_DING_B, 28000); + timedFunc_set_2(0.1f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2B_DING_B, 28000); func_80324E38(0.2f, 3); timedFunc_set_1(1.1f, (GenFunction_1)func_8038718C, (s32)this->marker); }//L80387704 diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index ae90094b..a21f11f7 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -33,8 +33,8 @@ static void __chAttackTutorial_spawnEnemyActorForMarker(ActorMarker* marker, enu s32 pad; Actor *other = spawn_child_actor(enemy_id, &actor); - actor->unk100 = other->marker; - other->unk100 = actor->marker; + actor->partnerActor = other->marker; + other->partnerActor = actor->marker; if (actor->unk10_12 == 3 && actor->unk38_31 == 1) { other->unk38_31 = 1; } else { @@ -89,10 +89,10 @@ static void __chAttackTutorial_setState(Actor* this, enum ch_attack_tutorial_sta case CH_ATTACK_TUTORIAL_STATE_5_SHOW_LEARN_MOVE_DIALOG: if (this->unk10_12 == 0) { ability_unlock(ABILITY_4_CLAW_SWIPE); - gcdialog_showText(ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnAbilityBasedOnDialog, __chAttackTutorial_advanceMarkToState2); + gcdialog_showDialog(ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnAbilityBasedOnDialog, __chAttackTutorial_advanceMarkToState2); } else{ - gcdialog_showText( + gcdialog_showDialog( (this->unk10_12 == VEGETABLE_1_TOPPER) ? ASSET_E15_DIALOG_ATTACK_TUTORIAL_FORWARD_ROLL : ASSET_E17_DIALOG_ATTACK_TUTORIAL_RATATAT_RAP, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnAbilityBasedOnDialog, NULL ); @@ -248,6 +248,6 @@ static void __chAttackTutorial_showDialogText(ActorMarker* marker) { timed_setStaticCameraToNode(0.0f, 6); } - gcdialog_showText(dialog_text, dialog_flag, actor->unk1C, actor->marker, __chAttackTutorial_handleDialog, NULL); + gcdialog_showDialog(dialog_text, dialog_flag, actor->unk1C, actor->marker, __chAttackTutorial_handleDialog, NULL); actor->unk38_31++; } diff --git a/src/SM/ch/jumptutorial.c b/src/SM/ch/jumptutorial.c index cd3f1b41..b7fcc258 100644 --- a/src/SM/ch/jumptutorial.c +++ b/src/SM/ch/jumptutorial.c @@ -56,7 +56,7 @@ void chJumpTutorial_setState(Actor *this, s32 state) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER); - gcdialog_showText(ASSET_DF6_DIALOG_BOTTLES_HIGH_JUMP_LEARN, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); + gcdialog_showDialog(ASSET_DF6_DIALOG_BOTTLES_HIGH_JUMP_LEARN, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); this->sm_4070.dialog_id = ASSET_E1A_DIALOG_BOTTLES_UNKNOWN; mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, FALSE); } @@ -107,12 +107,12 @@ void chJumpTutorial_update(Actor *this) { break; case JUMP_TUTORIAL_STATE_2_TEACHING://L8038A6C8 - if (!func_803114B0()) { + if (!gcdialog_hasCurrentTextId()) { if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED)) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_7_FEATHERY_FLAP); - gcdialog_showText(ASSET_DF7_DIALOG_BOTTLES_FEATHERY_FLAP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); + gcdialog_showDialog(ASSET_DF7_DIALOG_BOTTLES_FEATHERY_FLAP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); this->sm_4070.dialog_id = ASSET_E1B_DIALOG_BOTTLES_UNKNOWN; mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, FALSE); }//L8038A730 @@ -121,12 +121,12 @@ void chJumpTutorial_update(Actor *this) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_8_FLAP_FLIP); - gcdialog_showText(ASSET_DF8_DIALOG_BOTTLES_FLAP_FLIP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); + gcdialog_showDialog(ASSET_DF8_DIALOG_BOTTLES_FLAP_FLIP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); this->sm_4070.dialog_id = ASSET_E1C_DIALOG_BOTTLES_UNKNOWN; mapSpecificFlags_set(SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED, FALSE); }//L8038A794 - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_A)) { + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_A_ABILITY_FLIP_UNLOCKED)) { __chJumpTutorial_setStaticCameraToNode4(this); func_8028F94C(2, this->unk1C); @@ -138,8 +138,8 @@ void chJumpTutorial_update(Actor *this) { dialog_id = ASSET_DF9_DIALOG_BOTTLES_UNKNOWN; } - gcdialog_showText(dialog_id, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); - mapSpecificFlags_set(SM_SPECIFIC_FLAG_A, FALSE); + gcdialog_showDialog(dialog_id, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); + mapSpecificFlags_set(SM_SPECIFIC_FLAG_A_ABILITY_FLIP_UNLOCKED, FALSE); this->sm_4070.dialog_id = NULL; } }//L8038A828 @@ -151,7 +151,7 @@ void chJumpTutorial_update(Actor *this) { if (func_8028EFC8() && face_buttons[FACE_BUTTON(BUTTON_B)] == TRUE && func_8028F20C()) { if (this->sm_4070.dialog_id) { - gcdialog_showText(dialog_id = this->sm_4070.dialog_id, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(dialog_id = this->sm_4070.dialog_id, 0, NULL, NULL, NULL, NULL); } } break; diff --git a/src/SM/ch/smbottles.c b/src/SM/ch/smbottles.c index 788b4400..f772dcf2 100644 --- a/src/SM/ch/smbottles.c +++ b/src/SM/ch/smbottles.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + /* extern functions */ Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx **); void func_8028E668(f32 *, f32, f32, f32); @@ -83,15 +85,15 @@ bool __chSmBottles_isAnySpiralMountainAbilityLearned(void) { */ void __chSmBottles_setHasUsedSpiralMountainAbilities(void) { ability_unlock(ABILITY_3_CAMERA_CONTROL); - ability_setHasUsed(ABILITY_0_BARGE); - ability_setHasUsed(ABILITY_1_BEAK_BOMB); - ability_setHasUsed(ABILITY_2_BEAK_BUSTER); - ability_setHasUsed(ABILITY_3_CAMERA_CONTROL); - ability_setHasUsed(ABILITY_4_CLAW_SWIPE); - ability_setHasUsed(ABILITY_5_CLIMB); - ability_setHasUsed(ABILITY_B_RATATAT_RAP); - ability_setHasUsed(ABILITY_C_ROLL); - ability_setHasUsed(ABILITY_A_HOLD_A_JUMP_HIGHER); + ability_setHasUsed(ABILITY_USED_JUMP); + ability_setHasUsed(ABILITY_USED_FLAP); + ability_setHasUsed(ABILITY_USED_FLIP); + ability_setHasUsed(ABILITY_USED_SWIM); + ability_setHasUsed(ABILITY_USED_CLIMB); + ability_setHasUsed(ABILITY_USED_BEAK_BARGE); + ability_setHasUsed(ABILITY_USED_CLAW); + ability_setHasUsed(ABILITY_USED_TWIRL); + ability_setHasUsed(ABILITY_USED_PECK); } /** @@ -116,11 +118,11 @@ void __chSmBottles_skipIntroTutorial(void) { * camera that points to the lair. Otherwise, use the camera for the ability. */ void __chSmBottles_setStaticCameraToNode(Actor *this) { - if (this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) { + if (this->actorTypeSpecificField == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) { timed_setStaticCameraToNode(0.0f, 0x12); } else { //L80388F68 - timed_setStaticCameraToNode(0.0f, chSmBottlesDialogTable[this->unkF4_8 - 1].camera_node); + timed_setStaticCameraToNode(0.0f, chSmBottlesDialogTable[this->actorTypeSpecificField - 1].camera_node); } } @@ -150,7 +152,7 @@ void __chSmBottles_setState(Actor *this, s32 next_state) { switch (next_state) { case SM_BOTTLES_STATE_4_UNKNOWN: other = subaddie_getLinkedActor(this); - molehillMarker = this->unk100; + molehillMarker = this->partnerActor; if (molehillMarker && other && molehillMarker->id == 0xB8) { subaddie_set_state_with_direction(other, 3, 0.0001f, 1); @@ -160,7 +162,7 @@ void __chSmBottles_setState(Actor *this, s32 next_state) { this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, 0x3f9); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 0x6590); @@ -183,7 +185,7 @@ void __chSmBottles_setState(Actor *this, s32 next_state) { case SM_BOTTLES_STATE_2_UNKNOWN: other = subaddie_getLinkedActor(this); - molehillMarker = this->unk100; + molehillMarker = this->partnerActor; if (molehillMarker && other && molehillMarker->id == 0xB8) { subaddie_set_state_with_direction(other, 2, 0.0001f, 1); @@ -194,7 +196,7 @@ void __chSmBottles_setState(Actor *this, s32 next_state) { this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, 0x3f9); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 0x6590); @@ -241,7 +243,7 @@ void __chSmBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 a if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities()) { mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE); - gcdialog_showText(ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, __chSmBottles_textCallback, NULL); + gcdialog_showDialog(ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, __chSmBottles_textCallback, NULL); }//L8038933C else { if (!(text_id == ASSET_DF3_DIALOG_BOTTLES_INTRODUCTION || text_id == ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER || text_id == ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT)) { @@ -249,11 +251,11 @@ void __chSmBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 a } switch (text_id) { - case ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED: + case ASSET_D38_DIALOG_EMPTY: break; case ASSET_DF3_DIALOG_BOTTLES_INTRODUCTION: /* 2FB8 803893A8 3C188039 */ - gcdialog_showText(ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, __chSmBottles_textCallback, __chSmBottles_textActions); + gcdialog_showDialog(ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, __chSmBottles_textCallback, __chSmBottles_textActions); break; case ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */ @@ -277,7 +279,7 @@ void __chSmBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 a default: if (actor->state != SM_BOTTLES_STATE_5_UNKNOWN) { - gcdialog_showText(ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, 0x4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_D38_DIALOG_EMPTY, 0x4, NULL, NULL, NULL, NULL); } __chSmBottles_setState(actor, actor->state == SM_BOTTLES_STATE_5_UNKNOWN ? SM_BOTTLES_STATE_1_UNKNOWN : SM_BOTTLES_STATE_4_UNKNOWN); @@ -289,7 +291,7 @@ void __chSmBottles_textCallback(ActorMarker *marker, enum asset_e text_id, s32 a void __chSmBottles_getRefresherDialog(Actor *this, s32 *text_id, s32 *text_flags) { // Selects the learn and refresh dialogs. // Gives the player the ability if not learned. - if (ability_isUnlocked(chSmBottlesDialogTable[this->unkF4_8 - 1].ability)) { + if (ability_isUnlocked(chSmBottlesDialogTable[this->actorTypeSpecificField - 1].ability)) { if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) { *text_id = chSmBottlesDialogIndex + ASSET_E0A_DIALOG_BOTTLES_REFUSE_HELP_1; chSmBottlesDialogIndex++; @@ -301,16 +303,16 @@ void __chSmBottles_getRefresherDialog(Actor *this, s32 *text_id, s32 *text_flags } else {//L8038956C *text_flags |= 1; - *text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id; + *text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].refresher_text_id; - if (*text_id == ASSET_DFE_DIALOG_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)) { + if (*text_id == ASSET_DFE_DIALOG_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_USED_SWIM)) { *text_id = ASSET_DFD_DIALOG_BOTTLES_SWIM_LEARN; } } } else {//L803895C0 - *text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].teach_text_id; - ability_unlock(chSmBottlesDialogTable[this->unkF4_8 - 1].ability); + *text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].teach_text_id; + ability_unlock(chSmBottlesDialogTable[this->actorTypeSpecificField - 1].ability); } } @@ -321,7 +323,7 @@ void __chSmBottles_talk(Actor *this) { text_flags = 0xe; text_id = 0; - switch (this->unkF4_8) { + switch (this->actorTypeSpecificField) { case 1://L8038965C if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) { text_flags |= 1; @@ -332,11 +334,11 @@ void __chSmBottles_talk(Actor *this) { chSmBottlesDialogIndex = MIN(chSmBottlesDialogIndex, 5); } else {//L803896C0 - text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id; + text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].refresher_text_id; } } else {//L803896E8 - text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].teach_text_id; + text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].teach_text_id; mapSpecificFlags_set(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES, TRUE); } break; @@ -361,11 +363,11 @@ void __chSmBottles_talk(Actor *this) { } else {//L803897C8 if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) { - text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id; + text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].refresher_text_id; text_flags |= 1; } else { - text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].teach_text_id; + text_id = chSmBottlesDialogTable[this->actorTypeSpecificField - 1].teach_text_id; mapSpecificFlags_set(SM_SPECIFIC_FLAG_2, TRUE); } } @@ -395,7 +397,7 @@ void __chSmBottles_talk(Actor *this) { }//L80389904 if (text_id) { - gcdialog_showText(text_id, text_flags, this->position, this->marker, __chSmBottles_textCallback, __chSmBottles_textActions); + gcdialog_showDialog(text_id, text_flags, this->position, this->marker, __chSmBottles_textCallback, __chSmBottles_textActions); } } @@ -409,7 +411,7 @@ void __chSmBottles_spawnMolehill(ActorMarker *marker) { this = marker_getActor(marker); molehill = spawn_child_actor(ACTOR_12C_MOLEHILL, &this); - this->unk100 = molehill->marker; + this->partnerActor = molehill->marker; if (marker); } @@ -431,7 +433,7 @@ void chSmBottles_update(Actor *this) { // Checks the actor's selector value is lower than 0x9 // Anything higher is a non-Spiral Mountain ability, and should use a different actor id - if (this->unkF4_8 >= 9) { + if (this->actorTypeSpecificField >= 9) { return; } @@ -441,7 +443,7 @@ void chSmBottles_update(Actor *this) { this->initialized = TRUE; marker_setFreeMethod(this->marker, __chSmBottles_free); - if (this->unkF4_8 == 1 || this->unkF4_8 == 8) {//L80389A30 + if (this->actorTypeSpecificField == 1 || this->actorTypeSpecificField == 8) {//L80389A30 sp40 = nodeprop_findByActorIdAndActorPosition(ACTOR_349_UNKNOWN, this); if (!sp40) { @@ -455,7 +457,7 @@ void chSmBottles_update(Actor *this) { this->actor_specific_1_f = nodeprop_getRadius(sp40); }//L80389A8C - if (this->unkF4_8 == 1) { + if (this->actorTypeSpecificField == 1) { if (volatileFlag_get(VOLATILE_FLAG_1) || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) { __chSmBottles_setState(this, SM_BOTTLES_STATE_3_UNKNOWN); } @@ -491,14 +493,14 @@ void chSmBottles_update(Actor *this) { this->yaw_ideal = (f32) func_80329784(this); func_80328FB0(this, 4.0f); - if ((this->unkF4_8 == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) || - (this->unkF4_8 == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) || - (this->unkF4_8 == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)) + if ((this->actorTypeSpecificField == 1 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) || + (this->actorTypeSpecificField == 8 && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2)) || + (this->actorTypeSpecificField == 8 && mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)) ) {//L80389C50 if (((ml_vec3f_distance(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) || mapSpecificFlags_get(SM_SPECIFIC_FLAG_10) ) {//L80389C8C - if (func_80329530(this, 0x96)) { + if (subaddie_playerIsWithinSphereAndActive(this, 0x96)) { func_8028F45C(9, this->position); } @@ -507,20 +509,20 @@ void chSmBottles_update(Actor *this) { } } else {//L80389CBC - if (!func_80329530(this, 0xfa) || player_movementGroup() || !func_8028F20C() || func_8028EC04()) { + if (!subaddie_playerIsWithinSphereAndActive(this, 0xfa) || player_movementGroup() || !func_8028F20C() || func_8028EC04()) { break; } - sp34 = (chSmBottlesDialogTable[this->unkF4_8 - 1].ability + 1) && ability_isUnlocked(chSmBottlesDialogTable[this->unkF4_8 - 1].ability); + sp34 = (chSmBottlesDialogTable[this->actorTypeSpecificField - 1].ability + 1) && ability_isUnlocked(chSmBottlesDialogTable[this->actorTypeSpecificField - 1].ability); - if (!sp34 && this->unkF4_8 != 1 || fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) == 0 || chSmBottlesDialogIndex < 6) { - if (this->unkF4_8 != 8 || !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)) { + if (!sp34 && this->actorTypeSpecificField != 1 || fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL) == 0 || chSmBottlesDialogIndex < 6) { + if (this->actorTypeSpecificField != 8 || !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)) { if (func_8028EFC8() && face_buttons[FACE_BUTTON(BUTTON_B)] == 1) { - if (sp34 || this->unkF4_8 == 1 || this->unkF4_8 == 8) { + if (sp34 || this->actorTypeSpecificField == 1 || this->actorTypeSpecificField == 8) { __chSmBottles_setState(this, SM_BOTTLES_STATE_5_UNKNOWN); } else { - if (func_80329530(this, 0x96) && !sp34) { + if (subaddie_playerIsWithinSphereAndActive(this, 0x96) && !sp34) { func_8028F45C(9, this->position); } @@ -537,7 +539,7 @@ void chSmBottles_update(Actor *this) { func_80328FB0(this, 4.0f); if (0.0 < anctrl_getAnimTimer(this->anctrl) && anctrl_getAnimTimer(this->anctrl) < 0.16) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); }//L80389EA0 if (actor_animationIsAt(this, 0.9999f)) { @@ -548,13 +550,13 @@ void chSmBottles_update(Actor *this) { __chSmBottles_setState(this, SM_BOTTLES_STATE_3_UNKNOWN); }//L80389EE0 else if (actor_animationIsAt(this, 0.14f)) { - FUNC_8030E8B4(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500); } else if (actor_animationIsAt(this, 0.4f)) { //L80389F14 - FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500); } else if (actor_animationIsAt(this, 0.75f)) {//L80389F48 - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); } else if (actor_animationIsAt(this, 0.35f)) {//L80389F78 if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES)) { @@ -599,7 +601,7 @@ void chSmBottles_update(Actor *this) { if (this->unk38_0) { this->lifetime_value += time_getDelta(); - if (func_803114C4() != 0xe1d) { + if (gcdialog_getCurrentTextId() != 0xe1d) { if (face_buttons[FACE_BUTTON(BUTTON_A)] == TRUE) { bakey_pressed = 1; } @@ -610,7 +612,7 @@ void chSmBottles_update(Actor *this) { if (bakey_pressed != -1) { fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, bakey_pressed ? 0 : 1); - gcdialog_showText(bakey_pressed ? ASSET_E07_DIALOG_BOTTLES_UNKNOWN : ASSET_E09_DIALOG_BOTTLES_SKIPPED_TUTORIAL, 0xe, this->position, this->marker, __chSmBottles_textCallback,__chSmBottles_textActions); + gcdialog_showDialog(bakey_pressed ? ASSET_E07_DIALOG_BOTTLES_UNKNOWN : ASSET_E09_DIALOG_BOTTLES_SKIPPED_TUTORIAL, 0xe, this->position, this->marker, __chSmBottles_textCallback,__chSmBottles_textActions); if (!bakey_pressed) { __chSmBottles_skipIntroTutorial(); @@ -619,7 +621,7 @@ void chSmBottles_update(Actor *this) { this->unk38_0 = FALSE; } else if (!this->has_met_before && 5.0 < this->lifetime_value) { - gcdialog_showText(ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT, 0x86, this->position, this->marker, __chSmBottles_textCallback, NULL); + gcdialog_showDialog(ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT, 0x86, this->position, this->marker, __chSmBottles_textCallback, NULL); this->has_met_before = TRUE; } } @@ -627,7 +629,7 @@ void chSmBottles_update(Actor *this) { case SM_BOTTLES_STATE_4_UNKNOWN: //L8038A31C if (0.35 < anctrl_getAnimTimer(this->anctrl) && anctrl_getAnimTimer(this->anctrl) < 0.9) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } else if (actor_animationIsAt(this, 0.9999f)) { //L8038A378 __chSmBottles_setState(this, SM_BOTTLES_STATE_1_UNKNOWN); diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index 4e826891..47bbad7c 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -202,7 +202,7 @@ static void __chVegetables_vegetableDeathParticles(Actor* this) { sChVegetable* local = (sChVegetable*)&this->local; f32 particles_position[3]; - FUNC_8030E8B4(SFX_111_WHIPCRACK_DEATH, 1.0f, 32000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_111_WHIPCRACK_DEATH, 1.0f, 32000, this->position, 1000, 2000); if (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) { particles_position[0] = this->position_x; particles_position[1] = this->position_y; @@ -379,7 +379,7 @@ static void __chVegetables_update(Actor* this) { if (!this->unk138_23) { if (0.0f < this->position_y) { - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000); this->unk138_23 = 1; this->scale = 1.0f; } @@ -490,10 +490,10 @@ static void __chVegetables_update(Actor* this) { func_80328FB0(this, 2.0f); if (local->vegetable_type != CH_VEGETABLE_3_COLLIWOBBLE && actor_animationIsAt(this, 0.3f)) - FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000); if (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE && actor_animationIsAt(this, 0.4f)) - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000); break; case CH_VEGETABLES_STATE_3_UNKNOWN: diff --git a/src/SM/code_3FC0.c b/src/SM/code_3FC0.c index a5b50b87..1bd2a593 100644 --- a/src/SM/code_3FC0.c +++ b/src/SM/code_3FC0.c @@ -3,7 +3,7 @@ #include "variables.h" -extern f32 D_80365E04[3][3]; +extern f32 INITIAL_CAMERA_TARGETS[3][3]; void func_8038A3B0(Actor *this); @@ -53,7 +53,7 @@ void func_8038A3B0(Actor *this){ s32 sp24 = this->marker->id - 0xe1; if(this->marker->unk14_21) - func_8034A174(this->marker->unk44, 0x1f, D_80365E04[sp24]); + func_8034A174(this->marker->unk44, 0x1f, INITIAL_CAMERA_TARGETS[sp24]); actor_collisionOff(this); if(this->state == 2 && levelSpecificFlags_get(sp24 + 0x35)){ diff --git a/src/SM/code_44D0.c b/src/SM/code_44D0.c index 49626ea0..6fe5d6b3 100644 --- a/src/SM/code_44D0.c +++ b/src/SM/code_44D0.c @@ -4,7 +4,7 @@ f32 func_8028E82C(void); -void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); +void player_walkToPosition(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); // prototypes void func_8038A8F8(Actor *this); @@ -42,15 +42,15 @@ void func_8038A8F8(Actor *this){ }//L8038A968 player_getPosition(this->velocity); sp2C = ml_vec3f_distance(this->velocity, this->position); - if(sp2C < (f32) this->unkF4_8) + if(sp2C < (f32) this->actorTypeSpecificField) func_80388D48(); - if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_10) && sp2C < (f32) this->unkF4_8 && 1780.0f < func_8028E82C()){ + if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_10) && sp2C < (f32) this->actorTypeSpecificField && 1780.0f < func_8028E82C()){ if( !mapSpecificFlags_get(SM_SPECIFIC_FLAG_2) || (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && !mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)) ){ //L8038AA54 this->yaw_ideal = ml_vec3f_distance(this->velocity, this->unk1C) / 150.0; - func_8028F3D8(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker); + player_walkToPosition(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker); mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, TRUE); } } diff --git a/src/SM/code_5B0.c b/src/SM/code_5B0.c index b9342e32..f076baad 100644 --- a/src/SM/code_5B0.c +++ b/src/SM/code_5B0.c @@ -100,18 +100,18 @@ void func_80386C2C(ParticleEmitter *p_ctrl, f32 *arg1, s32 arg2, f32 arg3) { } void SM_func_80386D68(Actor *this){ - FUNC_8030E8B4(SFX_9B_BOULDER_BREAKING_1, 1.0f, 32000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_9B_BOULDER_BREAKING_1, 1.0f, 32000, this->position, 1000, 2000); this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, 0x3F9); - func_8030DD14(this->unk44_31, 3); + sfxSource_setunk43_7ByIndex(this->unk44_31, 3); sfxsource_setSampleRate(this->unk44_31, 32000); sfxsource_playSfxAtVolume(this->unk44_31, (0.01 < (2.0 - this->scale))? (2.0 - this->scale): 0.01); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); func_80386B04(partEmitMgr_newEmitter(0xA), this->position, 0xA, this->scale); func_80386C2C(partEmitMgr_newEmitter(0x10), this->position, 0x10, this->scale); - if (this->unk100 && codeBF0_shouldSpawnQuarrieHoneyComb(this->unk100)) { + if (this->partnerActor && codeBF0_shouldSpawnQuarrieHoneyComb(this->partnerActor)) { 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])); } @@ -142,9 +142,9 @@ void SM_func_80386EF4(Actor *this) { if ((temp_t3) == 0) { other = actorArray_findActorFromActorId(0x16E); if (other != NULL) { - this->unk100 = other->marker; + this->partnerActor = other->marker; } else { - this->unk100 = NULL; + this->partnerActor = NULL; } subaddie_set_state(this, 2); } diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index 3bc6c00b..57edfb1a 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -90,7 +90,7 @@ static void __chBlubber_showJiggySpawnedText(ActorMarker *marker){ if(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN)) { text_id = jiggyscore_isCollected(JIGGY_14_TTC_BLUBBER) ? ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED : ASSET_A0D_DIALOG_BLUBBER_COMPLETE; - gcdialog_showText(text_id, 0xf, this->position, this->marker, __chBlubber_showTextCallback, __chBlubber_showTextCallback2); + gcdialog_showDialog(text_id, 0xf, this->position, this->marker, __chBlubber_showTextCallback, __chBlubber_showTextCallback2); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN, TRUE); } } @@ -120,7 +120,7 @@ static void __func_80387774(Actor **this_ptr){ ActorLocal_Blubber *local = (ActorLocal_Blubber *)&(*this_ptr)->local; player_setCarryObjectPoseInCylinder(local->throw_target_position, local->throw_target_radius, 100.0f, ACTOR_2A_GOLD_BULLION, this_ptr); - if( func_80329530(*this_ptr, 200) + if( subaddie_playerIsWithinSphereAndActive(*this_ptr, 200) && bacarry_get_markerId() == MARKER_37_GOLD_BULLION && player_throwCarriedObject() ) { @@ -143,7 +143,7 @@ static void __chBlubber_updateFunc(Actor *this){ this->marker->propPtr->unk8_3 = TRUE; func_8028E668(this->position, 90.0f, -10.0f, 110.0f); - if(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_1_UNKNOWN) && !func_80329530(this, 2500)) + if(!mapSpecificFlags_get(TTC_SPECIFIC_FLAG_1_UNKNOWN) && !subaddie_playerIsWithinSphereAndActive(this, 2500)) return; if(!this->volatile_initialized){ @@ -153,11 +153,11 @@ static void __chBlubber_updateFunc(Actor *this){ this->volatile_initialized = TRUE; }//L80387970 - if(func_80329530(this, 250) && !func_80329530(this, 80) + if(subaddie_playerIsWithinSphereAndActive(this, 250) && !subaddie_playerIsWithinSphereAndActive(this, 80) && !this->has_met_before && item_getCount(ITEM_18_GOLD_BULLIONS) == 0 ){ - gcdialog_showText(ASSET_A0B_DIALOG_BLUBBER_FIRST_MEET, 0xe, this->position, this->marker, __chBlubber_showTextCallback, NULL); + gcdialog_showDialog(ASSET_A0B_DIALOG_BLUBBER_FIRST_MEET, 0xe, this->position, this->marker, __chBlubber_showTextCallback, NULL); this->has_met_before = TRUE; subaddie_set_state_forward(this, CH_BLUBBER_STATE_3_UNKNOWN); } @@ -166,7 +166,7 @@ static void __chBlubber_updateFunc(Actor *this){ && !this->unk138_23 ){ if (item_getCount(ITEM_18_GOLD_BULLIONS) == 0) { - gcdialog_showText(ASSET_A0C_DIALOG_BLUBBER_HALF_GOLD, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A0C_DIALOG_BLUBBER_HALF_GOLD, 4, NULL, NULL, NULL, NULL); } this->unk138_23 = TRUE; @@ -200,15 +200,15 @@ static void __chBlubber_updateFunc(Actor *this){ } if(actor_animationIsAt(this, 0.3f)){ - FUNC_8030E8B4(SFX_83_BLUBBER_CRYING, 0.95f, 17000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_83_BLUBBER_CRYING, 0.95f, 17000, this->position, 1250, 2500); } if(actor_animationIsAt(this, 0.53f)){ - FUNC_8030E8B4(SFX_83_BLUBBER_CRYING, 0.93f, 17000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_83_BLUBBER_CRYING, 0.93f, 17000, this->position, 1250, 2500); } if(actor_animationIsAt(this, 0.72f)){ - FUNC_8030E8B4(SFX_83_BLUBBER_CRYING, 0.91f, 17000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_83_BLUBBER_CRYING, 0.91f, 17000, this->position, 1250, 2500); } __chBlubber_checkJiggySpawnedTextAndAdvanceState(this); @@ -227,12 +227,12 @@ static void __chBlubber_updateFunc(Actor *this){ } } - if(actor_animationIsAt(this, 0.3f) && !func_803114B0()){ + if(actor_animationIsAt(this, 0.3f) && !gcdialog_hasCurrentTextId()){ FUNC_8030E624(SFX_8C_BOGGY_WAHEY, 1.0f, 27000); } if(actor_animationIsAt(this, 0.28f) || - (actor_animationIsAt(this, 0.78f) && !func_803114B0()) + (actor_animationIsAt(this, 0.78f) && !gcdialog_hasCurrentTextId()) ){ FUNC_8030E624(SFX_80_YUMYUM_CLACK, 0.9f, 13000); } diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index 5a129da7..ee73e315 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -24,7 +24,7 @@ ActorInfo gChClam = { /* .code */ static void __chClam_playSfx(enum sfx_e sfx_id, f32 volume, s32 sampleRate, f32 position[3], f32 minFadeDistance, f32 maxFadeDistance){ - if(func_803114B0()){ + if(gcdialog_hasCurrentTextId()){ sampleRate -= 10000; if(sampleRate < 0) sampleRate = 0; @@ -69,7 +69,7 @@ static bool __chClam_updateFuncTarget(Actor *this, f32 arg1) { TUPLE_COPY(target_position, red_feather->position) phi_f2 = egg_dist; } - else if ((func_80329530(this, 1200) != 0) && (func_803292E0(this) != 0)) { + else if ((subaddie_playerIsWithinSphereAndActive(this, 1200) != 0) && (func_803292E0(this) != 0)) { phi_f2 = gu_sqrtf((f32) func_8032970C(this)); player_getPosition(target_position); sp38 = 1; @@ -135,7 +135,7 @@ static void __chClam_particalEmitterInit(ParticleEmitter *pCtrl, f32 position[3] particleEmitter_setPosition(pCtrl, position); particleEmitter_func_802EF9F8(pCtrl, 0.7f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 0.8f, 1.0f); + particleEmitter_func_802EFA20(pCtrl, 0.8f, 1.0f); particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 10000); particleEmitter_setSpawnIntervalRange(pCtrl, 0.0f, 0.01f); particleEmitter_setParticleLifeTimeRange(pCtrl, 3.5f, 3.5f); @@ -242,9 +242,9 @@ static void __chClam_playerDropsItem(enum bundle_e bundle_id, enum item_e item_i static void __chClam_attackOther(ActorMarker *this_marker, ActorMarker *other_marker){ - if(func_80297C6C() == 3) return; + if(bsiFrame_getState() == 3) return; - if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN) && gcdialog_showText(ASSET_A14_DIALOG_CLAM_TAUNT, 0, NULL, NULL, NULL, NULL)){ + if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN) && gcdialog_showDialog(ASSET_A14_DIALOG_CLAM_TAUNT, 0, NULL, NULL, NULL, NULL)){ mapSpecificFlags_set(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN, TRUE); } diff --git a/src/TTC/ch/leaky.c b/src/TTC/ch/leaky.c index 9575da04..c8617ae0 100644 --- a/src/TTC/ch/leaky.c +++ b/src/TTC/ch/leaky.c @@ -58,14 +58,14 @@ static void __chLeaky_updateFunc(Actor *this) { if( this->state == 1 && !this->has_met_before - && func_80329530(this, 250) && !func_80329530(this, 160) + && subaddie_playerIsWithinSphereAndActive(this, 250) && !subaddie_playerIsWithinSphereAndActive(this, 160) && !player_movementGroup() - && gcdialog_showText(ASSET_A1A_DIALOG_LEAKY_FIRST_MEET, 0, NULL, NULL, NULL, NULL) + && gcdialog_showDialog(ASSET_A1A_DIALOG_LEAKY_FIRST_MEET, 0, NULL, NULL, NULL, NULL) ){ this->has_met_before = TRUE; } - if (func_803114B0() == 0) { + if (gcdialog_hasCurrentTextId() == 0) { if (actor_animationIsAt(this, 0.83f)) { func_8030E878(SFX_109_LOGGO_LID_CLAP, randf2(0.775f, 0.825f), 22000, this->position, 400.0f, 1000.0f); return; @@ -98,7 +98,7 @@ static void __chLeaky_showDoneText(ActorMarker *caller, enum asset_e text_id, s3 timedFunc_set_0(1.0f, __func_80388F88); func_80324E38(2.5f, 0); timedFunc_set_1(2.5f, func_8028F9DC, 2); - timedFunc_set_3(2.5f, (GenFunction_3)func_802E4078, MAP_A_TTC_SANDCASTLE, 0, 0); + timedFunc_set_3(2.5f, (GenFunction_3)transitionToMap, MAP_A_TTC_SANDCASTLE, 0, 0); func_803228D8(); } @@ -118,6 +118,6 @@ bool chLeaky_eggCollision(ActorMarker *marker){ levelSpecificFlags_set(2, TRUE); levelSpecificFlags_set(5, TRUE); - gcdialog_showText(ASSET_A28_DIALOG_LEAKY_DONE, 0x2a, this->position, this->marker, __chLeaky_showDoneText, NULL); + gcdialog_showDialog(ASSET_A28_DIALOG_LEAKY_DONE, 0x2a, this->position, this->marker, __chLeaky_showDoneText, NULL); return TRUE; } diff --git a/src/TTC/ch/lockup.c b/src/TTC/ch/lockup.c index 61084389..43df53b6 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -2,158 +2,150 @@ #include "functions.h" #include "variables.h" -extern void func_802EE6CC(f32[3], s32[4], s32[4], s32, f32, f32, s32, s32, s32); +#include "core2/dustemitter.h" -typedef struct { - s32 closed_ticks_counter; - s32 open_ticks_counter; -} ActorLocal_Lockup; +#include "lockup.h" -static Actor *__chLockup_drawFunc(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx); -static void __chLockup_updateFunc(Actor *this); - -enum ch_lockup_states_e { - CH_LOCKUP_STATE_CLOSED = 1, // L803896F0 - CH_LOCKUP_STATE_OPENING = 2, // L803897DC - CH_LOCKUP_STATE_OPEN = 3, // L80389864 - CH_LOCKUP_STATE_CLOSING = 4, // L803898F4 - CH_LOCKUP_STATE_CLOSING2 = 5 // L803898F4 +ActorAnimationInfo chLockupAnimations[6] = { + { NULL, NULL }, + { ASSET_BC_ANIM_LOCKUP, 8000000.0f }, + { ASSET_BC_ANIM_LOCKUP, 4.0f }, + { ASSET_BC_ANIM_LOCKUP, 8000000.0f }, + { ASSET_BC_ANIM_LOCKUP, 1.4f }, + { ASSET_BC_ANIM_LOCKUP, 8000000.0f } }; -/* .data */ -ActorAnimationInfo gChLockupAnimations[6] ={ - {NULL, NULL}, - {ASSET_BC_ANIM_LOCKUP, 8000000.0f}, - {ASSET_BC_ANIM_LOCKUP, 4.0f}, - {ASSET_BC_ANIM_LOCKUP, 8000000.0f}, - {ASSET_BC_ANIM_LOCKUP, 1.4f}, - {ASSET_BC_ANIM_LOCKUP, 8000000.0f} -}; - -ActorInfo gChLockupSlow = { +ActorInfo chLockupSlow = { MARKER_A4_LOCKUP_SLOW, ACTOR_151_LOCKUP_SLOW, ASSET_3D4_MODEL_LOCKUP, - 1, gChLockupAnimations, - __chLockup_updateFunc, actor_update_func_80326224, __chLockup_drawFunc, + 1, chLockupAnimations, + chLockup_update, actor_update_func_80326224, chLockup_draw, 2500, 0x366, 0.0f, 0 }; -ActorInfo gChLockupMedium = { +ActorInfo chLockupMedium = { MARKER_F6_LOCKUP_MEDIUM, ACTOR_152_LOCKUP_MEDIUM, ASSET_3D4_MODEL_LOCKUP, - 1, gChLockupAnimations, - __chLockup_updateFunc, actor_update_func_80326224, __chLockup_drawFunc, + 1, chLockupAnimations, + chLockup_update, actor_update_func_80326224, chLockup_draw, 2500, 0x366, 0.0f, 0 }; -ActorInfo gChLockupFast = { +ActorInfo chLockupFast = { MARKER_F7_LOCKUP_FAST, ACTOR_153_LOCKUP_FAST, ASSET_3D4_MODEL_LOCKUP, - 1, gChLockupAnimations, - __chLockup_updateFunc, actor_update_func_80326224, __chLockup_drawFunc, + 1, chLockupAnimations, + chLockup_update, actor_update_func_80326224, chLockup_draw, 2500, 0x366, 0.0f, 0 }; -static s32 sLockup_CloseColor[4] = {120, 120, 120, 120}; -static s32 sLockup_CloseVelocity[3] = {0,0,0}; +static s32 SMOKE_COLOR[4] = { 120, 120, 120, 120 }; +static s32 SMOKE_VELOCITY[3] = { 0, 0, 0 }; -/* .code */ -static Actor *__chLockup_drawFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ - Actor * actor = marker_getActor(marker); +static Actor *chLockup_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { + Actor *actor = marker_getActor(marker); func_8033A45C(3, actor->unk38_31); func_8033A45C(4, actor->unk38_31); actor_draw(marker, gfx, mtx, vtx); } -static void __chLockup_close(Actor *this){ +static void close(Actor *this) { subaddie_set_state_with_direction(this, CH_LOCKUP_STATE_CLOSED, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; - FUNC_8030E8B4(SFX_6C_LOCKUP_CLOSING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_6C_LOCKUP_CLOSING, 1.0f, 32000, this->position, 1250, 2500); } -static void __chLockup_open(Actor *this){ +static void open(Actor *this) { code3040_func_80389468(); subaddie_set_state_with_direction(this, CH_LOCKUP_STATE_OPENING, 0.2f, 1); this->unk38_31 = 1; - FUNC_8030E8B4(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_6B_LOCKUP_OPENING, 1.0f, 32000, this->position, 1250, 2500); } -static void __chLockup_updateFunc(Actor *this){ +static void chLockup_update(Actor *this) { ActorLocal_Lockup *local = (ActorLocal_Lockup *)&this->local; - s32 tmp_v1; + s32 cycle_ticks; int i; - if( !this->has_met_before - && this->unkF4_8 == 0xA + // Display "this be Grunty's gold" when getting close for the first time + if (!this->has_met_before + && this->actorTypeSpecificField == LOCKUP_WITH_JIGGY_ID && !jiggyscore_isCollected(JIGGY_13_TTC_LOCKUP) - && func_80329530(this, 320) - && !func_80329530(this, 160) + && subaddie_playerIsWithinSphereAndActive(this, 320) + && !subaddie_playerIsWithinSphereAndActive(this, 160) && !player_movementGroup() - && gcdialog_showText(ASSET_A15_DIALOG_TTC_LOCKUP_SPAWNED, 0, NULL, NULL, NULL, NULL) - ){ + && gcdialog_showDialog(ASSET_A15_DIALOG_TTC_LOCKUP_SPAWNED, 0, NULL, NULL, NULL, NULL)) { + this->has_met_before = TRUE; } - if(!this->volatile_initialized){ + if (!this->volatile_initialized) { this->volatile_initialized = TRUE; } - switch(this->state){ + switch (this->state) { case CH_LOCKUP_STATE_CLOSED: - if(!this->initialized){ + if (!this->initialized) { this->marker->propPtr->unk8_3 = TRUE; subaddie_set_state_with_direction(this, CH_LOCKUP_STATE_CLOSED, 0.2f, 1); this->marker->collidable = FALSE; this->unk38_31 = 0; this->initialized = TRUE; } - local->closed_ticks_counter++; - tmp_v1 = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? 0x1E : - (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? 0x14 : - (this->modelCacheIndex == ACTOR_153_LOCKUP_FAST) ? 0xA : - 10000; - + local->closedTicksCounter++; - if(!(local->closed_ticks_counter < tmp_v1)){ - local->closed_ticks_counter = 0; - __chLockup_open(this); + cycle_ticks = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? LOCKUP_CYCLE_TICKS_SLOW : + (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? LOCKUP_CYCLE_TICKS_MEDIUM : + (this->modelCacheIndex == ACTOR_153_LOCKUP_FAST) ? LOCKUP_CYCLE_TICKS_FAST : + LOCKUP_CYCLE_TICKS_DEFAULT; + + if (!(local->closedTicksCounter < cycle_ticks)) { + local->closedTicksCounter = 0; + open(this); } + break; case CH_LOCKUP_STATE_OPENING: - if(subaddie_playerIsWithinSphere(this, 400) && func_8028FB48(0x8000000)){ + if (subaddie_playerIsWithinSphere(this, 400) && func_8028FB48(0x8000000)) { func_8028F428(0xA, this->marker); } - if(actor_animationIsAt(this, 0.5f)){ + if (actor_animationIsAt(this, 0.5f)) { subaddie_set_state_with_direction(this, CH_LOCKUP_STATE_OPEN, 0.5f, 1); } - if(0.15 < anctrl_getAnimTimer(this->anctrl)){ + + if (0.15 < anctrl_getAnimTimer(this->anctrl)) { this->marker->collidable = TRUE; } + break; case CH_LOCKUP_STATE_OPEN: - local->open_ticks_counter++; - tmp_v1 = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? 0x1E : - (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? 0x14 : - (this->modelCacheIndex == ACTOR_153_LOCKUP_FAST) ? 0xA : - 10000; + local->openTicksCounter++; + cycle_ticks = (this->modelCacheIndex == ACTOR_151_LOCKUP_SLOW) ? LOCKUP_CYCLE_TICKS_SLOW : + (this->modelCacheIndex == ACTOR_152_LOCKUP_MEDIUM) ? LOCKUP_CYCLE_TICKS_MEDIUM : + (this->modelCacheIndex == ACTOR_153_LOCKUP_FAST) ? LOCKUP_CYCLE_TICKS_FAST : + LOCKUP_CYCLE_TICKS_DEFAULT; - if(!(local->open_ticks_counter < tmp_v1)){ - local->open_ticks_counter = 0; + if (!(local->openTicksCounter < cycle_ticks)) { + local->openTicksCounter = 0; subaddie_set_state_with_direction(this, CH_LOCKUP_STATE_CLOSING, 0.5f, 1); } + break; case CH_LOCKUP_STATE_CLOSING: case CH_LOCKUP_STATE_CLOSING2: - if(this->marker->unk14_21 && actor_animationIsAt(this, 0.99f)){ - __chLockup_close(this); - for(i = 5; i < 0xe; i++){ + if (this->marker->unk14_21 && actor_animationIsAt(this, 0.99f)) { + close(this); + + // Spawn smoke particles + for (i = 5; i < 0xE; i++) { func_8034A174(this->marker->unk44, i, this->unk1C); - func_802EE6CC(this->unk1C, sLockup_CloseVelocity, sLockup_CloseColor, 1, 0.4f, 50.0f, 0xb4, 0xa0, 0); + dustEmitter_emit(this->unk1C, SMOKE_VELOCITY, SMOKE_COLOR, TRUE, 0.4f, 50.0f, 0xB4, 0xA0, DUST_EMITTER_TYPE_DUST); } } + break; } } diff --git a/src/TTC/ch/lockup.h b/src/TTC/ch/lockup.h new file mode 100644 index 00000000..6fa175bb --- /dev/null +++ b/src/TTC/ch/lockup.h @@ -0,0 +1,22 @@ +#define LOCKUP_WITH_JIGGY_ID 0xA + +#define LOCKUP_CYCLE_TICKS_SLOW 0x1E +#define LOCKUP_CYCLE_TICKS_MEDIUM 0x14 +#define LOCKUP_CYCLE_TICKS_FAST 0xA +#define LOCKUP_CYCLE_TICKS_DEFAULT 10000 + +typedef struct { + s32 closedTicksCounter; + s32 openTicksCounter; +} ActorLocal_Lockup; + +static Actor *chLockup_draw(ActorMarker *this, Gfx **gfx, Mtx **mtx, Vtx **vtx); +static void chLockup_update(Actor *this); + +enum ch_lockup_states_e { + CH_LOCKUP_STATE_CLOSED = 1, + CH_LOCKUP_STATE_OPENING = 2, + CH_LOCKUP_STATE_OPEN = 3, + CH_LOCKUP_STATE_CLOSING = 4, + CH_LOCKUP_STATE_CLOSING2 = 5 +}; diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index 24effc9d..fa207308 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -104,7 +104,7 @@ static void __chNipper_playDeathAnimation(Actor *this) { subaddie_set_state_with_direction(this, CH_NIPPER_STATE_4_DIEING, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i ++){ - FUNC_8030E8B4(SFX_79_TICKER_DEATH, 0.5f, 17000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_79_TICKER_DEATH, 0.5f, 17000, this->position, 1500, 3000); }; } @@ -125,7 +125,7 @@ static bool __func_80388088(Actor *this){ } static bool __chNipper_shouldShowActor(Actor *this){ - return BOOL(func_80329530(this, 1300) && __func_80388088(this)); + return BOOL(subaddie_playerIsWithinSphereAndActive(this, 1300) && __func_80388088(this)); } static void __chNipper_dieFunc(ActorMarker *this_marker, ActorMarker *other_marker) { @@ -139,12 +139,12 @@ static void __chNipper_dieFunc(ActorMarker *this_marker, ActorMarker *other_mark subaddie_set_state_with_direction(this, CH_NIPPER_STATE_6_DEAD, 0.01f, 1); actor_playAnimationOnce(this); for(i = 0; i < 3; i++){ - FUNC_8030E8B4(SFX_78_EAGLECRY, 0.7f, 20000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_78_EAGLECRY, 0.7f, 20000, this->position, 1500, 3000); }; comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300); func_8025AABC(COMUSIC_12_TTC_NIPPER); func_8032BB88(this, -1, 300); - func_802BAFE4(0x1C); + gcStaticCamera_activate(0x1C); return; } @@ -156,7 +156,7 @@ static void __chNipper_dieFunc(ActorMarker *this_marker, ActorMarker *other_mark __chNipper_playDeathAnimation(this); this->lifetime_value = 80.0f; - gcdialog_showText(ASSET_A10_DIALOG_TTC_NIPPER_HURT, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A10_DIALOG_TTC_NIPPER_HURT, 4, NULL, NULL, NULL, NULL); return; } @@ -177,7 +177,7 @@ static void __chNipper_ow2Func(ActorMarker * this_marker, ActorMarker *other_mar this = marker_getActor(this_marker); if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN) && this->has_met_before - && gcdialog_showText(0xa0f, 0, NULL, NULL, NULL, NULL) + && gcdialog_showDialog(0xa0f, 0, NULL, NULL, NULL, NULL) ){ mapSpecificFlags_set(TTC_SPECIFIC_FLAG_7_NIPPER_FIRST_MEET_TEXT_SHOWN, TRUE); } @@ -188,7 +188,7 @@ static void __chNipper_owFunc(ActorMarker * this_marker, ActorMarker *other_mark Actor *this = marker_getActor(this_marker); if( !this->unk138_23 && this->has_met_before - && gcdialog_showText(0xa11, 0, NULL, NULL, NULL, NULL) + && gcdialog_showDialog(0xa11, 0, NULL, NULL, NULL, NULL) ){ this->unk138_23 = TRUE; } @@ -243,7 +243,7 @@ static void __chNipper_updateFunc(Actor *this){ && player_movement_group != BSGROUP_A_FLYING ){ subaddie_set_state_with_direction(this, CH_NIPPER_STATE_5_SPAWNED, 0.01f, 1); - if(gcdialog_showText(ASSET_A0E_DIALOG_NIPPER_SPAWNED, 0xf, this->position, this->marker, __chNipper_spawnedShowTextCallback, NULL)){ + if(gcdialog_showDialog(ASSET_A0E_DIALOG_NIPPER_SPAWNED, 0xf, this->position, this->marker, __chNipper_spawnedShowTextCallback, NULL)){ this->has_met_before = TRUE; } comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 5000, 300); @@ -260,7 +260,7 @@ static void __chNipper_updateFunc(Actor *this){ || actor_animationIsAt(this, 0.6f) || actor_animationIsAt(this, 0.7f) ){ - FUNC_8030E8B4(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 0x5dc, 0xbb8); + sfx_playFadeShorthandDefault(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 0x5dc, 0xbb8); } break; @@ -301,7 +301,7 @@ static void __chNipper_updateFunc(Actor *this){ || actor_animationIsAt(this, 0.95f) ){ for(sp48 = 0; sp48 < 3; sp48++){ - FUNC_8030E8B4(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 1500, 3000); } } break; @@ -318,14 +318,14 @@ static void __chNipper_updateFunc(Actor *this){ || actor_animationIsAt(this, 0.6f) || actor_animationIsAt(this, 0.7f) ){ - FUNC_8030E8B4(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 0x5dc, 0xbb8); + sfx_playFadeShorthandDefault(SFX_3D_TICKER_WALKING, 0.75f, 12000, this->position, 0x5dc, 0xbb8); } break; case CH_NIPPER_STATE_6_DEAD: this->marker->collidable = FALSE; if(actor_animationIsAt(this, 0.6f)){ - FUNC_8030E8B4(SFX_7C_CHEBOOF, 0.9f, 20000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_7C_CHEBOOF, 0.9f, 20000, this->position, 1500, 3000); break; } diff --git a/src/TTC/ch/treasure.c b/src/TTC/ch/treasure.c index 79ba60dc..5eb5f2c8 100644 --- a/src/TTC/ch/treasure.c +++ b/src/TTC/ch/treasure.c @@ -48,7 +48,7 @@ static void __chTreasure_updateFunc(Actor *this){ if(!this->initialized){ this->initialized = TRUE; - if(this->unkF4_8 == 1 && !volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)){ + if(this->actorTypeSpecificField == 1 && !volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)){ marker_despawn(this->marker); return; } diff --git a/src/TTC/ch/treasurehunt.c b/src/TTC/ch/treasurehunt.c index d368406c..ecc7027d 100644 --- a/src/TTC/ch/treasurehunt.c +++ b/src/TTC/ch/treasurehunt.c @@ -12,7 +12,7 @@ typedef struct { static void __chTreasurehunt_updateFunc(Actor *this); static Actor *__chTreasurehunt_animFunc(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); -extern u32 CH_TREASUREHUNT_PUZZLE_CURRENT_STEP; +extern u32 chtreasureHunt_puzzleCurrentStep; /* .data */ static f32 sChTreasurehunt_stepPositions[6][3] = { @@ -79,11 +79,11 @@ static bool __chTreasurehunt_isActiveHitboxBeakBusterHitbox(void) { if (player_getActiveHitbox(0) == HITBOX_1_BEAK_BUSTER) { comusic_id = COMUSIC_2B_DING_B; music_volume = 28000; - if (CH_TREASUREHUNT_PUZZLE_CURRENT_STEP == 5) { + if (chtreasureHunt_puzzleCurrentStep == 5) { comusic_id = COMUSIC_2D_PUZZLE_SOLVED_FANFARE; music_volume = 0x7FFF; } - func_8025A6EC(comusic_id, music_volume); + coMusicPlayer_playMusic(comusic_id, music_volume); return TRUE; } return FALSE; @@ -93,10 +93,10 @@ static void __chTreasurehunt_spawnRedXForNextStep(void) { Actor *actor; ActorLocal_TreasureHunt *local; - actor = actor_spawnWithYaw_f32(ACTOR_55_RED_X, sChTreasurehunt_stepPositions[CH_TREASUREHUNT_PUZZLE_CURRENT_STEP], 0); + actor = actor_spawnWithYaw_f32(ACTOR_55_RED_X, sChTreasurehunt_stepPositions[chtreasureHunt_puzzleCurrentStep], 0); local = (ActorLocal_TreasureHunt *)&actor->local; - actor->yaw = sChTreasurehunt_StepRedXYaws[CH_TREASUREHUNT_PUZZLE_CURRENT_STEP]; - local->unk0 = CH_TREASUREHUNT_PUZZLE_CURRENT_STEP; + actor->yaw = sChTreasurehunt_StepRedXYaws[chtreasureHunt_puzzleCurrentStep]; + local->unk0 = chtreasureHunt_puzzleCurrentStep; actor->lifetime_value = 0.0f; actor->state = 0; } @@ -105,24 +105,24 @@ static void __chTreasurehunt_spawnActorForNextStep(void) { Actor *actor; ActorLocal_TreasureHunt *local; - actor = actor_spawnWithYaw_f32((sChTreasurehunt_StepActors - 1)[CH_TREASUREHUNT_PUZZLE_CURRENT_STEP], sChTreasurehunt_stepPositions[CH_TREASUREHUNT_PUZZLE_CURRENT_STEP - 1], 0); + actor = actor_spawnWithYaw_f32((sChTreasurehunt_StepActors - 1)[chtreasureHunt_puzzleCurrentStep], sChTreasurehunt_stepPositions[chtreasureHunt_puzzleCurrentStep - 1], 0); local = (ActorLocal_TreasureHunt *)&actor->local; - actor->yaw = sChTreasurehunt_StepYaws[CH_TREASUREHUNT_PUZZLE_CURRENT_STEP - 1]; - local->unk0 = CH_TREASUREHUNT_PUZZLE_CURRENT_STEP; + actor->yaw = sChTreasurehunt_StepYaws[chtreasureHunt_puzzleCurrentStep - 1]; + local->unk0 = chtreasureHunt_puzzleCurrentStep; actor->lifetime_value = 0.0f; actor->state = 0; } static void __chTreasurehunt_checkStepProgress(s32 currentStep){ - if(CH_TREASUREHUNT_PUZZLE_CURRENT_STEP == currentStep && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){ + if(chtreasureHunt_puzzleCurrentStep == currentStep && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){ if(currentStep == 0 && !jiggyscore_isCollected(JIGGY_11_TTC_RED_X)){ - gcdialog_showText(ASSET_A18_DIALOG_TREASUREHUNT_FOLLOW_CLUES, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A18_DIALOG_TREASUREHUNT_FOLLOW_CLUES, 4, NULL, NULL, NULL, NULL); } else if(currentStep == 4){ - gcdialog_showText(ASSET_A19_DIALOG_TREASUREHUNT_SECOND_STEP, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_A19_DIALOG_TREASUREHUNT_SECOND_STEP, 4, NULL, NULL, NULL, NULL); } - CH_TREASUREHUNT_PUZZLE_CURRENT_STEP++; + chtreasureHunt_puzzleCurrentStep++; __spawnQueue_add_0(__chTreasurehunt_spawnActorForNextStep); __spawnQueue_add_0(__chTreasurehunt_spawnRedXForNextStep); } @@ -152,7 +152,7 @@ void chTreasurehunt_checkStepProgress5(NodeProp *this, ActorMarker *arg1){ static ParticleEmitter *particleEmitter; static f32 particleTargetPosition[3]; - if(CH_TREASUREHUNT_PUZZLE_CURRENT_STEP == 5 && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){ + if(chtreasureHunt_puzzleCurrentStep == 5 && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){ particleTargetPosition[0] = (f32)this->x; particleTargetPosition[1] = (f32)this->y; particleTargetPosition[2] = (f32)this->z; @@ -170,13 +170,13 @@ void chTreasurehunt_checkStepProgress5(NodeProp *this, ActorMarker *arg1){ gcpausemenu_80314AC8(0); timedFunc_set_2(0.1f, (GenFunction_2) func_8028F45C, 9, (s32)&particleTargetPosition); timedFunc_set_1(0.1f, (GenFunction_1) gcpausemenu_80314AC8, 1); - gcdialog_showText(ASSET_A17_DIALOG_BURIED_TREASURE_SPAWNED, 4, NULL, NULL, NULL, NULL); - CH_TREASUREHUNT_PUZZLE_CURRENT_STEP++; + gcdialog_showDialog(ASSET_A17_DIALOG_BURIED_TREASURE_SPAWNED, 4, NULL, NULL, NULL, NULL); + chtreasureHunt_puzzleCurrentStep++; } } void chTreasurehunt_resetProgress(void){ - CH_TREASUREHUNT_PUZZLE_CURRENT_STEP = 0; + chtreasureHunt_puzzleCurrentStep = 0; } static void __chTreasurehunt_updateFunc(Actor *this){ @@ -198,7 +198,7 @@ static void __chTreasurehunt_updateFunc(Actor *this){ } break; case 1: - if(local->unk0 < CH_TREASUREHUNT_PUZZLE_CURRENT_STEP){ + if(local->unk0 < chtreasureHunt_puzzleCurrentStep){ this->state = 2; } break; diff --git a/src/TTC/code_26D0.c b/src/TTC/code_26D0.c index ccd49e98..4e7ce928 100644 --- a/src/TTC/code_26D0.c +++ b/src/TTC/code_26D0.c @@ -17,9 +17,9 @@ extern ActorInfo gStairs1; extern ActorInfo gStairs2; extern ActorInfo gPalmTree; extern ActorInfo gChLeaky; -extern ActorInfo gChLockupSlow; -extern ActorInfo gChLockupMedium; -extern ActorInfo gChLockupFast; +extern ActorInfo chLockupSlow; +extern ActorInfo chLockupMedium; +extern ActorInfo chLockupFast; extern ActorInfo gChTreasurehuntRedArrow; extern ActorInfo gChTreasurehuntRedQuestionMark; extern ActorInfo gChTreasurehuntRedX; @@ -97,9 +97,9 @@ void code26D0_resetSpawnableActorsForTTC(void) 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); spawnableActorList_add(&gChBlubber, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_26); spawnableActorList_add(&gChLeaky, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&gChLockupSlow, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&gChLockupMedium, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&gChLockupFast, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&chLockupSlow, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&chLockupMedium, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&chLockupFast, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&gChTreasurehuntRedArrow, actor_new, ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&gChTreasurehuntRedQuestionMark, actor_new, ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&gChTreasurehuntRedX, actor_new, ACTOR_FLAG_UNKNOWN_10); diff --git a/src/TTC/ma/castle.c b/src/TTC/ma/castle.c index 5748f633..892afa45 100644 --- a/src/TTC/ma/castle.c +++ b/src/TTC/ma/castle.c @@ -242,7 +242,7 @@ static void __maCastle_setLetterFloorTileState(LetterFloorTile *arg0, s32 arg1) arg0->timeDeltaSum = 0.0f; if ((arg1 == 1) && (temp_v0 != arg1)) { - func_8025A6EC(COMUSIC_2C_BUZZER, 32000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 32000); } } @@ -327,11 +327,11 @@ static u32 __maCastle_cheatoCodeUnlocked(s32 cheato_code_index) static void __maCastle_setVolatileFlags(u32 arg0) { int i; - volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_C2_NOBONUS_TEXT); + progressDialog_setAndTriggerDialog_0(VOLATILE_FLAG_C2_NOBONUS_TEXT); // wish washy banjo cheat code if (arg0 & 0x400) { - volatileFlag_setAndTriggerDialog_E(VOLATILE_FLAG_C5_WISHYWASHYBANJO_TEXT); + progressDialog_setAndTriggerDialog_E(VOLATILE_FLAG_C5_WISHYWASHYBANJO_TEXT); } volatileFlag_set(VOLATILE_FLAG_78_SANDCASTLE_NO_BONUS, 0); for (i = 4; i < 11; i++) @@ -414,7 +414,7 @@ static void __maCastle_checkFloorTileForRegularCheatCode(LetterFloorTile *letter } if (cheatcode_ptr->code[cheatcode_ptr->codeCharacterIdx] == 0) { - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); if (is_in_ff_minigame) { @@ -433,14 +433,14 @@ static void __maCastle_checkFloorTileForRegularCheatCode(LetterFloorTile *letter sMapState.unkC = 0.0f; mapSpecificFlags_set(TTC_SPECIFIC_FLAG_1_UNKNOWN, TRUE); fileProgressFlag_set(FILEPROG_FA_UNKNOWN, TRUE); - func_8030E2C4(sMapState.doorOpeningSfxSourceIdx); + sfxSource_func_8030E2C4(sMapState.doorOpeningSfxSourceIdx); __maCastle_setupCheatCodeTimer(2); } // blue eggs & red/gold feathers check else if (var_v0 & 0xE) { // trigger dialog - func_8035644C((cheatcode_ptr - sCheatCodes) - 1 + FILEPROG_BE_CHEATO_BLUEEGGS); + progressDialog_showDialogMaskZero((cheatcode_ptr - sCheatCodes) - 1 + FILEPROG_BE_CHEATO_BLUEEGGS); switch ((cheatcode_ptr - sCheatCodes) - 1) { default: @@ -468,7 +468,7 @@ static void __maCastle_checkFloorTileForRegularCheatCode(LetterFloorTile *letter } else { - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } } @@ -539,7 +539,7 @@ void maCastle_init(void) timed_exitStaticCamera(2.0f); func_80324E38(2.0f, 0); func_803228D8(); - timedFunc_set_3(2.0f, (GenFunction_3)func_802E4078, MAP_7_TTC_TREASURE_TROVE_COVE, 1, 0); + timedFunc_set_3(2.0f, (GenFunction_3)transitionToMap, MAP_7_TTC_TREASURE_TROVE_COVE, 1, 0); } else if (levelSpecificFlags_get(LEVEL_FLAG_2_TTC_UNKNOWN) || volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME)) { func_8034E71C(sp2C, -500, 0.0f); @@ -557,12 +557,12 @@ void maCastle_init(void) sMapState.doorOpeningSfxSourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_playSfxAtVolume(sMapState.doorOpeningSfxSourceIdx, 0.1f); sfxsource_setSfxId(sMapState.doorOpeningSfxSourceIdx, SFX_3EC_CCW_DOOR_OPENING); - func_8030DD14(sMapState.doorOpeningSfxSourceIdx, 3); + sfxSource_setunk43_7ByIndex(sMapState.doorOpeningSfxSourceIdx, 3); sfxsource_setSampleRate(sMapState.doorOpeningSfxSourceIdx, 28000); sMapState.dullCannonShotSfxSourceId = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(sMapState.dullCannonShotSfxSourceId, SFX_3_DULL_CANNON_SHOT); - func_8030DD14(sMapState.dullCannonShotSfxSourceId, 3); + sfxSource_setunk43_7ByIndex(sMapState.dullCannonShotSfxSourceId, 3); sfxsource_setSampleRate(sMapState.dullCannonShotSfxSourceId, 0x7fff); __maCastle_initFloorTiles(); __maCastle_resetCheatCodeProgress(); @@ -588,7 +588,7 @@ void maCastle_update(void) time_delta = time_getDelta(); if (__maCastle_getNumberOfBannedCheatCodesEntered() == 3) { - func_802C5A3C(-1); + gameSelect_setGameNumber(-1); } if (sMapState.model1 != 0) { @@ -638,8 +638,8 @@ void maCastle_update(void) if (sMapState.unkC > 4.0f) { sMapState.banjoKazooieCodeEnteredState = 3; - func_8030E2C4(sMapState.dullCannonShotSfxSourceId); - func_8030E394(sMapState.doorOpeningSfxSourceIdx); + sfxSource_func_8030E2C4(sMapState.dullCannonShotSfxSourceId); + sfxSource_triggerCallbackByIndex(sMapState.doorOpeningSfxSourceIdx); } } } @@ -1029,10 +1029,10 @@ static void __maCastle_eraseGameplayDialogCallback(ActorMarker *caller, enum ass { __maCastle_setNumberOfBannedCheatcodesEntered(3); __maCastle_checkSecretCheatCodeIndex(sThirdForbiddenSecretCheatCodeIndex); - gcdialog_showText(ASSET_FBF_DIALOG_ERASED_SAVE, 0xC, NULL, NULL, NULL, NULL); - gameFile_clear(func_802C5A30()); - gameFile_8033CFD4(func_802C5A30()); - func_802C5A3C(-1); + gcdialog_showDialog(ASSET_FBF_DIALOG_ERASED_SAVE, 0xC, NULL, NULL, NULL, NULL); + gameFile_clear(gameSelect_getGameNumber()); + gameFile_8033CFD4(gameSelect_getGameNumber()); + gameSelect_setGameNumber(-1); return; } __maCastle_resetSecretCheatCodeProgress(); @@ -1064,11 +1064,11 @@ static void __maCastle_checkIfBannedCheatCodeEntered(s32 secret_cheat_code_index __maCastle_setNumberOfBannedCheatcodesEntered(2); __maCastle_checkSecretCheatCodeIndex(secret_cheat_code_index); __maCastle_resetSecretCheatCodeProgress(); - gcdialog_showText(ASSET_FBE_DIALOG_CHEATING_ERASE_SAVE_WARNING, 0xC, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_FBE_DIALOG_CHEATING_ERASE_SAVE_WARNING, 0xC, NULL, NULL, NULL, NULL); return; case 2: sThirdForbiddenSecretCheatCodeIndex = secret_cheat_code_index; - gcdialog_showText(ASSET_E38_DIALOG_CHEATING_ERASE_SAVE_CONFIRMATION, 0xC, NULL, NULL, __maCastle_eraseGameplayDialogCallback, NULL); + gcdialog_showDialog(ASSET_E38_DIALOG_CHEATING_ERASE_SAVE_CONFIRMATION, 0xC, NULL, NULL, __maCastle_eraseGameplayDialogCallback, NULL); return; } return; diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index 6447b8bf..b9a294e4 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -18,7 +18,7 @@ extern u8 soundfont2tbl_ROM_START[]; /* dependent functions */ void func_8024FA98(u8, enum comusic_e); -void func_8024FD28(u8, s16); +void musicTrack_setVolume(u8, s16); int func_80250074(u8); u8 func_8025F4A0(ALCSPlayer *, u8); @@ -27,182 +27,182 @@ u16 func_80250474(s32 arg0); void func_8024FB8C(void); /* .data */ -MusicTrackMeta D_80275D40[0xB0] = { - {"Blank", 15000}, - {"Scrap", 15000}, - {"Jungle 2", 20000}, - {"Snow 2", 20000}, - {"Bells", 21000}, - {"Beach", 20000}, - {"Swamp", 15000}, - {"Crab Cave", 20000}, - {"Title", 15000}, - {"Notes", 15000}, - {"Jinjo", 15000}, - {"Feather", 15000}, - {"Egg", 15000}, - {"Jigpiece", 28000}, - {"Sky", 0x7FFF}, - {"Spooky", 21000}, - {"Training", 15000}, - {"Lighthouse", 24000}, - {"Crab", 15000}, - {"Shell", 0x7FFF}, - {"Feather Inv", 15000}, - {"Extra life", 15000}, - {"Honeycomb", 15000}, - {"Empty honey piece", 15000}, - {"Extra honey", 15000}, - {"Mystery", 15000}, - {"You lose", 20000}, - {"Termite nest", 0x7FFF}, - {"Outside whale", 15000}, - {"Spell", 15000}, - {"Witch House", 23000}, - {"In whale", 0x4650}, - {"Desert", 20000}, - {"In spooky", 0x4650}, - {"Grave", 24000}, - {"Church", 28000}, - {"Sphinx", 20000}, - {"Invulnerabilty", 28000}, - {"Collapse", 15000}, - {"Snake", 15000}, - {"Sandcastle", 15000}, - {"Summer", 20000}, - {"Winter", 0x6978}, - {"Right", 28000}, - {"Wrong", 0x7D00}, - {"Achieve", 0x7D00}, - {"Autumn", 0x55F0}, - {"Default forest", 0x7530}, - {"5 Jinjos", 15000}, - {"Game over", 15000}, - {"Nintendo", 15000}, - {"Ship", 24000}, - {"Shark", 15000}, - {"Ship inside", 24000}, - {"100 Notes", 15000}, - {"Door Open", 15000}, - {"Organ sequence", 0x4650}, - {"Advent", 15000}, - {"Slalom", 15000}, - {"Race win", 15000}, - {"Race lose", 15000}, - {"Jigsaw magic", 15000}, - {"Oh dear", 15000}, - {"Up", 15000}, - {"Down", 15000}, - {"Shamen Hut", 0x4A38}, - {"Jig 10", 0x61A8}, - {"Carpet", 15000}, - {"Squirrel", 15000}, - {"Hornet", 15000}, - {"Treetop", 0x7D00}, - {"Turtle Shell", 0x61A8}, - {"House Summer", 15000}, - {"House Autumn", 15000}, - {"Out Buildings", 15000}, - {"Hornet 2", 15000}, - {"Cabins", 15000}, - {"Rain", 15000}, - {"Jigsaw Open", 15000}, - {"Jigsaw Close", 15000}, - {"Witch 1", 23000}, - {"Witch 2", 23000}, - {"Witch 3", 23000}, - {"Witch 4", 23000}, - {"Witch 5", 23000}, - {"Mr Vile", 15000}, - {"Bridge", 0x55F0}, - {"Turbo Talon Trot", 28000}, - {"Long legs", 28000}, - {"Witch 6", 23000}, - {"Boggy sad", 15000}, - {"Boggy happy", 15000}, - {"Quit", 15000}, - {"Witch 7", 23000}, - {"Witch 8", 23000}, - {"Spring", 0x4650}, - {"Squirrel attic", 0x6590}, - {"Lights", 15000}, - {"Box", 0x4268}, - {"Witch 9", 23000}, - {"Open up", 15000}, - {"Puzzle complete", 0x61A8}, - {"Xmas tree", 15000}, - {"Puzzle in", 15000}, - {"Lite tune", 15000}, - {"Open extra", 15000}, - {"Ouija", 0x7148}, - {"Wozza", 15000}, - {"Intro", 20000}, - {"Gnawty", 15000}, - {"Banjo's Pad", 15000}, - {"Pause", 15000}, - {"Cesspit", 0x61A8}, - {"Quiz", 15000}, - {"Frog", 20000}, - {"GameBoy", 15000}, - {"Lair", 15000}, - {"Red Extra", 0x7D00}, - {"Gold Extra", 0x7D00}, - {"Egg Extra", 0x7D00}, - {"Note door", 15000}, - {"Cheaty", 15000}, - {"Fairy", 20000}, - {"Skull", 0x61A8}, - {"Square Grunty", 0x61A8}, - {"Square Banjo", 0x61A8}, - {"Square Joker", 0x7530}, - {"Square Music", 0x61A8}, - {"Lab", 20000}, - {"Fade Up", 0x61A8}, - {"Puzzle Out", 15000}, - {"Secret Gobi", 20000}, - {"Secret Beach", 20000}, - {"Secret Ice", 20000}, - {"Secret Spooky", 20000}, - {"Secret Squirrel", 20000}, - {"Secret Egg", 20000}, - {"Jinjup", 0x7D00}, - {"Turbo Talon Trot short", 28000}, - {"Fade Down", 0x61A8}, - {"Big Jinjo", 0x7D00}, - {"T1000", 15000}, - {"Credits", 15000}, - {"T1000x", 20000}, - {"Big Door", 20000}, - {"Descent", 20000}, - {"Wind up", 20000}, - {"Air", 20000}, - {"Do jig", 20000}, - {"Picture", 28000}, - {"Piece up", 20000}, - {"Piece down", 20000}, - {"Spin", 20000}, - {"BarBQ", 15000}, - {"Chord1", 20000}, - {"Chord2", 20000}, - {"Chord3", 20000}, - {"Chord4", 20000}, - {"Chord5", 20000}, - {"Chord6", 20000}, - {"Chord7", 20000}, - {"Chord8", 20000}, - {"Chord9", 20000}, - {"Chord10", 20000}, - {"Shock1", 20000}, - {"Shock2", 20000}, - {"Shock3", 20000}, - {"Shock4", 20000}, - {"Sad grunt", 20000}, - {"Podium", 20000}, - {"Endbit", 20000}, - {"Rock", 20000}, - {"Last Bit", 20000}, - {"Unnamed piece", 15000}, - {"Unnamed piece", 15000}, +MusicTrackMeta musicTrackInfo[0xB0] = { + { "Blank", 15000 }, + { "Scrap", 15000 }, + { "Jungle 2", 20000 }, + { "Snow 2", 20000 }, + { "Bells", 21000 }, + { "Beach", 20000 }, + { "Swamp", 15000 }, + { "Crab Cave", 20000 }, + { "Title", 15000 }, + { "Notes", 15000 }, + { "Jinjo", 15000 }, + { "Feather", 15000 }, + { "Egg", 15000 }, + { "Jigpiece", 28000 }, + { "Sky", 0x7FFF }, + { "Spooky", 21000 }, + { "Training", 15000 }, + { "Lighthouse", 24000 }, + { "Crab", 15000 }, + { "Shell", 0x7FFF }, + { "Feather Inv", 15000 }, + { "Extra life", 15000 }, + { "Honeycomb", 15000 }, + { "Empty honey piece", 15000 }, + { "Extra honey", 15000 }, + { "Mystery", 15000 }, + { "You lose", 20000 }, + { "Termite nest", 0x7FFF }, + { "Outside whale", 15000 }, + { "Spell", 15000 }, + { "Witch House", 23000 }, + { "In whale", 0x4650 }, + { "Desert", 20000 }, + { "In spooky", 0x4650 }, + { "Grave", 24000 }, + { "Church", 28000 }, + { "Sphinx", 20000 }, + { "Invulnerabilty", 28000 }, + { "Collapse", 15000 }, + { "Snake", 15000 }, + { "Sandcastle", 15000 }, + { "Summer", 20000 }, + { "Winter", 0x6978 }, + { "Right", 28000 }, + { "Wrong", 0x7D00 }, + { "Achieve", 0x7D00 }, + { "Autumn", 0x55F0 }, + { "Default forest", 0x7530 }, + { "5 Jinjos", 15000 }, + { "Game over", 15000 }, + { "Nintendo", 15000 }, + { "Ship", 24000 }, + { "Shark", 15000 }, + { "Ship inside", 24000 }, + { "100 Notes", 15000 }, + { "Door Open", 15000 }, + { "Organ sequence", 0x4650 }, + { "Advent", 15000 }, + { "Slalom", 15000 }, + { "Race win", 15000 }, + { "Race lose", 15000 }, + { "Jigsaw magic", 15000 }, + { "Oh dear", 15000 }, + { "Up", 15000 }, + { "Down", 15000 }, + { "Shamen Hut", 0x4A38 }, + { "Jig 10", 0x61A8 }, + { "Carpet", 15000 }, + { "Squirrel", 15000 }, + { "Hornet", 15000 }, + { "Treetop", 0x7D00 }, + { "Turtle Shell", 0x61A8 }, + { "House Summer", 15000 }, + { "House Autumn", 15000 }, + { "Out Buildings", 15000 }, + { "Hornet 2", 15000 }, + { "Cabins", 15000 }, + { "Rain", 15000 }, + { "Jigsaw Open", 15000 }, + { "Jigsaw Close", 15000 }, + { "Witch 1", 23000 }, + { "Witch 2", 23000 }, + { "Witch 3", 23000 }, + { "Witch 4", 23000 }, + { "Witch 5", 23000 }, + { "Mr Vile", 15000 }, + { "Bridge", 0x55F0 }, + { "Turbo Talon Trot", 28000 }, + { "Long legs", 28000 }, + { "Witch 6", 23000 }, + { "Boggy sad", 15000 }, + { "Boggy happy", 15000 }, + { "Quit", 15000 }, + { "Witch 7", 23000 }, + { "Witch 8", 23000 }, + { "Spring", 0x4650 }, + { "Squirrel attic", 0x6590 }, + { "Lights", 15000 }, + { "Box", 0x4268 }, + { "Witch 9", 23000 }, + { "Open up", 15000 }, + { "Puzzle complete", 0x61A8 }, + { "Xmas tree", 15000 }, + { "Puzzle in", 15000 }, + { "Lite tune", 15000 }, + { "Open extra", 15000 }, + { "Ouija", 0x7148 }, + { "Wozza", 15000 }, + { "Intro", 20000 }, + { "Gnawty", 15000 }, + { "Banjo's Pad", 15000 }, + { "Pause", 15000 }, + { "Cesspit", 0x61A8 }, + { "Quiz", 15000 }, + { "Frog", 20000 }, + { "GameBoy", 15000 }, + { "Lair", 15000 }, + { "Red Extra", 0x7D00 }, + { "Gold Extra", 0x7D00 }, + { "Egg Extra", 0x7D00 }, + { "Note door", 15000 }, + { "Cheaty", 15000 }, + { "Fairy", 20000 }, + { "Skull", 0x61A8 }, + { "Square Grunty", 0x61A8 }, + { "Square Banjo", 0x61A8 }, + { "Square Joker", 0x7530 }, + { "Square Music", 0x61A8 }, + { "Lab", 20000 }, + { "Fade Up", 0x61A8 }, + { "Puzzle Out", 15000 }, + { "Secret Gobi", 20000 }, + { "Secret Beach", 20000 }, + { "Secret Ice", 20000 }, + { "Secret Spooky", 20000 }, + { "Secret Squirrel", 20000 }, + { "Secret Egg", 20000 }, + { "Jinjup", 0x7D00 }, + { "Turbo Talon Trot short", 28000 }, + { "Fade Down", 0x61A8 }, + { "Big Jinjo", 0x7D00 }, + { "T1000", 15000 }, + { "Credits", 15000 }, + { "T1000x", 20000 }, + { "Big Door", 20000 }, + { "Descent", 20000 }, + { "Wind up", 20000 }, + { "Air", 20000 }, + { "Do jig", 20000 }, + { "Picture", 28000 }, + { "Piece up", 20000 }, + { "Piece down", 20000 }, + { "Spin", 20000 }, + { "BarBQ", 15000 }, + { "Chord1", 20000 }, + { "Chord2", 20000 }, + { "Chord3", 20000 }, + { "Chord4", 20000 }, + { "Chord5", 20000 }, + { "Chord6", 20000 }, + { "Chord7", 20000 }, + { "Chord8", 20000 }, + { "Chord9", 20000 }, + { "Chord10", 20000 }, + { "Shock1", 20000 }, + { "Shock2", 20000 }, + { "Shock3", 20000 }, + { "Shock4", 20000 }, + { "Sad grunt", 20000 }, + { "Podium", 20000 }, + { "Endbit", 20000 }, + { "Rock", 20000 }, + { "Last Bit", 20000 }, + { "Unnamed piece", 15000 }, + { "Unnamed piece", 15000 }, 0 }; s32 D_802762C0 = 0; @@ -382,7 +382,7 @@ void func_8024FC1C(u8 arg0, enum comusic_e arg1){ D_80281720[arg0].index_cpy = arg1; D_80281720[arg0].unk2 = 1; D_80281720[arg0].unk3 = 0; - D_80281720[arg0].unk0 = D_80275D40[arg1].unk4; + D_80281720[arg0].unk0 = musicTrackInfo[arg1].volume; } void func_8024FC6C(u8 arg0){ @@ -408,15 +408,16 @@ void func_8024FCE0(u8 arg0, s16 arg1){ } //musicTrack_setVolume -void func_8024FD28(u8 arg0, s16 arg1){ +void musicTrack_setVolume(u8 arg0, s16 arg1) { D_80281720[arg0].unk0 = arg1; alCSPSetVol(&D_80281720[arg0].cseqp, arg1); - if(D_80281720[arg0].unk3 && arg1){ + + if (D_80281720[arg0].unk3 && arg1) { func_8024FCE0(arg0, arg1); - } - else if(!D_80281720[arg0].unk3 && arg1 == 0){ - if(func_80250074(arg0) == 0) + } else if (!D_80281720[arg0].unk3 && arg1 == 0) { + if (func_80250074(arg0) == 0) { func_8024FC6C(arg0); + } } } @@ -468,7 +469,7 @@ void func_8024FF34(void){ } D_80281720[i].unk3 = 0; D_80281720[i].unk2 = 0; - func_8024FD28(i, D_80281720[i].unk0); + musicTrack_setVolume(i, D_80281720[i].unk0); } break; case AL_STOPPING: //L80250008 @@ -477,17 +478,16 @@ void func_8024FF34(void){ } } -s32 func_80250034(enum comusic_e track_id){ - return D_80275D40[track_id].unk4; +s32 gcMusic_getDefaultVolumeForTrack(enum comusic_e track_id) { + return musicTrackInfo[track_id].volume; } -void func_80250048(enum comusic_e track_id, u16 arg1){ - D_80275D40[track_id].unk4 = arg1; +void gcMusic_setDefaultVolumeForTrack(enum comusic_e track_id, u16 volume) { + musicTrackInfo[track_id].volume = volume; } -//song_getName -char *func_80250060(enum comusic_e track_id){ - return D_80275D40[track_id].name; +char *gcMusic_getNameForTrack(enum comusic_e track_id) { + return musicTrackInfo[track_id].name; } int func_80250074(u8 arg0){ diff --git a/src/core1/code_1BE90.c b/src/core1/code_1BE90.c deleted file mode 100644 index d98fcba8..00000000 --- a/src/core1/code_1BE90.c +++ /dev/null @@ -1,639 +0,0 @@ -#include -#include "core1/core1.h" -#include "functions.h" -#include "variables.h" - -#include "version.h" - -extern func_8024FDDC(u8, s32); - -void func_8025AE50(s32, f32); - -bool func_80250074(u8); -void func_8024FD28(u8, s32); -void func_8024FC1C(u8, s32); -void func_8025AC20(enum comusic_e, s32, s32, f32, char*, s32); -void func_8025AC7C(enum comusic_e, s32, s32, f32, s32 *, char*, s32); -void comusicPlayer_free(void); -void func_8025A55C(s32, s32, s32); -void func_8025A7DC(enum comusic_e); -void func_8025ABB8(enum comusic_e, s32, s32, s32); -void *freelist_next(FLA **, s32*); - -/* .bss */ -CoMusic *D_80276E30 = NULL; //active track ptr -int D_80276E34 = 0; - -/* .code */ -/** - * @brief returns a pointer to the CoMusic struct with the corresponding track_id - * if it exists OR the first free CoMusic struct. - * - * @param track_id - * @return CoMusic* - */ -CoMusic *__find_track(enum comusic_e track_id) { - CoMusic *iMusPtr; - CoMusic *freeSlotPtr; - - freeSlotPtr = NULL; - for(iMusPtr = D_80276E30 + 1; iMusPtr < D_80276E30 + 5; iMusPtr++) { - if (track_id == iMusPtr->track_id) { - return iMusPtr; - } - if (freeSlotPtr == 0) { - if ((s32) iMusPtr->track_id < 0) { - freeSlotPtr = iMusPtr; - } - } - } - return freeSlotPtr; -} - -void func_80259914(CoMusic *this, s32 arg1, s32 arg2){ - s32 sp2C; - s32 i; - struct12s *tmp; - - freelist_clear(this->unk18); - for(i = 0; i < 0xE; i++){ - this->unk1C[i] = 0; - } - tmp = (struct12s *)freelist_next(&this->unk18, &sp2C); - tmp->unk0 = arg1; - tmp->unk1 = arg2; -} - -void func_80259994(CoMusic *this, s32 arg1){ - func_80259914(this, arg1, arg1); -} - -void func_802599B4(CoMusic *this){ - func_80259994(this, func_80250034(this->track_id)); - this->track_id = -1; - this->unk14 = 0; - this->unk15 = 0; - func_8024FC1C(this - D_80276E30, -1); -} - -void comusicPlayer_init(void){ - CoMusic * iPtr; - s32 i; - - if(D_80276E30 != NULL) - comusicPlayer_free(); - - D_80276E30 = (CoMusic *) malloc(6*sizeof(CoMusic)); - for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){ - iPtr->track_id = -1; - iPtr->unk8 = 0; - iPtr->unk12 = 0; - iPtr->unkC = 0; - iPtr->unk4 = 0.0f; - iPtr->unk14 = 0; - iPtr->unk15 = 0; - iPtr->unk0 = 0.0f; - iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_new(sizeof(struct12s),4); - for(i = 0; i < 0xE; i++){ - iPtr->unk1C[i] = 0; - } - } -} - -//comusic_freeAll -void comusicPlayer_free(void){ - CoMusic *iPtr; - func_8024FB8C(); - func_8024F83C(); - - for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){ - freelist_free(iPtr->unk18); - } - free(D_80276E30); - D_80276E30 = NULL; -} - -s32 comusic_active_track_count(void){ - CoMusic * iPtr; - s32 cnt = 0; - for(iPtr = D_80276E30; iPtr < D_80276E30 + 6; iPtr++){ - if(iPtr->track_id >= 0) - cnt++; - } - return cnt; -} - -void comusicPlayer_update(void) { - s32 temp_lo; - CoMusic *var_s0; - f32 dt; - - - dt = time_getDelta(); - for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){ - if (var_s0->track_id >= 0) { - temp_lo = var_s0 - D_80276E30; - var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f); - if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) { - func_8025A7DC(var_s0->track_id); - } - } - } - func_8024FF34(); - if (!D_80276E34) - return; - - D_80276E34 = FALSE; - for(var_s0 = D_80276E30; var_s0 < &D_80276E30[6]; var_s0++){ - if (var_s0->track_id >= 0) { - if (var_s0->unk12 != 0) { - temp_lo = var_s0 - D_80276E30; - if (var_s0->unk0 > 0.0f) { - var_s0->unk0 -= time_getDelta(); - D_80276E34 = TRUE; - } else if (var_s0->unk12 < 0) { - var_s0->unk8 += var_s0->unk12; - if (var_s0->unk15 && (var_s0->unkC == 0) && (var_s0->unk8 <= 0)) { - func_802599B4(var_s0); - continue; - } else { - if (var_s0->unkC >= var_s0->unk8) { - var_s0->unk8 = var_s0->unkC; - var_s0->unk12 = 0; - } else { - D_80276E34 = TRUE; - } - func_8024FD28(temp_lo, (s16)var_s0->unk8); - } - } else if (var_s0->unk8 < var_s0->unkC) { - if (var_s0->unk8 == 0) { - var_s0->unk4 = 0.0f; - } - var_s0->unk8 += var_s0->unk12; - if (var_s0->unk8 >= var_s0->unkC) { - var_s0->unk8 = var_s0->unkC; - var_s0->unk12 = 0; - } else { - D_80276E34 = TRUE; - } - func_8024FD28(temp_lo, (s16)var_s0->unk8); - } else { - var_s0->unk12 = 0; - } - } - } - } -} - -void func_80259EA8(CoMusic *this, s32 *arg1, s32 *arg2){ - int i; - int cnt = freelist_size(this->unk18); - s32 tmp_s1 = 0x7FFF; - s32 tmp_s2 = 0x40000000; - struct12s *tmp_ptr; - - for(i = 1; i < cnt; i++){ - if(freelist_elementIsAlive(this->unk18, i)){ - tmp_ptr = (struct12s*)freelist_at(this->unk18, i); - if(tmp_ptr->unk0 < tmp_s1 || (tmp_s1 == tmp_ptr->unk0 && tmp_ptr->unk1 < tmp_s2)){ - tmp_s1 = tmp_ptr->unk0; - tmp_s2 = tmp_ptr->unk1; - }//L80259F40 - } - } - *arg1 = tmp_s1; - *arg2 = tmp_s2; -} - -void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) { - struct12s *temp_v0; - f32 pad; - s32 sp34; - s32 var_s2; - - var_s2 = *arg1; - sp34 = *arg2; - if ((*arg3 != 0) && !freelist_elementIsAlive(self->unk18, *arg3)) { - *arg3 = 0; - } - - if (var_s2 < 0) { - temp_v0 = (struct12s *)freelist_at(self->unk18, 1); - if (temp_v0->unk0 < func_80250034(self->track_id)) { - var_s2 = func_80250034(self->track_id); - } - else{ - var_s2 = temp_v0->unk0; - } - if (*arg3 != 0) { - temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3); - *arg2 = temp_v0->unk1; - freelist_freeElement(self->unk18, *arg3); - *arg3 = 0; - func_80259EA8(self, arg1, &sp34); - return; - } - } - - if (*arg3 == 0) { - temp_v0 = (struct12s *)freelist_at(self->unk18, 1); - if ((temp_v0->unk0 < var_s2) || ((var_s2 == temp_v0->unk0) && (sp34 >= temp_v0->unk1))) { - func_80259914(self, var_s2, sp34); - } else { - freelist_next(&self->unk18, arg3); - } - } - if (*arg3 != 0) { - temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3); - temp_v0->unk0 = var_s2; - temp_v0->unk1 = sp34; - } - func_80259EA8(self, arg1, arg2); -} - -void func_8025A104(enum comusic_e arg0, s32 arg1){ - if (arg0 != D_80276E30[0].track_id){ - func_8024FC1C(0, arg0); - } - func_8024FD28(0, (s16)arg1); - D_80276E30[0].track_id = (s16) arg0; - D_80276E30[0].unk8 = arg1; - D_80276E30[0].unk0 = 0.0f; - D_80276E30[0].unk12 = 0; - D_80276E30[0].unk4 = 0.0f; - D_80276E30[0].unk15 = 0; - func_80259994(&D_80276E30[0], arg1); -} - -void func_8025A1A8(enum comusic_e arg0){ - - if (arg0 != D_80276E30[0].track_id){ - func_8024FC1C(0, arg0); - D_80276E30[0].track_id = (s16) arg0; - D_80276E30[0].unk8 = func_80250034(arg0); - D_80276E30[0].unk0 = 0.0f; - D_80276E30[0].unk12 = 0; - D_80276E30[0].unk4 = 0.0f; - D_80276E30[0].unk15 = 0; - func_80259994(&D_80276E30[0], D_80276E30[0].unk8); - } -} - -void func_8025A23C(s32 arg0){ - CoMusic *music = &D_80276E30[5]; - s32 temp_v0; - - if (arg0 != music->track_id){ - func_8024FC1C(5, arg0); - music->track_id = (s16) arg0; - temp_v0 = func_80250034(arg0); - music->unk8 = temp_v0; - music->unk12 = 0; - music->unk15 = 0; - music->unk0 = 0.0f; - music->unk4 = 0.0f; - func_80259994(music, temp_v0); - } -} - -void func_8025A2B0(void){ - func_802599B4(&D_80276E30[5]); -} - -void func_8025A2D8(void){ - func_802599B4(&D_80276E30[0]); -} - -void func_8025A2FC(s32 arg0, s32 arg1){ - s32 i; - - func_8025A55C(arg0, arg1, 1); - for (i = 1; i < 5; i++){ - s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i] - if (val >= 0){ - func_8025ABB8(val, arg0, arg1, 1); - } - } -} - -void func_8025A388(s32 arg0, s32 arg1) { - s32 i; - - if (D_80276E30->unk14 == 0){ - func_8025A55C(arg0, arg1, 1); - } - for (i = 1; i < 5; i++){ - CoMusic *current = (i + D_80276E30); // Doesn't match with D_80276E30[i] - if (current->track_id >= 0 && current->unk14 == 0){ - func_8025ABB8(current->track_id, arg0, arg1, 1); - } - } -} - -void func_8025A430(s32 arg0, s32 arg1, s32 arg2){ - s32 i; - - func_8025A55C(arg0, arg1, arg2); - for (i = 1; i < 5; i++){ - s16 val = (i + D_80276E30)->track_id; // Doesn't match with D_80276E30[i] - if (val >= 0){ - func_8025ABB8(val, arg0, arg1, arg2); - } - } -} - -void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2){ - if(D_80276E30[0].track_id >= 0){ - func_80259F7C(&D_80276E30[0], &arg0, &arg1, arg2); - if(arg0 != D_80276E30[0].unk8){ - if(D_80276E30[0].unk8 < arg0){ - D_80276E30[0].unk12 = arg1; - } - else{ - D_80276E30[0].unk12 = -arg1; - } - D_80276E30[0].unkC = arg0; - D_80276E34 = 1; - } - } -} - -void func_8025A55C(s32 arg0, s32 arg1, s32 arg2){ - func_8025A4C4(arg0, arg1, &D_80276E30->unk1C[arg2]); -} - -void func_8025A58C(s32 arg0, s32 arg1){ - func_8025A55C(arg0, arg1, 0); -} - - -void func_8025A5AC(enum comusic_e comusic_id, s32 volume, s32 arg2){ - CoMusic *tmp_a2; - s32 sp20; - - if(volume == -1){ - volume = func_80250034(comusic_id); - } - - tmp_a2 = __find_track(comusic_id); - if(tmp_a2 == NULL) - return; - - sp20 = (tmp_a2 - D_80276E30); - if(tmp_a2->track_id < 0 || arg2){ - switch(comusic_id){ - case COMUSIC_15_EXTRA_LIFE_COLLECTED: - if(map_get() == MAP_10_BGS_MR_VILE){ - break; - } - case COMUSIC_3B_MINIGAME_VICTORY: - case COMUSIC_3C_MINIGAME_LOSS: - func_8025AE50(4000, 2.0f); - } - tmp_a2->track_id = comusic_id; - tmp_a2->unk12 = 0; - tmp_a2->unk15 = 0; - tmp_a2->unk4 = 0.0f; - func_80259994(tmp_a2, volume); - func_8024FC1C(sp20, comusic_id); - } - func_8024FD28(sp20, (s16) volume); - tmp_a2->unk8 = volume; - -} - -void func_8025A6CC(enum comusic_e track_id, s32 volume){ - func_8025A5AC(track_id, volume, 0); -} - -void func_8025A6EC(enum comusic_e track_id, s32 volume){ - func_8025A5AC(track_id, volume, 1); -} - -//comusic_queueTrack -void comusic_playTrack(enum comusic_e track_id){ - CoMusic *trackPtr; - s32 indx; - - trackPtr = __find_track(track_id); - if(trackPtr == NULL) - return; - - indx = trackPtr - D_80276E30; - if(trackPtr->track_id < 0){ - trackPtr->track_id = track_id; - trackPtr->unk12 = 0; - trackPtr->unk4 = 0.0f; - func_8024FC1C( indx, track_id); - func_80259994(trackPtr, trackPtr->unk8 = func_80250034(track_id)); - } - -} - -void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2){ - timedFunc_set_1(delay1, (GenFunction_1) comusic_playTrack, comusic_id); - timedFunc_set_1(delay1 + delay2, (GenFunction_1) func_8025A7DC, comusic_id); -} - -void func_8025A7DC(enum comusic_e track_id){ - CoMusic *trackPtr; - - trackPtr = __find_track(track_id); - if (trackPtr != NULL && trackPtr->track_id >= 0){ - func_802599B4(trackPtr); - } -} - -s32 func_8025A818(void){ - if (D_80276E30[0].unkC == 0 && D_80276E30[0].unk8 <= 0){ - func_802599B4(&D_80276E30[0]); - return 1; - } - return 0; -} - -s32 func_8025A864(enum comusic_e track_id){ - CoMusic *trackPtr; - - trackPtr = __find_track(track_id); - if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->unk8 <= 0){ - func_802599B4(trackPtr); - return 1; - } - return 0; -} - -void func_8025A8B8(enum comusic_e track_id, s32 arg1){ - CoMusic *trackPtr; - - trackPtr = __find_track(track_id); - if (trackPtr != NULL){ - trackPtr->unk14 = arg1; - } -} - -void func_8025A8E4(s32 arg0) { - if (D_80276E30[0].track_id >= 0) { - D_80276E30[0].unk14 = arg0; - } -} - -void func_8025A904(void){ - CoMusic *trackPtr = &D_80276E30[0]; - - while (trackPtr < &D_80276E30[6]){ - if (trackPtr->track_id >= 0){ - func_802599B4(trackPtr); - } - trackPtr++; - } -} - -//dequeue_allTracks -void func_8025A96C(void){ - CoMusic *iPtr; - - for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->track_id >= 0){ - func_802599B4(iPtr); - } - } -} - -//dequeue_allTracks -void func_8025A9D4(void){ - CoMusic *iPtr; - - for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->track_id >= 0 && !iPtr->unk14){ - func_802599B4(iPtr); - } - } -} - -//dequeue_nonmainTracks -void func_8025AA48(void){ - CoMusic *iPtr; - - for(iPtr = &D_80276E30[1]; iPtr < &D_80276E30[6]; iPtr++){ - if(iPtr->track_id >= 0 && !iPtr->unk14){ - func_802599B4(iPtr); - } - } -} - -//dequeue_track? -void func_8025AABC(enum comusic_e track_id){ - CoMusic *trackPtr; - - if(trackPtr = __find_track(track_id)){ - trackPtr->unk15 = 1; - if(!trackPtr->unk8) - func_802599B4(trackPtr); - } -} - -void func_8025AB00(void){ - D_80276E30[0].unk15 = 1; - if (!D_80276E30[0].unk8){ - func_802599B4(&D_80276E30[0]); - } -} - -void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2){ - func_8025AC20(comusic_id, arg1, arg2, 0.0f, "comusic.c", VER_SELECT(0x39e, 0x39f, 0, 0)); - -} - -void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ - func_8025AC7C(comusic_id, arg1, arg2, 0.0f, arg3, "comusic.c", VER_SELECT(0x3a3, 0x3a4, 0, 0)); -} - -void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ - func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(__find_track(comusic_id)->unk1C[arg3]), "comusic.c", VER_SELECT(0x3aa, 0x3ab,0,0)); -} - -void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){ - func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) __find_track(comusic_id)->unk1C, "comusic.c", VER_SELECT(0x3b1, 0x3b2,0,0)); -} - -void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 *arg4, char* arg5, s32 arg6){ - CoMusic *trackPtr; - u32 slot_index; - - //get track location - trackPtr = __find_track(comusic_id); - if(trackPtr == NULL) - return; - - //check if track is loaded in slot - if(trackPtr->track_id < 0){ //Track not loaded - if(arg1 == 0) - return; - slot_index = (trackPtr - D_80276E30); - func_8024FC1C(slot_index, comusic_id); - trackPtr->track_id = comusic_id; - trackPtr->unk8 = 0; - trackPtr->unk15 = 0; - trackPtr->unk4 = 0.0f; - func_80259994(trackPtr, 0); - func_8024FD28(slot_index, 0); - } - func_80259F7C(trackPtr,&arg1, &arg2, arg4); - trackPtr->unk0 = arg3; - trackPtr->unk12 = (trackPtr->unk8 < arg1)? arg2: -arg2; - trackPtr->unkC = arg1; - D_80276E34 = 1; - -} - -//comusic_trackQueued -int func_8025AD7C(enum comusic_e arg0){ - CoMusic * trackPtr = __find_track(arg0); - return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1; -} - -//comusic_isPrimaryTrack -int func_8025ADBC(enum comusic_e arg0){ - return D_80276E30[0].track_id == arg0; -} - -s32 func_8025ADD4(enum comusic_e id){ - CoMusic * ptr = __find_track(id); - return ptr - D_80276E30; -} - -void func_8025AE0C(s32 arg0, f32 arg1){ - func_8025A58C(0, arg0); - timedFunc_set_2(arg1, (GenFunction_2)func_8025A58C, -1, arg0); -} - -void func_8025AE50(s32 arg0, f32 arg1){ - func_8025A430(0, arg0, 6); - timedFunc_set_3(arg1, (GenFunction_3)func_8025A430, -1, arg0, 6); -} - -void func_8025AEA0(enum comusic_e track_id, s32 arg1){ - CoMusic *ptr = __find_track(track_id); - - if(!ptr) return; - func_8024FDDC(ptr - D_80276E30, arg1); -} - -int func_8025AEEC(void){ - s32 out = func_802501A0(0, 0x6A, 0); - if(out) - func_80250170(0, 0x6A, 0); - return out; -} - -void comusic_defrag(void){ - CoMusic *iPtr; - - if(!D_80276E30) return; - - for(iPtr = &D_80276E30[0]; iPtr < &D_80276E30[6]; iPtr++){ - iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_defrag(iPtr->unk18); - } - D_80276E30 = (CoMusic *)defrag(D_80276E30); -} diff --git a/src/core1/code_1D00.c b/src/core1/code_1D00.c index 68452329..1787f63e 100644 --- a/src/core1/code_1D00.c +++ b/src/core1/code_1D00.c @@ -394,10 +394,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){ #if VERSION == VERSION_USA_1_0 if(sp30 == -1){ - func_80247F24(2, 0x7d2); - func_80247F9C(prev_info->frameSamples); - func_80247F9C(info->frameSamples); - func_802483D8(); + gcdebugText_showLargeValue(2, 0x7d2); + gcdebugText_showValue(prev_info->frameSamples); + gcdebugText_showValue(info->frameSamples); + gcdebugText_pauseThread(); } #endif @@ -419,10 +419,10 @@ bool audioManager_handleFrameMsg(AudioInfo *info, AudioInfo *prev_info){ #if VERSION == VERSION_USA_1_0 if(D_8027DD80 < sp34){ - func_80247F24(2, 2000); - func_80247F9C(sp34); - func_80247F9C(D_8027DD80); - func_802483D8(); + gcdebugText_showLargeValue(2, 2000); + gcdebugText_showValue(sp34); + gcdebugText_showValue(D_8027DD80); + gcdebugText_pauseThread(); } #endif @@ -469,8 +469,8 @@ s32 func_80240204(s32 addr, s32 len, void *state){ } phi_s0 = D_8027D5B0.unk8; if (phi_s0 == NULL) { - func_80247F24(2, 0x7D1); - func_802483D8(); + gcdebugText_showLargeValue(2, 0x7D1); + gcdebugText_pauseThread(); return osVirtualToPhysical(D_8027D5B0.unk4); } D_8027D5B0.unk8 = phi_s0->unk0.next; @@ -577,10 +577,10 @@ void func_802403F0(void) { #if VERSION == VERSION_USA_1_0 if (osRecvMesg(&D_8027D008, &sp40, 0) == -1) { - func_80247F24(2, 0x7D5); - func_80247F9C(D_8027DCCC); - func_80247F9C(phi_s0); - func_802483D8(); + gcdebugText_showLargeValue(2, 0x7D5); + gcdebugText_showValue(D_8027DCCC); + gcdebugText_showValue(phi_s0); + gcdebugText_pauseThread(); } #else osRecvMesg(&D_8027D008, &sp40, 0); diff --git a/src/core1/code_7090.c b/src/core1/code_7090.c index 22358da3..cf247c63 100644 --- a/src/core1/code_7090.c +++ b/src/core1/code_7090.c @@ -26,7 +26,7 @@ void core1_7090_release(void) { for (i = 0; i < 10; i++) { if (D_802758E0[i]) - func_8030E394(D_802758E0[i]); + sfxSource_triggerCallbackByIndex(D_802758E0[i]); } free(D_802758E0); @@ -43,13 +43,13 @@ void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volu 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); + sfxSource_func_8030E2C4(sfx_source_index); core1_7090_freeSfxSource(idx); D_802758E0[idx] = sfx_source_index; } } else { - func_8030E6A4(lookup_getSfxId(lookup_idx), volume, sample_rate); + gcsfx_playWithPitch(lookup_getSfxId(lookup_idx), volume, sample_rate); } } diff --git a/src/core1/code_9D30.c b/src/core1/code_9D30.c deleted file mode 100644 index a8dc6945..00000000 --- a/src/core1/code_9D30.c +++ /dev/null @@ -1,440 +0,0 @@ -#include -#include "core1/core1.h" -#include "functions.h" -#include "variables.h" - -#include "version.h" - -#if VERSION == VERSION_USA_1_0 - -/* .data */ -u8 D_80275A50[8][3] = { - {0xFF, 0x00, 0x00}, - {0x00, 0xFF, 0x00}, - {0x00, 0x00, 0xFF}, - {0xFF, 0xFF, 0x00}, - {0xFF, 0x00, 0xFF}, - {0xFF, 0xFF, 0xFF}, - {0xFF, 0x80, 0x00}, - {0x00, 0xFF, 0xFF} -}; -s32 D_80275A68 = 0xFF; -s32 D_80275A6C = 0xFF; -s32 D_80275A70 = 0xFF; -u8 D_80275A74[] = {1, 7, 3, 4, 0, 6, 5, 0}; -u32 D_80275A7C[] = { - 3, 0x0F6DE000, - 1, 0x0F800000, - 3, 0x0C4AE000, - 3, 0x0E59E000, - 4, 0x088AF200, - 3, 0x0F39E000, - 3, 0x0F3DE000, - 3, 0x0E4A4000, - 3, 0x0F7DE000, - 3, 0x0F79E000, - 3, 0x0F6FA000, - 3, 0x0D75C000, - 3, 0x0F24E000, - 3, 0x0D6DC000, - 3, 0x0F34E000, - 3, 0x0F348000, - 3, 0x0F25E000, - 3, 0x0B7DA000, - 3, 0x0E92E000, - 3, 0x0E928000, - 3, 0x0B75A000, - 3, 0x0924E000, - 5, 0x08EEB188, - 4, 0x09DFB900, - 4, 0x06999600, - 3, 0x0F7C8000, - 4, 0x069DB700, - 3, 0x0F7EA000, - 3, 0x0F39E000, - 3, 0x0E924000, - 4, 0x09999600, - 5, 0x08C62A20, - 5, 0x08C63550, - 3, 0x0B55A000, - 3, 0x0B79E000, - 4, 0x0F124F00, - 1, 0x00800000, - 1, 0x05000000, - 3, 0x00380000, - 2, 0x00000000 -}; - -s16 D_80275BBC = 0; -s16 D_80275BC0 = 0; -s16 D_80275BC4 = 0; -s16 D_80275BC8 = 0; -s16 D_80275BCC = 0; -s16 D_80275BD0 = 0; -s16 D_80275BD4 = 0; -s16 D_80275BD8 = 0; -s16 D_80275BDC = 0; - u8 D_80275BE0 = 0; -s32 D_80275BE4 = 0; -char D_80275BE8[] = {'a','z','A','Z','0','9','.',':', '-', ' '}; - - -/* .h */ -void func_802484D0(void); -void func_8024856C(void); -void func_80248520(void); - -/* code */ -void func_80247750(s32 r, s32 g, s32 b){ - D_80275A68 = r; - D_80275A6C = g; - D_80275A70 = b; -} - -void func_8024776C(s32 x, s32 y) { - s32 rgba16; - if( ((x >= 0) && (x < gFramebufferWidth)) - && ((y >= 0) && (y < gFramebufferHeight)) - ) { - gFramebuffers[0][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); - gFramebuffers[1][x + y*gFramebufferWidth] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); - - } -} - -void func_80247818(s32 x, s32 y, s32 w, s32 h) { - s32 iy; - s32 var_s1; - s32 ix; - - for(ix = 0; ix < w; ix++){ - for(iy = 0; iy < h; iy++){ - func_8024776C(x + ix, y + iy); - } - } - osWriteBackDCacheAll(); -} - -void func_802478C0(s32 r, s32 g, s32 b) { - func_80247750(r, g, b); - func_80247818((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100); -} - -void func_8024792C(void){} - -void func_80247934(void) { - s32 var_s0; - - for(var_s0 = 0; var_s0 < 2000000; var_s0++){ - func_8024792C(); - } -} - -void func_80247978(s32 arg0) { - do{ - func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]); - func_80247934(); - func_802478C0(0, 0, 0); - func_80247934(); - } - while(1); -} - -void func_802479E4(s32 arg0) { - func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]); - func_80247934(); - func_802478C0(0, 0, 0); - func_80247934(); -} - -void func_80247A40(s32 arg0) { - func_802478C0(D_80275A50[arg0][0], D_80275A50[arg0][1], D_80275A50[arg0][2]); -} - -void func_80247A7C(s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 r, s32 g, s32 b) { - s32 var_s3; - s32 sp48; - u32 sp44; - u32 sp40; - s32 temp_lo; - s32 temp_s1; - s32 temp_t8; - s32 var_s0; - u32 temp_t4; - u32 var_s4; - u32 *ptr = D_80275A7C + (arg1*2); - - var_s4 = 0x10000000; - sp44 = ptr[0]; - sp40 = ptr[1]; - for(sp48 = 0; sp48 < 5; sp48++){ - temp_lo = sp48 * arg2; - for(var_s3 = 0; var_s3 != sp44; var_s3++){ - var_s4 >>= 1; - if (sp40 & var_s4) { - func_80247750(r, g, b); - func_80247818((D_80275BC4 + arg2*var_s3) - arg3, (D_80275BC8 + temp_lo) - arg3, (arg2 + arg3) + arg3, (arg2 + arg3) + arg3); - } else { - if (arg4 != 0) { - func_80247750(0, 0, 0); - } - func_80247818((D_80275BC4 + arg2*var_s3) - arg3, (D_80275BC8 + temp_lo) - arg3, (arg2 + arg3) + arg3, (arg2 + arg3) + arg3); - } - } - } - if (arg3 == 0) { - D_80275BC4 += (sp44 * arg2) + 2; - } -} - -void func_80247C20(void) { - s16 *var_v0; - s16 *var_v1; - s32 temp_lo; - void *temp_a0; - s32 i; - - if (D_80275BE4 == 0) { - D_80275BE4 = globalTimer_getTime(); - return; - } - if (globalTimer_getTime() != D_80275BE4) { - D_80275BE0 = FALSE; - D_80275BE4 = globalTimer_getTime(); - } - - if (D_80275BE0) { - for(i = 0; i < gFramebufferWidth * gFramebufferHeight; i++){ - gFramebuffers[0][i] = 0; - gFramebuffers[1][i] = 0; - } - osWriteBackDCacheAll(); - } -} - -void func_80247CEC(s32 arg0, s32 arg1, s32 arg2) { - func_80247A7C(arg0, arg1, arg2, 1, 1, 0, 0, 0); - func_80247A7C(arg0, arg1, arg2, 0, 1, D_80275A50[D_80275A74[arg0]][0], D_80275A50[D_80275A74[arg0]][1], D_80275A50[D_80275A74[arg0]][2]); -} - -void func_80247D80(s32 arg0, s32 arg1, s32 arg2) { - s16 temp_v0; - s32 var_a1; - s32 var_s0; - s32 var_s1; - - D_80275BC4 = D_80275BBC; - D_80275BD4 = arg2; - if (arg1 < 0) { - func_80247CEC(arg0, 0x26, arg2); - arg1 *= -1; - } - - for(var_s0 = 1000000000; var_s0 >= 10 && arg1 < var_s0; var_s0 /= 10){ - continue; - } - - for(var_s0 = var_s0; var_s0 >= 10; var_s0 /= 10){ - for(var_a1 = 0; arg1 >= var_s0; var_a1++){ - arg1 -= var_s0; - } - func_80247CEC(arg0, var_a1, arg2); - } - - func_80247CEC(arg0, arg1, arg2); - func_8024856C(); - if (arg2 == 7) { - D_80275BD8 = D_80275BC4; - D_80275BDC = 0; - } - else if (D_80275BC4 >= D_80275BDC) { - D_80275BDC = D_80275BC4; - } -} - -void func_80247F24(s32 arg0, s32 arg1) { - D_80275BD0 = 0; - D_80275BCC = arg0; - D_80275BBC = 0xE; - D_80275BC8 = 0xA; - func_80247D80(arg0, arg1, 7); - func_802484D0(); - D_80275BC0 = D_80275BC8; - D_80275BDC = D_80275BBC; - D_80275BE0 = 1; -} - - -void func_80247F9C(s32 arg0){ - func_80247D80(D_80275BCC, arg0, 2); - func_802484D0(); -} - -void func_80247FD0(u32 arg0) { - s32 var_s0; - - D_80275BC4 = D_80275BBC; - D_80275BD4 = 2; - func_80247CEC(D_80275BCC, 0x25, 2); - var_s0 = (arg0 >= 0x01000000U) ? 0x1C - : (arg0 >= 0x10000U) ? 0x14 - :0xC; - if (var_s0 >= 0) { - do { - func_80247CEC(D_80275BCC, ((s32) arg0 >> var_s0) & 0xF, 2); - var_s0 -= 4; - } while (var_s0 >= 0); - } - func_80248520(); -} - -void func_80248098(f32 arg0) { - f32 var_f22; - s32 var_s0; - - D_80275BC4 = D_80275BBC; - D_80275BD4 = 2; - if (arg0 < 0.0f) { - func_80247CEC(D_80275BCC, 0x26, 2); - arg0 *= -1.0f; - } - var_f22 = 1e+09; - while((var_f22 >= 10.0f) && (arg0 < var_f22)) { - var_f22 /= 10.0f; - } - while (1e-09 <= var_f22) { - if ((0.09 < var_f22) && (var_f22 < 0.11)) { - func_80247CEC(D_80275BCC, 0x24, 2); - } - - var_s0 = 0; - while (var_f22 <= arg0) { - arg0 -= var_f22; - var_s0 += 1; - } - func_80247CEC(D_80275BCC, var_s0, 2); - var_f22 /= 10.0f; - } - func_80248520(); -} - -//letter to font index??? -s32 func_8024824C(s32 arg0) { - //lowercase_letter - if ((arg0 >= (s32) D_80275BE8[0]) && ((s32) D_80275BE8[1] >= arg0)) { - return (arg0 - D_80275BE8[0]) + 0xA; - } - - //uppercase_letter - if ((arg0 >= (s32) D_80275BE8[2]) && ((s32) D_80275BE8[3] >= arg0)) { - return (arg0 - D_80275BE8[2]) + 0xA; - } - - //number - if ((arg0 >= (s32) D_80275BE8[4]) && ((s32) D_80275BE8[5] >= arg0)) { - return (arg0 - D_80275BE8[4]); - } - - //. - if (arg0 == D_80275BE8[6]) { - return 0x24; - } - - //: - if (arg0 == D_80275BE8[7]) { - return 0x25; - } - - //- - if (arg0 == D_80275BE8[8]) { - return 0x26; - } - // - if (arg0 == D_80275BE8[9]) { - return 0x27; - } - return 0x27; -} - - -void func_80248330(u8 *arg0){ - s32 i; - s32 var_v0; - - D_80275BC4 = D_80275BBC; - D_80275BD4 = 2; - for(i = 0; arg0[i] != 0; i++){ - var_v0 = arg0[i]; - func_80247CEC(D_80275BCC, func_8024824C(var_v0), 2); - } - func_80248520(); -} - - -void func_802483B8(void){ - D_80275BD0 = 1; - do{}while(1); -} - -void func_802483D8(void){ - s32 i; - D_80275BD0 = 1; - for(i = 30000000; i != 0; i--){} - D_80275BD0 = 0; -} - -void func_80248404(s32 arg0){ - s32 i; - - D_80275BD0 = 1; - while(arg0 != 0){ - for(i = 30000000; i != 0; i--){} - arg0--; - } - D_80275BD0 = 0; -} - -void func_80248444(s32 arg0) { - D_80275BC8 += arg0; - if (D_80275BC8 >= 0xCD) { - D_80275BBC = D_80275BDC + 4; - D_80275BC4 = D_80275BBC; - D_80275BC8 = (D_80275BD8 < D_80275BC4) ? 0xA : D_80275BC0; - D_80275BDC = 0; - } -} - -void func_802484D0(void){ - func_80248444( D_80275BD4*5 + 2); -} - -void func_80248500(void){ - func_80248444(2); -} - -void func_80248520(void){ - func_8024856C(); - if(D_80275BC4 >= D_80275BDC){ - D_80275BDC = D_80275BC4; - } - func_802484D0(); -} - -void func_8024856C(void) { - s16 sp1E; - s16 temp_v0; - - sp1E = D_80275BC4--; - func_80247CEC(D_80275BCC, 0x27, D_80275BD4); - D_80275BC4 = sp1E; -} - - -s32 func_802485BC(void){ - return D_80275BD0; -} - -void func_802485C8(UNK_TYPE(s32) arg0){ - -} -#endif diff --git a/src/core1/code_CE60.c b/src/core1/code_CE60.c index 51b736a7..12d6216b 100644 --- a/src/core1/code_CE60.c +++ b/src/core1/code_CE60.c @@ -80,10 +80,10 @@ void core1_ce60_func_8024AAB0(void) { sTrackId[2] = sTrackId[3] = COMUSIC_0_DING_A; if (0 <= sTrackId[0]) - sTrackId[2] = func_80250034(sTrackId[0]); + sTrackId[2] = gcMusic_getDefaultVolumeForTrack(sTrackId[0]); if (0 <= sTrackId[1]) - sTrackId[3] = func_80250034(sTrackId[1]); + sTrackId[3] = gcMusic_getDefaultVolumeForTrack(sTrackId[1]); switch (map_get()) { case MAP_7_TTC_TREASURE_TROVE_COVE: @@ -160,7 +160,7 @@ void core1_ce60_func_8024ADF0(bool arg0) { func_8025A104(sTrackId[0], sTrackId[2]); if (0 < sTrackId[1] && 0 < sTrackId[3]) - func_8025A6CC(sTrackId[1], sTrackId[3]); + coMusicPlayer_playMusicWeak(sTrackId[1], sTrackId[3]); } void core1_ce60_func_8024AE74(void) { @@ -588,7 +588,7 @@ void core1_ce60_func_8024AF48(void) { break; case MAP_91_FILE_SELECT: - if (!func_802C5A30()) { + if (!gameSelect_getGameNumber()) { core1_ce60_setChanMaskWithValue(0x200, 0.5f); } else { core1_ce60_setChanMaskWithValue(0x1ff, 0.5f); diff --git a/src/core1/debugtext.c b/src/core1/debugtext.c new file mode 100644 index 00000000..e5e2efad --- /dev/null +++ b/src/core1/debugtext.c @@ -0,0 +1,493 @@ +#include +#include "core1/core1.h" +#include "functions.h" +#include "variables.h" + +#include "version.h" + +#if VERSION == VERSION_USA_1_0 + +/* .data */ +u8 RGB_VALUES[8][3] = { + {0xFF, 0x00, 0x00}, // Red + {0x00, 0xFF, 0x00}, // Green + {0x00, 0x00, 0xFF}, // Blue + {0xFF, 0xFF, 0x00}, // Yellow + {0xFF, 0x00, 0xFF}, // Pink + {0xFF, 0xFF, 0xFF}, // White + {0xFF, 0x80, 0x00}, // Orange + {0x00, 0xFF, 0xFF} // Cyan +}; + +s32 red = 0xFF; +s32 green = 0xFF; +s32 blue = 0xFF; + +// Orders the above RGB values: Green, Cyan, Yellow, Pink, Red, Orange, White, Red. +// Curiously, blue is missing. No idea why there's an intermediary to the RGB values! +u8 COLOR_SELECTOR[] = { 1, 7, 3, 4, 0, 6, 5, 0 }; + +// Each pair of 2 values here corresponds to the width of a character and the "encoding" of a character so it can draw +u32 CHARACTER_ENCODING[] = { + 3, 0x0F6DE000, // 0 + 1, 0x0F800000, // 1 + 3, 0x0C4AE000, // 2 + 3, 0x0E59E000, // 3 + 4, 0x088AF200, // 4 + 3, 0x0F39E000, // 5 + 3, 0x0F3DE000, // 6 + 3, 0x0E4A4000, // 7 + 3, 0x0F7DE000, // 8 + 3, 0x0F79E000, // 9 + 3, 0x0F6FA000, // A + 3, 0x0D75C000, // B + 3, 0x0F24E000, // C + 3, 0x0D6DC000, // D + 3, 0x0F34E000, // E + 3, 0x0F348000, // F + 3, 0x0F25E000, // G + 3, 0x0B7DA000, // H + 3, 0x0E92E000, // I + 3, 0x0E928000, // J + 3, 0x0B75A000, // K + 3, 0x0924E000, // L + 5, 0x08EEB188, // M + 4, 0x09DFB900, // N + 4, 0x06999600, // O + 3, 0x0F7C8000, // P + 4, 0x069DB700, // Q + 3, 0x0F7EA000, // R + 3, 0x0F39E000, // S + 3, 0x0E924000, // T + 4, 0x09999600, // U + 5, 0x08C62A20, // V + 5, 0x08C63550, // W + 3, 0x0B55A000, // X + 3, 0x0B79E000, // Y + 4, 0x0F124F00, // Z + 1, 0x00800000, // . + 1, 0x05000000, // : + 3, 0x00380000, // - + 2, 0x00000000 // +}; + +s16 startingXCoordinate = 0; +s16 largeYCoordinate = 0; +s16 cursorPosition = 0; +s16 startingYCoordinate = 0; +s16 currentColor = 0; +s16 isThreadLocked = FALSE; +s16 currentFontSize = 0; // "Font size", but really it's closer to pixel size +s16 largeValueCursorPosition = 0; +s16 longestLineLengthPosition = 0; + u8 shouldClearText = FALSE; +s32 clearTime = 0; + +char CHARACTER_RANGE[] = { 'a','z','A','Z','0','9','.',':', '-', ' ' }; + +/* .h */ +void gcdebugText_wrapToTop(void); +void gcdebugText_printSpace(void); +void gcdebugText_endLine(void); + +/* code */ +void setRGB(s32 r, s32 g, s32 b) { + red = r; + green = g; + blue = b; +} + +void setPixelInFrameBuffer(s32 x, s32 y) { + if (((x >= 0) && (x < gFramebufferWidth)) + && ((y >= 0) && (y < gFramebufferHeight))) { + + gFramebuffers[0][x + y * gFramebufferWidth] = _SHIFTL(red >> 3, 11, 5) | _SHIFTL(green >> 3, 6, 5) | _SHIFTL(blue >> 3, 1, 5) | _SHIFTL(1, 0, 1); + gFramebuffers[1][x + y * gFramebufferWidth] = _SHIFTL(red >> 3, 11, 5) | _SHIFTL(green >> 3, 6, 5) | _SHIFTL(blue >> 3, 1, 5) | _SHIFTL(1, 0, 1); + } +} + +// Starts the drawing of the pixel at the x and y coordinates, and continues drawing until the w and h coordinates +void drawPixel(s32 x, s32 y, s32 w, s32 h) { + s32 iy; + s32 ix; + + for (ix = 0; ix < w; ix++) { + for (iy = 0; iy < h; iy++) { + setPixelInFrameBuffer(x + ix, y + iy); + } + } + + osWriteBackDCacheAll(); +} + +// Sets the color and draws a square +void drawSquare(s32 r, s32 g, s32 b) { + setRGB(r, g, b); + drawPixel((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100); +} + +void gcdebugText_empty(void) { } + +// Wastes time, and doesn't trigger isThreadLocked +void gcdebugText_stallOnThread(void) { + s32 i; + for (i = 0; i < 2000000; i++) { + gcdebugText_empty(); + } +} + +// Flashes a colored square in the middle of the screen permanently +void gcdebugText_flashSquare(s32 color) { + do { + drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]); + gcdebugText_stallOnThread(); + drawSquare(0, 0, 0); + gcdebugText_stallOnThread(); + } while (TRUE); +} + +// Draws a colored square in the middle of the screen and replaces it with black +void gcdebugText_drawSquare(s32 color) { + drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]); + gcdebugText_stallOnThread(); + drawSquare(0, 0, 0); + gcdebugText_stallOnThread(); +} + +// Draws a square, but doesn't replace with black and doesn't hold it on screen +void gcdebugText_drawSquareOnly(s32 color) { + drawSquare(RGB_VALUES[color][0], RGB_VALUES[color][1], RGB_VALUES[color][2]); +} + +// Draws the character and the background. +// keepCursor: When true, does not advance to the next character and keeps an imaginary "cursor" in place before drawing the next +// setBackgroundColorBlack: When true, sets the color to black for the background. Kind of just draws boxes otherwise +void drawCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize, s32 keepCursor, bool setBackgroundColorBlack, s32 r, s32 g, s32 b) { + s32 j; + s32 i; + u32 char_width; + u32 encoding; + s32 y_position; + u32 encoding_mask; + u32 *encoding_ptr = CHARACTER_ENCODING + (displayCharacter * 2); + + encoding_mask = 0x10000000; + char_width = encoding_ptr[0]; + encoding = encoding_ptr[1]; + + for (i = 0; i < 5; i++) { // For each column; the height of these characters is 5 "pixels" + y_position = i * fontSize; + for (j = 0; j != char_width; j++) { + encoding_mask >>= 1; // Bitwise right shift 1 + if (encoding & encoding_mask) { + setRGB(r, g, b); + drawPixel((cursorPosition + fontSize * j) - keepCursor, + (startingYCoordinate + y_position) - keepCursor, + (fontSize + keepCursor) + keepCursor, + (fontSize + keepCursor) + keepCursor); + } else { + if (setBackgroundColorBlack != 0) { // Set color to black for the background + setRGB(0, 0, 0); + } + + drawPixel((cursorPosition + fontSize * j) - keepCursor, + (startingYCoordinate + y_position) - keepCursor, + (fontSize + keepCursor) + keepCursor, + (fontSize + keepCursor) + keepCursor); + } + } + } + + // Advance to the next character + if (keepCursor == 0) { + cursorPosition += (char_width * fontSize) + 2; + } +} + +// Seems unneeded, since text is cleared anyway +void gcdebugText_clearText(void) { + s32 i; + + if (clearTime == 0) { + clearTime = globalTimer_getTime(); + return; + } + + if (globalTimer_getTime() != clearTime) { + shouldClearText = FALSE; + clearTime = globalTimer_getTime(); + } + + if (shouldClearText) { + for (i = 0; i < gFramebufferWidth * gFramebufferHeight; i++) { + gFramebuffers[0][i] = 0; + gFramebuffers[1][i] = 0; + } + osWriteBackDCacheAll(); + } +} + +// Draw both the character and the background +void printCharacter(s32 colorSelect, s32 displayCharacter, s32 fontSize) { + drawCharacter(colorSelect, displayCharacter, fontSize, TRUE, TRUE, 0, 0, 0); + drawCharacter(colorSelect, displayCharacter, fontSize, FALSE, TRUE, + RGB_VALUES[COLOR_SELECTOR[colorSelect]][0], + RGB_VALUES[COLOR_SELECTOR[colorSelect]][1], + RGB_VALUES[COLOR_SELECTOR[colorSelect]][2]); +} + +void printValue(s32 colorSelect, s32 displayValue, s32 fontSize) { + s32 j, i; + + cursorPosition = startingXCoordinate; + currentFontSize = fontSize; + + if (displayValue < 0) { + printCharacter(colorSelect, 0x26, fontSize); // Print - character + displayValue *= -1; // Convert to positive for the next calculation + } + + // Sets i to a power of 10 with length equal to the given. + // IE: 150 sets i to 100, 3500 sets i to 1000 + for (i = 1000000000; i >= 10 && displayValue < i; i /= 10) { + continue; + } + + // Print each individual digit in the given value + for (i = i; i >= 10; i /= 10) { + for (j = 0; displayValue >= i; j++) { + displayValue -= i; + } + + printCharacter(colorSelect, j, fontSize); + } + + printCharacter(colorSelect, displayValue, fontSize); + gcdebugText_printSpace(); + + if (fontSize == 7) { // Corresponds to largeValue + largeValueCursorPosition = cursorPosition; + longestLineLengthPosition = 0; + } else if (cursorPosition >= longestLineLengthPosition) { + longestLineLengthPosition = cursorPosition; + } +} + +// Prints a value to the screen, but always in the same place in the upper left. +// Subsequent calls in the same frame will overwrite what's there +void gcdebugText_showLargeValue(s32 colorSelect, s32 displayValue) { + isThreadLocked = FALSE; + currentColor = colorSelect; + startingXCoordinate = 0xE; + startingYCoordinate = 0xA; + printValue(colorSelect, displayValue, 7); + gcdebugText_wrapToTop(); + largeYCoordinate = startingYCoordinate; + longestLineLengthPosition = startingXCoordinate; + shouldClearText = TRUE; +} + +void gcdebugText_showValue(s32 displayValue) { + printValue(currentColor, displayValue, 2); + gcdebugText_wrapToTop(); +} + +// Given a value such as 0x0F64 will print on screen ":0F64" +void gcdebugText_showHexValue(u32 displayValue) { + s32 display_character; + + cursorPosition = startingXCoordinate; + currentFontSize = 2; + printCharacter(currentColor, 0x25, 2); // Print : + display_character = + (displayValue >= 0x01000000U) ? 0x1C + : (displayValue >= 0x10000U) ? 0x14 + : 0xC; + + if (display_character >= 0) { + do { + printCharacter(currentColor, ((s32) displayValue >> display_character) & 0xF, 2); + display_character -= 4; + } while (display_character >= 0); + } + + gcdebugText_endLine(); +} + +// Possibly bugged +void gcdebugText_showFloat(f32 displayValue) { + f32 display_position; + s32 display_character; + + cursorPosition = startingXCoordinate; + currentFontSize = 2; + + // If a negative number, print the - symbol and convert the number to positive + if (displayValue < 0.0f) { + printCharacter(currentColor, 0x26, 2); + displayValue *= -1.0f; + } + + display_position = 1e+09; + + while ((display_position >= 10.0f) && (displayValue < display_position)) { + display_position /= 10.0f; + } + + while (1e-09 <= display_position) { + if ((0.09 < display_position) && (display_position < 0.11)) { + printCharacter(currentColor, 0x24, 2); // . character + } + + display_character = 0; + while (display_position <= displayValue) { + displayValue -= display_position; + display_character += 1; + } + printCharacter(currentColor, display_character, 2); + display_position /= 10.0f; + } + + gcdebugText_endLine(); +} + +// Turns characters into the corresponding number for CHARACTER_ENCODING +s32 encodeCharacter(s32 character) { + + // Lowercase letters + if ((character >= (s32) CHARACTER_RANGE[0]) && ((s32) CHARACTER_RANGE[1] >= character)) { + return (character - CHARACTER_RANGE[0]) + 0xA; + } + + // Uppercase letters + if ((character >= (s32) CHARACTER_RANGE[2]) && ((s32) CHARACTER_RANGE[3] >= character)) { + return (character - CHARACTER_RANGE[2]) + 0xA; + } + + // Numbers + if ((character >= (s32) CHARACTER_RANGE[4]) && ((s32) CHARACTER_RANGE[5] >= character)) { + return (character - CHARACTER_RANGE[4]); + } + + // . + if (character == CHARACTER_RANGE[6]) { + return 0x24; + } + + // : + if (character == CHARACTER_RANGE[7]) { + return 0x25; + } + + // - + if (character == CHARACTER_RANGE[8]) { + return 0x26; + } + + // (space) + if (character == CHARACTER_RANGE[9]) { + return 0x27; + } + + return 0x27; +} + +// Prints text to the screen. Note that it uses the current color value and isn't set here. Example usage: +// u8 str[] = " Banjo Kazooie"; +// gcdebugText_showText(str); +void gcdebugText_showText(u8 *text) { + s32 i; + s32 character; + + cursorPosition = startingXCoordinate; + currentFontSize = 2; + + for (i = 0; text[i] != 0; i++) { + character = text[i]; + printCharacter(currentColor, encodeCharacter(character), 2); + } + + gcdebugText_endLine(); +} + +// Lock up the thread and show what's on the screen permanently. +// Likely used for showing a value and keeping it there. +void gcdebugText_lockScreen(void) { + isThreadLocked = TRUE; + do { } while (1); +} + +// Temporarily stop the thread, presumably to show the value +void gcdebugText_pauseThread(void) { + s32 i; + + isThreadLocked = TRUE; + + for (i = 30000000; i != 0; i--) { } + + isThreadLocked = FALSE; +} + +void gcdebugText_pauseThreadForTime(s32 time) { + s32 i; + + isThreadLocked = TRUE; + + while (time != 0) { + for (i = 30000000; i != 0; i--) { } + time--; + } + + isThreadLocked = FALSE; +} + +void checkYAndgcdebugText_wrapToTop(s32 lineHeight) { + startingYCoordinate += lineHeight; + + // Only continue if the y coordinate is about to go off screen + if (startingYCoordinate < 0xCD) { + return; + } + + // Back the cursor to the top of the screen, and move it to the end of the existing line + startingXCoordinate = longestLineLengthPosition + 4; + cursorPosition = startingXCoordinate; + startingYCoordinate = (largeValueCursorPosition < cursorPosition) ? 0xA : largeYCoordinate; + longestLineLengthPosition = 0; +} + +// Calculate line height and wrap +void gcdebugText_wrapToTop(void) { + checkYAndgcdebugText_wrapToTop(currentFontSize * 5 + 2); +} + +// Unused, but possibly used for very tiny debugs +void gcdebugText_wrapToTopSmall(void) { + checkYAndgcdebugText_wrapToTop(2); +} + +void gcdebugText_endLine(void) { + gcdebugText_printSpace(); + + if (cursorPosition >= longestLineLengthPosition) { + longestLineLengthPosition = cursorPosition; + } + + gcdebugText_wrapToTop(); +} + +void gcdebugText_printSpace(void) { + s16 tempCursorPosition; + + tempCursorPosition = cursorPosition--; + printCharacter(currentColor, 0x27, currentFontSize); + cursorPosition = tempCursorPosition; +} + +s32 gcdebugText_isThreadLocked(void) { + return isThreadLocked; +} + +void gcdebugText_unused(s32 arg0) { } + +#endif diff --git a/src/core1/memory.c b/src/core1/memory.c index e2d65102..4ce2dbeb 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -371,7 +371,7 @@ void *malloc(s32 size){ if(!(v1 = func_80254B84(0))){ if(!func_80254B84(0)) - func_802F1294(); //particleEmitters + pem_freeEmitters(); //particleEmitters if(!func_80254B84(0)) animBinCache_flushStale(1); //persistent anim @@ -462,7 +462,7 @@ void _heap_sortEmptyBlock(EmptyHeapBlock * arg0){ } } -void free(void * ptr){ +void free(void * ptr) { HeapHeader *sPtr; //stack_ptr if(ptr){ diff --git a/src/core1/musicplayer.c b/src/core1/musicplayer.c new file mode 100644 index 00000000..33940f7b --- /dev/null +++ b/src/core1/musicplayer.c @@ -0,0 +1,718 @@ +#include +#include "functions.h" +#include "variables.h" +#include "version.h" + +#include "musicplayer.h" + +#include "core1/core1.h" + +extern func_8024FDDC(u8, s32); + +void func_8025AE50(s32, f32); + +bool func_80250074(u8); +void musicTrack_setVolume(u8, s32); +void func_8024FC1C(u8, s32); +void func_8025AC20(enum comusic_e, s32, s32, f32, char*, s32); +void func_8025AC7C(enum comusic_e, s32, s32, f32, s32 *, char*, s32); +void coMusicPlayer_free(void); +void func_8025A55C(s32, s32, s32); +void func_8025A7DC(enum comusic_e); +void func_8025ABB8(enum comusic_e, s32, s32, s32); +void *freelist_next(FLA **, s32*); + +CoMusic *musicTracks = NULL; // Pointer to the first CoMusic struct. Additional are saved after in memory. The first track is the primary track. +int D_80276E34 = 0; + +/** + * @brief returns a pointer to the CoMusic struct with the corresponding trackId + * if it exists OR the first free CoMusic struct. This also skips the first CoMusic in the search. + * + * @param trackId + * @return CoMusic* + */ +CoMusic *findTrack(enum comusic_e trackId) { + CoMusic *music_track; + CoMusic *free_music_track; + + free_music_track = NULL; + + for (music_track = musicTracks + 1; music_track < musicTracks + MAX_MUSIC_STRUCT_COUNT - 1; music_track++) { + if (trackId == music_track->track_id) { + return music_track; + } + + if (free_music_track == NULL && (s32) music_track->track_id < 0) { + free_music_track = music_track; + } + } + + return free_music_track; +} + +void func_80259914(CoMusic *this, s32 arg1, s32 arg2) { + s32 sp2C; + s32 i; + struct12s *tmp; + + freelist_clear(this->unk18); + + for (i = 0; i < 0xE; i++) { + this->unk1C[i] = 0; + } + + tmp = (struct12s *)freelist_next(&this->unk18, &sp2C); + tmp->unk0 = arg1; + tmp->unk1 = arg2; +} + +void func_80259994(CoMusic *this, s32 arg1){ + func_80259914(this, arg1, arg1); +} + +void func_802599B4(CoMusic *this){ + func_80259994(this, gcMusic_getDefaultVolumeForTrack(this->track_id)); + + this->track_id = -1; + this->unk14 = 0; + this->unk15 = 0; + + func_8024FC1C(this - musicTracks, -1); +} + +void coMusicPlayer_init(void) { + CoMusic * iPtr; + s32 i; + + if (musicTracks != NULL) { + coMusicPlayer_free(); + } + + musicTracks = (CoMusic *) malloc(MAX_MUSIC_STRUCT_COUNT * sizeof(CoMusic)); + for (iPtr = musicTracks; iPtr < musicTracks + MAX_MUSIC_STRUCT_COUNT; iPtr++) { + iPtr->track_id = -1; + iPtr->volume = 0; + iPtr->unk12 = 0; + iPtr->unkC = 0; + iPtr->unk4 = 0.0f; + iPtr->unk14 = 0; + iPtr->unk15 = 0; + iPtr->unk0 = 0.0f; + iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_new(sizeof(struct12s),4); + + for (i = 0; i < 0xE; i++) { + iPtr->unk1C[i] = 0; + } + } +} + +void coMusicPlayer_free(void){ + CoMusic *iPtr; + + func_8024FB8C(); + func_8024F83C(); + + for (iPtr = musicTracks; iPtr < musicTracks + MAX_MUSIC_STRUCT_COUNT; iPtr++) { + freelist_free(iPtr->unk18); + } + + free(musicTracks); + musicTracks = NULL; +} + +s32 coMusicPlayer_getTrackCount(void) { + CoMusic *track; + s32 count = 0; + + for (track = musicTracks; track < musicTracks + MAX_MUSIC_STRUCT_COUNT; track++) { + if (track->track_id >= 0) { + count++; + } + } + + return count; +} + +void coMusicPlayer_update(void) { + s32 temp_lo; + CoMusic *var_s0; + f32 dt; + + dt = time_getDelta(); + + for (var_s0 = musicTracks; var_s0 < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; var_s0++) { + if (var_s0->track_id >= 0) { + temp_lo = var_s0 - musicTracks; + var_s0->unk4 = ml_min_f(var_s0->unk4 + dt, 600.0f); + + if ((var_s0->unk4 > 1.0f) && func_80250074(temp_lo)) { + func_8025A7DC(var_s0->track_id); + } + } + } + + func_8024FF34(); + + if (!D_80276E34) { + return; + } + + D_80276E34 = FALSE; + + for (var_s0 = musicTracks; var_s0 < &musicTracks[6]; var_s0++) { + if (var_s0->track_id < 0) { + continue; + } + + if (var_s0->unk12 != 0) { + temp_lo = var_s0 - musicTracks; + + if (var_s0->unk0 > 0.0f) { + var_s0->unk0 -= time_getDelta(); + D_80276E34 = TRUE; + continue; + } + + if (var_s0->unk12 < 0) { + var_s0->volume += var_s0->unk12; + + if (var_s0->unk15 && (var_s0->unkC == 0) && (var_s0->volume <= 0)) { + func_802599B4(var_s0); + continue; + } else { + if (var_s0->unkC >= var_s0->volume) { + var_s0->volume = var_s0->unkC; + var_s0->unk12 = 0; + } else { + D_80276E34 = TRUE; + } + musicTrack_setVolume(temp_lo, (s16)var_s0->volume); + } + + continue; + } + + if (var_s0->volume < var_s0->unkC) { + if (var_s0->volume == 0) { + var_s0->unk4 = 0.0f; + } + var_s0->volume += var_s0->unk12; + if (var_s0->volume >= var_s0->unkC) { + var_s0->volume = var_s0->unkC; + var_s0->unk12 = 0; + } else { + D_80276E34 = TRUE; + } + musicTrack_setVolume(temp_lo, (s16)var_s0->volume); + + continue; + } + + var_s0->unk12 = 0; + } + } +} + +void func_80259EA8(CoMusic *this, s32 *arg1, s32 *arg2){ + int i; + int cnt = freelist_size(this->unk18); + s32 tmp_s1 = 0x7FFF; + s32 tmp_s2 = 0x40000000; + struct12s *tmp_ptr; + + for (i = 1; i < cnt; i++) { + if (freelist_elementIsAlive(this->unk18, i)) { + tmp_ptr = (struct12s*)freelist_at(this->unk18, i); + + if (tmp_ptr->unk0 < tmp_s1 || (tmp_s1 == tmp_ptr->unk0 && tmp_ptr->unk1 < tmp_s2)) { + tmp_s1 = tmp_ptr->unk0; + tmp_s2 = tmp_ptr->unk1; + }//L80259F40 + } + } + + *arg1 = tmp_s1; + *arg2 = tmp_s2; +} + +void func_80259F7C(CoMusic *self, s32 *arg1, s32 *arg2, s32 *arg3) { + struct12s *temp_v0; + f32 pad; + s32 sp34; + s32 var_s2; + + var_s2 = *arg1; + sp34 = *arg2; + if ((*arg3 != 0) && !freelist_elementIsAlive(self->unk18, *arg3)) { + *arg3 = 0; + } + + if (var_s2 < 0) { + temp_v0 = (struct12s *)freelist_at(self->unk18, 1); + if (temp_v0->unk0 < gcMusic_getDefaultVolumeForTrack(self->track_id)) { + var_s2 = gcMusic_getDefaultVolumeForTrack(self->track_id); + } else { + var_s2 = temp_v0->unk0; + } + + if (*arg3 != 0) { + temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3); + *arg2 = temp_v0->unk1; + freelist_freeElement(self->unk18, *arg3); + *arg3 = 0; + func_80259EA8(self, arg1, &sp34); + + return; + } + } + + if (*arg3 == 0) { + temp_v0 = (struct12s *)freelist_at(self->unk18, 1); + if ((temp_v0->unk0 < var_s2) || ((var_s2 == temp_v0->unk0) && (sp34 >= temp_v0->unk1))) { + func_80259914(self, var_s2, sp34); + } else { + freelist_next(&self->unk18, arg3); + } + } + + if (*arg3 != 0) { + temp_v0 = (struct12s *)freelist_at(self->unk18, *arg3); + temp_v0->unk0 = var_s2; + temp_v0->unk1 = sp34; + } + + func_80259EA8(self, arg1, arg2); +} + +void func_8025A104(enum comusic_e arg0, s32 arg1){ + if (arg0 != musicTracks[0].track_id){ + func_8024FC1C(0, arg0); + } + + musicTrack_setVolume(0, (s16)arg1); + musicTracks[0].track_id = (s16) arg0; + musicTracks[0].volume = arg1; + musicTracks[0].unk0 = 0.0f; + musicTracks[0].unk12 = 0; + musicTracks[0].unk4 = 0.0f; + musicTracks[0].unk15 = 0; + func_80259994(&musicTracks[0], arg1); +} + +void func_8025A1A8(enum comusic_e arg0){ + if (arg0 == musicTracks[0].track_id) { + return; + } + + func_8024FC1C(0, arg0); + + musicTracks[0].track_id = (s16) arg0; + musicTracks[0].volume = gcMusic_getDefaultVolumeForTrack(arg0); + musicTracks[0].unk0 = 0.0f; + musicTracks[0].unk12 = 0; + musicTracks[0].unk4 = 0.0f; + musicTracks[0].unk15 = 0; + + func_80259994(&musicTracks[0], musicTracks[0].volume); +} + +void func_8025A23C(s32 arg0){ + CoMusic *music = &musicTracks[5]; + s32 temp_v0; + + if (arg0 == music->track_id){ + return; + } + + func_8024FC1C(5, arg0); + music->track_id = (s16) arg0; + temp_v0 = gcMusic_getDefaultVolumeForTrack(arg0); + music->volume = temp_v0; + music->unk12 = 0; + music->unk15 = 0; + music->unk0 = 0.0f; + music->unk4 = 0.0f; + func_80259994(music, temp_v0); +} + +void func_8025A2B0(void) { + func_802599B4(&musicTracks[5]); +} + +void func_8025A2D8(void) { + func_802599B4(&musicTracks[0]); +} + +void func_8025A2FC(s32 arg0, s32 arg1){ + s32 i; + + func_8025A55C(arg0, arg1, 1); + for (i = 1; i < 5; i++){ + s16 val = (i + musicTracks)->track_id; // Doesn't match with musicTracks[i] + if (val >= 0){ + func_8025ABB8(val, arg0, arg1, 1); + } + } +} + +void func_8025A388(s32 arg0, s32 arg1) { + s32 i; + + if (musicTracks->unk14 == 0){ + func_8025A55C(arg0, arg1, 1); + } + + for (i = 1; i < 5; i++) { + CoMusic *current = (i + musicTracks); // Doesn't match with musicTracks[i] + + if (current->track_id >= 0 && current->unk14 == 0) { + func_8025ABB8(current->track_id, arg0, arg1, 1); + } + } +} + +void func_8025A430(s32 arg0, s32 arg1, s32 arg2){ + s32 i; + + func_8025A55C(arg0, arg1, arg2); + + for (i = 1; i < 5; i++) { + s16 val = (i + musicTracks)->track_id; // Doesn't match with musicTracks[i] + + if (val >= 0) { + func_8025ABB8(val, arg0, arg1, arg2); + } + } +} + +void func_8025A4C4(s32 arg0, s32 arg1, s32 *arg2) { + if (musicTracks[0].track_id < 0) { + return; + } + + func_80259F7C(&musicTracks[0], &arg0, &arg1, arg2); + + if (arg0 != musicTracks[0].volume) { + if (musicTracks[0].volume < arg0) { + musicTracks[0].unk12 = arg1; + } else { + musicTracks[0].unk12 = -arg1; + } + + musicTracks[0].unkC = arg0; + D_80276E34 = 1; + } +} + +void func_8025A55C(s32 arg0, s32 arg1, s32 arg2) { + func_8025A4C4(arg0, arg1, &musicTracks->unk1C[arg2]); +} + +void func_8025A58C(s32 arg0, s32 arg1) { + func_8025A55C(arg0, arg1, 0); +} + +void playMusic(enum comusic_e comusic_id, s32 volume, s32 forceReInit) { + CoMusic *track; + s32 index; + + if (volume == -1) { + volume = gcMusic_getDefaultVolumeForTrack(comusic_id); + } + + track = findTrack(comusic_id); + + if (track == NULL) { + return; + } + + index = track - musicTracks; + + // Initialize the track if findTrack returned an empty + if (track->track_id < 0 || forceReInit) { + switch (comusic_id) { + case COMUSIC_15_EXTRA_LIFE_COLLECTED: + if (map_get() == MAP_10_BGS_MR_VILE) { + break; + } + case COMUSIC_3B_MINIGAME_VICTORY: + case COMUSIC_3C_MINIGAME_LOSS: + func_8025AE50(4000, 2.0f); + } + + track->track_id = comusic_id; + track->unk12 = 0; + track->unk15 = 0; + track->unk4 = 0.0f; + func_80259994(track, volume); + func_8024FC1C(index, comusic_id); + } + + musicTrack_setVolume(index, (s16) volume); + track->volume = volume; +} + +// If findTrack returns the track, then do not re-initialize; just adust the volume +void coMusicPlayer_playMusicWeak(enum comusic_e track_id, s32 volume) { + playMusic(track_id, volume, FALSE); +} + +// Plays the track and reinitializes it +void coMusicPlayer_playMusic(enum comusic_e track_id, s32 volume) { + playMusic(track_id, volume, TRUE); +} + +//comusic_queueTrack +void comusic_playTrack(enum comusic_e track_id) { + CoMusic *trackPtr; + s32 indx; + + trackPtr = findTrack(track_id); + + if (trackPtr == NULL) { + return; + } + + indx = trackPtr - musicTracks; + + if (trackPtr->track_id < 0) { + trackPtr->track_id = track_id; + trackPtr->unk12 = 0; + trackPtr->unk4 = 0.0f; + func_8024FC1C( indx, track_id); + func_80259994(trackPtr, trackPtr->volume = gcMusic_getDefaultVolumeForTrack(track_id)); + } +} + +void func_8025A788(enum comusic_e comusic_id, f32 delay1, f32 delay2) { + timedFunc_set_1(delay1, (GenFunction_1) comusic_playTrack, comusic_id); + timedFunc_set_1(delay1 + delay2, (GenFunction_1) func_8025A7DC, comusic_id); +} + +void func_8025A7DC(enum comusic_e track_id) { + CoMusic *trackPtr; + + trackPtr = findTrack(track_id); + + if (trackPtr != NULL && trackPtr->track_id >= 0){ + func_802599B4(trackPtr); + } +} + +s32 func_8025A818(void) { + if (musicTracks[0].unkC == 0 && musicTracks[0].volume <= 0){ + func_802599B4(&musicTracks[0]); + return 1; + } + + return 0; +} + +s32 func_8025A864(enum comusic_e track_id){ + CoMusic *trackPtr; + + trackPtr = findTrack(track_id); + + if (trackPtr != NULL && trackPtr->unkC == 0 && trackPtr->volume <= 0){ + func_802599B4(trackPtr); + return 1; + } + + return 0; +} + +void func_8025A8B8(enum comusic_e track_id, s32 arg1){ + CoMusic *trackPtr; + + trackPtr = findTrack(track_id); + + if (trackPtr != NULL){ + trackPtr->unk14 = arg1; + } +} + +void func_8025A8E4(s32 arg0) { + if (musicTracks[0].track_id < 0) { + return; + } + + musicTracks[0].unk14 = arg0; +} + +void func_8025A904(void){ + CoMusic *trackPtr = &musicTracks[0]; + + while (trackPtr < &musicTracks[6]) { + if (trackPtr->track_id >= 0) { + func_802599B4(trackPtr); + } + + trackPtr++; + } +} + +//dequeue_allTracks +void func_8025A96C(void){ + CoMusic *iPtr; + + for (iPtr = &musicTracks[1]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) { + if (iPtr->track_id >= 0) { + func_802599B4(iPtr); + } + } +} + +//dequeue_allTracks +void func_8025A9D4(void){ + CoMusic *iPtr; + + for (iPtr = &musicTracks[0]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) { + if (iPtr->track_id >= 0 && !iPtr->unk14) { + func_802599B4(iPtr); + } + } +} + +//dequeue_nonmainTracks +void func_8025AA48(void){ + CoMusic *iPtr; + + for (iPtr = &musicTracks[1]; iPtr < &musicTracks[6]; iPtr++) { + if (iPtr->track_id >= 0 && !iPtr->unk14) { + func_802599B4(iPtr); + } + } +} + +//dequeue_track? +void func_8025AABC(enum comusic_e track_id) { + CoMusic *trackPtr; + + trackPtr = findTrack(track_id); + + if (!trackPtr) { + return; + } + + trackPtr->unk15 = 1; + + if (!trackPtr->volume) { + func_802599B4(trackPtr); + } +} + +void func_8025AB00(void) { + musicTracks[0].unk15 = 1; + + if (musicTracks[0].volume){ + return; + } + + func_802599B4(&musicTracks[0]); +} + +void comusic_8025AB44(enum comusic_e comusic_id, s32 arg1, s32 arg2){ + func_8025AC20(comusic_id, arg1, arg2, 0.0f, "comusic.c", VER_SELECT(0x39e, 0x39f, 0, 0)); +} + +void comusic_8025AB78(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ + func_8025AC7C(comusic_id, arg1, arg2, 0.0f, arg3, "comusic.c", VER_SELECT(0x3a3, 0x3a4, 0, 0)); +} + +void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3){ + func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32)&(findTrack(comusic_id)->unk1C[arg3]), "comusic.c", VER_SELECT(0x3aa, 0x3ab,0,0)); +} + +void func_8025AC20(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, char* arg4, s32 char5){ + func_8025AC7C(comusic_id, arg1, arg2, 0.0f, (s32) findTrack(comusic_id)->unk1C, "comusic.c", VER_SELECT(0x3b1, 0x3b2,0,0)); +} + +void func_8025AC7C(enum comusic_e comusic_id, s32 arg1, s32 arg2, f32 arg3, s32 *arg4, char* arg5, s32 arg6){ + CoMusic *trackPtr; + u32 slot_index; + + //get track location + trackPtr = findTrack(comusic_id); + if(trackPtr == NULL) + return; + + //check if track is loaded in slot + if(trackPtr->track_id < 0){ //Track not loaded + if(arg1 == 0) + return; + slot_index = (trackPtr - musicTracks); + func_8024FC1C(slot_index, comusic_id); + trackPtr->track_id = comusic_id; + trackPtr->volume = 0; + trackPtr->unk15 = 0; + trackPtr->unk4 = 0.0f; + func_80259994(trackPtr, 0); + musicTrack_setVolume(slot_index, 0); + } + func_80259F7C(trackPtr,&arg1, &arg2, arg4); + trackPtr->unk0 = arg3; + trackPtr->unk12 = (trackPtr->volume < arg1)? arg2: -arg2; + trackPtr->unkC = arg1; + D_80276E34 = 1; +} + +//comusic_trackQueued +int func_8025AD7C(enum comusic_e arg0) { + CoMusic * trackPtr = findTrack(arg0); + return (trackPtr == NULL || trackPtr->track_id == -1)? 0 : 1; +} + +//comusic_isPrimaryTrack +int func_8025ADBC(enum comusic_e arg0) { + return musicTracks[0].track_id == arg0; +} + +s32 func_8025ADD4(enum comusic_e id) { + CoMusic * ptr = findTrack(id); + return ptr - musicTracks; +} + +void func_8025AE0C(s32 arg0, f32 arg1) { + func_8025A58C(0, arg0); + timedFunc_set_2(arg1, (GenFunction_2)func_8025A58C, -1, arg0); +} + +void func_8025AE50(s32 arg0, f32 arg1) { + func_8025A430(0, arg0, 6); + timedFunc_set_3(arg1, (GenFunction_3)func_8025A430, -1, arg0, 6); +} + +void func_8025AEA0(enum comusic_e track_id, s32 arg1) { + CoMusic *ptr = findTrack(track_id); + + if (!ptr) { + return; + } + + func_8024FDDC(ptr - musicTracks, arg1); +} + +int func_8025AEEC(void) { + s32 out = func_802501A0(0, 0x6A, 0); + + if (out) { + func_80250170(0, 0x6A, 0); + } + + return out; +} + +void comusic_defrag(void) { + CoMusic *iPtr; + + if (!musicTracks) { + return; + } + + for (iPtr = &musicTracks[0]; iPtr < &musicTracks[MAX_MUSIC_STRUCT_COUNT]; iPtr++) { + iPtr->unk18 = (FREE_LIST(struct12s) *)freelist_defrag(iPtr->unk18); + } + + musicTracks = (CoMusic *)defrag(musicTracks); +} diff --git a/src/core1/musicplayer.h b/src/core1/musicplayer.h new file mode 100644 index 00000000..2d01858f --- /dev/null +++ b/src/core1/musicplayer.h @@ -0,0 +1 @@ +#define MAX_MUSIC_STRUCT_COUNT 6 \ No newline at end of file diff --git a/src/core1/pfsmanager.c b/src/core1/pfsmanager.c index bf828f18..a9005057 100644 --- a/src/core1/pfsmanager.c +++ b/src/core1/pfsmanager.c @@ -94,7 +94,7 @@ s32 func_8024E5E8(s32 arg0, s32 arg1){ return D_802810E0[arg0][arg1]; } -s32 func_8024E60C(s32 controller_index, s32 dst[3]){ +s32 controller_copySideButtons(s32 controller_index, s32 dst[3]){ dst[SIDE_BUTTON(BUTTON_Z)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_Z)]; dst[SIDE_BUTTON(BUTTON_L)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_L)]; dst[SIDE_BUTTON(BUTTON_R)] = D_80281138[controller_index].side_button[SIDE_BUTTON(BUTTON_R)]; diff --git a/src/core1/vimgr.c b/src/core1/vimgr.c index f10fc96d..9a6538da 100644 --- a/src/core1/vimgr.c +++ b/src/core1/vimgr.c @@ -226,7 +226,7 @@ void viMgr_entry(void *arg0){ D_802808D8++; if(D_802808D8 == 420){ #if VERSION == VERSION_USA_1_0 - func_802485BC(); + gcdebugText_isThreadLocked(); #endif } osSendMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK); diff --git a/src/core2/abilityprogress.c b/src/core2/abilityprogress.c index 535368ca..e6eb89e4 100644 --- a/src/core2/abilityprogress.c +++ b/src/core2/abilityprogress.c @@ -2,120 +2,133 @@ #include "functions.h" #include "variables.h" -s32 abilityprogress_learnedAbilities; -s32 abilityprogress_usedAbilities; +#include "core2/abilityprogress.h" -void ability_use(s32 arg0){ - s32 sp2C; - s32 sp28; +// Special note: The learned abilities and used abilities IDs are different! - sp2C = 0; - sp28 = 1; +s32 learnedAbilities; +s32 usedAbilities; - if(abilityprogress_usedAbilities & (1 << arg0)) +void ability_use(enum ability_used ability) { + s32 dialog_id; + bool play_ding; + + dialog_id = 0; + play_ding = TRUE; + + // Has this ability been used before? + if (usedAbilities & (1 << ability)) { return; + } - switch(arg0){ - case 0x0://L80295660 //jump - mapSpecificFlags_set(8, TRUE); - sp28 = 1; + switch (ability) { + case ABILITY_USED_JUMP: + mapSpecificFlags_set(SM_SPECIFIC_FLAG_8_ABILITY_HOLD_A_JUMP_HIGHER_UNLOCKED, TRUE); + play_ding = TRUE; break; - case 0x1://L80295674 //flap - mapSpecificFlags_set(9, TRUE); - sp28 = 1; + + case ABILITY_USED_FLAP: + mapSpecificFlags_set(SM_SPECIFIC_FLAG_9_ABILITY_FEATHERY_UNLOCKED, TRUE); + play_ding = TRUE; break; - case 0x2://L80295688 //bust - mapSpecificFlags_set(0xa, TRUE); - sp28 = 1; + + case ABILITY_USED_FLIP: + mapSpecificFlags_set(SM_SPECIFIC_FLAG_A_ABILITY_FLIP_UNLOCKED, TRUE); + play_ding = TRUE; break; - case 0x3://L8029569C // - if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_DFC_DIALOG_UNKNOWN; + + case ABILITY_USED_SWIM: + if (map_get() == MAP_1_SM_SPIRAL_MOUNTAIN) { + dialog_id = ASSET_DFC_BOTTLES_UNDERWATER_TUTORIAL; } break; - case 0x4://L802956B8 // - if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_E02_DIALOG_UNKNOWN; + + case ABILITY_USED_CLIMB: + if (map_get() == MAP_1_SM_SPIRAL_MOUNTAIN) { + dialog_id = ASSET_E02_DIALOG_BOTTLES_CLIMB_OTHER; } break; - case 0x5://L802956D4 //barge - if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_E05_DIALOG_UNKNOWN; + + case ABILITY_USED_BEAK_BARGE: + if (map_get() == MAP_1_SM_SPIRAL_MOUNTAIN) { + dialog_id = ASSET_E05_DIALOG_BOTTLES_KAZOOIE_BARGE; } break; - case 0x6://L802956F0 //slide - sp28 = 0; + + case ABILITY_USED_SLIDE: + play_ding = FALSE; if (!ability_isUnlocked(ABILITY_10_TALON_TROT)) { if (map_get() == MAP_2_MM_MUMBOS_MOUNTAIN) { - sp2C = ASSET_B4D_DIALOG_UNKNOWN; - } - else { + dialog_id = ASSET_B4D_DIALOG_BOTTLES_SLIPPERY; + } else { return; } - } - else { - abilityprogress_usedAbilities |= (1 << arg0); + } else { + usedAbilities |= (1 << ability); } break; - case 0x8://L80295738 //fly - sp2C = ASSET_A26_DIALOG_NEED_RED_FEATHERS_TO_FLY; - break; - case 0x7://L80295740 //egg - case 0x9://L80295740 //shock - break; - }//L80295744 - if (sp28) { + case ABILITY_USED_FLY: + dialog_id = ASSET_A26_DIALOG_NEED_RED_FEATHERS_TO_FLY; + break; + + case ABILITY_USED_EGG: + case ABILITY_USED_SHOCK: + break; + } + + if (play_ding) { comusic_playTrack(COMUSIC_2B_DING_B); } - if (sp2C) { - gcdialog_showText(sp2C, 4, NULL, NULL, NULL, 0); + if (dialog_id) { + gcdialog_showDialog(dialog_id, 4, NULL, NULL, NULL, 0); } - abilityprogress_usedAbilities |= (1 << arg0); + usedAbilities |= (1 << ability); } -int ability_hasUsed(enum ability_e move){ - return (1 << move) & abilityprogress_usedAbilities; +int ability_hasUsed(enum ability_used ability) { + return (1 << ability) & usedAbilities; } -void ability_setHasUsed(enum ability_e move){ - abilityprogress_usedAbilities |= (1 << move); +void ability_setHasUsed(enum ability_used ability) { + usedAbilities |= (1 << ability); } -int ability_hasLearned(enum ability_e move){ - return (1 << move) & abilityprogress_learnedAbilities; +int ability_hasLearned(enum ability_e ability) { + return (1 << ability) & learnedAbilities; } -s32 ability_getAllLearned(void){ - return abilityprogress_learnedAbilities; +s32 ability_getAllLearned(void) { + return learnedAbilities; } -void ability_debug(void){} +void ability_debug(void) { } -void ability_clearAll(void){ - abilityprogress_learnedAbilities = 0; - abilityprogress_usedAbilities = 0; +void ability_clearAll(void) { + learnedAbilities = 0; + usedAbilities = 0; } -void ability_setLearned(s32 move, s32 val){ - if(val){ - abilityprogress_learnedAbilities |= (1 << move); - }else{ - abilityprogress_learnedAbilities &= ~(1 << move); +void ability_setLearned(enum ability_e ability, bool hasLearned) { + if (hasLearned) { + learnedAbilities |= (1 << ability); + } else { + learnedAbilities &= ~(1 << ability); } } -void ability_setAllLearned(s32 val){ - abilityprogress_learnedAbilities = val; +void ability_setAllLearned(s32 val) { + learnedAbilities = val; } -void ability_setAllUsed(s32 val){ - abilityprogress_usedAbilities = val; +void ability_setAllUsed(s32 val) { + usedAbilities = val; } -void ability_getSizeAndPtr(s32 *size, u8 **addr){ +// Gets the size of the bitflags needed and address for which moves have been learned +void ability_getSizeAndPtr(s32 *size, u8 **addr) { *size = 8; - *addr = &abilityprogress_learnedAbilities; + *addr = &learnedAbilities; } diff --git a/src/core2/anseq.c b/src/core2/anseq.c index 76c25f71..f6b15703 100644 --- a/src/core2/anseq.c +++ b/src/core2/anseq.c @@ -54,16 +54,16 @@ void __anSeq_func_80289F4(s32 arg0) { s32 phi_a3; phi_a3 = arg0 >> 0x10; - if( !(phi_a3 == 0xF2 && map_get() == MAP_91_FILE_SELECT && func_802C5A30() != 0) - && !((phi_a3 == 0x21 || phi_a3 == 0x3ED) && map_get() == MAP_91_FILE_SELECT && (func_802C5A30() == 1)) + if( !(phi_a3 == 0xF2 && map_get() == MAP_91_FILE_SELECT && gameSelect_getGameNumber() != 0) + && !((phi_a3 == 0x21 || phi_a3 == 0x3ED) && map_get() == MAP_91_FILE_SELECT && (gameSelect_getGameNumber() == 1)) ){ - func_8030E6A4(phi_a3, (f32) ((f64) ((arg0 >> 8) & 0xFF) * 0.0078125), (s32) ((f64) (arg0 & 0xFF) * 128.0)); + gcsfx_playWithPitch(phi_a3, (f32) ((f64) ((arg0 >> 8) & 0xFF) * 0.0078125), (s32) ((f64) (arg0 & 0xFF) * 128.0)); } } void __anSeq_func_8028AE0(s32 arg0){ - func_8025A6EC((u16) (arg0 >> 16), (u16)arg0 - 1); + coMusicPlayer_playMusic((u16) (arg0 >> 16), (u16)arg0 - 1); } void __anSeq_func_8028B14(enum sfx_e arg0){ diff --git a/src/core2/ba/drone.c b/src/core2/ba/drone.c index 403b48de..36d5d23a 100644 --- a/src/core2/ba/drone.c +++ b/src/core2/ba/drone.c @@ -32,10 +32,10 @@ enum bs_e badrone_enter(void){ return func_8029BD90(); } -enum bs_e badrone_goto(f32 position[3], f32 duration, void (*arg2)(ActorMarker *), ActorMarker *arg3){ +enum bs_e badrone_goto(f32 position[3], f32 duration, void (*callback)(ActorMarker *), ActorMarker *arg3){ ml_vec3f_copy(badrone.position, position); badrone.duration = duration; - badrone.unk14 = arg2; + badrone.unk14 = callback; badrone.unk18 = arg3; badrone_set_type(BA_DRONE_GOTO); return func_8029BD90(); diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index 484da464..e5a73e8c 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -6,6 +6,8 @@ #include "version.h" #include "prop.h" +#include "core2/dustemitter.h" + extern void func_803012F8(void); extern void __baMarker_8028BA00(s32); extern void spawnQueue_actor_s16(void); @@ -14,13 +16,12 @@ extern f32 chwadingboots_802D6E4C(Actor *); extern void set_turbo_duration(f32); extern f32 chtrainers_getDuration(Actor *); extern void func_802EE354(Actor *, s32, s32, s32, f32, f32, f32, f32 arg8[3], s32, f32 arg10[2]); -extern void func_8035644C(s32); -extern void func_8035646C(s32 arg0); +extern void progressDialog_showDialogMaskZero(s32); +extern void progressDialog_showDialogMaskFour(s32 arg0); extern void func_80291634(ActorMarker *, ActorMarker *); extern void func_80291610(ActorMarker *, ActorMarker *); extern Actor *baModel_80291AAC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); extern void baMarker_8028D7B8(s32 arg0, ActorMarker *arg1, struct5Cs *collision_flags); -extern void func_802EE6CC(f32[3], s32, s32[4], s32, f32, f32, s32,s32,s32); extern void func_80320ED8(ActorMarker *, f32, s32); extern NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e actor_id, s32 position[3]); @@ -121,7 +122,7 @@ void __baMarker_8028B848(void){ if(player_getTransformation() == TRANSFORM_1_BANJO){ __baMarker_8028B7F4(); } - gcdialog_showText(s0, 0x2A, NULL, NULL, NULL, 0); + gcdialog_showDialog(s0, 0x2A, NULL, NULL, NULL, 0); } } @@ -159,7 +160,7 @@ void __baMarker_8028B9A8(s32 arg0){ nodeprop_getPosition_s32(tmp_v0, &ideal_yaw); func_802CA1CC(arg0); actor_spawnWithYaw_s32(ACTOR_47_EMPTY_HONEYCOMB, &ideal_yaw, 0); - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } @@ -175,8 +176,8 @@ void __baMarker_resolveMusicNoteCollision(Prop *arg0) { item_adjustByDiffWithoutHud(ITEM_C_NOTE, 1); } if (item_getCount(ITEM_C_NOTE) < 100) { - func_8025A6EC(COMUSIC_9_NOTE_COLLECTED, 16000); - timedFunc_set_1(0.75f, func_8035644C, FILEPROG_3_MUSIC_NOTE_TEXT); + coMusicPlayer_playMusic(COMUSIC_9_NOTE_COLLECTED, 16000); + timedFunc_set_1(0.75f, progressDialog_showDialogMaskZero, FILEPROG_3_MUSIC_NOTE_TEXT); } fxSparkle_musicNote(arg0->unk4); } @@ -332,12 +333,12 @@ void __baMarker_resolveCollision(Prop *other_prop){ case MARKER_F5_BGS_ELEVATED_WALKWAY_SWITCH: //L8028BFB0 if(plyr_hitbox_type == HITBOX_1_BEAK_BUSTER) - __baMarker_8028BAB0(JIGGY_20_BGS_ELEVATED_WALKWAY, 1, 3, 7); + __baMarker_8028BAB0(JIGGY_20_BGS_ELEVATED_WALKWAY, BGS_SPECIFIC_FLAG_1, BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING, BGS_SPECIFIC_FLAG_7); break; case MARKER_FD_BGS_MAZE_SWITCH: //L8028BFD4 if(plyr_hitbox_type == HITBOX_1_BEAK_BUSTER) - __baMarker_8028BAB0(JIGGY_25_BGS_MAZE, 0xa, 0xc, 8); + __baMarker_8028BAB0(JIGGY_25_BGS_MAZE, BGS_SPECIFIC_FLAG_A, BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING, BGS_SPECIFIC_FLAG_8); break; case MARKER_EC_GV_SUN_SWITCH: //L8028BFF8 @@ -352,7 +353,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ if(!mapSpecificFlags_get(0xD)){ mapSpecificFlags_set(0xD, 1); func_8030E6D4(SFX_90_SWITCH_PRESS); - func_802BAFE4(0x14); + gcStaticCamera_activate(0x14); timedFunc_set_1(1.5f, __baMarker_8028BA00, 0xB); } } @@ -363,7 +364,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ if(!mapSpecificFlags_get(0)){ mapSpecificFlags_set(0,1); func_8030E6D4(SFX_90_SWITCH_PRESS); - func_802BAFE4(0x7E); + gcStaticCamera_activate(0x7E); timedFunc_set_1(1.5f, __baMarker_8028BA00, 0xf); } } @@ -403,7 +404,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ * FILEPROG_51_YELLOW_CAULDRON_1_ACTIVE * FILEPROG_52_YELLOW_CAULDRON_2_ACTIVE */ - if(fileProgressFlag_get(((actor->unkF4_8 - 1) ^ 1) + 0x49)){ + if(fileProgressFlag_get(((actor->actorTypeSpecificField - 1) ^ 1) + 0x49)){ actor->unk10_12 = 2; } else{ @@ -572,8 +573,8 @@ void __baMarker_resolveCollision(Prop *other_prop){ if(sp98 != HONEYCOMB_12_MMM_FLOORBOARD || player_getTransformation() == TRANSFORM_3_PUMPKIN) { honeycombscore_set(sp98, 1); - func_8025A6EC(COMUSIC_17_EMPTY_HONEYCOMB_COLLECTED, 28000); - timedFunc_set_1(2.0f, func_8035644C, FILEPROG_B_EMPTY_HONEYCOMB_TEXT); + coMusicPlayer_playMusic(COMUSIC_17_EMPTY_HONEYCOMB_COLLECTED, 28000); + timedFunc_set_1(2.0f, progressDialog_showDialogMaskZero, FILEPROG_B_EMPTY_HONEYCOMB_TEXT); item_inc(ITEM_13_EMPTY_HONEYCOMB); if(!(item_getCount(ITEM_13_EMPTY_HONEYCOMB) < 6)){ gcpausemenu_80314AC8(0); @@ -585,7 +586,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ break; case 0x54: //L8028C820 - func_8025A6EC(COMUSIC_19_LOW_PITCH_FLUTES, 28000); + 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.x), reinterpret_cast(u32, other_prop->actorProp.y), reinterpret_cast(u32, other_prop->actorProp.z)); marker_despawn(marker); @@ -599,12 +600,12 @@ void __baMarker_resolveCollision(Prop *other_prop){ && volatileFlag_get(VOLATILE_FLAG_0_IN_FURNACE_FUN_QUIZ) && !fileProgressFlag_get(FILEPROG_A6_FURNACE_FUN_COMPLETE) ){ - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A6_FF_FOUND_HONEYCOMB); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A6_FF_FOUND_HONEYCOMB); func_8030E6D4(SFX_126_AUDIENCE_BOOING); } - func_8025A6EC(COMUSIC_16_HONEYCOMB_COLLECTED, 28000); - timedFunc_set_1(0.75f, func_8035644C, FILEPROG_A_HONEYCOMB_TEXT); + coMusicPlayer_playMusic(COMUSIC_16_HONEYCOMB_COLLECTED, 28000); + timedFunc_set_1(0.75f, progressDialog_showDialogMaskZero, FILEPROG_A_HONEYCOMB_TEXT); item_inc(ITEM_14_HEALTH); fxSparkle_honeycomb(&other_prop->actorProp.x); marker_despawn(marker); @@ -635,7 +636,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ } comusic_playTrack(COMUSIC_88_BIG_SNS_FANFARE); FUNC_8030E624(SFX_114_BRICKWALL_BREAKING, 0.8f, 15000); - tmp_v0_2 = 3*(actor->unkF4_8 - 1); + tmp_v0_2 = 3*(actor->actorTypeSpecificField - 1); tmp_f0 = 0.9f;\ sp64 = D_80363660; @@ -711,11 +712,11 @@ void __baMarker_resolveCollision(Prop *other_prop){ && volatileFlag_get(VOLATILE_FLAG_0_IN_FURNACE_FUN_QUIZ) && !fileProgressFlag_get(FILEPROG_A6_FURNACE_FUN_COMPLETE) ){ - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A7_FF_FOUND_EXTRALIFE); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A7_FF_FOUND_EXTRALIFE); func_8030E6D4(SFX_127_AUDIENCE_MIXED); } - func_8025A6EC(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FFF); - timedFunc_set_1(1.5f, func_8035646C, FILEPROG_C_EXTRA_LIFE_TEXT); + coMusicPlayer_playMusic(COMUSIC_15_EXTRA_LIFE_COLLECTED, 0x7FFF); + timedFunc_set_1(1.5f, progressDialog_showDialogMaskFour, FILEPROG_C_EXTRA_LIFE_TEXT); fxSparkle_extraLife(&other_prop->actorProp.x); item_inc(ITEM_16_LIFE); marker_despawn(marker); @@ -729,7 +730,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ baflag_set(BA_FLAG_2_ON_SPRING_PAD); }else{ if(!volatileFlag_getAndSet(VOLATILE_FLAG_C_HAS_SEEN_SPRING_PAD, 1)){ - gcdialog_showText(ASSET_A24_DIALOG_JUMP_PAD_DISCOVERED, 4, 0, 0, 0, 0); + gcdialog_showDialog(ASSET_A24_DIALOG_JUMP_PAD_DISCOVERED, 4, 0, 0, 0, 0); } } break; @@ -741,7 +742,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ baflag_set(BA_FLAG_1_ON_FLIGHT_PAD); } else if(! volatileFlag_getAndSet(VOLATILE_FLAG_D_HAS_SEEN_FLIGHT_PAD, 1)){ - gcdialog_showText(ASSET_A25_DIALOG_FLY_DISC_DISCOVERED, 4, 0, 0, 0, 0); + gcdialog_showDialog(ASSET_A25_DIALOG_FLY_DISC_DISCOVERED, 4, 0, 0, 0, 0); } break; @@ -807,7 +808,7 @@ void __baMarker_resolveCollision(Prop *other_prop){ obj_collision_type = MARKER_COLLISION_FUNC_1; break; }//L8028D034 - if(func_80297C6C() == 3){ + if(bsiFrame_getState() == 3){ plyr_collision_type = MARKER_COLLISION_FUNC_0; } if(obj_collision_type){ @@ -905,7 +906,7 @@ void baMarker_update(void){ if ((D_8037BF88 != 0)){ temp_s0 = func_8024FEEC(func_8025ADD4(COMUSIC_30_5TH_JINJO_COLLECTED) & 0xFF); - if((comusic_active_track_count() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){ + if((coMusicPlayer_getTrackCount() < 4 && temp_s0 >= 0xBB9) || !func_8025AD7C(COMUSIC_30_5TH_JINJO_COLLECTED)){ func_8028F918(0); D_8037BF88 = 0; } @@ -1016,7 +1017,7 @@ void baMarker_8028D71C(void){ func_8028E9C4(5, sp30); player_getPosition(sp3C); sp3C[1] += (sp30[1] - sp3C[1])*0.75; - func_802EE6CC(sp3C, 0, D_80363680, 1, 0.75f, 0.0f, 0x7d, 0xfa, 0); + dustEmitter_emit(sp3C, 0, D_80363680, 1, 0.75f, 0.0f, 0x7d, 0xfa, DUST_EMITTER_TYPE_DUST); } void baMarker_8028D7B8(s32 arg0, ActorMarker *arg1, struct5Cs *collision_flags){ @@ -1029,7 +1030,7 @@ void baMarker_8028D7B8(s32 arg0, ActorMarker *arg1, struct5Cs *collision_flags){ if(func_8033D5A4(collision_flags)) baflag_set(BA_FLAG_8); - if((func_80297C6C() != 3 && func_8028F1E0()) || !sp20){ + if((bsiFrame_getState() != 3 && func_8028F1E0()) || !sp20){ if(!func_8028F25C()){ sp24 = func_8033D564(collision_flags); if(0 < sp24 && sp24 < 6){ diff --git a/src/core2/babuzz.c b/src/core2/babuzz.c index 573cded6..216cf5ab 100644 --- a/src/core2/babuzz.c +++ b/src/core2/babuzz.c @@ -55,7 +55,7 @@ void babuzz_reset(void){ D_8037C048.sample_rate = D_8037C050.sample_rate = 13000; D_8037C048.volume = D_8037C050.volume; sfxsource_setSfxId(baBuzzSfxSource, 0x3fa); - func_8030DD14(baBuzzSfxSource, 2); + sfxSource_setunk43_7ByIndex(baBuzzSfxSource, 2); sfxsource_playSfxAtVolume(baBuzzSfxSource, D_8037C048.volume); sfxsource_setSampleRate(baBuzzSfxSource, D_8037C048.sample_rate); D_8037C058 = 0.0f; @@ -67,7 +67,7 @@ void babuzz_update(void){ D_8037C048.sample_rate = babuzz_80290920((f32)D_8037C048.sample_rate, (f32)D_8037C050.sample_rate, 100.0f); sfxsource_playSfxAtVolume(baBuzzSfxSource, babuzz_80290890(D_8037C058) + D_8037C048.volume); sfxsource_setSampleRate(baBuzzSfxSource, D_8037C048.sample_rate); - func_8030E2C4(baBuzzSfxSource); + sfxSource_func_8030E2C4(baBuzzSfxSource); } void babuzz_setVolume(f32 arg0){ diff --git a/src/core2/bakey.c b/src/core2/bakey.c index 2c3d6e94..2100bb0e 100644 --- a/src/core2/bakey.c +++ b/src/core2/bakey.c @@ -27,7 +27,7 @@ void bakey_update(void){ s32 i; bakey.pressed_count[0] = controller_getStartButton(0); - func_8024E60C(0, &bakey.pressed_count[BUTTON_Z]); + controller_copySideButtons(0, &bakey.pressed_count[BUTTON_Z]); func_8024E6E0(0, &bakey.pressed_count[BUTTON_D_UP]); controller_copyFaceButtons(0, &bakey.pressed_count[BUTTON_A]); for(i=0; i<0xE; i++){//L802954A8 diff --git a/src/core2/basfx.c b/src/core2/basfx.c index 4f1ef0ee..c7c10fe3 100644 --- a/src/core2/basfx.c +++ b/src/core2/basfx.c @@ -46,14 +46,14 @@ void basfx_updateClockSfxSource(f32 prev_time, f32 current_time){ f32 f20; s32 unks0; if(current_time == 0.0f){ - func_8030E394(basfx_timeUpSfxSource); + sfxSource_triggerCallbackByIndex(basfx_timeUpSfxSource); } else if(current_time < 1.0) { if(1.0 <= prev_time){ //timer complete sfxsource_setSfxId(basfx_timeUpSfxSource, SFX_1C_ALARMCLOCK); sfxsource_setSampleRate(basfx_timeUpSfxSource, 0x7fff); - func_8030E2C4(basfx_timeUpSfxSource); + sfxSource_func_8030E2C4(basfx_timeUpSfxSource); } } else{ @@ -63,7 +63,7 @@ void basfx_updateClockSfxSource(f32 prev_time, f32 current_time){ if(f20 <= prev_time && current_time < f20){ sfxsource_setSfxId(basfx_timeUpSfxSource, (unks0) ? SFX_2A_CLOCK_TIC_1 : SFX_51_CLOCK_TIC_2); sfxsource_setSampleRate(basfx_timeUpSfxSource, 0x7fff); - func_8030E2C4(basfx_timeUpSfxSource); + sfxSource_func_8030E2C4(basfx_timeUpSfxSource); return; } unks0 ^= 1; @@ -98,21 +98,21 @@ void basfx_802997E8(void){ } void basfx_802998D0(u8 indx){ - func_8030E6A4(SFX_19_BANJO_LANDING_08, D_8037C6CC, 22000); + gcsfx_playWithPitch(SFX_19_BANJO_LANDING_08, D_8037C6CC, 22000); } void basfx_reset(void){ basfx_owSfxIndex = 0; basfx_owSfxSource = sfxsource_createSfxsourceAndReturnIndex(); - func_8030DD14(basfx_owSfxSource, 3); + sfxSource_setunk43_7ByIndex(basfx_owSfxSource, 3); func_8030DD90(basfx_owSfxSource, 0); D_8037C6CC = 1.0f; D_8037C6C1 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(D_8037C6C1, SFX_18_BIGBUTT_SLIDE); - func_8030DD54(D_8037C6C1, basfx_802998D0); + sfxSource_setCallbackByIndex(D_8037C6C1, basfx_802998D0); sfxsource_setSampleRate(D_8037C6C1, 28000); - func_8030DD14(D_8037C6C1, 2); + sfxSource_setunk43_7ByIndex(D_8037C6C1, 2); func_8030DD90(D_8037C6C1, 0); D_8037C6C2 = sfxsource_createSfxsourceAndReturnIndex(); @@ -123,7 +123,7 @@ void basfx_reset(void){ basfx_timeUpSfxSource = sfxsource_createSfxsourceAndReturnIndex(); func_8030DD90(basfx_timeUpSfxSource, 0); - func_8030DD14(basfx_timeUpSfxSource, 3); + sfxSource_setunk43_7ByIndex(basfx_timeUpSfxSource, 3); baSfx.sfxsourceIdx = 0; } @@ -147,7 +147,7 @@ void basfx_80299AAC(void){ D_8037C6CC = ml_max_f(D_8037C6CC, 0.9f); D_8037C6CC = ml_min_f(D_8037C6CC, 1.5f); sfxsource_playSfxAtVolume(D_8037C6C1, D_8037C6CC); - func_8030E2C4(D_8037C6C1); + sfxSource_func_8030E2C4(D_8037C6C1); } void basfx_playJumpSfx(f32 arg0, f32 prev_time){ @@ -164,7 +164,7 @@ void basfx_80299BD4(void){ void basfx_playOwSfx(f32 volume){ sfxsource_setSfxId(basfx_owSfxSource, basfx_owSfxList[basfx_owSfxIndex]); sfxsource_playSfxAtVolume(basfx_owSfxSource, volume); - func_8030E2C4(basfx_owSfxSource); + sfxSource_func_8030E2C4(basfx_owSfxSource); ++basfx_owSfxIndex; if(basfx_owSfxIndex >= 8) basfx_owSfxIndex = 0; @@ -174,7 +174,7 @@ void basfx_80299C78(u8 indx, enum sfx_e sfx_id, f32 current_time, s32 arg3){ sfxsource_setSfxId(indx, sfx_id); sfxsource_playSfxAtVolume(indx, current_time); sfxsource_setSampleRate(indx, arg3); - func_8030E2C4(indx); + sfxSource_func_8030E2C4(indx); } u8 basfx_80299CC4(void){ @@ -222,15 +222,15 @@ void basfx_80299E00(void){ } void basfx_80299E48(void){ - func_8030E394(basfx_owSfxSource); + sfxSource_triggerCallbackByIndex(basfx_owSfxSource); } void basfx_80299E6C(void){ - func_8030E394(D_8037C6C2); + sfxSource_triggerCallbackByIndex(D_8037C6C2); } void basfx_80299E90(void){ - func_8030E394(D_8037C6C3); + sfxSource_triggerCallbackByIndex(D_8037C6C3); } void basfx_debug(void){} diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index 21ebfbdb..1817577c 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -337,7 +337,7 @@ static void __bsant_recoil_update(void){ } static void __bsant_recoil_end(void){ - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); diff --git a/src/core2/bs/bBarge.c b/src/core2/bs/bBarge.c index 21107b51..737da8e0 100644 --- a/src/core2/bs/bBarge.c +++ b/src/core2/bs/bBarge.c @@ -1,10 +1,14 @@ #include #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" #include "core2/ba/timer.h" + void func_80292864(f32, f32); @@ -172,8 +176,8 @@ void bsbarge_update(void){ bs_setState(sp24); } -void bsbarge_end(void){ - ability_use(5); +void bsbarge_end(void) { + ability_use(ABILITY_USED_BEAK_BARGE); func_8029E070(0); D_8037D2A6 = 0; } diff --git a/src/core2/bs/bEggAss.c b/src/core2/bs/bEggAss.c index 94851482..aeef0cf8 100644 --- a/src/core2/bs/bEggAss.c +++ b/src/core2/bs/bEggAss.c @@ -2,7 +2,10 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" +#include "core2/commonParticle.h" /* .bss */ u8 D_8037D2E0; @@ -39,9 +42,9 @@ void bseggass_update(void) { if (has_eggs) { if (anctrl_isAt(plyr_mvmt, 0.3837f)) { func_8030E760(SFX_3E_POOP_NOISE, 1.4f, 28000); - func_8033E3F0(COMMON_PARTICLE_4_EGG_ASS, 1); + commonParticle_new(COMMON_PARTICLE_4_EGG_ASS, 1); item_dec(ITEM_D_EGGS); - ability_use(7); + ability_use(ABILITY_USED_EGG); } if ((anctrl_isAt(plyr_mvmt, 0.4885f)) && (D_8037D2E1 < D_8037D2E0)) { anctrl_setStart(plyr_mvmt, 0.349f); diff --git a/src/core2/bs/bEggHead.c b/src/core2/bs/bEggHead.c index 6773a112..f04c0ff1 100644 --- a/src/core2/bs/bEggHead.c +++ b/src/core2/bs/bEggHead.c @@ -2,7 +2,10 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" +#include "core2/commonParticle.h" void yaw_setVelocityBounded(f32, f32); void anctrl_start(AnimCtrl *, char*, s32); @@ -47,9 +50,9 @@ void bsegghead_update(void) { func_8030E760(SFX_57_KAZOOIE_HEGH, 1.0f, 0x7fff); if (anctrl_isAt(aCtrl, 0.4704f)){ - func_8033E3F0(COMMON_PARTICLE_1_EGG_HEAD, 1); + commonParticle_new(COMMON_PARTICLE_1_EGG_HEAD, 1); item_dec(ITEM_D_EGGS); - ability_use(7); + ability_use(ABILITY_USED_EGG); } if ((anctrl_isAt(aCtrl, 0.5919f)) && (D_8037D2F1 < D_8037D2F0)) { anctrl_setStart(aCtrl, 0.3878f); diff --git a/src/core2/bs/bFlap.c b/src/core2/bs/bFlap.c index 814ee84a..2412d76a 100644 --- a/src/core2/bs/bFlap.c +++ b/src/core2/bs/bFlap.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" #include "core2/ba/timer.h" @@ -41,13 +43,13 @@ void bsbflap_init(void) { } void func_802A2790(s32 arg0, f32 arg1, s32 arg2) { - func_8030E394(D_8037D30C); + sfxSource_triggerCallbackByIndex(D_8037D30C); sfxsource_setSfxId(D_8037D30C, arg0); sfxsource_playSfxAtVolume(D_8037D30C, arg1); sfxsource_setSampleRate(D_8037D30C, arg2); func_8030DD90(D_8037D30C, 0); - func_8030DD14(D_8037D30C, 3); - func_8030E2C4(D_8037D30C); + sfxSource_setunk43_7ByIndex(D_8037D30C, 3); + sfxSource_func_8030E2C4(D_8037D30C); } void func_802A2810(void) { @@ -194,7 +196,7 @@ void bsbflap_update(void){ } void bsbflap_end(void) { - ability_use(1); + ability_use(ABILITY_USED_FLAP); baphysics_reset_gravity(); baphysics_reset_terminal_velocity(); func_8029E090(0, 0.2f); diff --git a/src/core2/bs/bFlip.c b/src/core2/bs/bFlip.c index a1510925..ae1457b4 100644 --- a/src/core2/bs/bFlip.c +++ b/src/core2/bs/bFlip.c @@ -1,6 +1,9 @@ #include #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" /* .data */ @@ -160,7 +163,7 @@ void bsbflip_update(void){ } void bsbflip_end(void){ - ability_use(2); + ability_use(ABILITY_USED_FLIP); baphysics_reset_gravity(); baphysics_reset_terminal_velocity(); func_8029E070(0); diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index 6f169ff9..1da6d657 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -2,6 +2,9 @@ #include "core1/core1.h" #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" #include "core2/ba/flap.h" #include "core2/ba/timer.h" @@ -174,8 +177,8 @@ void bsbfly_enter_update(void){ bs_setState(sp1C); } -void bsbfly_enter_end(void){ - ability_use(8); +void bsbfly_enter_end(void) { + ability_use(ABILITY_USED_FLY); func_8029E070(0); } @@ -514,7 +517,7 @@ void func_802A4664(void){ basfx_80299E90(); next_state = bs_getNextState(); if(next_state == BS_20_LANDING || next_state == BS_24_FLY || next_state == BS_2D_SWIM_IDLE){ - sfxsource_playHighPriority(SFX_3EA_UNKNOWN); + sfxsource_playHighPriority(SFX_3EA_BANJO_GUH_HUH); } func_802A34C8(); func_8029E070(0); @@ -676,7 +679,7 @@ void func_802A4C34(s32 arg0) { void func_802A4C88(s32 arg0) { baphysics_reset(); baMarker_collisionOn(); - func_80297CA8(); + bsiFrame_start(); func_8029E070(0); func_80291548(); func_802A34C8(); @@ -783,7 +786,7 @@ void func_802A503C(void){ void func_802A505C(void){ if(bs_getInterruptType() == BS_INTR_9){ - func_8029A86C(2); + bs_setInterruptResponse(2); baflag_set(BA_FLAG_7_TOUCHING_JIGGY); func_8029CCC4(); }else{ diff --git a/src/core2/bs/bLongLeg.c b/src/core2/bs/bLongLeg.c index aafb8798..8d3e2deb 100644 --- a/src/core2/bs/bLongLeg.c +++ b/src/core2/bs/bLongLeg.c @@ -26,7 +26,7 @@ u8 D_8037D361; /* .code */ int func_802A51D0(void){ - if(func_8029D66C()) + if(isPlayerInHazard()) return 0; return player_inWater(); } @@ -103,7 +103,7 @@ void __bsblongleg_enterFromTrot(void){ anctrl_start(aCtrl, "bsblongleg.c", 0xe1); stateTimer_set(STATE_TIMER_2_LONGLEG, D_8037D35C); func_803219F4(2); - func_8030E2C4(D_8037D361); + sfxSource_func_8030E2C4(D_8037D361); D_8037D360 = 1; } @@ -289,7 +289,7 @@ void bsblongleg_exit_update(void){ switch(D_8037D360){ case 0://L802A5C7C if(anctrl_isAt(aCtrl, 0.68f)) - func_8030E2C4(D_8037D361); + sfxSource_func_8030E2C4(D_8037D361); if(anctrl_isStopped(aCtrl)) func_802A5B34(); diff --git a/src/core2/bs/bPeck.c b/src/core2/bs/bPeck.c index 18c9f99c..00fc958b 100644 --- a/src/core2/bs/bPeck.c +++ b/src/core2/bs/bPeck.c @@ -1,7 +1,9 @@ #include #include "functions.h" #include "variables.h" + #include "core2/yaw.h" +#include "core2/abilityprogress.h" #include "core2/ba/physics.h" @@ -131,7 +133,7 @@ void bsbpeck_update(void){ void bsbpeck_end(void){ D_8037D376 = 0; - ability_use(0xa); + ability_use(ABILITY_USED_PECK); baModel_80292048(1, 0.0f, 0.0f, 0.0f); baModel_80292048(0, 0.0f, 0.0f, 0.0f); baMarker_8028D638(0, 0); diff --git a/src/core2/bs/bShock.c b/src/core2/bs/bShock.c index 2a8254cc..3edfafbb 100644 --- a/src/core2/bs/bShock.c +++ b/src/core2/bs/bShock.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" /* .data */ @@ -77,7 +79,7 @@ void bsbshock_charge_update(void){ break; case 1: if(anctrl_isAt(aCtrl, 0.11f)) - func_8030E2C4(D_8037D382); + sfxSource_func_8030E2C4(D_8037D382); if(anctrl_isAt(aCtrl, 0.4036f)) anctrl_setDuration(aCtrl, 1.4f); @@ -148,7 +150,7 @@ void bsbshock_init(void){ sfxsource_playHighPriority(SFX_E_SHOCKSPRING_BOING); func_8029E064(1); func_8029E070(1); - ability_use(9); + ability_use(ABILITY_USED_SHOCK); baModel_80292158(-50.0f); func_80298528(-50.0f); D_8037D381 = 0; diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index d8838947..e036b299 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/model.h" #include "core2/ba/physics.h" #include "core2/ba/timer.h" @@ -64,12 +66,12 @@ bool func_802A73BC(void) { f32 sp1C; sp1C = (map_get() == MAP_46_CCW_WINTER) ? 90.0f : 130.0f; - return func_80294574() && player_getYPosition() > (func_80294500() - sp1C); + return floor_isCurrentFloorunk59() && player_getYPosition() > (floor_getCurrentFloorYPosition() - sp1C); } void func_802A744C(void) { if (player_isInRBB() && bs_getState() != BS_4C_LANDING_IN_WATER) { - func_8035644C(FILEPROG_AC_DIVE_OILY_WATER); + progressDialog_showDialogMaskZero(FILEPROG_AC_DIVE_OILY_WATER); } roll_setAngularVelocity(30.0f, 0.9f); baphysics_set_gravity(0.0f); @@ -323,14 +325,14 @@ void func_802A7CA8(void) { void func_802A7D74(void) { - func_80297CA8(); + bsiFrame_start(); baMarker_collisionOn(); baeyes_open(); func_802A75B0(); } void bsSwim_dive_init(void) { - ability_use(ABILITY_3_CAMERA_CONTROL); + ability_use(ABILITY_USED_SWIM); baanim_playForDuration_once(ASSET_3C_ANIM_BSSWIM_DIVE_ENTER, 1.0f); func_802A7140(); yaw_setVelocityBounded(500.0f, 5.0f); diff --git a/src/core2/bs/bTrot.c b/src/core2/bs/bTrot.c index 5725eda2..b9fbeb16 100644 --- a/src/core2/bs/bTrot.c +++ b/src/core2/bs/bTrot.c @@ -749,7 +749,7 @@ void bsbtrot_ow_update(void){ } void bsbtrot_ow_end(void){ - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); diff --git a/src/core2/bs/bWhirl.c b/src/core2/bs/bWhirl.c index 3290bdd4..e2e11908 100644 --- a/src/core2/bs/bWhirl.c +++ b/src/core2/bs/bWhirl.c @@ -46,7 +46,7 @@ static void __bsbwhirl_end(void){ } static void __bsbwhirl_spawnSparkle(void){ - func_8033E3F0(2,1); + commonParticle_new(2,1); } enum bs_e func_802AA510(enum bs_e arg0){ @@ -88,7 +88,7 @@ void bsbwhirl_enter_init(void){ D_8037D3B0 = 0.0f; core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 0xfa0, 0xd); - func_8025A6EC(0x25, 0x6d60); + coMusicPlayer_playMusic(0x25, 0x6d60); basfx_80299BD4(); bainput_enable(1,0); } diff --git a/src/core2/bs/bbuster.c b/src/core2/bs/bbuster.c index 776ff796..5c4b6310 100644 --- a/src/core2/bs/bbuster.c +++ b/src/core2/bs/bbuster.c @@ -155,8 +155,8 @@ void bsbbuster_update(void){ break; case 3://802A00F0 D_8037D2B7 = 0; - if(func_80297C6C() == 1){ - func_80297CCC(0.9f); + if(bsiFrame_getState() == 1){ + bsiFrame_startWithValue(0.9f); } D_8037D2B0 -= time_getDelta(); diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 0863b825..05c61a6c 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -360,7 +360,7 @@ void func_802A1A50(void){ } void func_802A1B28(void){ - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); @@ -520,7 +520,7 @@ void func_802A2098(void){ baphysics_set_target_horizontal_velocity(0.0f); core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0, 0xFA0); - func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); + coMusicPlayer_playMusic(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); func_8029151C(0xC); baMarker_collisionOff(); batimer_set(0, 3.0f); diff --git a/src/core2/bs/carry.c b/src/core2/bs/carry.c index 310d718e..bbb51a41 100644 --- a/src/core2/bs/carry.c +++ b/src/core2/bs/carry.c @@ -97,7 +97,7 @@ void bscarry_interrupt(void){ bacarry_set_marker(baMarker_8028D688()); break; case 8: - func_8029A86C(2); + bs_setInterruptResponse(2); bs_setState(BS_3C_TALK); break; case 0x12: @@ -106,10 +106,10 @@ void bscarry_interrupt(void){ case BS_INTR_16_THROW_CARRIED_OBJ: if(stateTimer_isDone(STATE_TIMER_1_THROW)){ bs_setState(BS_CARRY_THROW); - func_8029A86C(2); + bs_setInterruptResponse(2); } else{ - func_8029A86C(1); + bs_setInterruptResponse(1); } break; default://L802AB260 diff --git a/src/core2/bs/claw.c b/src/core2/bs/claw.c index 57f9724e..97ab3a77 100644 --- a/src/core2/bs/claw.c +++ b/src/core2/bs/claw.c @@ -1,6 +1,9 @@ #include #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" @@ -66,8 +69,8 @@ void bsclaw_update(void){ bs_setState(sp2C); } -void bsclaw_end(void){ - ability_use(0xB); +void bsclaw_end(void) { + ability_use(ABILITY_USED_CLAW); _bsclawHitboxActive = 0; func_802915B8(); diff --git a/src/core2/bs/climb.c b/src/core2/bs/climb.c index 7e729c46..19e647e8 100644 --- a/src/core2/bs/climb.c +++ b/src/core2/bs/climb.c @@ -1,6 +1,9 @@ #include #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/anim.h" #include "core2/ba/physics.h" @@ -78,7 +81,7 @@ void bsclimb_idle_init(void){ yaw_setIdeal(angle_towards_pole); yaw_applyIdeal(); } - ability_use(4); + ability_use(ABILITY_USED_CLIMB); baanim_playForDuration_loopSmooth(ASSET_B2_ANIM_BSCLIMB_IDLE_2, 2.64f); baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); func_802AB654(); @@ -222,6 +225,6 @@ void func_802ABD60(void){ func_80296608(); return; } - func_8029A86C(1); + bs_setInterruptResponse(1); bs_setState(next_state); } diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index e154b14f..55c592d7 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -53,7 +53,7 @@ void func_802ABE70(void){ if(baflag_isTrue(BA_FLAG_10_TOUCHING_TURBO_TRAINERS) && bs_getState() != BS_17_BTROT_EXIT){ baflag_clear(BA_FLAG_10_TOUCHING_TURBO_TRAINERS); stateTimer_set(STATE_TIMER_3_TURBO_TALON, get_turbo_duration()); - func_8025A6EC(COMUSIC_8A_GETTING_TURBO_TRAINERS, -1); + coMusicPlayer_playMusic(COMUSIC_8A_GETTING_TURBO_TRAINERS, -1); func_8029E0DC(1); } @@ -384,7 +384,7 @@ static void __bscroc_recoil_update(void){ } void __bscroc_recoil_end(void){ - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); diff --git a/src/core2/bs/die.c b/src/core2/bs/die.c index 11ddaf63..ee253017 100644 --- a/src/core2/bs/die.c +++ b/src/core2/bs/die.c @@ -109,14 +109,14 @@ void bsdie_update(void){ func_8029B890(); if( batimer_get(0) != 0.0f - && func_80294574() + && floor_isCurrentFloorunk59() && ( D_8037D414 || ( anctrl_isStopped(aCtrl) - && ( player_getYPosition() < (func_80294500() - 150.0f)) + && ( player_getYPosition() < (floor_getCurrentFloorYPosition() - 150.0f)) ) ) && player_inWater() - && 100.0f < (func_80294500() - func_80294438()) + && 100.0f < (floor_getCurrentFloorYPosition() - func_80294438()) ){ sp28 = BS_54_SWIM_DIE; } diff --git a/src/core2/bs/droneenter.c b/src/core2/bs/droneenter.c index c87191f3..e25767d9 100644 --- a/src/core2/bs/droneenter.c +++ b/src/core2/bs/droneenter.c @@ -30,7 +30,7 @@ void __bsDroneEnter_setSubstate(enum bsdroneenter_state_e arg0) { batimer_set(0, 0.2f); break; case 2: - func_8025A6CC(COMUSIC_43_ENTER_LEVEL_GLITTER, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_43_ENTER_LEVEL_GLITTER, 32000); func_8025AABC(COMUSIC_43_ENTER_LEVEL_GLITTER); batimer_set(0, 0.4f); baModel_setEnvAlpha(0); diff --git a/src/core2/bs/dronevanish.c b/src/core2/bs/dronevanish.c index 58c6d238..3b1c9ab1 100644 --- a/src/core2/bs/dronevanish.c +++ b/src/core2/bs/dronevanish.c @@ -23,7 +23,7 @@ void __bsDroneVanish_setSubstate(s32 next_state) { batimer_set(0, 0.3f); break; case 2: - func_8025A6CC(COMUSIC_43_ENTER_LEVEL_GLITTER, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_43_ENTER_LEVEL_GLITTER, 32000); func_8025AABC(COMUSIC_43_ENTER_LEVEL_GLITTER); batimer_set(0, 0.4f); break; diff --git a/src/core2/bs/dronexform.c b/src/core2/bs/dronexform.c index 6423a803..c23d87f0 100644 --- a/src/core2/bs/dronexform.c +++ b/src/core2/bs/dronexform.c @@ -306,7 +306,7 @@ static void __bsdronexform_setState(int next_state){ case 8: // 802B03FC if(D_8037D470.room_transformation == TRANSFORM_1_BANJO && D_8037D470.player_transformation == TRANSFORM_1_BANJO){ - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 28000); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 28000); } batimer_set(0, 1.0f); break; diff --git a/src/core2/bs/iFrame.c b/src/core2/bs/iFrame.c new file mode 100644 index 00000000..fc33c20f --- /dev/null +++ b/src/core2/bs/iFrame.c @@ -0,0 +1,38 @@ +#include +#include "functions.h" +#include "variables.h" +#include "core2/statetimer.h" +#include "iFrame.h" + +/* .bss */ +u8 iFrameState; + +/* .code */ +void bsiFrame_setState(s32 state) { + iFrameState = state; +} + +s32 bsiFrame_getState(void) { + return iFrameState; +} + +void bsiFrame_reset(void) { + iFrameState = 0; + bsiFrame_setState(IFRAME_NONE); + stateTimer_clear(STATE_TIMER_4_IFRAME); +} + +void bsiFrame_start(void) { + bsiFrame_startWithValue(0.6f); +} + +void bsiFrame_startWithValue(f32 val) { + stateTimer_set(STATE_TIMER_4_IFRAME, val); + bsiFrame_setState(IFRAME_INVICIBLE); +} + +void bsiFrame_update(void) { + if (stateTimer_isDone(STATE_TIMER_4_IFRAME)) { + bsiFrame_setState(IFRAME_NONE); + } +} diff --git a/src/core2/bs/iFrame.h b/src/core2/bs/iFrame.h new file mode 100644 index 00000000..0a1e788c --- /dev/null +++ b/src/core2/bs/iFrame.h @@ -0,0 +1,4 @@ +typedef enum { + IFRAME_NONE = 1, + IFRAME_INVICIBLE = 3 +} IFrameState; diff --git a/src/core2/bs/jig.c b/src/core2/bs/jig.c index 8b0785f9..885dbb7d 100644 --- a/src/core2/bs/jig.c +++ b/src/core2/bs/jig.c @@ -38,7 +38,7 @@ void bsjig_jiggy_init(void){ if(tmp == 0) //weird if... tmp = 0; D_8037D4B1 = tmp; - func_8025A6EC(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); + coMusicPlayer_playMusic(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); func_8029151C(0xC); func_8029E070(1); func_8030E6D4(SFX_33_BANJO_AHOO); @@ -114,7 +114,7 @@ void bsjig_jiggy_end(void){ && bs_getNextState() != BS_34_JIG_NOTEDOOR ){ func_8028F918(2); - func_802E4078(MAP_95_CS_END_ALL_100, 0, 1); + transitionToMap(MAP_95_CS_END_ALL_100, 0, 1); } else {//L802B0DFC if( jiggyscore_total() == 2 && map_get() == MAP_2_MM_MUMBOS_MOUNTAIN @@ -134,7 +134,7 @@ void bsjig_jiggy_end(void){ } }//L802B0E88 if(sp2C != 0){ - gcdialog_showText(sp2C, sp28, 0, 0, 0, 0); + gcdialog_showDialog(sp2C, sp28, 0, 0, 0, 0); } }//L802B0EA4 func_80298A64(); @@ -156,7 +156,7 @@ void bsjig_notedoor_end(void){ && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY) ){ func_8028F918(2); - func_802E4078(MAP_95_CS_END_ALL_100, 0, 1); + transitionToMap(MAP_95_CS_END_ALL_100, 0, 1); } func_80298A64(); } @@ -177,7 +177,7 @@ void bsjig_notedoor_init(void){ core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0,0xfa0); } - func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE,-1); + coMusicPlayer_playMusic(COMUSIC_42_NOTEDOOR_OPENING_FANFARE,-1); func_8029151C(0xc); func_8029E070(1); func_8030E6D4(SFX_33_BANJO_AHOO); @@ -188,7 +188,7 @@ void bsjig_notedoor_update(void){ enum bs_e sp1C = 0; if(baanim_isAt(0.59f) || baanim_isAt(0.84f)) - basfx_80299CF4(SFX_3EA_UNKNOWN, 1.0f, 30000); + basfx_80299CF4(SFX_3EA_BANJO_GUH_HUH, 1.0f, 30000); if(baanim_isStopped()) sp1C = BS_1_IDLE; diff --git a/src/core2/bs/jump.c b/src/core2/bs/jump.c index ff6551de..c1b1b342 100644 --- a/src/core2/bs/jump.c +++ b/src/core2/bs/jump.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/model.h" #include "core2/ba/anim.h" @@ -161,12 +163,14 @@ void bsjump_update(void){ bs_setState(sp34); } -void bsjump_end(void){ - if(ability_hasLearned(ABILITY_A_HOLD_A_JUMP_HIGHER)) - ability_use(0); +void bsjump_end(void) { + if (ability_hasLearned(ABILITY_A_HOLD_A_JUMP_HIGHER)) { + ability_use(ABILITY_USED_JUMP); + } - if(bs_getNextState() != BS_11_BPECK) + if (bs_getNextState() != BS_11_BPECK) { baphysics_reset_gravity(); + } } void bsjump_fall_init(void){ diff --git a/src/core2/bs/ow.c b/src/core2/bs/ow.c index 11caf451..eda61f8f 100644 --- a/src/core2/bs/ow.c +++ b/src/core2/bs/ow.c @@ -66,7 +66,7 @@ void bsow_update(void) { void bsow_end(void){ func_802B35DC(); func_802B1FD0(0); - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index 59a8c1e9..79cd34b7 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -394,7 +394,7 @@ void __bspumpkin_bounce_update(void) { } void __bspumpkin_bounce_end(void) { - func_80297CA8(); + bsiFrame_start(); baphysics_reset_gravity(); baMarker_collisionOn(); baeyes_open(); diff --git a/src/core2/bs/sled.c b/src/core2/bs/sled.c index 7c39fa2f..ceb13f0b 100644 --- a/src/core2/bs/sled.c +++ b/src/core2/bs/sled.c @@ -51,7 +51,7 @@ void bssled_end(void){ void bssled_interrupt(void){ if(bs_getInterruptType() == BS_INTR_28){ func_802B3F60(); - func_8029A86C(2); + bs_setInterruptResponse(2); } else{ func_80296608(); diff --git a/src/core2/bs/slide.c b/src/core2/bs/slide.c index 3c2a75be..b46318d2 100644 --- a/src/core2/bs/slide.c +++ b/src/core2/bs/slide.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "core2/abilityprogress.h" + #include "core2/ba/physics.h" /* .bss */ @@ -116,8 +118,10 @@ void bsslide_update(void){ bs_setState(sp3C); } -void bsslide_end(void){ - if(level_get() != 6) - ability_use(6); +void bsslide_end(void) { + if (level_get() != 6) { + ability_use(ABILITY_USED_SLIDE); + } + pitch_setIdeal(0.0f); } diff --git a/src/core2/bs/splat.c b/src/core2/bs/splat.c index f9135430..34e2e10c 100644 --- a/src/core2/bs/splat.c +++ b/src/core2/bs/splat.c @@ -85,5 +85,5 @@ void bssplat_update(void){ void bssplat_end(void){ baMarker_collisionOn(); - func_80297CA8(); + bsiFrame_start(); } diff --git a/src/core2/bs/stand.c b/src/core2/bs/stand.c index 35dd8675..1b09baee 100644 --- a/src/core2/bs/stand.c +++ b/src/core2/bs/stand.c @@ -315,21 +315,21 @@ void func_802B5350(void){ } if(sp1C == 0x7){ if(bsStoredState_getTransformation() != TRANSFORM_1_BANJO) - func_8029A86C(1); + bs_setInterruptResponse(1); else{ bacarry_set_marker(baMarker_8028D688()); bs_setState(BS_3A_CARRY_IDLE); } } else if(sp1C == 0x12){//L802B53D0 - func_8029A86C(1); + bs_setInterruptResponse(1); if( bsStoredState_getTransformation() == TRANSFORM_1_BANJO && !baflag_isTrue(BA_FLAG_F) && stateTimer_isDone(STATE_TIMER_0_UNKNOWN)){ bacarriedobj_spawn(baMarker_getCarriedObjectActorId()); - func_8029A86C(2); + bs_setInterruptResponse(2); } } else if(sp1C == 0x8){//L802B5438 - func_8029A86C(2); + bs_setInterruptResponse(2); bs_setState(BS_3C_TALK); }else{ bacarry_reset_marker(); diff --git a/src/core2/bs/surf.c b/src/core2/bs/surf.c index adeb01c1..6ad84a30 100644 --- a/src/core2/bs/surf.c +++ b/src/core2/bs/surf.c @@ -44,7 +44,7 @@ void func_802B60D0(void){} void func_802B60D8(void) { if (bs_getInterruptType() == BS_INTR_D_SURF) { D_8037D560 = 1; - func_8029A86C(2); + bs_setInterruptResponse(2); return; } func_80296608(); diff --git a/src/core2/bs/swim.c b/src/core2/bs/swim.c index 0c7f7925..518b4ad0 100644 --- a/src/core2/bs/swim.c +++ b/src/core2/bs/swim.c @@ -35,7 +35,7 @@ void func_802B5480(void) { f32 bubble_spawn_position[3]; ParticleEmitter *bubble_emitter; - if (func_80294574()) { + if (floor_isCurrentFloorunk59()) { if (randf() > 0.5) { baModel_8029223C(bubble_spawn_position); } else { @@ -75,9 +75,9 @@ void func_802B55DC(void) { void swim_enteredWater(void) { if (level_get() == LEVEL_9_RUSTY_BUCKET_BAY) { - func_8035644C(FILEPROG_AB_SWIM_OILY_WATER); + progressDialog_showDialogMaskZero(FILEPROG_AB_SWIM_OILY_WATER); } else if (map_get() == MAP_46_CCW_WINTER) { - func_8035644C(FILEPROG_DD_HAS_TOUCHED_CCW_ICY_WATER); + progressDialog_showDialogMaskZero(FILEPROG_DD_HAS_TOUCHED_CCW_ICY_WATER); } baphysics_set_gravity(100.0f); baphysics_set_terminal_velocity(133.33f); @@ -245,7 +245,7 @@ void func_802B5C40(void) { if ((func_80294530() != 0) && (can_dive() != 0)) { func_802944D0(sp1C); if (sp1C[1] < -0.7) { - if ((func_80294500() - player_getYPosition()) > 90.0f) { + if ((floor_getCurrentFloorYPosition() - player_getYPosition()) > 90.0f) { next_state = BS_30_DIVE_ENTER; } } diff --git a/src/core2/bs/talk.c b/src/core2/bs/talk.c index 04492358..923bfbe8 100644 --- a/src/core2/bs/talk.c +++ b/src/core2/bs/talk.c @@ -46,7 +46,7 @@ void bstalk_end(void){} void bstalk_interrupt(void){ if(bs_getInterruptType() == BS_INTR_8){ bsTalkStayInState = TRUE; - func_8029A86C(2); + bs_setInterruptResponse(2); } else{ func_80296608(); diff --git a/src/core2/bs/throw.c b/src/core2/bs/throw.c index acede5dd..2e5e95de 100644 --- a/src/core2/bs/throw.c +++ b/src/core2/bs/throw.c @@ -70,7 +70,7 @@ void bsthrow_interrupt(void){ bacarriedobj_spawn(baMarker_getCarriedObjectActorId()); } else{ - func_8029A86C(1); + bs_setInterruptResponse(1); } } else{ //L802B6748 diff --git a/src/core2/bs/twirl.c b/src/core2/bs/twirl.c index f0440e18..e2634bce 100644 --- a/src/core2/bs/twirl.c +++ b/src/core2/bs/twirl.c @@ -1,6 +1,9 @@ #include #include "functions.h" #include "variables.h" + +#include "core2/abilityprogress.h" + #include "core2/ba/anim.h" #include "core2/ba/physics.h" #include "core2/ba/timer.h" @@ -81,7 +84,7 @@ void bstwirl_update(void){ bs_setState(sp1C); } -void bstwirl_end(void){ - ability_use(0xC); +void bstwirl_end(void) { + ability_use(ABILITY_USED_TWIRL); _bstwirlHitboxActive = FALSE; } diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 9e58d480..5b60c169 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -757,7 +757,7 @@ void func_802B9880(void) { void func_802B98C0(void) { if (bs_getInterruptType() == BS_INTR_2B) { - func_8029A86C(2); + bs_setInterruptResponse(2); bs_setState(BS_67_WALRUS_IDLE); return; } diff --git a/src/core2/ch/bat.c b/src/core2/ch/bat.c index 3f81c9bf..c4d8086d 100644 --- a/src/core2/ch/bat.c +++ b/src/core2/ch/bat.c @@ -54,7 +54,7 @@ void chbat_exitRoost(Actor *this){ subaddie_set_state_with_direction(this, CH_BAT_STATE_EXIT_ROOST, 0.01f, 1); actor_playAnimationOnce(this); this->actor_specific_1_f = 5.0f; - FUNC_8030E8B4(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 0x4e2, 0x9c4); + sfx_playFadeShorthandDefault(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 0x4e2, 0x9c4); } } @@ -166,13 +166,13 @@ bool chbat_nearPlayer(Actor *this) { } if (this->unk38_31 != 0) { - if (func_80329530(this, 0) && (sp24[1] <= (this->unk1C[1] - 40.0f))) { + if (subaddie_playerIsWithinSphereAndActive(this, 0) && (sp24[1] <= (this->unk1C[1] - 40.0f))) { return TRUE; } this->unk38_31--; return FALSE; } - if (func_80329530(this, 800) && (sp24[1] <= (this->unk1C[1] - 40.0f))) { + if (subaddie_playerIsWithinSphereAndActive(this, 800) && (sp24[1] <= (this->unk1C[1] - 40.0f))) { return TRUE; } @@ -381,7 +381,7 @@ void chBat_dieCollision(ActorMarker *this_marker, ActorMarker *other_marker){ chBat_fall(this); local->cooldown = 0.0f; this->marker->collidable = FALSE; - FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 1.3f, 26000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_115_BUZZBOMB_DEATH, 1.3f, 26000, this->position, 1250, 2500); } void chBat_attackCollision(ActorMarker *this_marker, ActorMarker *other_marker){ @@ -436,7 +436,7 @@ void chbat_update(Actor *this){ else{ if(!(globalTimer_getTime() & 0xf)){ if(randf() < 0.35){ - FUNC_8030E8B4(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_419_UNKNOWN, 1.0f, 28000, this->position, 1250, 2500); } } }//L80360A40 @@ -484,7 +484,7 @@ void chbat_update(Actor *this){ this->position_y = mapModel_getFloorY(this->position); subaddie_set_state_with_direction(this, CH_BAT_STATE_DIE, 0.01f, 1); actor_playAnimationOnce(this); - func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200); + gcsfx_playWithPitch(SFX_1F_HITTING_AN_ENEMY_3, 1.2f, 32200); } else{//L80360CC4 this->position_y += this->velocity_x * sp34; diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 0b4fec32..2e03d602 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -25,8 +25,8 @@ ActorInfo chBeehive = {MARKER_50_BEEHIVE, ACTOR_12_BEEHIVE, ASSET_364_MODEL_BEEH void chBeehive_die(ActorMarker *this, ActorMarker *other){ Actor *actor = marker_getActor(this); - FUNC_8030E8B4(SFX_11_WOOD_BREAKING_1, 1.0f, 28000, actor->position, 300, 3000); - FUNC_8030E8B4(SFX_D_EGGSHELL_BREAKING, 1.0f, 28000, actor->position, 300, 3000); + sfx_playFadeShorthandDefault(SFX_11_WOOD_BREAKING_1, 1.0f, 28000, actor->position, 300, 3000); + sfx_playFadeShorthandDefault(SFX_D_EGGSHELL_BREAKING, 1.0f, 28000, actor->position, 300, 3000); subaddie_set_state(actor, CHBEEHIVE_STATE_2_DIE); actor_playAnimationOnce(actor); this->collidable = FALSE; @@ -62,7 +62,7 @@ void chBeehive_update(Actor *this){ ){ if(player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT){ if( player_getTransformation() == TRANSFORM_1_BANJO - && gcdialog_showText(ASSET_D96_DIALOG_BEEHIVE_MEET, 0, NULL, NULL, NULL, 0) + && gcdialog_showDialog(ASSET_D96_DIALOG_BEEHIVE_MEET, 0, NULL, NULL, NULL, 0) ){ fileProgressFlag_set(FILEPROG_D_BEEHIVE_TEXT, 1); } @@ -74,14 +74,14 @@ void chBeehive_update(Actor *this){ || actor_animationIsAt(this, 0.6f) ){ if(!this->unk38_0){ - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); sfxsource_setSfxId(this->unk44_31, SFX_67_BEEHIVE_CLONK); sfxsource_setSampleRate(this->unk44_31, 12000); sfxsource_playSfxAtVolume(this->unk44_31, (anctrl_getAnimTimer(this->anctrl) + 0.9) - 0.4); sfxsource_set_position(this->unk44_31, this->position); sfxsource_set_fade_distances(this->unk44_31, 300.0f, 1500.0f); - func_8030DD14(this->unk44_31, 3); - func_8030E2C4(this->unk44_31); + sfxSource_setunk43_7ByIndex(this->unk44_31, 3); + sfxSource_func_8030E2C4(this->unk44_31); } } break; diff --git a/src/core2/ch/bigbutt.c b/src/core2/ch/bigbutt.c index 339e67f0..cb21abef 100644 --- a/src/core2/ch/bigbutt.c +++ b/src/core2/ch/bigbutt.c @@ -51,14 +51,14 @@ void func_802C5EB8(Actor *this){ this->unk38_31--; } else{ - if(func_80329530(this, 1200) && func_803292E0(this)){ + if(subaddie_playerIsWithinSphereAndActive(this, 1200) && func_803292E0(this)){ subaddie_set_state(this, 8); } } } void func_802C5F44(Actor *this){ - if(!func_80329530(this, 1200) || !func_803292E0(this)){ + if(!subaddie_playerIsWithinSphereAndActive(this, 1200) || !func_803292E0(this)){ subaddie_set_state_with_direction(this, 1, 0.16f, 1); } } @@ -105,8 +105,8 @@ void func_802C61C0(ActorMarker *marker, ActorMarker *other_marker){ && actor->state != 0xf ){ subaddie_set_state_forward(actor, 0xd); - FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); - FUNC_8030E8B4(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); + sfx_playFadeShorthandDefault(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); + sfx_playFadeShorthandDefault(SFX_143_BULL_DAMAGE, 1.0f, 16000, actor->position, 0, 2000); } } @@ -210,7 +210,7 @@ void func_802C6240(Actor *this){ if(!func_80329078(this, (s32)this->yaw, 20)) func_802C5F94(this); - if(this->unk10_12 == 0 || (this->unk10_12 < 3 && func_80329530(this, 300))){ + if(this->unk10_12 == 0 || (this->unk10_12 < 3 && subaddie_playerIsWithinSphereAndActive(this, 300))){ subaddie_set_state(this, 9); this->actor_specific_1_f = 13.0f; } @@ -230,7 +230,7 @@ void func_802C6240(Actor *this){ if(!func_80329030(this, 0)) func_802C5F94(this); - if(func_80329530(this, 320)){ + if(subaddie_playerIsWithinSphereAndActive(this, 320)){ if(func_80329078(this, (s32)this->yaw_ideal,200)){ anctrl_setPlaybackType(this->anctrl, ANIMCTRL_ONCE); subaddie_set_state(this, 4); @@ -241,9 +241,9 @@ void func_802C6240(Actor *this){ tmp_a0 = this->unk44_31; } sfxsource_setSfxId(tmp_a0, SFX_18_BIGBUTT_SLIDE); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, (randf()*0.1 - 0.05) + 1.0); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } else{//L802C69FC func_802C5F94(this); @@ -257,9 +257,9 @@ void func_802C6240(Actor *this){ func_80328FB0(this, 1.0f); } func_80329030(this, 0); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); if(0.99 <= anctrl_getAnimTimer(this->anctrl)){ - func_80329878(this, func_80329530(this, 250)? 0.8: 1.2); + func_80329878(this, subaddie_playerIsWithinSphereAndActive(this, 250)? 0.8: 1.2); if (0.0f == this->actor_specific_1_f) { anctrl_setPlaybackType(this->anctrl, ANIMCTRL_LOOP); subaddie_set_state_with_direction(this, 1, 0.65f, 1); diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index e24d714d..26c4b044 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -3,7 +3,7 @@ #include "functions.h" #include "variables.h" -extern void func_8025A6CC(enum comusic_e arg0, s32 arg1); +extern void coMusicPlayer_playMusicWeak(enum comusic_e arg0, s32 arg1); extern void chBottlesBonusCursor_func_802DF99C(void); extern f32 *chBottlesBonusCursor_func_802E05AC(s32); extern f32 func_802E4B38(void); @@ -399,7 +399,7 @@ void chBottlesBonus_lose(u8 *arg0, enum asset_e text_id) { actor = marker_getActor(chBottlesBonusMarker); chBottlesBonusCursor_lose(); - func_8025A6CC(COMUSIC_3C_MINIGAME_LOSS, 28000); + coMusicPlayer_playMusicWeak(COMUSIC_3C_MINIGAME_LOSS, 28000); actor->state = 5; item_set(ITEM_6_HOURGLASS, FALSE); func_802FAD64(0); @@ -407,7 +407,7 @@ void chBottlesBonus_lose(u8 *arg0, enum asset_e text_id) { *arg0 = 1; timedFunc_set_0(2.0f, chBottlesBonusCursor_func_802DF99C); func_80311714(0); - gcdialog_showText(text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_func_802DE224, NULL); + gcdialog_showDialog(text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_func_802DE224, NULL); func_80311714(1); } else{ @@ -426,7 +426,7 @@ void chBottlesBonus_completedPuzzle(void) { actor = marker_getActor(chBottlesBonusMarker); gCompletedBottleBonusGames[chBottleBonusPuzzleIndex] = TRUE; func_80311714(0); - gcdialog_showText(D_803681A0[chBottleBonusPuzzleIndex + 1].text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_IncrementPuzzle, NULL); + gcdialog_showDialog(D_803681A0[chBottleBonusPuzzleIndex + 1].text_id, 0x86, actor->position, chBottlesBonusMarker, chBottlesBonus_IncrementPuzzle, NULL); func_80311714(1); } @@ -510,7 +510,7 @@ void chBottlesBonus_update(Actor *this) { case 1: if ((this->lifetime_value > 2.0) && gctransition_done()) { this->lifetime_value = 0.0f; - func_8025A6EC(COMUSIC_98_BBONUS_PIECES_SHUFFLE, -1); + coMusicPlayer_playMusic(COMUSIC_98_BBONUS_PIECES_SHUFFLE, -1); comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 2000); func_8025AABC(COMUSIC_95_BBONUS_A); subaddie_set_state_with_direction(this, 2, 0.0f, 1); @@ -523,7 +523,7 @@ void chBottlesBonus_update(Actor *this) { func_8025A7DC(COMUSIC_98_BBONUS_PIECES_SHUFFLE); if (D_8037DCC7 == 0) { func_80311714(0); - gcdialog_showText(ASSET_E24_DIALOG_UNKNOWN, 0x87, this->position, chBottlesBonusMarker, chBottlesBonus_startTimer, NULL); + gcdialog_showDialog(ASSET_E24_DIALOG_UNKNOWN, 0x87, this->position, chBottlesBonusMarker, chBottlesBonus_startTimer, NULL); func_80311714(1); D_8037DCC7 = 1; } @@ -599,7 +599,7 @@ Actor *chBottlesBonus_new(s32 position[3], s32 yaw, ActorInfo *actor_info, u32 f return actor_new(position, yaw, actor_info, flags); } -void chBottlesBonus_func_802DEB80(void) { +void chBottlesBonus_resetCompleted(void) { int i; for(i = 0; i < 7; i++){ gCompletedBottleBonusGames[i] = 0; diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index a5b080c4..7d923774 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -132,7 +132,7 @@ bool chBottlesBonusCursor_checkPuzzleCompletion(void) { if (D_8037E5C0.is_completed) { item_set(ITEM_6_HOURGLASS, FALSE); timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_94_BBONUS, 0, 2000); - timedFunc_set_2(0.3f, (GenFunction_2)func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000); + timedFunc_set_2(0.3f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 22000); timedFunc_set_0(1.5f, (GenFunction_0)chBottlesBonusCursor_func_802DF99C); timedFunc_set_0(1.0f, (GenFunction_0)chBottlesBonus_completedPuzzle); } @@ -189,10 +189,10 @@ void chBottlesBonusCursor_func_802DF99C(void){ } void chBottlesBonusCursor_freeMethod(Actor *this) { - func_8031FBF8(); - func_8031FBA0(); + debugScoreStates(); + clearScoreStates(); if (func_8034BAFC() != -1) { - func_802C5A3C(func_8034BAFC()); + gameSelect_setGameNumber(func_8034BAFC()); gameFile_load(func_8034BAFC()); func_80347AA8(); } @@ -224,7 +224,7 @@ void chBottlesBonusCursor_update(Actor *this) { D_8037E5B8 = -1; D_8037E5C0.prev_button = sp5C->button; D_8037E5C0.is_completed = 0; - timedFunc_set_2(3.0f, (GenFunction_2)func_8025A6EC, COMUSIC_94_BBONUS, 0x5DC0); + timedFunc_set_2(3.0f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_94_BBONUS, 0x5DC0); timedFunc_set_1(3.0f, (GenFunction_1)func_8025AABC, COMUSIC_94_BBONUS); for(i = 0; i < 20; i++){ bzero(&D_8037E248[i], sizeof(Struct_core2_584D0_0)); @@ -301,7 +301,7 @@ void chBottlesBonusCursor_update(Actor *this) { held_piece->rotation = 0.0f; chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); chBottlesBonusCursor_func_802DF928(D_8037E5C0.unk0); - func_8025A6EC(COMUSIC_96_BBONUS_PICKUP_PIECE, -1); + coMusicPlayer_playMusic(COMUSIC_96_BBONUS_PICKUP_PIECE, -1); subaddie_set_state_with_direction(this, 2, 0.0f, 1); } } @@ -330,7 +330,7 @@ void chBottlesBonusCursor_update(Actor *this) { if((sp5C->button & B_BUTTON) && !(D_8037E5C0.prev_button & B_BUTTON)){ held_piece->state = 0; subaddie_set_state_with_direction(this, 5, 0.0f, 1); - func_8025A6EC(COMUISC_97_BBONUS_DROP_PIECE, -1); + coMusicPlayer_playMusic(COMUISC_97_BBONUS_DROP_PIECE, -1); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; break; @@ -356,7 +356,7 @@ void chBottlesBonusCursor_update(Actor *this) { actor_playAnimationOnce(this); } - timedFunc_set_2(0.25f, (GenFunction_2)func_8025A6EC, sp44, 26000); + timedFunc_set_2(0.25f, (GenFunction_2)coMusicPlayer_playMusic, sp44, 26000); chBottlesBonus_func_802DEA50(D_8037E5C0.unk0); D_8037E5C0.unk0 = -1; } diff --git a/src/core2/ch/climbBase.c b/src/core2/ch/climbBase.c index a6864ff5..5caa9e9a 100644 --- a/src/core2/ch/climbBase.c +++ b/src/core2/ch/climbBase.c @@ -71,13 +71,13 @@ void func_802D77D4(Actor *this) { return; case 2: - sp3C = (f32)(this->unkF4_8 + 0x19); + sp3C = (f32)(this->actorTypeSpecificField + 0x19); player_getPosition(sp40); ml_vec3f_diff_copy(sp4C, this->position, sp40); if (((sp4C[0] * sp4C[0]) + (sp4C[2] * sp4C[2])) < (sp3C * sp3C)) { if ((this->position[1] < sp40[1]) && (sp40[1] <= local->unk0[1])) { if (volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) == 0) { - player_setClimbParams(this->position, local->unk0, (f32)this->unkF4_8, local->unkC); + player_setClimbParams(this->position, local->unk0, (f32)this->actorTypeSpecificField, local->unkC); } } } diff --git a/src/core2/ch/clucker.c b/src/core2/ch/clucker.c index c2b46874..df77cd8b 100644 --- a/src/core2/ch/clucker.c +++ b/src/core2/ch/clucker.c @@ -86,7 +86,7 @@ void func_80357264(Actor *this, s32 next_state){ else skeletalAnim_set(this->unk148, ASSET_185_ANIM_CLUCKER_ATTACK_LONG, 0.0f, randf2( 2.3f, 2.7f)); skeletalAnim_setBehavior(this->unk148, SKELETAL_ANIM_2_ONCE); - func_8030E6A4(SFX_4A_CLUCKER_AHH, randf2(0.85f, 0.95f), 32000); + gcsfx_playWithPitch(SFX_4A_CLUCKER_AHH, randf2(0.85f, 0.95f), 32000); } if(next_state == 5){ @@ -186,7 +186,7 @@ void func_8035765C(Actor *this){ || (sp4C < 0.32 && 0.32 <= sp48) || (sp4C < 0.53 && 0.53 <= sp48) ){ - func_8030E6A4(SFX_80_YUMYUM_CLACK, randf2(0.75f, 0.95f), 32700); + gcsfx_playWithPitch(SFX_80_YUMYUM_CLACK, randf2(0.75f, 0.95f), 32700); } if(sp4C < 0.9 && 0.9 <= sp48){ func_8030E6D4(SFX_2_CLAW_SWIPE); @@ -200,7 +200,7 @@ void func_8035765C(Actor *this){ FUNC_8030E624(SFX_2_CLAW_SWIPE, 0.9f, 32000); } if(sp4C < 0.5 && 0.5 <= sp48){ - func_8030E6A4(SFX_80_YUMYUM_CLACK, randf2(0.75f, 0.95f), 32700); + gcsfx_playWithPitch(SFX_80_YUMYUM_CLACK, randf2(0.75f, 0.95f), 32700); } if(sp4C < 0.9 && 0.9 <= sp48){ func_8030E6D4(SFX_2_CLAW_SWIPE); @@ -214,7 +214,7 @@ void func_8035765C(Actor *this){ if(this->state == 5){ skeletalAnim_getProgressRange(this->unk148, &sp44, &sp40); if(sp44 < 0.1 && 0.1 <= sp40){ - func_8030E6A4(SFX_68_CLUCKER_AAEEGHH, randf2(1.0f, 1.1f), 32000); + gcsfx_playWithPitch(SFX_68_CLUCKER_AAEEGHH, randf2(1.0f, 1.1f), 32000); } if(sp44 < 0.7 && 0.7 <= sp40){ diff --git a/src/core2/ch/code_468E0.c b/src/core2/ch/code_468E0.c index e141c927..50183bb2 100644 --- a/src/core2/ch/code_468E0.c +++ b/src/core2/ch/code_468E0.c @@ -41,7 +41,7 @@ void func_802CD8C0(Actor *this){ marker_despawn(this->marker); return; } - if(this->unkF4_8 != 0x32 && func_8028E4A4() != this->unkF4_8){ + if(this->actorTypeSpecificField != 0x32 && func_8028E4A4() != this->actorTypeSpecificField){ marker_despawn(this->marker); return; } diff --git a/src/core2/ch/collectible.c b/src/core2/ch/collectible.c index 1a2eef0e..2b190c99 100644 --- a/src/core2/ch/collectible.c +++ b/src/core2/ch/collectible.c @@ -4,7 +4,7 @@ extern void actor_setOpacity(Actor*,s32); -extern void func_8035644C(u32); +extern void progressDialog_showDialogMaskZero(u32); bool chCollectible_collectItem(Actor*, enum file_progress_e, enum asset_e, enum comusic_e, enum item_e, f32); Actor *chCollectible_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3); @@ -77,8 +77,8 @@ void func_802D8C98(Actor *this, s32 arg1) { } bool chCollectible_collectItem(Actor* actor, enum file_progress_e arg1, enum asset_e dialogId, enum comusic_e sfxId, enum item_e itemId, f32 arg5){ - func_8025A6EC(sfxId,32000); - timedFunc_set_1(0.75f, (GenFunction_1)func_8035644C, arg1); + coMusicPlayer_playMusic(sfxId,32000); + timedFunc_set_1(0.75f, (GenFunction_1)progressDialog_showDialogMaskZero, arg1); if(!func_802FADD4(0x1b)){ item_inc(itemId); } else { diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index ad298b90..0534106d 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -44,7 +44,7 @@ void __chCrab_802CB078(Actor *this) { return; } else{ - if( func_80329530(this, 1500) + if( subaddie_playerIsWithinSphereAndActive(this, 1500) && ( (this->modelCacheIndex == ACTOR_F2_BLACK_SNIPPET) || func_803292E0(this)) ) { this->actor_specific_1_f = 0.0f; @@ -66,7 +66,7 @@ void __chCrab_touch(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); if ((this->state == 4) && func_803294F0(this, 80, func_80329784(this))) { - FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 28000, this->position, 950, 1900); + sfx_playFadeShorthandDefault(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 28000, this->position, 950, 1900); __chCrab_802CB140(this); subaddie_set_state(this, 1); } @@ -80,11 +80,11 @@ void __chCrab_ow(ActorMarker *marker, ActorMarker *other) { subaddie_set_state(this, 6); actor_playAnimationOnce(this); if (marker->id == MARKER_13_SNIPPET) { - FUNC_8030E8B4(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); + sfx_playFadeShorthandDefault(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); marker->id = MARKER_16B_SNIPPET_UPSIDEDOWN; } if (marker->id == MARKER_DD_BLACK_SNIPPET) { - FUNC_8030E8B4(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); + sfx_playFadeShorthandDefault(SFX_6E_VILE_EGH, 2.0f, 26000, this->position, 950, 1900); marker->id = MARKER_DE_BLACK_SNIPPET_UPSIDEDOWN; } } @@ -94,7 +94,7 @@ void __chCrab_particleEmitterSetup(ParticleEmitter *p_ctrl, f32 position[3]) { particleEmitter_setDrawMode(p_ctrl, 2); particleEmitter_func_802EF9F8(p_ctrl, 0.7f); particleEmitter_func_802EFA18(p_ctrl, 5); - func_802EFA20(p_ctrl, 0.8f, 1.0f); + particleEmitter_func_802EFA20(p_ctrl, 0.8f, 1.0f); particleEmitter_setSfx(p_ctrl, SFX_1F_HITTING_AN_ENEMY_3, 10000); particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f); particleEmitter_setParticleLifeTimeRange(p_ctrl, 3.5f, 3.5f); @@ -175,8 +175,8 @@ void __chCrab_die(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); is_mutant_snippet = this->modelCacheIndex == ACTOR_F5_MUTIE_SNIPPET; is_black_snippet = this->modelCacheIndex == ACTOR_F2_BLACK_SNIPPET; - FUNC_8030E8B4(SFX_79_TICKER_DEATH, 1.0f, 32750, this->position, 950, 1900); - FUNC_8030E8B4(SFX_79_TICKER_DEATH, 1.0f, 28000, this->position, 950, 1900); + 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])); this->lifetime_value = 5.0f; marker->collidable = FALSE; @@ -191,7 +191,7 @@ void __chCrab_die(ActorMarker *marker, ActorMarker *other){ jiggy_spawn_position[0] = 13814.0f; jiggy_spawn_position[1] = 3812.0f; jiggy_spawn_position[2] = 0.0f; - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); func_80324DBC(2.25f, ASSET_D33_DIALOG_MUTANT_CRAB_DEFEAT, 0xF, jiggy_spawn_position, NULL, __chCrab_mutantTextCallback, NULL); } } @@ -216,10 +216,10 @@ void __chCrab_die(ActorMarker *marker, ActorMarker *other){ void __chCrab_walkSfxUpdate(Actor *this) { if (actor_animationIsAt(this, 0.4f)) { - FUNC_8030E8B4(SFX_3D_TICKER_WALKING, 0.85f, 15000, this->position, 950, 1900); + sfx_playFadeShorthandDefault(SFX_3D_TICKER_WALKING, 0.85f, 15000, this->position, 950, 1900); } if (actor_animationIsAt(this, 0.9f)) { - FUNC_8030E8B4(SFX_3D_TICKER_WALKING, 1.15f, 15000, this->position, 950, 1900); + sfx_playFadeShorthandDefault(SFX_3D_TICKER_WALKING, 1.15f, 15000, this->position, 950, 1900); } } @@ -252,7 +252,7 @@ void chCrab_update(Actor *this) { } if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) != 0) { - if (this->unkF4_8 != 1) { + if (this->actorTypeSpecificField != 1) { marker_despawn(this->marker); return; } @@ -264,11 +264,11 @@ void chCrab_update(Actor *this) { && !mapSpecificFlags_get(0) && is_mutant_snippet && !jiggyscore_isCollected(JIGGY_16_CC_SNIPPETS) - && func_80329530(this, 500) && !func_80329530(this, 200) + && subaddie_playerIsWithinSphereAndActive(this, 500) && !subaddie_playerIsWithinSphereAndActive(this, 200) && !player_movementGroup() ) { if ((this->state != 6) && (this->state != 5)) { - gcdialog_showText(ASSET_D32_DIALOG_MUTANT_CRAB_MEET, 0xF, this->position, NULL, __chCrab_mutantTextCallback, NULL); + gcdialog_showDialog(ASSET_D32_DIALOG_MUTANT_CRAB_MEET, 0xF, this->position, NULL, __chCrab_mutantTextCallback, NULL); mapSpecificFlags_set(0, TRUE); levelSpecificFlags_set(LEVEL_FLAG_E_CC_UNKNOWN, TRUE); this->has_met_before = TRUE; @@ -279,12 +279,12 @@ void chCrab_update(Actor *this) { && levelSpecificFlags_get(LEVEL_FLAG_2_TTC_UNKNOWN) && !volatileFlag_get(VOLATILE_FLAG_2_FF_IN_MINIGAME) && !jiggyscore_isCollected(JIGGY_10_TTC_SANDCASTLE) - && func_80329530(this, 1600) + && subaddie_playerIsWithinSphereAndActive(this, 1600) ) { - gcdialog_showText(0xA12, 4, this->position, NULL, NULL, NULL); + gcdialog_showDialog(0xA12, 4, this->position, NULL, NULL, NULL); mapSpecificFlags_set(0, TRUE); } else if (mapSpecificFlags_get(1)) { - gcdialog_showText(0xA13, 4, this->position, NULL, NULL, NULL); + gcdialog_showDialog(0xA13, 4, this->position, NULL, NULL, NULL); mapSpecificFlags_set(1, FALSE); } } diff --git a/src/core2/ch/explosionripple.c b/src/core2/ch/explosionripple.c new file mode 100644 index 00000000..83b21b09 --- /dev/null +++ b/src/core2/ch/explosionripple.c @@ -0,0 +1,27 @@ +#include +#include "functions.h" +#include "variables.h" + +void explosionRipple_update(Actor *this); + +/* .data */ +ActorInfo chExplosionRipple = { MARKER_65_SHRAPNEL, ACTOR_F3_EXPLOSION_RIPPLE, 0x0, 0x0, 0x0, explosionRipple_update, actor_update_func_80326224, func_80325340, 0, 0, 0.0f, 0}; + +/* .code */ +void explosionRipple_update(Actor *this) { + + if (!this->initialized) { + actor_collisionOff(this); + this->lifetime_value = 0.0f; + this->pitch = 90.0f; + fxRipple_802F3554(4, this->position); + this->initialized = TRUE; + return; + } + + this->lifetime_value += time_getDelta(); + + if (2.0 < this->lifetime_value) { + marker_despawn(this->marker); + } +} diff --git a/src/core2/ch/firefx.c b/src/core2/ch/firefx.c index 8e2327e8..818bfc42 100644 --- a/src/core2/ch/firefx.c +++ b/src/core2/ch/firefx.c @@ -55,7 +55,7 @@ void __chfirefx_spawnSpark(f32 position[3], f32 scale){ void __chfirefx_hiss(ActorMarker *marker,ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - FUNC_8030E8B4(SFX_96_HOTSAND_EEL_HISS, 1.0f, 32000, actor->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_96_HOTSAND_EEL_HISS, 1.0f, 32000, actor->position, 1000, 2000); } void chfirefx_update(Actor *this){ @@ -65,7 +65,7 @@ void chfirefx_update(Actor *this){ actor_collisionOn(this); marker_setCollisionScripts(this->marker, __chfirefx_hiss, NULL, NULL); this->unk38_31 = (0.0f != this->yaw) ? 1 : 0; - if(this->unkF4_8 != 0x32){ + if(this->actorTypeSpecificField != 0x32){ this->unk1C[0] = 1.0f; this->unk44_31 = func_8030ED2C(SFX_128_FIRE_CRACKING, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.1f); @@ -85,7 +85,7 @@ void chfirefx_update(Actor *this){ }//L803599F4 if(0.0f != this->unk1C[0]){ func_8030DB04(this->unk44_31, 7000, this->position, 300.0f, 800.0f); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } }//L80359A2C } diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index ac056011..6c9a28dd 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "gameSelect.h" #include "core2/modelRender.h" @@ -11,13 +12,13 @@ #define ABS(d) ((d) >= 0) ? (d) : -(d) #endif -void func_8031FBF8(void); -void func_8031FBA0(void); +void debugScoreStates(void); +void clearScoreStates(void); -Actor *func_802C4360(ActorMarker *, Gfx **, Mtx **, Vtx **); -Actor *func_802C4464(ActorMarker *, Gfx **, Mtx **, Vtx **); -void func_802C4C14(Actor *this); -void func_802C5740(Actor *this); +Actor *gameSelect_draw(ActorMarker *, Gfx **, Mtx **, Vtx **); +Actor *gameSelect_zoomboxDraw(ActorMarker *, Gfx **, Mtx **, Vtx **); +void gameSelect_update(Actor *this); +void gameSelect_initAndUpdate(Actor *this); extern void func_802C71F0(Actor *); extern void func_802C74F4(Actor *, s32, f32 ); @@ -30,55 +31,59 @@ extern char *gcpausemenu_TimeToA(int); extern struct5Bs *func_803097A0(void); /* .data */ -f32 D_80365DD0[3][3] = { - {-320.0f, 340.0f, 350.0f}, - {110.0f, 340.0f, 110.0f}, - {-413.333313f, 353.333313f, -234.305511f} -}; -u8 *D_80365DF4 = "USE THE CONTROL STICK TO SELECT A GAME."; -u8 *D_80365DF8 = "PRESS A TO PLAY THE GAME OR Z TO ERASE IT!"; -u8 *D_80365DFC = "ARE YOU SURE? PRESS A TO CONFIRM, OR B TO CANCEL"; -s32 D_80365E00 = -1; -f32 D_80365E04[3][3] = { - {-435.0f, 278.0f, -159.0f}, - { 444.635437f, 216.0f, -356.591675f}, - { 55.0f, 191.822906f, -905.96875f} +f32 INITIAL_CAMERA_POSITIONS[3][3] = { + { -320.0f, 340.0f, 350.0f }, + { 110.0f, 340.0f, 110.0f }, + { -413.333313f, 353.333313f, -234.305511f } }; -ActorAnimationInfo D_80365E28[] = { - {0x000, 0.0f}, - {0x24D, 9e+09f}, - {0x24D, 2.0f}, - {0x24E, 1.0f}, - {0x24F, 0.6f}, - {0x24D, 2.0f} -}; -ActorInfo D_80365E58 = { 0xE4, 0x195, 0x532, 0x1, D_80365E28, func_802C5740, actor_update_func_80326224, func_802C4464, 0, 0, 0.0f, 0}; +u8 *CONTROL_STICK_INSTRUCTIONS = "USE THE CONTROL STICK TO SELECT A GAME."; +u8 *ERASE_INSTRUCTIONS = "PRESS A TO PLAY THE GAME OR Z TO ERASE IT!"; +u8 *ERASE_CONFIRMATION = "ARE YOU SURE? PRESS A TO CONFIRM, OR B TO CANCEL"; -ActorAnimationInfo D_80365E7C[] = { - {0x000, 0.0f}, - {0x250, 9e+09f}, - {0x250, 4.5f}, - {0x251, 1.0f}, - {0x252, 0.67f}, - {0x250, 4.5f}, -}; -ActorInfo D_80365EAC = { 0xE5, 0x196, 0x532, 0x1, D_80365E7C, func_802C4C14, actor_update_func_80326224, func_802C4360, 0, 0, 0.0f, 0}; +s32 gameNumber = -1; -ActorAnimationInfo D_80365ED0[] = { - {0x000, 0.0f}, - {0x24A, 9e+09f}, - {0x24A, 1.0f}, - {0x24B, 1.0f}, - {0x24C, 1.0f}, - {0x24A, 1.0f} +f32 INITIAL_CAMERA_TARGETS[3][3] = { + { -435.0f, 278.0f, -159.0f }, + { 444.635437f, 216.0f, -356.591675f }, + { 55.0f, 191.822906f, -905.96875f } }; -ActorInfo D_80365F00 = { 0xE6, 0x197, 0x532, 0x1, D_80365ED0, func_802C4C14, actor_update_func_80326224, func_802C4360, 0, 0, 0.0f, 0}; +ActorAnimationInfo banjoSleepingAnimations[] = { + { 0x000, 0.0f }, + { 0x24D, 9e+09f }, + { 0x24D, 2.0f }, + { 0x24E, 1.0f }, + { 0x24F, 0.6f }, + { 0x24D, 2.0f } +}; +ActorInfo gameSelect_banjoSleeping = { 0xE4, 0x195, 0x532, 0x1, banjoSleepingAnimations, gameSelect_initAndUpdate, actor_update_func_80326224, gameSelect_zoomboxDraw, 0, 0, 0.0f, 0 }; + +ActorAnimationInfo banjoGameboyAnimations[] = { + { 0x000, 0.0f }, + { 0x250, 9e+09f }, + { 0x250, 4.5f }, + { 0x251, 1.0f }, + { 0x252, 0.67f }, + { 0x250, 4.5f } +}; +ActorInfo gameSelect_banjoGameboy = { 0xE5, 0x196, 0x532, 0x1, banjoGameboyAnimations, gameSelect_update, actor_update_func_80326224, gameSelect_draw, 0, 0, 0.0f, 0 }; + +ActorAnimationInfo banjoCookingAnimations[] = { + { 0x000, 0.0f }, + { 0x24A, 9e+09f }, + { 0x24A, 1.0f }, + { 0x24B, 1.0f }, + { 0x24C, 1.0f }, + { 0x24A, 1.0f } +}; +ActorInfo gameSelect_banjoCooking = { 0xE6, 0x197, 0x532, 0x1, banjoCookingAnimations, gameSelect_update, actor_update_func_80326224, gameSelect_draw, 0, 0, 0.0f, 0 }; /* .bss */ -s32 mm_hut_smash_count; -u32 CH_TREASUREHUNT_PUZZLE_CURRENT_STEP; +// Fun level specific things- why would the devs define these here? +s32 mmhut_smashCount; +u32 chtreasureHunt_puzzleCurrentStep; + struct FF_StorageStruct* D_8037DCB8; s32 D_8037DCBC; u8 gCompletedBottleBonusGames[7]; // bottle bonus puzzle? @@ -94,26 +99,27 @@ s32 pad_8037DCD4; s32 pad_8037DCD8; struct { - u8 *unk0; - u8 *unk4; -} D_8037DCE0; -s32 D_8037DCE8; -s32 D_8037DCEC; + u8 *controlInstruction; + u8 *eraseInstruction; +} selectInstructions; + +s32 previousGameNumber; +bool isFileMoving; // Is the camera / player moving between save files? GcZoombox *chGameSelectTopZoombox; GcZoombox *chGameSelectBottomZoombox; -f32 D_8037DCF8[2][3]; -f32 D_8037DD10[2][3]; -s32 D_8037DD28; -s32 D_8037DD2C; -f32 D_8037DD30; -f32 D_8037DD34; - - +f32 cameraPositions[2][3]; +f32 cameraDelta[2][3]; +s32 cookingSoundEffectIndex; +bool isTopTextNotFinishedDisplaying; +f32 gameSelectCameraDelta; +f32 cycleInstructionsTimer; /* .code */ -Actor *func_802C4360(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ - s32 sp1C = marker->id - 0xe4; - func_8033A45C(3, sp1C); +Actor *gameSelect_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { + // Get the game number from the actor. The actor ids start at 0xE4 so this will turn into 0 - 2. + s32 game_number = marker->id - 0xE4; + + func_8033A45C(3, game_number); func_8033A45C(1, 1); func_8033A45C(4, 1); func_8033A45C(9, 1); @@ -123,72 +129,95 @@ Actor *func_802C4360(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_8033A45C(7, 0); func_8033A45C(0xC, 1); func_8033A45C(0xF, 1); - if(sp1C == D_80365E00){ + + // If this is the actor for the selected game, make Banjo normal- otherwise grey him out + if (game_number == gameNumber) { modelRender_setEnvColor(0xFF, 0xFF, 0xFF, 0xFF); - } - else{ + } else { modelRender_setEnvColor(0x64, 0x64, 0x64, 0xFF); } + return actor_draw(marker, gfx, mtx, vtx); } -Actor *func_802C4464(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ - Actor *ret_val = func_802C4360(marker, gfx, mtx, vtx); - if(chGameSelectBottomZoombox) +Actor *gameSelect_zoomboxDraw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { + Actor *ret_val = gameSelect_draw(marker, gfx, mtx, vtx); + + if (chGameSelectBottomZoombox) { gczoombox_draw(chGameSelectBottomZoombox, gfx, mtx, vtx); - if(chGameSelectTopZoombox) + } + + if (chGameSelectTopZoombox) { gczoombox_draw(chGameSelectTopZoombox, gfx, mtx, vtx); - return ret_val; + } + return ret_val; } -void func_802C44D0(s32 arg0, s32 arg1){ - if(arg1 == 3) - D_8037DD2C = 0; +void topZoomboxCallback(s32 portraitId, s32 state) { + // Is the zoombox state in finished? + if (state == 3) { + isTopTextNotFinishedDisplaying = FALSE; + } } -void *func_802C44EC(f32 arg0[3], f32 arg1[3], f32 arg2) { - f32 phi_f12; - f32 sp40[3]; +// Fancy trigonometry- please update the descriptions if you understand them +void *calculateGameSelectCameraPosition(f32 from[3], f32 to[3], f32 deltaTime) { + f32 sqrt_totals; + f32 delta[3]; s32 i; - static bool D_8037DD38; - static f32 D_8037DD3C; - static f32 D_8037DD40; - arg2 = (arg2 > 0.75) ? 0.75 : arg2; - sp40[0] = arg1[0] - arg0[0]; - sp40[1] = arg1[1] - arg0[1]; - sp40[2] = arg1[2] - arg0[2]; - D_8037DD38 = D_8037DD38^1; - phi_f12 = gu_sqrtf(sp40[0]*sp40[0] + sp40[1]*sp40[1] + sp40[2]*sp40[2]); - if (phi_f12 < 10.0f) { - phi_f12 = 500.0f; - } - D_8037DD3C = 1.0 + (9.0f / gu_sqrtf(phi_f12)); - D_8037DD40 = sinf(D_8037DD3C*1.5707963267948966); - for(i = 0; i < 3; i++){ - D_8037DD10[D_8037DD38][i] = arg0[i] + ((arg1[i] - arg0[i])*sinf((((arg2 / 0.75) * 3.1415926535897931) / 2) * D_8037DD3C)) / D_8037DD40; - D_8037DCF8[D_8037DD38][i] += (D_8037DD10[D_8037DD38][i] - D_8037DCF8[D_8037DD38][i]) / 5.0; + static s32 dummy_index; // Always zero + static f32 bounciness; // This helps give the camera that "rubber band" quality when moving between saves + static f32 sin_bounciness_half_pi; + // At max, this can take ~3/4s of a second- this acts as that upper bound + deltaTime = (deltaTime > 0.75) ? 0.75 : deltaTime; + + delta[0] = to[0] - from[0]; + delta[1] = to[1] - from[1]; + delta[2] = to[2] - from[2]; + dummy_index = dummy_index^1; + + sqrt_totals = gu_sqrtf((delta[0] * delta[0]) + (delta[1] * delta[1]) + (delta[2] * delta[2])); + + if (sqrt_totals < 10.0f) { + sqrt_totals = 500.0f; } - return &D_8037DCF8[D_8037DD38]; + + bounciness = 1.0 + (9.0f / gu_sqrtf(sqrt_totals)); + sin_bounciness_half_pi = sinf(bounciness * 1.5707963267948966); + + for (i = 0; i < 3; i++) { + cameraDelta[dummy_index][i] = from[i] + + ( + ((to[i] - from[i]) * sinf((((deltaTime / 0.75) * 3.1415926535897931) / 2) * bounciness)) + / sin_bounciness_half_pi + ); + cameraPositions[dummy_index][i] += (cameraDelta[dummy_index][i] - cameraPositions[dummy_index][i]) / 5.0; + } + + return &cameraPositions[dummy_index]; } -void func_802C4768(s32 gamenum){ - u8 * sp20[2]; +void setGameInformationZoombox(s32 gamenum) { + u8 *zoombox_strings[2]; static u8 upperTextLine[0x20]; static u8 lowerTextLine[0x20]; - func_8031FBF8(); - D_80365E00 = gamenum; - func_8031FBA0(); - if(gameFile_isNotEmpty(gamenum)){ + debugScoreStates(); + gameNumber = gamenum; + clearScoreStates(); + + if (gameFile_isNotEmpty(gamenum)) { gameFile_load(gamenum); D_8037DCCE[gamenum] = (itemscore_timeScores_get(LEVEL_6_LAIR)) ? 1 : 0; strcpy(upperTextLine, ""); strcat(upperTextLine, "GAME "); - switch(gamenum){ + + // Game number to human readable. Interestingly, gamenumber 1 is Banjo playing gameboy as opposed to cooking + switch (gamenum) { case 0: //L802C4820 strIToA(upperTextLine, 1); break; @@ -198,7 +227,8 @@ void func_802C4768(s32 gamenum){ case 2: //L802C484C strIToA(upperTextLine, 2); break; - }//L802C4858 + } //L802C4858 + strcat(upperTextLine, ": TIME "); strcat(upperTextLine, gcpausemenu_TimeToA(itemscore_timeScores_getTotal())); strcat(upperTextLine, ","); @@ -207,22 +237,25 @@ void func_802C4768(s32 gamenum){ strcpy(lowerTextLine, ""); strIToA(lowerTextLine, jiggyscore_total()); strcat(lowerTextLine, " JIGSAW"); - if(jiggyscore_total() != 1){ + if (jiggyscore_total() != 1) { strcat(lowerTextLine, "S"); } + strcat(lowerTextLine, ", "); strIToA(lowerTextLine, itemscore_noteScores_getTotal()); strcat(lowerTextLine, " NOTE"); - if(itemscore_noteScores_getTotal() != 1){ + if (itemscore_noteScores_getTotal() != 1) { strcat(lowerTextLine, "S"); } + strcat(lowerTextLine, "."); strcat(lowerTextLine, ""); - }//L802C49AC - else{ + } else { //L802C49AC D_8037DCCE[gamenum] = 0; strcpy(upperTextLine, ""); strcat(upperTextLine, "GAME "); + + // Game number to human readable switch (gamenum){ case 0: strIToA(upperTextLine, 1); @@ -233,43 +266,47 @@ void func_802C4768(s32 gamenum){ case 2: strIToA(upperTextLine, 2); break; - }//L802C4A40 + } //L802C4A40 + strcat(upperTextLine, ": EMPTY"); strcpy(lowerTextLine, ""); - }//L802C4A68 - sp20[0] = upperTextLine;\ - sp20[1] = lowerTextLine; + } //L802C4A68 + + // Can't delete backslash + zoombox_strings[0] = upperTextLine;\ + zoombox_strings[1] = lowerTextLine; + func_8031877C(chGameSelectBottomZoombox); - gczoombox_setStrings(chGameSelectBottomZoombox, 2, sp20); + gczoombox_setStrings(chGameSelectBottomZoombox, 2, zoombox_strings); gczoombox_maximize(chGameSelectBottomZoombox); gczoombox_resolve_minimize(chGameSelectBottomZoombox); } -void func_802C4AC8(s32 arg0){ - gameFile_clear(arg0); - func_802C4768(arg0); +void eraseGame(s32 gamenum) { + gameFile_clear(gamenum); + setGameInformationZoombox(gamenum); } -void func_802C4AF0(Actor * this){ +void gameSelect_free(Actor *this){ int i; - if(chGameSelectTopZoombox){ + if (chGameSelectTopZoombox) { gczoombox_free(chGameSelectTopZoombox); chGameSelectTopZoombox = NULL; } - if(chGameSelectBottomZoombox){ + if (chGameSelectBottomZoombox) { gczoombox_free(chGameSelectBottomZoombox); chGameSelectBottomZoombox = NULL; } - for(i = 0; i < 3; i++){ + for (i = 0; i < 3; i++) { gameFile_8033CFD4(i); } - if(D_8037DD28){ - func_802F9D38(D_8037DD28); - D_8037DD28 = NULL; + if (cookingSoundEffectIndex) { + func_802F9D38(cookingSoundEffectIndex); + cookingSoundEffectIndex = NULL; } comusic_8025AB44(COMUSIC_73_GAMEBOY, 0, 4000); @@ -277,345 +314,403 @@ void func_802C4AF0(Actor * this){ func_8025AB00(); } -void func_802C4BB4(ActorMarker *marker){ +// Using the Banjo actor, spawn in the needed actors for their "scene" +void spawnGameSelectProps(ActorMarker *marker) { Actor *this; - s32 sp20; - Actor *other; - f32 sp18; - sp20 = marker->id - 0xe4; + s32 game_number; + Actor *prop; + f32 scale; + game_number = marker->id - 0xE4; // Actor ID to game number this = marker_getActor(marker); - sp18 = this->scale; - other = actor_spawnWithYaw_f32(sp20 + 0x198, this->position, (s32)this->yaw); - other->scale = sp18; + scale = this->scale; + prop = actor_spawnWithYaw_f32(game_number + ACTOR_198_BANJOS_BED, // Bed -> Chair -> Stove + this->position, (s32)this->yaw); + prop->scale = scale; } -void func_802C4C14(Actor *this){ - int sp84; - int sp80; - s32 sp74[3]; - s32 *tmp_a2; //pad70 - s32 pad_6C; - s32 pad_68; - s32 sp5C[3]; - s32 pad_58; - f32 sp54; - f32 sp50; - int i; //sp4C +void gameSelect_update(Actor *this) { + int game_number; + int game_numbers_match; + s32 side_buttons[3]; + + s32 *unused_padding; + s32 unused_padding_2; + s32 unused_padding_3; + + s32 face_buttons[3]; + + s32 unused_padding_4; + + f32 joystick; + f32 delta_time; + int i; struct5Bs *sp48; - f32 sp44; - s32 tmp_a2_2; + f32 function_time; + s32 previous_game_number; f32 sp34[3]; - sp84 = this->marker->id - 0xe4; - sp80 = (sp84 == D_80365E00); - sp50 = time_getDelta(); - if(chGameSelectBottomZoombox == NULL) - return; + // Actor ID to game number + game_number = this->marker->id - 0xE4; - if(!this->initialized){ - __spawnQueue_add_1((GenFunction_1)func_802C4BB4, reinterpret_cast(s32, this->marker)); + game_numbers_match = (game_number == gameNumber); + delta_time = time_getDelta(); + + if (chGameSelectBottomZoombox == NULL) { + return; + } + + if (!this->initialized) { + __spawnQueue_add_1((GenFunction_1)spawnGameSelectProps, reinterpret_cast(s32, this->marker)); func_802C7318(this); this->unk130 = func_802C71F0; - if(sp84 == 0){ + + if (game_number == 0) { func_802C75A0(this, 1); func_802C74F4(this, 0, 1.0f); func_802C74F4(this, 1, 1.0f); - }//L802C4CD8 + } + this->initialized = TRUE; - }//L802C4CE4 + } + func_802C7478(this); - if(!sp80){ - if(this->state != 1){ - subaddie_set_state(this, 1); + + if (!game_numbers_match) { + if (this->state != GAME_SELECT_INITIALIZE) { + subaddie_set_state(this, GAME_SELECT_INITIALIZE); + } + + return; + } + + controller_copySideButtons(0, side_buttons); + controller_copyFaceButtons(0, face_buttons); + controller_getJoystick(0, &joystick); + + switch (this->state) { + case GAME_SELECT_IDLE: + case GAME_SELECT_ERASE_CONFIRMATION: + switch (game_number) { + case 0: // Sleeping Banjo; cycle his snoring sfx + if (actor_animationIsAt(this, 0.1f)) { + gcsfx_playAtSampleRate(SFX_5D_BANJO_RAAOWW, 8000); + } + + if (actor_animationIsAt(this, 0.7f)) { + gcsfx_playAtSampleRate(SFX_5E_BANJO_PHEWWW, 8000); + } + + break; + + case 1: // Gaming Banjo; randomly play some game low bloop sounds + if (randf() < 0.1) { + gcsfx_playWithPitch(MIN(2.0f, randf() * 3.0f) + SFX_137_GAMEBOY_BOIN, 1.0f, 12000); + } + + break; + + case 2: // Cooking Banjo; randomly play bubble popping at random pitch + if (randf() < 0.03) { + gcsfx_playWithPitch(SFX_3ED_BUBBLE_POP, randf() * 0.3 + 0.7, 15000); + } + + break; + } + break; + } + + if (!func_8038AAB0()) { + switch (this->state) { + case GAME_SELECT_INITIALIZE: + if (game_number == 1) { + gcsfx_playAtSampleRate(SFX_136_GAMEBOY_STARTUP, 15000); + timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_73_GAMEBOY, -1, 2000); + func_8025A58C(0, 2000); + } else { + comusic_8025AB44(COMUSIC_73_GAMEBOY, 0, 4000); + func_8025A58C(-1, 2000); + } + + if (game_number == 2) { + cookingSoundEffectIndex = func_802F9AA8(SFX_12B_BOILING_AND_BUBBLING); + func_802F9F80(cookingSoundEffectIndex, 0.5f, 9000000000.0f, 0.5f); + func_802F9DB8(cookingSoundEffectIndex, 0.9f, 0.9f, 0.0f); + func_802FA060(cookingSoundEffectIndex, 15000, 15000, 0.0f); + } else if (cookingSoundEffectIndex) { + func_802F9D38(cookingSoundEffectIndex); + cookingSoundEffectIndex = NULL; + } + + setGameInformationZoombox(game_number); + subaddie_set_state(this, GAME_SELECT_IDLE); + break; + + case GAME_SELECT_ERASE_CONFIRMATION: + // Don't let the player make a decision until the text has gone through + if (isTopTextNotFinishedDisplaying == FALSE + && (face_buttons[FACE_BUTTON(BUTTON_A)] == 1 || face_buttons[FACE_BUTTON(BUTTON_B)] == 1)) { + + if (face_buttons[FACE_BUTTON(BUTTON_A)] == 1) { + eraseGame(game_number); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 22000); + } + + subaddie_set_state(this, GAME_SELECT_IDLE); + func_8031877C(chGameSelectTopZoombox); + gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&selectInstructions); + cycleInstructionsTimer = 0.0f; + } + + break; + + case GAME_SELECT_STARTING: + case GAME_SELECT_STARTING_SILLY: + if (anctrl_isStopped(this->anctrl)) { + chBottlesBonus_resetCompleted(); + + if (!gameFile_isNotEmpty(game_number)) { // New game + timedFunc_set_3(0.0f, (GenFunction_3) transitionToMap, MAP_85_CS_SPIRAL_MOUNTAIN_3, 0, 1); + } else { + function_time = 0.0f; + + // Add a little extra time for the silly animation + if (this->state == GAME_SELECT_STARTING_SILLY && (game_number == 0 || game_number == 1)) { + function_time = 0.25f; + } + + // If player has gone into the lair, spawn them there + if (chmole_learnedAllSpiralMountainAbilities() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)) { + timedFunc_set_2(function_time, (GenFunction_2) warp_lairEnterLairFromSMLevel, 0, 0); + } else { // Otherwise, they're still in Spiral Mountain + timedFunc_set_2(function_time, (GenFunction_2) warp_smExitBanjosHouse, 0, 0); + } + + timedFunc_set_1(function_time, (GenFunction_1) func_80335110, 1); + } + + this->state = GAME_SELECT_DONE; + } + break; + + case GAME_SELECT_IDLE: + if (side_buttons[SIDE_BUTTON(BUTTON_Z)] == 1) { // Delete file + if (gameFile_isNotEmpty(game_number)) { + func_8031877C(chGameSelectTopZoombox); + func_803183A4(chGameSelectTopZoombox, (&ERASE_CONFIRMATION)[code94620_func_8031B5B0()]); + isTopTextNotFinishedDisplaying = TRUE; + subaddie_set_state(this, GAME_SELECT_ERASE_CONFIRMATION); + } else { + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 22000); + } + } else if (face_buttons[FACE_BUTTON(BUTTON_A)] == 1) { // Select file + if (gameFile_isNotEmpty(game_number)) { + if (randf() < 0.1) { // Rarely activate "silly" animations + switch (game_number) { + case 0: // Sleeping Banjo; Out the window + gcsfx_playAtSampleRate(SFX_31_BANJO_OHHWAAOOO, 28000); + gcsfx_play(SFX_135_CARTOONY_SPRING); + timedFunc_set_2(0.4f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_13A_GLASS_BREAKING_7, 0x7FFF); + timedFunc_set_2(0.9f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_150_PORCELAIN_CRASH, 0x7FFF); + timedFunc_set_2(1.0f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_151_CAT_MEOW, 0x7FFF); + break; + case 1: // Gaming Banjo; Springy chair + timedFunc_set_2(0.4f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_31_BANJO_OHHWAAOOO, 28000); + timedFunc_set_2(0.2f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_E_SHOCKSPRING_BOING, 28000); + gcsfx_play(SFX_2D_KABOING); + break; + case 2: // Cooking Banjo; Spin the kitchen + timedFunc_set_2(0.15f, (GenFunction_2)gcsfx_playAtSampleRate, SFX_32_BANJO_EGHEE, 28000); + gcsfx_playAtSampleRate(SFX_3F6_RUBBING, 28000); + gcsfx_play(SFX_8F_SNOWBALL_FLYING); + break; + } + + subaddie_set_state(this, GAME_SELECT_STARTING_SILLY); + levelSpecificFlags_set(game_number + LEVEL_FLAG_35_UNKNOWN, 1); + } else { + sfxsource_playHighPriority(SFX_3EA_BANJO_GUH_HUH); + subaddie_set_state(this, GAME_SELECT_STARTING); + } + } else { // Start new game + gcsfx_playAtSampleRate(SFX_4F_BANJO_WAHOO, 28000); + subaddie_set_state(this, GAME_SELECT_STARTING); + } + + if (game_number == 0) { + func_802C75A0(this, 2); + } + + if (game_number == 1) { + comusic_8025AB44(COMUSIC_73_GAMEBOY, 0, 4000); + } + + func_8025A58C(0, 0x1f4); + actor_playAnimationOnce(this); + + } else { + if ((0.7 < ((0.0f <= joystick) ? joystick : -joystick)) && isFileMoving == FALSE) { + previous_game_number = gameNumber; + + // Joystick went left + if (joystick < 0.0f) { + isFileMoving = TRUE; + + // Switch to file to the left + switch (gameNumber) { + case 0: + isFileMoving = FALSE; + break; + + case 1: + gameNumber = 2; + break; + + case 2: + gameNumber = 0; + break; + } + } else { // Joystick went right + isFileMoving = TRUE; + + // Switch to file to the right + switch (gameNumber) { + case 0: + gameNumber = 2; + break; + case 1: + isFileMoving = FALSE; + break; + case 2: + gameNumber = 1; + break; + } + } + + if (isFileMoving) { + previousGameNumber = previous_game_number; + gameSelectCameraDelta = 0.0f; + } + } else { + if (((0.0f <= joystick) ? joystick : -joystick) < 0.3) { + isFileMoving = FALSE; + } + } + } + + if (isTopTextNotFinishedDisplaying == FALSE) { + cycleInstructionsTimer += delta_time; + if (20.0 < cycleInstructionsTimer) { + func_8031877C(chGameSelectTopZoombox); + gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&selectInstructions); + cycleInstructionsTimer = 0.0f; + } + } + + break; + + case GAME_SELECT_DONE: + break; } } - else{//L802C4D24 - func_8024E60C(0, sp74); - controller_copyFaceButtons(0, sp5C); - controller_getJoystick(0, &sp54); - switch(this->state){ - case 2: - case 5: - switch(sp84){ - case 0://L802C4D8C - if(actor_animationIsAt(this, 0.1f)) - sfxsource_play(SFX_5D_BANJO_RAAOWW, 8000); - if(actor_animationIsAt(this, 0.7f)) - sfxsource_play(SFX_5E_BANJO_PHEWWW, 8000); - break; - case 1://L802C4DD0 - if(randf() < 0.1){ - // if(randf() < D_80376118){ - func_8030E6A4(MIN(2.0f, randf() *3.0f) + 311.0f, 1.0f, 12000); - } - break; - case 2://L802C4E74 - if(randf() < 0.03){ - func_8030E6A4(0x3ed, randf()*0.3 + 0.7, 15000); - } - break; - }//L802C4ED4 - break; - }//L802C4ED4 - if(!func_8038AAB0()){ - switch(this->state){ - case 1://L802C4F10 - if(sp84 == 1){ - sfxsource_play(SFX_136_GAMEBOY_STARTUP, 15000); - timedFunc_set_3(0.25f, (GenFunction_3)comusic_8025AB44, COMUSIC_73_GAMEBOY, -1, 2000); - func_8025A58C(0, 2000); - } - else{ - comusic_8025AB44(COMUSIC_73_GAMEBOY, 0, 4000); - func_8025A58C(-1, 2000); - } + gameSelectCameraDelta += delta_time; + sp48 = func_803097A0(); - if(sp84 == 2){ - D_8037DD28 = func_802F9AA8(SFX_12B_BOILING_AND_BUBBLING); - func_802F9F80(D_8037DD28, 0.5f, 9000000000.0f, 0.5f); - func_802F9DB8(D_8037DD28, 0.9f, 0.9f, 0.0f); - func_802FA060(D_8037DD28, 15000, 15000, 0.0f); - } - else{ - if(D_8037DD28){ - func_802F9D38(D_8037DD28); - D_8037DD28 = NULL; - } - } - func_802C4768(sp84); - subaddie_set_state(this, 2); - break; - case 5://L802C5040 - if(D_8037DD2C == 0 && - (sp5C[FACE_BUTTON(BUTTON_A)] == 1 || sp5C[FACE_BUTTON(BUTTON_B)] == 1) - ){ - if(sp5C[FACE_BUTTON(BUTTON_A)] == 1){ - func_802C4AC8(sp84); - func_8025A6EC(COMUSIC_2B_DING_B, 22000); - } - subaddie_set_state(this, 2); - func_8031877C(chGameSelectTopZoombox); - gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&D_8037DCE0); - D_8037DD34 = 0.0f; - } - break; - case 3://L802C50C8 - case 4://L802C50C8 - if(anctrl_isStopped(this->anctrl)){ - chBottlesBonus_func_802DEB80(); - if(!gameFile_isNotEmpty(sp84)){ - timedFunc_set_3(0.0f, (GenFunction_3)func_802E4078, MAP_85_CS_SPIRAL_MOUNTAIN_3, 0, 1); - } - else{//L802C511C - sp44 = 0.0f; - if(this->state == 4 && (sp84 == 0 || sp84 == 1)) - sp44 = 0.25f; - if(chmole_learnedAllSpiralMountainAbilities() && fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE)){ - timedFunc_set_2(sp44, (GenFunction_2)warp_lairEnterLairFromSMLevel, 0, 0); - } - else{//L802C5188 - timedFunc_set_2(sp44, (GenFunction_2)warp_smExitBanjosHouse, 0, 0); - }//L802C51A0 - timedFunc_set_1(sp44, (GenFunction_1)func_80335110, 1); - }//L802C51B8 - this->state = 6; - } - break; - case 2://L802C51CC - if(sp74[0] == 1){ - if(gameFile_isNotEmpty(sp84)){ - func_8031877C(chGameSelectTopZoombox); - func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[code94620_func_8031B5B0()]); - D_8037DD2C = 1; - subaddie_set_state(this, 5); - } - else{//L802C5240 - func_8025A6EC(COMUSIC_2C_BUZZER, 22000); - } - } - else if(sp5C[FACE_BUTTON(BUTTON_A)] == 1){//L802C5250 - if(gameFile_isNotEmpty(sp84)){ - if(randf() < 0.1){ - switch(sp84){ - case 0://L802C52B8 - sfxsource_play(SFX_31_BANJO_OHHWAAOOO, 28000); - func_8030E540(SFX_135_CARTOONY_SPRING); - timedFunc_set_2(0.4f, (GenFunction_2)sfxsource_play, SFX_13A_GLASS_BREAKING_7, 0x7fff); - timedFunc_set_2(0.9f, (GenFunction_2)sfxsource_play, SFX_150_PORCELAIN_CRASH, 0x7fff); - timedFunc_set_2(1.0f, (GenFunction_2)sfxsource_play, SFX_151_CAT_MEOW, 0x7fff); - break; - case 1://L802C5320 - timedFunc_set_2(0.4f, (GenFunction_2)sfxsource_play, SFX_31_BANJO_OHHWAAOOO, 28000); - timedFunc_set_2(0.2f, (GenFunction_2)sfxsource_play, SFX_E_SHOCKSPRING_BOING, 28000); - func_8030E540(SFX_2D_KABOING); - break; - case 2://L802C5364 - timedFunc_set_2(0.15f, (GenFunction_2)sfxsource_play, SFX_32_BANJO_EGHEE, 28000); - sfxsource_play(SFX_3F6_RUBBING, 28000); - func_8030E540(SFX_8F_SNOWBALL_FLYING); - break; - }//L802C5394 - subaddie_set_state(this, 4); - levelSpecificFlags_set(sp84 + 0x35, 1); - } - else{//L802C53B4 - sfxsource_playHighPriority(SFX_3EA_UNKNOWN); - subaddie_set_state(this, 3); - } - }else{//L802C53D0 - sfxsource_play(SFX_4F_BANJO_WAHOO, 28000); - subaddie_set_state(this, 3); - }//L802C53E8 - if(sp84 == 0) - func_802C75A0(this, 2); - - if(sp84 == 1) - comusic_8025AB44(COMUSIC_73_GAMEBOY, 0, 4000); - - func_8025A58C(0, 0x1f4); - actor_playAnimationOnce(this); - } - else{//L802C5434 - if((0.7 < ((0.0f <= sp54) ? sp54 : -sp54)) && D_8037DCEC == 0 - ){ - tmp_a2_2 = D_80365E00; - if(sp54 < 0.0f){ - D_8037DCEC = 1; - switch(D_80365E00){ - case 0: - D_8037DCEC = 0; - break; - case 1: - D_80365E00 = 2; - break; - case 2: - D_80365E00 = 0; - break; - } - } - else{//L802C54D4 - D_8037DCEC = 1; - switch(D_80365E00){ - case 0: - D_80365E00 = 2; - break; - case 1: - D_8037DCEC = 0; - break; - case 2: - D_80365E00 = 1; - break; - } - }//L802C550C - if(D_8037DCEC){ - D_8037DCE8 = tmp_a2_2; - D_8037DD30 = 0.0f; - } - }else{//L802C5530 - if(((0.0f <= sp54) ? sp54 : -sp54) < 0.3){ - D_8037DCEC = 0; - } - } - }//L802C556C - if(D_8037DD2C == 0){ - D_8037DD34 += sp50; - if(20.0 < D_8037DD34){ - func_8031877C(chGameSelectTopZoombox); - gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&D_8037DCE0); - D_8037DD34 = 0.0f; - } - } - break; - case 6://L802C55E8 - break; - } - }//L802C55E8 - D_8037DD30 += sp50; - sp48 = func_803097A0(); - if(this->marker->unk14_21){ - for(i = 0; i < 3; i++){ - func_8034A174(sp48, i+5, sp34); - ml_vec3f_copy(D_80365DD0[i], sp34); - } + if (this->marker->unk14_21) { + for (i = 0; i < 3; i++) { + func_8034A174(sp48, i + 5, sp34); + ml_vec3f_copy(INITIAL_CAMERA_POSITIONS[i], sp34); } - ncStaticCamera_setPositionAndTarget( - func_802C44EC(D_80365DD0[D_8037DCE8], D_80365DD0[D_80365E00], D_8037DD30), - func_802C44EC(D_80365E04[D_8037DCE8], D_80365E04[D_80365E00], D_8037DD30) - ); - if(this->marker->unk14_21) - osViBlack(0); - }//L802C5734 + } + + ncStaticCamera_setPositionAndTarget( + calculateGameSelectCameraPosition(INITIAL_CAMERA_POSITIONS[previousGameNumber], INITIAL_CAMERA_POSITIONS[gameNumber], gameSelectCameraDelta), + calculateGameSelectCameraPosition(INITIAL_CAMERA_TARGETS[previousGameNumber], INITIAL_CAMERA_TARGETS[gameNumber], gameSelectCameraDelta) + ); + + if (this->marker->unk14_21) { + osViBlack(0); + } } -void func_802C5740(Actor * this){ +// Update function for when the scene first loads, set on the sleeping Banjo actor +void gameSelect_initAndUpdate(Actor * this){ int i = code94620_func_8031B5B0(); - D_8037DCE0.unk0 = (&D_80365DF4)[i]; - D_8037DCE0.unk4 = (&D_80365DF8)[i]; - if(!this->initialized){ + selectInstructions.controlInstruction = (&CONTROL_STICK_INSTRUCTIONS)[i]; + selectInstructions.eraseInstruction = (&ERASE_INSTRUCTIONS)[i]; + + if (!this->initialized) { gameFile_8033CE40(); - if(chGameSelectBottomZoombox == NULL){ + + if (chGameSelectBottomZoombox == NULL) { chGameSelectBottomZoombox = gczoombox_new(0xA0, ZOOMBOX_SPRITE_C_BANJO_2, 2, 0, NULL); gczoombox_open(chGameSelectBottomZoombox); gczoombox_func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0); - }//L802C57FC + } - if(chGameSelectTopZoombox == NULL){ - chGameSelectTopZoombox = gczoombox_new(0xA, ZOOMBOX_SPRITE_D_KAZOOIE_1, 2, 1, func_802C44D0); - gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&D_8037DCE0); + if (chGameSelectTopZoombox == NULL) { + chGameSelectTopZoombox = gczoombox_new(0xA, ZOOMBOX_SPRITE_D_KAZOOIE_1, 2, 1, topZoomboxCallback); + gczoombox_setStrings(chGameSelectTopZoombox, 2, (char **)&selectInstructions); gczoombox_open(chGameSelectTopZoombox); gczoombox_maximize(chGameSelectTopZoombox); - }//L802C5860 + } - marker_setFreeMethod(this->marker, func_802C4AF0); - D_8037DCEC = 0; - func_8031FBF8(); - func_8031FBA0(); - D_8037DCE8 = 0; - D_80365E00 = 0; - D_8037DCF8[1][0] = D_80365DD0[0][0]; - D_8037DCF8[1][1] = D_80365DD0[0][1]; - D_8037DCF8[1][2] = D_80365DD0[0][2]; + marker_setFreeMethod(this->marker, gameSelect_free); + isFileMoving = FALSE; + debugScoreStates(); + clearScoreStates(); + previousGameNumber = 0; + gameNumber = 0; + cameraPositions[1][0] = INITIAL_CAMERA_POSITIONS[0][0]; + cameraPositions[1][1] = INITIAL_CAMERA_POSITIONS[0][1]; + cameraPositions[1][2] = INITIAL_CAMERA_POSITIONS[0][2]; - D_8037DCF8[0][0] = D_80365E04[0][0]; - D_8037DCF8[0][1] = D_80365E04[0][1]; - D_8037DCF8[0][2] = D_80365E04[0][2]; - D_8037DD30 = 0.75f; - D_8037DD34 = func_8038AAB0(&D_80365E04[0], &D_8037DCE8) ? 20.0 : 0.0; + cameraPositions[0][0] = INITIAL_CAMERA_TARGETS[0][0]; + cameraPositions[0][1] = INITIAL_CAMERA_TARGETS[0][1]; + cameraPositions[0][2] = INITIAL_CAMERA_TARGETS[0][2]; + gameSelectCameraDelta = 0.75f; + cycleInstructionsTimer = func_8038AAB0(&INITIAL_CAMERA_TARGETS[0], &previousGameNumber) ? 20.0 : 0.0; actor_collisionOff(this); - func_8025A6EC(COMUSIC_73_GAMEBOY, 0); - }//L802C5940 - if(!func_8038AAB0()){ - if(chGameSelectBottomZoombox) - gczoombox_update(chGameSelectBottomZoombox); - if(chGameSelectTopZoombox) - gczoombox_update(chGameSelectTopZoombox); + coMusicPlayer_playMusic(COMUSIC_73_GAMEBOY, 0); } - func_802C4C14(this); -} -void func_802C5994(void){ - s32 sp1C = level_get(); - s32 t6 = map_get() == MAP_83_CS_GAME_OVER_MACHINE_ROOM; - s32 a1 = (0 < sp1C && sp1C < 0xd); - if( a1 || t6) - { - if(D_80365E00 != -1 && !func_802E4A08() && map_get() != MAP_91_FILE_SELECT){ - gameFile_save(D_80365E00); - gameFile_8033CFD4(D_80365E00); + if (!func_8038AAB0()) { + if (chGameSelectBottomZoombox) { + gczoombox_update(chGameSelectBottomZoombox); + } + + if (chGameSelectTopZoombox) { + gczoombox_update(chGameSelectTopZoombox); } } + + gameSelect_update(this); } -s32 func_802C5A30(void){ - return D_80365E00; +void gameSelect_saveAndExit(void) { + s32 level_id = level_get(); + s32 is_map_game_over = map_get() == MAP_83_CS_GAME_OVER_MACHINE_ROOM; + + // Within bounds of levels. 0xD is 1 more than the amount of levels in the game. + s32 is_level_id_valid = (0 < level_id && level_id < 0xD); + + if ((is_level_id_valid || is_map_game_over) + && (gameNumber != -1 && !func_802E4A08() && map_get() != MAP_91_FILE_SELECT)) { + + gameFile_save(gameNumber); + gameFile_8033CFD4(gameNumber); + } } -void func_802C5A3C(s32 arg0){ - D_80365E00 = arg0; +s32 gameSelect_getGameNumber(void) { + return gameNumber; } -void func_802C5A48(void){ - D_80365E00 = -1; +void gameSelect_setGameNumber(s32 num) { + gameNumber = num; +} + +void gameSelect_resetGameNumber(void) { + gameNumber = -1; } diff --git a/src/core2/ch/gameSelect.h b/src/core2/ch/gameSelect.h new file mode 100644 index 00000000..b3f64c3c --- /dev/null +++ b/src/core2/ch/gameSelect.h @@ -0,0 +1,8 @@ +typedef enum { + GAME_SELECT_INITIALIZE = 1, + GAME_SELECT_IDLE = 2, + GAME_SELECT_STARTING = 3, + GAME_SELECT_STARTING_SILLY = 4, + GAME_SELECT_ERASE_CONFIRMATION = 5, + GAME_SELECT_DONE = 6 +} GameSelectState; diff --git a/src/core2/ch/ghost.c b/src/core2/ch/ghost.c index 940cfbe9..d270fcdb 100644 --- a/src/core2/ch/ghost.c +++ b/src/core2/ch/ghost.c @@ -100,7 +100,7 @@ void func_8035B3B4(ActorMarker *this_marker, ActorMarker *other_marker){ } int func_8035B3E4(Actor *this){ - if(func_80329530(this, (s32)(this->scale*600.0f)) && func_803292E0(this)) + if(subaddie_playerIsWithinSphereAndActive(this, (s32)(this->scale*600.0f)) && func_803292E0(this)) return 1; return 0; } diff --git a/src/core2/ch/gloop.c b/src/core2/ch/gloop.c index ba5d505d..b2b8f4e4 100644 --- a/src/core2/ch/gloop.c +++ b/src/core2/ch/gloop.c @@ -59,8 +59,8 @@ void chgloop_update(Actor *this){ subaddie_set_state(this, 4); if( !mapSpecificFlags_get(2) - && func_80329530(this, 350) - && gcdialog_showText(ASSET_D34_DIALOG_GLOOP_MEET, 0, NULL, NULL, NULL, NULL) + && subaddie_playerIsWithinSphereAndActive(this, 350) + && gcdialog_showDialog(ASSET_D34_DIALOG_GLOOP_MEET, 0, NULL, NULL, NULL, NULL) ){ mapSpecificFlags_set(2, TRUE); } @@ -82,11 +82,11 @@ void chgloop_update(Actor *this){ sp34[1] = this->position[1]; sp34[2] = this->position[2]; } - if(func_80329530(this, 1900)){ + if(subaddie_playerIsWithinSphereAndActive(this, 1900)){ __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, randf()/2 + 0.6, 32000, this->position, 100.0f, 3000.0f); + func_8030E9C4(SFX_3ED_BUBBLE_POP, randf()/2 + 0.6, 32000, this->position, 100.0f, 3000.0f); } break; }//L802D1670 diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index bd2c0089..16f3dc29 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -118,7 +118,7 @@ void func_8035EF3C(Actor *this) { if( actor_animationIsAt(this, 0.2f) || actor_animationIsAt(this, 0.7f) ) { - FUNC_8030E8B4(SFX_123_BANJO_LANDING_10, 0.5f, 24000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_123_BANJO_LANDING_10, 0.5f, 24000, this->position, 1750, 3500); } } @@ -133,8 +133,8 @@ void func_8035EF9C(ActorMarker *marker, ActorMarker *other_marker) { actor_playAnimationOnce(this); local->unk0 = 2; actor_collisionOff(this); - FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 0.6f, 32000, this->position, 1750, 3500); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_115_BUZZBOMB_DEATH, 0.6f, 32000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); func_8035EE48(this); } @@ -145,8 +145,8 @@ void func_8035F048(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_core2_D7D10 *)&this->local; - FUNC_8030E8B4(SFX_F9_GRUNTLING_NOISE_1, 1.2f, 22000, this->position, 1750, 3500); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_F9_GRUNTLING_NOISE_1, 1.2f, 22000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); this->velocity[2] = 0.0f; subaddie_set_state_with_direction(this, 6, 0.02f, 1); actor_playAnimationOnce(this); @@ -160,7 +160,7 @@ void func_8035F0E8(ActorMarker *marker, ActorMarker *other_marker) { this = marker_getActor(marker); local = (ActorLocal_core2_D7D10 *)&this->local; - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, this->position, 1750, 3500); this->velocity[2] = 0.8f; func_8035EE80(this); } @@ -197,12 +197,12 @@ void func_8035F138(Actor *this) { this->velocity[0] = this->yaw; } anctrl_setAnimTimer(this->anctrl, 0.0f); - if (func_80329530(this, (s32) (this->scale * 650.0f)) && func_803292E0(this)) { + if (subaddie_playerIsWithinSphereAndActive(this, (s32) (this->scale * 650.0f)) && func_803292E0(this)) { subaddie_set_state(this, 2U); actor_playAnimationOnce(this); this->unk1C[1] = 1.0f; this->unk44_31 = func_8030ED2C(SFX_2C_PULLING_NOISE, 3); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } break; @@ -212,7 +212,7 @@ void func_8035F138(Actor *this) { } sfxsource_playSfxAtVolume(this->unk44_31, this->unk1C[1]); if (actor_animationIsAt(this, 0.66f)) { - FUNC_8030E8B4(SFX_F9_GRUNTLING_NOISE_1, 0.8f, 32000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_F9_GRUNTLING_NOISE_1, 0.8f, 32000, this->position, 1750, 3500); } if (0.99 <= anctrl_getAnimTimer(this->anctrl)) { @@ -224,7 +224,7 @@ void func_8035F138(Actor *this) { case 3: //L8035F3AC func_8035EF3C(this); - if (!func_80329530(this, (s32) (this->scale * 1050.0f)) || !func_803292E0(this)) { + if (!subaddie_playerIsWithinSphereAndActive(this, (s32) (this->scale * 1050.0f)) || !func_803292E0(this)) { func_8035EEC0(this); break; } @@ -244,7 +244,7 @@ void func_8035F138(Actor *this) { case 4: //L8035F4FC func_8035EF3C(this); - if (((f64)this->unk38_31 <= 0.0) && func_80329530(this, (s32) (this->scale * 1050.0f)) && func_803292E0(this)) { + if (((f64)this->unk38_31 <= 0.0) && subaddie_playerIsWithinSphereAndActive(this, (s32) (this->scale * 1050.0f)) && func_803292E0(this)) { func_8035EE80(this); break; } @@ -265,7 +265,7 @@ void func_8035F138(Actor *this) { case 5: //L8035F6F4 if (actor_animationIsAt(this, 0.36f) != 0) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } if ((this->unk44_31 != 0) && func_8030E3FC(this->unk44_31)) { if (this->unk1C[1] > 1.0) { @@ -296,22 +296,22 @@ void func_8035F138(Actor *this) { case 7: //L8035F840 if (actor_animationIsAt(this, 0.3f)) { - FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 0.6f, 32000, this->position, 1750, 3500); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 26000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1E_HITTING_AN_ENEMY_2, 0.6f, 32000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 26000, this->position, 1750, 3500); } if( actor_animationIsAt(this, 0.5f) || actor_animationIsAt(this, 0.7f) ) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 16000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 16000, this->position, 1750, 3500); } if (actor_animationIsAt(this, 0.8f)) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 14000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 14000, this->position, 1750, 3500); } if (actor_animationIsAt(this, 0.9f)) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 12000, this->position, 1750, 3500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 0.8f, 12000, this->position, 1750, 3500); } if (actor_animationIsAt(this, 0.25f)) { diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 0b0bb106..b3e9c514 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -46,7 +46,7 @@ Actor *chicecube_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ } int func_80359DF4(Actor *this, s32 arg1){ - if(func_80329530(this, arg1) && func_803292E0(this)) + if(subaddie_playerIsWithinSphereAndActive(this, arg1) && func_803292E0(this)) return 1; return 0; } @@ -202,7 +202,7 @@ void __chicecube_spawnHalfCubes(ActorMarker *marker){ for(i = 0; i < 2; i++){//L8035A7FC bundle_setYaw((i & 1)? actor->yaw : actor->yaw + 180.0f); other = bundle_spawn_f32(BUNDLE_21__ICECUBE_B, sp54); - other->unkF4_8 = 1; //don't spawn more + other->actorTypeSpecificField = 1; //don't spawn more other->scale = randf2(0.5f, 0.6f)*actor->scale; actor->yaw = randi2(0, 359); } @@ -212,7 +212,7 @@ void __chicecube_spawnHalfCubes(ActorMarker *marker){ //__chicecube_ow void __chicecube_ow(ActorMarker *marker, ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, actor->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 0.9f, 22000, actor->position, 1500, 3000); actor->velocity[1] = 0.8f; actor->actor_specific_1_f = 0.0f; } @@ -220,11 +220,11 @@ void __chicecube_ow(ActorMarker *marker, ActorMarker *other_marker){ //__chicecube_die void __chicecube_die(ActorMarker *marker, ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - FUNC_8030E8B4(SFX_B6_GLASS_BREAKING_1, 1.0f, 32000, actor->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_B6_GLASS_BREAKING_1, 1.0f, 32000, actor->position, 1500, 4500); actor->velocity[1] = 0.0f; 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->unkF4_8 != 1){ + if(actor->actorTypeSpecificField != 1){ __spawnQueue_add_1((GenFunction_1)__chicecube_spawnHalfCubes, reinterpret_cast(s32, actor->marker)); } marker_despawn(actor->marker); @@ -302,7 +302,7 @@ void chicecube_update(Actor *this){ case 1: // L8035AC9C anctrl_setAnimTimer(this->anctrl, 0.0f); if( func_80359DF4(this, 900) - || (this->unkF4_8 == 2 && volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) + || (this->actorTypeSpecificField == 2 && volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) ){ subaddie_set_state_with_direction(this, 2, 0.0001f, 1); actor_playAnimationOnce(this); @@ -311,7 +311,7 @@ void chicecube_update(Actor *this){ break; case 2: // L8035AD10 if(actor_animationIsAt(this, 0.1f)){ - FUNC_8030E8B4(SFX_112_TINKER_ATTENTION, 1.3f, 23000, this->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_112_TINKER_ATTENTION, 1.3f, 23000, this->position, 1500, 4500); } if( func_80359E38(this, 0xff, 0xa) && 0.98 < anctrl_getAnimTimer(this->anctrl) @@ -367,7 +367,7 @@ void chicecube_update(Actor *this){ break; case 5: // L8035AF58 if(actor_animationIsAt(this, 0.25f)){ - FUNC_8030E8B4(SFX_112_TINKER_ATTENTION, 1.3f, 23000, this->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_112_TINKER_ATTENTION, 1.3f, 23000, this->position, 1500, 4500); } if( anctrl_getAnimTimer(this->anctrl) < 0.1 && func_80359EBC(this, 0x50, 0xA) diff --git a/src/core2/ch/jiggy.c b/src/core2/ch/jiggy.c index b78d7d79..9d61c4c8 100644 --- a/src/core2/ch/jiggy.c +++ b/src/core2/ch/jiggy.c @@ -2,154 +2,159 @@ #include "functions.h" #include "variables.h" #include "enums.h" +#include "jiggy.h" +#include "core2/commonParticle.h" extern void func_802BE720(void); extern f32 func_8033A244(f32); extern void func_8033A280(f32); extern void func_80329904(ActorMarker *, s32, f32 *); -typedef struct chjiggy_s{ - u32 unk0; - u32 index; -} ActorLocal_Jiggy; - -Actor *spawnQueue_actor_s32(f32, f32, f32); -void func_802C7AF8(u32 x, u32 y, u32 z, u32 arg3); -Actor *chjiggy_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3); -void func_802C7D98(Actor * arg0); -void chjiggy_update(Actor *this); -enum jiggy_e chjiggy_getJiggyId(Actor *this); - - - /* .data */ -ActorAnimationInfo D_80366290[] = { - {0, 0.0f}, - {0, 0.0f}, - {0, 0.0f} +ActorAnimationInfo JIGGY_ANIMATIONS[] = { + { 0, 0.0f }, + { 0, 0.0f }, + { 0, 0.0f } }; -ActorInfo D_803662A8 = { - 0x52, ACTOR_46_JIGGY, ASSET_35F_MODEL_JIGGY, - 1, D_80366290, - chjiggy_update, func_802C7D98, chjiggy_draw, +ActorInfo chJiggy = { + MARKER_52_JIGGY, ACTOR_46_JIGGY, ASSET_35F_MODEL_JIGGY, + 1, JIGGY_ANIMATIONS, + chjiggy_update, chjiggy_update_2, chjiggy_draw, 0, 0, 0.9f, 0 }; /* .code */ -enum jiggy_e func_802C7A30(Actor *this){ +enum jiggy_e getJiggyId(Actor *this) { s32 id; - s32 sp18[3]; + s32 position[3]; id = map_get(); - sp18[0] = (s32)this->position[0]; - sp18[1] = (s32)this->position[1]; - sp18[2] = (s32)this->position[2]; - id = func_80307164(sp18); - if( id < 0){ + position[0] = (s32)this->position[0]; + position[1] = (s32)this->position[1]; + position[2] = (s32)this->position[2]; + + id = func_80307164(position); + + if (id < 0) { return 0; } - else{ - return func_80306DBC(id) + 1; - } + + return func_80306DBC(id) + 1; } -void func_802C7AB0(ActorMarker * arg0, u32 arg1){ +void playJiggyDestroyedSoundsAndReset(ActorMarker *marker, u32 resetSwitchFlag) { func_8030E6D4(SFX_30_MAGIC_POOF); - func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); - mapSpecificFlags_set(arg1, 1); - marker_despawn(arg0); + coMusicPlayer_playMusic(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); + mapSpecificFlags_set(resetSwitchFlag, TRUE); + marker_despawn(marker); } -void func_802C7AF8(u32 x, u32 y, u32 z, u32 arg3){ +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); - mapSpecificFlags_set(arg3, 1); + mapSpecificFlags_set(resetSwitchFlag, TRUE); } -void func_802C7B6C(u32 arg0){ - mapSpecificFlags_set(arg0, 0); +void resetFlag(enum bgs_specific_flags flag) { + mapSpecificFlags_set(flag, FALSE); } -void func_802C7B8C(Actor *this, s32 arg1, s32 arg2, s32 arg3, s32 arg4, s32 arg5, enum volatile_flags_e arg6){ - if( !mapSpecificFlags_get(arg1) - && mapSpecificFlags_get(arg2) - && item_getCount(ITEM_0_HOURGLASS_TIMER) == 0 - ){ - func_8028FCC8(1); - actor_collisionOff(this); - func_802BAFE4(arg3); - volatileFlag_setAndTriggerDialog_0(arg6); - timedFunc_set_4(0.6f, (GenFunction_4)func_802C7AF8, (s32)this->position[0], (s32)this->position[1], (s32)this->position[2], arg4); - timedFunc_set_2(0.6f, (GenFunction_2)func_802C7AB0, (s32)this->marker, arg5); - timedFunc_set_0(1.0f, (GenFunction_0)func_802BE720); - timedFunc_set_1(3.9f, (GenFunction_1)func_802C7B6C, arg4); - mapSpecificFlags_set(arg1, 1); +void destroyJiggy(Actor *this, s32 jiggyFlag, s32 timerRunningFlag, s32 cameraId, s32 switchPressedFlag, s32 resetSwitchFlag, enum volatile_flags_e dialogFlag) { + + // Jiggy is still active + if (mapSpecificFlags_get(jiggyFlag) + || !mapSpecificFlags_get(timerRunningFlag) + || item_getCount(ITEM_0_HOURGLASS_TIMER) != 0) { + + return; } + + player_setModelVisible(1); + actor_collisionOff(this); + + // Switch camera to a static one showing the newly destroyed jiggy + gcStaticCamera_activate(cameraId); + + progressDialog_setAndTriggerDialog_0(dialogFlag); + timedFunc_set_4(0.6f, (GenFunction_4)spawnJiggyDestroyedEffects, (s32)this->position[0], (s32)this->position[1], (s32)this->position[2], switchPressedFlag); + timedFunc_set_2(0.6f, (GenFunction_2)playJiggyDestroyedSoundsAndReset, (s32)this->marker, resetSwitchFlag); + timedFunc_set_0(1.0f, (GenFunction_0)func_802BE720); + timedFunc_set_1(3.9f, (GenFunction_1)resetFlag, switchPressedFlag); + mapSpecificFlags_set(jiggyFlag, TRUE); } -void chjiggy_updateRotation(Actor *this){ +void chjiggy_updateRotation(Actor *this) { f32 delta = time_getDelta(); + + // Controls the rotation speed this->yaw += delta * 230.0f; - if(360.0f <= this->yaw){ + + if (360.0f <= this->yaw) { this->yaw -= 360.0f; } + this->yaw_ideal = this->yaw; } -//chjiggy_draw -Actor *chjiggy_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3){ - Actor * thisActor = marker_getActor(this); - ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&thisActor->local; +Actor *chjiggy_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **vtx) { + Actor *jiggy_actor = marker_getActor(this); + ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&jiggy_actor->local; u32 jiggyId; - if(!local->unk0){ - jiggyId = chjiggy_getJiggyId(thisActor); - if((jiggyId == JIGGY_1C_CC_RINGS) || (jiggyId == JIGGY_1D_CC_SLOW_SAWBLADES)){ + if (!local->isHidden) { + jiggyId = chjiggy_getJiggyId(jiggy_actor); + + if ((jiggyId == JIGGY_1C_CC_RINGS) || (jiggyId == JIGGY_1D_CC_SLOW_SAWBLADES)) { func_8033A280(10.0f); func_8033A244(30000.0f); } - thisActor = actor_draw(this, gdl, mptr, arg3); + + jiggy_actor = actor_draw(this, gdl, mptr, vtx); } - return thisActor; + + return jiggy_actor; } -void func_802C7D98(Actor * arg0){ - func_80343DEC(arg0); - chjiggy_updateRotation(arg0); +void chjiggy_update_2(Actor *this) { + func_80343DEC(this); + chjiggy_updateRotation(this); } -//chjiggy_update -void chjiggy_update(Actor *this){ +void chjiggy_update(Actor *this) { ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&this->local; int i; - if(this->marker->unk14_21){ - for(i = 0; i < 4; i++){ - if(randf() < 0.015){ - func_8033E73C(this->marker, i + 5, func_80329904); - func_8033E3F0(8, 1); + // A small chance to show a jiggy shine effect. Up to four can be shown at once. + if (this->marker->unk14_21) { + for (i = 0; i < 4; i++) { + if (randf() < 0.015) { + commonParticle_add(this->marker, i + 5, func_80329904); + commonParticle_new(COMMON_PARTICLE_8_JIGGY_SHINE, 1); } } - }//L802C7E44 - switch(this->state){ - case 1: //L802C7E68 - local->unk0 = 0; - if(local->index == 0) - local->index = func_802C7A30(this); - - if(jiggyscore_isCollected(local->index)){ - marker_despawn(this->marker); + } + + switch (this->state) { + case JIGGY_STATE_1_INIT: + local->isHidden = FALSE; + + if (local->id == 0) { + local->id = getJiggyId(this); } - else{ - subaddie_set_state(this, 2); - switch(chjiggy_getJiggyId(this)){ - case JIGGY_17_CC_CLANKER_RAISED: //L802C7EF8 - case JIGGY_49_CCW_EYRIE:// L802C7EF8 + + if (jiggyscore_isCollected(local->id)) { + marker_despawn(this->marker); + } else { + subaddie_set_state(this, JIGGY_STATE_2_IDLE); + switch (chjiggy_getJiggyId(this)) { + case JIGGY_17_CC_CLANKER_RAISED: + case JIGGY_49_CCW_EYRIE: this->marker->unk40_21 = 1; break; - case JIGGY_36_LAIR_TTC_WITCH_SWITCH:// L802C7F0C + + case JIGGY_36_LAIR_TTC_WITCH_SWITCH: this->unk44_14 = func_80341F2C(0x20A); this->unk48 = 0.0f; this->unk4C = 300.0f; @@ -158,53 +163,63 @@ void chjiggy_update(Actor *this){ func_80343DEC(this); chjiggy_updateRotation(this); break; - case JIGGY_3E_GV_GRABBA:// L802C7F6C - case JIGGY_4D_CCW_FLOWER:// L802C7F6C + + case JIGGY_3E_GV_GRABBA: + case JIGGY_4D_CCW_FLOWER: this->unk124_6 = 0; break; - case JIGGY_41_GV_MAZE:// L802C7F7C + + case JIGGY_41_GV_MAZE: this->marker->unk14_10 = 30; break; - case JIGGY_13_TTC_LOCKUP: //L802C7F94 + + case JIGGY_13_TTC_LOCKUP: this->marker->unk14_10 = 40; break; } } + break; - case 2: //L802C7FAC + + case JIGGY_STATE_2_IDLE: chjiggy_updateRotation(this); - switch(chjiggy_getJiggyId(this)){ - case JIGGY_20_BGS_ELEVATED_WALKWAY: //L802C7FE8 - func_802C7B8C(this, 4, 3, 0xD, 5, 2, VOLATILE_FLAG_AE_BGS_WALKWAY_JIGGY_MISSED); + + switch (chjiggy_getJiggyId(this)) { + case JIGGY_20_BGS_ELEVATED_WALKWAY: + destroyJiggy(this, BGS_SPECIFIC_FLAG_WALKWAY_JIGGY, BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_TIMER_RUNNING, STATIC_CAMERA_D_WALKWAY_JIGGY_DESTROY, + BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_SWITCH_PRESSED, BGS_SPECIFIC_FLAG_WALKWAY_JIGGY_RESET, VOLATILE_FLAG_AE_BGS_WALKWAY_JIGGY_MISSED); break; - case JIGGY_25_BGS_MAZE://L802C8018 - func_802C7B8C(this, 0xd, 0xc, 0x1e, 9, 0xb, VOLATILE_FLAG_AF_BGS_MAZE_JIGGY_MISSED); + + case JIGGY_25_BGS_MAZE: + destroyJiggy(this, BGS_SPECIFIC_FLAG_MAZE_JIGGY, BGS_SPECIFIC_FLAG_MAZE_JIGGY_TIMER_RUNNING, STATIC_CAMERA_1E_MAZE_JIGGY_DESTROY, + BGS_SPECIFIC_FLAG_MAZE_JIGGY_SWITCH_PRESSED, BGS_SPECIFIC_FLAG_MAZE_JIGGY_RESET, VOLATILE_FLAG_AF_BGS_MAZE_JIGGY_MISSED); break; - case JIGGY_2F_FP_XMAS_TREE://L802C8048 + + case JIGGY_2F_FP_XMAS_TREE: if (levelSpecificFlags_get(LEVEL_FLAG_29_FP_UNKNOWN)) { actor_collisionOn(this); - } - else { + } else { actor_collisionOff(this); } break; } + break; - }//L802C8074 + } } -enum jiggy_e chjiggy_getJiggyId(Actor *this){ +enum jiggy_e chjiggy_getJiggyId(Actor *this) { ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&this->local; - return local->index; + return local->id; } -void chjiggy_hide(Actor * this){ +void chjiggy_hide(Actor *this) { ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&this->local; - local->unk0 = 1; + local->isHidden = TRUE; actor_collisionOff(this); } -void chjiggy_setJiggyId(Actor *this, u32 id){ +void chjiggy_setJiggyId(Actor *this, u32 id) { ActorLocal_Jiggy *local = (ActorLocal_Jiggy *)&this->local; - local->index = id; + local->id = id; } diff --git a/src/core2/ch/jiggy.h b/src/core2/ch/jiggy.h new file mode 100644 index 00000000..b977c00e --- /dev/null +++ b/src/core2/ch/jiggy.h @@ -0,0 +1,15 @@ +typedef struct chjiggy_s { + bool isHidden; + u32 id; +} ActorLocal_Jiggy; + +Actor *spawnQueue_actor_s32(f32, f32, f32); +Actor *chjiggy_draw(ActorMarker *this, Gfx **gdl, Mtx **mptr, Vtx **arg3); +void chjiggy_update_2(Actor * arg0); +void chjiggy_update(Actor *this); +enum jiggy_e chjiggy_getJiggyId(Actor *this); + +enum jiggy_state_e { + JIGGY_STATE_1_INIT = 1, + JIGGY_STATE_2_IDLE = 2 +}; diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index 2a41a4e9..5c8f488b 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -46,7 +46,7 @@ void __chJinjo_802CDBA8(ActorMarker *this, ActorMarker *other){ if(actorPtr->state < 5){ if(!fileProgressFlag_get(FILEPROG_E_JINJO_TEXT)){ - gcdialog_showText(__chJinjo_getMeetDialogId(actorPtr->marker->id), 4, 0, 0, 0, 0); + gcdialog_showDialog(__chJinjo_getMeetDialogId(actorPtr->marker->id), 4, 0, 0, 0, 0); fileProgressFlag_set(FILEPROG_E_JINJO_TEXT, 1); } subaddie_set_state_with_direction(actorPtr, 6, 0.0f , -1); @@ -176,9 +176,9 @@ void chJinjo_update(Actor * this){ core1_ce60_incOrDecCounter(FALSE); func_8032BB88(this, 0, 4000); if(local->unk4){ - func_8025A6EC(COMUSIC_30_5TH_JINJO_COLLECTED, 28000); + coMusicPlayer_playMusic(COMUSIC_30_5TH_JINJO_COLLECTED, 28000); }else{ - func_8025A6EC(COMUSIC_A_JINJO_COLLECTED, 28000); + coMusicPlayer_playMusic(COMUSIC_A_JINJO_COLLECTED, 28000); } }//L802CE114 break; @@ -206,8 +206,8 @@ void chJinjo_update(Actor * this){ if(sp50 || anctrl_getAnimTimer(this->anctrl) < 0.8){ for(i = 0; i < 4; i++){ if(randf() < 0.3){ - func_8033E73C(this->marker, i + 5, func_80329904); - func_8033E3F0(8, this->marker->unk14_21); + commonParticle_add(this->marker, i + 5, func_80329904); + commonParticle_new(8, this->marker->unk14_21); } //L802CE2C4 } }//L802CE2D0 @@ -222,7 +222,7 @@ void chJinjo_update(Actor * this){ func_802F9EC4(local->unkC, sp30, 500, 2000); func_802F9F80(local->unkC, 0.0f, 9e+09, 0.0f); func_802FA0B0(local->unkC, 0); - func_8025A6EC(COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7FFF); func_8025AABC(COMUSIC_43_ENTER_LEVEL_GLITTER); func_8030E9C4(SFX_C7_SHWOOP, 0.8f, 0x7FFF, sp30, 300.0f, 2000.0f); }//L802CE3C4 @@ -279,14 +279,14 @@ void chJinjo_update(Actor * this){ subaddie_set_state_with_direction(this, 4, 0.0f, -1); actor_playAnimationOnce(this); }//L802CE630 - if(!func_803114B0()){ + if(!gcdialog_hasCurrentTextId()){ switch(chJinjoAnimations[this->state].index){ case ASSET_31_ANIM_JINJO_JUMP: if(actor_animationIsAt(this, 0.6f)){ if(local->unk8){ func_8030E988(SFX_8_BANJO_LANDING_04, 1.8f, 18000, sp30, 120.0f, 1200.0f); }else{ - FUNC_8030E8B4(SFX_8_BANJO_LANDING_04, 1.8f, 18000, sp30, 120, 1200); + sfx_playFadeShorthandDefault(SFX_8_BANJO_LANDING_04, 1.8f, 18000, sp30, 120, 1200); } } break; @@ -295,7 +295,7 @@ void chJinjo_update(Actor * this){ if(local->unk8){ func_8030E988(SFX_17_JINJO_WHISTLE, 1.0f, 22000, sp30, 120.0f, 1200.0f); }else{ - FUNC_8030E8B4(SFX_17_JINJO_WHISTLE, 1.0f, 22000, sp30, 120, 1200); + sfx_playFadeShorthandDefault(SFX_17_JINJO_WHISTLE, 1.0f, 22000, sp30, 120, 1200); } } break; @@ -304,7 +304,7 @@ void chJinjo_update(Actor * this){ if(local->unk8){ func_8030E988(SFX_27_JINJO_HI, 1.0f, 22000, sp30, 120.0f, 1200.0f); }else{ - FUNC_8030E8B4(SFX_27_JINJO_HI, 1.0f, 22000, sp30, 120, 1200); + sfx_playFadeShorthandDefault(SFX_27_JINJO_HI, 1.0f, 22000, sp30, 120, 1200); } } break; diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index da71d84a..809022fc 100644 --- a/src/core2/ch/mole.c +++ b/src/core2/ch/mole.c @@ -77,19 +77,19 @@ enum asset_e chmole_learnedAllLevelAbilitiesDialog(void){ int learned_all_moves = chmole_learnedAllLevelAbilities(level_id); switch(level_id){ case LEVEL_1_MUMBOS_MOUNTAIN: - return learned_all_moves ? ASSET_B4E_DIALOG_BOTTLES_ALL_MM_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_B4E_DIALOG_BOTTLES_ALL_MM_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; case LEVEL_2_TREASURE_TROVE_COVE: - return learned_all_moves ? ASSET_A27_DIALOG_BOTTLES_ALL_TTC_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_A27_DIALOG_BOTTLES_ALL_TTC_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; case LEVEL_3_CLANKERS_CAVERN: - return learned_all_moves ? ASSET_D37_DIALOG_BOTTLES_ALL_CC_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_D37_DIALOG_BOTTLES_ALL_CC_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; case LEVEL_4_BUBBLEGLOOP_SWAMP: - return learned_all_moves ? ASSET_C8A_DIALOG_BOTTLES_ALL_BGS_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C8A_DIALOG_BOTTLES_ALL_BGS_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; case LEVEL_5_FREEZEEZY_PEAK: - return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; case LEVEL_7_GOBIS_VALLEY: - return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_EMPTY; default: - return ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; + return ASSET_D38_DIALOG_EMPTY; } } @@ -122,15 +122,15 @@ Actor *func_802D94B4(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_802D9530(Actor *this){ Actor *other = subaddie_getLinkedActor(this); - if(this->unk100 && other){ - if(this->unk100->id == 0xB8) + if(this->partnerActor && other){ + if(this->partnerActor->id == 0xB8) subaddie_set_state_with_direction(other, 3, 0.0001f, 1); } subaddie_set_state_with_direction(this, 4, 0.0001f, 1); actor_playAnimationOnce(this); this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 26000); func_8028F918(0); @@ -145,7 +145,7 @@ void func_802D9600(Actor * this){ // func_802D9658 void chmole_setStaticCamera(Actor *this){ // Sets the camera to a static camera - timed_setStaticCameraToNode(0.0f, moleTable[this->unkF4_8-9].camera_node); + timed_setStaticCameraToNode(0.0f, moleTable[this->actorTypeSpecificField-9].camera_node); } // func_802D9698 @@ -154,13 +154,13 @@ void chmole_healthRefill(ActorMarker *marker, enum asset_e arg1, s32 arg2){ // Also releases the camera Actor *actor = marker_getActor(marker); - if( arg1 == moleTable[actor->unkF4_8-9].teach_text_id + if( arg1 == moleTable[actor->actorTypeSpecificField-9].teach_text_id && item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL) ){ - gcdialog_showText(ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions); + gcdialog_showDialog(ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions); }//L802D9738 - else if(arg1 == moleTable[actor->unkF4_8-9].teach_text_id || arg1 == ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH){ - gcdialog_showText(chmole_learnedAllGameAbilities()? 0xa87 : chmole_learnedAllLevelAbilitiesDialog(), 7, 0, actor->marker, chmole_healthRefill, NULL); + else if(arg1 == moleTable[actor->actorTypeSpecificField-9].teach_text_id || arg1 == ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH){ + gcdialog_showDialog(chmole_learnedAllGameAbilities()? 0xa87 : chmole_learnedAllLevelAbilitiesDialog(), 7, 0, actor->marker, chmole_healthRefill, NULL); } else{//L802D97BC if(actor->has_met_before){ @@ -222,33 +222,33 @@ int chmole_learnAbility(Actor *this){ s32 sp2C; s32 sp28 = 0xe; // Known Ability: Refresher Dialog - if(ability_isUnlocked(moleTable[this->unkF4_8-9].ability)){ + if(ability_isUnlocked(moleTable[this->actorTypeSpecificField-9].ability)){ sp28 = 0xf; - sp2C = moleTable[this->unkF4_8-9].refresher_text_id; + sp2C = moleTable[this->actorTypeSpecificField-9].refresher_text_id; }//L802D99EC // New Ability: Learn Dialog & Misc Actions else{ func_80347A14(0); this->has_met_before = TRUE; - sp2C = moleTable[this->unkF4_8-9].teach_text_id; - ability_unlock(moleTable[this->unkF4_8-9].ability); - switch(moleTable[this->unkF4_8-9].ability){ + sp2C = moleTable[this->actorTypeSpecificField-9].teach_text_id; + ability_unlock(moleTable[this->actorTypeSpecificField-9].ability); + switch(moleTable[this->actorTypeSpecificField-9].ability){ case ABILITY_9_FLIGHT: case ABILITY_D_SHOCK_JUMP: - func_8030E6A4(SFX_113_PAD_APPEARS, 0.9f, 32000); + gcsfx_playWithPitch(SFX_113_PAD_APPEARS, 0.9f, 32000); break; case ABILITY_13_1ST_NOTEDOOR: func_802FAD64(ITEM_C_NOTE); break; } }//L802D9A9C - gcdialog_showText(sp2C, sp28, this->position, this->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions); + gcdialog_showDialog(sp2C, sp28, this->position, this->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions); return TRUE; } void func_802D9ADC(Actor *this){ Actor *other = subaddie_getLinkedActor(this); - if(this->unk100 && other && this->unk100->id == 0xB8){ + if(this->partnerActor && other && this->partnerActor->id == 0xB8){ subaddie_set_state_with_direction(other, 2, 0.0001f, 1); } this->marker->propPtr->unk8_3 = 1; @@ -257,7 +257,7 @@ void func_802D9ADC(Actor *this){ actor_playAnimationOnce(this); this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 26000); chmole_setStaticCamera(this); @@ -287,7 +287,7 @@ void chmole_spawnMolehill(ActorMarker *marker){ Actor *other = spawn_child_actor(ACTOR_12C_MOLEHILL, &actor); f32 pad[1]; - actor->unk100 = other->marker; + actor->partnerActor = other->marker; if(marker); } @@ -302,11 +302,11 @@ void func_802D9C90(Actor *this){ void chmole_startingDialog(Actor *this){ // If the player knows the ability, use refresher function // Otherwise, set player's position and spawn mole - if(ability_isUnlocked(moleTable[this->unkF4_8 - 9].ability)){ + if(ability_isUnlocked(moleTable[this->actorTypeSpecificField - 9].ability)){ chmole_Refresher(this); } else{ - if(func_80329530(this, 150)){ + if(subaddie_playerIsWithinSphereAndActive(this, 150)){ if(this->unk38_0 == 0) func_8028F45C(9, this->position); else @@ -328,7 +328,7 @@ void chmole_update(Actor *this){ // Checks the actor's selector value is between 0x8 and 0x13 // Anything lower is a Spiral Mountain ability, and should use a different actor id - if(this->unkF4_8 < 8 || this->unkF4_8 >= 0x13) + if(this->actorTypeSpecificField < 8 || this->actorTypeSpecificField >= 0x13) return; if(!this->volatile_initialized){ @@ -336,10 +336,10 @@ void chmole_update(Actor *this){ marker_setFreeMethod(this->marker, func_802D9C90); if(this->initialized){ other = actorArray_findClosestActorFromActorId(this->position, ACTOR_12C_MOLEHILL, -1, &sp4C); - this->unk100 = (other) ? other->marker : NULL; - if(this->unk100){ + this->partnerActor = (other) ? other->marker : NULL; + if(this->partnerActor){ other = subaddie_getLinkedActor(this); - if(other && this->unk100->id == 0xB8){ + if(other && this->partnerActor->id == 0xB8){ subaddie_set_state(other, 1); } } @@ -362,7 +362,7 @@ void chmole_update(Actor *this){ this->marker->propPtr->unk8_3 = FALSE; this->marker->collidable = FALSE; this->initialized = TRUE; - if(this->unkF4_8 == 0x12){ + if(this->actorTypeSpecificField == 0x12){ node_prop = nodeprop_findByActorIdAndActorPosition(0x349, this); if(node_prop == NULL){ this->velocity[0] = this->position[0]; @@ -382,8 +382,8 @@ void chmole_update(Actor *this){ this->yaw_ideal = func_80329784(this); func_80328FB0(this, 4.0f); if(func_8028F20C() && func_8028F0D4() && !func_8028EC04()){ - if( this->unkF4_8 == 0x12 - && !ability_isUnlocked(moleTable[this->unkF4_8-9].ability) + if( this->actorTypeSpecificField == 0x12 + && !ability_isUnlocked(moleTable[this->actorTypeSpecificField-9].ability) && (player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT) ){ player_getPosition(sp34); @@ -393,7 +393,7 @@ void chmole_update(Actor *this){ } else{//L802DA054 if( !player_movementGroup() - && func_80329530(this, 0xFA) + && subaddie_playerIsWithinSphereAndActive(this, 0xFA) && func_8028EFC8() && sp50[FACE_BUTTON(BUTTON_B)] == 1 ){ @@ -409,7 +409,7 @@ void chmole_update(Actor *this){ if( 0.0 < anctrl_getAnimTimer(this->anctrl) && anctrl_getAnimTimer(this->anctrl) < 0.16 ){ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); }//L802DA128 if(actor_animationIsAt(this, 0.9999f)){ chmole_setFacingDirection(this); @@ -417,13 +417,13 @@ void chmole_update(Actor *this){ this->unk44_31 = 0; } else if(actor_animationIsAt(this, 0.14f)){//L802DA154 - FUNC_8030E8B4(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C6_SHAKING_MOUTH, 1.2f, 24000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.4f)){//L802DA188 - FUNC_8030E8B4(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2C_PULLING_NOISE, 1.2f, 24000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.75f)){//L802DA1BC - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1250, 2500); } else if(actor_animationIsAt(this, 0.35f)){//L802DA1EC chmole_learnAbility(this); @@ -462,7 +462,7 @@ void chmole_update(Actor *this){ if( 0.35 < anctrl_getAnimTimer(this->anctrl) && anctrl_getAnimTimer(this->anctrl) < 0.9 ){ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } else if(actor_animationIsAt(this, 0.9999f)){//L802DA45C func_802D9600(this); diff --git a/src/core2/ch/musicnote.c b/src/core2/ch/musicnote.c index ed239dc2..308676bc 100644 --- a/src/core2/ch/musicnote.c +++ b/src/core2/ch/musicnote.c @@ -2,16 +2,25 @@ #include "functions.h" #include "variables.h" -void func_802C9C30(Actor* this); +void musicNote_update(Actor* this); /* .data */ -ActorInfo D_80366C50 = { - MARKER_5F_MUSIC_NOTE, ACTOR_51_MUSIC_NOTE, ASSET_6D6_MODEL_MUSIC_NOTE, 0, NULL, - func_802C9C30, actor_update_func_80326224, func_80325934, - 0, 0, 0.6f, 0 +ActorInfo sumusicNote = { + MARKER_5F_MUSIC_NOTE, + ACTOR_51_MUSIC_NOTE, + ASSET_6D6_MODEL_MUSIC_NOTE, + 0, + NULL, + musicNote_update, + actor_update_func_80326224, + func_80325934, + 0, + 0, + 0.6f, + 0 }; /* .code */ -void func_802C9C30(Actor* this){ +void musicNote_update(Actor* this){ this->scale = 0.42857143f; } diff --git a/src/core2/code_517A0.c b/src/core2/ch/piranhaWaterParticles.c similarity index 75% rename from src/core2/code_517A0.c rename to src/core2/ch/piranhaWaterParticles.c index b246e02c..5cd9404b 100644 --- a/src/core2/code_517A0.c +++ b/src/core2/ch/piranhaWaterParticles.c @@ -4,20 +4,20 @@ #include "variables.h" extern f32 func_8028EF88(void); -void func_802D8730(Actor *this); +void chPiranhaWaterParticles_update(Actor *this); /* .data */ -ActorInfo D_80367C60 = { - 0x15E, 0x188, 0x0, +ActorInfo chPiranhaWaterParticles = { + 0x15E, ACTOR_188_PIRANHA_WATER_PARTICLES, 0x0, 0, NULL, - func_802D8730, actor_update_func_80326224, func_80325340, + chPiranhaWaterParticles_update, actor_update_func_80326224, func_80325340, 0, 0, 0.0f, 0 }; -s32 D_80367C84[3] = {255, 100, 100}; +s32 PIRANHA_PARTICLES_SVG[3] = { 255, 100, 100 }; /* .code */ -void func_802D8730(Actor *this) { +void chPiranhaWaterParticles_update(Actor *this) { f32 dt; f32 sp38; ParticleEmitter *pCtrl; @@ -47,7 +47,7 @@ void func_802D8730(Actor *this) { pCtrl = func_802F4094(this->position, 40.0f); particleEmitter_setStartingScaleRange(pCtrl, 0.05f, 0.06f); particleEmitter_setAccelerationRange(pCtrl, 0.0f, -3400.0f, 0.0f, 0.0f, -3400.0f, 0.0f); - particleEmitter_setRGB(pCtrl, D_80367C84); + particleEmitter_setRGB(pCtrl, PIRANHA_PARTICLES_SVG); particleEmitter_setParticleVelocityRange(pCtrl, -180.0f, 200.0f, -180.0f, 180.0f, 400.0f, 180.0f); particleEmitter_emitN(pCtrl, 9); } diff --git a/src/core2/ch/shrapnel.c b/src/core2/ch/shrapnel.c index 7ab52892..558f6513 100644 --- a/src/core2/ch/shrapnel.c +++ b/src/core2/ch/shrapnel.c @@ -34,7 +34,7 @@ void chShrapnel_func_802D0A38(Actor *this){ this->unk38_31--; } else{ - if(func_80329530(this, 600) && func_803292E0(this)){ + if(subaddie_playerIsWithinSphereAndActive(this, 600) && func_803292E0(this)){ this->actor_specific_1_f = 0.0f; subaddie_set_state_with_direction(this, 2, 0.0f, 1); } @@ -50,7 +50,7 @@ void chShrapnel_func_802D0AB8(Actor *this) { void chShrapnel_spawnExplodeActor(s32 arg0){ Actor *this = reinterpret_cast(Actor *, arg0); - actor_spawnWithYaw_f32(0xF3, this->unk1C, 0); + actor_spawnWithYaw_f32(ACTOR_F3_EXPLOSION_RIPPLE, this->unk1C, 0); } void chShrapnel_emitExplosion(Actor *this) { @@ -111,7 +111,7 @@ void chShrapnel_explode(ActorMarker *marker, ActorMarker *other_marker) { Actor *this; this = marker_getActor(marker); - FUNC_8030E8B4(SFX_1B_EXPLOSION_1, 1.0f, 32736, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1B_EXPLOSION_1, 1.0f, 32736, this->position, 1250, 2500); __spawnQueue_add_1((GenFunction_1)chShrapnel_spawnExplodeActor, reinterpret_cast(s32, this)); chShrapnel_emitExplosion(this); chShrapnel_emitSmoke(this); @@ -127,10 +127,10 @@ void chShrapnel_func_802D0FC8(Actor *this) { *(s32 *)(&this->local) = NOT(*(s32 *)(&this->local)); this->unk4C = 0.0f; if (*(s32 *)(&this->local)) { - FUNC_8030E8B4(SFX_2A_CLOCK_TIC_1, 0.5f, 12000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2A_CLOCK_TIC_1, 0.5f, 12000, this->position, 1250, 2500); } else{ - FUNC_8030E8B4(SFX_51_CLOCK_TIC_2, 0.5f, 12000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_51_CLOCK_TIC_2, 0.5f, 12000, this->position, 1250, 2500); } } } @@ -169,7 +169,7 @@ void chshrapnel_update(Actor *this) { if (250.0 > ABS(player_position[1] - this->unk1C[1])) { subaddie_set_state(this, 3); actor_loopAnimation(this); - FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 32750, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 32750, this->position, 1250, 2500); this->actor_specific_1_f = 4.0f; } } diff --git a/src/core2/ch/snacker.c b/src/core2/ch/snacker.c index 11b3539d..7860ff91 100644 --- a/src/core2/ch/snacker.c +++ b/src/core2/ch/snacker.c @@ -80,7 +80,7 @@ static void __chsnacker_start_dialog(Actor *this) { text_index = mapSpecificFlags_getN(8, 3); if( !this->has_met_before ) { if(text_index < 4) { - if(gcdialog_showText(0xA1B + text_index, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(0xA1B + text_index, 0, NULL, NULL, NULL, NULL)){ text_index++; mapSpecificFlags_setN(8, text_index, 3); this->has_met_before = TRUE; @@ -129,7 +129,7 @@ static void __chsnacker_die(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); actor_collisionOff(this); - FUNC_8030E8B4(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); + sfx_playFadeShorthandDefault(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); subaddie_set_state_with_direction(this, CH_SNACKER_STATE_9_DEAD, 0.0f, 1); actor_playAnimationOnce(this); } @@ -156,7 +156,7 @@ static void __chsnacker_ow(ActorMarker *marker, ActorMarker *other){ this = marker_getActor(marker); if(level_get() == LEVEL_2_TREASURE_TROVE_COVE && !player_isDead()){ - gcdialog_showText(0xA29, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xA29, 0, NULL, NULL, NULL, NULL); }//L802E10A4 if(this->state == 4){ @@ -250,7 +250,7 @@ void chsnacker_update(Actor *this) { case CH_SNACKER_STATE_5_EATING: //802E14F8 if (actor_animationIsAt(this, 0.25f)) { - FUNC_8030E8B4(SFX_6D_CROC_BITE, 1.0f, 28000, this->position, 300, 3000); + sfx_playFadeShorthandDefault(SFX_6D_CROC_BITE, 1.0f, 28000, this->position, 300, 3000); } if (actor_animationIsAt(this, 0.99f)) { func_802E0CD0(this); @@ -374,7 +374,7 @@ void chSnacker_spawn(void) { if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) == 0) { func_8032BB88(snacker, 5000, 750); core1_ce60_incOrDecCounter(FALSE); - func_8025A6EC(COMUSIC_34_SNACKER_DANGER, 0); + coMusicPlayer_playMusic(COMUSIC_34_SNACKER_DANGER, 0); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750); core1_ce60_incOrDecCounter(TRUE); } diff --git a/src/core2/ch/snowball.c b/src/core2/ch/snowball.c index e1097313..57fec25f 100644 --- a/src/core2/ch/snowball.c +++ b/src/core2/ch/snowball.c @@ -32,8 +32,8 @@ Actor *chSnowball_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { this = actor_draw(marker, gfx, mtx, vtx); if (marker->unk14_21 && this->state != 2) { - func_8033E73C(marker, 5, func_80329904); - func_8033E3F0(0xD, marker->unk14_21); + commonParticle_add(marker, 5, func_80329904); + commonParticle_new(0xD, marker->unk14_21); } return this; } @@ -97,8 +97,8 @@ void chSnowball_update(Actor *this) { s32 phi_a1; s32 i; - if(this->unk38_31 == 0 && func_80329530(this, 500)){ - FUNC_8030E8B4(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.85f, 32000, this->position, 1250, 2500); + if(this->unk38_31 == 0 && subaddie_playerIsWithinSphereAndActive(this, 500)){ + sfx_playFadeShorthandDefault(SFX_C_TAKING_FLIGHT_LIFTOFF, 0.85f, 32000, this->position, 1250, 2500); this->unk38_31 = 1; } diff --git a/src/core2/ch/snowman.c b/src/core2/ch/snowman.c index 4c801814..3b84cbdb 100644 --- a/src/core2/ch/snowman.c +++ b/src/core2/ch/snowman.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_802EFA20(ParticleEmitter *, f32, f32); +extern void particleEmitter_func_802EFA20(ParticleEmitter *, f32, f32); extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80328FB0(Actor *, f32); extern void func_803300C0(ActorMarker *, void *); @@ -124,7 +124,7 @@ void __chSnowman_spawnSnowballParticles(f32 position[3], s32 count){ particleEmitter_setAngularVelocityRange(particleSpawner, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); particleEmitter_func_802EF9F8(particleSpawner, 0.01f); particleEmitter_func_802EFA18(particleSpawner, 3); - func_802EFA20(particleSpawner, 1.0f, 1.3f); + particleEmitter_func_802EFA20(particleSpawner, 1.0f, 1.3f); particleEmitter_setSfx(particleSpawner, SFX_2F_ORANGE_SPLAT, 16000); particleEmitter_setScaleAndLifetimeRanges(particleSpawner, &D_80368694); particleEmitter_emitN(particleSpawner, count); @@ -158,12 +158,12 @@ bool __chSnowman_isYawNearYawTarget(Actor *this, s32 max_angle_degree){ int __chSnowman_isPlayerInAttackRange(Actor *this, s32 min_distance, s32 max_distance){ f32 player_position[3]; - if(this->unkF4_8 == 0x33){ + if(this->actorTypeSpecificField == 0x33){ player_getPosition(player_position); if( (this->position[1] + 500.0f < player_position[1]) || (player_position[1] < this->position[1] - 500.0f)) return 0; }//L802E1F28 - if(func_80329530(this, max_distance) && !func_80329530(this, min_distance)){ + if(subaddie_playerIsWithinSphereAndActive(this, max_distance) && !subaddie_playerIsWithinSphereAndActive(this, min_distance)){ return 1; } return 0; @@ -181,9 +181,9 @@ int __chSnowman_func_802E1F70(ActorMarker *marker, s32 arg1){ void __chSnowman_deathCallback(ActorMarker *marker, ActorMarker *other_marker){ Actor *actor = marker_getActor(marker); - FUNC_8030E8B4(SFX_15_METALLIC_HIT_2, 1.0f, 30000, actor->position, 1500, 4500); - FUNC_8030E8B4(SFX_3EA_UNKNOWN, 1.0f, 30000, actor->position, 1500, 4500); - FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 1.0f, 30000, actor->position, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_15_METALLIC_HIT_2, 1.0f, 30000, actor->position, 1500, 4500); + 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, (s32)actor->marker); if(map_get() == MAP_27_FP_FREEZEEZY_PEAK) @@ -250,7 +250,7 @@ void chSnowman_update(Actor *this){ local->unk9 = FALSE; local->unkA = 1; __chSnowman_setYawTarget(this, 6.0f); - if(!func_80329530(this, 3150)){ + if(!subaddie_playerIsWithinSphereAndActive(this, 3150)){ __chSnowman_enterDeath(this); } else if( @@ -278,7 +278,7 @@ void chSnowman_update(Actor *this){ } break; case CHSNOWMAN_STATE_2_ATTACK://L802E23E8 - if(!func_80329530(this, 3150)){ + if(!subaddie_playerIsWithinSphereAndActive(this, 3150)){ __chSnowman_enterDeath(this); }//L802E240C else if( @@ -297,7 +297,7 @@ void chSnowman_update(Actor *this){ || actor_animationIsAt(this, 0.28f) || actor_animationIsAt(this, 0.37f) ){ - FUNC_8030E8B4(SFX_A7_WOODEN_SWOSH, 1.3f, 18000, this->position, 800, 3050); + sfx_playFadeShorthandDefault(SFX_A7_WOODEN_SWOSH, 1.3f, 18000, this->position, 800, 3050); }//L802E24FC if(actor_animationIsAt(this, 0.15f)){ func_8030E878(SFX_3F5_UNKNOWN, randf2(1.35f, 1.5f),32000, this->position, 800.0f, 3050.0f); @@ -318,7 +318,7 @@ void chSnowman_update(Actor *this){ } break; case CHSNOWMAN_STATE_3_DIE://L802E2604 - if(func_80329530(this, 3150)){ + if(subaddie_playerIsWithinSphereAndActive(this, 3150)){ __chSnowman_enterIdle(this); } break; diff --git a/src/core2/ch/snowmanhat.c b/src/core2/ch/snowmanhat.c index 128810bf..59cb904a 100644 --- a/src/core2/ch/snowmanhat.c +++ b/src/core2/ch/snowmanhat.c @@ -28,7 +28,7 @@ void chSnowmanHat_update(Actor *this){ if(this->position_y <= mapModel_getFloorY(this->position)){ subaddie_set_state(this, 2); - FUNC_8030E8B4(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 32750, this->position, 2250, 4500); + sfx_playFadeShorthandDefault(SFX_1D_HITTING_AN_ENEMY_1, 1.0f, 32750, this->position, 2250, 4500); } break; diff --git a/src/core2/ch/soundsource.c b/src/core2/ch/soundsource.c index 987306e8..b7ded9d9 100644 --- a/src/core2/ch/soundsource.c +++ b/src/core2/ch/soundsource.c @@ -58,7 +58,7 @@ void func_802D05A0(Actor *this, s32 next_state){ } local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(local->sfxsourceIdx, D_80367340[(s32)this->yaw].unk0); - func_8030DD14(local->sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 3); func_8030DFF0(local->sfxsourceIdx, 1); sfxsource_set_position(local->sfxsourceIdx, this->position); sfxsource_set_fade_distances(local->sfxsourceIdx, D_80367340[(s32)this->yaw].unk4*this->scale, D_80367340[(s32)this->yaw].unk6*this->scale); @@ -66,7 +66,7 @@ void func_802D05A0(Actor *this, s32 next_state){ func_802D0500(this); if(-1.0f != D_80367340[(s32)this->yaw].unkC) sfxsource_playSfxAtVolume(local->sfxsourceIdx, D_80367340[(s32)this->yaw].unkC); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); }//L802D0780 this->state = next_state; } diff --git a/src/core2/ch/termite.c b/src/core2/ch/termite.c index 5cc3c174..055df049 100644 --- a/src/core2/ch/termite.c +++ b/src/core2/ch/termite.c @@ -63,10 +63,10 @@ void __chTermite_updateWalkSFX(Actor *this) { , 8000.0f, 1000.0f ); if (actor_animationIsAt(this, 0.4f)) { - func_8030E6A4(SFX_3D_TICKER_WALKING, 0.85f, (s32) sp20); + gcsfx_playWithPitch(SFX_3D_TICKER_WALKING, 0.85f, (s32) sp20); } if (actor_animationIsAt(this, 0.9f)) { - func_8030E6A4(SFX_3D_TICKER_WALKING, 1.15f, (s32) sp20); + gcsfx_playWithPitch(SFX_3D_TICKER_WALKING, 1.15f, (s32) sp20); } } @@ -75,7 +75,7 @@ void __chTermite_setupParticleEmitter(ParticleEmitter *pCtrl, f32 position[3]){ particleEmitter_setDrawMode(pCtrl, 2); particleEmitter_func_802EF9F8(pCtrl, 0.7f); particleEmitter_func_802EFA18(pCtrl, 5); - func_802EFA20(pCtrl, 0.8f, 1.0f); + particleEmitter_func_802EFA20(pCtrl, 0.8f, 1.0f); particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 10000); particleEmitter_setSpawnIntervalRange(pCtrl, 0.0f, 0.01f); particleEmitter_setParticleLifeTimeRange(pCtrl, 3.5f, 3.5f); @@ -166,29 +166,29 @@ void chTermite_update(Actor *this) { } if( map_get() == MAP_C_MM_TICKERS_TOWER && !mapSpecificFlags_get(0) - && func_80329530(this, 700) - && !func_80329530(this, 150) + && subaddie_playerIsWithinSphereAndActive(this, 700) + && !subaddie_playerIsWithinSphereAndActive(this, 150) && player_movementGroup() == BSGROUP_0_NONE && player_getTransformation() == TRANSFORM_1_BANJO ) { - gcdialog_showText(ASSET_B43_DIALOG_TERMITE_MEET_AS_BEAR, 7, this->position, this->marker, __chTermite_testCallback, NULL); + gcdialog_showDialog(ASSET_B43_DIALOG_TERMITE_MEET_AS_BEAR, 7, this->position, this->marker, __chTermite_testCallback, NULL); mapSpecificFlags_set(0, TRUE); levelSpecificFlags_set(LEVEL_FLAG_D_MM_UNKNOWN, TRUE); this->has_met_before = TRUE; } - if( func_80329530(this, 300) - && !func_80329530(this, 150) + if( subaddie_playerIsWithinSphereAndActive(this, 300) + && !subaddie_playerIsWithinSphereAndActive(this, 150) && player_movementGroup() == BSGROUP_0_NONE && player_getTransformation() == TRANSFORM_2_TERMITE ) { if (!levelSpecificFlags_get(LEVEL_FLAG_B_MM_UNKNOWN)) { - if (gcdialog_showText(ASSET_B41_DIALOG_TERMITE_COOL_SHORTS, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(ASSET_B41_DIALOG_TERMITE_COOL_SHORTS, 0, NULL, NULL, NULL, NULL)) { levelSpecificFlags_set(LEVEL_FLAG_B_MM_UNKNOWN, TRUE); this->unk138_23 = TRUE; } } - else if (!levelSpecificFlags_get(LEVEL_FLAG_C_MM_UNKNOWN) && !this->unk138_23 && (gcdialog_showText(ASSET_B42_DIALOG_TERMITE_COOL_BACKPACK, 0, NULL, NULL, NULL, NULL))) { + else if (!levelSpecificFlags_get(LEVEL_FLAG_C_MM_UNKNOWN) && !this->unk138_23 && (gcdialog_showDialog(ASSET_B42_DIALOG_TERMITE_COOL_BACKPACK, 0, NULL, NULL, NULL, NULL))) { levelSpecificFlags_set(LEVEL_FLAG_C_MM_UNKNOWN, TRUE); } } diff --git a/src/core2/ch/trainers.c b/src/core2/ch/trainers.c index cddd1f63..51680a18 100644 --- a/src/core2/ch/trainers.c +++ b/src/core2/ch/trainers.c @@ -45,7 +45,7 @@ void _chtrainers_802CA378(Actor *this, bool arg1){ if(arg1) FUNC_8030E624(SFX_8_BANJO_LANDING_04, 1.6f, 7000); else - FUNC_8030E8B4(SFX_8_BANJO_LANDING_04, 1.6f, 7000, this->position, 600, 1500); + sfx_playFadeShorthandDefault(SFX_8_BANJO_LANDING_04, 1.6f, 7000, this->position, 600, 1500); } func_802589E4(sp24, this->velocity[1], 40.0f); @@ -58,7 +58,7 @@ void _chtrainers_802CA378(Actor *this, bool arg1){ void chtrainers_update(Actor *this){ s32 sp2C = levelSpecificFlags_get(LEVEL_FLAG_1A_UNKNOWN); - if (sp2C && this->unkF4_8 != 1) { + if (sp2C && this->actorTypeSpecificField != 1) { return; } @@ -78,11 +78,11 @@ void chtrainers_update(Actor *this){ switch(this->state){ case 0://L802CA5A8 if(func_803296D8(this, 2000) || sp2C){ - if( func_80329530(this, 0xfa) + if( subaddie_playerIsWithinSphereAndActive(this, 0xfa) && !volatileFlag_get(VOLATILE_FLAG_F_HAS_MEET_TURBO_SHOES) && player_getTransformation() == TRANSFORM_1_BANJO ){ - if(gcdialog_showText(0xda4, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(0xda4, 0, NULL, NULL, NULL, NULL)){ volatileFlag_set(VOLATILE_FLAG_F_HAS_MEET_TURBO_SHOES, TRUE); } }//L802CA620 diff --git a/src/core2/ch/wadingboots.c b/src/core2/ch/wadingboots.c index 7acbfb31..a6725660 100644 --- a/src/core2/ch/wadingboots.c +++ b/src/core2/ch/wadingboots.c @@ -35,7 +35,7 @@ Actor *chwadingboots_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ void chwadingboots_update(Actor *this){ s32 sp2C = levelSpecificFlags_get(LEVEL_FLAG_1A_UNKNOWN); - if (sp2C && this->unkF4_8 != 1) { + if (sp2C && this->actorTypeSpecificField != 1) { return; } @@ -62,15 +62,15 @@ void chwadingboots_update(Actor *this){ FUNC_8030E624(SFX_3F2_UNKNOWN, 1.4f, 23000); } else{ - FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.4f, 23000, this->position, 600, 1500); + sfx_playFadeShorthandDefault(SFX_3F2_UNKNOWN, 1.4f, 23000, this->position, 600, 1500); } } if(volatileFlag_get(VOLATILE_FLAG_10_HAS_MEET_WADING_BOOTS)) break; - if(!func_80329530(this, 250)) break; + if(!subaddie_playerIsWithinSphereAndActive(this, 250)) break; if(player_getTransformation() != TRANSFORM_1_BANJO) break; - if(gcdialog_showText(ASSET_DA5_DIALOG_WADINGBOOTS_MEET, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(ASSET_DA5_DIALOG_WADINGBOOTS_MEET, 0, NULL, NULL, NULL, NULL)){ volatileFlag_set(VOLATILE_FLAG_10_HAS_MEET_WADING_BOOTS, TRUE); } diff --git a/src/core2/ch/whipcrack.c b/src/core2/ch/whipcrack.c index e87ba64b..e6a37fe2 100644 --- a/src/core2/ch/whipcrack.c +++ b/src/core2/ch/whipcrack.c @@ -24,7 +24,7 @@ void __chwhipcrack_spawnPieces(Actor *this, enum asset_e model_id, s32 cnt){ ); particleEmitter_func_802EF9F8(pCtrl, 0.7f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 0.5f, 1.0f); + particleEmitter_func_802EFA20(pCtrl, 0.5f, 1.0f); particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 10000); particleEmitter_setModel(pCtrl, model_id); particleEmitter_setSpawnPositionRange(pCtrl, @@ -79,7 +79,7 @@ void __chwhipcrack_setState(Actor *this, s32 next_state){ __chwhipcrack_spawnPieces(this, ASSET_4FF_MODEL_WHIPCRACK_PART_2, 4); __chwhipcrack_spawnPieces(this, ASSET_500_MODEL_WHIPCRACK_PART_3, 4); __chwhipcrack_spawnSmoke(this, 6); - FUNC_8030E8B4(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); + sfx_playFadeShorthandDefault(SFX_2F_ORANGE_SPLAT, 0.8f, 32200, this->position, 500, 2500); marker_despawn(this->marker); } diff --git a/src/core2/code_10CD0.c b/src/core2/code_10CD0.c deleted file mode 100644 index 966dad67..00000000 --- a/src/core2/code_10CD0.c +++ /dev/null @@ -1,37 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "core2/statetimer.h" - -/* .bss */ -u8 D_8037C530; - -/* .code */ -void func_80297C60(s32 arg0){ - D_8037C530 = arg0; -} - -s32 func_80297C6C(void){ - return D_8037C530; -} - -void func_80297C78(void){ - D_8037C530 = 0; - func_80297C60(1); - stateTimer_clear(STATE_TIMER_4_UNKNOWN); -} - -void func_80297CA8(void){ - func_80297CCC(0.6f); -} - -void func_80297CCC(f32 value){ - stateTimer_set(STATE_TIMER_4_UNKNOWN, value); - func_80297C60(3); -} - -void func_80297CF8(void){ - if(stateTimer_isDone(STATE_TIMER_4_UNKNOWN)){ - func_80297C60(1); - } -} diff --git a/src/core2/code_11870.c b/src/core2/code_11870.c index 1c985061..5af7f6b8 100644 --- a/src/core2/code_11870.c +++ b/src/core2/code_11870.c @@ -32,7 +32,7 @@ void func_80298890(void){ if(D_8037C670){ D_8037C670--; if(D_8037C670 == 0){ - func_80297CCC(1.2f); + bsiFrame_startWithValue(1.2f); D_8037C671 = 0; } } diff --git a/src/core2/code_13780.c b/src/core2/code_13780.c index fb8c2f63..df667d07 100644 --- a/src/core2/code_13780.c +++ b/src/core2/code_13780.c @@ -7,62 +7,69 @@ s32 D_8037D160; //prev_state s32 D_8037D164; //state s32 D_8037D168; //next_state -s32 D_8037D16C; -s32 D_8037D170; +s32 currentInterrupt; +s32 interruptResponse; -void bs_clearState(void){ +void bs_clearState(void) { D_8037D160 = 0; D_8037D164 = 0; D_8037D168 = 0; } -void bs_setState(s32 state_id){ +void bs_setState(s32 state_id) { - if(state_id == 0) + if (state_id == 0) { return; + } D_8037D168 = state_id; - if(bsList_getEndMethod(D_8037D164) != NULL) + if (bsList_getEndMethod(D_8037D164) != NULL) { bsList_getEndMethod(D_8037D164)(); + } D_8037D160 = D_8037D164; D_8037D164 = D_8037D168; D_8037D168 = 0; - if(bsList_getInitMethod(D_8037D164) != NULL) + if (bsList_getInitMethod(D_8037D164) != NULL) { bsList_getInitMethod(D_8037D164)(); + } } -s32 bs_getPrevState(void){ +s32 bs_getPrevState(void) { return D_8037D160; } -s32 bs_getState(void){ +s32 bs_getState(void) { return D_8037D164; } -s32 bs_getNextState(void){ +s32 bs_getNextState(void) { return D_8037D168; } -void bs_updateState(void){ - if(bsList_getUpdateMethod(D_8037D164) != NULL) +void bs_updateState(void) { + if (bsList_getUpdateMethod(D_8037D164) != NULL) { bsList_getUpdateMethod(D_8037D164)(); + } } -s32 bs_checkInterrupt(enum bs_interrupt_e arg0){ - D_8037D16C = arg0; - D_8037D170 = 0; - if(bsList_getInterruptMethod(D_8037D164) != NULL) +s32 bs_checkInterrupt(enum bs_interrupt_e interruptId) { + currentInterrupt = interruptId; + interruptResponse = 0; + + if (bsList_getInterruptMethod(D_8037D164) != NULL) { bsList_getInterruptMethod(D_8037D164)(); - return D_8037D170; + } + + return interruptResponse; } -void func_8029A86C(s32 arg0){ - D_8037D170 = arg0; +void bs_setInterruptResponse(s32 response) { + interruptResponse = response; } -enum bs_interrupt_e bs_getInterruptType(void){ - return D_8037D16C; +enum bs_interrupt_e bs_getInterruptType(void) { + return currentInterrupt; } diff --git a/src/core2/code_13A00.c b/src/core2/code_13A00.c index b5e4a559..6efba52d 100644 --- a/src/core2/code_13A00.c +++ b/src/core2/code_13A00.c @@ -5,7 +5,7 @@ extern void func_802F494C(void *, f32); extern void func_802F4884(void *, s32, f32); -extern f32 func_80294500(void); +extern f32 floor_getCurrentFloorYPosition(void); void func_8029AE74(s32 arg0); @@ -26,7 +26,7 @@ void func_8029A990(void){ func_8029C304(1); _player_getPosition(plyr_pos); - plyr_pos[1] = func_80294500(); + plyr_pos[1] = floor_getCurrentFloorYPosition(); pCtrl = func_802F4094(plyr_pos, 25.0f); particleEmitter_setParticleVelocityRange(pCtrl, -350.0f, 300.0f, -350.0f, @@ -46,7 +46,7 @@ void func_8029AA3C(void){ sp30 = ml_map_f(baphysics_get_horizontal_velocity(), 0.0f, 500.0f, 70.0f, 250.0f); func_8028E9C4(D_8037D194, sp34); - sp34[1] = func_80294500(); + sp34[1] = floor_getCurrentFloorYPosition(); pCtrl = func_802F4094(sp34, 8.0f); particleEmitter_setParticleVelocityRange(pCtrl, -sp30, 300.0f, -sp30, @@ -116,7 +116,7 @@ void func_8029ACD4(void){ _player_getPosition(plyr_pos); func_802F4894(D_8037D190, plyr_pos); - func_802F4884( D_8037D190, func_80294660(), func_80294500()); + func_802F4884( D_8037D190, func_80294660(), floor_getCurrentFloorYPosition()); } void func_8029AD28(f32 arg0, s32 arg1){ diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index 77cb1710..9daf5fe5 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -271,7 +271,7 @@ f32 func_8029B56C(f32 arg0, f32 arg1, f32 arg2, f32 arg3) { void func_8029B5EC(void){ func_802DC560(0, 0); func_802E412C(1, 0); - func_802E4078(MAP_1F_CS_START_RAREWARE, 0, 1); + transitionToMap(MAP_1F_CS_START_RAREWARE, 0, 1); } void func_8029B62C(void){ @@ -285,7 +285,7 @@ void func_8029B62C(void){ } else{ func_802E412C(1, 0); - func_802E4078(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, 1); + transitionToMap(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, 1); } } @@ -299,7 +299,7 @@ void func_8029B6F0(void){ func_8029B62C(); } else{ - func_802E4078(gVoidOutReturnLocation[0], gVoidOutReturnLocation[1], 1); + transitionToMap(gVoidOutReturnLocation[0], gVoidOutReturnLocation[1], 1); } } @@ -341,7 +341,7 @@ void func_8029B890(void){ func_8029B62C(); return; } - gcdialog_showText(0xf81, 7, NULL, NULL, func_8029B85C, NULL); + gcdialog_showDialog(0xf81, 7, NULL, NULL, func_8029B85C, NULL); fileProgressFlag_set(FILEPROG_A8_HAS_DIED, TRUE); } else{ @@ -354,7 +354,7 @@ void func_8029B930(void){ } ParticleEmitter *func_8029B950(f32 pos[3],f32 arg1){ - return func_802EDD8C(pos, arg1, func_80294500()); + return func_802EDD8C(pos, arg1, floor_getCurrentFloorYPosition()); } void func_8029B984(f32 dst[3]){ @@ -581,7 +581,7 @@ enum bs_e bs_getIdleState(void){ return BS_26_LONGLEG_IDLE; } if (player_inWater()) { - if (player_getYPosition() > (func_80294500() - 80.0f)) { + if (player_getYPosition() > (floor_getCurrentFloorYPosition() - 80.0f)) { return BS_2D_SWIM_IDLE; } return BS_2B_DIVE_IDLE; @@ -599,9 +599,9 @@ void func_8029C0D0(void) { ParticleEmitter *p_ctrl; f32 sp34; - if (func_80294574()) { + if (floor_isCurrentFloorunk59()) { _player_getPosition(sp3C); - sp3C[1] = sp34 = func_80294500(); + sp3C[1] = sp34 = floor_getCurrentFloorYPosition(); p_ctrl = func_802F4094(sp3C, 35.0f); fxRipple_802F3554(3, sp3C); particleEmitter_setParticleVelocityRange(p_ctrl, -350.0f, 300.0f, -350.0f, 350.0f, 500.0f, 350.0f); @@ -620,7 +620,7 @@ void func_8029C0D0(void) { void func_8029C22C(void) { - if(func_80294574() && func_80294500() > player_getYPosition()) + if(floor_isCurrentFloorunk59() && floor_getCurrentFloorYPosition() > player_getYPosition()) return; D_80364620 = D_80364620 ? FALSE : TRUE; @@ -638,7 +638,7 @@ void func_8029C304(s32 arg0) { f32 sp1C[3]; _player_getPosition(sp1C); - sp1C[1] = func_80294500(); + sp1C[1] = floor_getCurrentFloorYPosition(); fxRipple_802F3584(arg0, sp1C, func_802946CC()); } @@ -679,13 +679,13 @@ void func_8029C4E4(bool arg0) { f32 sp38; ParticleEmitter *sp34; - if (func_80294574()) { + if (floor_isCurrentFloorunk59()) { if (arg0) { baModel_80292260(sp3C); } else { baModel_8029223C(sp3C); } - sp3C[1] = func_80294500(); + sp3C[1] = floor_getCurrentFloorYPosition(); sp38 = yaw_get(); sp34 = func_802F4094(sp3C, 8.0f); particleEmitter_setSphericalParticleVelocityRange(sp34, -140.0f, sp38 - 35.0f, 200.0f, -120.0f, sp38 + 35.0f, 250.0f); @@ -890,15 +890,15 @@ void func_8029CBC4(void){ void func_8029CBF4(void){ if(item_getCount(ITEM_E_JIGGY) == 10){ if( jiggyscore_total() == 100 && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){ - timedFunc_set_3(4.1f, (GenFunction_3)func_802E4078, MAP_95_CS_END_ALL_100, 0, 1); + timedFunc_set_3(4.1f, (GenFunction_3)transitionToMap, MAP_95_CS_END_ALL_100, 0, 1); }//L8029CC58 timedFunc_set_0(4.0f, func_8029CBC4); - func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); + coMusicPlayer_playMusic(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); }//L8029CC7C else{ if( jiggyscore_total() == 100 && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){ - func_802E4078(MAP_95_CS_END_ALL_100, 0, 1); + transitionToMap(MAP_95_CS_END_ALL_100, 0, 1); } func_8029CBC4(); } @@ -921,7 +921,7 @@ void func_8029CCC4(void){ } core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 0xC); - func_8025A6EC(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); + coMusicPlayer_playMusic(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); timedFunc_set_0(4.0f, func_8029CBF4); } diff --git a/src/core2/code_16010.c b/src/core2/code_16010.c deleted file mode 100644 index b859a7e6..00000000 --- a/src/core2/code_16010.c +++ /dev/null @@ -1,323 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#include "core2/ba/timer.h" -#include "core2/statetimer.h" - -/* .bss */ -u8 D_8037D210; -u8 D_8037D211; -u8 D_8037D212; -f32 D_8037D218[3]; -f32 D_8037D224; - -/*.code */ -bool func_8029CFA0(void){ - return func_80294574() && func_80294500() > player_getYPosition(); -} - -void func_8029CFF8(void){ - sfxsource_freeSfxsourceByIndex(D_8037D210); -} - -void func_8029D01C(void){ - baflag_clear(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); - D_8037D210 = sfxsource_createSfxsourceAndReturnIndex(); - D_8037D212 = 0; -} - -void func_8029D050(void){ - basfx_80299E48(); - func_8030E394(D_8037D210); - sfxsource_setSfxId(D_8037D210, SFX_14D_BANJO_FREEZING); - sfxsource_setSampleRate(D_8037D210, 30000); - sfxsource_playSfxAtVolume(D_8037D210, 1.2f); - func_8030DD14(D_8037D210, 3); - func_8030E2C4(D_8037D210); - - D_8037D211 = 2; - D_8037D224 = 1.0f; -} - -void func_8029D0D8(void) { - func_8030E394(D_8037D210); - sfxsource_setSfxId(D_8037D210, SFX_B0_SIZZLING_NOISE); - sfxsource_setSampleRate(D_8037D210, 32000); - sfxsource_playSfxAtVolume(D_8037D210, randf2(0.7f, 0.8f)); - func_8030DD14(D_8037D210, 3); - func_8030E2C4(D_8037D210); -} - -void func_8029D154(void){ - f32 plyr_pos[3]; - player_getPosition(plyr_pos); - actor_spawnWithYaw_f32(0x188, plyr_pos, (s32)yaw_get()); -} - -void func_8029D194(void) { - __spawnQueue_add_0(&func_8029D154); - FUNC_8030E624(SFX_A_BANJO_LANDING_05, 1.0f, 28000); - func_8030E394(D_8037D210); - sfxsource_setSfxId(D_8037D210, SFX_6D_CROC_BITE); - sfxsource_setSampleRate(D_8037D210, 22000); - func_8030DD14(D_8037D210, 3); - player_getPosition(D_8037D218); - D_8037D218[1] = func_80294500(); - D_8037D212 = 4; - D_8037D224 = 0.0f; -} - -/* plays ground damage sound effect */ -void func_8029D230(void) { - switch (map_get()) { - case MAP_12_GV_GOBIS_VALLEY: //L8029D2C0 - case MAP_31_RBB_RUSTY_BUCKET_BAY: //L8029D2C0 - case MAP_3C_RBB_KITCHEN: //L8029D2C0 - case MAP_6E_GL_GV_LOBBY: - case MAP_8E_GL_FURNACE_FUN: - func_8029D0D8(); - break; - - case MAP_27_FP_FREEZEEZY_PEAK: //L8029D2D0 - case MAP_7F_FP_WOZZAS_CAVE: - func_8029D050(); - break; - - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: - case MAP_72_GL_BGS_LOBBY: - func_8029D194(); - break; - } -} - -void func_8029D2F8(void) { - u8 temp_v0; - - if (D_8037D211 != 0) { - if ((func_8029CFA0() == 0) && (func_8028F2FC() == 0) && (func_8030E3FC(D_8037D210) != 0)) { - func_8030E394(D_8037D210); - D_8037D211 = 0; - return; - } - - D_8037D224 = ml_max_f(0.0f, D_8037D224 - time_getDelta()); - if (D_8037D224 == 0.0f) { - if (D_8037D211 == 1) { - func_8029D050(); - } - else if (D_8037D211 == 2) { - func_8030E394(D_8037D210); - sfxsource_setSfxId(D_8037D210, SFX_134_FREEZING_SHIVER); - sfxsource_setSampleRate(D_8037D210, 20000); - sfxsource_playSfxAtVolume(D_8037D210, 1.2f); - func_8030DD14(D_8037D210, 3); - func_8030E2C4(D_8037D210); - D_8037D211 = 2; - D_8037D224 = 1.5f; - } - } - } -} - - -void func_8029D448(void) { - f32 sp1C; - s32 temp_a1; - - if (func_8030E3FC(D_8037D210) != 0) { - sp1C = time_getDelta(); - temp_a1 = func_8030E1C4(D_8037D210) - (s32) (sp1C * 30000.0); - if (temp_a1 <= 0) { - func_8030E394(D_8037D210); - return; - } - sfxsource_setSampleRate(D_8037D210, temp_a1); - } -} - -void func_8029D4D8(void) { - if (D_8037D212 != 0) { - D_8037D224 = ml_max_f(0.0f, D_8037D224 - time_getDelta()); - if (!(D_8037D224 > 0.0f)) { - D_8037D212 += -1; - D_8037D224 = randf2(0.12f, 0.22f); - sfxsource_playSfxAtVolume(D_8037D210, randf2(0.95f, 1.05f)); - func_8030E2C4(D_8037D210); - } - } -} - -void func_8029D5A4(void){ - switch (map_get()) { - case MAP_12_GV_GOBIS_VALLEY: - case MAP_31_RBB_RUSTY_BUCKET_BAY: - case MAP_3C_RBB_KITCHEN: - case MAP_6E_GL_GV_LOBBY: - case MAP_8E_GL_FURNACE_FUN: - func_8029D448(); - break; - - case MAP_27_FP_FREEZEEZY_PEAK: - case MAP_7F_FP_WOZZAS_CAVE: - func_8029D2F8(); - break; - - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: - case MAP_72_GL_BGS_LOBBY: - func_8029D4D8(); - break; - } -} - -bool func_8029D66C(void){ - f32 sp2C[3]; - - switch (map_get()) { - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: - case MAP_12_GV_GOBIS_VALLEY: - case MAP_1B_MMM_MAD_MONSTER_MANSION: - case MAP_3C_RBB_KITCHEN: - case MAP_43_CCW_SPRING: - case MAP_44_CCW_SUMMER: - case MAP_45_CCW_AUTUMN: - case MAP_46_CCW_WINTER: - case MAP_6E_GL_GV_LOBBY: - case MAP_72_GL_BGS_LOBBY: - case MAP_8E_GL_FURNACE_FUN://L8029D6FC - return func_80294610(0xE000) && player_isStable(); - - case MAP_31_RBB_RUSTY_BUCKET_BAY: - player_getPosition(sp2C); - return player_inWater() && ml_vec3f_inside_box_f(sp2C, -9000.0f, -3000.0f, -3850.0f, -6820.0f, -700.0f, -1620.0f); - break; - - case MAP_27_FP_FREEZEEZY_PEAK: - case MAP_7F_FP_WOZZAS_CAVE://L8029D790 - return player_inWater(); - } - return FALSE; -} - -bool canTakeGroundDamage(void){ - enum bs_e sp1C; - - sp1C = bs_getState(); - - switch (map_get()) { - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: - case MAP_12_GV_GOBIS_VALLEY: - case MAP_1B_MMM_MAD_MONSTER_MANSION: - case MAP_27_FP_FREEZEEZY_PEAK: - case MAP_31_RBB_RUSTY_BUCKET_BAY: - case MAP_3C_RBB_KITCHEN: - case MAP_43_CCW_SPRING: - case MAP_44_CCW_SUMMER: - case MAP_45_CCW_AUTUMN: - case MAP_46_CCW_WINTER: - case MAP_6E_GL_GV_LOBBY: - case MAP_72_GL_BGS_LOBBY: - case MAP_7F_FP_WOZZAS_CAVE://L8029D84C - case MAP_8E_GL_FURNACE_FUN://L8029D84C - return func_8029D66C() - && bsStoredState_getTransformation() == TRANSFORM_1_BANJO - && stateTimer_isDone(STATE_TIMER_2_LONGLEG) - && player_movementGroup() != BSGROUP_3_WONDERWING - && player_movementGroup() != BSGROUP_9_LONG_LEG - && baflag_isFalse(BA_FLAG_E_TOUCHING_WADING_BOOTS) - && sp1C != BS_25_LONGLEG_ENTER - && player_getWaterState() != BSWATERGROUP_2_UNDERWATER - && func_8028EC04() < 1U - && func_80297C6C() != 3 - && bs_getState() != BS_3D_FALL_TUMBLING - && player_isDead() < 1U - ; - } - return 0; -} - -void func_8029D968(void){ - s32 can_take_ground_damage; - BKCollisionTri *temp_v0; - s32 sp1C; - s32 sp18; - - func_8029D5A4(); - if(map_get() == MAP_12_GV_GOBIS_VALLEY){ - sp18 = 0; - sp1C = 0; - temp_v0 = func_802946F0(); - if(temp_v0 != NULL){ - sp1C = temp_v0->flags & 0x4000; - } - temp_v0 = func_8029463C(); - if(temp_v0 != NULL){ - sp18 = (temp_v0->flags & 0x4000) && player_isStable(); - } - if (sp1C || sp18) { - baMotor_80250D94(1.0f, 0.5f, 0.4f); - func_8028F504(0xD); - } - }//L8029DA18 - - can_take_ground_damage = canTakeGroundDamage(); - batimer_decrement(4); - if(can_take_ground_damage){ - if(map_get() == MAP_8E_GL_FURNACE_FUN){ - if(bs_checkInterrupt(BS_INTR_13_FF_DEATH_SQUARE)){ - func_8029D230(); - } - } - else{//L8029DA6C - - if(batimer_isZero(4)){ - batimer_set(4, 4.0f); - if(func_8028F504(0xD)){ - func_8029D230(); - baMotor_80250D94(1.0f, 0.5f, 0.4f); - } - if(item_empty(ITEM_14_HEALTH)){ - bs_checkInterrupt(BS_INTR_13_FF_DEATH_SQUARE); - } - }//L8029DAD0 - - switch (map_get()) { - case MAP_43_CCW_SPRING://8029DB58 - case MAP_44_CCW_SUMMER://8029DB58 - case MAP_45_CCW_AUTUMN://8029DB58 - case MAP_46_CCW_WINTER://8029DB58 - func_8035644C(FILEPROG_AA_HAS_TOUCHED_CCW_BRAMBLE_FIELD); - break; - - case MAP_D_BGS_BUBBLEGLOOP_SWAMP://8029DB68 - case MAP_72_GL_BGS_LOBBY: - func_8035644C(FILEPROG_F_HAS_TOUCHED_PIRAHANA_WATER); - break; - - case MAP_3C_RBB_KITCHEN://8029DB78 - func_8035644C(FILEPROG_A9_HAS_TOUCHED_RBB_OVEN); - break; - - case MAP_12_GV_GOBIS_VALLEY://8029DB88 - case MAP_6E_GL_GV_LOBBY: - case MAP_8E_GL_FURNACE_FUN://8029DB88 - func_8035644C(FILEPROG_10_HAS_TOUCHED_SAND_EEL_SAND); - break; - - case MAP_27_FP_FREEZEEZY_PEAK://8029DB98 - case MAP_7F_FP_WOZZAS_CAVE://8029DB98 - func_8035644C(FILEPROG_14_HAS_TOUCHED_FP_ICY_WATER); - break; - - case MAP_1B_MMM_MAD_MONSTER_MANSION://8029DBA8 - if(!func_8029CFA0()) - func_8035644C(FILEPROG_86_HAS_TOUCHED_MMM_THORN_HEDGE); - break; - } - } - baflag_set(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); - } - else{ - baflag_clear(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); - } -} diff --git a/src/core2/code_33F90.c b/src/core2/code_33F90.c index ee9e4b59..e97bfb2c 100644 --- a/src/core2/code_33F90.c +++ b/src/core2/code_33F90.c @@ -25,6 +25,8 @@ void func_802BB3AC(s32 arg0, f32 arg1); /* .data */ extern s32 D_80364E00 = 0; extern s32 D_80364E04 = -1; + +// Time s16 D_80364E08[] = { 0, -1, 0, 1, 0x13, 0, -1, 0x32}; s16 D_80364E18[] = { 0xF, -1, 0xF, 2, 0x1B, 3, -1, 0x2A}; s16 D_80364E28[] = { 0x3, -1, 0xF, 4, 0x20, 5, -1, 0x37}; @@ -221,9 +223,9 @@ s16 *D_803654B8[] = { D_80364EA4, D_80364EB0, D_80364EBC, - D_80364EC8, - D_80364ED4, - D_80364EE0, + D_80364EC8, // MM Conga Orange Pad Top Jiggy Spawn + D_80364ED4, // MM Conga Orange Pad Left Jiggy Spawn + D_80364EE0, // MM Conga Orange Pad Right Jiggy Spawn D_80364EEC, D_80364EF8, D_80364F04, @@ -404,66 +406,73 @@ void func_802BAF80(s32 arg0){ func_802BE720(); } -f32 func_802BAFA0(s32 arg0, s32 arg1){ +f32 func_802BAFA0(s32 arg0, s32 arg1) { return (f32)D_803654B8[arg0][arg1]/10.0; } -void func_802BAFE4(s32 arg0) { +void gcStaticCamera_activate(s32 cameraId) { f32 temp_f0; s32 phi_s1; s32 phi_s0; phi_s0 = 0; - if (arg0 != D_80364E04) { - D_80364E04 = arg0; - func_802BB22C(); - D_80364E00 = 1; - for(phi_s1 = 0; D_803654B8[arg0][phi_s1] != -1 && D_803654B8[arg0][phi_s1] != -4; phi_s1+=2){ - temp_f0 = func_802BAFA0(arg0, phi_s1); - switch(D_803654B8[arg0][phi_s1 + 1]){ - case -5: - timedFunc_set_6(temp_f0, (GenFunction_6) func_802BAF80, NULL); - phi_s0++; - break; - case -3: - func_80324E38(temp_f0, 1); - phi_s0++; - break; + if (cameraId == D_80364E04) { + return; + } - case -2: - func_80324E38(temp_f0, 2); - phi_s0++; - break; + D_80364E04 = cameraId; + func_802BB22C(); + D_80364E00 = 1; - case -1: - func_80324E38(temp_f0, 3); - phi_s0++; - break; + for (phi_s1 = 0; D_803654B8[cameraId][phi_s1] != -1 && D_803654B8[cameraId][phi_s1] != -4; phi_s1+=2) { + temp_f0 = func_802BAFA0(cameraId, phi_s1); + switch(D_803654B8[cameraId][phi_s1 + 1]){ + case -5: + timedFunc_set_6(temp_f0, (GenFunction_6) func_802BAF80, NULL); + phi_s0++; + break; - case -4: - func_80324E38(temp_f0, 4); - break; + case -3: + func_80324E38(temp_f0, 1); + phi_s0++; + break; - case -6: - func_80324E38(temp_f0, 4); - break; - - default: - timed_setStaticCameraToNode(temp_f0, D_803654B8[arg0][phi_s1 + 1]); - break; - } - } - temp_f0 = func_802BAFA0(arg0, phi_s1 + 1); - if (D_803654B8[arg0][phi_s1] == -4) { - func_80324E38(temp_f0, 4); - } else { - timed_exitStaticCamera(temp_f0); - } - for(phi_s1 = 0; phi_s1 < phi_s0; phi_s1++){ - func_80324E38(temp_f0, 0); + case -2: + func_80324E38(temp_f0, 2); + phi_s0++; + break; + + case -1: + func_80324E38(temp_f0, 3); + phi_s0++; + break; + + case -4: + func_80324E38(temp_f0, 4); + break; + + case -6: + func_80324E38(temp_f0, 4); + break; + + default: + timed_setStaticCameraToNode(temp_f0, D_803654B8[cameraId][phi_s1 + 1]); + break; } } + + temp_f0 = func_802BAFA0(cameraId, phi_s1 + 1); + + if (D_803654B8[cameraId][phi_s1] == -4) { + func_80324E38(temp_f0, 4); + } else { + timed_exitStaticCamera(temp_f0); + } + + for (phi_s1 = 0; phi_s1 < phi_s0; phi_s1++) { + func_80324E38(temp_f0, 0); + } } void func_802BB200(void){ diff --git a/src/core2/code_3EC30.c b/src/core2/code_3EC30.c deleted file mode 100644 index 8a57069b..00000000 --- a/src/core2/code_3EC30.c +++ /dev/null @@ -1,24 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void func_802C5BC0(Actor *this); - -/* .data */ -ActorInfo D_80365FB0 = { 0x65, 0xF3, 0x0, 0x0, 0x0, func_802C5BC0, actor_update_func_80326224, func_80325340, 0, 0, 0.0f, 0}; - -/* .code */ -void func_802C5BC0(Actor *this){ - if(!this->initialized){ - actor_collisionOff(this); - this->lifetime_value = 0.0f; - this->pitch = 90.0f; - fxRipple_802F3554(4, this->position); - this->initialized = TRUE; - } - else{ - this->lifetime_value += time_getDelta(); - if(2.0 < this->lifetime_value) - marker_despawn(this->marker); - } -} diff --git a/src/core2/code_41460.c b/src/core2/code_41460.c index f148b882..561bab3e 100644 --- a/src/core2/code_41460.c +++ b/src/core2/code_41460.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); +#include "core2/dustemitter.h" typedef struct struct_24_s{ s32 unk0; @@ -27,6 +27,8 @@ typedef struct struct_25_s{ Actor *func_802C8484(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_802C8C5C(Actor *this); +// These seem to be related to assets like bricks, pipes, planks, when destroying objects + /* .data */ f32 D_80366330 = 0.5f; f32 D_80366334 = 30.0f; @@ -59,7 +61,7 @@ void func_802C83F0(Actor *actor) { assetcache_release(phi_s0->model_bin); } if (phi_s0->unk3C != 0) { - func_802EE5E8(phi_s0->unk3C); + dustEmitter_empty(phi_s0->unk3C); } phi_s0->unk3C = NULL; } @@ -278,14 +280,14 @@ void func_802C8C5C(Actor *actor) { if (phi_s0->unk8[1] <= phi_s0->unk50) { phi_s0->unk0 = 1; - phi_s0->unk3C = func_802EE5E0(1); + phi_s0->unk3C = dustEmitter_returnGiven(1); if (phi_s0->unk3C != 0) { - func_802EE6CC(phi_s0->unk8, sp70, phi_s0->unk40, 1, D_80366330, D_80366334, (s32)D_80366338, (s32)D_8036633C, 1); + dustEmitter_emit(phi_s0->unk8, sp70, phi_s0->unk40, 1, D_80366330, D_80366334, (s32)D_80366338, (s32)D_8036633C, DUST_EMITTER_TYPE_BREAK_DUST); } } } if (phi_s0->unk0 == 1) { - if (!func_802EE5F0(phi_s0->unk3C)) { + if (!dustEmitter_isActive(phi_s0->unk3C)) { phi_s0->unk0 = 0; } phi_s0->unk8[1] -= 2.0f; diff --git a/src/core2/code_42CB0.c b/src/core2/code_42CB0.c index 67d64480..0fcc14e7 100644 --- a/src/core2/code_42CB0.c +++ b/src/core2/code_42CB0.c @@ -152,8 +152,8 @@ void chHoneycomb_update(Actor *this){ for(i = 0; i < 4; i++){ if(randf() < 0.03){ - func_8033E73C(this->marker, i+5, func_80329904); - func_8033E3F0(8, this->marker->unk14_21); + commonParticle_add(this->marker, i+5, func_80329904); + commonParticle_new(8, this->marker->unk14_21); } } } diff --git a/src/core2/code_43250.c b/src/core2/code_43250.c index 74fe715b..b7b8e3e9 100644 --- a/src/core2/code_43250.c +++ b/src/core2/code_43250.c @@ -165,7 +165,7 @@ void func_802CA1E0(Actor *this){ phi_a0 = tmp_v0->unk0; tmp_f4 = tmp_v0->unk2*0.0078125; phi_a2 = tmp_v0->unk3*128.0; - func_8030E6A4(phi_a0, tmp_f4, phi_a2); + gcsfx_playWithPitch(phi_a0, tmp_f4, phi_a2); reinterpret_cast(s32, this->unkBC[0])++; if(reinterpret_cast(s32, this->unkBC[0]) == reinterpret_cast(s32, this->unkBC[4])) this->unk154 = 0; diff --git a/src/core2/code_43A40.c b/src/core2/code_43A40.c index ae95f12c..5777c4fe 100644 --- a/src/core2/code_43A40.c +++ b/src/core2/code_43A40.c @@ -94,7 +94,7 @@ void chFightFlightPad_update(Actor *this){ if(!this->volatile_initialized){ this->volatile_initialized = TRUE; chFightFlightPad_emitSparklesAtPosition(this->position); - FUNC_8030E8B4(SFX_113_PAD_APPEARS, 1.0f, 32000, this->position, 5000, 12000); + sfx_playFadeShorthandDefault(SFX_113_PAD_APPEARS, 1.0f, 32000, this->position, 5000, 12000); } this->marker->propPtr->unk8_3 = TRUE; this->alpha_124_19 = MIN(this->alpha_124_19 + this->unk38_31, 0xFF); diff --git a/src/core2/code_45310.c b/src/core2/code_45310.c index 638d0ade..8e397c54 100644 --- a/src/core2/code_45310.c +++ b/src/core2/code_45310.c @@ -271,7 +271,7 @@ void func_802CCBF4(Actor *this) { local->unk0 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_playSfxAtVolume(local->unk0, 0.9f); sfxsource_setSfxId(local->unk0, 0x3FA); - func_8030DD14(local->unk0, 2); + sfxSource_setunk43_7ByIndex(local->unk0, 2); sfxsource_setSampleRate(local->unk0, 0); } @@ -355,7 +355,7 @@ void func_802CCC5C(Actor *this) { } if (phi_f12 > 0.0f) { sfxsource_setSampleRate(local->unk0, (s32) (phi_f12 * 10000.0f)); - func_8030E2C4(local->unk0); + sfxSource_func_8030E2C4(local->unk0); } } } diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index e74b72f0..c37c82d3 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -9,7 +9,7 @@ extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); extern void fileProgressFlag_set(enum file_progress_e, bool); extern void sfxsource_set_fade_distances(u8, f32, f32); extern void sfxsource_set_position(u8, f32[3]); -extern void func_8030E2C4(u8); +extern void sfxSource_func_8030E2C4(u8); extern void sfxsource_setSampleRate(u8, s32); typedef struct{ @@ -64,7 +64,7 @@ void chBeeSwarm_802CEBA8(Actor *this){ ActorLocal_core2_47BD0 *local; local = (ActorLocal_core2_47BD0 *)&this->local; - this->unk100 = NULL; + this->partnerActor = NULL; free(local->unk8); local->unk8 = NULL; @@ -245,7 +245,7 @@ void chBeeSwarm_802CF434(Actor *this) { void chBeeSwarm_802CF518(Actor *this) { if( func_803292E0(this) - && func_80329530(this, 900) + && subaddie_playerIsWithinSphereAndActive(this, 900) && player_getWaterState() == BSWATERGROUP_0_NONE && player_getTransformation() != TRANSFORM_6_BEE ) { @@ -257,7 +257,7 @@ void chBeeSwarm_802CF57C(Actor *this) { ActorLocal_core2_47BD0 *local; local = (ActorLocal_core2_47BD0 *) &this->local; - if (!func_803292E0(this) || !func_80329530(this, 900) || player_getWaterState() != BSWATERGROUP_0_NONE) { + if (!func_803292E0(this) || !subaddie_playerIsWithinSphereAndActive(this, 900) || player_getWaterState() != BSWATERGROUP_0_NONE) { subaddie_set_state(this, 5); func_802CEF54(this, local->unkC, 100.0f); } @@ -269,18 +269,18 @@ bool chBeeSwarm_802CF5E4(Actor *this){ bool out = 1; local = (ActorLocal_core2_47BD0 *) &this->local; - out = (this->unk100 != NULL) ? out = local->unk24 != this->unk100->unk5C + out = (this->partnerActor != NULL) ? out = local->unk24 != this->partnerActor->unk5C : 1; return out; } void chBeeSwarm_802CF610(Actor *this, ParticleEmitter *p_ctrl, f32 position[3]) { - func_8030E6A4(SFX_66_BIRD_AUUGHH, randf2(1.75f, 1.85f), 15000); + gcsfx_playWithPitch(SFX_66_BIRD_AUUGHH, randf2(1.75f, 1.85f), 15000); particleEmitter_setPosition(p_ctrl, position); particleEmitter_setDrawMode(p_ctrl, 2); particleEmitter_func_802EF9F8(p_ctrl, 0.5f); particleEmitter_func_802EFA18(p_ctrl, 3); - func_802EFA20(p_ctrl, 0.8f, 1.0f); + particleEmitter_func_802EFA20(p_ctrl, 0.8f, 1.0f); particleEmitter_setSfx(p_ctrl, SFX_1F_HITTING_AN_ENEMY_3, 10000); particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.01f); particleEmitter_setParticleLifeTimeRange(p_ctrl, 2.0f, 2.5f); @@ -297,7 +297,7 @@ void chBeeSwarm_802CF7CC(Actor *this) { if (D_8037DCBC == 0) { this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3FA_HONEYCOMB_TALKING); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); func_8030DD90(this->unk44_31, 2); D_8037DCBC = 1; } @@ -322,19 +322,19 @@ void chBeeSwarm_update(Actor *this) { if (!this->initialized) { this->initialized = TRUE; beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); - this->unk100 = (beehive != NULL) ? beehive->marker : NULL; + this->partnerActor = (beehive != NULL) ? beehive->marker : NULL; if(500.0f < distance_to_home){ - this->unk100 = NULL; + this->partnerActor = NULL; } sp78 = 1; local->unk18 = (f32) this->position[1]; - local->unkC[0] = ((this->unk100) ? beehive->position : this->position)[0]; - local->unkC[1] = ((this->unk100) ? beehive->position : this->position)[1]; - local->unkC[2] = ((this->unk100) ? beehive->position : this->position)[2]; + local->unkC[0] = ((this->partnerActor) ? beehive->position : this->position)[0]; + local->unkC[1] = ((this->partnerActor) ? beehive->position : this->position)[1]; + local->unkC[2] = ((this->partnerActor) ? beehive->position : this->position)[2]; local->unkC[1] += 250.0f; - local->unk0 = this->unkF4_8; + local->unk0 = this->actorTypeSpecificField; this->position[0] = local->unkC[0]; this->position[1] = local->unkC[1]; this->position[2] = local->unkC[2]; @@ -361,20 +361,20 @@ void chBeeSwarm_update(Actor *this) { if (sp78 == 0) { beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); if (beehive != NULL) { - this->unk100 = beehive->marker; + this->partnerActor = beehive->marker; } else { - this->unk100 = NULL; + this->partnerActor = NULL; } if (distance_to_home > 500.0f) { - this->unk100 = NULL; + this->partnerActor = NULL; } } - local->unk24 = (this->unk100 != NULL) ? this->unk100->unk5C : 0; + local->unk24 = (this->partnerActor != NULL) ? this->partnerActor->unk5C : 0; local->unk5 = 1; - if (this->unk100 != NULL) { + if (this->partnerActor != NULL) { fileProgressFlag_set(FILEPROG_D_BEEHIVE_TEXT, TRUE); } - subaddie_set_state(this, (this->unk100 != NULL) ? 1 : 2); + subaddie_set_state(this, (this->partnerActor != NULL) ? 1 : 2); this->lifetime_value = 0.0f; chBeeSwarm_802CF040(this); this->unk38_0 = volatileFlag_get(VOLATILE_FLAG_1) | volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE); @@ -447,7 +447,7 @@ void chBeeSwarm_update(Actor *this) { if (!fileProgressFlag_get(FILEPROG_8F_MET_BEE_INFESTED_BEEHIVE) && subaddie_playerIsWithinCylinder(this, 250, 300) && ((player_movementGroup() == BSGROUP_0_NONE) || (player_movementGroup() == BSGROUP_8_TROT)) && (player_getTransformation() == TRANSFORM_1_BANJO) - && (gcdialog_showText(0xDA6, 0, NULL, NULL, NULL, NULL) != 0) + && (gcdialog_showDialog(0xDA6, 0, NULL, NULL, NULL, NULL) != 0) ) { fileProgressFlag_set(FILEPROG_8F_MET_BEE_INFESTED_BEEHIVE, TRUE); } @@ -480,7 +480,7 @@ void chBeeSwarm_update(Actor *this) { spB4[1] += 50.0f; this->lifetime_value += dt; if ((this->lifetime_value - 0.5 > 0.0) && (local->unk0 > 0) && (player_movementGroup() != BSGROUP_3_WONDERWING)) { - func_8028F504(0xD); + player_checkHazardInterrupt(0xD); this->lifetime_value -= 0.5; } if ((this->lifetime_value > 0.2) && (player_movementGroup() == BSGROUP_3_WONDERWING)) { @@ -533,7 +533,7 @@ void chBeeSwarm_update(Actor *this) { chBeeSwarm_802CF434(this); } local->unk5 = 0; - if ((local->unk0 > 0) && func_80329530(this, 1500) && !this->unk38_0) { + if ((local->unk0 > 0) && subaddie_playerIsWithinSphereAndActive(this, 1500) && !this->unk38_0) { if (this->unk44_31 == 0) { chBeeSwarm_802CF7CC(this); } @@ -545,7 +545,7 @@ void chBeeSwarm_update(Actor *this) { ); sfxsource_set_fade_distances(this->unk44_31, 500.0f, 1500.0f); sfxsource_set_position(this->unk44_31, this->position); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); sfxsource_setSampleRate(this->unk44_31, (s32)(((gu_sqrtf(this->velocity[0] * this->velocity[0] + this->velocity[1] * this->velocity[1] + this->velocity[2] * this->velocity[2]) / this->actor_specific_1_f) * 8000.0f) + 2000.0f)); } } diff --git a/src/core2/code_4A6F0.c b/src/core2/code_4A6F0.c index 2452d87f..f4a931c8 100644 --- a/src/core2/code_4A6F0.c +++ b/src/core2/code_4A6F0.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); +#include "core2/dustemitter.h" + extern void func_803255FC(Actor *); extern void func_80325760(Actor *); @@ -143,12 +144,12 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 this = marker_getActor(caller); switch(text_id){ case ASSET_D8F_DIALOG_MUMBO_MEET: //L802D1A04 - gcdialog_showText((this->unk38_0) ? ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS : ASSET_DAB_DIALOG_MUMBO_NOT_ENOUGH_TOKENS, 0xe, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog((this->unk38_0) ? ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS : ASSET_DAB_DIALOG_MUMBO_NOT_ENOUGH_TOKENS, 0xe, this->position, this->marker, __chMumbo_textCallback, NULL); return; case ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR: //L802D1A40 fileProgressFlag_set(FILEPROG_12_HAS_TRANSFORMED_BEFORE, TRUE); - gcdialog_showText(ASSET_D8F_DIALOG_MUMBO_MEET + D_8037DDF0, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_D8F_DIALOG_MUMBO_MEET + D_8037DDF0, 4, NULL, NULL, NULL, NULL); gcpausemenu_80314AC8(1); break; @@ -161,7 +162,7 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 case ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE: //L802D1A98 this->has_met_before = FALSE; if(this->unk38_31 != 0){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); item_adjustByDiffWithHud(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); this->unk38_31 = 0; } @@ -174,7 +175,7 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 D_8037DDF0 = this->unk10_12; this->unk10_12 = 1; if(this->unk38_31){ - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); item_adjustByDiffWithHud(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); } @@ -191,16 +192,16 @@ static void __chMumbo_textCallback(ActorMarker *caller, enum asset_e text_id, s3 void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { if (this->unk10_12 != 0) { - gcdialog_showText(fileProgressFlag_getN(FILEPROG_BB_MUMBO_MISTAKE_INDEX, 2) + ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(fileProgressFlag_getN(FILEPROG_BB_MUMBO_MISTAKE_INDEX, 2) + ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); return; } if (fileProgressFlag_get(FILEPROG_12_HAS_TRANSFORMED_BEFORE)) { if (this->velocity[0] == 0.0f) { - gcdialog_showText(transform_id + ASSET_D8F_DIALOG_MUMBO_MEET, 6, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(transform_id + ASSET_D8F_DIALOG_MUMBO_MEET, 6, this->position, this->marker, __chMumbo_textCallback, NULL); return; } if (map_get() == MAP_7A_GL_CRYPT && transform_id == TRANSFORM_3_PUMPKIN && !fileProgressFlag_get(FILEPROG_F7_HAS_TRANSFORMED_IN_CRYPT)) { - gcdialog_showText(ASSET_DAD_DIALOG_MUMBO_XFORM_IN_CRYPT, 6, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_DAD_DIALOG_MUMBO_XFORM_IN_CRYPT, 6, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_F7_HAS_TRANSFORMED_IN_CRYPT, TRUE); return; } @@ -208,7 +209,7 @@ void chMumbo_func_802D1B8C(Actor *this, enum transformation_e transform_id) { subaddie_set_state(this, 4U); return; } - gcdialog_showText(ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); } void chMumbo_update(Actor *this) { @@ -281,7 +282,7 @@ void chMumbo_update(Actor *this) { && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE) ) { subaddie_set_state(this, 3); - gcdialog_showText(ASSET_D8F_DIALOG_MUMBO_MEET, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_D8F_DIALOG_MUMBO_MEET, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_11_HAS_MET_MUMBO, TRUE); break; } @@ -292,7 +293,7 @@ void chMumbo_update(Actor *this) { && this->unk38_0 ){ subaddie_set_state(this, 3); - gcdialog_showText(ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_DAA_DIALOG_MUMBO_HAS_ENOUGH_TOKENS, 0xE, this->position, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_DC_HAS_HAD_ENOUGH_TOKENS_BEFORE, TRUE); break; } @@ -330,7 +331,7 @@ void chMumbo_update(Actor *this) { && randf() < 0.01 && sp48 ) { - gcdialog_showText(ASSET_DAE_DIALOG_MUMBO_TREX_START, 6, NULL, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_DAE_DIALOG_MUMBO_TREX_START, 6, NULL, this->marker, __chMumbo_textCallback, NULL); fileProgressFlag_set(FILEPROG_BA_HAS_SEEN_TREX_TEXT, 1); this->has_met_before = TRUE; subaddie_set_state(this, 3); @@ -349,7 +350,7 @@ void chMumbo_update(Actor *this) { subaddie_set_state(this, 5); } else { if (this->unk38_31) { - func_8025A6EC(SFX_2B_BULL_MOO_1, 28000); + coMusicPlayer_playMusic(SFX_2B_BULL_MOO_1, 28000); item_adjustByDiffWithHud(ITEM_1C_MUMBO_TOKEN, -this->unk38_31); } subaddie_set_state(this, 5); @@ -358,8 +359,8 @@ void chMumbo_update(Actor *this) { break; } - func_8025A6EC(COMUSIC_2C_BUZZER, 22000); - if ((levelSpecificFlags_get(LEVEL_FLAG_3E_UNKNOWN) == FALSE) && (gcdialog_showText(ASSET_DAC_DIALOG_MUMBO_FAIL_TO_BUY, 0, NULL, NULL, NULL, NULL) != 0)) { + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 22000); + if ((levelSpecificFlags_get(LEVEL_FLAG_3E_UNKNOWN) == FALSE) && (gcdialog_showDialog(ASSET_DAC_DIALOG_MUMBO_FAIL_TO_BUY, 0, NULL, NULL, NULL, NULL) != 0)) { levelSpecificFlags_set(LEVEL_FLAG_3E_UNKNOWN, 1); } } @@ -369,10 +370,10 @@ void chMumbo_update(Actor *this) { case 5: //L802D2488 actor_playAnimationOnce(this); if (actor_animationIsAt(this, 0.35f)){ - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } if (actor_animationIsAt(this, 0.56f)) { - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); } if (actor_animationIsAt(this, 0.57f)) { func_8030E6D4(1); @@ -417,7 +418,7 @@ void chMumbo_update(Actor *this) { } if (this->has_met_before) { subaddie_set_state(this, 3); - gcdialog_showText(ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 6, NULL, this->marker, __chMumbo_textCallback, NULL); + gcdialog_showDialog(ASSET_DAF_DIALOG_MUMBO_TREX_MISTAKE, 6, NULL, this->marker, __chMumbo_textCallback, NULL); break; } gcpausemenu_80314AC8(1); @@ -434,7 +435,7 @@ void chMumbo_update(Actor *this) { sp48 = chMumbo_withinHorzDistToPlayer(0, -0x6B, 0xBC); } if (sp48 != 0) { - gcdialog_showText(ASSET_DA7_DIALOG_MUMBO_CCW_SUMMER, 7, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_DA7_DIALOG_MUMBO_CCW_SUMMER, 7, NULL, NULL, NULL, NULL); volatileFlag_set(VOLATILE_FLAG_11, TRUE); } } @@ -450,7 +451,7 @@ void chMumbo_update(Actor *this) { sp48 = chMumbo_withinHorzDistToPlayer(0, -0x6B, 0xBC); } if (sp48 != 0) { - gcdialog_showText(ASSET_DA8_DIALOG_MUMBO_CCW_AUTUMN, 7, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_DA8_DIALOG_MUMBO_CCW_AUTUMN, 7, NULL, NULL, NULL, NULL); volatileFlag_set(VOLATILE_FLAG_12, TRUE); } } @@ -495,7 +496,7 @@ Actor *chMumbo_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { || actor_animationIsAt(out, 0.36f) ){ func_8034A174(func_80329934(), 9, sp44); - func_802EE6CC(sp44, sp38, D_8036751C, 0, 0.9f, 0.0f, 0x46, 0x14, 0); + dustEmitter_emit(sp44, sp38, D_8036751C, 0, 0.9f, 0.0f, 0x46, 0x14, DUST_EMITTER_TYPE_DUST); } } return out; @@ -511,7 +512,7 @@ void chMumbo_detransformWarn(NodeProp *arg0, ActorMarker *arg1){ if(D_8037DDF3) return; - gcdialog_showText(fileProgressFlag_getAndSet(FILEPROG_83_MAGIC_GET_WEAK_TEXT, TRUE) ? ASSET_F5C_DIALOG_MUMBO_MAGIC_GET_WEAK_ABREV : ASSET_F5B_DIALOG_MUMBO_MAGIC_GET_WEAK_FULL, 0xe, NULL, NULL, NULL, NULL); + gcdialog_showDialog(fileProgressFlag_getAndSet(FILEPROG_83_MAGIC_GET_WEAK_TEXT, TRUE) ? ASSET_F5C_DIALOG_MUMBO_MAGIC_GET_WEAK_ABREV : ASSET_F5B_DIALOG_MUMBO_MAGIC_GET_WEAK_FULL, 0xe, NULL, NULL, NULL, NULL); } void chMumbo_detransformTrigger(NodeProp *arg0, ActorMarker *arg1){ @@ -519,7 +520,7 @@ void chMumbo_detransformTrigger(NodeProp *arg0, ActorMarker *arg1){ xform = player_getTransformation(); if(xform == TRANSFORM_1_BANJO || xform == TRANSFORM_7_WISHWASHY || D_8037DDF1) return; - gcdialog_showText(fileProgressFlag_getAndSet(FILEPROG_84_MAGIC_ALL_GONE_TEXT, TRUE) ? ASSET_F5E_DIALOG_MUMBO_MAGIC_RUN_OUT_ABREV: ASSET_F5D_DIALOG_MUMBO_MAGIC_RUN_OUT_FULL, 0xe, NULL, NULL, NULL, NULL); + gcdialog_showDialog(fileProgressFlag_getAndSet(FILEPROG_84_MAGIC_ALL_GONE_TEXT, TRUE) ? ASSET_F5E_DIALOG_MUMBO_MAGIC_RUN_OUT_ABREV: ASSET_F5D_DIALOG_MUMBO_MAGIC_RUN_OUT_FULL, 0xe, NULL, NULL, NULL, NULL); D_8037DDF1++; func_8028FB88(TRANSFORM_1_BANJO); } diff --git a/src/core2/code_4BE10.c b/src/core2/code_4BE10.c index f81a48fc..7a58ba2f 100644 --- a/src/core2/code_4BE10.c +++ b/src/core2/code_4BE10.c @@ -32,7 +32,7 @@ void func_802D2DA0(Actor *this) { pCtrl = partEmitMgr_newEmitter((s32) this->lifetime_value); for(phi_s6 = 0; phi_s6 < (s32)this->lifetime_value; phi_s6++){ for(i = 0; i < 3; i++){ - sp70[i] = this->position[i] + randf()*2*this->unkF4_8 - ((i == 1)? 0: this->unkF4_8); + sp70[i] = this->position[i] + randf()*2*this->actorTypeSpecificField - ((i == 1)? 0: this->actorTypeSpecificField); } particleEmitter_setSprite(pCtrl, ASSET_710_SPRITE_SPARKLE_PURPLE); particleEmitter_setStartingFrameRange(pCtrl, 0, 0); diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 38bdd59a..cdb855ac 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -3,11 +3,12 @@ #include "functions.h" #include "variables.h" +#include "core2/dustemitter.h" + extern void func_8025A788(enum comusic_e, f32, f32); extern void func_8031CC40(enum map_e, s32); extern void fxRipple_802F363C(f32); extern void func_802F9D38(s32); -extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_802EE2E8(Actor *arg0, s32 arg1, s32 cnt, s32 arg3, f32 arg4, f32 arg5, f32 arg6); extern void gcquiz_func_80319EA4(void); extern void fileProgressFlag_set(enum file_progress_e, bool); @@ -101,7 +102,7 @@ s16 D_803679B0[] = { FILEPROG_90_PAID_TERMITE_COST, FILEPROG_A_HONEYCOMB_TEXT, FILEPROG_93_PAID_CROC_COST, - FILEPROG_F_HAS_TOUCHED_PIRAHANA_WATER, + FILEPROG_F_HAS_TOUCHED_PIRANHA_WATER, FILEPROG_92_PAID_WALRUS_COST, FILEPROG_14_HAS_TOUCHED_FP_ICY_WATER, FILEPROG_91_PAID_PUMPKIN_COST, @@ -142,7 +143,7 @@ void func_802D2FB0(Actor *this, s32 arg1, s32 arg2, s32 arg3, f32 arg4, s32 arg5 spA4[1] = randf2(4.0f, 10.0f); spA4[0] = randf2(-8.0f, 8.0f); spA4[2] = randf2(-8.0f, 8.0f); - func_802EE6CC(sp98, spA4, D_803679A0, 1, arg4, 50.0f, arg5, randi2(arg6, arg7), 0); + dustEmitter_emit(sp98, spA4, D_803679A0, 1, arg4, 50.0f, arg5, randi2(arg6, arg7), DUST_EMITTER_TYPE_DUST); } } @@ -169,7 +170,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0x9F: case 0xA0: case 0xFF: - func_8030E540(SFX_82_METAL_BREAK); + gcsfx_play(SFX_82_METAL_BREAK); subaddie_set_state(sp2C, 4); break; @@ -183,28 +184,28 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case MARKER_109_BREAKABLE_BRICK_WALL: func_8030E6D4(SFX_114_BRICKWALL_BREAKING); - sfxsource_play(SFX_11_WOOD_BREAKING_1, 28000); + gcsfx_playAtSampleRate(SFX_11_WOOD_BREAKING_1, 28000); subaddie_set_state_looped(sp2C, 9); - fileProgressFlag_set((sp2C->unkF4_8 == 1) ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN, TRUE); + fileProgressFlag_set((sp2C->actorTypeSpecificField == 1) ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN, TRUE); break; case 0x107: - func_8030E540(SFX_82_METAL_BREAK); + gcsfx_play(SFX_82_METAL_BREAK); func_802EE278(sp2C, 0xE, 0xF, 0x46, 0.8f, 0.7f); marker_despawn(arg0); break; case MARKER_224_BREAKABLE_FLOOR_COBWEB: comusic_playTrack(COMUSIC_2B_DING_B); - func_8030E6A4(SFX_129_SWOOSH, (sp2C->scale < 0.45) ? 1.0 : 0.8, 0x7FF8); + gcsfx_playWithPitch(SFX_129_SWOOSH, (sp2C->scale < 0.45) ? 1.0 : 0.8, 0x7FF8); subaddie_set_state_looped(sp2C, 0xC); func_802D2FB0(sp2C, 8, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); - fileProgressFlag_set((sp2C->unkF4_8== 1) ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN, 1); + fileProgressFlag_set((sp2C->actorTypeSpecificField== 1) ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN, 1); break; case MARKER_225_BREAKABLE_WALL_COBWEB: comusic_playTrack(COMUSIC_2B_DING_B); - func_8030E540(SFX_129_SWOOSH); + gcsfx_play(SFX_129_SWOOSH); subaddie_set_state_looped(sp2C, 0xF); func_802D2FB0(sp2C, 0xE, -0x3C, 0xC8, 2.0f, 0xFA, 0x3C, 0x64); fileProgressFlag_set(FILEPROG_CA_COBWEB_BLOCKING_PURPLE_CAULDRON_BROKEN, 1); @@ -234,8 +235,8 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { levelSpecificFlags_set(LEVEL_FLAG_38_CCW_UNKNOWN, 1); } func_802D2FB0(sp2C, 5, -0x28, 0xC8, 0.85f, 0xDC, 0x3C, 0x64); - func_8030E540(SFX_D_EGGSHELL_BREAKING); - func_8030E540(SFX_11_WOOD_BREAKING_1); + gcsfx_play(SFX_D_EGGSHELL_BREAKING); + gcsfx_play(SFX_11_WOOD_BREAKING_1); switch (arg0->id) { case 0x9E: func_802EE278(sp2C, 0xD, 9, 0x82, 0.34f, 1.0f); @@ -270,28 +271,28 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { break; case 0x11F: - func_8030E540(SFX_D9_WOODEN_CRATE_BREAKING_1); + gcsfx_play(SFX_D9_WOODEN_CRATE_BREAKING_1); func_802EE2E8(sp2C, 7, 9, 0x78, 0.43f, 1.3f, 3.0f); func_802EE2E8(sp2C, 3, 6, 0x78, 0.43f, 1.3f, 3.0f); func_802D317C(arg0, FILEPROG_C5_RAREWARE_BOX_BROKEN); break; case 0x11A: - func_8030E540(SFX_82_METAL_BREAK); + gcsfx_play(SFX_82_METAL_BREAK); func_802EE278(sp2C, 0xE, 0xD, 0x32, 0.8f, 0.9f); func_802EE278(sp2C, 0xE, 0xD, 0xAA, 0.8f, 0.9f); func_802D317C(arg0, FILEPROG_C2_GRATE_TO_RBB_PUZZLE_OPEN); break; case 0x118: - func_8030E540(SFX_82_METAL_BREAK); + gcsfx_play(SFX_82_METAL_BREAK); func_802EE278(sp2C, 0xE, 0xD, 0x50, 1.2f, 0.9f); func_802EE278(sp2C, 0xE, 0xD, 0xB4, 1.2f, 0.9f); func_802D317C(arg0, FILEPROG_CD_GRATE_TO_WATER_SWITCH_3_OPEN); break; case 0x119: - func_8030E540(SFX_82_METAL_BREAK); + gcsfx_play(SFX_82_METAL_BREAK); func_802EE278(sp2C, 0xE, 9, 0x50, 1.2f, 0.9f); func_802EE278(sp2C, 0xE, 9, 0xAA, 1.2f, 0.9f); func_802EE278(sp2C, 0xE, 9, 0x104, 1.2f, 0.9f); @@ -300,8 +301,8 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0x22D: case 0x22E: - func_8030E540(SFX_82_METAL_BREAK); - func_8030E540(SFX_B6_GLASS_BREAKING_1); + gcsfx_play(SFX_82_METAL_BREAK); + gcsfx_play(SFX_B6_GLASS_BREAKING_1); func_802EE278(sp2C, 4, 0x23, 0x1E, 0.7f, 0.6f); marker_despawn(arg0); break; @@ -314,7 +315,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0x237: case 0x238: case 0x239: - func_8030E540(SFX_13A_GLASS_BREAKING_7); + gcsfx_play(SFX_13A_GLASS_BREAKING_7); func_802EE278(sp2C, 4, 0x2D, 0x82, 1.0f, 1.0f); if (arg0->id == 0x1F3) { func_802EE278(sp2C, 4, 0x2D, 0x104, 1.0f, 1.0f); @@ -323,7 +324,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { break; case 0x11E: - func_8030E540(SFX_B6_GLASS_BREAKING_1); + gcsfx_play(SFX_B6_GLASS_BREAKING_1); func_802EE278(sp2C, 4, 0x32, 0x50, 1.0f, 1.4f); func_802EE278(sp2C, 4, 0x32, 0xA0, 1.0f, 1.4f); func_802EE278(sp2C, 4, 0x1E, 0xF0, 0.8f, 1.1f); @@ -331,7 +332,7 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { break; case MARKER_121_GLASS_EYE: - func_8030E540(SFX_B6_GLASS_BREAKING_1); + gcsfx_play(SFX_B6_GLASS_BREAKING_1); func_802EE2E8(sp2C, 1, 0x32, 0x14, 1.2f, 1.4f, 2.2f); func_802EE2E8(sp2C, 1, 0x3C, 0x64, 1.6f, 1.8f, 2.2f); func_802EE2E8(sp2C, 1, 0x32, 0xB4, 1.2f, 1.4f, 2.2f); @@ -341,14 +342,14 @@ void func_802D31AC(ActorMarker *arg0, ActorMarker * arg1) { case 0x164: case 0x165: if (sp2C->unk1C[1] == sp2C->position[1]) { - sfxsource_play(SFX_9B_BOULDER_BREAKING_1, 25000); + gcsfx_playAtSampleRate(SFX_9B_BOULDER_BREAKING_1, 25000); sp2C->unk1C[0] = 1.0f; } break; default: - func_8030E540(SFX_D_EGGSHELL_BREAKING); - func_8030E540(SFX_11_WOOD_BREAKING_1); + gcsfx_play(SFX_D_EGGSHELL_BREAKING); + gcsfx_play(SFX_11_WOOD_BREAKING_1); marker_despawn(arg0); break; } @@ -410,7 +411,7 @@ Actor *func_802D3F48(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ s32 i; this = marker_getActor(marker); - phi_s2 = this->unkF4_8; + phi_s2 = this->actorTypeSpecificField; for(i = 0; i < 9; i++){ func_8033A45C(i + 1, i+1 == phi_s2); } @@ -460,7 +461,7 @@ void func_802D3FD4(Actor *this){ return; }//L802D4134 - this->yaw += (this->unkF4_8 & 1) ? -1.4 : 1.4; + this->yaw += (this->actorTypeSpecificField & 1) ? -1.4 : 1.4; if(this->yaw < 0.0f){ this->yaw += 360.0f; } @@ -475,7 +476,7 @@ Actor *func_802D41C4(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ s32 i; this = marker_getActor(marker); - sp2C = this->unkF4_8; + sp2C = this->actorTypeSpecificField; for(i = 0; i < 6; i++){ func_8033A45C(i+1, FALSE); } @@ -503,7 +504,7 @@ void func_802D4250(Actor *this){ bool func_802D42F8(Actor *this) { s32 i; - for(i = 0; D_803679B0[i] != -1 && this->unkF4_8 != D_803679B0[i]; i+=2){ + for(i = 0; D_803679B0[i] != -1 && this->actorTypeSpecificField != D_803679B0[i]; i+=2){ } if (D_803679B0[i] == -1) { @@ -517,7 +518,7 @@ bool func_802D42F8(Actor *this) { void func_802D4388(Actor *this){ func_802D3CE8(this); - this->unk38_0 = BOOL(map_get() == MAP_7A_GL_CRYPT || item_getCount(ITEM_1C_MUMBO_TOKEN) >= this->unkF4_8 || func_802D42F8(this)); + this->unk38_0 = BOOL(map_get() == MAP_7A_GL_CRYPT || item_getCount(ITEM_1C_MUMBO_TOKEN) >= this->actorTypeSpecificField || func_802D42F8(this)); mapSpecificFlags_set(0x1F, (func_8028F20C() && func_8028FB48(0x78000000)) || player_movementGroup() == BSGROUP_D_TRANSFORMING); switch(this->state){ case 0x12: //L802D4468 @@ -728,33 +729,33 @@ void func_802D4D3C(enum actor_e arg0, enum actor_e arg1) { if (nodeProp_findPositionFromActorId(arg1, sp5C)) { codeABC00_spawnJiggyAtLocation(arg0, sp5C); - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); if (arg0 == 0x36) { sp4C[3] = 200; sp4C[0] = sp4C[1] = sp4C[2] = 180;\ ml_vec3f_assign(sp40, 0.0f, 0.0f, 0.0f); - func_802EE6CC(sp5C, sp40, sp4C, 0, 6.0f, 200.0f, 200, 100, 0); + dustEmitter_emit(sp5C, sp40, sp4C, 0, 6.0f, 200.0f, 200, 100, DUST_EMITTER_TYPE_DUST); sp4C[3] = 230; sp4C[0] = sp4C[1] = sp4C[2] = 150; ml_vec3f_assign(sp40, 0.0f, 2.0f, 0.0f); - func_802EE6CC(sp5C, sp40, sp4C, 0, 2.0f, 90.0f, 50, 33, 0); + dustEmitter_emit(sp5C, sp40, sp4C, 0, 2.0f, 90.0f, 50, 33, DUST_EMITTER_TYPE_DUST); sp4C[3] = 150; sp4C[0] = sp4C[1] = sp4C[2] = 230; ml_vec3f_assign(sp40, -3.0f, 1.0f, 1.0f); - func_802EE6CC(sp5C, sp40, sp4C, 0, 3.5f, 130.0f, 100, 80, 0); + dustEmitter_emit(sp5C, sp40, sp4C, 0, 3.5f, 130.0f, 100, 80, DUST_EMITTER_TYPE_DUST); sp4C[3] = 200; sp4C[0] = sp4C[1] = sp4C[2] = 250; ml_vec3f_assign(sp40, -1.0f, 3.0f, -3.0f); - func_802EE6CC(sp5C, sp40, sp4C, 0, 2.4f, 40.0f, 10, 120, 0); + dustEmitter_emit(sp5C, sp40, sp4C, 0, 2.4f, 40.0f, 10, 120, DUST_EMITTER_TYPE_DUST); sp4C[3] = 130; sp4C[0] = sp4C[1] = sp4C[2] = 130; ml_vec3f_assign(sp40, 2.0f, -2.0f, 2.0f); - func_802EE6CC(sp5C, sp40, sp4C, 0, 4.7f, 180.0f, 20, 160, 0); + dustEmitter_emit(sp5C, sp40, sp4C, 0, 4.7f, 180.0f, 20, 160, DUST_EMITTER_TYPE_DUST); func_8030E6D4(SFX_1B_EXPLOSION_1); } else{ @@ -771,7 +772,7 @@ void func_802D5000(enum map_e map_id){ if(map_getLevel(map_id) != level_get()) func_802E4A70(); func_803228D8(); - func_802E4078(D_80367684, 0x65, 0); + transitionToMap(D_80367684, 0x65, 0); } void func_802D5058(enum map_e map_id, s32 arg1, bool arg2) { @@ -917,7 +918,7 @@ void func_802D5628(void){ if(D_803679EC < 2){ D_803679EC = 2; } - func_8030E6A4(SFX_2_CLAW_SWIPE, MIN(2.0,D_803679F0), 20000); + gcsfx_playWithPitch(SFX_2_CLAW_SWIPE, MIN(2.0,D_803679F0), 20000); D_803679F0 += 0.05; } } @@ -1028,25 +1029,25 @@ void func_802D5628(void){ } else{//L802D5B64 func_802D5260(); - func_802D5178(LEVEL_FLAG_1C_MM_UNKNOWN, 0x28, 0x30, MAP_69_GL_MM_LOBBY, 0x8, 0xA, ACTOR_20E_MM_ENTRANCE_DOOR, 0x28); - func_802D5178(LEVEL_FLAG_21_GV_UNKNOWN, 0x2D, 0x31, MAP_6E_GL_GV_LOBBY, 0xA, 0xA, ACTOR_226_GV_ENTRANCE, 0x12); - func_802D5178(LEVEL_FLAG_1E_CC_UNKNOWN, 0x2A, 0x32, MAP_70_GL_CC_LOBBY, 0xE, 0xA, ACTOR_212_CC_ENTRANCE_BARS, 0xA); - func_802D5178(LEVEL_FLAG_1D_TTC_UNKNOWN, 0x29, 0x33, MAP_6D_GL_TTC_LOBBY, 0x9, 0xB, ACTOR_211_TCC_ENTRANCE_CHEST_LID, 0xA); - func_802D5178(LEVEL_FLAG_1F_BGS_UNKNOWN, 0x2B, 0x34, MAP_72_GL_BGS_LOBBY, 0xB, 0xB, ACTOR_210_BGS_ENTRANCE_DOOR, 0xA); - func_802D5178(LEVEL_FLAG_23_RBB_UNKNOWN, 0x2F, 0x35, MAP_77_GL_RBB_LOBBY, 0xD, 0x5, ACTOR_20F_RBB_ENTRANCE_DOOR, 0xA); - func_802D5178(LEVEL_FLAG_22_MMM_UNKNOWN, 0x2E, 0x36, MAP_75_GL_MMM_LOBBY, 0xC, 0x6, ACTOR_228_MMM_ENTRANCE_DOOR, 0xA); - func_802D5178(LEVEL_FLAG_24_CCW_UNKNOWN, 0x30, 0x37, MAP_79_GL_CCW_LOBBY, 0xF, 0xB, ACTOR_234_CCW_ENTRANCE_DOOR, 0xA); - func_802D5178(LEVEL_FLAG_20_FP_UNKNOWN, 0x2C, 0x38, MAP_6F_GL_FP_LOBBY, 0x11, 0xA, ACTOR_235_FP_ENTANCE_DOOR, 0xA); - func_802D5178(LEVEL_FLAG_3F_LAIR_UNKNOWN, 0xE2, 0x40, MAP_93_GL_DINGPOT, 0x10, 0xA, ACTOR_2E5_DOOR_OF_GRUNTY, 0x28); + func_802D5178(LEVEL_FLAG_1C_MM_OPEN, 0x28, 0x30, MAP_69_GL_MM_LOBBY, 0x8, 0xA, ACTOR_20E_MM_ENTRANCE_DOOR, 0x28); + func_802D5178(LEVEL_FLAG_21_GV_OPEN, 0x2D, 0x31, MAP_6E_GL_GV_LOBBY, 0xA, 0xA, ACTOR_226_GV_ENTRANCE, 0x12); + func_802D5178(LEVEL_FLAG_1E_CC_OPEN, 0x2A, 0x32, MAP_70_GL_CC_LOBBY, 0xE, 0xA, ACTOR_212_CC_ENTRANCE_BARS, 0xA); + func_802D5178(LEVEL_FLAG_1D_TTC_OPEN, 0x29, 0x33, MAP_6D_GL_TTC_LOBBY, 0x9, 0xB, ACTOR_211_TCC_ENTRANCE_CHEST_LID, 0xA); + func_802D5178(LEVEL_FLAG_1F_BGS_OPEN, 0x2B, 0x34, MAP_72_GL_BGS_LOBBY, 0xB, 0xB, ACTOR_210_BGS_ENTRANCE_DOOR, 0xA); + func_802D5178(LEVEL_FLAG_23_RBB_OPEN, 0x2F, 0x35, MAP_77_GL_RBB_LOBBY, 0xD, 0x5, ACTOR_20F_RBB_ENTRANCE_DOOR, 0xA); + func_802D5178(LEVEL_FLAG_22_MMM_OPEN, 0x2E, 0x36, MAP_75_GL_MMM_LOBBY, 0xC, 0x6, ACTOR_228_MMM_ENTRANCE_DOOR, 0xA); + func_802D5178(LEVEL_FLAG_24_CCW_OPEN, 0x30, 0x37, MAP_79_GL_CCW_LOBBY, 0xF, 0xB, ACTOR_234_CCW_ENTRANCE_DOOR, 0xA); + func_802D5178(LEVEL_FLAG_20_FP_OPEN, 0x2C, 0x38, MAP_6F_GL_FP_LOBBY, 0x11, 0xA, ACTOR_235_FP_ENTANCE_DOOR, 0xA); + func_802D5178(LEVEL_FLAG_3F_LAIR_GRUNTY_DOOR_OPEN, 0xE2, 0x40, MAP_93_GL_DINGPOT, 0x10, 0xA, ACTOR_2E5_DOOR_OF_GRUNTY, 0x28); if(volatileFlag_get(VOLATILE_FLAG_18)){ if(!fileProgressFlag_get(FILEPROG_99_PAST_50_NOTE_DOOR_TEXT)){ - func_80311174(0xF75, 0xE, NULL, NULL, NULL, NULL, func_802D5140); + gcdialog_showDialogConditional(0xF75, 0xE, NULL, NULL, NULL, NULL, func_802D5140); fileProgressFlag_set(FILEPROG_99_PAST_50_NOTE_DOOR_TEXT, TRUE); volatileFlag_set(VOLATILE_FLAG_18, 0); } else{//L802D5DD8 if(!volatileFlag_get(VOLATILE_FLAG_16)){ - func_80311174(0xF77, 0x4, NULL, NULL, NULL, NULL, func_802D5140); + gcdialog_showDialogConditional(0xF77, 0x4, NULL, NULL, NULL, NULL, func_802D5140); volatileFlag_set(VOLATILE_FLAG_18, 0); } } @@ -1073,7 +1074,7 @@ void func_802D5628(void){ }//L802D5F1C if(volatileFlag_get(VOLATILE_FLAG_22)){ - if(gcdialog_showText(0xF82, 4, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(0xF82, 4, NULL, NULL, NULL, NULL)){ fileProgressFlag_set(FILEPROG_C1_BADDIES_ESCAPE_TEXT, TRUE); volatileFlag_set(VOLATILE_FLAG_22, 0); D_8037DE04 = 0.0f; @@ -1083,7 +1084,7 @@ void func_802D5628(void){ } } else{//L802D5FCC - if(gcdialog_showText(D_8037DE00, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showDialog(D_8037DE00, 0, NULL, NULL, NULL, NULL)){ D_8037DE00++; if(!(D_8037DE00 < sp4C)){ D_8037DE00 = 0xF86; @@ -1131,7 +1132,7 @@ void func_802D6114(void){ if(sp24 != 0x1C || !func_8025ADBC(COMUSIC_23_MMM_INSIDE_CHURCH)){ func_803228D8(); } - func_802E4078(sp24, sp20, 0); + transitionToMap(sp24, sp20, 0); } else{//L802D61DC func_80347A14(1); @@ -1143,7 +1144,7 @@ void func_802D61FC(enum map_e arg0){ if( map_getLevel(arg0) != map_getLevel(map_get())) func_802E4A70(); func_803228D8(); - func_802E4078(D_80367684, 0, 0); + transitionToMap(D_80367684, 0, 0); func_802D6750(); } @@ -1210,7 +1211,7 @@ void func_802D63D4(void){ func_8028F85C(sp1C); break; default: //L802D6460 - func_802BAFE4(D_80367688); + gcStaticCamera_activate(D_80367688); timedFuncQueue_update(); volatileFlag_set(VOLATILE_FLAG_BF, 0); func_802D6750(); @@ -1227,52 +1228,52 @@ void func_802D6494(void){ break; case ACTOR_20E_MM_ENTRANCE_DOOR:// L802D6510 FUNC_8030E624(SFX_6B_LOCKUP_OPENING, 0.6f, 32000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); break; case ACTOR_211_TCC_ENTRANCE_CHEST_LID:// L802D6530 FUNC_8030E624(SFX_6B_LOCKUP_OPENING, 0.6f, 32000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); break; case ACTOR_212_CC_ENTRANCE_BARS:// L802D6550 if(map_get() == MAP_70_GL_CC_LOBBY && !volatileFlag_get(VOLATILE_FLAG_7F_SANDCASTLE_OPEN_CC)){ func_802D4830(actorArray_findActorFromActorId(ACTOR_212_CC_ENTRANCE_BARS), SFX_9A_MECHANICAL_CLOSING, 0.5f); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_234_CCW_ENTRANCE_DOOR:// L802D65A0 if(map_get() == MAP_79_GL_CCW_LOBBY && !volatileFlag_get(VOLATILE_FLAG_93_SANDCASTLE_OPEN_CCW)){ func_802D485C(actorArray_findActorFromActorId(ACTOR_234_CCW_ENTRANCE_DOOR), SFX_3EC_CCW_DOOR_OPENING, 0.8f, 15000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_210_BGS_ENTRANCE_DOOR:// L802D65F8 if(!volatileFlag_get(VOLATILE_FLAG_84_SANDCASTLE_OPEN_BGS)){ FUNC_8030E624(SFX_6B_LOCKUP_OPENING, 0.6f, 32000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_235_FP_ENTANCE_DOOR:// L802D6624 if(map_get() == MAP_6F_GL_FP_LOBBY && !volatileFlag_get(VOLATILE_FLAG_8B_SANDCASTLE_OPEN_FP)){ func_802D4830(actorArray_findActorFromActorId(ACTOR_235_FP_ENTANCE_DOOR), SFX_18_BIGBUTT_SLIDE, 0.5f); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_226_GV_ENTRANCE:// L802D6674 if(map_get() == MAP_6E_GL_GV_LOBBY && !volatileFlag_get(VOLATILE_FLAG_87_SANDCASTLE_OPEN_GV)){ func_802D485C(actorArray_findActorFromActorId(ACTOR_226_GV_ENTRANCE), SFX_3EC_CCW_DOOR_OPENING, 0.8f, 15000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_228_MMM_ENTRANCE_DOOR:// L802D66CC if(!volatileFlag_get(VOLATILE_FLAG_8C_SANDCASTLE_OPEN_MMM)){ FUNC_8030E624(SFX_6B_LOCKUP_OPENING, 0.6f, 32000); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; case ACTOR_20F_RBB_ENTRANCE_DOOR:// L802D66F8 if(map_get() == MAP_77_GL_RBB_LOBBY && !volatileFlag_get(VOLATILE_FLAG_90_SANDCASTLE_OPEN_RBB)){ func_802D4830(actorArray_findActorFromActorId(ACTOR_20F_RBB_ENTRANCE_DOOR), SFX_9A_MECHANICAL_CLOSING, 0.5f); - func_8025A6CC(COMUSIC_64_WORLD_OPENING_A, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_64_WORLD_OPENING_A, 32000); } break; } diff --git a/src/core2/code_50490.c b/src/core2/code_50490.c index 9d576953..033bed4d 100644 --- a/src/core2/code_50490.c +++ b/src/core2/code_50490.c @@ -2,8 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); -extern void func_802EE5E8(void *); +#include "core2/dustemitter.h" typedef struct{ s32 unk0; @@ -18,7 +17,7 @@ f32 D_80367A84 = 30.0f; f32 D_80367A88 = 150.0f; f32 D_80367A8C = 25.0f; s32 D_80367A90[4] = {250, 250, 250, 120}; -s32 D_80367AA0 = 0; +enum dust_emitter_type_e D_80367AA0 = DUST_EMITTER_TYPE_DUST; f32 D_80367AA4[3] = {0.0f, 0.0f, 0.0f}; ActorInfo D_80367AB0 = { @@ -45,7 +44,7 @@ void func_802D7420(Actor *this){ ActorLocal_core2_50490 * local = (ActorLocal_core2_50490 *)&this->local; if(local->unk0 != NULL){ - func_802EE5E8(local->unk0); + dustEmitter_empty(local->unk0); } local->unk0 = NULL; } @@ -59,9 +58,9 @@ Actor *func_802D7484(s32 position[3], s32 yaw, ActorInfo *arg2, u32 arg3) { ActorLocal_core2_50490 * local; Actor *sp34; - sp3C = func_802EE5E0(D_80367AA0); + sp3C = dustEmitter_returnGiven(D_80367AA0); sp34 = actor_new(position, yaw, arg2, arg3); - func_802EE6CC(sp34->position, D_80367AA4, D_80367A90, 0, D_80367A80, D_80367A84, D_80367A88, D_80367A8C, D_80367AA0); + dustEmitter_emit(sp34->position, D_80367AA4, D_80367A90, 0, D_80367A80, D_80367A84, D_80367A88, D_80367A8C, D_80367AA0); local = (ActorLocal_core2_50490 *)&sp34->local; local->unk0 = sp3C; sp34->marker->collidable = FALSE; @@ -98,7 +97,7 @@ void func_802D766C(Actor *this) { marker_setFreeMethod(this->marker, func_802D7420); this->initialized = TRUE; } - if (func_802EE5F0(local->unk0) == 0) { + if (dustEmitter_isActive(local->unk0) == 0) { func_802D7420(this); marker_despawn(this->marker); } diff --git a/src/core2/code_509D0.c b/src/core2/code_509D0.c index d04dafa4..dfc32d4f 100644 --- a/src/core2/code_509D0.c +++ b/src/core2/code_509D0.c @@ -7,7 +7,7 @@ void chLevelCollectible_update(Actor *this); extern void func_80329904(ActorMarker *, s32, f32*); extern ActorMarker *func_8028E86C(void); extern void timed_mapSpecificFlags_setTrue(f32, s32); -extern void func_8035646C(s32); +extern void progressDialog_showDialogMaskFour(s32); ActorAnimationInfo D_80367B50[] = { {0, 0.0f}, @@ -90,7 +90,7 @@ s32 __chLevelCollectible_dialogCallback(ActorMarker *marker, enum asset_e text_i void __chLevelCollectible_callDialog(enum asset_e text_id){ - func_80311174(text_id, 0, NULL, NULL, NULL, NULL, __chLevelCollectible_dialogCallback); + gcdialog_showDialogConditional(text_id, 0, NULL, NULL, NULL, NULL, __chLevelCollectible_dialogCallback); } void __chLevelCollectible_collide(ActorMarker *marker, ActorMarker *other_marker) { @@ -111,34 +111,34 @@ void __chLevelCollectible_collide(ActorMarker *marker, ActorMarker *other_marker return; } - func_8035646C(FILEPROG_8_ORANGE_TEXT); + progressDialog_showDialogMaskFour(FILEPROG_8_ORANGE_TEXT); func_8030E6D4(SFX_B3_ORANGE_TALKING); dialog_id = 0; break; case MARKER_37_GOLD_BULLION: - func_8025A6EC(COMUSIC_2B_DING_B, 0x7FFF); - timedFunc_set_1(0.5f, func_8035646C, FILEPROG_9_GOLD_BULLION_TEXT); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7FFF); + timedFunc_set_1(0.5f, progressDialog_showDialogMaskFour, FILEPROG_9_GOLD_BULLION_TEXT); dialog_id = 0; break; case MARKER_1FD_BLUE_PRESENT_COLLECTIBLE: levelSpecificFlags_set(LEVEL_FLAG_2A_FP_UNKNOWN, TRUE); - func_8025A6EC(COMUSIC_2B_DING_B, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7FFF); __chLevelCollectible_presentCollectEmitSparkles(this->position, ASSET_711_SPRITE_SPARKLE_DARK_BLUE); dialog_id = ASSET_C20_DIALOG_PRESENT_COLLECTIBLE_MEET_BLUE; break; case MARKER_1FE_GREEN_PRESENT_COLLECTIBLE: levelSpecificFlags_set(LEVEL_FLAG_2B_FP_UNKNOWN, TRUE); - func_8025A6EC(COMUSIC_2B_DING_B, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7FFF); __chLevelCollectible_presentCollectEmitSparkles(this->position, ASSET_712_SPRITE_SPARKLE_GREEN); dialog_id = ASSET_C21_DIALOG_PRESENT_COLLECTIBLE_MEET_GREEN; break; case MARKER_1FF_RED_PRESENT_COLLECTIBLE: levelSpecificFlags_set(LEVEL_FLAG_2C_FP_UNKNOWN, TRUE); - func_8025A6EC(COMUSIC_2B_DING_B, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 0x7FFF); __chLevelCollectible_presentCollectEmitSparkles(this->position, ASSET_715_SPRITE_SPARKLE_RED); dialog_id = ASSET_C22_DIALOG_PRESENT_COLLECTIBLE_MEET_RED; break; @@ -207,7 +207,7 @@ void __chLevelCollectible_returnObj(Actor *this) { local = (s32*)&this->local; if( (this->marker->id != MARKER_36_ORANGE_COLLECTIBLE) - || (this->unk78_13 == 0) + || (this->secondaryId == 0) ) { this->position[0] += this->velocity[0]; this->position[1] += (this->velocity[1] -= 5.0); @@ -220,16 +220,16 @@ void __chLevelCollectible_returnObj(Actor *this) { } if (this->position[1] < sp20) { if (this->modelCacheIndex == ACTOR_2A_GOLD_BULLION) { - func_8025A6EC(COMUSIC_2B_DING_B, 32000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 32000); if (mapSpecificFlags_get(1)) { - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); } } this->position[1] = sp20; if (this->marker->id != MARKER_36_ORANGE_COLLECTIBLE) { - FUNC_8030E8B4(SFX_21_EGG_BOUNCE_1, 0.76f, 25000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_21_EGG_BOUNCE_1, 0.76f, 25000, this->position, 1000, 2000); } else { - FUNC_8030E8B4(SFX_B3_ORANGE_TALKING, 1.0f, 25000, this->position, 1000, 2000); + sfx_playFadeShorthandDefault(SFX_B3_ORANGE_TALKING, 1.0f, 25000, this->position, 1000, 2000); } if (this->state == 4) { switch (this->marker->id) { @@ -237,18 +237,18 @@ void __chLevelCollectible_returnObj(Actor *this) { break; case MARKER_36_ORANGE_COLLECTIBLE: timed_mapSpecificFlags_setTrue(1.7f, MM_SPECIFIC_FLAG_2_ORANGE_HAS_BEEN_RETURNED); - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); break; case MARKER_1FD_BLUE_PRESENT_COLLECTIBLE: - func_8025A6EC(COMUSIC_2B_DING_B, 32000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 32000); levelSpecificFlags_set(LEVEL_FLAG_11_FP_UNKNOWN, TRUE); break; case MARKER_1FE_GREEN_PRESENT_COLLECTIBLE: - func_8025A6EC(COMUSIC_2B_DING_B, 32000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 32000); levelSpecificFlags_set(LEVEL_FLAG_12_FP_UNKNOWN, TRUE); break; case MARKER_1FF_RED_PRESENT_COLLECTIBLE: - func_8025A6EC(COMUSIC_2B_DING_B, 32000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 32000); levelSpecificFlags_set(LEVEL_FLAG_13_FP_UNKNOWN, TRUE); break; } @@ -295,8 +295,8 @@ void func_802D83EC(Actor *this) { // temp_f20 = D_80376D70; for(var_s0 = 0; var_s0 < 10; var_s0++){ if (randf() < 0.03) { - func_8033E73C(this->marker, var_s0 + 5, func_80329904); - func_8033E3F0(8, this->marker->unk14_21); + commonParticle_add(this->marker, var_s0 + 5, func_80329904); + commonParticle_new(8, this->marker->unk14_21); } } this->yaw = this->yaw + time_getDelta() * 25.0f; diff --git a/src/core2/code_53A10.c b/src/core2/code_53A10.c index 33fe68f2..10c06508 100644 --- a/src/core2/code_53A10.c +++ b/src/core2/code_53A10.c @@ -78,7 +78,7 @@ void func_802DAA14(Actor *this){ tmp = ASSET_F67_DIALOG_UNKNOWN; text_id = tmp; } - gcdialog_showText(text_id, 4, NULL, this->marker, func_802DA9A0, NULL); + gcdialog_showDialog(text_id, 4, NULL, this->marker, func_802DA9A0, NULL); this->has_met_before = TRUE; } } diff --git a/src/core2/code_53C10.c b/src/core2/code_53C10.c index 8ebc0e10..eb85c0b2 100644 --- a/src/core2/code_53C10.c +++ b/src/core2/code_53C10.c @@ -35,7 +35,7 @@ void func_802DABA0(ParticleEmitter *pCtrl, f32 position[3], f32 scale, enum asse particleEmitter_setDrawMode(pCtrl, 2); particleEmitter_func_802EF9F8(pCtrl, 0.7f); particleEmitter_func_802EFA18(pCtrl, 5); - func_802EFA20(pCtrl, 0.8f, 1.0f); + particleEmitter_func_802EFA20(pCtrl, 0.8f, 1.0f); particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 6000); particleEmitter_setStartingScaleRange(pCtrl, scale, scale); particleEmitter_setSpawnIntervalRange(pCtrl, 0.0f, 0.01f); @@ -153,13 +153,13 @@ bool func_802DAFBC(Actor *this) { } void func_802DB220(Actor *this) { - if (func_80329530(this, 900) && func_803292E0(this)) { + if (subaddie_playerIsWithinSphereAndActive(this, 900) && func_803292E0(this)) { subaddie_set_state(this, 6); } } void func_802DB264(Actor *this) { - if (!func_80329530(this, 900) || !func_803292E0(this)) { + if (!subaddie_playerIsWithinSphereAndActive(this, 900) || !func_803292E0(this)) { subaddie_set_state(this, 1); } } @@ -194,10 +194,10 @@ void func_802DB3B0(Actor *this) { local = (ActorLocal_core2_53C10 *)&this->local; if (local->unkC_28 && actor_animationIsAt(this, 0.0f)) { - FUNC_8030E8B4(SFX_8_BANJO_LANDING_04, 1.8f, 8000, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_8_BANJO_LANDING_04, 1.8f, 8000, this->position, 500, 1500); } if (local->unkC_28 && actor_animationIsAt(this, 0.5f)) { - FUNC_8030E8B4(SFX_8_BANJO_LANDING_04, 1.8f, 8000, this->position, 500, 1500); + sfx_playFadeShorthandDefault(SFX_8_BANJO_LANDING_04, 1.8f, 8000, this->position, 500, 1500); } } @@ -209,7 +209,7 @@ void func_802DB440(ActorMarker *marker, ActorMarker *other_marker) { && this->actor_specific_1_f >= 3.0 && func_803294F0(this, 0x50, func_80329784(this)) ) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 20000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 20000, this->position, 1250, 2500); func_802DAE40(this); } @@ -336,7 +336,7 @@ void func_802DB5A0(Actor *this) { } } if( (this->unk10_12 == 0) - || (this->unk10_12 < local->unkC_31 && func_80329530(this, 0xFA)) + || (this->unk10_12 < local->unkC_31 && subaddie_playerIsWithinSphereAndActive(this, 0xFA)) ) { subaddie_set_state(this, 7); this->actor_specific_1_f = (f32) local->unkA; diff --git a/src/core2/code_54D50.c b/src/core2/code_54D50.c index da7f1163..e81aace5 100644 --- a/src/core2/code_54D50.c +++ b/src/core2/code_54D50.c @@ -58,7 +58,7 @@ void func_802DBCE0(ParticleEmitter *pCtrl, f32 arg1[3]){ particleEmitter_setPosition(other, arg1); particleEmitter_setParticleVelocityRange(other, -230.0f, 30.0f, -230.0f, 230.0f, 110.0f, 230.0f); func_802EFC28(other, &D_80367F60); - FUNC_8030E8B4(SFX_7_BANJO_LANDING_03, 1.0f, 22000, arg1, 1500, 4500); + sfx_playFadeShorthandDefault(SFX_7_BANJO_LANDING_03, 1.0f, 22000, arg1, 1500, 4500); }//L802DBE8C } diff --git a/src/core2/code_55390.c b/src/core2/code_55390.c index 9f970640..11a403da 100644 --- a/src/core2/code_55390.c +++ b/src/core2/code_55390.c @@ -79,7 +79,7 @@ void func_802DC4C4(void) { D_8037DE40 = actor->marker; func_8025A58C(0, 5000); func_8025AB00(); - func_8025A6EC(COMUSIC_31_GAME_OVER, -1); + coMusicPlayer_playMusic(COMUSIC_31_GAME_OVER, -1); } } diff --git a/src/core2/code_556C0.c b/src/core2/code_556C0.c index 78965da3..5b79141c 100644 --- a/src/core2/code_556C0.c +++ b/src/core2/code_556C0.c @@ -41,7 +41,7 @@ void func_802DC6E4(void) { D_8037DE50 = actor->marker; func_8025A58C(0, 5000); func_8025AB00(); - func_8025A6EC(COMUSIC_AC_GOOD_ENDING, -1); + coMusicPlayer_playMusic(COMUSIC_AC_GOOD_ENDING, -1); } } diff --git a/src/core2/code_59A80.c b/src/core2/code_59A80.c index 7dbdb014..36e7bcb5 100644 --- a/src/core2/code_59A80.c +++ b/src/core2/code_59A80.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_8035644C(s32); +extern void progressDialog_showDialogMaskZero(s32); typedef struct { enum mumbotoken_e uid; @@ -29,7 +29,7 @@ void chMumboToken_collect(ActorMarker *marker, ActorMarker *other_marker){ this = marker_getActor(marker); mumboscore_set(func_802E0CB0(this), TRUE); func_8030E760(0x401, 1.0f, 0x7fff); - timedFunc_set_1(0.75f, func_8035644C, FILEPROG_4_MUMBO_TOKEN_TEXT); + timedFunc_set_1(0.75f, progressDialog_showDialogMaskZero, FILEPROG_4_MUMBO_TOKEN_TEXT); fxSparkle_mumboToken(&marker->propPtr->x); item_inc(ITEM_1C_MUMBO_TOKEN); marker_despawn(marker); diff --git a/src/core2/code_5C240.c b/src/core2/code_5C240.c index 1e8bdc6a..758f07bc 100644 --- a/src/core2/code_5C240.c +++ b/src/core2/code_5C240.c @@ -6,7 +6,7 @@ #include "time.h" extern void func_8023DFF0(s32); -extern void comusicPlayer_update(void); +extern void coMusicPlayer_update(void); extern void func_802F1A10(void *, f32); extern void func_8033DC10(void); extern void func_8033DC18(void); @@ -73,7 +73,7 @@ void func_802E3460(s32 arg0) { if (D_8037E8C0.unk14 == 0) { D_8037E8C0.unk8 = 0xFF; D_8037E8C0.unk0 = 0.0f; - func_8025A6EC(COMUSIC_31_GAME_OVER, -1); + coMusicPlayer_playMusic(COMUSIC_31_GAME_OVER, -1); func_8033DC04(); } else if (D_8037E8C0.unk14 == 1) { @@ -103,7 +103,7 @@ void func_802E3580(void) { assetcache_release(D_8037E8C0.unkC); func_802F1884(D_8037E8C0.unk10); func_802E5F68(); - comusicPlayer_free(); + coMusicPlayer_free(); depthBuffer_stub(); viMgr_func_8024BF94(2); } @@ -158,7 +158,7 @@ void func_802E35D8(void ) { return; } } - comusicPlayer_update(); + coMusicPlayer_update(); if (D_8037E8C0.unk14 == 0) { gcbound_alpha(D_8037E8C0.unk8); } diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index fef98ff0..18c37225 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -17,7 +17,7 @@ extern void func_8034BB90(void); extern void func_8030C27C(void); extern void func_80321C34(void); extern void func_8030ED0C(void); -extern void comusicPlayer_update(void); +extern void coMusicPlayer_update(void); enum transition_e { TRANSITION_0_NONE @@ -106,7 +106,7 @@ void func_802E38E8(enum map_e map, s32 exit, s32 reset_on_load){ void func_802E398C(s32 arg0) { func_80334910(); func_8030ED0C(); - comusicPlayer_update(); + coMusicPlayer_update(); if (arg0 != 0) { func_802E3854(); } @@ -317,7 +317,7 @@ void func_802E4048(s32 map, s32 exit, s32 transition){ } //take me there -void func_802E4078(enum map_e map, s32 exit, s32 transition){ +void transitionToMap(enum map_e map, s32 exit, s32 transition){ func_802E40D0(map, exit); func_802E40E8(transition); func_802E40C4(1); @@ -369,9 +369,9 @@ void func_802E4170(void){ func_802E398C(0); func_8030AFD8(0); func_80321854(); - func_8031FBF8(); + debugScoreStates(); animCache_free(); - comusicPlayer_free(); + coMusicPlayer_free(); func_8030D8DC(); } @@ -385,7 +385,7 @@ void func_802E4214(enum map_e map_id){ savedata_init(); sns_save_and_update_global_data(); func_8030D86C(); - comusicPlayer_init(); + coMusicPlayer_init(); func_80322764(); timedFuncQueue_init(); func_802F9CD8(); @@ -404,7 +404,7 @@ void func_802E4214(enum map_e map_id){ func_80253FE8(); time_reset(); func_8033DC04(); - func_8031FBA0(); + clearScoreStates(); D_8037E8E0.game_mode = GAME_MODE_2_UNKNOWN; D_8037E8E0.unk8 = 0.0f; time_setDeltaReal_sec(0.0f); @@ -518,7 +518,7 @@ bool func_802E4424(void) { sp1C = func_80334ECC(); func_80321C34(); func_8030ED0C(); - comusicPlayer_update(); + coMusicPlayer_update(); switch (D_8037E8E0.game_mode) { case GAME_MODE_8_BOTTLES_BONUS: case GAME_MODE_A_SNS_PICTURE: @@ -587,7 +587,7 @@ s32 game_defrag(void){ glspline_defrag(); animCache_defrag(); - func_802F1320(); + pem_defragAll(); ncCameraNodeList_defrag(); modelRender_defrag(); func_8028FB68(); diff --git a/src/core2/code_66D90.c b/src/core2/code_66D90.c index cb226868..79802f1d 100644 --- a/src/core2/code_66D90.c +++ b/src/core2/code_66D90.c @@ -6,7 +6,7 @@ extern void func_802EFA34(ParticleEmitter *, f32); extern void func_802EFF5C(ParticleEmitter *, f32, f32, f32); extern void func_802EFF7C(ParticleEmitter *, f32, f32, f32); extern void func_802EFF9C(ParticleEmitter *, f32); -extern ParticleEmitter *func_802F0EF0(u8); +extern ParticleEmitter *pem_getEmitterByIndex(u8); /* .data */ s32 D_80368850[3] = {0xFF, 0xFF, 0xFE}; @@ -16,11 +16,11 @@ u8 D_803808F0; /* .code */ void func_802EDD20(void){ - func_802F1190(D_803808F0); + pem_free(D_803808F0); } void func_802EDD44(void){ - D_803808F0 = func_802F0F78(0x1e); + D_803808F0 = pem_newEmitter(0x1e); } void func_802EDD68(ParticleEmitter *caller, f32 pos[3]){ @@ -28,7 +28,7 @@ void func_802EDD68(ParticleEmitter *caller, f32 pos[3]){ } ParticleEmitter *func_802EDD8C(f32 pos[3], f32 xz_range, f32 arg2){ - ParticleEmitter *pCtrl = func_802F0EF0(D_803808F0); + ParticleEmitter *pCtrl = pem_getEmitterByIndex(D_803808F0); particleEmitter_setSprite(pCtrl, ASSET_70A_SPRITE_BUBBLE_1); particleEmitter_setDrawMode(pCtrl, 4); particleEmitter_setAlpha(pCtrl, 0xff); diff --git a/src/core2/code_67650.c b/src/core2/code_67650.c deleted file mode 100644 index dcf2599e..00000000 --- a/src/core2/code_67650.c +++ /dev/null @@ -1,88 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "core2/particle.h" - - -/* .data */ -s16 D_80368930[3] = { - ASSET_700_SPRITE_DUST, - ASSET_702_SPRITE_UNKNOWN, - ASSET_70D_SPRITE_SMOKE_1 -}; - -/* .bss */ -u8 D_80380910[3]; - -/* .code */ -s32 func_802EE5E0(s32 arg0){ - return arg0; -} - -void func_802EE5E8(ParticleEmitter *this){ - return; -} - -bool func_802EE5F0(s32 arg0){ - return (arg0 < 3) ? !particleEmitter_isDone(func_802F0EF0(D_80380910[arg0])) : FALSE; -} - -void func_802EE63C(void) { - s32 i; - - for(i = 0; i < 3; i++){ - D_80380910[i] = func_802F0F78(0x20); - } -} - -void func_802EE684(void) { - s32 i; - - for(i = 0; i < 3; i++){ - func_802F1190(D_80380910[i]); - } -} - -void func_802EE6CC(f32 position[3], f32 velocity[3], s32 color[4], s32 arg3, f32 arg4, f32 arg5, s32 arg6, s32 arg7, s32 arg8) { - s32 pad54; - s32 pad50; - s32 pad4C; - f32 sp40[3]; - s32 sp3C; - ParticleEmitter *p_ctrl; - - sp3C = 0x28; - p_ctrl = func_802F0EF0(D_80380910[arg8]); - particleEmitter_setSprite(p_ctrl, D_80368930[arg8]); - particleEmitter_setFade(p_ctrl, 0.075f, 0.4f); - particleEmitter_setPosition(p_ctrl, position); - particleEmitter_setSpawnIntervalRange(p_ctrl, 0.0f, 0.0f); - particleEmitter_func_802EFA78(p_ctrl, 1); - if (velocity != NULL) { - ml_vec3f_scale_copy(sp40, velocity, 30.0f); - } else { - sp40[0] = sp40[1] = sp40[2] = 0.0f; - } - - if (arg5 != 0.0) { - sp40[1] += arg5 / arg4; - } - particleEmitter_setParticleVelocityRange(p_ctrl, sp40[0], sp40[1], sp40[2], sp40[0], sp40[1], sp40[2]); - if (color != NULL) { - particleEmitter_setRGB(p_ctrl, color); - particleEmitter_setAlpha(p_ctrl, color[3]); - } - if (arg3 == 0) { - sp3C = PART_EMIT_NO_OPA | PART_EMIT_NO_DEPTH | PART_EMIT_NO_LOOP; - } - particleEmitter_setDrawMode(p_ctrl, sp3C); - particleEmitter_setParticleLifeTimeRange(p_ctrl, arg4, arg4); - particleEmitter_setStartingScaleRange(p_ctrl, arg6 / 175.0, arg6 / 175.0); - particleEmitter_setFinalScaleRange(p_ctrl, (arg6 + arg7) / 175.0, (arg6 + arg7) / 175.0); - if (arg8 == 0) { - particleEmitter_setParticleFramerateRange(p_ctrl, (15.0 / arg4), (15.0 / arg4)); - } else { - particleEmitter_setStartingFrameRange(p_ctrl, 0, 0xC); - } - particleEmitter_emitN(p_ctrl, 1); -} diff --git a/src/core2/code_69F60.c b/src/core2/code_69F60.c deleted file mode 100644 index 6339d6f8..00000000 --- a/src/core2/code_69F60.c +++ /dev/null @@ -1,127 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -typedef struct { - f32 unk0; - ParticleEmitter *p_emitter; - u32 unk8_31:1; - u32 capacity:10; - u32 pad8_20:21; -} Struct_Core2_69F60_0; - -void func_802F1190(u8 arg0); - -/* .bss*/ -u8 D_80380930; -Struct_Core2_69F60_0 D_80380938[16]; - -/* .code */ -ParticleEmitter *func_802F0EF0(u8 arg0){ - if(D_80380938[arg0].p_emitter == NULL){ - D_80380930 = arg0; - D_80380938[arg0].p_emitter = partEmitMgr_newEmitter(D_80380938[arg0].capacity); - particleEmitter_manualFree(D_80380938[arg0].p_emitter); - D_80380930 = 0; - } - D_80380938[arg0].unk0 = 1.0f; - return D_80380938[arg0].p_emitter; -} - -u8 func_802F0F78(s32 cnt){ - int i; - for(i = 1; i < 16; i++){ - if(D_80380938[i].unk8_31 == 0){ - D_80380938[i].unk8_31++; - D_80380938[i].p_emitter = NULL; - D_80380938[i].capacity = cnt; - return i; - } - } - return 0; -} - -void func_802F10A4(void){ - int i; - for(i = 1; i < 16; i++){ - if(D_80380938[i].unk8_31 != 0){ - func_802F1190(i); - } - } -} - -void func_802F1104(void){ - int i; - for(i = 1; i < 16; i++){ - D_80380938[i].unk8_31 = 0; - } -} - -void func_802F1190(u8 arg0){ - if(D_80380938[arg0].p_emitter){ - partEmitMgr_freeEmitter(D_80380938[arg0].p_emitter); - } - D_80380938[arg0].unk8_31 = 0; -} - -void func_802F11E8(void){ - int i; - for(i = 1; i < 16; i++){ - if( D_80380938[i].unk8_31 != 0 - && D_80380938[i].p_emitter != NULL - && particleEmitter_isDone(D_80380938[i].p_emitter) - ){ - D_80380938[i].unk0 -= time_getDelta(); - if(D_80380938[i].unk0 <= 0.0f){ - partEmitMgr_freeEmitter(D_80380938[i].p_emitter); - D_80380938[i].p_emitter = NULL; - } - } - } -} - -void func_802F1294(void){ - int i; - for(i = 1; i < 16; i++){ - if( D_80380938[i].unk8_31 != 0 - && D_80380938[i].p_emitter != NULL - && i != D_80380930 - ){ - partEmitMgr_freeEmitter(D_80380938[i].p_emitter); - D_80380938[i].p_emitter = NULL; - } - } -} - -void func_802F1320(void){ - int i; - for(i = 1; i < 16; i++){ - if( D_80380938[i].unk8_31 != 0 - && D_80380938[i].p_emitter != NULL - ){ - D_80380938[i].p_emitter = partEmitMgr_defragEmitter(D_80380938[i].p_emitter); - } - } -} - -void func_802F1388(void){ - func_802EDD20(); - fxRipple_free(); - func_802F1E80(); - fxSparkle_free(); - func_802F404C(); - func_802F422C(); - func_802EE684(); - func_802F3CB0(); -} - -void func_802F13E0(void){ - func_802EDD44(); - fxRipple_init(); - func_802F1EA4(); - fxSparkle_init(); - func_802F4070(); - func_802F4250(); - func_802EE63C(); - func_802F3CD4(); -} diff --git a/src/core2/code_6AEF0.c b/src/core2/code_6AEF0.c index 40882f14..88a45f0b 100644 --- a/src/core2/code_6AEF0.c +++ b/src/core2/code_6AEF0.c @@ -10,11 +10,11 @@ u8 D_80380A00; /* .code */ void func_802F1E80(void){ - func_802F1190(D_80380A00); + pem_free(D_80380A00); } void func_802F1EA4(void){ - D_80380A00 = func_802F0F78(0x10); + D_80380A00 = pem_newEmitter(0x10); } ParticleEmitter *func_802F1EC8(f32 *position) { @@ -22,7 +22,7 @@ ParticleEmitter *func_802F1EC8(f32 *position) { ParticleEmitter *p_emitter; - p_emitter = func_802F0EF0(D_80380A00); + p_emitter = pem_getEmitterByIndex(D_80380A00); particleEmitter_setPosition(p_emitter, position); particleEmitter_setSprite(p_emitter, ASSET_700_SPRITE_DUST); particleEmitter_setParticleVelocityRange(p_emitter, -10.0f, 10.0f, -10.0f, 10.0f, 240.0f, 10.0f); diff --git a/src/core2/code_6CD20.c b/src/core2/code_6CD20.c index d9a13b0b..b3edf8f3 100644 --- a/src/core2/code_6CD20.c +++ b/src/core2/code_6CD20.c @@ -3,7 +3,7 @@ #include "variables.h" #include "core2/particle.h" -extern ParticleEmitter *func_802F0EF0(u8); +extern ParticleEmitter *pem_getEmitterByIndex(u8); /* .data */ s16 D_80368D80[] = { @@ -23,17 +23,17 @@ u8 D_80380A70; /* .code */ void func_802F3CB0(void){ - func_802F1190(D_80380A70); + pem_free(D_80380A70); } void func_802F3CD4(void){ - D_80380A70 = func_802F0F78(0xC); + D_80380A70 = pem_newEmitter(0xC); } void func_802F3CF8(f32 arg0[3], s32 arg1, s32 arg2){ ParticleEmitter *pCtrl; if(arg2 < 3){ - pCtrl = func_802F0EF0(D_80380A70); + pCtrl = pem_getEmitterByIndex(D_80380A70); particleEmitter_setSprite(pCtrl, D_80368D80[arg2]); particleEmitter_setFade(pCtrl, 0.4f, 0.8f); particleEmitter_setPosition(pCtrl, arg0); diff --git a/src/core2/code_6CEC0.c b/src/core2/code_6CEC0.c index 4c30827b..28df752a 100644 --- a/src/core2/code_6CEC0.c +++ b/src/core2/code_6CEC0.c @@ -2,23 +2,23 @@ #include "functions.h" #include "variables.h" -extern ParticleEmitter *func_802F0EF0(u8); +extern ParticleEmitter *pem_getEmitterByIndex(u8); /* .bss */ u8 D_80380A80; /* .code */ void func_802F3E50(void){ - func_802F1190(D_80380A80); + pem_free(D_80380A80); } void func_802F3E74(void){ - D_80380A80 = func_802F0F78(0xF); + D_80380A80 = pem_newEmitter(0xF); } ParticleEmitter *func_802F3E98(f32 pos[3], enum asset_e sprite_id){ ParticleEmitter *this; - this = func_802F0EF0(D_80380A80); + this = pem_getEmitterByIndex(D_80380A80); particleEmitter_setSprite(this, sprite_id); particleEmitter_setAccelerationRange(this, diff --git a/src/core2/code_6D030.c b/src/core2/code_6D030.c index 645c8abd..8b467a3c 100644 --- a/src/core2/code_6D030.c +++ b/src/core2/code_6D030.c @@ -24,11 +24,11 @@ void func_802F3FE4(f32 pos[3]){ } void func_802F404C(void){ - func_802F1190(D_80380A90); + pem_free(D_80380A90); } void func_802F4070(void){ - D_80380A90 = func_802F0F78(0x1e); + D_80380A90 = pem_newEmitter(0x1e); } ParticleEmitter *func_802F4094(f32 pos[3], f32 arg1){ @@ -36,7 +36,7 @@ ParticleEmitter *func_802F4094(f32 pos[3], f32 arg1){ static s32 D_80368DD0[3] = {0xff, 0xff, 0xfe}; - pCtrl = func_802F0EF0(D_80380A90); + pCtrl = pem_getEmitterByIndex(D_80380A90); particleEmitter_setSprite(pCtrl, ASSET_70B_SPRITE_BUBBLE_2); particleEmitter_setAlpha(pCtrl, 180); particleEmitter_setAccelerationRange(pCtrl, diff --git a/src/core2/code_6D270.c b/src/core2/code_6D270.c index bacb45d0..6c20da04 100644 --- a/src/core2/code_6D270.c +++ b/src/core2/code_6D270.c @@ -19,11 +19,11 @@ void func_802F4200(f32 arg0[3]){ } void func_802F422C(void){ - func_802F1190(D_80380AA0); + pem_free(D_80380AA0); } void func_802F4250(void){ - D_80380AA0 = func_802F0F78(3); + D_80380AA0 = pem_newEmitter(3); } ParticleEmitter *func_802F4274(f32 arg0[3]) { @@ -45,7 +45,7 @@ ParticleEmitter *func_802F4274(f32 arg0[3]) { sp2C[0] += sp44[0]; sp2C[1] += sp44[1]; sp2C[2] += sp44[2]; - temp_v0 = func_802F0EF0(D_80380AA0); + temp_v0 = pem_getEmitterByIndex(D_80380AA0); if (sp20 != 0) { func_802EFAB0(temp_v0, sp20, sp2C[1]); } diff --git a/src/core2/code_6D490.c b/src/core2/code_6D490.c index 592fd9e1..1cb5377b 100644 --- a/src/core2/code_6D490.c +++ b/src/core2/code_6D490.c @@ -87,7 +87,7 @@ void func_802F44AC(Struct5Ds *this, enum sfx_e sfx_id, f32 arg2, f32 arg3, s32 a f0 = arg3*0.5; sfxsource_playSfxAtVolume(sfxsourceIdx, randf2(arg2 - f0, arg2 + f0)); sfxsource_setSampleRate(sfxsourceIdx, arg4); - func_8030E2C4(sfxsourceIdx); + sfxSource_func_8030E2C4(sfxsourceIdx); this->unk1E ^= 1; } @@ -109,7 +109,7 @@ void func_802F4554(Struct5Ds *this, enum sfx_e sfx_id, f32 arg2, f32 arg3, f32 a range = arg4*0.5; sfxsource_playSfxAtVolume(sp20, randf2(sp24 - range, sp24 + range)); sfxsource_setSampleRate(sp20, arg5); - func_8030E2C4(sp20); + sfxSource_func_8030E2C4(sp20); this->unk1E ^= 1; } @@ -166,11 +166,11 @@ Struct5Ds *func_802F47D0(void){ this->unk1F = 1; this->unk1C = sfxsource_createSfxsourceAndReturnIndex(); - func_8030DD14(this->unk1C, 3); + sfxSource_setunk43_7ByIndex(this->unk1C, 3); func_8030DD90(this->unk1C, 0); this->unk1D = sfxsource_createSfxsourceAndReturnIndex(); - func_8030DD14(this->unk1D, 3); + sfxSource_setunk43_7ByIndex(this->unk1D, 3); func_8030DD90(this->unk1D, 0); ml_vec3f_clear(this->unk4); diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 1112dc36..bf432132 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -544,8 +544,8 @@ void player_getVelocity(f32 dst[3]){ } f32 func_8028EF88(void){ - if(func_80294574()){ - return func_80294500(); + if(floor_isCurrentFloorunk59()){ + return floor_getCurrentFloorYPosition(); } return player_getYPosition(); } @@ -679,8 +679,8 @@ void ability_unlock(enum ability_e uid){ ability_setLearned(uid, TRUE); } -void func_8028F3D8(f32 arg0[3], f32 arg1, void(*arg2)(ActorMarker *), ActorMarker *arg3){ - bs_setState(badrone_goto(arg0, arg1, arg2, arg3)); +void player_walkToPosition(f32 position[3], f32 duration, void(*callback)(ActorMarker *), ActorMarker *arg3){ + bs_setState(badrone_goto(position, duration, callback, arg3)); } void func_8028F408(f32 arg0[3]){ @@ -711,9 +711,9 @@ bool func_8028F4B8(f32 arg0[3], f32 arg1, f32 arg2) { return bs_checkInterrupt(BS_INTR_2D) == 2; } -bool func_8028F504(s32 arg0) { +bool player_checkHazardInterrupt(s32 arg0) { func_80296CB4(arg0); - return bs_checkInterrupt(BS_INTR_1F) == 2; + return bs_checkInterrupt(BS_INTR_1F_HAZARD) == 2; } bool func_8028F530(s32 arg0) { @@ -858,7 +858,7 @@ void func_8028F974(void){ void func_8028F994(void){ D_803636B0 = 1; player_getPosition(D_803636B4); - func_802E4078(map_get(), 0, 0); + transitionToMap(map_get(), 0, 0); } void func_8028F9DC(s32 arg0){ @@ -924,7 +924,7 @@ bool func_8028FB88(enum transformation_e xform_id) { } bool func_8028FBD4(f32 arg0[3]) { - if (func_803114B0() || player_movementGroup()) { + if (gcdialog_hasCurrentTextId() || player_movementGroup()) { return FALSE; } if (arg0 != NULL) { @@ -953,9 +953,8 @@ void func_8028FCBC(void){ D_8037BFB8 = FALSE; } -//player_setModelVisibile -void func_8028FCC8(bool arg0){ - baModel_setVisible(arg0); +void player_setModelVisible(bool visible) { + baModel_setVisible(visible); } void func_8028FCE8(void) { diff --git a/src/core2/code_72B10.c b/src/core2/code_72B10.c index 8ecbb9dd..2432eb42 100644 --- a/src/core2/code_72B10.c +++ b/src/core2/code_72B10.c @@ -33,9 +33,9 @@ s32 func_802F9AA8(enum sfx_e arg0){ iPtr->unk0 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(iPtr->unk0, arg0); - func_8030DD14(iPtr->unk0, 3); + sfxSource_setunk43_7ByIndex(iPtr->unk0, 3); sfxsource_setSampleRate(iPtr->unk0, 0x64); - func_8030E2C4(iPtr->unk0); + sfxSource_func_8030E2C4(iPtr->unk0); startPtr = vector_getBegin(D_803810A0); indx = iPtr - startPtr; iPtr->unk3C = 0; @@ -85,7 +85,7 @@ void func_802F9D38(s32 arg0){ struct4Es *ptr; ptr = vector_at(D_803810A0, arg0); if(ptr->unk0){ - func_8030E394(ptr->unk0); + sfxSource_triggerCallbackByIndex(ptr->unk0); sfxsource_freeSfxsourceByIndex(ptr->unk0); ptr->unk0 = 0; } @@ -236,7 +236,7 @@ void func_802FA0F8(void){ iPtr->unk8 = (1.0f - ((iPtr->unk4 - iPtr->unkC) - iPtr->unk14)/iPtr->unk10) * (iPtr->unk3A + iPtr->unk38) / 2; } if(iPtr->unk3F && !func_8030E3FC(iPtr->unk0)){ - func_8030E2C4(iPtr->unk0); + sfxSource_func_8030E2C4(iPtr->unk0); } sfxsource_setSampleRate(iPtr->unk0, (s32)iPtr->unk8); } diff --git a/src/core2/code_73640.c b/src/core2/code_73640.c index 34a6e1fd..5fbd15bd 100644 --- a/src/core2/code_73640.c +++ b/src/core2/code_73640.c @@ -142,12 +142,12 @@ void itemPrint_update(void) { itemPrintValues[i] += (sign * _73640_MIN(time_getDelta() * _73640_MAX(diff, 8.0f), 1.0)); } if ((D_80381168[i] != 0) && ((globalTimer_getTime() & 7) == 0)) { - func_8025A6EC(D_80381168[i], 32000); + coMusicPlayer_playMusic(D_80381168[i], 32000); } if (D_80381378[i] != 0) { if ((D_80381478[i] != 0) && ((s32) diff != D_80381478[i])) { if (itemPrintValues[i] > 9.0f) { - func_8030E6A4(D_80381378[i], D_80381218[i], 0x7D00); + gcsfx_playWithPitch(D_80381378[i], D_80381218[i], 0x7D00); D_80381218[i] = _73640_MIN(D_80381218[i] + 0.1, 2.0); } } @@ -161,7 +161,7 @@ void itemPrint_update(void) { if (item_getCount(i) == (s32) (itemPrintValues[i] + 0.01)) { do{ if (D_803812C8[i] != 0) { - func_8025A6EC(D_803812C8[i], 0x7D00); + coMusicPlayer_playMusic(D_803812C8[i], 0x7D00); } D_80381378[i] = 0; diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 96ced98c..cd7a3d88 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -1806,17 +1806,18 @@ s32 func_80306EF4(s32 arg0[3], s32 arg1, u32 arg2) { return -1; } -s32 func_80307164(s32 arg0[3]) { +s32 func_80307164(s32 position[3]) { Struct_core2_7AF80_1 *phi_v1; Struct_core2_7AF80_2 *phi_a0; - for( phi_v1 = D_8036A9D4; phi_v1 < &D_8036A9D4[D_8036A9D0]; phi_v1++){ - for(phi_a0 = phi_v1->unk8; phi_a0 < &phi_v1->unk8[phi_v1->count]; phi_a0++){ - if ((SQ(arg0[0] - phi_a0->position[0]) + SQ(arg0[2] - phi_a0->position[2])) < SQ(phi_a0->radius)) { + for (phi_v1 = D_8036A9D4; phi_v1 < &D_8036A9D4[D_8036A9D0]; phi_v1++) { + for (phi_a0 = phi_v1->unk8; phi_a0 < &phi_v1->unk8[phi_v1->count]; phi_a0++) { + if ((SQ(position[0] - phi_a0->position[0]) + SQ(position[2] - phi_a0->position[2])) < SQ(phi_a0->radius)) { return phi_v1 - D_8036A9D4; } } } + return -1; } diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 68290cb7..5a1d80df 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -31,7 +31,7 @@ typedef struct { s16 sample_rate;//sample_rate u8 unk2C; u8 pad2D[3]; - void (*unk30)(u8 indx); + void (*callback)(u8 indx); f32 unk34; //volume f32 unk38; f32 unk3C; @@ -50,7 +50,7 @@ void func_8030DD90(u8, s32); void func_8030DCCC(u8, s32); void func_8030E0B4(u8, f32, f32); f32 func_8030E200(u8); -void func_8030E2C4(u8); +void sfxSource_func_8030E2C4(u8); int func_8030ED70(enum sfx_e uid); void func_8030EDAC(f32, f32); @@ -68,12 +68,12 @@ void __sfx_getPlayerPositionIfPresent(f32 arg0[3]){ ml_vec3f_clear(arg0); } -void func_8030C7D0(SfxSource *arg0, s32 arg1){ - arg0->unk43_7 = arg1; +void sfxSource_setunk43_7(SfxSource *sfxSource, s32 arg1) { + sfxSource->unk43_7 = arg1; } -s32 func_8030C7E8(SfxSource *arg0){ - return arg0->unk43_7; +s32 sfxSource_getunk43_7(SfxSource *sfxSource){ + return sfxSource->unk43_7; } void func_8030C7F8(SfxSource *arg0, s32 arg1){ @@ -354,14 +354,14 @@ void func_8030D310(u8 indx){ break; } }//L8030D434 - switch(func_8030C7E8(ptr)){ + switch(sfxSource_getunk43_7(ptr)){ case 1://L8030D468 if( func_8030C814(ptr, 0) || (func_8030C814(ptr, 1) && !ptr->unk40)) sfxsource_freeSfxsourceByIndex(indx); break; case 2://L8030D4A4 if(func_8030C814(ptr, 1) && sfxsource_isFlagCleared(ptr, 1)) - func_8030E394(indx); + sfxSource_triggerCallbackByIndex(indx); else sfxsource_clearFlag(ptr, SFX_SRC_FLAG_0_UNKOWN); break; @@ -426,9 +426,9 @@ void func_8030D6C4(enum sfx_e uid, f32 volume, s32 sampleRate, s32 arg3, s32 arg sfxsource_setSampleRate(indx, sampleRate); sfxsource_playSfxAtVolume(indx, volume); func_8030DCCC(indx, arg3); - func_8030DD14(indx, 1); + sfxSource_setunk43_7ByIndex(indx, 1); func_8030DD90(indx, arg4); - func_8030E2C4(indx); + sfxSource_func_8030E2C4(indx); } } @@ -484,7 +484,7 @@ u8 sfxsource_createSfxsourceAndReturnIndex(void){ return 0; s0 = sfxsource_at(s1); - s0->unk30 = NULL; + s0->callback = NULL; s0->sfx_uid = -1; s0->sample_rate = 22000; s0->unk2C = 0; @@ -492,7 +492,7 @@ u8 sfxsource_createSfxsourceAndReturnIndex(void){ s0->unk43_1 = 0; s0->unk34 = 1.0f; func_8030C7F8(s0, 0); - func_8030C7D0(s0, 0); + sfxSource_setunk43_7(s0, 0); sfxsource_setFlag(s0, SFX_SRC_FLAG_0_UNKOWN); sfxsource_setFlag(s0, SFX_SRC_FLAG_2_UNKOWN); sfxsource_setFlag(s0, SFX_SRC_FLAG_3_UNKOWN); @@ -512,7 +512,7 @@ u8 sfxsource_createSfxsourceAndReturnIndex(void){ void sfxsource_freeSfxsourceByIndex(u8 indx) { SfxSource *sp1C = sfxsource_at(indx); - func_8030E394(indx); + sfxSource_triggerCallbackByIndex(indx); func_8030C7F8(sp1C, 3); } @@ -589,19 +589,21 @@ void func_8030DCCC(u8 indx, s32 arg1){ } } -void func_8030DD14(u8 indx, int arg1){ - SfxSource *temp_v0; - if(indx){ - temp_v0 = sfxsource_at(indx); - func_8030C7D0(temp_v0, arg1); +void sfxSource_setunk43_7ByIndex(u8 index, int arg1) { + SfxSource *sfx_source; + + if (index) { + sfx_source = sfxsource_at(index); + sfxSource_setunk43_7(sfx_source, arg1); } } -void func_8030DD54(u8 indx, void (*arg1)(u8)){ - SfxSource *temp_v0; - if(indx){ - temp_v0 = sfxsource_at(indx); - temp_v0->unk30 = arg1; +void sfxSource_setCallbackByIndex(u8 index, void (*callback)(u8)){ + SfxSource *sfx_source; + + if (index) { + sfx_source = sfxsource_at(index); + sfx_source->callback = callback; } } @@ -736,15 +738,15 @@ enum sfx_e sfxsource_getSfxId(u8 indx){ } } -s32 func_8030E1C4(u8 indx){ - SfxSource *ptr; +s32 sfxSource_getSampleRate(u8 index) { + SfxSource *sfx_source; - if(indx == 0) + if (index == 0) { return 0; - else{ - ptr = sfxsource_at(indx); - return ptr->sample_rate; } + + sfx_source = sfxsource_at(index); + return sfx_source->sample_rate; } f32 func_8030E200(u8 indx){ @@ -780,7 +782,7 @@ bool func_8030E280(SfxSource *arg0){ return (temp_v1 > 100); } -void func_8030E2C4(u8 indx){ +void sfxSource_func_8030E2C4(u8 indx){ SfxSource *ptr; if(!indx) @@ -788,7 +790,7 @@ void func_8030E2C4(u8 indx){ ptr = sfxsource_at(indx); if(func_8030E280(ptr) || func_8030ED70(ptr->sfx_uid)){ - switch(func_8030C7E8(ptr)){ + switch(sfxSource_getunk43_7(ptr)){ case 2: sfxsource_setFlag(ptr, SFX_SRC_FLAG_0_UNKOWN); if(func_8030C814(ptr, 1)){ @@ -798,7 +800,7 @@ void func_8030E2C4(u8 indx){ default: if(func_8030C814(ptr, 1)){ - func_8030E394(indx); + sfxSource_triggerCallbackByIndex(indx); } break; } @@ -809,32 +811,38 @@ void func_8030E2C4(u8 indx){ } } -void func_8030E394(u8 indx){ - SfxSource *ptr; +void sfxSource_triggerCallbackByIndex(u8 index){ + SfxSource *sfx_source; - if(indx){ - ptr = sfxsource_at(indx); - if(func_8030C814(ptr, 1)){ - func_8030CC90(ptr); - if(ptr->unk30) - ptr->unk30(indx); - } + if (!index) { + return; + } + + sfx_source = sfxsource_at(index); + + if (!func_8030C814(sfx_source, 1)) { + return; + } + + func_8030CC90(sfx_source); + if (sfx_source->callback) { + sfx_source->callback(index); } } -int func_8030E3FC(u8 indx){ +int func_8030E3FC(u8 indx) { SfxSource *ptr; - if(!indx) + if (!indx) { return 0; - else { - ptr = sfxsource_at(indx); - return indx - && func_8030C814(ptr, 1) - && ptr->unk40 - && func_8030C8F4(ptr->unk40); } + + ptr = sfxsource_at(indx); + return indx + && func_8030C814(ptr, 1) + && ptr->unk40 + && func_8030C8F4(ptr->unk40); } void sfxsource_playHighPriority(enum sfx_e uid){ @@ -849,12 +857,12 @@ void func_8030E4E4(enum sfx_e uid){ func_8030D6C4(uid, 1.0f, 22000, 0, 0); } -void sfxsource_play(enum sfx_e uid, s32 sampleRate){ +void gcsfx_playAtSampleRate(enum sfx_e uid, s32 sampleRate){ func_8030D6C4(uid, 1.0f, sampleRate, 0, 2); } -void func_8030E540(enum sfx_e uid){ - sfxsource_play(uid, 0x7ff8); +void gcsfx_play(enum sfx_e uid){ + gcsfx_playAtSampleRate(uid, 0x7FF8); } void func_8030E560(enum sfx_e uid, s32 arg1){ @@ -878,8 +886,8 @@ void func_8030E624(u32 arg0){ func_8030D6C4(arg0 & 0x7FF, f6/1023.0, (arg0 >> 6) & 0x7fe0, 0, 2); } -void func_8030E6A4(enum sfx_e uid, f32 arg1, s32 arg2){ - func_8030D6C4(uid, arg1, arg2, 0, 2); +void gcsfx_playWithPitch(enum sfx_e uid, f32 pitch, s32 arg2){ + func_8030D6C4(uid, pitch, arg2, 0, 2); } void func_8030E6D4(enum sfx_e uid){ @@ -915,8 +923,8 @@ void sfx_play(enum sfx_e uid, f32 volume, u32 sampleRate, f32 position[3], f32 m sfxsource_playSfxAtVolume(sfxsource, volume); sfxsource_set_fade_distances(sfxsource, minFadeDistance, maxFadeDistance); sfxsource_set_position(sfxsource, position); - func_8030DD14(sfxsource, 1); - func_8030E2C4(sfxsource); + sfxSource_setunk43_7ByIndex(sfxsource, 1); + sfxSource_func_8030E2C4(sfxsource); } } } @@ -926,7 +934,7 @@ void func_8030E878(enum sfx_e id, f32 volume, u32 sampleRate, f32 position[3], f } // fadeDistance is a 32-bit value where the lower 16 bits represent minFadeDistance and the upper 16 bits represent maxFadeDistance. -void func_8030E8B4(u32 arg0, f32 position[3], u32 fadeDistance){ +void sfx_playFadeShorthand(u32 arg0, f32 position[3], u32 fadeDistance) { sfx_play( (arg0 & 0x7ff), (f32)((arg0 >> 0x15) & 0x7ff)/1023.0, ((arg0 >> 0x6) & 0x7fe0), position, (f32)(fadeDistance & 0xffff), (f32)((fadeDistance >> 0x10) & 0xffff), @@ -985,8 +993,8 @@ void func_8030EC74(enum sfx_e uid, f32 arg1, f32 arg2, u32 arg3, u32 arg4, f32 a sfxsource_setSampleRate(indx, sfx_randi2(arg3, arg4)); sfxsource_playSfxAtVolume(indx, sfx_randf2(arg1, arg2)); sfxsource_set_position(indx, arg5); - func_8030DD14(indx, 1); - func_8030E2C4(indx); + sfxSource_setunk43_7ByIndex(indx, 1); + sfxSource_func_8030E2C4(indx); } } @@ -997,7 +1005,7 @@ void func_8030ED0C(void){ u8 func_8030ED2C(enum sfx_e uid, s32 arg1){ u8 indx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(indx, uid); - func_8030DD14(indx, arg1); + sfxSource_setunk43_7ByIndex(indx, arg1); return indx; } diff --git a/src/core2/code_935F0.c b/src/core2/code_935F0.c index b1b155ea..6570cc31 100644 --- a/src/core2/code_935F0.c +++ b/src/core2/code_935F0.c @@ -139,7 +139,7 @@ void __chMinigame_setState(Actor *this, u32 arg1) { comusic_playTrack((volatileFlag_get(VOLATILE_FLAG_5_FF_MINIGAME_WON)) ? COMUSIC_3B_MINIGAME_VICTORY : COMUSIC_3C_MINIGAME_LOSS); func_802E4A70(); volatileFlag_set(VOLATILE_FLAG_21, TRUE); - timedFunc_set_3(2.0f, (GenFunction_3)func_802E4078, MAP_8E_GL_FURNACE_FUN, 1, 1); + timedFunc_set_3(2.0f, (GenFunction_3)transitionToMap, MAP_8E_GL_FURNACE_FUN, 1, 1); break; } subaddie_set_state(this, arg1); diff --git a/src/core2/code_94A20.c b/src/core2/code_94A20.c index 71847f41..d09bbd6f 100644 --- a/src/core2/code_94A20.c +++ b/src/core2/code_94A20.c @@ -350,7 +350,7 @@ BKModelBin *func_8031C5DC(struct0 *this){ return this->model; } -f32 func_8031C5E4(struct0 *this){ +f32 floor_getYPosition(struct0 *this){ return this->posY; } diff --git a/src/core2/code_956B0.c b/src/core2/code_956B0.c index e7621b1e..3734f3b5 100644 --- a/src/core2/code_956B0.c +++ b/src/core2/code_956B0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); +extern void player_walkToPosition(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); extern void func_8028F760(s32, f32, f32); extern void func_8031CE70(f32 *arg0, enum map_e arg1, s32 arg2); extern s32 fileProgressFlag_get(s32); @@ -61,7 +61,7 @@ bool cutscene_skipGameOverCutsceneCheck(void) { mapSpecificFlags_set(0xC, TRUE); func_802DC528(0, 0); timedFunc_set_2(11.0f, (GenFunction_2)func_802DC560, 0, 0); - timedFunc_set_3(12.0f, (GenFunction_3)func_802E4078, MAP_1F_CS_START_RAREWARE, 0, 1); + timedFunc_set_3(12.0f, (GenFunction_3)transitionToMap, MAP_1F_CS_START_RAREWARE, 0, 1); } else { timedFuncQueue_flush(); } @@ -81,7 +81,7 @@ void cutscenetrigger_check(s32 cs_map, s32 arg1, s32 return_map, s32 return_exit if((condFunc && condFunc()) || mapSpecificFlags_get(arg1)){ mapSpecificFlags_set(arg1, 0); - func_802E4078(return_map, (return_exit == -1)? 0: return_exit, 1); + transitionToMap(return_map, (return_exit == -1)? 0: return_exit, 1); } } @@ -133,7 +133,7 @@ void func_8031CB50(enum map_e map_id, s32 exit_id, s32 arg2) { func_802E40E8(1); func_802E40C4(0xB); } else { - func_802E4078(map_id, exit_id, 1); + transitionToMap(map_id, exit_id, 1); } func_80335110(arg2); } @@ -183,7 +183,7 @@ void func_8031CD44(enum map_e arg0, s32 arg1, f32 arg2, f32 yaw, s32 arg4) { sp30[2] = sp24[2]; ncDynamicCamera_setUpdateEnabled(0); func_8031CB50(arg0, arg1, 1); - func_8028F3D8(sp30, 1.0f, NULL, NULL); + player_walkToPosition(sp30, 1.0f, NULL, NULL); } void func_8031CE28(s32 arg0, s32 arg1, f32 arg2) { @@ -216,7 +216,7 @@ void func_8031CE70(f32 *arg0, enum map_e arg1, s32 arg2) { if (phi_s0->unk8 == 0x184) { ncDynamicCamera_setUpdateEnabled(0); func_8031CB50(arg1, arg2, 1); - func_8028F3D8(sp38, 1.0f, NULL, NULL); + player_walkToPosition(sp38, 1.0f, NULL, NULL); } else if (phi_s0->unk8 == 0x185) { func_8031CD44(arg1, arg2, sp38[1], (f32) phi_s0->yaw, phi_s0->scale); } else { @@ -536,7 +536,7 @@ void func_8031DAE0(s32 arg0, s32 arg1) { volatileFlag_set(VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED, 1); core1_7090_freeSfxSource(0); mapSpecificFlags_set(2, 1); - func_8025A6EC(COMUSIC_3B_MINIGAME_VICTORY, 0x6D60); + coMusicPlayer_playMusic(COMUSIC_3B_MINIGAME_VICTORY, 0x6D60); func_8028F918(1); timedFunc_set_2(1.8f, &func_8031DAA8, 0x1C, 1); func_802D6924(); @@ -1488,7 +1488,7 @@ void func_8031FB6C(s32 arg0, s32 arg1) { func_8031CC8C(arg0, 0x7104); } -void func_8031FBA0(void) { +void clearScoreStates(void) { bsStoredState_clear(); func_8031FFAC(); item_setItemsStartCounts(); @@ -1499,11 +1499,12 @@ void func_8031FBA0(void) { func_802D6344(); } -void func_8031FBF8(void) { +// Mostly does nothing, but it resets the selected game in the file select screen (even if it does get re-written right after) +void debugScoreStates(void) { mumboscore_debug(); honeycombscore_debug(); jiggyscore_debug(); func_803465DC(); bsStoredState_debug(); - func_802C5A48(); + gameSelect_resetGameNumber(); } diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c index 0f9eb3f6..ed45dabc 100644 --- a/src/core2/code_98CB0.c +++ b/src/core2/code_98CB0.c @@ -13,7 +13,7 @@ void volatileFlag_clear(void); void volatileFlag_set(enum volatile_flags_e index, s32 set); s32 fileProgressFlag_getN(enum file_progress_e offset, s32 numBits); void func_8031CE70(f32 *arg0, s32 arg1, s32 arg2); -void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); +void player_walkToPosition(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); struct unkfunc_80304ED0 *func_80304ED0(void*, f32 *); void func_8031CD44(s32, s32, f32, f32, s32); diff --git a/src/core2/code_9A9D0.c b/src/core2/code_9A9D0.c index 8bf8298f..d7fc093d 100644 --- a/src/core2/code_9A9D0.c +++ b/src/core2/code_9A9D0.c @@ -62,7 +62,7 @@ void func_803219F4(s32 arg0){ case 2: //L80321B28 core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); - func_8025A6EC(COMUSIC_58_WADING_BOOTS, -1); + coMusicPlayer_playMusic(COMUSIC_58_WADING_BOOTS, -1); func_8025A8B8(COMUSIC_58_WADING_BOOTS, 1); break; case 4: //L80321B60 @@ -76,14 +76,14 @@ void func_803219F4(s32 arg0){ if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){ func_8025A55C(0, 4000, 7); } - func_8025A6EC(D_80383314, -1); + coMusicPlayer_playMusic(D_80383314, -1); func_8025A8B8(D_80383314, 1); break; case 3: //L80321BDC func_803228D8(); core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); - func_8025A6EC(COMUSIC_95_BBONUS_A, -1); + coMusicPlayer_playMusic(COMUSIC_95_BBONUS_A, -1); func_8025A8B8(COMUSIC_95_BBONUS_A, 1); break; case 5: //L80321C1C diff --git a/src/core2/code_9C170.c b/src/core2/code_9C170.c index 251d4866..51041c5b 100644 --- a/src/core2/code_9C170.c +++ b/src/core2/code_9C170.c @@ -25,7 +25,7 @@ void func_80323170(void){ void func_80323190(void){ D_80383370 = sfxsource_createSfxsourceAndReturnIndex(); - func_8030DD14(D_80383370, 3); + sfxSource_setunk43_7ByIndex(D_80383370, 3); sfxsource_setSfxId(D_80383370, SFX_21_EGG_BOUNCE_1); sfxsource_setSampleRate(D_80383370, 12000); } @@ -35,7 +35,7 @@ void func_803231E8(void){ } void func_8032320C(void){ - func_8030E2C4(D_80383370); + sfxSource_func_8030E2C4(D_80383370); } void func_80323230(void){} diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index 43276886..84139508 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -5,11 +5,11 @@ #include "actor.h" #include "prop.h" +#include "core2/dustemitter.h" #define DIST_SQ_VEC3F(v1, v2) ((v1[0] - v2[0])*(v1[0] - v2[0]) + (v1[1] - v2[1])*(v1[1] - v2[1]) + (v1[2] - v2[2])*(v1[2] - v2[2])) extern void func_802D7124(Actor *, f32); -extern void func_802EE6CC(f32[3], s32[4], s32[4], s32, f32, f32, s32, s32, s32); extern void func_8033A244(f32); @@ -356,7 +356,7 @@ void func_80325F84(Actor *this){} void func_80325F8C(void) { suBaddieActorArray = NULL; D_8036E568 = func_8034A2C8(); - D_8036E56C = func_802EE5E0(0x10); + D_8036E56C = dustEmitter_returnGiven(0x10); D_8036E570 = func_802F2AEC(); D_8036E574 = 0; D_8036E578 = 0; @@ -388,7 +388,7 @@ void func_80325FE8(Actor *this) { marker->actorFreeFunc = NULL; } if ((s32)marker->unk44 < 0) { - func_8033E7CC(marker); + commonParticle_freeParticleByActorMarker(marker); func_8034A2A8(marker->unk44); marker->unk44 = 0; } @@ -427,7 +427,7 @@ void actorArray_free(void) { } func_8034A2A8(D_8036E568); D_8036E568 = NULL; - func_802EE5E8(D_8036E56C); + dustEmitter_empty(D_8036E56C); D_8036E56C = NULL; func_802F2C78(D_8036E570); D_8036E570 = NULL; @@ -596,7 +596,7 @@ void func_803268B4(void) { } } if (D_8036E56C != 0) { - func_802EE5F0(D_8036E56C); + dustEmitter_isActive(D_8036E56C); } if (D_8036E570 != 0) { func_802F2D8C(D_8036E570); @@ -783,7 +783,7 @@ Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ suLastBaddie->position_x = (f32)position[0]; suLastBaddie->position_y = (f32)position[1]; suLastBaddie->position_z = (f32)position[2]; - suLastBaddie->unkF4_8 = 0; + suLastBaddie->actorTypeSpecificField = 0; suLastBaddie->yaw = (f32) yaw; suLastBaddie->yaw_ideal = (f32) yaw; suLastBaddie->pitch = 0.0f; @@ -838,10 +838,10 @@ Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ suLastBaddie->lifetime_value = 0.0f; suLastBaddie->is_bundle = FALSE; suLastBaddie->unk104 = NULL; - suLastBaddie->unk100 = NULL; + suLastBaddie->partnerActor = NULL; suLastBaddie->unk158[0] = NULL; suLastBaddie->unk158[1] = NULL; - suLastBaddie->unk78_13 = 0; + suLastBaddie->secondaryId = 0; suLastBaddie->unk124_31 = 0; suLastBaddie->unkF4_20 = 0; suLastBaddie->sound_timer = 0.0f; @@ -1316,15 +1316,15 @@ int subaddie_maybe_set_state(Actor *this, s32 myAnimId, f32 chance){ return 0; } -void subaddie_set_state_with_direction(Actor * this, s32 myAnimId, f32 anim_start_position, s32 direction){ - if (__subaddie_set_state(this, myAnimId) && this->anctrl) { +void subaddie_set_state_with_direction(Actor * this, s32 state, f32 anim_start_position, s32 direction){ + if (__subaddie_set_state(this, state) && this->anctrl) { func_803289EC(this, anim_start_position, direction); } } -bool subaddie_maybe_set_state_position_direction(Actor *this, s32 myAnimId, f32 start_position, s32 direction, f32 probability) { +bool subaddie_maybe_set_state_position_direction(Actor *this, s32 state, f32 start_position, s32 direction, f32 probability) { if (randf() < probability) { - if (__subaddie_set_state(this, myAnimId) && this->anctrl) { + if (__subaddie_set_state(this, state) && this->anctrl) { func_803285E8(this, start_position, direction); anctrl_start(this->anctrl, "subaddie.c", 0x705); } @@ -1522,13 +1522,14 @@ bool func_803294F0(Actor *this, s32 arg1, s32 arg2){ return ((-arg1 <= v1) && (v1 <= arg1)); } -bool func_80329530(Actor *this, s32 dist){ - if( func_8028F098() - && !volatileFlag_get(VOLATILE_FLAG_BF) - && subaddie_playerIsWithinSphere(this, dist) - ){ +bool subaddie_playerIsWithinSphereAndActive(Actor *this, s32 dist) { + if (func_8028F098() + && !volatileFlag_get(VOLATILE_FLAG_BF) + && subaddie_playerIsWithinSphere(this, dist)) { + return TRUE; } + return FALSE; } @@ -1570,7 +1571,7 @@ bool func_803296D8(Actor *this, s32 dist){ return TRUE; } else{ - return func_80329530(this, dist); + return subaddie_playerIsWithinSphereAndActive(this, dist); } } @@ -1625,9 +1626,9 @@ void actor_loopAnimation(Actor *this){ anctrl_setPlaybackType(this->anctrl, ANIMCTRL_LOOP); } -s32 func_80329904(ActorMarker *arg0, s32 arg1, f32 *arg2){ - func_8034A174(arg0->unk44, arg1, arg2); - return arg0->unk14_21; +s32 func_80329904(ActorMarker *marker, s32 arg1, f32 *arg2) { + func_8034A174(marker->unk44, arg1, arg2); + return marker->unk14_21; } struct5Bs *func_80329934(void){ @@ -1648,9 +1649,9 @@ Actor *marker_getActor(ActorMarker *this){ } Actor *subaddie_getLinkedActor(Actor *this){ - if(this->unk100 == NULL) + if(this->partnerActor == NULL) return NULL; - return marker_getActor(this->unk100); + return marker_getActor(this->partnerActor); } void func_803299B4(Actor *arg0) { @@ -1746,7 +1747,7 @@ void *actors_appendToSavestate(void * begin, u32 end){ s0->volatile_initialized = FALSE; s0->unk44_31 = 0; s0->unk104 = NULL; - s0->unk100 = NULL; + s0->partnerActor = NULL; s0->unk158[0] = NULL; s0->unk158[1] = NULL; s0->unk138_19 = s1->marker->id; @@ -1799,14 +1800,14 @@ void func_8032A09C(s32 arg0, ActorListSaveState *arg1) { var_s3 = 0; var_s0 = arg1->actor_save_state; for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--) { - if ((var_s0->unk78_13 != 0) && (var_s3 < var_s0->unk78_13)) { - var_s3 = var_s0->unk78_13; + if ((var_s0->secondaryId != 0) && (var_s3 < var_s0->secondaryId)) { + var_s3 = var_s0->secondaryId; } var_s0++; } for(var_s0 = &suBaddieActorArray->data[0]; var_s0 < &suBaddieActorArray->data[suBaddieActorArray->cnt]; var_s0++){ - if ((var_s0->unk78_13 != 0) && (var_s3 < var_s0->unk78_13)) { - var_s3 = var_s0->unk78_13; + if ((var_s0->secondaryId != 0) && (var_s3 < var_s0->secondaryId)) { + var_s3 = var_s0->secondaryId; } } @@ -1823,14 +1824,14 @@ void func_8032A09C(s32 arg0, ActorListSaveState *arg1) { var_s0 = arg1->actor_save_state; for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--) { - if (var_s0->unk78_13 != 0) { - sp5C[var_s0->unk78_13] = var_s0; + if (var_s0->secondaryId != 0) { + sp5C[var_s0->secondaryId] = var_s0; } var_s0++; } for(var_s0 = &suBaddieActorArray->data[0]; var_s0 < &suBaddieActorArray->data[suBaddieActorArray->cnt]; var_s0++){ - if ((var_s0->unk78_13 != 0)) { - sp60[var_s0->unk78_13] = var_s0; + if ((var_s0->secondaryId != 0)) { + sp60[var_s0->secondaryId] = var_s0; } } @@ -1856,7 +1857,7 @@ void func_8032A09C(s32 arg0, ActorListSaveState *arg1) { var_s0 = arg1->actor_save_state; for(var_s2 = arg1->cnt; var_s2 != 0; var_s2--){ - if (var_s0->unk78_13 == 0) { + if (var_s0->secondaryId == 0) { sp50[0] = (s32) var_s0->position[0]; sp50[1] = (s32) var_s0->position[1]; sp50[2] = (s32) var_s0->position[2]; @@ -1902,8 +1903,8 @@ void func_8032A6A8(Actor *arg0) { if ((arg0->unk44_14 == var_v0->unk44_14) && (arg0 != var_v0)) { var_f2 = var_v0->unk48; if ((var_f2 <= var_f0) && (arg0->unk48 <= var_f2)) { - if (var_v0->unk78_13 != 0) { - arg0->unk124_31 = var_v0->unk78_13; + if (var_v0->secondaryId != 0) { + arg0->unk124_31 = var_v0->secondaryId; var_f0 = var_f2; } } @@ -1919,7 +1920,7 @@ Actor *func_8032A7AC(Actor *arg0) { 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->unk78_13) { + if (arg0->unk124_31 == var_a0->secondaryId) { return var_a0; } } @@ -2208,7 +2209,7 @@ void func_8032B3A0(Actor *this, ActorMarker *arg1) { sp54[0] = this->position[0]; sp54[1] = this->position[1] + func_8033229C(this->marker)*((this->unk16C_0) ? 0.5 : 1.0); sp54[2] = this->position[2]; - func_802EE6CC(sp54, 0, D_8036E5B0, !this->unk16C_0, 0.75f, 0.0f, 125, 250, 0); + dustEmitter_emit(sp54, 0, D_8036E5B0, !this->unk16C_0, 0.75f, 0.0f, 125, 250, DUST_EMITTER_TYPE_DUST); func_802F3CF8(sp54, !this->unk16C_0, (arg1->id == 1) ? 1 : (player_getTransformation() == TRANSFORM_5_CROC) ? 2 @@ -2224,7 +2225,7 @@ void func_8032B4DC(Actor *this, ActorMarker *arg1, s32 arg2) { if (arg1 != NULL) { func_8034A174(this->marker->unk44, arg2, &sp3C); - func_802EE6CC(sp3C, NULL, D_8036E5C0, !this->unk16C_0, 0.75f, 0.0f, 125, 250, 0); + dustEmitter_emit(sp3C, NULL, D_8036E5C0, !this->unk16C_0, 0.75f, 0.0f, 125, 250, DUST_EMITTER_TYPE_DUST); func_802F3CF8(sp3C, !this->unk16C_0, (arg1->id == 1) ? 1 : (player_getTransformation() == TRANSFORM_5_CROC) ? 2 @@ -2253,7 +2254,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { sp6C = func_8033D584(arg2); sp68 = func_8033D5A4(arg2); sp64 = func_8033D574(arg2); - if (((func_80297C6C() != 3) && func_8028F1E0()) || (func_8033D594(arg2) == 0)) { + if (((bsiFrame_getState() != 3) && func_8028F1E0()) || (func_8033D594(arg2) == 0)) { if (sp64 == 0) { if ((sp68 != 0) || (arg1->id == 0)) { if (sp68 <= 0) { @@ -2321,7 +2322,7 @@ void func_8032B5C0(ActorMarker *arg0, ActorMarker *arg1, struct5Cs *arg2) { marker_callCollisionFunc(arg0, arg1, sp64); } if ((sp64 != 0) && (sp6C != 0)) { - FUNC_8030E8B4(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)); + 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/code_A5BC0.c b/src/core2/code_A5BC0.c index 1b11f1b1..30e64773 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -1153,7 +1153,7 @@ ActorMarker * marker_init(s32 *pos, MarkerDrawFunc draw_func, int arg2, int mark marker->actrArrayIdx = 0; marker->unk14_10 = 0; marker->modelId = 0; - marker->unk3E_1 = 0; + marker->isBanjoOnTop = 0; marker->unk14_22 = 0; marker->unk14_21 = 0; marker->yaw = 0; @@ -1174,7 +1174,7 @@ ActorMarker * marker_init(s32 *pos, MarkerDrawFunc draw_func, int arg2, int mark marker->unk18 = 0; marker->actorUpdateFunc = NULL; marker->actorFreeFunc = NULL; - marker->unk28 = 0; + marker->commonParticleIndex = 0; marker->actorUpdate2Func = NULL; marker->unk38[0] = 0; marker->unk38[1] = 0; @@ -1222,8 +1222,8 @@ void func_8032FFD4(ActorMarker *this, s32 arg1){ this->actrArrayIdx = arg1; } -void func_8032FFEC(ActorMarker *this, s32 arg1){ - this->unk28 = arg1; +void marker_setCommonParticleIndex(ActorMarker *this, s32 index) { + this->commonParticleIndex = index; } void marker_callCollisionFunc(ActorMarker *this, ActorMarker *other, enum marker_collision_func_type_e type){ @@ -1319,8 +1319,8 @@ void func_80330208(Cube *cube) { position[2] = (s32) i_prop->z; actor = func_803055E0(i_prop->unk8, position, i_prop->yaw, i_prop->unk10_31, i_prop->unk10_19); if (actor != NULL) { - actor->unk78_13 = i_prop->unk10_31; - actor->unkF4_8 = i_prop->radius; + actor->secondaryId = i_prop->unk10_31; + actor->actorTypeSpecificField = i_prop->radius; func_8032AA58(actor, (i_prop->scale != 0) ? ((f32)i_prop->scale * 0.01) : 1.0); } } diff --git a/src/core2/code_ABC00.c b/src/core2/code_ABC00.c index 3df108c1..9c2203ea 100644 --- a/src/core2/code_ABC00.c +++ b/src/core2/code_ABC00.c @@ -247,7 +247,7 @@ void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]) { if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != JIGGY_3E_GV_GRABBA) && (jiggy_id != JIGGY_0B_TTC_JINJO)) { core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 5); - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); timedFunc_set_0(3.5f, func_80332BB0); } } diff --git a/src/core2/code_AD110.c b/src/core2/code_AD110.c index ecbb44d2..842a5f5b 100644 --- a/src/core2/code_AD110.c +++ b/src/core2/code_AD110.c @@ -66,7 +66,7 @@ extern void warp_lairEnterRBBLobbyFromRBBPuzzleRoom(s32, s32); extern void warp_lairEnterRBBLobbyFromMMMPuzzleRoom(s32, s32); extern void func_80334430(s32, s32); extern void func_80363388(s32, s32); -extern void func_80386744(s32, s32); +extern void chOrangePad_handleOrangeCollision(s32, s32); extern void func_80388BEC(s32, s32); extern void func_80388C00(s32, s32); extern void func_80388C28(s32, s32); @@ -314,8 +314,8 @@ typedef void (*CodeAD110Callback)(NodeProp *arg0, ActorMarker *arg1); /* .data */ CodeAD110Callback sWarpFunctions[] = { - func_80388BEC, func_80334430, func_80386744, func_80386744, - func_80386744, warp_gvEnterJinxy, warp_gvExitJinxy, func_8038F10C, + func_80388BEC, func_80334430, chOrangePad_handleOrangeCollision, chOrangePad_handleOrangeCollision, + chOrangePad_handleOrangeCollision, warp_gvEnterJinxy, warp_gvExitJinxy, func_8038F10C, func_8038F130, warp_bgsEnterMumbosHut, warp_bgsExitMumbosHut, warp_ttcExitNipper, warp_ttcEnterLevel, warp_ccEnterLevel, warp_bgsEnterLevel, warp_gvEnterLevel, warp_mmmEnterLevel, warp_rbbEnterLevel, warp_ccwEnterSpringWhipcrackRoom, warp_ccwEnterSummerWhipcrackRoom, diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index 03231e40..63425541 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -115,7 +115,7 @@ s32 exit_get(){ } void func_803348D8(s32 arg0) { - func_802E4078(D_803835D0.map_4, arg0, 1); + transitionToMap(D_803835D0.map_4, arg0, 1); } s32 func_80334904(){ @@ -143,15 +143,15 @@ void func_80334910(void) { func_802F53D0(); func_802FAC3C(); bundle_free(); - func_8033E184(); + commonParticle_freeAllParticles(); func_8033FA24(); func_80344C80(); animsprite_terminate(); animBinCache_free(); func_802BC10C(); ncCameraNodeList_free(); - func_802F1388(); - func_802F10A4(); + pem_freeDependencies(); + pem_freeAll(); partEmitMgr_free(); func_802F7CE0(); func_8031F9E0(); @@ -189,9 +189,9 @@ void func_80334910(void) { animCache_flushAll(); } -void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { +void func_80334B20(enum map_e map, s32 arg1, s32 arg2) { D_803835D0.unk0 = 3; - D_803835D0.map_4 = arg0; + D_803835D0.map_4 = map; D_803835D0.unk8 = arg1; overlay_init(); func_80335110(1); @@ -230,8 +230,8 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { ncCameraNodeList_init(); func_802BC044(); partEmitMgr_init(); - func_802F1104(); - func_802F13E0(); + pem_setAllInactive(); + pem_initDependencies(); func_802F7D30(); func_8030A78C(); lighting_init(); @@ -239,9 +239,9 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { func_803343D0(); cubeList_init(); func_802FA69C(); - func_8033DEA0(); + commonParticle_init(); if (arg2 == 0) { - func_80335140(arg0); + func_80335140(map); } func_80305990(0); func_8030C740(); @@ -266,7 +266,7 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { if (func_802E4A08() == 0) { func_802F5188(); } - if (arg0 != MAP_1F_CS_START_RAREWARE) { + if (map != MAP_1F_CS_START_RAREWARE) { func_8024F150(); } } @@ -291,7 +291,7 @@ void func_80334E1C(s32 arg0) { func_803225B0(D_803835D0.unk0, arg0); func_80323098(D_803835D0.unk0, arg0); func_802F0E80(D_803835D0.unk0, arg0); - func_8033EA78(D_803835D0.unk0, arg0); + commonParticle_setActive(D_803835D0.unk0, arg0); D_803835D0.unk0 = arg0; } @@ -327,8 +327,8 @@ s32 func_80334ECC(void) { } } } - func_8033E1E0(); - func_802F11E8(); + commonParticle_update(); + pem_updateAll(); animCache_update(); animBinCache_update(); ncCamera_update(); @@ -399,8 +399,8 @@ void func_80335140(enum map_e map_id) { lightingVectorList_fromFile(fp); } } + file_close(fp); //file close } -void func_8033520C(s32 arg0){ -} +void func_8033520C(s32 arg0) { } diff --git a/src/core2/code_B6EA0.c b/src/core2/code_B6EA0.c deleted file mode 100644 index 22cd0e4c..00000000 --- a/src/core2/code_B6EA0.c +++ /dev/null @@ -1,342 +0,0 @@ -#include "code_B6EA0.h" -#include -#include "functions.h" -#include "variables.h" - -#include "core2/anim/sprite.h" - -extern s32 func_8033FA84(void); -extern s32 func_8035287C(void); -extern s32 func_80344CDC(void); -extern void func_8032FFEC(s32, s32); -extern void func_80352A38(s32, u32); -extern void func_8033FFB8(s32 , s32); -extern void projectile_getPosition(s32 , f32[3]); -extern void func_8032F64C(f32[3] , ActorMarker *); -extern void func_8033FB64(s32); -extern void func_803529DC(s32); -extern void func_80344D70(s32); -extern void func_80352B20(s32); -extern ActorMarker * func_8032FBE4(f32 *pos, MarkerDrawFunc arg1, int arg2, enum asset_e model_id); - -extern void (*func_80352614)(void); -extern void (*func_8035261C)(void); -extern void (*func_803526DC)(void); -extern void (*func_80355D58)(void); -extern void (*func_80355E80)(void); -extern void (*func_80355D50)(void); -extern void (*fxegg_head_spawn)(void); -extern void (*fxegg_head_update)(void); -extern void (*fxegg_head_destroy)(void); -extern void (*func_803546E8)(void); -extern void (*func_8035489C)(void); -extern void (*func_80354990)(void); -extern void (*fxegg_ass_spawn)(void); -extern void (*fxegg_ass_update)(void); -extern void (*fxegg_ass_destroy)(void); -extern void (*func_8035611C)(void); -extern void (*func_803562E8)(void); -extern void (*func_80356364)(void); -extern void (*func_80352DE4)(void); -extern void (*func_80352F58)(void); -extern void (*func_80352FF4)(void); -extern void (*func_80354998)(void); -extern void (*func_80354C18)(void); -extern void (*func_80354DC8)(void); -extern void (*func_80354DD0)(void); -extern void (*func_80354EEC)(void); -extern void (*func_80355004)(void); -extern void (*func_8035500C)(void); -extern void (*func_80355134)(void); -extern void (*func_80355294)(void); -extern void (*func_803540B4)(void); -extern void (*func_803541D8)(void); -extern void (*func_803540AC)(void); -extern void (*func_8035529C)(void); -extern void (*func_803553E8)(void); -extern void (*func_80355548)(void); -extern void (*func_80355550)(void); -extern void (*func_8035570C)(void); -extern void (*func_8035585C)(void); -extern void (*func_803543FC)(void); -extern void (*func_8035451C)(void); -extern void (*func_803543F4)(void); -extern void (*func_80355864)(void); -extern void (*func_80355B00)(void); -extern void (*func_80355C4C)(void); - -typedef struct { - u8 unk0; - u8 unk1; - //u8 pad2[0x2]; - f32 unk4; -}Struct_Core2_B6CE0_1; - -void func_8033E6D4(s32 arg0); - -/* .data */ -Struct_Core2_B6CE0_1 D_80371E30[] ={ - {0, 0, 0.0f}, - {1, 0, 0.07f}, - {2, 1, 0.29f}, - {3, 2, 0.15f}, - {4, 1, 0.05f} -}; - -/* .bss */ -ParticleStruct0s D_80384490[40]; -s32 D_80384FD0; -struct { - s32 unk0; - s32 unk4; -} D_80384FD8; -u8 D_80384FE0; - -/* .code */ -f32 func_8033DE30(s32 arg0){ - return D_80371E30[arg0].unk4; -} - -s32 func_8033DE44(s32 arg0){ - return D_80371E30[arg0].unk1 & 1; -} - -Actor *func_8033DE60(ActorMarker *marker){ - int indx = marker->unk28; - func_8033F7F0(D_80384490[indx].unk45); - if(marker); - return 0; -} - -void func_8033DEA0(void){ - int i; - for(i = 0; i < 40 ;i++){ - D_80384490[i].unk44 = 0; - } - D_80384FD8.unk0 = D_80384FD8.unk4 = 0; - commonParticleType_set(COMMON_PARTICLE_1_EGG_HEAD, &fxegg_head_spawn, &fxegg_head_update, &fxegg_head_destroy, 0, 1); //bsbEggAss - commonParticleType_set(0x2, &func_803546E8, &func_8035489C, &func_80354990, 0, 8); //bsbWhirl //aka wonderwing - commonParticleType_set(COMMON_PARTICLE_4_EGG_ASS, &fxegg_ass_spawn, &fxegg_ass_update, &fxegg_ass_destroy, 0, 1); - commonParticleType_set(0x6, &func_8035611C, &func_803562E8, &func_80356364, 0, 8); - commonParticleType_set(0x7, &func_80352DE4, &func_80352F58, &func_80352FF4, 0, 8); - commonParticleType_set(0x8, &func_80354998, &func_80354C18, &func_80354DC8, 0, 8); - commonParticleType_set(0x9, &func_80354DD0, &func_80354EEC, &func_80355004, 0, 8); //orange_pad? - commonParticleType_set(0xa, &func_8035500C, &func_80355134, &func_80355294, 0, 8); - commonParticleType_set(0xb, &func_803540B4, &func_803541D8, &func_803540AC, 0, 8); - commonParticleType_set(0xc, &func_8035529C, &func_803553E8, &func_80355548, 0, 8); - commonParticleType_set(0xd, &func_80355550, &func_8035570C, &func_8035585C, 0, 8); - commonParticleType_set(0xe, &func_803543FC, &func_8035451C, &func_803543F4, 0, 8); - commonParticleType_set(0xf, &func_80355864, &func_80355B00, &func_80355C4C, 0, 8); - commonParticleType_set(0x10, &func_80355D58, &func_80355E80, &func_80355D50, 0, 8); - commonParticleType_set(0x11, &func_8035261C, &func_803526DC, &func_80352614, 0, 8); //mumbotoken sparkle -} - -void func_8033E184(void){ - int i; - for(i = 0; i < 40; i++){ - if(D_80384490[i].unk44){ - func_8033E6D4(i); - } - } -} - -//commonParticle_update -void func_8033E1E0(void){ - f32 sp4C[3]; - int i; - if(D_80384FE0){ - for(i = 0; i < 40; i++){ - if(D_80384490[i].unk44){ - D_80384FD0 = i; - func_80352B20(D_80384490[D_80384FD0].unk46); - if(D_80384490[D_80384FD0].unk44){ - projectile_getPosition(D_80384490[D_80384FD0].unk45, sp4C); - func_803451B0(D_80384490[D_80384FD0].unk47, sp4C); - projectile_setPosition(D_80384490[D_80384FD0].unk45, sp4C); - animsprite_update(D_80384490[D_80384FD0].unk34); - func_8033FFB8(D_80384490[D_80384FD0].unk45, animsprite_get_frame(D_80384490[D_80384FD0].unk34)); - func_8032F64C(sp4C, D_80384490[D_80384FD0].marker_30); - } - else{ - func_8033E6D4(i); - } - } - } - } -} - -//commonParticle_findFree -s32 func_8033E368(void){ - int i; - for(i = 0; i < 40; i++){ - if(D_80384490[i].unk44 == 0){ - D_80384490[i].unk44++; - return i; - } - } - return -1; -} - -//commonParticle_new -int func_8033E3F0(enum common_particle_e particle_id, int arg1){ - f32 sp34[3]; - s32 a0; - - if(arg1 == 0) - return -1; - - ml_vec3f_clear(sp34); - D_80384FD0 = func_8033E368(); - if(D_80384FD0 < 0) - return -1; - - - D_80384490[D_80384FD0].unk45 = func_8033FA84(); - D_80384490[D_80384FD0].unk34 = animsprite_new(); - D_80384490[D_80384FD0].unk46 = func_8035287C(); - D_80384490[D_80384FD0].unk47 = func_80344CDC(); - - if( ( !(a0 = D_80384490[D_80384FD0].unk45) - || !D_80384490[D_80384FD0].unk34 - || !D_80384490[D_80384FD0].unk46 - || !D_80384490[D_80384FD0].unk47 - ) - ){//L8033E4DC - if(a0){ - func_8033FB64(a0); - } - a0 = D_80384490[D_80384FD0].unk34; - if(a0){ - animsprite_free(a0); - } - a0 = D_80384490[D_80384FD0].unk46; - if(a0){ - func_803529DC(a0); - } - a0 = D_80384490[D_80384FD0].unk47; - if(a0){ - func_80344D70(a0); - } - D_80384490[D_80384FD0].unk44 = 0; - return -1; - } - - //L8033E5B4 - D_80384490[D_80384FD0].marker_30 = func_8032FBE4(sp34, func_8033DE60, 1, commonParticleType_80352C7C(particle_id)); - D_80384490[D_80384FD0].marker_30->unk40_22 = 1; - func_8032FFEC(D_80384490[D_80384FD0].marker_30, (u32)D_80384FD0); - D_80384490[D_80384FD0].marker_30->collidable = FALSE; - func_80352A38(D_80384490[D_80384FD0].unk46, particle_id); - func_8033FFB8(D_80384490[D_80384FD0].unk45, animsprite_get_frame(D_80384490[D_80384FD0].unk34)); - projectile_getPosition(D_80384490[D_80384FD0].unk45, sp34); - func_8032F64C(sp34, D_80384490[D_80384FD0].marker_30); - return D_80384FD0; - -} - -void func_8033E6D4(s32 arg0){ - func_803529DC(D_80384490[arg0].unk46); - func_80344D70(D_80384490[arg0].unk47); - func_8033FB64(D_80384490[arg0].unk45); - animsprite_free(D_80384490[arg0].unk34); - marker_free(D_80384490[arg0].marker_30); - D_80384490[arg0].marker_30 = NULL; - D_80384490[arg0].unk38 = 0; - D_80384490[arg0].unk44 = 0; -} - -void func_8033E73C(s32 arg0, s32 arg1, FuncUnk40 arg2){ - s32 tmp_v0 = func_8033E368(); - D_80384490[tmp_v0].unk44--; - D_80384490[tmp_v0].unk38 = arg0; - D_80384490[tmp_v0].unk3C = arg1; - D_80384490[tmp_v0].unk40 = arg2; -} - -void func_8033E79C(s32 arg0, s32 arg1, FuncUnk40 arg2){ - D_80384490[D_80384FD0].unk38 = arg0; - D_80384490[D_80384FD0].unk3C = arg1; - D_80384490[D_80384FD0].unk40 = arg2; -} - -void func_8033E7CC(s32 arg0){ - int i; - for(i = 0; i < 40; i++){ - if(D_80384490[i].unk44 && arg0 == (s32)D_80384490[i].unk38){ - func_8033E6D4(i); - } - } -} - -ActorMarker *func_8033E840(void){ - return D_80384490[D_80384FD0].marker_30; -} - -ActorMarker *func_8033E864(void){ - return D_80384490[D_80384FD0].unk38; -} - -FuncUnk40 func_8033E888(void){ - return D_80384490[D_80384FD0].unk40; -} - -s32 func_8033E8AC(void){ - return D_80384490[D_80384FD0].unk3C; -} - -u8 func_8033E8D0(void){ - return D_80384490[D_80384FD0].unk45; -} - -AnimSprite * func_8033E8F4(void){ - return D_80384490[D_80384FD0].unk34; -} - -u8 func_8033E918(void){ - return D_80384490[D_80384FD0].unk46; -} - -u8 func_8033E93C(void){ - return D_80384490[D_80384FD0].unk47; -} - -ParticleStruct0s *func_8033E960(void){ - return &D_80384490[D_80384FD0]; -} - -void func_8033E984(void){ - D_80384490[D_80384FD0].unk44 = 0; -} - -void func_8033E9A8(s32 arg0){ - func_8033E6D4(arg0); -} - -void func_8033E9C8(s32 arg0){ - D_80384FD0 = arg0; -} - -void func_8033E9D4(void){ - D_80384FD8.unk4 = D_80384FD8.unk0; - D_80384FD8.unk0 = D_80384FD0; -} - -void func_8033E9F4(void){ - D_80384FD0 = D_80384FD8.unk0; - D_80384FD8.unk0 = D_80384FD8.unk4; -} - -f32 func_8033EA14(s32 arg0){ - return *((f32 *)func_8033E960() + arg0); -} - -void func_8033EA40(s32 arg0, f32 arg1){ - *((f32 *)func_8033E960() + arg0) = arg1; -} - -void func_8033EA78(s32 arg0, s32 arg1){ - if(arg1 == 2) - D_80384FE0 = 1; - else - D_80384FE0 = 0; -} diff --git a/src/core2/code_B6EA0.h b/src/core2/code_B6EA0.h deleted file mode 100644 index c082cd9b..00000000 --- a/src/core2/code_B6EA0.h +++ /dev/null @@ -1,53 +0,0 @@ -#ifndef CORE2_B6EA0_H -#define CORE2_B6EA0_H - -#include -#include "functions.h" -#include "variables.h" -#include "core2/anim/sprite.h" - -typedef s32 (*FuncUnk40)(ActorMarker *, s32, f32[3]); - -typedef struct particle_struct_0_s{ - f32 unk0; - f32 unk4; - f32 unk8; - f32 unkC; - f32 unk10; - f32 unk14; - u8 pad18[8]; - s32 unk20; - s32 unk24; - s32 unk28; - u8 pad24[0x4]; - ActorMarker *marker_30; - AnimSprite *unk34; - ActorMarker *unk38; - s32 unk3C; - FuncUnk40 unk40; - u8 unk44; - u8 unk45; - u8 unk46; - u8 unk47; -} ParticleStruct0s; - -ActorMarker *func_8033E864(void); -FuncUnk40 func_8033E888(void); -u8 func_8033E8D0(void); -AnimSprite *func_8033E8F4(void); -ParticleStruct0s *func_8033E960(void); -void func_8033E984(void); -void projectile_setSprite(u8, enum asset_e); -void func_8033FC34(u8, s32); -void projectile_setColor(u8, s32, s32, s32); -void func_8033FCD8(u8, s32); -void projectile_setRotation(u8, f32[3]); -void projectile_addRoll(u8, f32); -void projectile_setPosition(u8, f32[3]); -void func_8033FFE4(u8, s32, s32); -void func_80344E18(u8, s32); -void func_80344E3C(u8, f32[3]); -void func_80344D94(u8, f32[3]); -void func_80344EE4(u8, f32, f32); - -#endif diff --git a/src/core2/code_B8860.c b/src/core2/code_B8860.c index 8c4b4516..18e722c7 100644 --- a/src/core2/code_B8860.c +++ b/src/core2/code_B8860.c @@ -24,7 +24,7 @@ typedef struct { void projectile_setRoll(u8 indx, f32 angle); f32 projectile_getRoll(u8 indx); -void func_8033FB64(u8 arg0); +void projectile_freeByIndex(u8 arg0); /* .bss */ Struct_B8860_0s D_80385000[0x32]; @@ -74,7 +74,7 @@ void func_8033FA24(void){ int i; for(i = 1; i < 0x32; i++){ if(D_80385000[i].unk28_13){ - func_8033FB64(i); + projectile_freeByIndex(i); } } } @@ -104,10 +104,11 @@ u8 func_8033FA84(void){ return 0; } -void func_8033FB64(u8 indx){ - if(D_80385000[indx].sprite_0){ +void projectile_freeByIndex(u8 indx) { + if (D_80385000[indx].sprite_0) { assetCache_free(D_80385000[indx].sprite_0); } + D_80385000[indx].sprite_0 = NULL; D_80385000[indx].unk28_13 = 0; } diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index fd67a2c6..3df29925 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -781,7 +781,7 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){ case 2: D_803858A0[arg1->t0.unk10.common.bit7] = arg1->t0.unk4.common.bit31; - func_8025A6EC(lookup_getCoMusicId(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8); + coMusicPlayer_playMusic(lookup_getCoMusicId(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8); break; case 3: @@ -797,13 +797,13 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){ sfxsource_setSfxId(sfxsourceIdx, lookup_getSfxId(sp78)); sfxsource_playSfxAtVolume(sfxsourceIdx, sp7C); sfxsource_setSampleRate(sfxsourceIdx, sp74); - func_8030E2C4(sfxsourceIdx); + sfxSource_func_8030E2C4(sfxsourceIdx); if (D_803858A0[sp70] != 0){ sfxsource_freeSfxsourceByIndex(D_803858A0[sp70]); } D_803858A0[sp70] = sfxsourceIdx; } else { - func_8030E6A4(lookup_getSfxId(sp78), sp7C, sp74); + gcsfx_playWithPitch(lookup_getSfxId(sp78), sp7C, sp74); } break; @@ -1270,14 +1270,14 @@ void func_80343E20(s32 arg0, s32 arg1, f32 arg2, s32 arg3) { sfxsource_setSfxId(temp_v0, lookup_getSfxId(arg0)); sfxsource_playSfxAtVolume(temp_v0, arg2); sfxsource_setSampleRate(temp_v0, arg1); - func_8030E2C4(temp_v0); + sfxSource_func_8030E2C4(temp_v0); if (D_803858A0[arg3] != 0) { sfxsource_freeSfxsourceByIndex(D_803858A0[arg3]); } D_803858A0[arg3] = temp_v0; } } else { - func_8030E6A4(lookup_getSfxId(arg0), arg2, arg1); + gcsfx_playWithPitch(lookup_getSfxId(arg0), arg2, arg1); } } diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index dafc751b..6de47c4a 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -128,7 +128,7 @@ s32 item_adjustByDiff(enum item_e item, s32 diff, s32 no_hud){ } if(sp2C && sp30 != sp2C ){ if(sp2C < sp30){ - func_8025A6EC(SFX_AIR_METER_DROPPING, 28000); + coMusicPlayer_playMusic(SFX_AIR_METER_DROPPING, 28000); } else{ func_8030E760(0x3e9, 1.2f, 28000); @@ -139,7 +139,7 @@ s32 item_adjustByDiff(enum item_e item, s32 diff, s32 no_hud){ sp28 = itemscore_noteScores_get(level_get()); func_80346DB4(D_80385F30[item]); if(D_80385F30[item] == 100 && sp28 != 100){ - func_8025A6EC(COMUSIC_36_100TH_NOTE_COLLECTED, 20000); + coMusicPlayer_playMusic(COMUSIC_36_100TH_NOTE_COLLECTED, 20000); item_inc(ITEM_16_LIFE); } break; @@ -336,7 +336,7 @@ void func_803465E4(void){ void func_80346C10(enum bs_e *retVal, enum bs_e fail_state, enum bs_e success_state, enum item_e item_id, int use_item){ if(item_empty(item_id)){ item_adjustByDiffWithHud(item_id, 0); - func_8025A6EC(COMUSIC_2C_BUZZER, 22000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 22000); if(fail_state != -1){ *retVal = fail_state; } @@ -393,15 +393,15 @@ void func_80346DB4(s32 note_count) { if (D_80385FF0[level_id] < note_count) { D_80385FF0[level_id] = note_count; if ((level_get() == LEVEL_1_MUMBOS_MOUNTAIN) && (note_count == 50)) { - gcdialog_showText(0xF74, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xF74, 4, NULL, NULL, NULL, NULL); } if (note_count == 100) { - gcdialog_showText(0xF78, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(0xF78, 4, NULL, NULL, NULL, NULL); } if (note_count == 1) { levelSpecificFlags_set(LEVEL_FLAG_34_UNKNOWN, TRUE); } - if (!levelSpecificFlags_get(LEVEL_FLAG_34_UNKNOWN) && (gcdialog_showText(0xF76, 0, NULL, NULL, NULL, NULL))) { + if (!levelSpecificFlags_get(LEVEL_FLAG_34_UNKNOWN) && (gcdialog_showDialog(0xF76, 0, NULL, NULL, NULL, NULL))) { levelSpecificFlags_set(LEVEL_FLAG_34_UNKNOWN, TRUE); } if (volatileFlag_get(VOLATILE_FLAG_17) == 0) { diff --git a/src/core2/code_C0B80.c b/src/core2/code_C0B80.c index d0f8c35e..c384133b 100644 --- a/src/core2/code_C0B80.c +++ b/src/core2/code_C0B80.c @@ -22,9 +22,9 @@ void func_80347B80(Struct81s *arg0) { sp1C = marker_getActor(arg0->marker); if (sp1C->unk54 > 0.0) { if (randf() < ((sp1C->unk54 / 3.0) * 2)) { - func_8033E73C(arg0->marker, 5, func_80329904); - func_8033E3F0(0xF, ((ActorMarker *)arg0->marker)->unk14_21); - // func_8033E3F0(0xF, arg0->marker->unk14_21); + commonParticle_add(arg0->marker, 5, func_80329904); + commonParticle_new(0xF, ((ActorMarker *)arg0->marker)->unk14_21); + // commonParticle_new(0xF, arg0->marker->unk14_21); } sp1C->unk54 -= time_getDelta(); } diff --git a/src/core2/code_C0CF0.c b/src/core2/code_C0CF0.c index bd899f44..ab3f3940 100644 --- a/src/core2/code_C0CF0.c +++ b/src/core2/code_C0CF0.c @@ -24,8 +24,8 @@ void func_80347CF4(Struct81s *arg0) { sp1C = marker_getActor(arg0->marker); if (sp1C->unk54 > 0.0) { if (randf() < ((sp1C->unk54 / 3.0) * 2)) { - func_8033E73C(arg0->marker, 5, func_80329904); - func_8033E3F0(0xF, ((ActorMarker *)arg0->marker)->unk14_21); + commonParticle_add(arg0->marker, 5, func_80329904); + commonParticle_new(0xF, ((ActorMarker *)arg0->marker)->unk14_21); } sp1C->unk54 -= time_getDelta(); } diff --git a/src/core2/code_C2F30.c b/src/core2/code_C2F30.c index b3535a5c..23be4f2c 100644 --- a/src/core2/code_C2F30.c +++ b/src/core2/code_C2F30.c @@ -73,8 +73,8 @@ void func_80349FB0(DemoInput *input_ptr, u32 size, int arg2){ func_8030AFD8(0); func_80321854(); - func_8031FBF8(); - func_8031FBA0(); + debugScoreStates(); + clearScoreStates(); func_803216D0(map_get()); func_8030AFA0(map_get()); volatileFlag_set(VOLATILE_FLAG_C4_WOZZA_HIDE_IN_SNS_PARADE, 1); diff --git a/src/core2/code_C4320.c b/src/core2/code_C4320.c index c475b7fd..18fa69c9 100644 --- a/src/core2/code_C4320.c +++ b/src/core2/code_C4320.c @@ -99,7 +99,7 @@ void func_8034B33C(s32 arg0) { func_802E412C(1, 0xB); func_802E40C4(7); D_80386114 = sp18; - D_80386124 = func_802C5A30(); + D_80386124 = gameSelect_getGameNumber(); } void func_8034B3A4(enum map_e map_id, s32 exit_id) { @@ -107,7 +107,7 @@ void func_8034B3A4(enum map_e map_id, s32 exit_id) { func_802E412C(1, 8); func_802E40C4(8); D_80386114 = &D_80371F70; - D_80386124 = func_802C5A30(); + D_80386124 = gameSelect_getGameNumber(); } @@ -123,7 +123,7 @@ void func_8034B3F0(s32 arg0) { } func_802E40C4(0xC); D_80386114 = temp_s0; - D_80386124 = func_802C5A30(); + D_80386124 = gameSelect_getGameNumber(); } @@ -269,7 +269,7 @@ void func_8034BA7C(enum map_e map_id, s32 exit_id){ void func_8034BA9C(void) { if (func_8034BAFC() != -1) { - func_802C5A3C(func_8034BAFC()); + gameSelect_setGameNumber(func_8034BAFC()); gameFile_load(func_8034BAFC()); func_80347AA8(); } diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index 5ad930dd..dac61324 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -8,7 +8,7 @@ extern int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); extern f32 floor_getXPosition(struct0*); extern void func_8031C5AC(struct0 *, f32 *); -extern f32 func_8031C5E4(struct0*); +extern f32 floor_getYPosition(struct0*); extern void func_8031C5FC(struct0 *, f32); extern void func_80244FC0(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3, s32 arg4, u32 arg5); extern s32 func_80244E54(f32[3], f32[3], f32 [3], u32, f32, f32); @@ -318,8 +318,8 @@ void func_80293F0C(void){ _player_getPosition(D_8037C218); func_80298504(D_8037C228); ml_vec3f_diff_copy(D_8037C238, D_8037C218, D_8037C228); - if ((D_8037C274 == 3) && func_8031C594(D_8037C200) && (D_8037C218[1] > (func_8031C5E4(D_8037C200) - 70.0f))) { - D_8037C218[1] = func_8031C5E4(D_8037C200) - 70.0f; + if ((D_8037C274 == 3) && func_8031C594(D_8037C200) && (D_8037C218[1] > (floor_getYPosition(D_8037C200) - 70.0f))) { + D_8037C218[1] = floor_getYPosition(D_8037C200) - 70.0f; D_8037C27E = 1; baphysics_set_vertical_velocity(1.0f); } @@ -339,7 +339,7 @@ void func_80293F0C(void){ break; }//L80294148 if (func_8031C594(D_8037C200)) { - D_8037C278 = (D_8037C218[1] < func_8031C5E4(D_8037C200)); + D_8037C278 = (D_8037C218[1] < floor_getYPosition(D_8037C200)); } ml_vec3f_diff_copy(D_8037C248, D_8037C218, D_8037C228); ml_vec3f_diff(D_8037C248, D_8037C238); @@ -347,7 +347,7 @@ void func_80293F0C(void){ D_8037C279 = 1; } - if(D_8037C278 && D_8037C218[1] < (func_8031C5E4(D_8037C200) - 70.0f)){ + if(D_8037C278 && D_8037C218[1] < (floor_getYPosition(D_8037C200) - 70.0f)){ func_80294384(3); if(D_8037C279 && baphysics_get_vertical_velocity() < 0.0f) { baphysics_set_vertical_velocity(-1.0f); @@ -440,8 +440,8 @@ s32 func_802944F4(void){ return D_8037C284; } -f32 func_80294500(void){ - return func_8031C5E4(D_8037C200); +f32 floor_getCurrentFloorYPosition(void) { + return floor_getYPosition(D_8037C200); } s32 func_80294524(void){ @@ -468,7 +468,7 @@ int func_80294560(void){ return D_8037C280 == 3; } -bool func_80294574(void){ +bool floor_isCurrentFloorunk59(void){ return func_8031C594(D_8037C200); } diff --git a/src/core2/code_C5440.c b/src/core2/code_C5440.c index e2cba9ce..177a54f4 100644 --- a/src/core2/code_C5440.c +++ b/src/core2/code_C5440.c @@ -117,10 +117,12 @@ Struct70s *func_8034C528(s32 arg0){ struct1Ds *iPtr; struct1Ds *endPtr = vector_getEnd(D_80386140.unk4); - for(iPtr = vector_getBegin(D_80386140.unk4); iPtr < endPtr; iPtr++){ - if(iPtr->xform_id == 2 && iPtr->unk4 == arg0) + for (iPtr = vector_getBegin(D_80386140.unk4); iPtr < endPtr; iPtr++) { + if (iPtr->xform_id == 2 && iPtr->unk4 == arg0) { return &iPtr->unk8; + } } + return NULL; } diff --git a/src/core2/code_C62B0.c b/src/core2/code_C62B0.c index 6d7aecbe..b9fd7d13 100644 --- a/src/core2/code_C62B0.c +++ b/src/core2/code_C62B0.c @@ -211,19 +211,19 @@ void func_8034DFB0(Struct6Ds *arg0, s32 arg1[4], s32 arg2[4], f32 arg3) { arg0->unk98 = 0.0f; } -void func_8034E088(Struct6Ds *arg0, s32 arg1, s32 arg2, f32 arg3){ +void updateStruct6DsOpacity(Struct6Ds *arg0, s32 from, s32 to, f32 time) { arg0->unk78[0] = arg0->unk78[1] = arg0->unk78[2] = 0.0f; arg0->unk88[0] = arg0->unk88[1] = arg0->unk88[2] = 0.0f; arg0->unk29 = 5; arg0->unk28 = 0; - arg0->unk84 = (f32) arg1; - arg0->unk94 = (f32) arg2; - arg0->unk9C = (arg3 > 0.0f) ? arg3 : 0.001; + arg0->unk84 = (f32) from; + arg0->unk94 = (f32) to; + arg0->unk9C = (time > 0.0f) ? time : 0.001; arg0->unk98 = 0.0f; } -void func_8034E0FC(Struct6Ds *arg0, s32 arg1){ - func_8034E088(arg0, arg1, arg1, 0.0f); +void setStruct6DsOpacity(Struct6Ds *arg0, s32 opacity){ + updateStruct6DsOpacity(arg0, opacity, opacity, 0.0f); } void func_8034E120(Struct6Ds *arg0, f32 arg1, f32 arg2, f32 arg3,s32 arg4){ @@ -248,10 +248,10 @@ void func_8034E1A4(Struct6Ds *arg0, enum sfx_e sfx_id, f32 arg2, f32 arg3){ arg0->unk20 = arg2; arg0->unk24 = arg3; sfxsource_setSfxId(arg0->unk0, sfx_id); - func_8030DD14(arg0->unk0, 3); + sfxSource_setunk43_7ByIndex(arg0->unk0, 3); sfxsource_playSfxAtVolume(arg0->unk0, (arg2 +arg3)/2); sfxsource_setSampleRate(arg0->unk0, 32000); - func_8030E2C4(arg0->unk0); + sfxSource_func_8030E2C4(arg0->unk0); } void func_8034E254(Struct6Ds *arg0, void (*arg1)(Struct6Ds *)){ @@ -323,7 +323,7 @@ void func_8034E26C(Struct6Ds *arg0, BKModel *model, s32 mesh_id) { if (arg0->unk0 != 0) { sp28 = arg0->unk44 / arg0->unk48; sp24 = func_8030E200(arg0->unk0); - sp20 = func_8030E1C4(arg0->unk0); + sp20 = sfxSource_getSampleRate(arg0->unk0); sp24 += (randf2(-1.0f, 1.0f) * sp2C); sp24 = MAX(arg0->unk20, sp24); diff --git a/src/core2/code_C8490.c b/src/core2/code_C8490.c index d8ecdb0b..3e867c76 100644 --- a/src/core2/code_C8490.c +++ b/src/core2/code_C8490.c @@ -16,7 +16,7 @@ void func_8034F434(Struct76s *arg0, s32 arg1) { arg0->unk4 = (s32) (arg0->unk4 + 1); arg0->unk14 = arg0->unk10 = randf2(0.08f, 0.12f); if ((arg0->unk4 == 1) && func_8034C4CC()) { - func_8030E6A4(SFX_B5_THUNDERBOLT, randf2(0.9f, 1.1f), randi2(10000, 20000)); + gcsfx_playWithPitch(SFX_B5_THUNDERBOLT, randf2(0.9f, 1.1f), randi2(10000, 20000)); } } if (arg1 == 0) { diff --git a/src/core2/code_C8760.c b/src/core2/code_C8760.c index 8ecc91af..5a1f3f2f 100644 --- a/src/core2/code_C8760.c +++ b/src/core2/code_C8760.c @@ -53,12 +53,12 @@ void func_8034F774(void){ sp44[1] = (sp38[1] + sp2C[1])/2; sp44[2] = (sp38[2] + sp2C[2])/2; sfxsource_setSfxId(D_803720A0.sfxsourceIdx, 0x3EC); - func_8030DD14(D_803720A0.sfxsourceIdx, 3); + sfxSource_setunk43_7ByIndex(D_803720A0.sfxsourceIdx, 3); func_8030DFF0(D_803720A0.sfxsourceIdx, 1); sfxsource_set_position(D_803720A0.sfxsourceIdx, sp44); sfxsource_set_fade_distances(D_803720A0.sfxsourceIdx, 400.0f, 3200.0f); func_8030DE44(D_803720A0.sfxsourceIdx, 2, 0.5f); - func_8030E2C4(D_803720A0.sfxsourceIdx); + sfxSource_func_8030E2C4(D_803720A0.sfxsourceIdx); } } diff --git a/src/core2/code_C9F00.c b/src/core2/code_C9F00.c index 5b5734d3..2ef36e76 100644 --- a/src/core2/code_C9F00.c +++ b/src/core2/code_C9F00.c @@ -343,7 +343,7 @@ void func_803518E8(void){ void func_80351954(Struct68s *arg0){ if(arg0->unk0){ - func_8030E394(arg0->unk0); + sfxSource_triggerCallbackByIndex(arg0->unk0); sfxsource_freeSfxsourceByIndex(arg0->unk0); arg0->unk0 = 0; } diff --git a/src/core2/code_CB610.c b/src/core2/code_CB610.c index 30002dd5..cdf31b81 100644 --- a/src/core2/code_CB610.c +++ b/src/core2/code_CB610.c @@ -4,19 +4,19 @@ #include "core2/anim/sprite.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" -extern u8 func_8033E8D0(void); +extern u8 commonParticle_getCurrentProjectileIndex(void); /* .code */ void func_803525A0(f32 arg0[3]){ u8 sp1F; u8 sp1E; f32 *sp18; - if(func_8033E3F0(0x11, 1) >= 0){ - sp1E = func_8033E8D0(); + if(commonParticle_new(0x11, 1) >= 0){ + sp1E = commonParticle_getCurrentProjectileIndex(); sp1F = func_8033E93C(); - sp18 = func_8033E960(); + sp18 = commonParticle_getCurrentParticle(); projectile_setPosition(sp1E, arg0); func_80344D94(sp1F, arg0); sp18[1] = 0.45f; @@ -27,7 +27,7 @@ void func_803525A0(f32 arg0[3]){ void func_80352614(void){} void func_8035261C(void) { - ParticleStruct0s *sp2C; + CommonParticle *sp2C; u8 projectile_indx; AnimSprite *sp24; u8 sp23; @@ -35,9 +35,9 @@ void func_8035261C(void) { f32 temp_f6; s32 temp_f16; - sp2C = func_8033E960(); - projectile_indx = func_8033E8D0(); - sp24 = func_8033E8F4(); + sp2C = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp24 = commonParticle_getCurrentAnimSprite(); sp23 = func_8033E93C(); sp1C = (s32) (randf() * 20.0f + 60.0f); sp2C->unk20 = sp1C; @@ -54,15 +54,15 @@ void func_8035261C(void) { void func_803526DC(void) { - ParticleStruct0s *temp_s0; + CommonParticle *temp_s0; u8 projectile_indx; s32 temp_f16; f32 sp38; f32 temp_f20; f32 sp30; - temp_s0 = func_8033E960(); - projectile_indx = func_8033E8D0(); + temp_s0 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); sp38 = temp_s0->unk4; temp_f20 = temp_s0->unk0; sp30 =temp_s0->unk20; @@ -77,6 +77,6 @@ void func_803526DC(void) { temp_f20 += time_getDelta(); temp_s0->unk0 = temp_f20; if (sp38 < temp_f20) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } diff --git a/src/core2/code_CB8A0.c b/src/core2/code_CB8A0.c deleted file mode 100644 index 36c2a635..00000000 --- a/src/core2/code_CB8A0.c +++ /dev/null @@ -1,85 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -extern GenFunction_0 commonParticleType_getFreeMethod(enum common_particle_e); -extern GenFunction_0 commonParticleType_getUpdateMethod(enum common_particle_e); - -typedef struct { - u8 unk0; //prev_particle_type - u8 unk1; //current_particle_type - u8 unk2; //next_particle_type - u8 occupied; -}Struct_Core2_CB610_0; - -/* .bss */ -Struct_Core2_CB610_0 D_803861C0[40]; - -void func_80352830(void){ - s32 i; - for(i = 1; i < 40; i++){ - D_803861C0[i].occupied = FALSE; - } -} - -void func_80352874(void){ return; } - -u8 func_8035287C(void){ - s32 i; - for(i = 1; i < 40; i++){ - if(!D_803861C0[i].occupied){ - D_803861C0[i].occupied++; - D_803861C0[i].unk0 = 0; - D_803861C0[i].unk1 = 0; - D_803861C0[i].unk2 = 0; - return i; - } - } - return 0; -} - -void func_803529DC(u8 arg0) { - if (commonParticleType_getFreeMethod(D_803861C0[arg0].unk1) != NULL) { - commonParticleType_getFreeMethod(D_803861C0[arg0].unk1)(); - } - D_803861C0[arg0].occupied = 0; -} - -void func_80352A38(u8 arg0, enum common_particle_e arg1){ - void (*funcPtr)(void); - if(arg1){ - D_803861C0[arg0].unk2 = arg1; - if(commonParticleType_getFreeMethod(D_803861C0[arg0].unk1)){ - funcPtr = commonParticleType_getFreeMethod(D_803861C0[arg0].unk1); - funcPtr(); - } - - D_803861C0[arg0].unk0 = D_803861C0[arg0].unk1; - D_803861C0[arg0].unk1 = D_803861C0[arg0].unk2; - D_803861C0[arg0].unk2 = 0; - if(commonParticleType_getInitMethod(D_803861C0[arg0].unk1)){ - funcPtr = commonParticleType_getInitMethod(D_803861C0[arg0].unk1); - funcPtr(); - } - - } -} - -s32 func_80352ACC(u8 arg0){ - return D_803861C0[arg0].unk0; -} - -s32 func_80352AE8(u8 arg0){ - return D_803861C0[arg0].unk1; -} - -s32 func_80352B04(u8 arg0){ - return D_803861C0[arg0].unk2; -} - -void func_80352B20(u8 arg0) { - if (commonParticleType_getUpdateMethod(D_803861C0[arg0].unk1) != NULL) { - commonParticleType_getUpdateMethod(D_803861C0[arg0].unk1)(); - } -} diff --git a/src/core2/code_CBBF0.c b/src/core2/code_CBBF0.c index e7e56e45..13c1b7b4 100644 --- a/src/core2/code_CBBF0.c +++ b/src/core2/code_CBBF0.c @@ -1,6 +1,7 @@ #include #include "functions.h" #include "variables.h" +#include "core2/commonParticle.h" typedef struct{ @@ -11,7 +12,7 @@ typedef struct{ s32 unk10; }CommonParticleType; -void commonParticleType_set(enum common_particle_e arg0, GenFunction_0 init_method, s32 update_method, GenFunction_0 free_method, s32 arg4, s32 arg5); +void commonParticleType_set(enum common_particle_e id, GenFunction_0 init_method, s32 update_method, GenFunction_0 free_method, s32 arg4, s32 arg5); /* .bss */ CommonParticleType D_80386260[0x12]; diff --git a/src/core2/code_CBD10.c b/src/core2/code_CBD10.c index 9a8348c2..8d3b1dee 100644 --- a/src/core2/code_CBD10.c +++ b/src/core2/code_CBD10.c @@ -4,10 +4,10 @@ #include "core2/anim/sprite.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" extern f32 time_getDelta_frames(void); -extern u8 func_8033E8D0(void); +extern u8 commonParticle_getCurrentProjectileIndex(void); extern void func_8033FFE4(u8, s32, s32); extern void func_8033FC34(u8, s32); extern void projectile_setPosition(u8, f32[3]); @@ -51,10 +51,10 @@ void func_80352CF4(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3) { u8 sp1A; - if (func_8033E3F0(7, 1) >= 0) { - sp1A = func_8033E8D0(); + if (commonParticle_new(7, 1) >= 0) { + sp1A = commonParticle_getCurrentProjectileIndex(); sp1B = func_8033E93C(); - sp1C = func_8033E960(); + sp1C = commonParticle_getCurrentParticle(); sp1C[0] = arg2; sp1C[1] = (arg3 - arg2) / 20.0f; projectile_setPosition(sp1A, arg0); @@ -72,15 +72,15 @@ void func_80352DE4(void) { u8 projectile_indx; AnimSprite *sp58; u8 sp57; - ParticleStruct0s *temp_s1; + CommonParticle *temp_s1; f32 sp44[3]; f32 sp38[3]; f32 sp2C[3]; - projectile_indx = func_8033E8D0(); - sp58 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp58 = commonParticle_getCurrentAnimSprite(); sp57 = func_8033E93C(); - temp_s1 = func_8033E960(); + temp_s1 = commonParticle_getCurrentParticle(); player_getPosition(sp44); temp_s1->unk0 = 10.0f; temp_s1->unk4 = 8.0f; @@ -108,12 +108,12 @@ void func_80352DE4(void) { } void func_80352F58(void){ - f32 *sp2C = func_8033E960(); - AnimSprite *sp28 = func_8033E8F4(); - u8 sp27 = func_8033E8D0(); + f32 *sp2C = commonParticle_getCurrentParticle(); + AnimSprite *sp28 = commonParticle_getCurrentAnimSprite(); + u8 sp27 = commonParticle_getCurrentProjectileIndex(); f32 sp20 = time_getDelta_frames(); if(animsprite_is_stopped(sp28)){ - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else{ sp2C[0] += sp2C[1]*sp20; diff --git a/src/core2/code_CC1E0.c b/src/core2/code_CC1E0.c index 5af99484..8c234c4f 100644 --- a/src/core2/code_CC1E0.c +++ b/src/core2/code_CC1E0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" #include "core2/anim/sprite.h" extern void func_80244D94(f32[3], f32[3], f32[3], u32, f32); @@ -76,59 +76,59 @@ s32 func_803531C8(u8 projectile_indx, s32 arg1){ if(0.25 <= temp_f2 && temp_f2 <= 0.75){ other_actor->unk38_31 = 1; } - func_8033E984(); + commonParticle_setCurrentInUseFalse(); fxegg_shatter(projectile_indx); } break; case MARKER_33_LEAKY: //L80353350 if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x32) && chLeaky_eggCollision(other_marker)) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } break; case MARKER_4C_CLANKER_TOKEN_TOOTH_EXT: //L80353384 - func_8033E984(); + commonParticle_setCurrentInUseFalse(); func_803870EC(1); break; case MARKER_1AE_ZUBBA: //L8035339C //zubba? - func_8033E984(); + commonParticle_setCurrentInUseFalse(); fxegg_shatter(projectile_indx); break; case MARKER_4D_CLANKER_JIGGY_TOOTH_EXT: //L803533B4 - func_8033E984(); + commonParticle_setCurrentInUseFalse(); func_803870EC(2); break; case MARKER_182_RBB_EGG_TOLL: //L803533CC - func_8033E984(); + commonParticle_setCurrentInUseFalse(); func_8038685C(other_marker); break; case MARKER_BB_UNKNOWN: //L803533E4 //"BIG_JINXYHEAD" other_actor = marker_getActor(other_marker); *(s32 *)&other_actor->local = 1; - func_8033E984(); + commonParticle_setCurrentInUseFalse(); break; case MARKER_34_CEMETARY_POT: //L80353400 if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x3C) && chFlowerpot_eggCollision(other_marker)) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } break; case MARKER_AB_RUBEES_EGG_POT: //L80353434 if (collisionTri_isHitFromAbove_marker(egg_position, other_marker, 0x1E) && (func_8038E178() < func_8038E184())) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); func_8038E140(); } break; case MARKER_AE_UNKNOWN: //L80353480 //big_jynxy_head if(func_8038E344(other_marker)){ - func_8033E984(); + commonParticle_setCurrentInUseFalse(); func_8038E2FC(other_marker); } break; @@ -149,13 +149,13 @@ bool fxegg_isCollidingWithPlayer(f32 arg0[3]){ && (sp20[0]*sp20[0] + sp20[2]*sp20[2] < 4900.0f); } -void func_80353580(ActorMarker *marker){ - func_8033E9A8(marker->unk28); +void func_80353580(ActorMarker *marker) { + commonParticle_freeParticleByIndex(marker->commonParticleIndex); } void fxegg_head_spawn(void){ - u8 projectile_indx = func_8033E8D0(); - AnimSprite *sp78 = func_8033E8F4(); + u8 projectile_indx = commonParticle_getCurrentProjectileIndex(); + AnimSprite *sp78 = commonParticle_getCurrentAnimSprite(); u8 sp77 = func_8033E93C(); f32 sp68[3]; f32 sp5C[3]; @@ -212,7 +212,7 @@ void fxegg_head_update(void){ f32 sp54[3]; f32 tmp_f20; - projectile_indx = func_8033E8D0(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); sp96 = func_8033E93C(); sp78 = func_8033EA14(1); tmp_f24 = func_8033EA14(2); @@ -221,7 +221,7 @@ void fxegg_head_update(void){ while(tmp_f24 <= 0.0f){//L80353868 tmp_f24 += sp6C; projectile_getPosition(projectile_indx, sp7C); - func_8033E9D4(); + commonParticle_stashCurrentIndex(); sp7C[0] += randf2(-8.0f, 8.0f); sp7C[1] += randf2(-8.0f, 8.0f); sp7C[2] += randf2(-8.0f, 8.0f); @@ -233,7 +233,7 @@ void fxegg_head_update(void){ } func_803541CC(0x32); func_80354030(sp7C, 0.15f); - func_8033E9F4(); + commonParticle_applyIndexStash(); }//L80353930 func_8033EA40(2, tmp_f24); func_803531C8(projectile_indx, 0); @@ -244,7 +244,7 @@ void fxegg_head_update(void){ sp54[0] = (f32)s0->propPtr->x; sp54[1] = (f32)s0->propPtr->y; sp54[2] = (f32)s0->propPtr->z; - func_8033E984(); + commonParticle_setCurrentInUseFalse(); fxegg_shatter(projectile_indx); }//L803539D4 func_80344E3C(sp96, sp88); @@ -254,7 +254,7 @@ void fxegg_head_update(void){ sp78 += time_getDelta(); func_8033EA40(1, sp78); if(2.0 < sp78){ - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } @@ -270,8 +270,8 @@ void fxegg_ass_spawn(void) { f32 temp_f2; f32 temp_f18; - projectile_indx = func_8033E8D0(); - sp58 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp58 = commonParticle_getCurrentAnimSprite(); sp57 = func_8033E93C(); func_8033E840()->unk2C_1 = TRUE; func_8033E840()->collidable = TRUE; @@ -317,7 +317,7 @@ void fxegg_ass_update(void) { f32 sp58; f32 var_f22; - projectile_indx = func_8033E8D0(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); sp8E = func_8033E93C(); sp64 = func_8033EA14(1); var_f22 = func_8033EA14(2); @@ -326,7 +326,7 @@ void fxegg_ass_update(void) { while (var_f22 <= 0.0f) { var_f22 += sp58; projectile_getPosition(projectile_indx, sp68); - func_8033E9D4(); + commonParticle_stashCurrentIndex(); sp68[0] += randf2(-8.0f, 8.0f); sp68[1] += randf2(-8.0f, 8.0f); sp68[2] += randf2(-8.0f, 8.0f); @@ -337,7 +337,7 @@ void fxegg_ass_update(void) { } func_803541CC(0x32); func_80354030(sp68, 0.15); - func_8033E9F4(); + commonParticle_applyIndexStash(); } func_8033EA40(2, var_f22); if (func_80344EC0(sp8E)) { @@ -349,7 +349,7 @@ void fxegg_ass_update(void) { projectile_getPosition(projectile_indx, sp80); if (fxegg_isCollidingWithPlayer(sp80)) { chCollectible_collectEgg(NULL); - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } func_80344E3C(sp8E, sp74); @@ -359,7 +359,7 @@ void fxegg_ass_update(void) { sp64 += time_getDelta(); func_8033EA40(1, sp64); if ((2.8 < sp64) && (func_80344EC0(sp8E) || (sp64 > 3.5))) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); fxegg_shatter(projectile_indx); } } @@ -371,9 +371,9 @@ void fxegg_collide(s32 arg0, ActorMarker *marker, s32 arg2) { actor = marker_getActor(marker); if (func_8033D5A4(arg2) != 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); if (actor->modelCacheIndex != 0x29D) { - fxegg_shatter(func_8033E8D0()); + fxegg_shatter(commonParticle_getCurrentProjectileIndex()); } } } diff --git a/src/core2/code_CD0A0.c b/src/core2/code_CD0A0.c index f0dc366a..840bc70b 100644 --- a/src/core2/code_CD0A0.c +++ b/src/core2/code_CD0A0.c @@ -3,7 +3,7 @@ #include "variables.h" #include "core2/anim/sprite.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" struct{ s32 unk0; @@ -13,14 +13,14 @@ struct{ void func_80354030(f32 position[3], f32 arg1){ u8 sp1F; u8 sp1E; - ParticleStruct0s *sp18; + CommonParticle *sp18; - if(func_8033E3F0(0xb, 1) < 0) + if(commonParticle_new(0xb, 1) < 0) return; - sp1E = func_8033E8D0(); + sp1E = commonParticle_getCurrentProjectileIndex(); sp1F = func_8033E93C(); - sp18 = func_8033E960(); + sp18 = commonParticle_getCurrentParticle(); projectile_setPosition(sp1E, position); func_80344D94(sp1F, position); sp18->unk4 = arg1; @@ -30,15 +30,15 @@ void func_80354030(f32 position[3], f32 arg1){ void func_803540AC(void){} void func_803540B4(void){ - ParticleStruct0s *sp34; + CommonParticle *sp34; u8 projectile_indx; AnimSprite *sp2C; u8 sp2B; f32 sp1C[3]; - sp34 = func_8033E960(); - projectile_indx = func_8033E8D0(); - sp2C = func_8033E8F4(); + sp34 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp2C = commonParticle_getCurrentAnimSprite(); sp2B = func_8033E93C(); sp34->unk20 = D_803863D0.unk4; projectile_setSprite(projectile_indx, D_803863D0.unk0 + 0x710); @@ -63,15 +63,15 @@ void func_803541CC(s32 arg0){ } void func_803541D8(void) { - ParticleStruct0s *sp44; + CommonParticle *sp44; u8 projectile_indx; f32 temp_f20; f32 temp_f22; s32 temp_f10; f32 sp30; - sp44 = func_8033E960(); - projectile_indx = func_8033E8D0(); + sp44 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); temp_f22 = sp44->unk4; temp_f20 = sp44->unk0; sp30 = (f32) sp44->unk20; @@ -88,6 +88,6 @@ void func_803541D8(void) { temp_f20 += time_getDelta(); sp44->unk0 = temp_f20; if (temp_f22 < temp_f20) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } diff --git a/src/core2/code_CD3F0.c b/src/core2/code_CD3F0.c index 1d569a5a..c91f8355 100644 --- a/src/core2/code_CD3F0.c +++ b/src/core2/code_CD3F0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" #include "core2/anim/sprite.h" extern f64 D_80379470; @@ -11,12 +11,12 @@ extern f32 D_80379478; void func_80354380(f32 arg0[3], f32 arg1) { u8 sp1F; u8 sp1E; - ParticleStruct0s* sp18; + CommonParticle* sp18; - if (func_8033E3F0(0xE, 1) >= 0) { - sp1E = func_8033E8D0(); + if (commonParticle_new(0xE, 1) >= 0) { + sp1E = commonParticle_getCurrentProjectileIndex(); sp1F = func_8033E93C(); - sp18 = func_8033E960(); + sp18 = commonParticle_getCurrentParticle(); projectile_setPosition(sp1E, arg0); func_80344D94(sp1F, arg0); sp18->unk4 = arg1; @@ -26,16 +26,16 @@ void func_80354380(f32 arg0[3], f32 arg1) { void func_803543F4(void){} void func_803543FC(void) { - ParticleStruct0s* sp3C; + CommonParticle* sp3C; u8 projectile_indx; AnimSprite* sp34; u8 sp33; f32 sp24[3]; s32 temp_f16; - sp3C = func_8033E960(); - projectile_indx = func_8033E8D0(); - sp34 = func_8033E8F4(); + sp3C = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp34 = commonParticle_getCurrentAnimSprite(); sp33 = func_8033E93C(); temp_f16 = ((randf() * 20.0f) + 80.0f); sp3C->unk0 = 0.0f; @@ -54,7 +54,7 @@ void func_803543FC(void) { } void func_8035451C(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; u8 projectile_indx; f32 sp3c; f32 sp38; @@ -62,8 +62,8 @@ void func_8035451C(void) { f32 sp30; s32 temp_f16; - temp_s0 = func_8033E960(); - projectile_indx = func_8033E8D0(); + temp_s0 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); sp38 = temp_s0->unk4; temp_f20 = temp_s0->unk0; sp30 = temp_s0->unk20; @@ -78,6 +78,6 @@ void func_8035451C(void) { temp_f20 += time_getDelta(); temp_s0->unk0 = temp_f20; if (sp38 < temp_f20) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } diff --git a/src/core2/code_CD6E0.c b/src/core2/code_CD6E0.c index cccc4b3e..bd796ff6 100644 --- a/src/core2/code_CD6E0.c +++ b/src/core2/code_CD6E0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" #include "core2/anim/sprite.h" extern f32 player_getYaw(void); @@ -25,14 +25,14 @@ void func_803546E8(void) { u8 projectile_indx; AnimSprite* sp48; u8 sp47; - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; f32 plyr_pos[3]; f32 sp28[3]; - projectile_indx = func_8033E8D0(); - sp48 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp48 = commonParticle_getCurrentAnimSprite(); sp47 = func_8033E93C(); - temp_s0 = func_8033E960(); + temp_s0 = commonParticle_getCurrentParticle(); player_getPosition(plyr_pos); temp_s0->unk0 = randf2(-10.0f, 10.0f); @@ -60,17 +60,17 @@ void func_803546E8(void) { } void func_8035489C(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; u8 projectile_indx; f32 playerVelocity[3]; f32 playerPosition[3]; - temp_s0 = func_8033E960(); - projectile_indx = func_8033E8D0(); + temp_s0 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); projectile_addRoll(projectile_indx, 7.0f); temp_s0->unk20--; if (temp_s0->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); return; } func_80354670(projectile_indx, temp_s0->unk20); @@ -89,21 +89,21 @@ void func_8035489C(void) { void func_80354990(void){} -void func_80354998(void) { +void jiggyShine_init(void) { u8 sp57; ActorMarker *sp50; AnimSprite *sp4C; u8 sp4B; - ParticleStruct0s *temp_s0; + CommonParticle *temp_s0; f32 sp38[3]; f32 sp2C[3]; s32 sp28; - sp57 = func_8033E8D0(); - sp50 = func_8033E864(); - sp4C = func_8033E8F4(); + sp57 = commonParticle_getCurrentProjectileIndex(); + sp50 = commonParticle_getCurrentActorMarker(); + sp4C = commonParticle_getCurrentAnimSprite(); sp4B = func_8033E93C(); - temp_s0 = func_8033E960(); + temp_s0 = commonParticle_getCurrentParticle(); ml_vec3f_clear(sp38); (&temp_s0->unk0)[0] = randf2(-2.0f, 2.0f); (&temp_s0->unk0)[1] = 0.0f; @@ -115,44 +115,46 @@ void func_80354998(void) { animsprite_default(sp4C); animsprite_set_speed(sp4C, 3.0f); animsprite_set_state(sp4C, ANIM_SPRITE_STATE_STOPPED); + switch (sp50->modelId) { /* irregular */ - case 0x3BB: - sp28 = 7; - break; - case 0x3BC: - sp28 = 0xB; - break; - case 0x3C0: - case 0x551: - sp28 = 8; - break; - case 0x3C1: - sp28 = 0xA; - break; - case 0x3C2: - sp28 = 9; - break; - case 0x548: - sp28 = 5; - ml_vec3f_clear(&temp_s0->unk0); - ml_vec3f_clear(&temp_s0->unkC); - break; - case 0x549: - sp28 = 3; - ml_vec3f_clear(&temp_s0->unk0); - ml_vec3f_clear(&temp_s0->unkC); - break; - case 0x547: - sp28 = 1; - ml_vec3f_clear(&temp_s0->unk0); - ml_vec3f_clear(&temp_s0->unkC); - break; - default: - sp28 = 3; - ml_vec3f_clear(&temp_s0->unk0); - ml_vec3f_clear(&temp_s0->unkC); - break; + case 0x3BB: + sp28 = 7; + break; + case 0x3BC: + sp28 = 0xB; + break; + case 0x3C0: + case 0x551: + sp28 = 8; + break; + case 0x3C1: + sp28 = 0xA; + break; + case 0x3C2: + sp28 = 9; + break; + case 0x548: + sp28 = 5; + ml_vec3f_clear(&temp_s0->unk0); + ml_vec3f_clear(&temp_s0->unkC); + break; + case 0x549: + sp28 = 3; + ml_vec3f_clear(&temp_s0->unk0); + ml_vec3f_clear(&temp_s0->unkC); + break; + case 0x547: + sp28 = 1; + ml_vec3f_clear(&temp_s0->unk0); + ml_vec3f_clear(&temp_s0->unkC); + break; + default: + sp28 = 3; + ml_vec3f_clear(&temp_s0->unk0); + ml_vec3f_clear(&temp_s0->unkC); + break; } + projectile_setSprite(sp57, sp28 + 0x710); projectile_setPosition(sp57, sp38); func_80344E18(sp4B, 3); @@ -165,8 +167,8 @@ void func_80354998(void) { func_80354670(sp57, 0x14); } -void func_80354C18(void) { - ParticleStruct0s* temp_s0; +void jiggyShine_update(void) { + CommonParticle* particle; s32 pad; ActorMarker *sp4C; u8 sp4B; @@ -176,19 +178,21 @@ void func_80354C18(void) { f32 sp28[3]; u8 projectile_indx; - temp_s0 = func_8033E960(); - projectile_indx = func_8033E8D0(); - sp4C = func_8033E864(); + particle = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp4C = commonParticle_getCurrentActorMarker(); sp4B = func_8033E93C(); sp44 = func_8033E888(); sp40 = func_8033E8AC(); projectile_addRoll(projectile_indx, 7.0f); - temp_s0->unk20--; - if (temp_s0->unk20 < 0) { - func_8033E984(); + particle->unk20--; + + if (particle->unk20 < 0) { + commonParticle_setCurrentInUseFalse(); } else { - func_80354670(projectile_indx, temp_s0->unk20); - if (temp_s0->unk20 >= 0x10) { + func_80354670(projectile_indx, particle->unk20); + + if (particle->unk20 >= 0x10) { if (sp44(sp4C, sp40, sp34) != 0) { func_8033FC98(projectile_indx, 0); } else { @@ -197,27 +201,29 @@ void func_80354C18(void) { } else { projectile_getPosition(projectile_indx, sp34); } + func_80344E7C(sp4B, sp28); - sp28[0] += (&temp_s0->unkC)[0]; - sp28[1] += (&temp_s0->unkC)[1]; - sp28[2] += (&temp_s0->unkC)[2]; + sp28[0] += (&particle->unkC)[0]; + sp28[1] += (&particle->unkC)[1]; + sp28[2] += (&particle->unkC)[2]; func_80344E3C(sp4B, sp28); - (&temp_s0->unk0)[0] += sp28[0]; - (&temp_s0->unk0)[1] += sp28[1]; - (&temp_s0->unk0)[2] += sp28[2]; - sp34[0] += (&temp_s0->unk0)[0]; - sp34[1] += (&temp_s0->unk0)[1]; - sp34[2] += (&temp_s0->unk0)[2]; + (&particle->unk0)[0] += sp28[0]; + (&particle->unk0)[1] += sp28[1]; + (&particle->unk0)[2] += sp28[2]; + sp34[0] += (&particle->unk0)[0]; + sp34[1] += (&particle->unk0)[1]; + sp34[2] += (&particle->unk0)[2]; projectile_setPosition(projectile_indx, sp34); } + func_8033FC34(projectile_indx, 0xB4); func_8033FCD8(projectile_indx, 0xC); } -void func_80354DC8(void){} +void jiggyShine_free(void) { } void func_80354DD0(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; AnimSprite* sp40; u8 sp3F; u8 pad3C[3]; @@ -225,10 +231,10 @@ void func_80354DD0(void) { f32 sp2C[3]; f32 sp20[3]; - projectile_indx = func_8033E8D0(); - sp40 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp40 = commonParticle_getCurrentAnimSprite(); sp3F = func_8033E93C(); - temp_s0 = func_8033E960(); + temp_s0 = commonParticle_getCurrentParticle(); ml_vec3f_clear(sp2C); (&temp_s0->unk0)[0] = randf2(-50.0f, 50.0f); (&temp_s0->unk0)[1] = randf2(-65.0f, -65.0f); @@ -249,7 +255,7 @@ void func_80354DD0(void) { } void func_80354EEC(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; s32 pad; ActorMarker *sp3C; FuncUnk40 sp38; @@ -257,14 +263,14 @@ void func_80354EEC(void) { f32 sp28[3]; u8 temp_s1; - temp_s0 = func_8033E960(); - temp_s1 = func_8033E8D0(); - sp3C = func_8033E864(); + temp_s0 = commonParticle_getCurrentParticle(); + temp_s1 = commonParticle_getCurrentProjectileIndex(); + sp3C = commonParticle_getCurrentActorMarker(); sp38 = func_8033E888(); sp34 = func_8033E8AC(); temp_s0->unk20--; if (temp_s0->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else { func_80354670(temp_s1, temp_s0->unk20); if (temp_s0->unk20 >= 0x10) { @@ -289,14 +295,14 @@ void func_8035500C(void) { u8 projectile_indx; AnimSprite* sp40; u8 sp3F; - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; f32 sp2C[3]; f32 sp20[3]; - projectile_indx = func_8033E8D0(); - sp40 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp40 = commonParticle_getCurrentAnimSprite(); sp3F = func_8033E93C(); - temp_s0 = func_8033E960(); + temp_s0 = commonParticle_getCurrentParticle(); ml_vec3f_clear(sp2C); (&temp_s0->unk0)[0] = randf2(-40.0f, 40.0f); (&temp_s0->unk0)[1] = randf2(-40.0f, 40.0f); @@ -318,23 +324,23 @@ void func_8035500C(void) { } void func_80355134(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; u8 temp_s1; ActorMarker *sp3C; FuncUnk40 sp38; s32 sp34; f32 sp28[3]; - temp_s0 = func_8033E960(); - temp_s1 = func_8033E8D0(); - sp3C = func_8033E864(); + temp_s0 = commonParticle_getCurrentParticle(); + temp_s1 = commonParticle_getCurrentProjectileIndex(); + sp3C = commonParticle_getCurrentActorMarker(); sp38 = func_8033E888(); sp34 = func_8033E8AC(); if ((globalTimer_getTime() & 1) == 0) { temp_s0->unk20--; } if (temp_s0->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else { func_80354670(temp_s1, temp_s0->unk20); if (temp_s0->unk20 >= 0x13) { @@ -360,14 +366,14 @@ void func_8035529C(void) { u8 projectile_indx; AnimSprite* sp48; u8 sp47; - ParticleStruct0s* sp40; + CommonParticle* sp40; f32 sp34[3]; f32 sp28[3]; - projectile_indx = func_8033E8D0(); - sp48 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp48 = commonParticle_getCurrentAnimSprite(); sp47 = func_8033E93C(); - sp40 = func_8033E960(); + sp40 = commonParticle_getCurrentParticle(); ml_vec3f_clear(sp34); (&sp40->unk0)[0] = randf2(-40.0f, 40.0f); (&sp40->unk0)[1] = 0.0f; @@ -389,23 +395,23 @@ void func_8035529C(void) { } void func_803553E8(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; u8 temp_s1; ActorMarker *sp3C; FuncUnk40 sp38; s32 sp34; f32 sp28[3]; - temp_s0 = func_8033E960(); - temp_s1 = func_8033E8D0(); - sp3C = func_8033E864(); + temp_s0 = commonParticle_getCurrentParticle(); + temp_s1 = commonParticle_getCurrentProjectileIndex(); + sp3C = commonParticle_getCurrentActorMarker(); sp38 = func_8033E888(); sp34 = func_8033E8AC(); if ((globalTimer_getTime() & 1) == 0) { temp_s0->unk20--; } if (temp_s0->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else { func_80354670(temp_s1, temp_s0->unk20); if (temp_s0->unk20 >= 0xD) { @@ -432,14 +438,14 @@ void func_80355550(void) { u8 projectile_indx; AnimSprite *sp38; u8 sp37; - ParticleStruct0s *sp30; + CommonParticle *sp30; f32 sp24[3]; f32 sp18[3]; - projectile_indx = func_8033E8D0(); - sp38 = func_8033E8F4(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp38 = commonParticle_getCurrentAnimSprite(); sp37 = func_8033E93C(); - sp30 = func_8033E960(); + sp30 = commonParticle_getCurrentParticle(); ml_vec3f_clear(sp24); (&sp30->unk0)[0] = randf2(-30.0f, 30.0f); (&sp30->unk0)[1] = randf2(-30.0f, 30.0f); @@ -470,21 +476,21 @@ void func_80355550(void) { } void func_8035570C(void) { - ParticleStruct0s* temp_s0; + CommonParticle* temp_s0; u8 temp_s1; ActorMarker *sp3C; FuncUnk40 sp38; s32 sp34; f32 sp28[3]; - temp_s0 = func_8033E960(); - temp_s1 = func_8033E8D0(); - sp3C = func_8033E864(); + temp_s0 = commonParticle_getCurrentParticle(); + temp_s1 = commonParticle_getCurrentProjectileIndex(); + sp3C = commonParticle_getCurrentActorMarker(); sp38 = func_8033E888(); sp34 = func_8033E8AC(); temp_s0->unk20--; if (temp_s0->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else { func_80354670(temp_s1, temp_s0->unk20); if (temp_s0->unk20 >= 0x13) { @@ -513,17 +519,17 @@ void func_80355864(void) { static s32 D_803863E4; f32 var_f2; Actor *sp4C; - ParticleStruct0s *sp48; + CommonParticle *sp48; s32 sp44; f32 sp38[3]; f32 sp2C[3]; f32 sp28; - sp5F = func_8033E8D0(); - sp58 = func_8033E8F4(); + sp5F = commonParticle_getCurrentProjectileIndex(); + sp58 = commonParticle_getCurrentAnimSprite(); sp57 = func_8033E93C(); - sp4C = marker_getActor(func_8033E864()); - sp48 = func_8033E960(); + sp4C = marker_getActor(commonParticle_getCurrentActorMarker()); + sp48 = commonParticle_getCurrentParticle(); D_803863E4 = (D_803863E4 + 1) % 10; sp44 = (D_803863E4 == 0); sp38[0] = sp4C->position[0]; @@ -555,16 +561,16 @@ void func_80355864(void) { } void func_80355B00(void) { - ParticleStruct0s *sp44; + CommonParticle *sp44; u8 projectile_indx; ActorMarker *pad40; Actor *sp38; f32 *sp34; f32 sp28[3]; - sp44 = func_8033E960(); - projectile_indx = func_8033E8D0(); - pad40 = func_8033E864(); + sp44 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + pad40 = commonParticle_getCurrentActorMarker(); sp38 = marker_getActor(pad40); sp34 = bundle_getVelocity(sp38); projectile_addRoll(projectile_indx, 7.0f); @@ -579,7 +585,7 @@ void func_80355B00(void) { } if (sp44->unk20 < 0) { - func_8033E984(); + commonParticle_setCurrentInUseFalse(); return; } func_80354670(projectile_indx, sp44->unk20); diff --git a/src/core2/code_CECD0.c b/src/core2/code_CECD0.c index 0765cc90..833fa82b 100644 --- a/src/core2/code_CECD0.c +++ b/src/core2/code_CECD0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" #include "core2/anim/sprite.h" typedef struct { @@ -17,15 +17,15 @@ extern Struct_Core2_CECD0_0 D_803726F0 = {0x3, 0x32}; void func_80355C60(f32 arg0[3], f32 arg1){ u8 sp2F; u8 sp2E; - ParticleStruct0s *sp28; + CommonParticle *sp28; f32 sp1C[3]; - if(func_8033E3F0(0x10, 1) < 0) + if(commonParticle_new(0x10, 1) < 0) return; - sp2E = func_8033E8D0(); + sp2E = commonParticle_getCurrentProjectileIndex(); sp2F = func_8033E93C(); - sp28 = func_8033E960(); + sp28 = commonParticle_getCurrentParticle(); sp1C[0] = arg0[0] + randf2(-30.0f, 30.0f); sp1C[1] = arg0[1] + randf2(0.0f, 30.0f) + 25.0f; @@ -39,15 +39,15 @@ void func_80355C60(f32 arg0[3], f32 arg1){ void func_80355D50(void){} void func_80355D58(void){ - ParticleStruct0s * sp3C; + CommonParticle * sp3C; u8 projectile_indx; AnimSprite *sp34; u8 temp_s0; f32 sp24[3]; - sp3C = func_8033E960(); - projectile_indx = func_8033E8D0(); - sp34 = func_8033E8F4(); + sp3C = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); + sp34 = commonParticle_getCurrentAnimSprite(); temp_s0 = func_8033E93C(); sp3C->unk20 = D_803726F0.unk4; projectile_setSprite(projectile_indx, D_803726F0.unk0 + ASSET_710_SPRITE_SPARKLE_PURPLE); @@ -67,15 +67,15 @@ void func_80355D58(void){ } void func_80355E80(void){ - ParticleStruct0s *sp44; + CommonParticle *sp44; u8 projectile_indx; f32 f22; f32 f20; s32 temp_a1; f32 sp30; - sp44 = func_8033E960(); - projectile_indx = func_8033E8D0(); + sp44 = commonParticle_getCurrentParticle(); + projectile_indx = commonParticle_getCurrentProjectileIndex(); f20 = sp44->unk0;\ f22 = sp44->unk4;\ sp30 = (f32)sp44->unk20; @@ -95,6 +95,6 @@ void func_80355E80(void){ f20 += time_getDelta(); sp44->unk0 = f20; if(f22 < sp44->unk0){ - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } } diff --git a/src/core2/code_CF090.c b/src/core2/code_CF090.c index 35deb22f..025643ad 100644 --- a/src/core2/code_CF090.c +++ b/src/core2/code_CF090.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "code_B6EA0.h" +#include "core2/commonParticle.h" #include "core2/anim/sprite.h" /* .data */ @@ -37,16 +37,16 @@ void func_80356020(u8 arg0, f32 arg1[4]){ } void func_80356074(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3){ - ParticleStruct0s *sp1C; + CommonParticle *sp1C; u8 sp1B; u8 sp1A; - if(func_8033E3F0(6, 1) < 0) + if(commonParticle_new(6, 1) < 0) return; - sp1A = func_8033E8D0(); + sp1A = commonParticle_getCurrentProjectileIndex(); sp1B = func_8033E93C(); - sp1C = func_8033E960(); + sp1C = commonParticle_getCurrentParticle(); sp1C->unk0 = arg2; sp1C->unk4 = (arg3 - sp1C->unk0)/20.0f; projectile_setPosition(sp1A, arg0); @@ -59,15 +59,15 @@ void func_8035611C(void){ u8 projectile_indx; AnimSprite *sp58; u8 sp57; - ParticleStruct0s *sp54; + CommonParticle *sp54; f32 plyr_pos[3]; f32 sp38[3]; f32 sp2C[3]; - projectile_indx = (u8)func_8033E8D0(); - sp58 = func_8033E8F4(); + projectile_indx = (u8)commonParticle_getCurrentProjectileIndex(); + sp58 = commonParticle_getCurrentAnimSprite(); sp57 = func_8033E93C(); - sp54 = func_8033E960(); + sp54 = commonParticle_getCurrentParticle(); player_getPosition(plyr_pos); sp54->unk0 = 10.0f; sp54->unk4 = 8.0f; @@ -97,15 +97,15 @@ void func_8035611C(void){ } void func_803562E8(void){ - ParticleStruct0s *sp24; + CommonParticle *sp24; AnimSprite *sp20; u8 sp1F; - sp24 = func_8033E960(); - sp20 = func_8033E8F4(); - sp1F = func_8033E8D0(); + sp24 = commonParticle_getCurrentParticle(); + sp20 = commonParticle_getCurrentAnimSprite(); + sp1F = commonParticle_getCurrentProjectileIndex(); if(animsprite_is_stopped(sp20)){ - func_8033E984(); + commonParticle_setCurrentInUseFalse(); } else{ sp24->unk0 += sp24->unk4; diff --git a/src/core2/code_CF3E0.c b/src/core2/code_CF3E0.c deleted file mode 100644 index 91065f2f..00000000 --- a/src/core2/code_CF3E0.c +++ /dev/null @@ -1,134 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -typedef KEY_VALUE_PAIR(s16, s16) MapProgressFlagToDialogID; - -/* Mapping for file progess flags to Dialog IDs */ -MapProgressFlagToDialogID fileProgressDialogMap[] = { - { FILEPROG_AB_SWIM_OILY_WATER, 0xBA1}, - { FILEPROG_AC_DIVE_OILY_WATER, 0xBA2}, - { FILEPROG_AA_HAS_TOUCHED_CCW_BRAMBLE_FIELD, 0xCE6}, - { FILEPROG_F_HAS_TOUCHED_PIRAHANA_WATER, 0xC85}, - { FILEPROG_A9_HAS_TOUCHED_RBB_OVEN, 0xBA0}, - { FILEPROG_10_HAS_TOUCHED_SAND_EEL_SAND, 0xA7E}, - { FILEPROG_14_HAS_TOUCHED_FP_ICY_WATER, 0xC11}, - { FILEPROG_F_HAS_TOUCHED_PIRAHANA_WATER, 0xC85}, - { FILEPROG_86_HAS_TOUCHED_MMM_THORN_HEDGE, 0xAE1}, - { FILEPROG_DD_HAS_TOUCHED_CCW_ICY_WATER, 0xCE7}, - { FILEPROG_3_MUSIC_NOTE_TEXT, 0xD9C}, - { FILEPROG_4_MUMBO_TOKEN_TEXT, 0xD9D}, - { FILEPROG_5_BLUE_EGG_TEXT, 0xD9E}, - { FILEPROG_6_RED_FEATHER_TEXT, 0xD9F}, - { FILEPROG_7_GOLD_FEATHER_TEXT, 0xDA0}, - { FILEPROG_8_ORANGE_TEXT, 0xB46}, - { FILEPROG_9_GOLD_BULLION_TEXT, 0xA21}, - { FILEPROG_A_HONEYCOMB_TEXT, 0xDA1}, - { FILEPROG_B_EMPTY_HONEYCOMB_TEXT, 0xDA2}, - { FILEPROG_C_EXTRA_LIFE_TEXT, 0xDA3}, - { FILEPROG_BE_CHEATO_BLUEEGGS, 0xFA8}, - { FILEPROG_BF_CHEATO_REDFEATHERS, 0xFA9}, - { FILEPROG_C0_CHEATO_GOLDFEATHERS, 0xFAA}, - { FILEPROG_95_UNKNOWN, 0xB50}, - { FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT, 0xF7B}, - { -1, -1} -}; - -/* This progress IDs are not saved in the save file, like when Banjo goes near a Note door which requires more notes than the Banjo has. */ -/* Triggers a dialog every time after the game restarts. */ -MapProgressFlagToDialogID gVolatileFlagDialogMap[] = { - {VOLATILE_FLAG_9E_BETA_OILY_SCUM, 0xBA3}, // Oily scum (unused) - {VOLATILE_FLAG_9F_BETA_DIVE_IN_ICY_WATER, 0xCE8}, // Dive in icy water (unused) - {VOLATILE_FLAG_A0_FF_FIRST_ANSWER_RIGHT, 0x1032}, - {VOLATILE_FLAG_A1_FF_NEXT_ANSWER_RIGHT, 0x1033}, - {VOLATILE_FLAG_A2_FF_GRUNTY_ANSWER_RIGHT, 0x1034}, - {VOLATILE_FLAG_A3_FF_FIRST_ANSWER_WRONG, 0x1035}, - {VOLATILE_FLAG_A4_FF_NEXT_ANSWER_WRONG, 0x1036}, - {VOLATILE_FLAG_A5_FF_UNUSED, 0x1037}, // FF "the choice is yours" - {VOLATILE_FLAG_A6_FF_FOUND_HONEYCOMB, 0x1038}, - {VOLATILE_FLAG_A7_FF_FOUND_EXTRALIFE, 0x1039}, - {VOLATILE_FLAG_A8_FF_GOT_JOKER, 0x103A}, - {VOLATILE_FLAG_A9_FF_USED_JOKER, 0x103B}, - {VOLATILE_FLAG_AA_FF_LOW_HEALTH, 0x103C}, - {VOLATILE_FLAG_AB_LAST_LIFE_ON_SKULL, 0x103D}, - {VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED, 0xA88}, - {VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED, 0xAE2}, - {VOLATILE_FLAG_AE_BGS_WALKWAY_JIGGY_MISSED, 0xC8B}, - {VOLATILE_FLAG_AF_BGS_MAZE_JIGGY_MISSED, 0xC8C}, - {VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES, 0xFBD}, - {VOLATILE_FLAG_C2_NOBONUS_TEXT, 0xE36}, - {VOLATILE_FLAG_C5_WISHYWASHYBANJO_TEXT, 0xDB6}, - { -1, -1} -}; - -static s32 __findIndex(MapProgressFlagToDialogID *map, s32 key) { - s32 i = 0; - - while (map[i].key >= 0) { - if (key == map[i].key) { - return i; - } - i++; - } - - return -1; -} - -/* Checks for a specific file progress flag and triggers a dialog only if the progress flag was not set and sets the progress flag */ -s32 func_803563B8(enum file_progress_e progress_flag, s32 arg1) { - s32 index; - - if (fileProgressFlag_get(progress_flag) != 0) { - return 0; - } else { - index = __findIndex(fileProgressDialogMap, progress_flag); - if (index != -1) { - if (gcdialog_showText(fileProgressDialogMap[index].value, arg1, 0, 0, 0, 0) != 0) { - fileProgressFlag_set(progress_flag, 1); - } - return fileProgressFlag_get(progress_flag); - } - return 0; - } -} - -void func_8035644C(enum file_progress_e progress_flag){ - func_803563B8(progress_flag, 0); -} - -void func_8035646C(enum file_progress_e progress_flag) { - func_803563B8(progress_flag, 4); -} - -/* Checks for a specific "volatile" progress flag and triggers a dialog only if the progress flag was not set and sets the progress flag */ -s32 volatileFlag_setAndTriggerDialog(enum volatile_flags_e id, s32 arg1) { - s32 index; - - if (volatileFlag_get(id) != 0) { - return 0; - } else { - index = __findIndex(gVolatileFlagDialogMap, id); - if (index != -1) { - if (gcdialog_showText(gVolatileFlagDialogMap[index].value, arg1, 0, 0, 0, 0) != 0) { - volatileFlag_set(id, 1); - } - return volatileFlag_get(id); - } - return 0; - } -} - -// called for dialogs when banjo is not fast enough to reach a door or jiggy and for NOBONUS text -void volatileFlag_setAndTriggerDialog_0(enum volatile_flags_e arg0) { - volatileFlag_setAndTriggerDialog(arg0, 0); -} - -// called for FFQ dialogs -void volatileFlag_setAndTriggerDialog_4(enum volatile_flags_e arg0) { - volatileFlag_setAndTriggerDialog(arg0, 4); -} - -// called for WISHYWASHYBANJO dialog, mumbo jumbo speaking? -void volatileFlag_setAndTriggerDialog_E(enum volatile_flags_e arg0) { - volatileFlag_setAndTriggerDialog(arg0, 0xE); -} diff --git a/src/core2/code_D0CA0.c b/src/core2/code_D0CA0.c index c4ecf1d2..75307871 100644 --- a/src/core2/code_D0CA0.c +++ b/src/core2/code_D0CA0.c @@ -229,7 +229,7 @@ void func_803584BC(Actor *this) { local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.9f); sfxsource_setSfxId(local->sfxsourceIdx, 0x3FA); - func_8030DD14(local->sfxsourceIdx, 2); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 2); sfxsource_setSampleRate(local->sfxsourceIdx, 0); } @@ -251,7 +251,7 @@ void func_80358524(f32 position[3], s32 count, enum asset_e model_id) { particleEmitter_setAngularVelocityRange(p_ctrl, -400.0f, -400.0f, -400.0f, 400.0f, 400.0f, 400.0f); particleEmitter_func_802EF9F8(p_ctrl, 0.01f); particleEmitter_func_802EFA18(p_ctrl, 3); - func_802EFA20(p_ctrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(p_ctrl, 1.0f, 1.3f); particleEmitter_setSfx(p_ctrl, SFX_2F_ORANGE_SPLAT, 16000); particleEmitter_setVelocityAccelerationAndPositionRanges(p_ctrl, &D_803728EC); particleEmitter_setScaleAndLifetimeRanges(p_ctrl, &D_803728C4); @@ -338,7 +338,7 @@ void func_80358684(Actor *this) { sp78 = (0.0f > sp78) ? 0 : sp78; if (sp78 > 0.0f) { sfxsource_setSampleRate(local->sfxsourceIdx, (s32) (sp78 * 10000.0f)); - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); } } if (this->unk10_25) { diff --git a/src/core2/code_D5D10.c b/src/core2/code_D5D10.c index bdf09b01..f9318944 100644 --- a/src/core2/code_D5D10.c +++ b/src/core2/code_D5D10.c @@ -72,7 +72,7 @@ void chskeleton_despawn(ActorMarker *marker, s32 arg1) { func_802DAD08(partEmitMgr_newEmitter(1), this, ASSET_4CF_MODEL_LIMBO_HEAD); func_802DAD8C(partEmitMgr_newEmitter(2), this, ASSET_4CD_MODEL_LIMBO_ARM); func_8035CCA0(partEmitMgr_newEmitter(4), this, ASSET_4D0_MODEL_LIMBO_BONE); - FUNC_8030E8B4(SFX_119_FISH_DEATH, 1.0f, 32000, this->position, 1250, 2500); + 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])); marker_despawn(marker); } diff --git a/src/core2/code_D5FD0.c b/src/core2/code_D5FD0.c index bd3e405b..ea035c9a 100644 --- a/src/core2/code_D5FD0.c +++ b/src/core2/code_D5FD0.c @@ -62,7 +62,7 @@ void func_8035CF60(ActorMarker * marker, s32 arg1) { actor = marker_getActor(marker); subaddie_set_state_with_direction(actor, 5, 0.0f, 1); actor_playAnimationOnce(actor); - FUNC_8030E8B4(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_C2_GRUBLIN_EGH, 1.0f, 32000, actor->position, 1250, 2500); actor_collisionOff(actor); } @@ -94,10 +94,10 @@ void func_8035D058(Actor *this) { func_802DB5A0(this); if (this->state == 5) { if (actor_animationIsAt(this, 0.18f) != 0) { - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 0x4E2, 0x9C4); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 0x4E2, 0x9C4); } if (actor_animationIsAt(this, 0.7f) != 0) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 0x4E2, 0x9C4); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 0x4E2, 0x9C4); } } diff --git a/src/core2/code_D6180.c b/src/core2/code_D6180.c index c1d4c44f..2273c13d 100644 --- a/src/core2/code_D6180.c +++ b/src/core2/code_D6180.c @@ -70,7 +70,7 @@ void func_8035D1F0(ActorMarker *arg0, s32 arg1) { func_802DAD08(partEmitMgr_newEmitter(1), this, ASSET_4CA_MODEL_MUMMUM_HEAD); func_802DAD8C(partEmitMgr_newEmitter(2), this, ASSET_4C8_MODEL_MUMMUM_ARM); func_8035D110(partEmitMgr_newEmitter(1), this, ASSET_4CB_MODEL_MUMMUM_BODY); - FUNC_8030E8B4(SFX_119_FISH_DEATH, 0.8f, 32000, this->position, 1250, 2500); + 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])); marker_despawn(arg0); } @@ -133,7 +133,7 @@ void func_8035D490(ActorMarker *marker){ if (map_get() == MAP_13_GV_MEMORY_GAME) { sp1C = marker_getActor(marker); - if (func_80329530(sp1C, 250) != 0) { + if (subaddie_playerIsWithinSphereAndActive(sp1C, 250) != 0) { __bundle_spawnFromFirstActor(BUNDLE_1C__HONEYCOMB, sp1C); func_8035D2C0(marker, 0); } diff --git a/src/core2/code_D6600.c b/src/core2/code_D6600.c index b92687ea..e223aca7 100644 --- a/src/core2/code_D6600.c +++ b/src/core2/code_D6600.c @@ -62,7 +62,7 @@ void func_8035D65C(Actor *this) { this->unk38_31--; return; } - if (func_80329530(this, 500) && player_isSwimming() && func_8035D608(this)) { + if (subaddie_playerIsWithinSphereAndActive(this, 500) && player_isSwimming() && func_8035D608(this)) { this->actor_specific_1_f = 2.0f; subaddie_set_state_with_direction(this, 4, 0.0f, -1); } @@ -89,7 +89,7 @@ void func_8035D88C(ActorMarker *marker, ActorMarker *other_marker){ this = marker_getActor(marker); subaddie_set_state_with_direction(this, 7, 0.0f, -1); actor_playAnimationOnce(this); - FUNC_8030E8B4(SFX_115_BUZZBOMB_DEATH, 0.8f, 30000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_115_BUZZBOMB_DEATH, 0.8f, 30000, this->position, 1500, 3000); actor_collisionOff(this); } @@ -204,7 +204,7 @@ void func_8035DA1C(Actor *this) { case 6://L8035DE60 if (actor_animationIsAt(this, 0.5f)) { - func_8030E6A4(SFX_6D_CROC_BITE, 1.1f, 10000); + gcsfx_playWithPitch(SFX_6D_CROC_BITE, 1.1f, 10000); } case 5://L8035DE84 this->marker->id = MARKER_173_CHUMP_FISH_2; @@ -213,7 +213,7 @@ void func_8035DA1C(Actor *this) { func_80328CA8(this, (s32) func_8035D590(sp40)); func_80328FB0(this, 10.0f); func_80328FF0(this, 10.0f); - sp38 = func_80329530(this, 0x12C); + sp38 = subaddie_playerIsWithinSphereAndActive(this, 0x12C); if ((this->state == 5) && sp38) { subaddie_set_state_with_direction(this, 6, 0.0f, -1); } diff --git a/src/core2/code_D9B0.c b/src/core2/code_D9B0.c index 9c7d7475..53a78d45 100644 --- a/src/core2/code_D9B0.c +++ b/src/core2/code_D9B0.c @@ -29,7 +29,7 @@ f32 func_80294940(void){ } f32 func_8029494C(void){ - return D_8037C2F0.unk0 - func_80294500(); + return D_8037C2F0.unk0 - floor_getCurrentFloorYPosition(); } enum asset_e func_80294974(void){ diff --git a/src/core2/code_DA760.c b/src/core2/code_DA760.c index b3074a5d..a281bc6c 100644 --- a/src/core2/code_DA760.c +++ b/src/core2/code_DA760.c @@ -14,7 +14,7 @@ ActorInfo D_803731B0 = { /* .code */ int func_803616F0(Actor *this){ - switch(this->unkF4_8){ + switch(this->actorTypeSpecificField){ case 1:// L80361728 return fileProgressFlag_get(FILEPROG_31_MM_OPEN) && !chmole_learnedAllLevelAbilities(LEVEL_1_MUMBOS_MOUNTAIN); case 2:// L80361750 @@ -46,20 +46,20 @@ void func_80361870(Actor *this){ this->volatile_initialized = TRUE; } - if(!this->has_met_before && func_80329530(this, 400) && !func_80329530(this, 50)){ - if(this->unkF4_8 == 1 && !fileProgressFlag_get(FILEPROG_31_MM_OPEN) && level_get() == LEVEL_6_LAIR){ + if(!this->has_met_before && subaddie_playerIsWithinSphereAndActive(this, 400) && !subaddie_playerIsWithinSphereAndActive(this, 50)){ + if(this->actorTypeSpecificField == 1 && !fileProgressFlag_get(FILEPROG_31_MM_OPEN) && level_get() == LEVEL_6_LAIR){ text_id = fileProgressFlag_get(FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT)? 0xF80 : 0xF7F; - if(gcdialog_showText(text_id, 0, 0, 0, 0, 0)){ + if(gcdialog_showDialog(text_id, 0, 0, 0, 0, 0)){ this->has_met_before = TRUE; } } else if(func_803616F0(this)){ - sp28 = (volatileFlag_get(VOLATILE_FLAG_16)?0xf6e:0xf68) + this->unkF4_8 - 1; + sp28 = (volatileFlag_get(VOLATILE_FLAG_16)?0xf6e:0xf68) + this->actorTypeSpecificField - 1; if(!volatileFlag_get(VOLATILE_FLAG_16) && level_get() == LEVEL_6_LAIR){ this->has_met_before = TRUE; } else{ - if(gcdialog_showText(sp28, 0, 0, 0, 0, 0)){ + if(gcdialog_showDialog(sp28, 0, 0, 0, 0, 0)){ this->has_met_before = TRUE; volatileFlag_set(VOLATILE_FLAG_16, 0); } diff --git a/src/core2/code_DAAA0.c b/src/core2/code_DAAA0.c index 3dfc2c67..a5063fa1 100644 --- a/src/core2/code_DAAA0.c +++ b/src/core2/code_DAAA0.c @@ -83,7 +83,7 @@ Struct62s D_803731E0[0x20] = { /* .code */ void func_80361A30(f32 arg0[3], s32 arg1){ if(viewport_isPointOutsideFrustum_vec3f(arg0)){ - func_8030E6A4(arg1 >> 16, ((arg1 >> 8) & 0xff)*0.0078125, (arg1 & 0xff)*128.0); + gcsfx_playWithPitch(arg1 >> 16, ((arg1 >> 8) & 0xff)*0.0078125, (arg1 & 0xff)*128.0); } } diff --git a/src/core2/code_DB010.c b/src/core2/code_DB010.c index 10e37d8f..e11e5262 100644 --- a/src/core2/code_DB010.c +++ b/src/core2/code_DB010.c @@ -44,7 +44,7 @@ void func_80361FA0(f32 arg0[3]) { particleEmitter_setAngularVelocityRange(pCtrl, -200.0f, 200.0f, -200.0f, 200.0f, 200.0f, 200.0f); particleEmitter_func_802EF9F8(pCtrl, 0.01f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setSfx(pCtrl, SFX_2F_ORANGE_SPLAT, 16000); particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_80373334); func_802EFC28(pCtrl, &D_80373304); @@ -128,7 +128,7 @@ void func_80362274(f32 arg0[3]) { particleEmitter_setAngularVelocityRange(pCtrl, -400.0f, -200.0f, -400.0f, 400.0f, -400.0f, 400.0f); particleEmitter_func_802EF9F8(pCtrl, 0.01f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_80373514); func_802EFC28(pCtrl, &D_803734E4); } @@ -148,7 +148,7 @@ void func_8036233C(f32 arg0[3]) { particleEmitter_setAngularVelocityRange(pCtrl, -200.0f, 200.0f, -200.0f, 200.0f, 200.0f, 200.0f); particleEmitter_func_802EF9F8(pCtrl, 0.01f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8037358C); func_802EFC28(pCtrl, &D_8037355C); } @@ -477,7 +477,7 @@ void func_80362DC0(f32 arg0[3]){ particleEmitter_setAngularVelocityRange(pCtrl, -200.0f, 200.0f, -200.0f, 200.0f, 200.0f, 200.0f); particleEmitter_func_802EF9F8(pCtrl, 0.4f); particleEmitter_func_802EFA18(pCtrl, 3); - func_802EFA20(pCtrl, 1.0f, 1.3f); + particleEmitter_func_802EFA20(pCtrl, 1.0f, 1.3f); particleEmitter_setDrawMode(pCtrl, 2); particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_80373D78); func_802EFC28(pCtrl, &D_80373D48); @@ -486,7 +486,7 @@ void func_80362DC0(f32 arg0[3]){ void func_80362E94(Actor *this){ f32 tick = time_getDelta(); - switch(this->unkF4_8){ + switch(this->actorTypeSpecificField){ case 0x3: //L80362ED8 if(viewport_func_8024DB50(this->position, 50.0f) && randf() < 0.2){ func_80362084(this->position); @@ -540,7 +540,7 @@ void func_80362E94(Actor *this){ this->lifetime_value = MAX(0.0, this->lifetime_value - tick); if(0.0f == this->lifetime_value){ - switch(this->unkF4_8){ + switch(this->actorTypeSpecificField){ case 2: //L8036325C func_80361FA0(this->position); break; diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index d196e973..554dd2e4 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -202,7 +202,7 @@ void func_80295914(void){ func_80295DD0(); func_80296C30(); baphysics_init(); - func_80297C78(); + bsiFrame_reset(); pitch_reset(); climbClear(); func_8029887C(); @@ -225,7 +225,7 @@ void func_80295914(void){ basfx_reset(); func_8029A4D0(); func_8029ADCC(); - func_8029D01C(); + hazards_reset(); func_802958A0(); } @@ -249,7 +249,8 @@ void func_80295B04(void){ bsStoredState_setLongLegTimer(sp24); sp24 = 0.0f; is_in_talon_trot = FALSE; - if(bsbtrot_inSet(sp20)){ + + if (bsbtrot_inSet(sp20)) { sp24 = stateTimer_get(STATE_TIMER_3_TURBO_TALON); is_in_talon_trot = TRUE; } @@ -268,7 +269,7 @@ void func_80295B04(void){ basfx_free(); func_8029A54C(); func_8029ADA8(); - func_8029CFF8(); + freeHazardSfxId(); D_80363820 = 0; } @@ -307,8 +308,8 @@ void func_80295C14(void){ bacarry_update(); snackerctl_update(); func_8028B71C(); - func_8029D968(); - func_80297CF8(); + hazards_update(); + bsiFrame_update(); func_80294E60(); cameraMode_update(); func_802919A0(); diff --git a/src/core2/code_EF50.c b/src/core2/code_EF50.c index 696764e2..b982ccca 100644 --- a/src/core2/code_EF50.c +++ b/src/core2/code_EF50.c @@ -279,7 +279,7 @@ void func_80296590(void){ break; } - func_8029A86C(1); + bs_setInterruptResponse(1); bs_setState(0); } @@ -381,8 +381,8 @@ void func_80296608(void){ next_state = func_8029B504(); sp2C = 2; break; - case BS_INTR_1F: //L80296868 - if(func_80297C6C() != 3 && baMarker_isCollidable()){ + case BS_INTR_1F_HAZARD: //L80296868 + if(bsiFrame_getState() != 3 && baMarker_isCollidable()){ case BS_INTR_31: //L8029688C func_802960C4(2); item_dec(ITEM_14_HEALTH); @@ -391,7 +391,7 @@ void func_80296608(void){ } break; case BS_INTR_21: //L802968B4 - if(func_80297C6C() != 3){ + if(bsiFrame_getState() != 3){ case BS_INTR_33: //L802968C8 func_802960C4(0); item_dec(ITEM_14_HEALTH); @@ -400,7 +400,7 @@ void func_80296608(void){ } break; case BS_INTR_20: //L802968F0 - if(func_80297C6C() != 3){ + if(bsiFrame_getState() != 3){ func_802960C4(1); item_dec(ITEM_14_HEALTH); next_state = func_802962BC(0); @@ -523,7 +523,7 @@ void func_80296608(void){ } break; }//L80296C0C - func_8029A86C(sp2C); + bs_setInterruptResponse(sp2C); bs_setState(next_state); } diff --git a/src/core2/commonParticle.c b/src/core2/commonParticle.c new file mode 100644 index 00000000..73a48066 --- /dev/null +++ b/src/core2/commonParticle.c @@ -0,0 +1,361 @@ +#include +#include "functions.h" +#include "variables.h" + +#include "core2/anim/sprite.h" +#include "core2/commonParticle.h" + +extern s32 func_8033FA84(void); +extern s32 commonParticleTypeMap_findFree(void); +extern s32 func_80344CDC(void); +extern void marker_setCommonParticleIndex(s32, s32); +extern void commonParticleTypeMap_advanceParticleType(s32, u32); +extern void func_8033FFB8(s32 , s32); +extern void projectile_getPosition(s32, f32[3]); +extern void func_8032F64C(f32[3] , ActorMarker *); +extern void projectile_freeByIndex(s32); +extern void commonParticleTypeMap_freeByIndex(s32); +extern void func_80344D70(s32); +extern void commonParticleTypeMap_updateByIndex(s32); +extern ActorMarker *func_8032FBE4(f32 *pos, MarkerDrawFunc arg1, int arg2, enum asset_e model_id); + +extern void (*func_80352614)(void); +extern void (*func_8035261C)(void); +extern void (*func_803526DC)(void); +extern void (*func_80355D58)(void); +extern void (*func_80355E80)(void); +extern void (*func_80355D50)(void); +extern void (*fxegg_head_spawn)(void); +extern void (*fxegg_head_update)(void); +extern void (*fxegg_head_destroy)(void); +extern void (*func_803546E8)(void); +extern void (*func_8035489C)(void); +extern void (*func_80354990)(void); +extern void (*fxegg_ass_spawn)(void); +extern void (*fxegg_ass_update)(void); +extern void (*fxegg_ass_destroy)(void); +extern void (*func_8035611C)(void); +extern void (*func_803562E8)(void); +extern void (*func_80356364)(void); +extern void (*func_80352DE4)(void); +extern void (*func_80352F58)(void); +extern void (*func_80352FF4)(void); +extern void (*jiggyShine_init)(void); +extern void (*jiggyShine_update)(void); +extern void (*jiggyShine_free)(void); +extern void (*func_80354DD0)(void); +extern void (*func_80354EEC)(void); +extern void (*func_80355004)(void); +extern void (*func_8035500C)(void); +extern void (*func_80355134)(void); +extern void (*func_80355294)(void); +extern void (*func_803540B4)(void); +extern void (*func_803541D8)(void); +extern void (*func_803540AC)(void); +extern void (*func_8035529C)(void); +extern void (*func_803553E8)(void); +extern void (*func_80355548)(void); +extern void (*func_80355550)(void); +extern void (*func_8035570C)(void); +extern void (*func_8035585C)(void); +extern void (*func_803543FC)(void); +extern void (*func_8035451C)(void); +extern void (*func_803543F4)(void); +extern void (*func_80355864)(void); +extern void (*func_80355B00)(void); +extern void (*func_80355C4C)(void); + +typedef struct { + u8 unk0; + u8 unk1; + f32 unk4; +} Struct_Core2_B6CE0_1; + +void freeParticleByIndex(s32 arg0); + +/* .data */ +Struct_Core2_B6CE0_1 D_80371E30[] ={ + { 0, 0, 0.0f }, + { 1, 0, 0.07f }, + { 2, 1, 0.29f }, + { 3, 2, 0.15f }, + { 4, 1, 0.05f } +}; + +/* .bss */ +CommonParticle particles[PARTICLE_LIMIT]; +s32 currentIndex; + +struct { + s32 index; + s32 previous; +} indexStash; + +u8 commonParticleActive; + +/* .code */ +f32 func_8033DE30(s32 arg0){ + return D_80371E30[arg0].unk4; +} + +s32 func_8033DE44(s32 arg0){ + return D_80371E30[arg0].unk1 & 1; +} + +Actor *commonParticle_markerDrawFunction(ActorMarker *marker) { + int index = marker->commonParticleIndex; + + func_8033F7F0(particles[index].projectileIndex); + + if (marker); + + return 0; +} + +void commonParticle_init(void) { + int i; + + for (i = 0; i < PARTICLE_LIMIT; i++) { + particles[i].isInUse = FALSE; + } + + indexStash.index = indexStash.previous = 0; + + commonParticleType_set(COMMON_PARTICLE_1_EGG_HEAD, &fxegg_head_spawn, &fxegg_head_update, &fxegg_head_destroy, 0, 1); //bsbEggAss + commonParticleType_set(COMMON_PARTICLE_2, &func_803546E8, &func_8035489C, &func_80354990, 0, 8); //bsbWhirl //aka wonderwing + commonParticleType_set(COMMON_PARTICLE_4_EGG_ASS, &fxegg_ass_spawn, &fxegg_ass_update, &fxegg_ass_destroy, 0, 1); + commonParticleType_set(COMMON_PARTICLE_6, &func_8035611C, &func_803562E8, &func_80356364, 0, 8); + commonParticleType_set(COMMON_PARTICLE_7, &func_80352DE4, &func_80352F58, &func_80352FF4, 0, 8); + commonParticleType_set(COMMON_PARTICLE_8_JIGGY_SHINE, &jiggyShine_init, &jiggyShine_update, &jiggyShine_free, 0, 8); + commonParticleType_set(COMMON_PARTICLE_9, &func_80354DD0, &func_80354EEC, &func_80355004, 0, 8); //orange_pad? + commonParticleType_set(COMMON_PARTICLE_A, &func_8035500C, &func_80355134, &func_80355294, 0, 8); + commonParticleType_set(COMMON_PARTICLE_B, &func_803540B4, &func_803541D8, &func_803540AC, 0, 8); + commonParticleType_set(COMMON_PARTICLE_C, &func_8035529C, &func_803553E8, &func_80355548, 0, 8); + commonParticleType_set(COMMON_PARTICLE_D, &func_80355550, &func_8035570C, &func_8035585C, 0, 8); + commonParticleType_set(COMMON_PARTICLE_E, &func_803543FC, &func_8035451C, &func_803543F4, 0, 8); + commonParticleType_set(COMMON_PARTICLE_F, &func_80355864, &func_80355B00, &func_80355C4C, 0, 8); + commonParticleType_set(COMMON_PARTICLE_10, &func_80355D58, &func_80355E80, &func_80355D50, 0, 8); + commonParticleType_set(COMMON_PARTICLE_11, &func_8035261C, &func_803526DC, &func_80352614, 0, 8); //mumbotoken sparkle +} + +void commonParticle_freeAllParticles(void) { + int i; + + for (i = 0; i < PARTICLE_LIMIT; i++) { + if (particles[i].isInUse) { + freeParticleByIndex(i); + } + } +} + +void commonParticle_update(void) { + f32 position[3]; + int i; + + if (!commonParticleActive) { + return; + } + + for (i = 0; i < PARTICLE_LIMIT; i++) { + if (!particles[i].isInUse) { + continue; + } + + currentIndex = i; + commonParticleTypeMap_updateByIndex(particles[currentIndex].typeMapIndex); + + if (particles[currentIndex].isInUse) { + projectile_getPosition(particles[currentIndex].projectileIndex, position); + func_803451B0(particles[currentIndex].unk47, position); + projectile_setPosition(particles[currentIndex].projectileIndex, position); + animsprite_update(particles[currentIndex].animSprite); + func_8033FFB8(particles[currentIndex].projectileIndex, animsprite_get_frame(particles[currentIndex].animSprite)); + func_8032F64C(position, particles[currentIndex].marker_30); + } else { + freeParticleByIndex(i); + } + } +} + +s32 commonParticle_findFree(void) { + int i; + + for (i = 0; i < PARTICLE_LIMIT; i++) { + if (particles[i].isInUse == FALSE) { + particles[i].isInUse++; + return i; + } + } + + return -1; +} + +int commonParticle_new(enum common_particle_e particle_id, int arg1) { + f32 sp34[3]; + s32 reference; + + if (arg1 == 0) { + return -1; + } + + ml_vec3f_clear(sp34); + currentIndex = commonParticle_findFree(); + if (currentIndex < 0) { + return -1; + } + + particles[currentIndex].projectileIndex = func_8033FA84(); + particles[currentIndex].animSprite = animsprite_new(); + particles[currentIndex].typeMapIndex = commonParticleTypeMap_findFree(); + particles[currentIndex].unk47 = func_80344CDC(); + + if(!(reference = particles[currentIndex].projectileIndex) + || !particles[currentIndex].animSprite + || !particles[currentIndex].typeMapIndex + || !particles[currentIndex].unk47) { //L8033E4DC + + if (reference) { + projectile_freeByIndex(reference); + } + + reference = particles[currentIndex].animSprite; + if (reference) { + animsprite_free(reference); + } + + reference = particles[currentIndex].typeMapIndex; + if (reference) { + commonParticleTypeMap_freeByIndex(reference); + } + + reference = particles[currentIndex].unk47; + if (reference) { + func_80344D70(reference); + } + + particles[currentIndex].isInUse = FALSE; + + return -1; + } + + //L8033E5B4 + particles[currentIndex].marker_30 = func_8032FBE4(sp34, commonParticle_markerDrawFunction, 1, commonParticleType_80352C7C(particle_id)); + particles[currentIndex].marker_30->unk40_22 = 1; + marker_setCommonParticleIndex(particles[currentIndex].marker_30, (u32) currentIndex); + particles[currentIndex].marker_30->collidable = FALSE; + commonParticleTypeMap_advanceParticleType(particles[currentIndex].typeMapIndex, particle_id); + func_8033FFB8(particles[currentIndex].projectileIndex, animsprite_get_frame(particles[currentIndex].animSprite)); + projectile_getPosition(particles[currentIndex].projectileIndex, sp34); + func_8032F64C(sp34, particles[currentIndex].marker_30); + + return currentIndex; +} + +void freeParticleByIndex(s32 index) { + commonParticleTypeMap_freeByIndex(particles[index].typeMapIndex); + func_80344D70(particles[index].unk47); + projectile_freeByIndex(particles[index].projectileIndex); + animsprite_free(particles[index].animSprite); + marker_free(particles[index].marker_30); + particles[index].marker_30 = NULL; + particles[index].actorMarker = 0; + particles[index].isInUse = 0; +} + +void commonParticle_add(s32 actorMarker, s32 arg1, FuncUnk40 arg2) { + s32 index = commonParticle_findFree(); + particles[index].isInUse--; + particles[index].actorMarker = actorMarker; + particles[index].unk3C = arg1; + particles[index].unk40 = arg2; +} + +void commonParticle_modifyCurrent(s32 arg0, s32 arg1, FuncUnk40 arg2) { + particles[currentIndex].actorMarker = arg0; + particles[currentIndex].unk3C = arg1; + particles[currentIndex].unk40 = arg2; +} + +void commonParticle_freeParticleByActorMarker(s32 actorMarker) { + int i; + + for (i = 0; i < PARTICLE_LIMIT; i++) { + if (particles[i].isInUse && actorMarker == (s32)particles[i].actorMarker) { + freeParticleByIndex(i); + } + } +} + +ActorMarker *func_8033E840(void) { + return particles[currentIndex].marker_30; +} + +ActorMarker *commonParticle_getCurrentActorMarker(void) { + return particles[currentIndex].actorMarker; +} + +FuncUnk40 func_8033E888(void) { + return particles[currentIndex].unk40; +} + +s32 func_8033E8AC(void) { + return particles[currentIndex].unk3C; +} + +u8 commonParticle_getCurrentProjectileIndex(void) { + return particles[currentIndex].projectileIndex; +} + +AnimSprite *commonParticle_getCurrentAnimSprite(void) { + return particles[currentIndex].animSprite; +} + +u8 commonParticle_getCurrentTypeMapIndex(void) { + return particles[currentIndex].typeMapIndex; +} + +u8 func_8033E93C(void) { + return particles[currentIndex].unk47; +} + +CommonParticle *commonParticle_getCurrentParticle(void) { + return &particles[currentIndex]; +} + +void commonParticle_setCurrentInUseFalse(void) { + particles[currentIndex].isInUse = FALSE; +} + +void commonParticle_freeParticleByIndex(s32 index) { + freeParticleByIndex(index); +} + +void commonParticle_setCurrentIndex(s32 index) { + currentIndex = index; +} + +void commonParticle_stashCurrentIndex(void) { + indexStash.previous = indexStash.index; + indexStash.index = currentIndex; +} + +void commonParticle_applyIndexStash(void) { + currentIndex = indexStash.index; + indexStash.index = indexStash.previous; +} + +f32 func_8033EA14(s32 arg0) { + return *((f32 *)commonParticle_getCurrentParticle() + arg0); +} + +void func_8033EA40(s32 arg0, f32 arg1) { + *((f32 *)commonParticle_getCurrentParticle() + arg0) = arg1; +} + +void commonParticle_setActive(s32 arg0, s32 arg1) { + if (arg1 == 2) { + commonParticleActive = TRUE; + } else { + commonParticleActive = FALSE; + } +} diff --git a/src/core2/commonParticleTypeMap.c b/src/core2/commonParticleTypeMap.c new file mode 100644 index 00000000..c1762ee9 --- /dev/null +++ b/src/core2/commonParticleTypeMap.c @@ -0,0 +1,98 @@ +#include +#include "functions.h" +#include "variables.h" +#include "core2/commonParticle.h" + +extern GenFunction_0 commonParticleType_getFreeMethod(enum common_particle_e); +extern GenFunction_0 commonParticleType_getUpdateMethod(enum common_particle_e); + +typedef struct { + u8 prevParticleType; + u8 currentParticleType; + u8 nextParticleType; + u8 occupied; +} TypeMap; + +/* .bss */ +TypeMap typeMaps[PARTICLE_LIMIT]; + +void commonParticleTypeMap_freeAll(void) { + s32 i; + + for (i = 1; i < PARTICLE_LIMIT; i++) { + typeMaps[i].occupied = FALSE; + } +} + +void commonParticleTypeMap_unused(void) { + return; +} + +u8 commonParticleTypeMap_findFree(void) { + s32 i; + + for (i = 1; i < PARTICLE_LIMIT; i++) { + if (typeMaps[i].occupied) { + continue; + } + + typeMaps[i].occupied++; + typeMaps[i].prevParticleType = 0; + typeMaps[i].currentParticleType = 0; + typeMaps[i].nextParticleType = 0; + + return i; + } + + return 0; +} + +void commonParticleTypeMap_freeByIndex(u8 index) { + if (commonParticleType_getFreeMethod(typeMaps[index].currentParticleType) != NULL) { + commonParticleType_getFreeMethod(typeMaps[index].currentParticleType)(); + } + + typeMaps[index].occupied = FALSE; +} + +void commonParticleTypeMap_advanceParticleType(u8 index, enum common_particle_e nextType) { + void (*funcPtr)(void); + + if (!nextType) { + return; + } + + typeMaps[index].nextParticleType = nextType; + + if (commonParticleType_getFreeMethod(typeMaps[index].currentParticleType)) { + funcPtr = commonParticleType_getFreeMethod(typeMaps[index].currentParticleType); + funcPtr(); + } + + typeMaps[index].prevParticleType = typeMaps[index].currentParticleType; + typeMaps[index].currentParticleType = typeMaps[index].nextParticleType; + typeMaps[index].nextParticleType = 0; + + if (commonParticleType_getInitMethod(typeMaps[index].currentParticleType)) { + funcPtr = commonParticleType_getInitMethod(typeMaps[index].currentParticleType); + funcPtr(); + } +} + +s32 commonParticleTypeMap_getPreviousType(u8 index) { + return typeMaps[index].prevParticleType; +} + +s32 commonParticleTypeMap_getCurrentType(u8 index) { + return typeMaps[index].currentParticleType; +} + +s32 commonParticleTypeMap_getNextType(u8 index) { + return typeMaps[index].nextParticleType; +} + +void commonParticleTypeMap_updateByIndex(u8 index) { + if (commonParticleType_getUpdateMethod(typeMaps[index].currentParticleType) != NULL) { + commonParticleType_getUpdateMethod(typeMaps[index].currentParticleType)(); + } +} diff --git a/src/core2/dustemitter.c b/src/core2/dustemitter.c new file mode 100644 index 00000000..336ceaff --- /dev/null +++ b/src/core2/dustemitter.c @@ -0,0 +1,98 @@ +#include +#include "functions.h" +#include "variables.h" + +#include "core2/particle.h" + +#include "core2/dustemitter.h" + +s16 emitterAssets[EMITTER_COUNT] = { + ASSET_700_SPRITE_DUST, + ASSET_702_SPRITE_UNKNOWN, + ASSET_70D_SPRITE_SMOKE_1 +}; + +u8 emitterIndexes[EMITTER_COUNT]; + +s32 dustEmitter_returnGiven(s32 value) { + return value; +} + +void dustEmitter_empty(ParticleEmitter *this) { + return; +} + +bool dustEmitter_isActive(s32 index) { + return (index < EMITTER_COUNT) ? !particleEmitter_isDone(pem_getEmitterByIndex(emitterIndexes[index])) : FALSE; +} + +void dustEmitter_init(void) { + s32 i; + + for (i = 0; i < EMITTER_COUNT; i++) { + emitterIndexes[i] = pem_newEmitter(EMITTER_CAPACITY); + } +} + +void dustEmitter_free(void) { + s32 i; + + for (i = 0; i < EMITTER_COUNT; i++) { + pem_free(emitterIndexes[i]); + } +} + +void dustEmitter_emit(f32 position[3], f32 velocity[3], s32 color[4], bool useDefaultDrawMode, f32 lifetime, + f32 additionalYVelocity, s32 startingScale, s32 finalScale, enum dust_emitter_type_e type) { + + s32 _1; + s32 _2; + s32 _3; + f32 velocity_range[3]; + s32 draw_mode; + ParticleEmitter *emitter; + + draw_mode = 0x28; + emitter = pem_getEmitterByIndex(emitterIndexes[type]); + particleEmitter_setSprite(emitter, emitterAssets[type]); + particleEmitter_setFade(emitter, 0.075f, 0.4f); + particleEmitter_setPosition(emitter, position); + particleEmitter_setSpawnIntervalRange(emitter, 0.0f, 0.0f); + particleEmitter_func_802EFA78(emitter, 1); + + if (velocity != NULL) { + ml_vec3f_scale_copy(velocity_range, velocity, 30.0f); + } else { + velocity_range[0] = velocity_range[1] = velocity_range[2] = 0.0f; + } + + if (additionalYVelocity != 0.0) { + velocity_range[1] += additionalYVelocity / lifetime; + } + + particleEmitter_setParticleVelocityRange(emitter, + velocity_range[0], velocity_range[1], velocity_range[2], // x, y, z min + velocity_range[0], velocity_range[1], velocity_range[2]); // x, y, z max + + if (color != NULL) { + particleEmitter_setRGB(emitter, color); + particleEmitter_setAlpha(emitter, color[3]); + } + + if (useDefaultDrawMode == FALSE) { + draw_mode = PART_EMIT_NO_OPA | PART_EMIT_NO_DEPTH | PART_EMIT_NO_LOOP; + } + + particleEmitter_setDrawMode(emitter, draw_mode); + particleEmitter_setParticleLifeTimeRange(emitter, lifetime, lifetime); + particleEmitter_setStartingScaleRange(emitter, startingScale / 175.0, startingScale / 175.0); + particleEmitter_setFinalScaleRange(emitter, (startingScale + finalScale) / 175.0, (startingScale + finalScale) / 175.0); + + if (type == DUST_EMITTER_TYPE_DUST) { + particleEmitter_setParticleFramerateRange(emitter, (15.0 / lifetime), (15.0 / lifetime)); + } else { + particleEmitter_setStartingFrameRange(emitter, 0, 0xC); + } + + particleEmitter_emitN(emitter, 1); +} diff --git a/src/core2/fx/healthscore.c b/src/core2/fx/healthscore.c index 0a693ded..95100a39 100644 --- a/src/core2/fx/healthscore.c +++ b/src/core2/fx/healthscore.c @@ -194,10 +194,10 @@ void fxhealthscore_update(enum item_e item_id, struct8s *arg1) { gHealth =gHealth + 1.0; } if (item_getCount(ITEM_14_HEALTH) < gHealth) { - func_8025A6EC(COMUSIC_2B_DING_B, 22000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 22000); } if (gHealth < (f32) item_getCount(ITEM_14_HEALTH)) { - func_8025A6EC(COMUSIC_2C_BUZZER, 22000); + coMusicPlayer_playMusic(COMUSIC_2C_BUZZER, 22000); } item_set(ITEM_14_HEALTH, (s32) gHealth); D_80381EF0 = 0; diff --git a/src/core2/fx/honeycarrierscore.c b/src/core2/fx/honeycarrierscore.c index adb1976f..94f60d7a 100644 --- a/src/core2/fx/honeycarrierscore.c +++ b/src/core2/fx/honeycarrierscore.c @@ -210,7 +210,7 @@ void fxhoneycarrierscore_update(s32 arg0, struct8s *arg1){ if(6.0f <= D_803815D4 && D_80381610 && D_803815E8 == 0xFF){ D_803815C0 = 1; D_803815DC = 20.0f; - func_8025A6EC(COMUSIC_18_HEALTH_UPGRADE, 28000); + coMusicPlayer_playMusic(COMUSIC_18_HEALTH_UPGRADE, 28000); }else{ if(1.0f < D_803815D4 && !D_80381610){ D_803815D8 += _76D90_MAX((((D_803815D4 - 1.0f) * 60.0 - D_803815D8) * sp24 * 3.0), 2.0); @@ -230,10 +230,10 @@ void fxhoneycarrierscore_update(s32 arg0, struct8s *arg1){ D_803815E4 = 0; D_803815E0 = 0.9999f; item_adjustByDiffWithHud(ITEM_13_EMPTY_HONEYCOMB, -6); - timedFunc_set_2(0.25f, (GenFunction_2)func_8025A6EC, COMUSIC_2B_DING_B, 28000); + timedFunc_set_2(0.25f, (GenFunction_2)coMusicPlayer_playMusic, COMUSIC_2B_DING_B, 28000); item_adjustByDiffWithHud(ITEM_14_HEALTH, 0); timedFunc_set_1(1.25f, (GenFunction_1)item_inc, ITEM_15_HEALTH_TOTAL); - timedFunc_set_1(1.25f, (GenFunction_1)sfxsource_playHighPriority, SFX_3EA_UNKNOWN); + timedFunc_set_1(1.25f, (GenFunction_1)sfxsource_playHighPriority, SFX_3EA_BANJO_GUH_HUH); timedFunc_set_2(1.25f, (GenFunction_2)item_set, ITEM_14_HEALTH, item_getCount(ITEM_15_HEALTH_TOTAL)+1); timedFunc_set_1(1.5f, (GenFunction_1)gcpausemenu_80314AC8, 1); } diff --git a/src/core2/fx/ripple.c b/src/core2/fx/ripple.c index 6d2c892b..2d6c1687 100644 --- a/src/core2/fx/ripple.c +++ b/src/core2/fx/ripple.c @@ -6,7 +6,7 @@ extern bool func_8024549C(f32[3], f32); extern void func_802EFAB0(ParticleEmitter *, s32, f32); extern void func_802F0EAC(ParticleEmitter *, f32); -extern ParticleEmitter *func_802F0EF0(u8); +extern ParticleEmitter *pem_getEmitterByIndex(u8); typedef union range_f32_u { f32 raw[2]; @@ -69,7 +69,7 @@ ParticleEmitter *__fxRipple_create(s32 arg0, f32 position[3], bool arg2){ return NULL; } spawn_position[1] += 3.0f; - p_emitter = func_802F0EF0(D_80380A60); + p_emitter = pem_getEmitterByIndex(D_80380A60); particleEmitter_setSprite(p_emitter, ASSET_70C_SPRITE_RIPPLE); particleEmitter_setDrawMode(p_emitter, PART_EMIT_ROTATABLE); if(sp44){ @@ -107,11 +107,11 @@ void fxRipple_802F3584(s32 arg0, f32 position[3], s32 arg2){ } void fxRipple_free(void){ - func_802F1190(D_80380A60); + pem_free(D_80380A60); } void fxRipple_init(void){ - D_80380A60 = func_802F0F78(0x19); + D_80380A60 = pem_newEmitter(0x19); } ParticleEmitter *fxRipple_802F35FC(s32 arg0, f32 position[3]){ @@ -123,6 +123,6 @@ ParticleEmitter *fxRipple_802F361C(s32 arg0, f32 position[3], s32 arg2){ } void fxRipple_802F363C(f32 arg0){ - func_802F0EAC(func_802F0EF0(D_80380A60), arg0); + func_802F0EAC(pem_getEmitterByIndex(D_80380A60), arg0); } diff --git a/src/core2/gc/dialog.c b/src/core2/gc/dialog.c index c70935d3..b6e3854b 100644 --- a/src/core2/gc/dialog.c +++ b/src/core2/gc/dialog.c @@ -2,104 +2,97 @@ #include "core1/core1.h" #include "functions.h" #include "variables.h" +#include "dialog.h" #include "zoombox.h" -extern void func_803114D0(void ); -extern int func_803114B0(void); +extern void func_803114D0(void); +extern int gcdialog_hasCurrentTextId(void); extern char *dialogBin_get(enum asset_e text_id); -s8 D_8036C4D0[] = {1, 0x1E, 0x14, 0xF, 0xB, 8, 6, 4, 3, 2, -1, -1}; +s8 Y_POSITION_MODIFIERS[] = { 1, 0x1E, 0x14, 0xF, 0xB, 8, 6, 4, 3, 2, -1, -1 }; /* .bss */ struct { char output[0x100]; u8 *dialog_bin_ptr; - struct13s *string_list[2]; //string ptr - char *string[2]; //current_string - u8 string_count[2]; //zoombox string_count - s8 string_cmd[2]; //current_cmd - u8 string_index[2]; //current_string_index + BKDialog *dialog[2]; // string ptr + char *string[2]; // current_string + u8 string_count[2]; // zoombox string_count + s8 string_cmd[2]; // current_cmd + u8 string_index[2]; // current_string_index struct15s unk11A[2]; GcZoombox *zoombox[2]; - s16 unk124[2]; - union{ + s16 zoomboxYPosition[2]; + + union { struct { u8 unk128_31; u8 state; u8 unk128_15; - u8 active_zoombox:1; //active_zoombox_index - u8 unk128_6:1; - u8 unk128_5:1; - u8 unk128_4:1; - u8 unk128_3:1; - u8 pad128_2:2; - u8 unk128_0:1; - u8 unk12C_31:2; - u8 unk12C_29:2; - u8 unk12C_27:2; - u8 unk12C_25:2; - s8 unk12C_23:8; - u8 unk12C_15:4; - u8 unk12C_11:4; - u8 pad12C_7:8; + u8 active_zoombox: 1; // active_zoombox_index + u8 unk128_6: 1; + u8 queueZoomboxYPositionModify: 1; + u8 zoomboxYPositionIndexDecremented: 1; + u8 unk128_3: 1; + u8 pad128_2: 2; + u8 unk128_0: 1; + u8 unk12C_31: 2; + u8 unk12C_29: 2; + u8 unk12C_27: 2; + u8 unk12C_25: 2; + s8 playerHasConfirmed: 8; + u8 unk12C_15: 4; + u8 unk12C_11: 4; + u8 pad12C_7: 8; } u8; struct { - u32 unk128_31:8; - u32 state:8; - u32 unk128_15:8; - u32 active_zoombox:1; //active_zoombox_index - u32 unk128_6:1; - u32 unk128_5:1; - u32 unk128_4:1; - u32 unk128_3:1; - u32 pad128_2:2; - u32 unk128_0:1; - u32 unk12C_31:2; - u32 unk12C_29:2; - u32 unk12C_27:2; - u32 unk12C_25:2; - s32 unk12C_23:8; - u32 unk12C_15:4; - u32 unk12C_11:4; - u32 pad12C_7:8; + u32 unk128_31: 8; + u32 state: 8; + u32 unk128_15: 8; + u32 active_zoombox: 1; // active_zoombox_index + u32 unk128_6: 1; + u32 queueZoomboxYPositionModify: 1; + u32 zoomboxYPositionIndexDecremented: 1; + u32 unk128_3: 1; + u32 pad128_2: 2; + u32 unk128_0: 1; + u32 unk12C_31: 2; + u32 unk12C_29: 2; + u32 unk12C_27: 2; + u32 unk12C_25: 2; + s32 playerHasConfirmed: 8; + u32 unk12C_15: 4; + u32 unk12C_11: 4; + u32 pad12C_7: 8; }; }; - s16 unk130; - s8 unk132; - u8 pad133[0x1]; + + s16 currentTextId; + s8 yPositionModifierIndex; + u8 pad133[0x1]; ActorMarker *caller; - s32 unk138; - void (* unk13C)(ActorMarker *, s32, s32); + s32 unk138; + void (* currentCallback)(ActorMarker *, s32, s32); void (* unk140)(ActorMarker *, s32, s32); - s32 (* unk144)(ActorMarker *, s32, s32); + s32 (* conditionalCallback)(ActorMarker *, s32, s32); struct14s unk148[4]; } g_Dialog; + char D_80382FF8[0x18]; /* .code */ -int func_8030EDC0(ActorMarker *caller, s32 arg1){ - return (arg1 == -1)? 0: caller->unk5C == arg1; +int func_8030EDC0(ActorMarker *caller, s32 arg1) { + return (arg1 == -1) ? 0 : caller->unk5C == arg1; } void gcdialog_init(void) { - s8 temp_t9; - u32 temp_t2; - u8 temp_a1; - u8 temp_t0; - u8 temp_t3; - u8 temp_t5; - u8 temp_t6; - u8 temp_t7; - u8 temp_t8; s32 i; - struct14s *i_ptr; - g_Dialog.dialog_bin_ptr = 0; - for( i = 0; i < 2; i++){ - g_Dialog.string_list[i] = NULL; + for (i = 0; i < 2; i++) { + g_Dialog.dialog[i] = NULL; g_Dialog.string_count[i] = 0; g_Dialog.zoombox[i] = NULL; g_Dialog.string_index[i] = NULL; @@ -109,8 +102,8 @@ void gcdialog_init(void) { g_Dialog.unk11A[i].unk0_5 = 0; } - for(i = 0; i < 4; i++){ - g_Dialog.unk148[i].unk0 = -1; + for (i = 0; i < 4; i++) { + g_Dialog.unk148[i].unk0 = -1; g_Dialog.unk148[i].unk2 = 0; g_Dialog.unk148[i].unk10 = NULL; g_Dialog.unk148[i].unk14 = 0; @@ -120,93 +113,99 @@ void gcdialog_init(void) { g_Dialog.unk148[i].unk4[0] = g_Dialog.unk148[i].unk4[1] = g_Dialog.unk148[i].unk4[2] = 0; } - g_Dialog.state = 0; - g_Dialog.unk128_31 = g_Dialog.unk128_5 = FALSE; + g_Dialog.state = DIALOG_STATE_0; + g_Dialog.unk128_31 = g_Dialog.queueZoomboxYPositionModify = FALSE; g_Dialog.unk12C_31 = g_Dialog.unk12C_29 = g_Dialog.unk12C_27 = g_Dialog.unk12C_25 = 0; g_Dialog.unk128_15 = g_Dialog.active_zoombox = FALSE; g_Dialog.unk128_6 = TRUE; - g_Dialog.unk12C_23 = -1; + g_Dialog.playerHasConfirmed = -1; g_Dialog.unk12C_15 = g_Dialog.unk12C_11 = 0; - g_Dialog.unk130 = (s16) -1; + g_Dialog.currentTextId = (s16) -1; g_Dialog.caller = NULL; - g_Dialog.unk13C = NULL; + g_Dialog.currentCallback = NULL; g_Dialog.unk140 = NULL; - g_Dialog.unk144 = 0; - g_Dialog.unk132 = 0xC; + g_Dialog.conditionalCallback = 0; + g_Dialog.yPositionModifierIndex = 12; // Length of array is 11, so intentionally setting out of bounds g_Dialog.unk128_3 = TRUE; } -static void _gcdialog_freeZoomboxes(void){ +static void freeZoomboxes(void) { s32 i; - for(i =0; i < 2; i++){ + for (i = 0; i < 2; i++) { gczoombox_free(g_Dialog.zoombox[i]); g_Dialog.zoombox[i] = NULL; } } -void func_8030F078(void){ - s32 i; - s32 j; - for(i = 0; i <2; i++){ - for(j =0; j < g_Dialog.string_count[i]; j++){ - g_Dialog.string_list[i][j].str = NULL; +void clearDialogStrings(void) { + s32 i, j; + for (i = 0; i < 2; i++) { + for (j = 0; j < g_Dialog.string_count[i]; j++) { + g_Dialog.dialog[i][j].str = NULL; } g_Dialog.string_count[i] = 0; - free(g_Dialog.string_list[i]); - g_Dialog.string_list[i] = NULL; + free(g_Dialog.dialog[i]); + g_Dialog.dialog[i] = NULL; } - if(g_Dialog.unk130 != -1){ - dialogBin_release(g_Dialog.unk130); + + if (g_Dialog.currentTextId != -1) { + dialogBin_release(g_Dialog.currentTextId); } + g_Dialog.dialog_bin_ptr = NULL; } -void func_8030F130(void){ - func_8030F078(); - if(g_Dialog.zoombox[1] != NULL && !g_Dialog.unk11A[1].unk0_7){ +void clearDialog(void) { + clearDialogStrings(); + + if (g_Dialog.zoombox[DIALOG_TOP] != NULL && !g_Dialog.unk11A[DIALOG_TOP].unk0_7) { func_80347A14(1); } - if(!g_Dialog.unk11A[0].unk0_7 && !g_Dialog.unk11A[1].unk0_7){ - _gcdialog_freeZoomboxes(); + + if (!g_Dialog.unk11A[DIALOG_BOTTOM].unk0_7 && !g_Dialog.unk11A[DIALOG_TOP].unk0_7) { + freeZoomboxes(); } - g_Dialog.unk130 = -1; + + g_Dialog.currentTextId = -1; g_Dialog.unk128_15 = 0; g_Dialog.unk128_31 = 0; g_Dialog.caller = NULL; - g_Dialog.unk13C = NULL; + g_Dialog.currentCallback = NULL; g_Dialog.unk140 = NULL; - g_Dialog.unk144 = NULL; + g_Dialog.conditionalCallback = NULL; } -void func_8030F1D0(void){ - if(func_803114B0()){ +void func_8030F1D0(void) { + if (gcdialog_hasCurrentTextId()) { func_8025A55C(-1, 300, 2); } + func_803114D0(); - func_8030F130(); - g_Dialog.state = 0; + clearDialog(); + g_Dialog.state = DIALOG_STATE_0; } -void func_8030F218(char *next_state, char *arg1, char *arg2, bool arg3, bool arg4) { +void replaceText(char *next_state, char *arg1, char *arg2, bool arg3, bool arg4) { s32 var_v0; s32 i; s32 j; - var_v0 = 0;\ - for(i = 0; arg1[i] != '\0'; i++){ + var_v0 = 0; + for (i = 0; arg1[i] != '\0'; i++) { if (arg1[i] == ((arg3) ? 0xE : '~')) { if (arg4) { next_state[var_v0++] = 0xFD; next_state[var_v0++] = 0x68; } - for(j = 0 ; arg2[j] != '\0'; j++){ + for (j = 0; arg2[j] != '\0'; j++) { next_state[var_v0++] = arg2[j]; if (arg4 && !arg3 && arg2[j] == ' ') { next_state[var_v0++] = 0xFD; next_state[var_v0++] = 0x68; } } + if (arg4) { next_state[var_v0++] = 0xFD; next_state[var_v0++] = 0x6C; @@ -215,153 +214,163 @@ void func_8030F218(char *next_state, char *arg1, char *arg2, bool arg3, bool arg next_state[var_v0++] = arg1[i]; } } + next_state[var_v0] = '\0'; } -void func_8030F338(void){ - if(g_Dialog.unk13C != NULL){ - if(g_Dialog.caller == NULL){ - g_Dialog.unk13C(g_Dialog.caller, g_Dialog.unk130, g_Dialog.unk12C_23); - }else{ - if(func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)){ - g_Dialog.unk13C(g_Dialog.caller, g_Dialog.unk130, g_Dialog.unk12C_23); +void func_8030F338(void) { + if (g_Dialog.currentCallback != NULL) { + if (g_Dialog.caller == NULL) { + g_Dialog.currentCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.playerHasConfirmed); + } else { + if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + g_Dialog.currentCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.playerHasConfirmed); } } } - if(g_Dialog.unk128_31 & 0x8){ - if((!func_802E4A08() && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3){ - func_8028F918(0); - } - }//L8030F3E8 + + if (g_Dialog.unk128_31 & 0x8) { + if ((!func_802E4A08() && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3) { + func_8028F918(0); + } + } //L8030F3E8 + func_8025A55C(-1, 0x12c, 2); - func_8030F130(); + clearDialog(); } -void gcdialog_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ +void gcdialog_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 i; - for(i = 0; i<2; i++){ + for (i = 0; i < 2; i++) { gczoombox_draw(g_Dialog.zoombox[i], gfx, mtx, vtx); } } -void gcdialog_setState(s32 next_state){ - s32 i; - s32 j; - s32 v0 = 6; +void dialog_setState(DialogState next_state) { + s32 i, j; + s32 v0 = DIALOG_STATE_6; - if(v0); - if(g_Dialog.state != v0 || next_state != v0){ - switch(next_state){ - case 1: - for(i = 0; i < 2; i++){ - if(g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0) - gczoombox_open(g_Dialog.zoombox[i]); + if (v0); // _possibly_ a debug assert that got optimized to an if. Can't remove it though! + + if (g_Dialog.state == v0 && next_state == v0) { + return; + } + + switch (next_state) { + case DIALOG_STATE_1: + for (i = 0; i < 2; i++) { + if (g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0) { + gczoombox_open(g_Dialog.zoombox[i]); } - break; + } + break; - case 5: - for(i =0; i < 2; i++){ - if(g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0){ - gczoombox_minimize(g_Dialog.zoombox[i]); - gczoombox_close(g_Dialog.zoombox[i]); - } + case DIALOG_STATE_5: + for (i = 0; i < 2; i++) { + if (g_Dialog.zoombox[i] != NULL && g_Dialog.unk11A[i].unk0_7 == 0) { + gczoombox_minimize(g_Dialog.zoombox[i]); + gczoombox_close(g_Dialog.zoombox[i]); } - break; + } + break; - case 6: - for(i = 0; i< 2; i++){//L8030F59C - for(j = g_Dialog.string_index[i]; g_Dialog.string_list[i][j].cmd < -4 || g_Dialog.string_list[i][j].cmd >= 0; j++){ - if(g_Dialog.string_list[i][j].cmd == -7 && g_Dialog.unk140){ - if(g_Dialog.caller == NULL){ - g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string_list[i][j].str); - }else{ - if(func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)){ - g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string_list[i][j].str); - } + case DIALOG_STATE_6: + for (i = 0; i < 2; i++) { //L8030F59C + for (j = g_Dialog.string_index[i]; g_Dialog.dialog[i][j].cmd < -4 || g_Dialog.dialog[i][j].cmd >= 0; j++) { + if (g_Dialog.dialog[i][j].cmd == -7 && g_Dialog.unk140) { + if (g_Dialog.caller == NULL) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.currentTextId, *g_Dialog.dialog[i][j].str); + } else { + if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.currentTextId, *g_Dialog.dialog[i][j].str); } } } } - g_Dialog.unk12C_25 = 0; - for(i=0; i< 2; i++){ - g_Dialog.unk11A[i].unk0_7 = 0; - if(g_Dialog.zoombox[i] != NULL){ - g_Dialog.unk12C_25 += (u8)func_803188B4(g_Dialog.zoombox[i]); - } - } - break; + } - case 7: - func_8030F338(); - next_state = 0; - break; - case 8: - func_8030F338(); - for(i=0; i<2; i++){ - if(g_Dialog.unk11A[i].unk0_7 == 0){ - gczoombox_free(g_Dialog.zoombox[i]); - g_Dialog.zoombox[i] = NULL; - } + g_Dialog.unk12C_25 = 0; + for (i = 0; i < 2; i++) { + g_Dialog.unk11A[i].unk0_7 = 0; + if (g_Dialog.zoombox[i] != NULL) { + g_Dialog.unk12C_25 += (u8)func_803188B4(g_Dialog.zoombox[i]); } - break; - default: - break; - } - g_Dialog.state = next_state; + } + break; + + case DIALOG_STATE_7: + func_8030F338(); + next_state = DIALOG_STATE_0; + break; + + case DIALOG_STATE_8: + func_8030F338(); + for (i = 0; i < 2; i++) { + if (g_Dialog.unk11A[i].unk0_7 == 0) { + gczoombox_free(g_Dialog.zoombox[i]); + g_Dialog.zoombox[i] = NULL; + } + } + break; + + default: + break; } - + + g_Dialog.state = next_state; } -void func_8030F754(GcZoomboxSprite portrait_id, s32 arg1){ +void newZoomboxCallback(GcZoomboxSprite portrait_id, s32 state) { s32 temp_a0; s32 temp_v0; - switch(arg1){ + switch (state) { case 1: //L8030F790 g_Dialog.unk12C_31++; break; case 3: //L8030F7BC - gcdialog_setState(2); + dialog_setState(DIALOG_STATE_2); break; case 4: //L8030F7CC - if(g_Dialog.state == 6){ + if (g_Dialog.state == DIALOG_STATE_6) { g_Dialog.unk12C_25--; - if(g_Dialog.unk12C_25 == 0){ + if (g_Dialog.unk12C_25 == 0) { temp_a0 = ((g_Dialog.unk11A[0].unk0_7) ? 1 : 0); temp_v0 = ((g_Dialog.unk11A[1].unk0_7) ? 1 : 0); - gcdialog_setState((temp_v0 + temp_a0) ? 8 : 5); - }//L8030F980 + dialog_setState((temp_v0 + temp_a0) ? DIALOG_STATE_8 : DIALOG_STATE_5); + } //L8030F980 break; } temp_v0 = ((g_Dialog.unk11A[0].unk0_7) ? 1 : 0) + ((g_Dialog.unk11A[1].unk0_7) ? 1 : 0); - if(temp_v0 > (s32)g_Dialog.unk12C_29){ + if (temp_v0 > (s32)g_Dialog.unk12C_29) { g_Dialog.unk12C_29++; - if(g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27){ - gcdialog_setState(8); + if (g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27) { + dialog_setState(DIALOG_STATE_8); } } break; case 6: //L8030F8FC g_Dialog.unk12C_27++; - if(g_Dialog.unk12C_27 == g_Dialog.unk128_15){ - gcdialog_setState(7); - }//L8030F964 + if (g_Dialog.unk12C_27 == g_Dialog.unk128_15) { + dialog_setState(DIALOG_STATE_7); + } //L8030F964 - if(g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27){ - gcdialog_setState(8); + if (g_Dialog.unk128_15 == g_Dialog.unk12C_29 + g_Dialog.unk12C_27) { + dialog_setState(DIALOG_STATE_8); } + break; - }//L8030F984 + } //L8030F984 } -#define CMD(i) (g_Dialog.string_list[g_Dialog.u8.active_zoombox] + i) -#define CMD2(i) (&g_Dialog.string_list[g_Dialog.u8.active_zoombox][i]) +#define CMD(i) (g_Dialog.dialog[g_Dialog.u8.active_zoombox] + i) +#define CMD2(i) (&g_Dialog.dialog[g_Dialog.u8.active_zoombox][i]) -void gcdialog_update(void) { +void dialog_update(void) { s32 i; s32 spA8; s32 controller_face_buttons[6]; @@ -378,243 +387,246 @@ void gcdialog_update(void) { func_8024E640(0, controller_side_buttons); } else { controller_copyFaceButtons(0, controller_face_buttons); - func_8024E60C(0, controller_side_buttons); + controller_copySideButtons(0, controller_side_buttons); } - switch (g_Dialog.state) { - case 1: - for(spA8 = 0, i = 0; i < 2; i++){ - if(g_Dialog.zoombox[i] == NULL){ - spA8++; + switch (g_Dialog.state) { + case DIALOG_STATE_1: + for (spA8 = 0, i = 0; i < 2; i++) { + if (g_Dialog.zoombox[i] == NULL) { + spA8++; + } } - } - if (spA8 == 2) { - gcdialog_setState(7); - } else if (g_Dialog.u8.unk12C_31 == g_Dialog.u8.unk128_15) { - g_Dialog.u8.unk12C_31 = 0; - gcdialog_setState(2); - } - break; - case 2: - if (g_Dialog.zoombox[g_Dialog.u8.active_zoombox] == NULL || func_80318BEC(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]) || g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5) { - g_Dialog.u8.active_zoombox ^= 1; - } else { - g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; - g_Dialog.string[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str; - - switch (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox]) { - case -2: - if (g_Dialog.string_index[g_Dialog.u8.active_zoombox] == 0) { - g_Dialog.u8.unk12C_29++; - } - gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 1; - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; + if (spA8 == 2) { + dialog_setState(DIALOG_STATE_7); + } else if (g_Dialog.u8.unk12C_31 == g_Dialog.u8.unk128_15) { + g_Dialog.u8.unk12C_31 = 0; + dialog_setState(DIALOG_STATE_2); + } + break; + + case DIALOG_STATE_2: + if (g_Dialog.zoombox[g_Dialog.u8.active_zoombox] == NULL || func_80318BEC(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]) || g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5) { g_Dialog.u8.active_zoombox ^= 1; - g_Dialog.unk128_6 = TRUE; - break; - - case -1: // Choice - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 2; - gcdialog_setState(4); - break; - - case -4: // Close - gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - gczoombox_close(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; - g_Dialog.u8.active_zoombox ^= 1; - g_Dialog.unk128_6 = TRUE; - break; - - case -7: // Trigger - if (g_Dialog.unk140 != NULL) { - if (g_Dialog.caller == NULL) { - g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string[g_Dialog.u8.active_zoombox]); - } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { - g_Dialog.unk140(g_Dialog.caller, g_Dialog.unk130, *g_Dialog.string[g_Dialog.u8.active_zoombox]); - } - } - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - break; - - case -9: // Substitute integer - case -8: // Conditional text - do { - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; - } while (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -8 || g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -9); - break; - - case -6: // Conditional minimize - for(spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD2(spA8)->cmd < -4; spA8++); - - if (CMD2(spA8)->cmd >= 0) { - gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); - } - if (g_Dialog.string_index[g_Dialog.u8.active_zoombox]) { - gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - } - if (!g_Dialog.string_index[g_Dialog.u8.active_zoombox] && g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 == 2) { - gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - } - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - g_Dialog.u8.active_zoombox ^= 1; - g_Dialog.unk128_6 = TRUE; - break; - - case -5: - gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - g_Dialog.u8.active_zoombox ^= 1; - g_Dialog.unk128_6 = TRUE; - break; - - case -3: - g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; - gcdialog_setState(4); - break; - - default: - if (!gczoombox_strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - } else { - if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -8) { - // Conditional text - use callback to determine if text should be shown - if (g_Dialog.unk144 != NULL) { - sp7C = 1; - - if (g_Dialog.caller == NULL) { - ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); - } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { - ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); - } - - if (ret < 0) { - ret = -1 - ret; - sp7C = 0; - } - - if(ret >= 0 && CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->cmd == -8) { - strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str); - strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); - - func_8030F218( - g_Dialog.output, - CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, - CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str, - func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), - sp7C - ); - } else { - ret = -1; - } + } else { + g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; + g_Dialog.string[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str; + + switch (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox]) { + case -2: + if (g_Dialog.string_index[g_Dialog.u8.active_zoombox] == 0) { + g_Dialog.u8.unk12C_29++; } - } else if(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -9){ - // Integer substitution - use callback to determine integer value - // (used for player's note count in some messages) - if (g_Dialog.unk144 != NULL) { - // static char D_80382FF8[24]; - - D_80382FF8[0] = '\0'; - - if (g_Dialog.caller == NULL) { - ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); - } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { - ret = g_Dialog.unk144(g_Dialog.caller, g_Dialog.unk130, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); - } - - strIToA(D_80382FF8, ret); - strlen(D_80382FF8); - strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); - - func_8030F218( - g_Dialog.output, - CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, - D_80382FF8, - func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), - 0 - ); - } - } - - if (gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 1; + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; + g_Dialog.u8.active_zoombox ^= 1; g_Dialog.unk128_6 = TRUE; - } - - if (g_Dialog.unk128_6) { - gczoombox_maximize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); - g_Dialog.unk128_6 = FALSE; - } - - if (ret == -1) { - for (spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD(spA8)->cmd == g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] && spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox] < 8; spA8++) { - sp4C[spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox]] = CMD(spA8)->str; + break; + + case -1: // Choice + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 2; + dialog_setState(DIALOG_WAITING_FOR_PLAYER_CHOICE); + break; + + case -4: // Close + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + gczoombox_close(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_5 = 1; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; + + case -7: // Trigger + if (g_Dialog.unk140 != NULL) { + if (g_Dialog.caller == NULL) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.currentTextId, *g_Dialog.string[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + g_Dialog.unk140(g_Dialog.caller, g_Dialog.currentTextId, *g_Dialog.string[g_Dialog.u8.active_zoombox]); + } + } + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + break; + + case -9: // Substitute integer + case -8: // Conditional text + do { + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] = CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->cmd; + } while (g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -8 || g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] == -9); + break; + + case -6: // Conditional minimize + for(spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD2(spA8)->cmd < -4; spA8++); + + if (CMD2(spA8)->cmd >= 0) { + gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); } - gczoombox_setStrings(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); - g_Dialog.string_index[g_Dialog.u8.active_zoombox] = spA8; - } else { - func_803183A4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.output); - g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; - } + if (g_Dialog.string_index[g_Dialog.u8.active_zoombox]) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + } - gcdialog_setState(3); + if (!g_Dialog.string_index[g_Dialog.u8.active_zoombox] && g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 == 2) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + } + + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; + + case -5: + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + g_Dialog.u8.active_zoombox ^= 1; + g_Dialog.unk128_6 = TRUE; + break; + + case -3: + g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 = 0; + dialog_setState(DIALOG_WAITING_FOR_PLAYER_CHOICE); + break; + + default: + if (!gczoombox_strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + } else { + if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -8) { + // Conditional text - use callback to determine if text should be shown + if (g_Dialog.conditionalCallback != NULL) { + sp7C = 1; + + if (g_Dialog.caller == NULL) { + ret = g_Dialog.conditionalCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + ret = g_Dialog.conditionalCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } + + if (ret < 0) { + ret = -1 - ret; + sp7C = 0; + } + + if (ret >= 0 && CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->cmd == -8) { + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str); + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); + + replaceText( + g_Dialog.output, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + ret + 1)->str, + func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), + sp7C + ); + } else { + ret = -1; + } + } + } else if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -9) { + // Integer substitution - use callback to determine integer value + // (used for player's note count in some messages) + if (g_Dialog.conditionalCallback != NULL) { + // static char D_80382FF8[24]; + + D_80382FF8[0] = '\0'; + + if (g_Dialog.caller == NULL) { + ret = g_Dialog.conditionalCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } else if (func_8030EDC0(g_Dialog.caller, g_Dialog.unk138)) { + ret = g_Dialog.conditionalCallback(g_Dialog.caller, g_Dialog.currentTextId, g_Dialog.string_index[g_Dialog.u8.active_zoombox]); + } + + strIToA(D_80382FF8, ret); + strlen(D_80382FF8); + strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str); + + replaceText( + g_Dialog.output, + CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str, + D_80382FF8, + func_8031B604(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str), + 0 + ); + } + } + + if (gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { + gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk128_6 = TRUE; + } + + if (g_Dialog.unk128_6) { + gczoombox_maximize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); + g_Dialog.unk128_6 = FALSE; + } + + if (ret == -1) { + for (spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD(spA8)->cmd == g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] && spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox] < 8; spA8++) { + sp4C[spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox]] = CMD(spA8)->str; + } + + gczoombox_setStrings(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); + g_Dialog.string_index[g_Dialog.u8.active_zoombox] = spA8; + } else { + func_803183A4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.output); + g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; + } + + dialog_setState(DIALOG_STATE_3); + } + + break; } + } + break; + + case DIALOG_STATE_3: + if ((g_Dialog.u8.unk128_31 & 1) && controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1u) { + dialog_setState(DIALOG_STATE_6); break; } - } - break; - - case 3: - if ((g_Dialog.u8.unk128_31 & 1) && controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1u) { - gcdialog_setState(6); + + if (g_Dialog.u8.unk128_31 & 0x80) { + break; + } + + if (NOT((g_Dialog.u8.unk128_31 & 0x80) ? func_8024E5E8(0, 4) : func_8024E5E8(0, 3))) { + break; + } + + dialog_setState(DIALOG_STATE_6); break; - } - if (g_Dialog.u8.unk128_31 & 0x80) { + case DIALOG_WAITING_FOR_PLAYER_CHOICE: + if (controller_face_buttons[FACE_BUTTON(BUTTON_A)] == 1) { + g_Dialog.u8.playerHasConfirmed = 1; + } else if (controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1) { + g_Dialog.u8.playerHasConfirmed = 0; + } + + if (g_Dialog.u8.playerHasConfirmed != -1) { + dialog_setState(g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 ? DIALOG_STATE_8 : DIALOG_STATE_5); + } break; - } - if (NOT((g_Dialog.u8.unk128_31 & 0x80) ? func_8024E5E8(0, 4) : func_8024E5E8(0, 3))) { + case DIALOG_STATE_7: + case DIALOG_STATE_8: + dialog_setState(DIALOG_STATE_0); break; - } - - gcdialog_setState(6); - break; - - case 4: // Waiting for player to make choice - if (controller_face_buttons[FACE_BUTTON(BUTTON_A)] == 1) { - g_Dialog.u8.unk12C_23 = 1; - } else if (controller_face_buttons[FACE_BUTTON(BUTTON_B)] == 1) { - g_Dialog.u8.unk12C_23 = 0; - } - - if (g_Dialog.u8.unk12C_23 != -1) { - gcdialog_setState(g_Dialog.unk11A[g_Dialog.u8.active_zoombox].unk0_7 ? 8 : 5); - } - break; - - case 7: - case 8: - gcdialog_setState(0); - break; } - for(i = 0; i < 2; i++){ + for (i = 0; i < 2; i++) { gczoombox_update(g_Dialog.zoombox[i]); } } -//parses text asset into seperate strings -void func_80310574(s32 text_id){ - s32 i; - s32 j; +void loadDialogStrings(s32 text_id) { + s32 i, j; u8 *txt; s32 _v0; char ch; @@ -622,317 +634,328 @@ void func_80310574(s32 text_id){ txt = g_Dialog.dialog_bin_ptr = dialogBin_get(text_id); - for(i = 0; i < 2; i++){ + for (i = 0; i < 2; i++) { g_Dialog.string_count[i] = *(txt++); - g_Dialog.string_list[i] = (struct13s *) malloc(g_Dialog.string_count[i]*sizeof(struct13s)); - for(j = 0; j < g_Dialog.string_count[i]; j++){//L803105F0 + g_Dialog.dialog[i] = (BKDialog *) malloc(g_Dialog.string_count[i] * sizeof(BKDialog)); + for (j = 0; j < g_Dialog.string_count[i]; j++) { + // Step 1: Get the cmd / chat head from the dialog asset ch = *(txt++); - if(ch > 0 && ch < 0x20){ + // Low cmds correspond to specific commands for a dialog box instead of a chat head + if (ch > 0 && ch < 0x20) { + // Swap it to negative: See DIALOG_STATE_2 above _v0 = -ch; - } - else{ + } else { _v0 = (ch >= 0x80)? ch - 0x80 : ch; } - g_Dialog.string_list[i][j].cmd = _v0; + g_Dialog.dialog[i][j].cmd = _v0; + + // Step 2: Get the speaking text len = *(txt); txt++; - g_Dialog.string_list[i][j].str = txt; - txt += len; - + g_Dialog.dialog[i][j].str = txt; + txt += len; } - //L80310664 } } -s32 func_8031068C(s32 next_state){ - return (next_state) ? 0 : 0xA0; +s32 getYPositionForZoombox(s32 dialogPosition) { + return (dialogPosition) ? 0 // Top Dialog + : 0xA0; // Bottom Dialog } -int func_803106A4(s32 next_state){ - return (next_state) ? 1 : 0; +bool isDialogTop(s32 dialogIterator) { + return dialogIterator ? TRUE : FALSE; } -void func_803106BC(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(ActorMarker *, s32, s32), void(*arg4)(ActorMarker *, s32, s32), s32 arg5){ - s32 i; - s32 j; +void loadAndCreateDialogs(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(ActorMarker *, s32, s32), void(*arg4)(ActorMarker *, s32, s32), s32 arg5) { + s32 i, j; s32 temp_a2; - func_80310574(text_id); + loadDialogStrings(text_id); g_Dialog.unk12C_29 = 0; g_Dialog.unk12C_31 = (g_Dialog.unk12C_25 = g_Dialog.unk12C_29); g_Dialog.unk12C_27 = g_Dialog.unk12C_31; g_Dialog.unk128_15 = g_Dialog.unk12C_27; - for(j = 0; j < 2; j++){//L80310774 - i = 0; - temp_a2 = g_Dialog.string_list[j][0].cmd; - while(g_Dialog.string_list[j][i].cmd < -4 && i < g_Dialog.string_count[j]){ - i++; + + for (i = 0; i < 2; i++) { //L80310774 + j = 0; + temp_a2 = g_Dialog.dialog[i][0].cmd; + while (g_Dialog.dialog[i][j].cmd < -4 && j < g_Dialog.string_count[i]) { + j++; }; - g_Dialog.string_cmd[j] = temp_a2; + + g_Dialog.string_cmd[i] = temp_a2; //L803107C4 - g_Dialog.string[j] = g_Dialog.string_list[j]->str; - g_Dialog.string_index[j] = 0; - g_Dialog.unk124[j] = func_8031068C(j); - g_Dialog.unk11A[j].unk0_5 = 0; - if(g_Dialog.string_list[j][i].cmd >= 0){ - if(!g_Dialog.unk11A[j].unk0_7){ - g_Dialog.zoombox[j] = gczoombox_new(g_Dialog.unk124[j], g_Dialog.string_list[j][i].cmd + 0xC, 0, func_803106A4(j), (void *)func_8030F754); - if( j == 1 ){ + g_Dialog.string[i] = g_Dialog.dialog[i]->str; + g_Dialog.string_index[i] = 0; + g_Dialog.zoomboxYPosition[i] = getYPositionForZoombox(i); + g_Dialog.unk11A[i].unk0_5 = 0; + + if (g_Dialog.dialog[i][j].cmd >= 0) { + if (!g_Dialog.unk11A[i].unk0_7) { + g_Dialog.zoombox[i] = gczoombox_new(g_Dialog.zoomboxYPosition[i], g_Dialog.dialog[i][j].cmd + 0xC, 0, isDialogTop(i), (void *)newZoomboxCallback); + if (i == DIALOG_TOP) { func_80347A14(0); } - } else{//L80310860 + } else { //L80310860 g_Dialog.unk12C_31++; } //L80310880 g_Dialog.unk128_15++; - }else{//L80310890 - if(g_Dialog.string_list[j][i].cmd < -2){ - if(g_Dialog.unk11A[j].unk0_7){ - gczoombox_close(g_Dialog.zoombox[j]); + } else { //L80310890 + if (g_Dialog.dialog[i][j].cmd < -2) { + if (g_Dialog.unk11A[i].unk0_7) { + gczoombox_close(g_Dialog.zoombox[i]); g_Dialog.unk128_15++; - }else{ - g_Dialog.zoombox[j] = NULL; + } else { + g_Dialog.zoombox[i] = NULL; } - g_Dialog.unk11A[j].unk0_7 = 0; - }else{//L803108D8 - if(g_Dialog.unk11A[j].unk0_7){ + g_Dialog.unk11A[i].unk0_7 = 0; + } else { //L803108D8 + if (g_Dialog.unk11A[i].unk0_7) { g_Dialog.unk128_15++; g_Dialog.unk12C_31++; } } - }//L80310910 + } //L80310910 } - g_Dialog.unk130 = text_id; + g_Dialog.currentTextId = text_id; g_Dialog.unk128_31 = arg1; - if(g_Dialog.string_cmd[0] < 0){ - g_Dialog.active_zoombox = 0; - }else{//L80310950 - g_Dialog.active_zoombox = 1; - }//L8031095C + if (g_Dialog.string_cmd[DIALOG_BOTTOM] < 0) { + g_Dialog.active_zoombox = DIALOG_BOTTOM; + } else { //L80310950 + g_Dialog.active_zoombox = DIALOG_TOP; + } //L8031095C g_Dialog.unk128_6 = 1; - g_Dialog.unk12C_23 = ((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 1 : -1; + g_Dialog.playerHasConfirmed = ((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 1 : -1; g_Dialog.caller = marker; - g_Dialog.unk13C = callback; + g_Dialog.currentCallback = callback; g_Dialog.unk140 = arg4; - g_Dialog.unk144 = (void *)arg5; - g_Dialog.unk138 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; - gcdialog_setState(((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 6 : 1); + g_Dialog.conditionalCallback = (void *)arg5; + g_Dialog.unk138 = (marker != NULL) ? ((marker->unk5C)? marker->unk5C : -1) : 0; + dialog_setState(((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3) ? 6 : 1); //L803109EC } -void func_80310A5C(s32 next_state, s32 arg1, s32 arg2, s32 arg3, s32 arg4){ +void func_80310A5C(s32 next_state, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { s32 i; - f32 tmpf; - for(i = 0, tmpf = 0.4f; i< 2; i++){ - if(g_Dialog.zoombox[i]){ - gczoombox_func_803184C8(g_Dialog.zoombox[i], arg2, next_state, arg1, tmpf, arg3, arg4); + f32 box_background_animation_duration = 0.4f; + + for (i = 0; i < 2; i++) { + if (g_Dialog.zoombox[i]) { + gczoombox_func_803184C8(g_Dialog.zoombox[i], arg2, next_state, arg1, box_background_animation_duration, arg3, arg4); } } } -void func_80310B1C(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(ActorMarker *, s32, s32), void(*arg4)(ActorMarker *, s32, s32), s32 arg5){ - func_803106BC(text_id, arg1, marker, callback, arg4, arg5); - if(map_get() == MAP_90_GL_BATTLEMENTS && 0x10ec < text_id){ - func_80310A5C( 3, 4, 0x1e, arg1 & 2, arg1 & 0x80); - } - else{ - func_80310A5C( 5, 2, 0xF, arg1 & 2, arg1 & 0x80); +void func_80310B1C(s32 text_id, s32 arg1, ActorMarker *marker, void(*callback)(ActorMarker *, s32, s32), void(*arg4)(ActorMarker *, s32, s32), s32 arg5) { + loadAndCreateDialogs(text_id, arg1, marker, callback, arg4, arg5); + + // Is the player at the final boss and is the text not an entering quote? + if (map_get() == MAP_90_GL_BATTLEMENTS && ASSET_10EC_DIALOG_FINALBOSS_ENTERING_6 < text_id) { + func_80310A5C(3, 4, 0x1e, arg1 & 2, arg1 & 0x80); + return; } + + func_80310A5C(5, 2, 0xF, arg1 & 2, arg1 & 0x80); } -void func_80310BB4(s32 next_state, s32 arg1, s32 arg2){ +void func_80310BB4(s32 next_state, s32 arg1, s32 arg2) { func_80310A5C(arg1, arg2, next_state, g_Dialog.unk128_31 & 2, g_Dialog.unk128_31 & 0x80); } -void func_80310BFC(void){ - s32 ch; - if(g_Dialog.unk128_4){ - g_Dialog.unk132++; - ch = D_8036C4D0[g_Dialog.unk132]; - if(g_Dialog.zoombox[0] != NULL){ - g_Dialog.unk124[0] -= ch; - func_80318B7C(g_Dialog.zoombox[0], g_Dialog.unk124[0]); - }//L80310C60 +void updateDialogYPositions(void) { + s32 y_position_change; + + if (g_Dialog.zoomboxYPositionIndexDecremented) { + g_Dialog.yPositionModifierIndex++; + y_position_change = Y_POSITION_MODIFIERS[g_Dialog.yPositionModifierIndex]; + if (g_Dialog.zoombox[DIALOG_BOTTOM] != NULL) { + g_Dialog.zoomboxYPosition[DIALOG_BOTTOM] -= y_position_change; + func_80318B7C(g_Dialog.zoombox[DIALOG_BOTTOM], g_Dialog.zoomboxYPosition[DIALOG_BOTTOM]); + } - if(g_Dialog.zoombox[1] != NULL){ - g_Dialog.unk124[1] += ch; - func_80318B7C(g_Dialog.zoombox[1], g_Dialog.unk124[1]); - }//L80310C84 - if(g_Dialog.unk132 == 0xC){ - g_Dialog.unk128_5 = 0; + if (g_Dialog.zoombox[DIALOG_TOP] != NULL) { + g_Dialog.zoomboxYPosition[DIALOG_TOP] += y_position_change; + func_80318B7C(g_Dialog.zoombox[DIALOG_TOP], g_Dialog.zoomboxYPosition[DIALOG_TOP]); } - }else{//L80310CA4 - g_Dialog.unk132--; - ch = D_8036C4D0[g_Dialog.unk132]; - if(g_Dialog.zoombox[0] != NULL){ - g_Dialog.unk124[0] += ch; - func_80318B7C(g_Dialog.zoombox[0], g_Dialog.unk124[0]); + + if (g_Dialog.yPositionModifierIndex == 12) { + g_Dialog.queueZoomboxYPositionModify = FALSE; } - if(g_Dialog.zoombox[1] != NULL){ - g_Dialog.unk124[1] -= ch; - func_80318B7C(g_Dialog.zoombox[1], g_Dialog.unk124[1]); + } else { + g_Dialog.yPositionModifierIndex--; + y_position_change = Y_POSITION_MODIFIERS[g_Dialog.yPositionModifierIndex]; + if (g_Dialog.zoombox[DIALOG_BOTTOM] != NULL) { + g_Dialog.zoomboxYPosition[DIALOG_BOTTOM] += y_position_change; + func_80318B7C(g_Dialog.zoombox[DIALOG_BOTTOM], g_Dialog.zoomboxYPosition[DIALOG_BOTTOM]); } - if(g_Dialog.unk132 == 0){ - g_Dialog.unk128_5 = 0; + + if (g_Dialog.zoombox[DIALOG_TOP] != NULL) { + g_Dialog.zoomboxYPosition[DIALOG_TOP] -= y_position_change; + func_80318B7C(g_Dialog.zoombox[DIALOG_TOP], g_Dialog.zoomboxYPosition[DIALOG_TOP]); + } + + if (g_Dialog.yPositionModifierIndex == 0) { + g_Dialog.queueZoomboxYPositionModify = FALSE; } } } -void func_80310D2C(void){ - struct14s * sp24; +void func_80310D2C(void) { + struct14s *sp24; - if(g_Dialog.unk128_5) - func_80310BFC(); + if (g_Dialog.queueZoomboxYPositionModify) { + updateDialogYPositions(); + } - if(getGameMode() == GAME_MODE_3_NORMAL || func_802E4A08()){ - if(g_Dialog.unk128_5) + if (getGameMode() == GAME_MODE_3_NORMAL || func_802E4A08()) { + if (g_Dialog.queueZoomboxYPositionModify) { return; + } - if(!func_803114B0() && (s32)(g_Dialog.unk12C_15) > 0){ + if (!gcdialog_hasCurrentTextId() && (s32)(g_Dialog.unk12C_15) > 0) { sp24 = g_Dialog.unk148 + g_Dialog.unk12C_11; func_80310B1C(sp24->unk0,sp24->unk2, sp24->unk10, sp24->unk18, sp24->unk1C, sp24->unk20); g_Dialog.unk138 = sp24->unk14; func_8025A55C(8000, 300, 2); - if((sp24->unk2 & 0x8) && !((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3)){//L80310E6C - func_8028F918(0); - if( 0.0f == sp24->unk4_x - && 0.0f == sp24->unk4_y - && 0.0f == sp24->unk4_z - ){ - func_8028F918((g_Dialog.string_cmd[1] < 0)? 1 : 3); - } - else{//L80310F00 - func_8028F94C((g_Dialog.string_cmd[1] < 0)? 1 : 3, sp24->unk4); - } + if ((sp24->unk2 & 0x8) && !((func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) && g_Dialog.unk128_3)) { //L80310E6C + func_8028F918(0); + if (0.0f == sp24->unk4_x + && 0.0f == sp24->unk4_y + && 0.0f == sp24->unk4_z + ) { + func_8028F918((g_Dialog.string_cmd[1] < 0)? 1 : 3); + } else { //L80310F00 + func_8028F94C((g_Dialog.string_cmd[1] < 0)? 1 : 3, sp24->unk4); + } } //L80310F28 g_Dialog.unk12C_11++; - if(!((s32) g_Dialog.unk12C_11 < 4)){ + if (!((s32) g_Dialog.unk12C_11 < 4)) { g_Dialog.unk12C_11 = g_Dialog.unk12C_11 - 4; } + g_Dialog.unk12C_15--; - - }else{//L80310F88 - gcdialog_update(); - }//L80310F98 - if( ( g_Dialog.state != 0 && g_Dialog.state != 5 && g_Dialog.state != 7) + } else { //L80310F88 + dialog_update(); + } //L80310F98 + + if ((g_Dialog.state != DIALOG_STATE_0 && g_Dialog.state != DIALOG_STATE_5 && g_Dialog.state != DIALOG_STATE_7) || ((!g_Dialog.state && (g_Dialog.unk11A[0].unk0_7 || g_Dialog.unk11A[1].unk0_7))) || g_Dialog.unk12C_15 - ){ - //L80310FF0 - if(func_802FADD4(0)){ - if(item_getCount(ITEM_6_HOURGLASS) != 0) + ) { //L80310FF0 + if (func_802FADD4(0)) { + if (item_getCount(ITEM_6_HOURGLASS) != 0) { func_802FACA4(0x28); - else + } else { func_802FAD64(ITEM_0_HOURGLASS_TIMER); - } - else { - if(func_802FADD4(3)){ - if(item_getCount(ITEM_3_PROPELLOR_TIMER) != 0){ + } + } else { + if (func_802FADD4(3)) { + if (item_getCount(ITEM_3_PROPELLOR_TIMER) != 0) { func_802FACA4(0x28); - } - else{ + } else { func_802FAD64(ITEM_3_PROPELLOR_TIMER); } } } //L80311068 - if(func_802FBE04()) + + if (func_802FBE04()) { func_802FACA4(0x2A); + } - if(func_802FC390()){ + if (func_802FC390()) { func_802FACA4(0x29); } - } - else{//L803110A0 - if(func_802FAD9C(0x28)) + } else { //L803110A0 + if (func_802FAD9C(0x28)) { func_802FAD64(0x28); + } - if(func_802FAD9C(0x2A)) + if (func_802FAD9C(0x2A)) { func_802FAD64(0x2A); + } - if(func_802FAD9C(0x29)) + if (func_802FAD9C(0x29)) { func_802FAD64(0x29); - + } } } } -int func_803110F8(s32 next_state, s32 arg1, s32 arg2, s32 arg3, void (*arg4)(ActorMarker *, enum asset_e, s32)){ +int func_803110F8(s32 next_state, s32 arg1, s32 arg2, s32 arg3, void (*arg4)(ActorMarker *, enum asset_e, s32)) { func_8025A55C(15000, 300, 2); - func_80311174(next_state + 0xe57, 0x84, NULL, NULL, NULL, NULL, arg4); + gcdialog_showDialogConditional(next_state + 0xe57, 0x84, NULL, NULL, NULL, NULL, arg4); func_80310A5C(arg2, arg3, arg1, 0, 0); return 1; } -int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32), s32 arg6){ +int gcdialog_showDialogConditional(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32), s32 arg6) { f32 pad; s32 temp_v1; - if(volatileFlag_get(VOLATILE_FLAG_1) || func_802D686C()) + if (volatileFlag_get(VOLATILE_FLAG_1) || func_802D686C()) { return 0; + } - if(!func_803114B0()){ + if (!gcdialog_hasCurrentTextId()) { func_80310B1C(text_id, arg1, marker, (void *)callback, (void *)arg5, arg6); - if(arg1 & 8){ - if(!(func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3){//L80311214 - if(pos != NULL){ + if (arg1 & 8) { + if (!(func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3) { //L80311214 + if (pos != NULL) { func_8028F94C(((g_Dialog.string_cmd[1] < 0)? 1 : 3), pos); - }else{//L8031126C + } else { //L8031126C func_8028F918(((g_Dialog.string_cmd[1] < 0)? 1 : 3)); } } - }//L8031128C + } //L8031128C func_8025A55C(0x1f40, 0x12c, 2); return 1; - }else{//L803112A0 - if(arg1 & 0x20){ - if(!(g_Dialog.unk128_31 & 0x80)){ + } else { //L803112A0 + if (arg1 & 0x20) { + if (!(g_Dialog.unk128_31 & 0x80)) { func_803114D0(); - } - else{ + } else { g_Dialog.unk12C_15 = 0; g_Dialog.unk12C_11 = 0; } - }//L803112E8 - if(arg1 & 0x04 || arg1 & 0x20){ - + } //L803112E8 + if (arg1 & 0x04 || arg1 & 0x20) { //L80311300 temp_v1 = g_Dialog.unk12C_11 + g_Dialog.unk12C_15; temp_v1 = (temp_v1 < 4)?temp_v1 : temp_v1 - 4; //L80311328 g_Dialog.unk148[temp_v1].unk0 = text_id; g_Dialog.unk148[temp_v1].unk2 = arg1; - if(pos){ + if (pos) { g_Dialog.unk148[temp_v1].unk4[0] = pos[0]; g_Dialog.unk148[temp_v1].unk4[1] = pos[1]; g_Dialog.unk148[temp_v1].unk4[2] = pos[2]; - } - else{ + } else { g_Dialog.unk148[temp_v1].unk4[2] = 0.0f; g_Dialog.unk148[temp_v1].unk4[1] = 0.0f; g_Dialog.unk148[temp_v1].unk4[0] = 0.0f; } g_Dialog.unk148[temp_v1].unk10 = marker; - g_Dialog.unk148[temp_v1].unk14 = (marker != NULL )? ((marker->unk5C)? marker->unk5C : -1) : 0; + g_Dialog.unk148[temp_v1].unk14 = (marker != NULL) ? ((marker->unk5C) ? marker->unk5C : -1) : 0; g_Dialog.unk148[temp_v1].unk18 = (void *)callback; g_Dialog.unk148[temp_v1].unk1C = (void *)arg5; g_Dialog.unk148[temp_v1].unk20 = arg6; g_Dialog.unk12C_15++; - if(arg1 & 0x08){ - if(!( func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3){//L8031141C - if(!func_8028EC04()){ - if(pos != NULL){ + if (arg1 & 0x08) { + if (!(func_802E4A08() || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) || !g_Dialog.unk128_3) { //L8031141C + if (!func_8028EC04()) { + if (pos != NULL) { func_8028F94C(2, pos); - } - else{//L80311444 + } else { //L80311444 func_8028F918(2); } - } - else{//L80311454 + } else { //L80311454 func_8028F918(func_8028EC04()); } } @@ -943,76 +966,84 @@ int func_80311174(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*ca return 0; } -bool gcdialog_showText(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32)){ - return func_80311174(text_id, arg1, pos, marker, callback, arg5, 0); +bool gcdialog_showDialog(s32 text_id, s32 arg1, f32 *pos, ActorMarker *marker, void(*callback)(ActorMarker *, enum asset_e, s32), void(*arg5)(ActorMarker *, enum asset_e, s32)) { + return gcdialog_showDialogConditional(text_id, arg1, pos, marker, callback, arg5, 0); } -int func_803114B0(void){ - return (g_Dialog.unk130 + 1) != 0; +int gcdialog_hasCurrentTextId(void) { + // Empty text ids are set to -1 + return (g_Dialog.currentTextId + 1) != 0; } -int func_803114C4(void){ - return g_Dialog.unk130; +int gcdialog_getCurrentTextId(void) { + return g_Dialog.currentTextId; } -void func_803114D0(void){ +void func_803114D0(void) { s32 i; - if(func_803114B0()){ - gcdialog_setState(6); - }else{ - if(g_Dialog.state != 6){ + if (gcdialog_hasCurrentTextId()) { + dialog_setState(DIALOG_STATE_6); + } else { + if (g_Dialog.state != DIALOG_STATE_6) { g_Dialog.unk12C_25 = 0; - for(i = 0; i< 2; i++){ + for (i = 0; i < 2; i++) { g_Dialog.unk11A[i].unk0_7 = 0; - if(g_Dialog.zoombox[i]){ + if (g_Dialog.zoombox[i]) { g_Dialog.unk12C_25 += (u8)func_803188B4(g_Dialog.zoombox[i]); } } - if(g_Dialog.unk12C_25 != 0){ - g_Dialog.state = 6; + if (g_Dialog.unk12C_25 != 0) { + g_Dialog.state = DIALOG_STATE_6; } } - }//L80311594 + } //L80311594 + g_Dialog.unk12C_15 = 0; g_Dialog.unk12C_11 = 0; - } -int func_803115C4(s32 next_state){ - if(func_803114C4() != next_state){ - return 0; - }else{ - gcdialog_setState(6); - return 1; + +bool func_803115C4(s32 textId) { + if (gcdialog_getCurrentTextId() != textId) { + return FALSE; } + + dialog_setState(DIALOG_STATE_6); + + return TRUE; } -void func_80311604(void){ - if(func_803114B0()){ - g_Dialog.unk128_5 = 1; - g_Dialog.unk128_4 = 0; - g_Dialog.unk132++; +void gcdialog_incrementYPositionModifier(void) { + if (!gcdialog_hasCurrentTextId()) { + return; } + + g_Dialog.queueZoomboxYPositionModify = TRUE; + g_Dialog.zoomboxYPositionIndexDecremented = FALSE; + g_Dialog.yPositionModifierIndex++; } -void func_80311650(void){ - if(func_803114B0()){ - g_Dialog.unk128_5 = 1; - g_Dialog.unk128_4 = 1; - g_Dialog.unk132--; +void gcdialog_decrementYPositionModifier(void) { + if (!gcdialog_hasCurrentTextId()) { + return; } + + g_Dialog.queueZoomboxYPositionModify = TRUE; + g_Dialog.zoomboxYPositionIndexDecremented = TRUE; + g_Dialog.yPositionModifierIndex--; } -void gcdialog_defrag(void){ +void gcdialog_defrag(void) { s32 i; - for(i = 0; i< 2; i++){ + for (i = 0; i < 2; i++) { gczoombox_defrag(g_Dialog.zoombox[i]); - if(g_Dialog.string_list[i]){ - g_Dialog.string_list[i] = (struct13s *)defrag(g_Dialog.string_list[i]); + if (g_Dialog.dialog[i]) { + g_Dialog.dialog[i] = (BKDialog *)defrag(g_Dialog.dialog[i]); } - if(g_Dialog.zoombox[i] != NULL){ + + if (g_Dialog.zoombox[i] != NULL) { g_Dialog.zoombox[i] = (GcZoombox *)defrag(g_Dialog.zoombox[i]); } } diff --git a/src/core2/gc/dialog.h b/src/core2/gc/dialog.h new file mode 100644 index 00000000..05b59cb6 --- /dev/null +++ b/src/core2/gc/dialog.h @@ -0,0 +1,16 @@ +enum { + DIALOG_BOTTOM = 0, + DIALOG_TOP = 1 +}; + +typedef enum { + DIALOG_STATE_0 = 0, + DIALOG_STATE_1 = 1, + DIALOG_STATE_2 = 2, + DIALOG_STATE_3 = 3, + DIALOG_WAITING_FOR_PLAYER_CHOICE = 4, + DIALOG_STATE_5 = 5, + DIALOG_STATE_6 = 6, + DIALOG_STATE_7 = 7, + DIALOG_STATE_8 = 8 +} DialogState; diff --git a/src/core2/gc/parade.c b/src/core2/gc/parade.c index f8e279a3..5cb39f20 100644 --- a/src/core2/gc/parade.c +++ b/src/core2/gc/parade.c @@ -148,23 +148,23 @@ void gcparade_setState(enum parade_state_e next_state); /* .code */ void gcparade_8031ABA0(void) { - func_8031FBF8(); - func_8031FBA0(); + debugScoreStates(); + clearScoreStates(); if (D_803830F0.unk8 != -1) { - func_802C5A3C(D_803830F0.unk8); + gameSelect_setGameNumber(D_803830F0.unk8); gameFile_load(D_803830F0.unk8); func_80347AA8(); } } void gcparade_8031ABF8(void) { - D_803830F0.unk8 = func_802C5A30(); + D_803830F0.unk8 = gameSelect_getGameNumber(); func_8030AFD8(1); mapSavestate_free_all(); levelSpecificFlags_clear(); func_80347A7C(); - func_8031FBF8(); - func_8031FBA0(); + debugScoreStates(); + clearScoreStates(); volatileFlag_set(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE, 1); if (D_803830F0.parade_id == PARADE_1_POST_GRUNTY_BATTLE) { volatileFlag_set(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE, TRUE); diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 8aad86ee..3b85cfd0 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -23,7 +23,7 @@ typedef struct struct_1A_s { u8 unkF; } struct1As; -extern void func_802C5994(void); +extern void gameSelect_saveAndExit(void); extern void func_802E412C(s32, s32); void volatileFlag_set(enum volatile_flags_e, s32); f32 func_8024DE1C(f32, f32, f32 *, f32 *); @@ -232,7 +232,7 @@ void gcpausemenu_free(void) { D_80383010.b_button_sprite = NULL; } gcpausemenu_zoomboxes_free(); - func_80311650(); + gcdialog_decrementYPositionModifier(); } void gcpausemenu_zoomboxes_initMainMenu(void) { @@ -757,7 +757,7 @@ void gcpausemenu_init(void) { sp38 = sns_get_item_state(1, 0); D_80383010.sns_items = sp38 + sp34 + sp30 + sp2C + sp28 + sp24 + sns_get_item_state(7, 0); D_80383010.return_to_lair_disabled = gcpausemenu_initReturnToLair(); - func_80311604(); + gcdialog_incrementYPositionModifier(); gcpausemenu_zoomboxes_initMainMenu(); D_80383010.joystick_sprite = assetcache_get(0x7EB); D_80383010.joystick_frame_count = sprite_getFrameCount(D_80383010.joystick_sprite); @@ -934,7 +934,7 @@ s32 gcPauseMenu_update(void) { controller_copyFaceButtons(0, face_button); controller_getJoystick(0, joystick); - func_8024E60C(0, sp60); + controller_copySideButtons(0, sp60); func_8024E6E0(0, sp50); func_80310D2C(); @@ -1065,10 +1065,10 @@ s32 gcPauseMenu_update(void) { if (map_get() == MAP_8E_GL_FURNACE_FUN) { volatileFlag_set(VOLATILE_FLAG_0_IN_FURNACE_FUN_QUIZ, 0); - func_802E4078(MAP_80_GL_FF_ENTRANCE, 2, 1); + transitionToMap(MAP_80_GL_FF_ENTRANCE, 2, 1); } else { - func_802E4078(D_8036C560[level - 1].map, D_8036C560[level - 1].exit, 1); + transitionToMap(D_8036C560[level - 1].map, D_8036C560[level - 1].exit, 1); } gcPauseMenu_setState(PAUSE_STATE_13_EXIT_PAUSE); @@ -1080,7 +1080,7 @@ s32 gcPauseMenu_update(void) { break; case PAUSE_SELECTION_3_SAVE_AND_EXIT://L8031399C - func_802C5994(); + gameSelect_saveAndExit(); volatileFlag_set(VOLATILE_FLAG_0_IN_FURNACE_FUN_QUIZ, 0); if (!fileProgressFlag_get(FILEPROG_BD_ENTER_LAIR_CUTSCENE) || @@ -1089,7 +1089,7 @@ s32 gcPauseMenu_update(void) { } else { func_802E412C(1, 0); - func_802E4078(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, 1); + transitionToMap(MAP_83_CS_GAME_OVER_MACHINE_ROOM, 0, 1); gcPauseMenu_setState(PAUSE_STATE_13_EXIT_PAUSE); } break; @@ -1282,7 +1282,7 @@ s32 gcPauseMenu_update(void) { if (!D_80383010.unk3_6) { func_802DC560(0, 0); func_802E412C(1, 0); - func_802E4078(MAP_1F_CS_START_RAREWARE, 0, 1); + transitionToMap(MAP_1F_CS_START_RAREWARE, 0, 1); D_80383010.unk3_6 = 1; } } @@ -1535,6 +1535,6 @@ void gcpausemenu_returnToLair(void) { if (0 < level && level < LEVEL_C_BOSS && D_8036C560[level - 1].map != -1) { volatileFlag_set(VOLATILE_FLAG_16, TRUE); - func_802E4078(D_8036C560[level - 1].map, D_8036C560[level - 1].exit, 1); + transitionToMap(D_8036C560[level - 1].map, D_8036C560[level - 1].exit, 1); } } diff --git a/src/core2/gc/section.c b/src/core2/gc/section.c index 89435462..92f084dc 100644 --- a/src/core2/gc/section.c +++ b/src/core2/gc/section.c @@ -271,7 +271,7 @@ void func_8030AFD8(s32 arg0){ s32 sp1C = level_get(); func_80321918(0); if(arg0){ - func_802C5994(); + gameSelect_saveAndExit(); } if(sp1C > 0 && sp1C < 0xC){ func_8033301C(); diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 6c49505c..d74c2f07 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -342,7 +342,7 @@ gczoomboxPortraitInfo D_8036C6C0[] = { {SFX_A5_EYRIE_CRY, 20000, 1.0f} }}, {ASSET_7FA_SPRITE_WARP_CAULDRON, 0xED, 0x07, { - {SFX_3ED, 20000, 0.8f} + {SFX_3ED_BUBBLE_POP, 20000, 0.8f} }}, {ASSET_82E_SPRITE_BRENTILDA, 0xED, 0x05, { {SFX_14C_BRENTILDA_TALKING, 16000, 1.2f} @@ -400,7 +400,7 @@ gczoomboxPortraitInfo D_8036C6C0[] = { {SFX_E9_TOOTY_TALKING_2, 20000, 1.1f}, {SFX_122_TOOTY_TALKING_3, 22000, 1.0f}}}, {ASSET_833_SPRITE_DINGPOT, 0xEF, 0x06, { - {SFX_3ED, 20000, 0.8f} + {SFX_3ED_BUBBLE_POP, 20000, 0.8f} }}, {ASSET_7E7_SPRITE_CROC_BANJO, 0xF0, 0x0A, { {SFX_95_BANJO_TALKING, 20000, 1.2f} @@ -549,7 +549,7 @@ void func_803155C8(GcZoombox *this){ if(this->sfx_count){ for(i = 0; i < 5; i++){ if(func_8030E3FC(this->unk108[i])){ - func_8030E394(this->unk108[i]); + sfxSource_triggerCallbackByIndex(this->unk108[i]); } } } @@ -712,7 +712,7 @@ void func_80315C90(GcZoombox *this, s32 arg1) { for(phi_s1 = 0; phi_s1 < 5; phi_s1++){ if (func_8030E3FC(this->unk108[phi_s1])) { - func_8030E394(this->unk108[phi_s1]); + sfxSource_triggerCallbackByIndex(this->unk108[phi_s1]); } } if (this->sfx_count != 1) { @@ -757,7 +757,7 @@ void func_80315C90(GcZoombox *this, s32 arg1) { phi_a0 = (this->unk124[current_sfx] - phi_s1_3 < 0)? 0 : this->unk124[current_sfx] - phi_s1_3; phi_a1 = (this->unk124[current_sfx] - phi_s2 < 0) ? 0 : this->unk124[current_sfx] - phi_s2; sfxsource_setSampleRate(this->unk108[current_sfx], randi2(phi_a0, phi_a1)); - func_8030E2C4(this->unk108[current_sfx]); + sfxSource_func_8030E2C4(this->unk108[current_sfx]); } } } @@ -878,7 +878,7 @@ void func_80316764(GcZoombox *this, s32 arg1) { if (!this->unk1A4_10 ) { controller_copyFaceButtons(0, sp38); - func_8024E60C(0, sp2C); + controller_copySideButtons(0, sp2C); phi_f0 = time_getDelta(); } else { pfsManager_getFirstControllerFaceButtonState(0, sp38); @@ -1064,7 +1064,7 @@ void gczoombox_update(GcZoombox *this){ if( !this->unk1A4_10 ){ controller_copyFaceButtons(0, sp58); - func_8024E60C(0, sp4C); + controller_copySideButtons(0, sp4C); tmp_f0 = time_getDelta(); } else{ @@ -1254,7 +1254,7 @@ void gczoombox_update(GcZoombox *this){ } } if(this->unk1A4_11 && anctrl_isAt(this->anim_ctrl, 0.9f)){ - func_8030E6A4(SFX_CD_PAUSEMENU_LEAVE_SUBMENU, 1.1f, this->unk12E); + gcsfx_playWithPitch(SFX_CD_PAUSEMENU_LEAVE_SUBMENU, 1.1f, this->unk12E); } if(this->unk1A4_16 && anctrl_isStopped(this->anim_ctrl)){ if(this->unk1A4_14){ diff --git a/src/core2/hazards.c b/src/core2/hazards.c new file mode 100644 index 00000000..3fee7301 --- /dev/null +++ b/src/core2/hazards.c @@ -0,0 +1,348 @@ +#include +#include "functions.h" +#include "variables.h" + +#include "core2/ba/timer.h" +#include "core2/statetimer.h" +#include "bs/iFrame.h" + +/* .bss */ +u8 hazardSfxId; +u8 frozenEffectsState; +u8 swampEffectsState; +f32 playerPosition[3]; +f32 effectTimer; + +/*.code */ +bool isOnFloor(void) { + return floor_isCurrentFloorunk59() && floor_getCurrentFloorYPosition() > player_getYPosition(); +} + +void freeHazardSfxId(void) { + sfxsource_freeSfxsourceByIndex(hazardSfxId); +} + +void hazards_reset(void) { + baflag_clear(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); + hazardSfxId = sfxsource_createSfxsourceAndReturnIndex(); + swampEffectsState = 0; +} + +void triggerFrozenHazardEffects(void) { + basfx_80299E48(); + sfxSource_triggerCallbackByIndex(hazardSfxId); + sfxsource_setSfxId(hazardSfxId, SFX_14D_BANJO_FREEZING); + sfxsource_setSampleRate(hazardSfxId, 30000); + sfxsource_playSfxAtVolume(hazardSfxId, 1.2f); + sfxSource_setunk43_7ByIndex(hazardSfxId, 3); + sfxSource_func_8030E2C4(hazardSfxId); + + frozenEffectsState = 2; + effectTimer = 1.0f; +} + +void triggerHotHazardEffects(void) { + sfxSource_triggerCallbackByIndex(hazardSfxId); + sfxsource_setSfxId(hazardSfxId, SFX_B0_SIZZLING_NOISE); + sfxsource_setSampleRate(hazardSfxId, 32000); + sfxsource_playSfxAtVolume(hazardSfxId, randf2(0.7f, 0.8f)); + sfxSource_setunk43_7ByIndex(hazardSfxId, 3); + sfxSource_func_8030E2C4(hazardSfxId); +} + +void spawnPiranhaParticles(void) { + f32 player_position[3]; + + player_getPosition(player_position); + actor_spawnWithYaw_f32(ACTOR_188_PIRANHA_WATER_PARTICLES, player_position, (s32)yaw_get()); +} + +void triggerSwampHazardEffects(void) { + __spawnQueue_add_0(&spawnPiranhaParticles); + FUNC_8030E624(SFX_A_BANJO_LANDING_05, 1.0f, 28000); + sfxSource_triggerCallbackByIndex(hazardSfxId); + sfxsource_setSfxId(hazardSfxId, SFX_6D_CROC_BITE); + sfxsource_setSampleRate(hazardSfxId, 22000); + sfxSource_setunk43_7ByIndex(hazardSfxId, 3); + + player_getPosition(playerPosition); + playerPosition[1] = floor_getCurrentFloorYPosition(); + + swampEffectsState = 4; + effectTimer = 0.0f; +} + +void triggerHazardEffects(void) { + switch (map_get()) { + case MAP_12_GV_GOBIS_VALLEY: + case MAP_31_RBB_RUSTY_BUCKET_BAY: + case MAP_3C_RBB_KITCHEN: + case MAP_6E_GL_GV_LOBBY: + case MAP_8E_GL_FURNACE_FUN: + triggerHotHazardEffects(); + break; + + case MAP_27_FP_FREEZEEZY_PEAK: + case MAP_7F_FP_WOZZAS_CAVE: + triggerFrozenHazardEffects(); + break; + + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + case MAP_72_GL_BGS_LOBBY: + triggerSwampHazardEffects(); + break; + } +} + +void updateFrozenEffects(void) { + if (frozenEffectsState == 0) { + return; + } + + if ((isOnFloor() == 0) && (func_8028F2FC() == 0) && (func_8030E3FC(hazardSfxId) != 0)) { + sfxSource_triggerCallbackByIndex(hazardSfxId); + frozenEffectsState = 0; + return; + } + + effectTimer = ml_max_f(0.0f, effectTimer - time_getDelta()); + + if (effectTimer != 0.0f) { + return; + } + + if (frozenEffectsState == 1) { // Seems to never be able to trigger + triggerFrozenHazardEffects(); + } else if (frozenEffectsState == 2) { + sfxSource_triggerCallbackByIndex(hazardSfxId); + sfxsource_setSfxId(hazardSfxId, SFX_134_FREEZING_SHIVER); + sfxsource_setSampleRate(hazardSfxId, 20000); + sfxsource_playSfxAtVolume(hazardSfxId, 1.2f); + sfxSource_setunk43_7ByIndex(hazardSfxId, 3); + sfxSource_func_8030E2C4(hazardSfxId); + frozenEffectsState = 2; + effectTimer = 1.5f; + } +} + +void updateBurnSfx(void) { + f32 delta_time; + s32 sample_rate; + + if (func_8030E3FC(hazardSfxId) == 0) { + return; + } + + delta_time = time_getDelta(); + sample_rate = sfxSource_getSampleRate(hazardSfxId) - (s32) (delta_time * 30000.0); + + if (sample_rate <= 0) { + sfxSource_triggerCallbackByIndex(hazardSfxId); + return; + } + + sfxsource_setSampleRate(hazardSfxId, sample_rate); +} + +// Interesting to note, this update function plays the sfx while the other ones wait until after Banjo +// has been damaged. +void updateSwampEffects(void) { + if (swampEffectsState == 0) { + return; + } + + effectTimer = ml_max_f(0.0f, effectTimer - time_getDelta()); + + if (effectTimer > 0.0f) { + return; + } + + swampEffectsState -= 1; + effectTimer = randf2(0.12f, 0.22f); + sfxsource_playSfxAtVolume(hazardSfxId, randf2(0.95f, 1.05f)); + sfxSource_func_8030E2C4(hazardSfxId); +} + +void updateHazardEffects(void) { + switch (map_get()) { + case MAP_12_GV_GOBIS_VALLEY: + case MAP_31_RBB_RUSTY_BUCKET_BAY: + case MAP_3C_RBB_KITCHEN: + case MAP_6E_GL_GV_LOBBY: + case MAP_8E_GL_FURNACE_FUN: + updateBurnSfx(); + break; + + case MAP_27_FP_FREEZEEZY_PEAK: + case MAP_7F_FP_WOZZAS_CAVE: + updateFrozenEffects(); + break; + + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + case MAP_72_GL_BGS_LOBBY: + updateSwampEffects(); + break; + } +} + +bool isPlayerInHazard(void) { + f32 player_position[3]; + + switch (map_get()) { + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + case MAP_12_GV_GOBIS_VALLEY: + case MAP_1B_MMM_MAD_MONSTER_MANSION: + case MAP_3C_RBB_KITCHEN: + case MAP_43_CCW_SPRING: + case MAP_44_CCW_SUMMER: + case MAP_45_CCW_AUTUMN: + case MAP_46_CCW_WINTER: + case MAP_6E_GL_GV_LOBBY: + case MAP_72_GL_BGS_LOBBY: + case MAP_8E_GL_FURNACE_FUN: + return func_80294610(0xE000) && player_isStable(); + + case MAP_31_RBB_RUSTY_BUCKET_BAY: + player_getPosition(player_position); + return player_inWater() && ml_vec3f_inside_box_f(player_position, -9000.0f, -3000.0f, -3850.0f, -6820.0f, -700.0f, -1620.0f); + + case MAP_27_FP_FREEZEEZY_PEAK: + case MAP_7F_FP_WOZZAS_CAVE: + return player_inWater(); + } + + return FALSE; +} + +bool canTakeGroundDamage(void) { + enum bs_e bs_state; + + bs_state = bs_getState(); + + switch (map_get()) { + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + case MAP_12_GV_GOBIS_VALLEY: + case MAP_1B_MMM_MAD_MONSTER_MANSION: + case MAP_27_FP_FREEZEEZY_PEAK: + case MAP_31_RBB_RUSTY_BUCKET_BAY: + case MAP_3C_RBB_KITCHEN: + case MAP_43_CCW_SPRING: + case MAP_44_CCW_SUMMER: + case MAP_45_CCW_AUTUMN: + case MAP_46_CCW_WINTER: + case MAP_6E_GL_GV_LOBBY: + case MAP_72_GL_BGS_LOBBY: + case MAP_7F_FP_WOZZAS_CAVE: + case MAP_8E_GL_FURNACE_FUN: + return isPlayerInHazard() + && bsStoredState_getTransformation() == TRANSFORM_1_BANJO + && stateTimer_isDone(STATE_TIMER_2_LONGLEG) + && player_movementGroup() != BSGROUP_3_WONDERWING + && player_movementGroup() != BSGROUP_9_LONG_LEG + && baflag_isFalse(BA_FLAG_E_TOUCHING_WADING_BOOTS) + && bs_state != BS_25_LONGLEG_ENTER + && player_getWaterState() != BSWATERGROUP_2_UNDERWATER + && func_8028EC04() < 1U + && bsiFrame_getState() != IFRAME_INVICIBLE + && bs_getState() != BS_3D_FALL_TUMBLING + && player_isDead() < 1U; + } + + return FALSE; +} + +void hazards_update(void) { + bool can_take_ground_damage; + BKCollisionTri *collision; + s32 sp1C; + s32 sp18; + + updateHazardEffects(); + + if (map_get() == MAP_12_GV_GOBIS_VALLEY) { + sp18 = 0; + sp1C = 0; + + collision = func_802946F0(); + + if (collision != NULL) { + sp1C = collision->flags & 0x4000; + } + + collision = func_8029463C(); + + if (collision != NULL) { + sp18 = (collision->flags & 0x4000) && player_isStable(); + } + + if (sp1C || sp18) { + baMotor_80250D94(1.0f, 0.5f, 0.4f); + player_checkHazardInterrupt(0xD); + } + } + + can_take_ground_damage = canTakeGroundDamage(); + batimer_decrement(BA_TIMER_HAZARDS); + + if (can_take_ground_damage) { + if (map_get() == MAP_8E_GL_FURNACE_FUN) { + if (bs_checkInterrupt(BS_INTR_13_FF_DEATH_SQUARE)) { + triggerHazardEffects(); + } + } else { + + if (batimer_isZero(4)) { + batimer_set(4, 4.0f); + + if (player_checkHazardInterrupt(0xD)) { // If not invincible, reduces health + triggerHazardEffects(); + baMotor_80250D94(1.0f, 0.5f, 0.4f); + } + + if (item_empty(ITEM_14_HEALTH)) { + bs_checkInterrupt(BS_INTR_13_FF_DEATH_SQUARE); + } + } + + switch (map_get()) { // Show dialog associated with touching a hazard for the first time + case MAP_43_CCW_SPRING: + case MAP_44_CCW_SUMMER: + case MAP_45_CCW_AUTUMN: + case MAP_46_CCW_WINTER: + progressDialog_showDialogMaskZero(FILEPROG_AA_HAS_TOUCHED_CCW_BRAMBLE_FIELD); + break; + + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + case MAP_72_GL_BGS_LOBBY: + progressDialog_showDialogMaskZero(FILEPROG_F_HAS_TOUCHED_PIRANHA_WATER); + break; + + case MAP_3C_RBB_KITCHEN: + progressDialog_showDialogMaskZero(FILEPROG_A9_HAS_TOUCHED_RBB_OVEN); + break; + + case MAP_12_GV_GOBIS_VALLEY: + case MAP_6E_GL_GV_LOBBY: + case MAP_8E_GL_FURNACE_FUN: + progressDialog_showDialogMaskZero(FILEPROG_10_HAS_TOUCHED_SAND_EEL_SAND); + break; + + case MAP_27_FP_FREEZEEZY_PEAK: + case MAP_7F_FP_WOZZAS_CAVE: + progressDialog_showDialogMaskZero(FILEPROG_14_HAS_TOUCHED_FP_ICY_WATER); + break; + + case MAP_1B_MMM_MAD_MONSTER_MANSION: + if (!isOnFloor()) { + progressDialog_showDialogMaskZero(FILEPROG_86_HAS_TOUCHED_MMM_THORN_HEDGE); + } + + break; + } + } + + baflag_set(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); + } else { + baflag_clear(BA_FLAG_13_TOUCHING_DANGEROUS_GROUND); + } +} diff --git a/src/core2/mapModel.c b/src/core2/mapModel.c index 2f52074e..060f02a9 100644 --- a/src/core2/mapModel.c +++ b/src/core2/mapModel.c @@ -333,7 +333,7 @@ void mapModel_opa_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { case MAP_93_GL_DINGPOT: func_8033A45C(4, 1); func_8033A45C(5, 1); - func_8033A45C(6, (func_8038EAE0(0xA) || fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))); + func_8033A45C(6, (jigsawPicture_isJigsawPictureComplete(0xA) || fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))); break; } func_8033A450(mapModel.unk24); diff --git a/src/core2/nc/firstpersoncamera.c b/src/core2/nc/firstpersoncamera.c index f4d001b2..1c1af001 100644 --- a/src/core2/nc/firstpersoncamera.c +++ b/src/core2/nc/firstpersoncamera.c @@ -36,7 +36,7 @@ void __ncFirstPersonCamera_getPositionAndRotation_entering(f32 arg0[3], f32 arg1 ncFirstPersonCamera_setState(FIRSTPERSON_STATE_2_IDLE); } if (__ncFirstPersonCamera_fullyZoomedIn() && func_8028F150()) { - func_8028FCC8(0); + player_setModelVisible(0); } ml_vec3f_copy(arg0, D_8037DC60.position); ml_vec3f_copy(arg1, D_8037DC60.rotation); @@ -55,7 +55,7 @@ void __ncFirstPersonCamera_getPositionAndRotation_exiting(f32 arg0[3], f32 arg1[ ncFirstPersonCamera_setState(FIRSTPERSON_STATE_4_DONE); } if (!__ncFirstPersonCamera_fullyZoomedIn() && !func_8028F150()) { - func_8028FCC8(1); + player_setModelVisible(1); } ml_vec3f_copy(arg0, D_8037DC60.position); ml_vec3f_copy(arg1, D_8037DC60.rotation); diff --git a/src/core2/particle.c b/src/core2/particle.c index 262ceb36..803a54b4 100644 --- a/src/core2/particle.c +++ b/src/core2/particle.c @@ -320,7 +320,7 @@ ParticleEmitter * particleEmitter_new(u32 capacity){ func_802EFA34(this, 100000.0f); particleEmitter_setParticleCallback(this, 0); particleEmitter_func_802EFA18(this, 0); - func_802EFA20(this, 1.0f, 1.0f); + particleEmitter_func_802EFA20(this, 1.0f, 1.0f); particleEmitter_setStartingFrameRange(this, 0, 0); particleEmitter_setParticleFramerateRange(this, 0.0f, 0.0f); particleEmitter_setStartingScaleRange(this, 1.0f, 1.0f); @@ -382,7 +382,7 @@ void particleEmitter_func_802EFA18(ParticleEmitter *this, s32 arg1){ this->unk64 = arg1; } -void func_802EFA20(ParticleEmitter *this, f32 arg1, f32 arg2){ +void particleEmitter_func_802EFA20(ParticleEmitter *this, f32 arg1, f32 arg2){ this->unk6C = arg1; this->unk70 = arg2; } @@ -545,13 +545,13 @@ void particleEmitter_setParticleLifeTimeRange(ParticleEmitter *this, f32 min, f3 this->particleLifeTimeRange[1] = max; } -void particleEmitter_setParticleVelocityRange(ParticleEmitter *this, f32 x_min, f32 x_max, f32 y_min, f32 y_max, f32 z_min, f32 z_max){ +void particleEmitter_setParticleVelocityRange(ParticleEmitter *this, f32 x_min, f32 y_min, f32 z_min, f32 x_max, f32 y_max, f32 z_max) { this->sphericalParticleVelocity_48 = FALSE; this->particleVelocityRange_E4.cartisian_min_x = x_min; - this->particleVelocityRange_E4.cartisian_min_y = x_max; - this->particleVelocityRange_E4.cartisian_min_z = y_min; - this->particleVelocityRange_E4.cartisian_max_x = y_max; - this->particleVelocityRange_E4.cartisian_max_y = z_min; + this->particleVelocityRange_E4.cartisian_min_y = y_min; + this->particleVelocityRange_E4.cartisian_min_z = z_min; + this->particleVelocityRange_E4.cartisian_max_x = x_max; + this->particleVelocityRange_E4.cartisian_max_y = y_max; this->particleVelocityRange_E4.cartisian_max_z = z_max; } @@ -668,7 +668,7 @@ void particleEmitter_update(ParticleEmitter *this){ sp68 = 1.0f; }//L802F0324 if(particleSfxTimer == 0.0f){ - func_8030E6A4(this->sfx_id, randf2(this->unk6C, this->unk70), (s32)((f32)this->unk7C*sp68)); + gcsfx_playWithPitch(this->sfx_id, randf2(this->unk6C, this->unk70), (s32)((f32)this->unk7C*sp68)); particleSfxTimer = 0.25f; } }//L802F0384 diff --git a/src/core2/particleemittermanager.c b/src/core2/particleemittermanager.c new file mode 100644 index 00000000..99f55303 --- /dev/null +++ b/src/core2/particleemittermanager.c @@ -0,0 +1,129 @@ +#include +#include "functions.h" +#include "variables.h" + +#include "core2/particleemittermanager.h" + +u8 initializingIndex; +EmitterData emitterData[MAX_EMITTER_COUNT]; + +ParticleEmitter *pem_getEmitterByIndex(u8 index) { + if (emitterData[index].emitter == NULL) { + initializingIndex = index; + emitterData[index].emitter = partEmitMgr_newEmitter(emitterData[index].capacity); + particleEmitter_manualFree(emitterData[index].emitter); + initializingIndex = 0; + } + + emitterData[index].freeTime = 1.0f; + + return emitterData[index].emitter; +} + +u8 pem_newEmitter(s32 count) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + if (emitterData[i].isActive == 0) { + emitterData[i].isActive++; + emitterData[i].emitter = NULL; + emitterData[i].capacity = count; + return i; + } + } + + return 0; +} + + +void pem_freeAll(void) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + if (emitterData[i].isActive != 0) { + pem_free(i); + } + } +} + +void pem_setAllInactive(void) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + emitterData[i].isActive = 0; + } +} + +void pem_free(u8 index) { + if (emitterData[index].emitter) { + partEmitMgr_freeEmitter(emitterData[index].emitter); + } + + emitterData[index].isActive = 0; +} + +void pem_updateAll(void) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + if (emitterData[i].isActive != 0 + && emitterData[i].emitter != NULL + && particleEmitter_isDone(emitterData[i].emitter)) { + + emitterData[i].freeTime -= time_getDelta(); + + if (emitterData[i].freeTime <= 0.0f) { + partEmitMgr_freeEmitter(emitterData[i].emitter); + emitterData[i].emitter = NULL; + } + } + } +} + +void pem_freeEmitters(void) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + if (emitterData[i].isActive != 0 + && emitterData[i].emitter != NULL + && i != initializingIndex) { + + partEmitMgr_freeEmitter(emitterData[i].emitter); + emitterData[i].emitter = NULL; + } + } +} + +void pem_defragAll(void) { + int i; + + for (i = 1; i < MAX_EMITTER_COUNT; i++) { + if (emitterData[i].isActive != 0 + && emitterData[i].emitter != NULL) { + + emitterData[i].emitter = partEmitMgr_defragEmitter(emitterData[i].emitter); + } + } +} + +void pem_freeDependencies(void) { + func_802EDD20(); + fxRipple_free(); + func_802F1E80(); + fxSparkle_free(); + func_802F404C(); + func_802F422C(); + dustEmitter_free(); + func_802F3CB0(); +} + +void pem_initDependencies(void) { + func_802EDD44(); + fxRipple_init(); + func_802F1EA4(); + fxSparkle_init(); + func_802F4070(); + func_802F4250(); + dustEmitter_init(); + func_802F3CD4(); +} diff --git a/src/core2/playerutils.c b/src/core2/playerutils.c index b2b85e6f..fa17005e 100644 --- a/src/core2/playerutils.c +++ b/src/core2/playerutils.c @@ -42,8 +42,8 @@ s32 can_climb(void){ int can_dive(void){ return ability_hasLearned(ABILITY_F_DIVE) - && !func_8029D66C() - && 100.0f < func_80294500() - func_80294438(); + && !isPlayerInHazard() + && 100.0f < floor_getCurrentFloorYPosition() - func_80294438(); } s32 can_egg(void){ @@ -290,9 +290,9 @@ void func_8028B59C(void) { sp24 = D_8037BF61; if (D_8037BF61) { - D_8037BF61 = (func_80294554() && player_getYPosition() < ((func_80294500() - 50.0f) + 2.0f)); + D_8037BF61 = (func_80294554() && player_getYPosition() < ((floor_getCurrentFloorYPosition() - 50.0f) + 2.0f)); } else { - D_8037BF61 = (func_80294554() && player_getYPosition() < ((func_80294500() - 50.0f) - 2.0f)); + D_8037BF61 = (func_80294554() && player_getYPosition() < ((floor_getCurrentFloorYPosition() - 50.0f) - 2.0f)); } if (map_get() == MAP_6_TTC_NIPPERS_SHELL) { D_8037BF61 = FALSE; diff --git a/src/core2/progressDialog.c b/src/core2/progressDialog.c new file mode 100644 index 00000000..b24de2ba --- /dev/null +++ b/src/core2/progressDialog.c @@ -0,0 +1,136 @@ +#include +#include "functions.h" +#include "variables.h" + +typedef KEY_VALUE_PAIR(s16, s16) MapProgressFlagToDialogID; + +/* Mapping for file progess flags to Dialog IDs */ +MapProgressFlagToDialogID fileProgressDialogMap[] = { + { FILEPROG_AB_SWIM_OILY_WATER, ASSET_BA1_DIALOG_GRUNTY_RBB_WATER_SWIM }, + { FILEPROG_AC_DIVE_OILY_WATER, ASSET_BA2_DIALOG_GRUNTY_RBB_WATER_DIVE }, + { FILEPROG_AA_HAS_TOUCHED_CCW_BRAMBLE_FIELD, ASSET_CE6_DIALOG_GRUNTY_MMM_BRAMBLES }, + { FILEPROG_F_HAS_TOUCHED_PIRANHA_WATER, ASSET_C85_DIALOG_PIRANHA_WATER }, + { FILEPROG_A9_HAS_TOUCHED_RBB_OVEN, ASSET_BA0_DIALOG_GRUNTY_RBB_RED_HOT_OVENS }, + { FILEPROG_10_HAS_TOUCHED_SAND_EEL_SAND, ASSET_A7E_DIALOG_SAND_EELS_MEET }, + { FILEPROG_14_HAS_TOUCHED_FP_ICY_WATER, ASSET_C11_DIALOG_FREEZING_WATER }, + { FILEPROG_F_HAS_TOUCHED_PIRANHA_WATER, ASSET_C85_DIALOG_PIRANHA_WATER }, + { FILEPROG_86_HAS_TOUCHED_MMM_THORN_HEDGE, ASSET_AE1_DIALOG_GRUNTY_MMM_THORNS }, + { FILEPROG_DD_HAS_TOUCHED_CCW_ICY_WATER, ASSET_CE7_DIALOG_GRUNTY_CCW_ICY_WATER_SWIM }, + { FILEPROG_3_MUSIC_NOTE_TEXT, ASSET_D9C_DIALOG_MUSIC_NOTE_MEET }, + { FILEPROG_4_MUMBO_TOKEN_TEXT, ASSET_D9D_DIALOG_MUMBO_TOKEN_MEET }, + { FILEPROG_5_BLUE_EGG_TEXT, ASSET_D9E_DIALOG_BLUE_EGG_MEET }, + { FILEPROG_6_RED_FEATHER_TEXT, ASSET_D9F_DIALOG_RED_FEATHER_MEET }, + { FILEPROG_7_GOLD_FEATHER_TEXT, ASSET_DA0_DIALOG_GOLD_FEATHER_MEET }, + { FILEPROG_8_ORANGE_TEXT, ASSET_B46_DIALOG_COLLECT_ORANGE }, + { FILEPROG_9_GOLD_BULLION_TEXT, ASSET_A21_DIALOG_BLUBBER_TREASURE_MEET }, + { FILEPROG_A_HONEYCOMB_TEXT, ASSET_DA1_DIALOG_HONEYCOMB_MEET }, + { FILEPROG_B_EMPTY_HONEYCOMB_TEXT, ASSET_DA2_DIALOG_EMPTY_HONEYCOMB_MEET }, + { FILEPROG_C_EXTRA_LIFE_TEXT, ASSET_DA3_DIALOG_EXTRA_LIFE_MEET }, + { FILEPROG_BE_CHEATO_BLUEEGGS, ASSET_FA8_EGG_CHEAT_ACTIVATION }, + { FILEPROG_BF_CHEATO_REDFEATHERS, ASSET_FA9_RED_FEATHER_CHEAT_ACTIVATION }, + { FILEPROG_C0_CHEATO_GOLDFEATHERS, ASSET_FAA_GOLD_FEATHER_CHEAT_ACTIVATION }, + { FILEPROG_95_UNUSED_UNKNOWN_ITEM_COLLECT, ASSET_B50_DIALOG_BOTTLES_UNUSED_UNKNOWN_ITEM_COLLECT }, + { FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT, ASSET_F7B_DIALOG_BOTTLES_JIGSAW_PICTURE_MEET }, + { -1, -1 } +}; + +/* This progress IDs are not saved in the save file, like when Banjo goes near a Note door which requires more notes than the Banjo has. */ +/* Triggers a dialog every time after the game restarts. */ +MapProgressFlagToDialogID gVolatileFlagDialogMap[] = { + { VOLATILE_FLAG_9E_BETA_OILY_SCUM, ASSET_BA3_DIALOG_GRUNTY_RBB_OILY_SCUM_UNUSED }, + { VOLATILE_FLAG_9F_BETA_DIVE_IN_ICY_WATER, ASSET_CE8_DIALOG_GRUNTY_CCW_ICY_WATER_UNUSED }, + { VOLATILE_FLAG_A0_FF_FIRST_ANSWER_RIGHT, ASSET_1032_DIALOG_FF_FIRST_ANSWER_CORRECT }, + { VOLATILE_FLAG_A1_FF_NEXT_ANSWER_RIGHT, ASSET_1033_DIALOG_FF_NEXT_ANSWER_CORRECT }, + { VOLATILE_FLAG_A2_FF_GRUNTY_ANSWER_RIGHT, ASSET_1034_DIALOG_FF_GRUNTY_ANSWER_CORRECT }, + { VOLATILE_FLAG_A3_FF_FIRST_ANSWER_WRONG, ASSET_1035_DIALOG_FF_FIRST_ANSWER_WRONG }, + { VOLATILE_FLAG_A4_FF_NEXT_ANSWER_WRONG, ASSET_1036_DIALOG_FF_NEXT_ANSWER_WRONG }, + { VOLATILE_FLAG_A5_FF_UNUSED, ASSET_1037_DIALOG_FF_CHOICE_IS_YOURS_UNUSED }, + { VOLATILE_FLAG_A6_FF_FOUND_HONEYCOMB, ASSET_1038_DIALOG_FF_GET_HONEYCOMB }, + { VOLATILE_FLAG_A7_FF_FOUND_EXTRALIFE, ASSET_1039_DIALOG_FF_GET_EXTRA_LIFE }, + { VOLATILE_FLAG_A8_FF_GOT_JOKER, ASSET_103A_DIALOG_FF_GET_JOKER }, + { VOLATILE_FLAG_A9_FF_USED_JOKER, ASSET_103B_DIALOG_FF_USE_JOKER }, + { VOLATILE_FLAG_AA_FF_LOW_HEALTH, ASSET_103C_DIALOG_FF_LOW_HEALTH }, + { VOLATILE_FLAG_AB_LAST_LIFE_ON_SKULL, ASSET_103D_DIALOG_FF_LOW_HEALTH_ON_SKULL }, + { VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED, ASSET_A88_DIALOG_GRUNTY_GV_MISS_TRAPDOOR }, + { VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED, ASSET_AE2_DIALOG_GRUNTY_MMM_MISS_CHRUCH_DOOR }, + { VOLATILE_FLAG_AE_BGS_WALKWAY_JIGGY_MISSED, ASSET_C8B_DIALOG_GRUNTY_BGS_MISS_WALKWAY_JIGGY }, + { VOLATILE_FLAG_AF_BGS_MAZE_JIGGY_MISSED, ASSET_C8C_DIALOG_GRUNTY_BGS_MISS_MAZE_JIGGY }, + { VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES, ASSET_FBD_DIALOG_GRUNTY_NOT_ENOUGH_NOTES }, + { VOLATILE_FLAG_C2_NOBONUS_TEXT, ASSET_E36_DIALOG_BOTTLES_NO_BONUS }, + { VOLATILE_FLAG_C5_WISHYWASHYBANJO_TEXT, ASSET_DB6_DIALOG_MUMBO_WISHYWASHY }, + { -1, -1 } +}; + +static s32 __findIndex(MapProgressFlagToDialogID *map, s32 key) { + s32 i = 0; + + while (map[i].key >= 0) { + if (key == map[i].key) { + return i; + } + i++; + } + + return -1; +} + +/* Checks for a specific file progress flag and triggers a dialog only if the progress flag was not set and sets the progress flag */ +bool showProgressFlagDialog(enum file_progress_e progressFlag, s32 dialogMask) { + s32 index; + + if (fileProgressFlag_get(progressFlag) != 0) { + return FALSE; + } + + index = __findIndex(fileProgressDialogMap, progressFlag); + if (index != -1) { + if (gcdialog_showDialog(fileProgressDialogMap[index].value, dialogMask, 0, 0, 0, 0) != 0) { + fileProgressFlag_set(progressFlag, 1); + } + + return fileProgressFlag_get(progressFlag); + } + + return FALSE; +} + +void progressDialog_showDialogMaskZero(enum file_progress_e progressFlag) { + showProgressFlagDialog(progressFlag, 0); +} + +void progressDialog_showDialogMaskFour(enum file_progress_e progressFlag) { + showProgressFlagDialog(progressFlag, 4); +} + +/* Checks for a specific "volatile" progress flag and triggers a dialog only if the progress flag was not set and sets the progress flag */ +s32 progressDialog_setAndTriggerDialog(enum volatile_flags_e id, s32 dialogMask) { + s32 index; + + if (volatileFlag_get(id) != 0) { + return 0; + } + + index = __findIndex(gVolatileFlagDialogMap, id); + if (index != -1) { + if (gcdialog_showDialog(gVolatileFlagDialogMap[index].value, dialogMask, 0, 0, 0, 0) != 0) { + volatileFlag_set(id, 1); + } + return volatileFlag_get(id); + } + return 0; +} + +// called for dialogs when banjo is not fast enough to reach a door or jiggy and for NOBONUS text +void progressDialog_setAndTriggerDialog_0(enum volatile_flags_e id) { + progressDialog_setAndTriggerDialog(id, 0); +} + +// called for FFQ dialogs +void progressDialog_setAndTriggerDialog_4(enum volatile_flags_e id) { + progressDialog_setAndTriggerDialog(id, 4); +} + +// called for WISHYWASHYBANJO dialog, mumbo jumbo speaking? +void progressDialog_setAndTriggerDialog_E(enum volatile_flags_e id) { + progressDialog_setAndTriggerDialog(id, 0xE); +} diff --git a/src/core2/snackerctl.c b/src/core2/snackerctl.c index b5c9bee2..0c45c86f 100644 --- a/src/core2/snackerctl.c +++ b/src/core2/snackerctl.c @@ -82,7 +82,7 @@ static SnackerCtlState _snackerctl_update_bottles_bonus(void){ return 0; if(func_8034BB48() && chBottlesBonus_getPuzzleIndex() != 7){ - gcdialog_showText(SNACKER_BB_DIALOG_0 + (chBottlesBonus_getPuzzleIndex() << 1), 6, D_80363610, NULL, NULL, NULL); + gcdialog_showDialog(SNACKER_BB_DIALOG_0 + (chBottlesBonus_getPuzzleIndex() << 1), 6, D_80363610, NULL, NULL, NULL); } if(!func_8028F25C() && func_80321960() == 3) func_803219F4(1); @@ -92,12 +92,12 @@ static SnackerCtlState _snackerctl_update_bottles_bonus(void){ if(chBottlesBonus_getPuzzleIndex() == 6){ if(!D_8037DCCC){ func_8028F94C(4, &D_80363610); - gcdialog_showText(SNACKER_BB_DIALOG_1, 0x6, D_80363610, NULL, func_8028A584, NULL); + gcdialog_showDialog(SNACKER_BB_DIALOG_1, 0x6, D_80363610, NULL, func_8028A584, NULL); } }//L8028A70C else if(chBottlesBonus_getPuzzleIndex() == 7){ func_8028F94C(4, &D_80363610); - gcdialog_showText(ASSET_E35_DIALOG_BOTTLES_BONUS_REMINDER, 0x6, D_80363610, NULL, func_8028A558, NULL); + gcdialog_showDialog(ASSET_E35_DIALOG_BOTTLES_BONUS_REMINDER, 0x6, D_80363610, NULL, func_8028A558, NULL); D_8037DCCC = 1; }//L8028A764 else if(jiggyscore_isCollected(0x10)){ @@ -107,7 +107,7 @@ static SnackerCtlState _snackerctl_update_bottles_bonus(void){ ){ if(!D_8037DCCA){ func_8028F94C(4, &D_80363610); - gcdialog_showText(ASSET_E21_DIALOG_BOTTLES_BONUS_DISCOVERED, 6, D_80363610, 0, func_8028A584, NULL); + gcdialog_showDialog(ASSET_E21_DIALOG_BOTTLES_BONUS_DISCOVERED, 6, D_80363610, 0, func_8028A584, NULL); D_8037DCCA = 1; }else{ func_8028A584(0,0,0); @@ -117,7 +117,7 @@ static SnackerCtlState _snackerctl_update_bottles_bonus(void){ else{ if(!D_8037DCCB){ func_8028F94C(4, &D_80363610); - gcdialog_showText(ASSET_E20_DIALOG_BOTTLES_BONUS_NOT_READY, 6, D_80363610, 0, func_8028A558, NULL); + gcdialog_showDialog(ASSET_E20_DIALOG_BOTTLES_BONUS_NOT_READY, 6, D_80363610, 0, func_8028A558, NULL); D_8037DCCB = 1; } } diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index af3b7495..c5f18213 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -15,16 +15,16 @@ Actor *func_802D75B4(s32 *, s32, ActorInfo*, u32); Actor *func_802D7610(s32 *, s32, ActorInfo*, u32); Actor *chBottlesBonus_new(s32 *, s32, ActorInfo*, u32); -extern ActorInfo D_80365E58; //banjo.without_right_hand -extern ActorInfo D_80365EAC; //banjo.playing_gameboy -extern ActorInfo D_80365F00; //banjo.cooking +extern ActorInfo gameSelect_banjoSleeping; //banjo.without_right_hand +extern ActorInfo gameSelect_banjoGameboy; //banjo.playing_gameboy +extern ActorInfo gameSelect_banjoCooking; //banjo.cooking extern ActorInfo D_80365F60; extern ActorInfo D_80365F84; //turbotrainers -extern ActorInfo D_80365FB0; //shrapnel +extern ActorInfo chExplosionRipple; extern ActorInfo chBubble; extern ActorInfo D_80366090; //bigbutt extern ActorInfo D_803660B4; //brownbull -extern ActorInfo D_803662A8; //jiggy +extern ActorInfo chJiggy; //jiggy extern ActorInfo chJigsawDance; //jigdance extern ActorInfo D_80366340; extern ActorInfo D_80366364; @@ -33,7 +33,7 @@ extern ActorInfo D_803663AC; extern ActorInfo D_803663D0; extern ActorInfo D_803663F4; extern ActorInfo chExtraLife; //extralife -extern ActorInfo D_80366C50; //music_note +extern ActorInfo sumusicNote; //music_note extern ActorInfo D_80366C80; //chhoneycarrier extern ActorInfo D_80366CA4; //chhoney extern ActorInfo chTrainers; @@ -90,7 +90,7 @@ extern ActorInfo D_80367BA4; //gold_bullion extern ActorInfo D_80367BC8; extern ActorInfo D_80367BEC; extern ActorInfo D_80367C10; -extern ActorInfo D_80367C60; +extern ActorInfo chPiranhaWaterParticles; extern ActorInfo D_80367C90; //spent_redfeather extern ActorInfo D_80367CB4; //spent_goldfeather extern ActorInfo D_80367D00; //egg @@ -223,13 +223,13 @@ void spawnQueue_reset(void){ spawnableActorList_add(&chJinjoBlue, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&chJinjoPink, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&chJinjoGreen, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&D_803662A8, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_21); + spawnableActorList_add(&chJiggy, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_21); spawnableActorList_add(&chJigsawDance, actor_new, ACTOR_FLAG_UNKNOWN_2); - spawnableActorList_add(&D_80367C60, actor_new, ACTOR_FLAG_UNKNOWN_2); + spawnableActorList_add(&chPiranhaWaterParticles, actor_new, ACTOR_FLAG_UNKNOWN_2); spawnableActorList_add(&D_80367A20, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&D_80366C80, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_21); //chhoneycarrier spawnableActorList_add(&D_80366CA4, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_21); //chhoney - spawnableActorList_add(&D_80366C50, actor_new, ACTOR_FLAG_UNKNOWN_21); //music_note + spawnableActorList_add(&sumusicNote, actor_new, ACTOR_FLAG_UNKNOWN_21); //music_note spawnableActorList_add(&D_80367D00, actor_new, ACTOR_FLAG_UNKNOWN_21); //egg spawnableActorList_add(&D_80366340, func_802C8A54, ACTOR_FLAG_UNKNOWN_2); spawnableActorList_add(&D_80366364, func_802C8AA8, ACTOR_FLAG_UNKNOWN_2); @@ -245,7 +245,7 @@ void spawnQueue_reset(void){ spawnableActorList_add(&D_80365F84, actor_new, ACTOR_FLAG_UNKNOWN_2); //turbotrainers spawnableActorList_add(&D_80367184, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&chExtraLife, actor_new, ACTOR_FLAG_UNKNOWN_21); //extralife - spawnableActorList_add(&D_80365FB0, actor_new, ACTOR_FLAG_UNKNOWN_2); //shrapnel + spawnableActorList_add(&chExplosionRipple, actor_new, ACTOR_FLAG_UNKNOWN_2); spawnableActorList_add(&chBadShad, actor_new, ACTOR_FLAG_UNKNOWN_2); //chbadshad spawnableActorList_add(&D_803685A0, actor_new, ACTOR_FLAG_UNKNOWN_6); //mumbotoken spawnableActorList_add(&D_80367F30, actor_new, ACTOR_FLAG_UNKNOWN_10); @@ -281,9 +281,9 @@ void spawnQueue_reset(void){ spawnableActorList_add(&D_80367838, actor_new, ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); //level_entry_disk spawnableActorList_add(&D_80367760, actor_new, ACTOR_FLAG_UNKNOWN_12); spawnableActorList_add(&D_80367784, actor_new, ACTOR_FLAG_UNKNOWN_12); - spawnableActorList_add(&D_80365E58, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.without_right_hand - spawnableActorList_add(&D_80365EAC, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.playing_gameboy - spawnableActorList_add(&D_80365F00, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.cooking + spawnableActorList_add(&gameSelect_banjoSleeping, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.without_right_hand + spawnableActorList_add(&gameSelect_banjoGameboy, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.playing_gameboy + spawnableActorList_add(&gameSelect_banjoCooking, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_17); //banjo.cooking spawnableActorList_add(&D_803677CC, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15);//mumbo_transform_pad spawnableActorList_add(&D_803677F0, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); spawnableActorList_add(&D_803731B0, actor_new, ACTOR_FLAG_NONE); diff --git a/src/core2/timedfuncqueue.c b/src/core2/timedfuncqueue.c index a8ad249d..8a2a00f6 100644 --- a/src/core2/timedfuncqueue.c +++ b/src/core2/timedfuncqueue.c @@ -110,7 +110,7 @@ void __timedFunc_execute(TimedFunction *arg0){ } void func_80324A28(s32 soundId, s32 volume){ - func_8025A6EC(soundId, volume); + coMusicPlayer_playMusic(soundId, volume); } void func_80324A48(enum comusic_e arg0){ @@ -127,10 +127,10 @@ void func_80324AA4(timefuncqueue_Struct2 *arg0){ void func_80324AEC(DelayedTextCallback *arg0) { if ((arg0->position[0] == 0.0f) && (arg0->position[1] == 0.0f) && (arg0->position[2] == 0.0f)) { - gcdialog_showText(arg0->text_id, arg0->unk4, NULL, arg0->caller, arg0->callback_method_1, arg0->callback_method_2); + gcdialog_showDialog(arg0->text_id, arg0->unk4, NULL, arg0->caller, arg0->callback_method_1, arg0->callback_method_2); } else{ - gcdialog_showText(arg0->text_id, arg0->unk4, arg0->position, arg0->caller, arg0->callback_method_1, arg0->callback_method_2); + gcdialog_showDialog(arg0->text_id, arg0->unk4, arg0->position, arg0->caller, arg0->callback_method_1, arg0->callback_method_2); } } @@ -226,31 +226,34 @@ void timed_exitStaticCamera(f32 time){ timedFunc_set_0(time, (GenFunction_0) ncStaticCamera_exit); } -void timedFunc_set_0(f32 time, GenFunction_0 funcPtr){ +/* The following functions all add a function to the queue on a timer, then runs them. + * There's different functions depending on the amount of parameters that the running function needs. + */ +void timedFunc_set_0(f32 time, GenFunction_0 funcPtr) { __timedFuncQueue_insert(time, 0, (void *) funcPtr, 0, 0, 0, 0, 0); } -void timedFunc_set_1(f32 time, GenFunction_1 funcPtr, s32 arg0){ +void timedFunc_set_1(f32 time, GenFunction_1 funcPtr, s32 arg0) { __timedFuncQueue_insert(time, 1, (void *) funcPtr, arg0, 0, 0, 0, 0); } -void timedFunc_set_2(f32 time, GenFunction_2 funcPtr, s32 arg0, s32 arg1){ +void timedFunc_set_2(f32 time, GenFunction_2 funcPtr, s32 arg0, s32 arg1) { __timedFuncQueue_insert(time, 2, (void *) funcPtr, arg0, arg1, 0, 0, 0); } -void timedFunc_set_3(f32 time, GenFunction_3 funcPtr, s32 arg0, s32 arg1, s32 arg2){ +void timedFunc_set_3(f32 time, GenFunction_3 funcPtr, s32 arg0, s32 arg1, s32 arg2) { __timedFuncQueue_insert(time, 3, (void *) funcPtr, arg0, arg1, arg2, 0, 0); } -void timedFunc_set_4(f32 time, GenFunction_4 funcPtr, s32 arg0, s32 arg1, s32 arg2, s32 arg3){ +void timedFunc_set_4(f32 time, GenFunction_4 funcPtr, s32 arg0, s32 arg1, s32 arg2, s32 arg3) { __timedFuncQueue_insert(time, 4, (void *) funcPtr, arg0, arg1, arg2, arg3, 0); } -void timedFunc_set_5(f32 time, GenFunction_5 funcPtr, s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4){ +void timedFunc_set_5(f32 time, GenFunction_5 funcPtr, s32 arg0, s32 arg1, s32 arg2, s32 arg3, s32 arg4) { __timedFuncQueue_insert(time, 5, (void *) funcPtr, arg0, arg1, arg2, arg3, arg4); } -void timedFunc_set_6(f32 time, GenFunction_6 funcPtr, void* argPtr ){ +void timedFunc_set_6(f32 time, GenFunction_6 funcPtr, void* argPtr) { TimedFunction *q = __timedFuncQueue_insert(time, 6, funcPtr, 0, 0, 0, 0, 0); memcpy(&q->arg[5], argPtr, 0x50); } diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index 54ad8724..c0b0610d 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -136,8 +136,8 @@ void chbossjinjo_func_8038C79C(Actor *this) { for (i = 0; i < 4; i++) { if (randf() < 0.3) { - func_8033E73C(this->marker, i + 5, func_80329904); - func_8033E3F0(8, this->marker->unk14_21); + commonParticle_add(this->marker, i + 5, func_80329904); + commonParticle_new(8, this->marker->unk14_21); } } } @@ -226,30 +226,30 @@ void chBossJinjo_update(Actor *this){ if (actor_animationIsAt(this, 0.1f)) { this->unk44_31 = func_8030ED2C(0x18, 3); - func_8030E2C4(this->unk44_31); - func_8025A6EC(COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7fff); - FUNC_8030E8B4(SFX_C7_SHWOOP, 0.8f, 32750, this->position, 300, 2000); + sfxSource_func_8030E2C4(this->unk44_31); + coMusicPlayer_playMusic(COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7fff); + sfx_playFadeShorthandDefault(SFX_C7_SHWOOP, 0.8f, 32750, this->position, 300, 2000); } if (actor_animationIsAt(this, 0.434f)) { - FUNC_8030E8B4(SFX_C7_SHWOOP, 0.9f, 32750, this->position, 300, 2000); + sfx_playFadeShorthandDefault(SFX_C7_SHWOOP, 0.9f, 32750, this->position, 300, 2000); } if (actor_animationIsAt(this, 0.811f)) { - FUNC_8030E8B4(SFX_C7_SHWOOP, 1.0f, 32750, this->position, 300, 2000); + sfx_playFadeShorthandDefault(SFX_C7_SHWOOP, 1.0f, 32750, this->position, 300, 2000); } } else { if (actor_animationIsAt(this, 0.214f)) { - FUNC_8030E8B4(SFX_C7_SHWOOP, 1.1f, 32750, this->position, 300, 2000); + sfx_playFadeShorthandDefault(SFX_C7_SHWOOP, 1.1f, 32750, this->position, 300, 2000); } if (actor_animationIsAt(this, 0.55f)) { - FUNC_8030E8B4(SFX_53_BANJO_HUIII, 1.5f, 32750, this->position, 300, 2000); + sfx_playFadeShorthandDefault(SFX_53_BANJO_HUIII, 1.5f, 32750, this->position, 300, 2000); } if (actor_animationIsAt(this, 0.85f)) { if(func_8030E3FC(this->unk44_31)) { - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); } sfxsource_playHighPriority(SFX_19_BANJO_LANDING_08); @@ -266,7 +266,7 @@ void chBossJinjo_update(Actor *this){ if (actor_animationIsAt(this, 0.9f)) { anctrl_setSmoothTransition(this->anctrl, FALSE); subaddie_set_state_with_direction(this, BOSSJINJO_STATE_5_HIT, 0.001f, 1); - FUNC_8030E8B4(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); + sfx_playFadeShorthandDefault(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); func_80324D54(0.1f, SFX_C1_BUZZBOMB_ATTACK, 0.85f, 32000, this->position, 5000.0f, 12000.0f); func_8034A174(this->marker->unk44, 0x1f, this->position); @@ -342,7 +342,7 @@ void chBossJinjo_update2(Actor *this) { } if (0.98 < this->unk48) { - func_8030E6A4(0x3ee, randf2(1.0f, 1.15f), 32000); + gcsfx_playWithPitch(0x3ee, randf2(1.0f, 1.15f), 32000); timed_playSfx(0.1f, 0x416, 0.6f, 32000); marker_despawn(this->marker); @@ -379,7 +379,7 @@ void chbossjinjo_attack(ActorMarker *marker) { Actor *actor_bossjinjo = marker_getActor(marker); chbossjinjo_spawnAttackParticles(actor_bossjinjo); - FUNC_8030E8B4(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor_bossjinjo->position, 1000, 6500); + sfx_playFadeShorthandDefault(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor_bossjinjo->position, 1000, 6500); marker_despawn(actor_bossjinjo->marker); } diff --git a/src/fight/chbossjinjobase.c b/src/fight/chbossjinjobase.c index 2fa53ad9..9fb77445 100644 --- a/src/fight/chbossjinjobase.c +++ b/src/fight/chbossjinjobase.c @@ -16,9 +16,9 @@ void chbossjinjobase_spawnStoneJinjo(ActorMarker *marker) { Actor *actor_bossjinjobase = marker_getActor(marker); Actor *childactor_stonejinjo = spawn_child_actor(ACTOR_3A1_STONE_JINJO, &actor_bossjinjobase); - childactor_stonejinjo->unkF4_8 = actor_bossjinjobase->unkF4_8; + childactor_stonejinjo->actorTypeSpecificField = actor_bossjinjobase->actorTypeSpecificField; childactor_stonejinjo->position_y = childactor_stonejinjo->position_y + 172.0f; - actor_bossjinjobase->unk100 = childactor_stonejinjo->marker; + actor_bossjinjobase->partnerActor = childactor_stonejinjo->marker; } void chBossJinjoBase_createSmokeParticles(f32 position[3], s32 count) { @@ -50,7 +50,7 @@ void chBossJinjoBase_getHitByEgg(ActorMarker *this, ActorMarker *other) { if (actor_bossjinjobase->unk38_31 >= 3) { subaddie_set_state(actor_bossjinjobase, CHBOSSJINJOBASE_STATE_3_SPAWNED_BOSS_JINJO); - chstonejinjo_breakOpen(actor_bossjinjobase->unk100); + chstonejinjo_breakOpen(actor_bossjinjobase->partnerActor); chBossJinjoBase_func_8038D3DC(actor_bossjinjobase, 0x19A, -100.0f, 0.0f, 1.2f); func_80324D54(1.2f, SFX_90_SWITCH_PRESS, 1.0f, 32000, actor_bossjinjobase->position, 1000.0f, 2000.0f); } @@ -90,12 +90,12 @@ void chBossJinjoBase_update(Actor *this) { this->unk38_31 = 0; this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_3F9_UNKNOWN); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.4f); sfxsource_setSampleRate(this->unk44_31, 32000); local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(local->sfxsourceIdx, SFX_405_UNKNOWN); - func_8030DD14(local->sfxsourceIdx, 2); + sfxSource_setunk43_7ByIndex(local->sfxsourceIdx, 2); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 0.7f); sfxsource_setSampleRate(local->sfxsourceIdx, 12000); FUNC_8030E624(SFX_3F6_RUBBING, 0.6f, 20000); @@ -115,13 +115,13 @@ void chBossJinjoBase_update(Actor *this) { } else { if(this->state == CHBOSSJINJOBASE_STATE_1_RAISE) { - actor_stonejinjo = marker_getActor(this->unk100); + actor_stonejinjo = marker_getActor(this->partnerActor); y_delta = this->velocity_y * delta_time; if(this->position_y + y_delta < this->unk1C[1]) { - if( !fileProgressFlag_get(FILEPROG_D2_HAS_SPAWNED_A_JINJO_STATUE_IN_FINAL_FIGHT) || this->unkF4_8 == 1) { - func_8030E2C4(this->unk44_31); - func_8030E2C4(local->sfxsourceIdx); + if( !fileProgressFlag_get(FILEPROG_D2_HAS_SPAWNED_A_JINJO_STATUE_IN_FINAL_FIGHT) || this->actorTypeSpecificField == 1) { + sfxSource_func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(local->sfxsourceIdx); } position_delta[0] = (rumbling & 1) ? 3.0f : -3.0f; diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 0bfd71b1..2ae65d19 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -577,7 +577,7 @@ void chfinalboss_setPhase(ActorMarker *this, enum ch_finalboss_phase_e phase_id) { actor->unk44_31 = (u8)sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(actor->unk44_31, SFX_152_MOTOR_BREAKDOWN_01); - func_8030DD14(actor->unk44_31, 3); + sfxSource_setunk43_7ByIndex(actor->unk44_31, 3); sfxsource_playSfxAtVolume(actor->unk44_31, 1.0f); sfxsource_setSampleRate(actor->unk44_31, 32000); } @@ -589,7 +589,7 @@ void chfinalboss_setPhase(ActorMarker *this, enum ch_finalboss_phase_e phase_id) actor->unk1C_x = D_803927D0[(local->unk5)][0]; actor->unk1C_y = D_803927D0[(local->unk5)][1]; actor->unk1C_z = D_803927D0[(local->unk5)][2]; - gcdialog_showText(randi2(0, 5) + 0x1106, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1106, 4, NULL, NULL, NULL, NULL); return; @@ -760,7 +760,7 @@ void chfinalboss_func_80388110(ActorMarker *marker, enum asset_e text_id, s32 ar actor = marker_getActor(marker); actorLocal = (ActorLocal_FinalBoss *)&actor->local; ncStaticCamera_exit(); - gcdialog_showText(randi2(0, 5) + 0x1101, 4, NULL, actor->marker, chfinalboss_func_803880E0, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1101, 4, NULL, actor->marker, chfinalboss_func_803880E0, NULL); actorLocal->unk9 = (u8)1; } @@ -779,7 +779,7 @@ void chfinalboss_phase1_setState(Actor *this, s32 next_state) { chfinalboss_func_80386600(this->marker, 0); if (next_state != 9) { if (func_8030E3FC(this->unk44_31)) { - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); FUNC_8030E624(SFX_162_MOTOR_RUCKUS, 1.0f, 32000); } @@ -826,7 +826,7 @@ void chfinalboss_phase1_setState(Actor *this, s32 next_state) { func_8030E878(SFX_EA_GRUNTY_LAUGH_1, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); break; case 12: - func_8025A6EC(SFX_GRUNTY_SPELL_POWERUP, 30000); + coMusicPlayer_playMusic(SFX_GRUNTY_SPELL_POWERUP, 30000); break; case 13: func_8030E878(SFX_131_GRUNTY_WEEEGH, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); @@ -858,18 +858,18 @@ void chfinalboss_func_803885DC(Actor *this) { s32 sp24 = globalTimer_getTime(); if (func_8030E3FC(this->unk44_31) == 0) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } if (((sp24 & 7) == 0) && (randf() < 0.5)) { chfinalboss_func_8038856C(this, D_80391728); } if ((actor_animationIsAt(this, 0.30f) != 0) || (actor_animationIsAt(this, 0.78f) != 0)) { - FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000, this->position, 2000, 10000); - FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 25000, this->position, 2000, 10000); + sfx_playFadeShorthandDefault(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000, this->position, 2000, 10000); + sfx_playFadeShorthandDefault(SFX_8E_GRUNTLING_DAMAGE, 1.0f, 25000, this->position, 2000, 10000); } if ((actor_animationIsAt(this, 0.40f) != 0) || (actor_animationIsAt(this, 0.88f) != 0)) { - FUNC_8030E8B4(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000, this->position, 2000, 10000); - FUNC_8030E8B4(SFX_8E_GRUNTLING_DAMAGE, 0.9f, 25000, this->position, 2000, 10000); + sfx_playFadeShorthandDefault(SFX_1E_HITTING_AN_ENEMY_2, 1.0f, 25000, this->position, 2000, 10000); + sfx_playFadeShorthandDefault(SFX_8E_GRUNTLING_DAMAGE, 0.9f, 25000, this->position, 2000, 10000); } } @@ -955,7 +955,7 @@ void chfinalboss_phase1_update(ActorMarker *marker) { func_80328FB0(this, 30.0f * sp54); if ((local->unkA == 0) && (local->unk20 < (local->unk14 * 0.65))) { local->unkA = 1U; - FUNC_8030E8B4(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 28000, this->position, 2000, 10000); + sfx_playFadeShorthandDefault(SFX_C4_TWINKLY_MUNCHER_GRR, 0.6f, 28000, this->position, 2000, 10000); } if ((local->unk14 * 0.75) < local->unk20) { chfinalboss_func_80386B54(sp40, 0); @@ -1080,19 +1080,19 @@ void chfinalboss_phase2_setState(Actor *this, s32 arg1){ break; case 19: if (sp28 & 1) { - FUNC_8030E8B4(SFX_132_GRUNTY_YOW, 1.0f, 32000, this->position, 7000, 12000); + sfx_playFadeShorthandDefault(SFX_132_GRUNTY_YOW, 1.0f, 32000, this->position, 7000, 12000); } else{ - FUNC_8030E8B4(SFX_133_GRUNTY_OHW, 1.0f, 32000, this->position, 7000, 12000); + sfx_playFadeShorthandDefault(SFX_133_GRUNTY_OHW, 1.0f, 32000, this->position, 7000, 12000); } break; case 20: - FUNC_8030E8B4(SFX_131_GRUNTY_WEEEGH, 1.0f, 32000, this->position, 5000, 12000); + sfx_playFadeShorthandDefault(SFX_131_GRUNTY_WEEEGH, 1.0f, 32000, this->position, 5000, 12000); local->unkA = 0; break; case 17: - func_8025A6EC(SFX_GRUNTY_SPELL_POWERUP, 30000); + coMusicPlayer_playMusic(SFX_GRUNTY_SPELL_POWERUP, 30000); break; } } @@ -1166,8 +1166,8 @@ void chfinalboss_phase2_update(ActorMarker *marker) { case 20: if (actor_animationIsAt(this, 0.9999f)) { if (local->hits >= 4) { - gcdialog_showText(randi2(0, 5) + 0x1115, 0x20, NULL, NULL, NULL, NULL); - gcdialog_showText(randi2(0, 3) + 0x111A, 4, NULL, this->marker, NULL, chfinalboss_phase2_endTextCallback); + gcdialog_showDialog(randi2(0, 5) + 0x1115, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 3) + 0x111A, 4, NULL, this->marker, NULL, chfinalboss_phase2_endTextCallback); chfinalboss_phase2_setState(this, 0x11); } else{ @@ -1214,7 +1214,7 @@ void __chfinalboss_spawnStatue(enum ch_bossjinjo_e statue_id) { break; } sp1C->lifetime_value = (statue_id == BOSSJINJO_5_JINJONATOR) ? 5.25f : 1.54f; - sp1C->unkF4_8 = statue_id; + sp1C->actorTypeSpecificField = statue_id; } void chfinalboss_spawnStatue(s32 statue_id) { @@ -1225,7 +1225,7 @@ void __chfinalboss_spawnSpellBarrier(ActorMarker *marker) { Actor *actor; actor = marker_getActor(marker); - actor->unk100 = spawn_child_actor(ACTOR_3AB_GRUNTY_SPELL_BARRIER, &actor)->marker; + actor->partnerActor = spawn_child_actor(ACTOR_3AB_GRUNTY_SPELL_BARRIER, &actor)->marker; __chFinalBossSpellBarrierActive = TRUE; } @@ -1267,12 +1267,12 @@ void chfinalboss_phase3_setState(Actor *this, s32 arg1) { local->unk3 = 0; break; case 25: - FUNC_8030E8B4(SFX_131_GRUNTY_WEEEGH, 1.0f, 32000, this->position, 5000, 12000); + sfx_playFadeShorthandDefault(SFX_131_GRUNTY_WEEEGH, 1.0f, 32000, this->position, 5000, 12000); break; case 26: chfinalboss_func_80386CF8(this); func_80324E38(0.0f, 1); - gcdialog_showText(randi2(0, 5) + 0x112C, 0xA8, NULL, this->marker, chfinalboss_phase3_endTextCallback, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x112C, 0xA8, NULL, this->marker, chfinalboss_phase3_endTextCallback, NULL); break; } } @@ -1328,7 +1328,7 @@ void chfinalboss_phase3_update(ActorMarker *marker) { } break; case 23: - if (chfinalboss_func_80386BEC(this, 9.0f) && (func_80297C6C() != 3)) { + if (chfinalboss_func_80386BEC(this, 9.0f) && (bsiFrame_getState() != 3)) { chfinalboss_phase3_setState(this, 0x18); } break; @@ -1413,7 +1413,7 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { if ((local->unk3 == 2) && (local->unkA == 0)) { iter.D_803928C4_ptr = &D_803928C4; chFinalBossJinjoSpawned = TRUE; - gcdialog_showText(randi2(0, 5) + 0x1136, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1136, 4, NULL, NULL, NULL, NULL); if ( !fileProgressFlag_get(FILEPROG_D2_HAS_SPAWNED_A_JINJO_STATUE_IN_FINAL_FIGHT) ) { local->unkA = 1U; sFinalBossJinjoStatueActivated = 1; @@ -1475,13 +1475,13 @@ void chfinalboss_phase4_setState(Actor *this, s32 arg1) { break; case 34: actor_playAnimationOnce(this); - gcdialog_showText(randi2(0, 5) + 0x1145, 0x20, NULL, NULL, NULL, NULL); - func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); - func_8030E6A4(SFX_133_GRUNTY_OHW, randf2(0.95f, 1.05f), 32000); + gcdialog_showDialog(randi2(0, 5) + 0x1145, 0x20, NULL, NULL, NULL, NULL); + gcsfx_playWithPitch(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_133_GRUNTY_OHW, randf2(0.95f, 1.05f), 32000); this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); D_803927C0 = 1.0f; sfxsource_setSfxId(this->unk44_31, SFX_2C_PULLING_NOISE); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, D_803927C0); sfxsource_setSampleRate(this->unk44_31, 26000); for(iter.i = 0; iter.i < 4; iter.i+=1){ @@ -1549,7 +1549,7 @@ void chfinalboss_phase4_update(ActorMarker *marker) { func_80324E38(1.0f, 0); } if (local->hits == 0) { - gcdialog_showText(randi2(0, 5) + 0x1140, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1140, 0x20, NULL, NULL, NULL, NULL); } if ((local->hits + 1) < 4) { local->hits++; @@ -1575,7 +1575,7 @@ void chfinalboss_phase4_update(ActorMarker *marker) { break; case 29: - if ((chfinalboss_func_80386BEC(this, 9.0f)) && (func_80297C6C() != 3) && (sFinalBossJinjoStatueActivated == 0)) { + if ((chfinalboss_func_80386BEC(this, 9.0f)) && (bsiFrame_getState() != 3) && (sFinalBossJinjoStatueActivated == 0)) { chfinalboss_phase4_setState(this, 0x1E); } break; @@ -1623,8 +1623,8 @@ void chfinalboss_phase4_update(ActorMarker *marker) { this->position[2] = sp5C[2]; this->position[1] = temp_f2; chfinalboss_phase4_setState(this, 0x22); - func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); - func_8030E6A4(SFX_132_GRUNTY_YOW, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_132_GRUNTY_YOW, randf2(0.95f, 1.05f), 32000); } else{ this->position[0] = sp5C[0]; @@ -1637,19 +1637,19 @@ void chfinalboss_phase4_update(ActorMarker *marker) { case 34: sp58 = anctrl_getAnimTimer(this->anctrl); if (actor_animationIsAt(this, 0.17f) != 0) { - func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); - func_8030E6A4(SFX_133_GRUNTY_OHW, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_133_GRUNTY_OHW, randf2(0.95f, 1.05f), 32000); } if (actor_animationIsAt(this, 0.1f) != 0) { - func_8030E6A4(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); - func_8030E6A4(SFX_12A_GRUNTY_AH, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_1F_HITTING_AN_ENEMY_3, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_12A_GRUNTY_AH, randf2(0.95f, 1.05f), 32000); } if ((sp58 >= 0.4) && (sp58 <= 0.65)) { sfxsource_playSfxAtVolume(this->unk44_31, ((D_803927C0 += 0.005) > 1.99) ? 1.99 : (D_803927C0 += 0.005)); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } if (actor_animationIsAt(this, 0.56f)) { - func_8030E6A4(SFX_C5_TWINKLY_POP, randf2(0.95f, 1.05f), 32000); + gcsfx_playWithPitch(SFX_C5_TWINKLY_POP, randf2(0.95f, 1.05f), 32000); } else if (actor_animationIsAt(this, 0.9999f)) { timed_exitStaticCamera(0.0f); @@ -1680,7 +1680,7 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { subaddie_set_state_with_direction(this, next_state, 0.0001f, 1); switch (next_state) { case 35: - gcdialog_showText(randi2(0, 5) + 0x114F, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x114F, 4, NULL, NULL, NULL, NULL); if (local->mirror_phase5) { sp28 = 0x13; } @@ -1705,7 +1705,7 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { if (this->unk44_31 == 0) { this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_134_FREEZING_SHIVER); - func_8030DD14(this->unk44_31, 2); + sfxSource_setunk43_7ByIndex(this->unk44_31, 2); sfxsource_playSfxAtVolume(this->unk44_31, 1.0f); sfxsource_setSampleRate(this->unk44_31, 0x4268); } @@ -1716,10 +1716,10 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { if (this->unk44_31 == 0) { this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, SFX_134_FREEZING_SHIVER); - func_8030DD14(this->unk44_31, 3); + sfxSource_setunk43_7ByIndex(this->unk44_31, 3); sfxsource_playSfxAtVolume(this->unk44_31, 1.0f); sfxsource_setSampleRate(this->unk44_31, 0x4268); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } break; @@ -1733,7 +1733,7 @@ void chfinalboss_phase5_setState(Actor *this, s32 next_state) { break; case 38: - func_8025A6EC(SFX_GRUNTY_SPELL_POWERUP, 30000); + coMusicPlayer_playMusic(SFX_GRUNTY_SPELL_POWERUP, 30000); break; case 43: @@ -1748,7 +1748,7 @@ void chfinalboss_func_8038AF84(ActorMarker *arg0) { } void chfinalboss_func_8038AFB0(void) { - func_802E4078(MAP_87_CS_SPIRAL_MOUNTAIN_5, 0, 1); + transitionToMap(MAP_87_CS_SPIRAL_MOUNTAIN_5, 0, 1); } void chfinalboss_phase5_update(ActorMarker *marker) { @@ -1793,7 +1793,7 @@ void chfinalboss_phase5_update(ActorMarker *marker) { func_802BB3DC(0, 63.0f, 0.9f); chjinjonator_finalAttack(jinjonator_marker); func_8030E6D4(SFX_HEAVY_THUNDERSTORM_01); - func_8025A6EC(COMUSIC_A3_JINJONATOR_HITS_GRUNTY_J, 20000); + coMusicPlayer_playMusic(COMUSIC_A3_JINJONATOR_HITS_GRUNTY_J, 20000); chfinalboss_phase5_setState(this, 0x2B); timed_exitStaticCamera(0.0f); timed_setStaticCameraToNode(0.0f, sp38 + 0xD); @@ -1804,7 +1804,7 @@ void chfinalboss_phase5_update(ActorMarker *marker) { player_setIdealRotation(D_803928C8); } if (__chFinalBossJinjonatorHits == 3) { - gcdialog_showText(randi2(0, 5) + 0x1159, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1159, 0x20, NULL, NULL, NULL, NULL); } } } @@ -1814,14 +1814,14 @@ void chfinalboss_phase5_update(ActorMarker *marker) { break; case 36: - if (chfinalboss_func_80386BEC(this, 9.0f) && (func_80297C6C() != 3)) { + if (chfinalboss_func_80386BEC(this, 9.0f) && (bsiFrame_getState() != 3)) { chfinalboss_phase5_setState(this, 0x25); } break; case 37: chfinalboss_func_80386BEC(this, 3.0f); - if (func_80297C6C() == 3) { + if (bsiFrame_getState() == 3) { chfinalboss_phase5_setState(this, 0x24); break; } @@ -1865,10 +1865,10 @@ void chfinalboss_phase5_update(ActorMarker *marker) { case 40: if (actor_animationIsAt(this, 0.21f)) { - FUNC_8030E8B4(SFX_163_GRUNTY_WILD_SCREAM, 1.0f, 32000, this->position, 5000, 12000); + sfx_playFadeShorthandDefault(SFX_163_GRUNTY_WILD_SCREAM, 1.0f, 32000, this->position, 5000, 12000); } if ((0.56 < sp34) && (sp34 < 0.99)) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } if (actor_animationIsAt(this, 0.9999f)) { chfinalboss_phase5_setState(this, 0x27); @@ -1885,7 +1885,7 @@ void chfinalboss_phase5_update(ActorMarker *marker) { func_802BB3DC(0, 12.0f, 1.0f); v0 = this->unk44_31; if (v0 != 0) { - func_8030E394(v0); + sfxSource_triggerCallbackByIndex(v0); sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } @@ -1954,10 +1954,10 @@ void chfinalboss_func_8038B780(ActorMarker *marker) { sp24 = marker_getActor(marker); if (!fileProgressFlag_get(FILEPROG_CF_HAS_ENTERED_FINAL_FIGHT)) { fileProgressFlag_set(FILEPROG_CF_HAS_ENTERED_FINAL_FIGHT, TRUE); - gcdialog_showText(ASSET_10E7_DIALOG_UNKNOWN, 0x2A, sp24->position, sp24->marker, chfinalboss_phase0_endTextCallback, NULL); + gcdialog_showDialog(ASSET_10E7_DIALOG_FINALBOSS_ENTERING_1, 0x2A, sp24->position, sp24->marker, chfinalboss_phase0_endTextCallback, NULL); } else{ - gcdialog_showText(randi2(0, 5) + 0x10E8, 0x2B, sp24->position, sp24->marker, chfinalboss_phase0_endTextCallback, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x10E8, 0x2B, sp24->position, sp24->marker, chfinalboss_phase0_endTextCallback, NULL); } } @@ -2018,7 +2018,7 @@ void chfinalboss_collisionPassive(ActorMarker *marker, ActorMarker *other_marker switch (local->phase) { case 1: if (local->hits == 0) { - gcdialog_showText(randi2(0, 5) + 0x10F7, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x10F7, 0x20, NULL, NULL, NULL, NULL); } if ((local->hits + 1) < 5) { local->hits++; @@ -2032,7 +2032,7 @@ void chfinalboss_collisionPassive(ActorMarker *marker, ActorMarker *other_marker if ((local->unk2 + 1) >= 3) { local->unk2 = 0; if (local->hits == 0) { - gcdialog_showText(randi2(0, 5) + 0x1110, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1110, 0x20, NULL, NULL, NULL, NULL); } if ((local->hits + 1) < 5) { local->hits++; @@ -2046,7 +2046,7 @@ void chfinalboss_collisionPassive(ActorMarker *marker, ActorMarker *other_marker break; case 3: if (local->hits == 0) { - gcdialog_showText(randi2(0, 5) + 0x1127, 0x20, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + 0x1127, 0x20, NULL, NULL, NULL, NULL); } if ((local->hits + 1) < 5) { local->hits++; @@ -2067,7 +2067,7 @@ void chfinalboss_collisionActive(ActorMarker *marker, ActorMarker *other_marker) func_8030E878(SFX_EA_GRUNTY_LAUGH_1, randf2(0.95f, 1.05f), 32000, this->position, 5000.0f, 12000.0f); if (local->player_hit_in_phase1 == 0) { - if (gcdialog_showText(randi2(0, 5) + ASSET_10ED_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(randi2(0, 5) + ASSET_10ED_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL)) { local->player_hit_in_phase1++; } } @@ -2076,7 +2076,7 @@ void chfinalboss_collisionActive(ActorMarker *marker, ActorMarker *other_marker) if (local->phase == FINALBOSS_PHASE_3_FLIGHT) { if ((local->player_hit_in_phase3 == 0) && (this->state != 0x1A)) { local->player_hit_in_phase3++; - gcdialog_showText(randi2(0, 5) + ASSET_111D_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL); + gcdialog_showDialog(randi2(0, 5) + ASSET_111D_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL); } } } @@ -2173,8 +2173,8 @@ void chfinalboss_update(Actor *this){ chFinalBossPosition[1] = this->position[1]; chFinalBossPosition[2] = this->position[2]; - if(this->unk100 != NULL && __chFinalBossSpellBarrierActive){ - fight_setPositionWithDisplacement(this->unk100, this->position); + if(this->partnerActor != NULL && __chFinalBossSpellBarrierActive){ + fight_setPositionWithDisplacement(this->partnerActor, this->position); } if(__chFinalBossShadowMarker != NULL){ diff --git a/src/fight/chgreenblast.c b/src/fight/chgreenblast.c index 4cefedf8..9b1acb10 100644 --- a/src/fight/chgreenblast.c +++ b/src/fight/chgreenblast.c @@ -60,7 +60,7 @@ void chGreenBlast_collisionDie(ActorMarker *marker, ActorMarker *other_marker){ explosion_position[2] = actor->position_z; explosion_position[1] += 160.0f; - FUNC_8030E8B4(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor->position, 1000, 3500); + sfx_playFadeShorthandDefault(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor->position, 1000, 3500); timedFunc_set_0(0.0f, chGreenBlast_func_8038FC88); timedFunc_set_0(0.3f, chGreenBlast_func_8038FCBC); diff --git a/src/fight/chjinjonator.c b/src/fight/chjinjonator.c index 9cd74f5c..29505d55 100644 --- a/src/fight/chjinjonator.c +++ b/src/fight/chjinjonator.c @@ -132,7 +132,7 @@ void chjinjonator_8039040C(Actor *this) { sfxsource_playSfxAtVolume(this->unk44_31, local->sfx_volume); if (func_8030E3FC(this->unk44_31) == 0) - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } void chjinjonator_update(Actor *this){ @@ -147,12 +147,12 @@ void chjinjonator_update(Actor *this){ this->volatile_initialized = TRUE; local->sfx_volume_adjust = 0.40000000000000013 / (this->lifetime_value + 3.3); local->sfx_volume = 0.7f; - func_8025A6EC(JINGLE_MENACING_GRUNTILDA_B, 20000); + coMusicPlayer_playMusic(JINGLE_MENACING_GRUNTILDA_B, 20000); func_8025A58C(0, 0x7fff); this->unk44_31 = func_8030ED2C(SFX_17A_SHIPHORN, 3); sfxsource_setSampleRate(this->unk44_31, 25000); sfxsource_playSfxAtVolume(this->unk44_31, local->sfx_volume); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); local->attack_timer = 12; } @@ -188,7 +188,7 @@ void chjinjonator_update(Actor *this){ if (actor_animationIsAt(this, 0.999f)) { subaddie_set_state_with_direction(this, JINJONATOR_STATE_3_MOVE_UPWARD, 0.001f, 1); actor_playAnimationOnce(this); - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; local->velocity_move_up = (320.0f - this->position_y) * 0.5; @@ -232,7 +232,7 @@ void chjinjonator_update(Actor *this){ this->unk44_31 = func_8030ED2C(0x416, 3); sfxsource_setSampleRate(this->unk44_31, 26000); sfxsource_playSfxAtVolume(this->unk44_31, local->sfx_volume); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } local->boss_claw_sfx_volume = 0.5f; @@ -251,10 +251,10 @@ void chjinjonator_update(Actor *this){ if(actor_animationIsAt(this, 0.5f)){ if(--local->attack_timer <= 0){ chjinjonator_803903C4(this); - FUNC_8030E8B4(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); + sfx_playFadeShorthandDefault(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); func_80324D54(0.1f, SFX_C1_BUZZBOMB_ATTACK, 0.85f, 32000, this->position, 5000.0f, 12000.0f); if((u8)this->unk44_31){ - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } @@ -286,7 +286,7 @@ void chjinjonator_update(Actor *this){ if(actor_animationIsAt(this, 0.999f)){ func_8034A174(this->marker->unk44, 0x1f, this->position); chjinjonator_803903C4(this); - FUNC_8030E8B4(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); + sfx_playFadeShorthandDefault(SFX_135_CARTOONY_SPRING, 1.0f, 32000, this->position, 10000, 16000); func_80324D54(0.1f, SFX_C1_BUZZBOMB_ATTACK, 0.85f, 32000, this->position, 5000.0f, 12000.0f); this->velocity[2] = 0.0f; this->velocity[1] = 0.0f; @@ -331,7 +331,7 @@ void chjinjonator_update(Actor *this){ actor_playAnimationOnce(this); func_802BB41C(0); text_id = 0x115e + randi2(0,5); - gcdialog_showText(text_id, 0x20, 0, 0, 0, 0); + gcdialog_showDialog(text_id, 0x20, 0, 0, 0, 0); } break; @@ -367,10 +367,10 @@ void chjinjonator_attack(ActorMarker *marker, s32 hit_count, bool mirrored) { ActorLocal_Jinjonator *local = (ActorLocal_Jinjonator *) &actor_jinjonator->local; s32 pad; - func_8025A6EC(chJinjonatorHitSounds[hit_count - 1], 20000); + coMusicPlayer_playMusic(chJinjonatorHitSounds[hit_count - 1], 20000); chjinjonator_spawnAttackParticles(actor_jinjonator, hit_count); - FUNC_8030E8B4(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor_jinjonator->position, 1000, 6500); + sfx_playFadeShorthandDefault(SFX_1B_EXPLOSION_1, 1.0f, 32000, actor_jinjonator->position, 1000, 6500); actor_jinjonator->velocity[2] = 0.0f; actor_jinjonator->velocity[1] = 0.0f; diff --git a/src/fight/chjinjonatorbase.c b/src/fight/chjinjonatorbase.c index 161bd8a9..020a260f 100644 --- a/src/fight/chjinjonatorbase.c +++ b/src/fight/chjinjonatorbase.c @@ -17,9 +17,9 @@ void chjinjonatorbase_spawnStoneJinjo(ActorMarker *marker) { Actor *actor_jinjonatorbase = marker_getActor(marker); Actor *actor_stonejinjo = spawn_child_actor(ACTOR_3A1_STONE_JINJO, &actor_jinjonatorbase); - actor_stonejinjo->unkF4_8 = actor_jinjonatorbase->unkF4_8; + actor_stonejinjo->actorTypeSpecificField = actor_jinjonatorbase->actorTypeSpecificField; actor_stonejinjo->position_y = actor_stonejinjo->position_y + 155.0f; - actor_jinjonatorbase->unk100 = actor_stonejinjo->marker; + actor_jinjonatorbase->partnerActor = actor_stonejinjo->marker; } void chjinjonatorbase_createSmokeParticles(f32 position[3], s32 count) { @@ -64,7 +64,7 @@ void chjinjonatorbase_getHitByEgg(ActorMarker *this, ActorMarker *other) { if (remaining_hits <= 0) { chfinalboss_setBossDefeated(); subaddie_set_state(actor_jinjonatorbase, CHBOSSJINJOBASE_STATE_3_SPAWNED_BOSS_JINJO); - chstonejinjo_breakOpen(actor_jinjonatorbase->unk100); + chstonejinjo_breakOpen(actor_jinjonatorbase->partnerActor); } } } @@ -107,16 +107,16 @@ void chjinjonatorbase_update(Actor *this){ this->unk44_31 = sfxsource_createSfxsourceAndReturnIndex(); sfxsource_setSfxId(this->unk44_31, 0x3f9); - func_8030DD14(this->unk44_31, 3); + sfxSource_setunk43_7ByIndex(this->unk44_31, 3); sfxsource_playSfxAtVolume(this->unk44_31, 1.0f); sfxsource_setSampleRate(this->unk44_31, 26000); - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); temp_s0 = func_802F9AA8(0x3EC); func_802F9DB8(temp_s0, 0.5f, 0.5f, 0.0f); func_802F9EC4(temp_s0, this->position, 5000, 15000); func_802F9FD0(temp_s0, 0.25f, this->lifetime_value - 1.0, 1); func_802FA060(temp_s0, 17000, 17000, 0.0f); - func_8025A6EC(JINGLE_MENACING_GRUNTILDA_A, 15000); + coMusicPlayer_playMusic(JINGLE_MENACING_GRUNTILDA_A, 15000); func_8032BB88(this, 0, 0x7fff); timedFunc_set_1(8.0f, (GenFunction_1)chjinjonatorbase_func_8038E2CC, reinterpret_cast(s32,this->marker)); this->unk1C[0] = this->position_x; @@ -139,12 +139,12 @@ void chjinjonatorbase_update(Actor *this){ } else { if(this->state == CHBOSSJINJOBASE_STATE_1_RAISE) { - actor_jinjonator = marker_getActor(this->unk100); + actor_jinjonator = marker_getActor(this->partnerActor); y_delta = this->velocity_y * delta_time; if(this->position_y + y_delta < this->unk1C[1]) { if (!func_8030E3FC(this->unk44_31)) { - func_8030E2C4(this->unk44_31); + sfxSource_func_8030E2C4(this->unk44_31); } position_delta[0] = (rumbling & 1) ? 3.0f : -3.0f; @@ -169,7 +169,7 @@ void chjinjonatorbase_update(Actor *this){ subaddie_set_state(this, CHBOSSJINJOBASE_STATE_2_DEFAULT); FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000); - func_8030E394(this->unk44_31); + sfxSource_triggerCallbackByIndex(this->unk44_31); sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; diff --git a/src/fight/chspellbarrier.c b/src/fight/chspellbarrier.c index db28742d..ca2f33a0 100644 --- a/src/fight/chspellbarrier.c +++ b/src/fight/chspellbarrier.c @@ -30,11 +30,11 @@ void chspellbarrier_collisionPassive(ActorMarker *this, ActorMarker *other) { local->unk4 = 0; if (func_8030E3FC(local->sfxsourceIdx) == 0) { - func_8030E2C4(local->sfxsourceIdx); + sfxSource_func_8030E2C4(local->sfxsourceIdx); } if (func_8030E3FC(actor_spellbarrier->unk44_31) == 0) { - func_8030E2C4(actor_spellbarrier->unk44_31); + sfxSource_func_8030E2C4(actor_spellbarrier->unk44_31); } } @@ -73,7 +73,7 @@ void chspellbarrier_update(Actor *this) { local->sfxsourceIdx = func_8030ED2C(0x415, 3); func_8030DB04(local->sfxsourceIdx, 32000, this->position, 4000.0f, 12000.0f); sfxsource_playSfxAtVolume(local->sfxsourceIdx, 1.0f); - FUNC_8030E8B4(SFX_416, 0.8f, 32000, this->position, 10000, 25000); + sfx_playFadeShorthandDefault(SFX_416, 0.8f, 32000, this->position, 10000, 25000); } jinjo_marker = chfinalboss_findCollidingJinjo(this, 600.0f); diff --git a/src/fight/chspellfireball.c b/src/fight/chspellfireball.c index 741a6e40..dca8a0ad 100644 --- a/src/fight/chspellfireball.c +++ b/src/fight/chspellfireball.c @@ -147,7 +147,7 @@ void chSpellFireball_createExplosionParticles(ActorMarker *marker) { position[1] += 120.0f; if (actor->state != SPELLFIREBALL_STATE_2_DESPAWN) { - FUNC_8030E8B4(SFX_148_GRUNTY_SPELL_LANDING, 1.0f, 32000, actor->position, 1000, 3500); + sfx_playFadeShorthandDefault(SFX_148_GRUNTY_SPELL_LANDING, 1.0f, 32000, actor->position, 1000, 3500); timedFunc_set_0(0.0f, chSpellFireball_func_8038F01C); timedFunc_set_0(0.3f, chSpellFireball_func_8038F050); actor->unk58_0 = 0; @@ -184,21 +184,21 @@ void chSpellFireball_collisionDie(ActorMarker *marker, ActorMarker *other) { switch(volatileFlag_getN(VOLATILE_FLAG_23_FINAL_BOSS_PHASE, 3)) { case FINALBOSS_PHASE_1_BROOMSTICK: - if (!sFightPlayerHitBySpellInPhase1 && gcdialog_showText(randi2(0, 5) + ASSET_10F2_DIALOG_FINALBOSS_PHASE_1_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase1 && gcdialog_showDialog(randi2(0, 5) + ASSET_10F2_DIALOG_FINALBOSS_PHASE_1_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase1 = TRUE; } break; case FINALBOSS_PHASE_2_AIR: - if (!sFightPlayerHitBySpellInPhase2 && gcdialog_showText(randi2(0, 5) + ASSET_110B_DIALOG_FINALBOSS_PHASE_2_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase2 && gcdialog_showDialog(randi2(0, 5) + ASSET_110B_DIALOG_FINALBOSS_PHASE_2_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase2 = TRUE; } break; case FINALBOSS_PHASE_3_FLIGHT: - if (!sFightPlayerHitBySpellInPhase3 && gcdialog_showText(randi2(0, 5) + ASSET_1122_DIALOG_FINALBOSS_PHASE_3_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase3 && gcdialog_showDialog(randi2(0, 5) + ASSET_1122_DIALOG_FINALBOSS_PHASE_3_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase3 = TRUE; } @@ -207,7 +207,7 @@ void chSpellFireball_collisionDie(ActorMarker *marker, ActorMarker *other) { case FINALBOSS_PHASE_4_JINJOS: if (!sFightPlayerHitBySpellInPhase4 && chfinalboss_isJinjoSpawned() && - gcdialog_showText(randi2(0, 5) + ASSET_113B_DIALOG_FINALBOSS_PHASE_4_OPTION_1, 0, 0, 0, 0, 0)) + gcdialog_showDialog(randi2(0, 5) + ASSET_113B_DIALOG_FINALBOSS_PHASE_4_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase4 = TRUE; } @@ -216,7 +216,7 @@ void chSpellFireball_collisionDie(ActorMarker *marker, ActorMarker *other) { case FINALBOSS_PHASE_5_JINJONATOR: if (!sFightPlayerHitBySpellInPhase5 && chfinalboss_isJinjonatorSpawned() && - gcdialog_showText(randi2(0, 5) + ASSET_1154_DIALOG_FINALBOSS_PHASE_5_OPTION_1, 0, 0, 0, 0, 0)) + gcdialog_showDialog(randi2(0, 5) + ASSET_1154_DIALOG_FINALBOSS_PHASE_5_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase5 = TRUE; } diff --git a/src/fight/chstonejinjo.c b/src/fight/chstonejinjo.c index c275ea25..d68eedec 100644 --- a/src/fight/chstonejinjo.c +++ b/src/fight/chstonejinjo.c @@ -16,13 +16,13 @@ void chstonejinjo_spawnJinjo(ActorMarker *marker) { Actor *actor_stonejinjo = marker_getActor(marker); Actor *actor_jinjo; - if (actor_stonejinjo->unkF4_8 == BOSSJINJO_5_JINJONATOR) { + if (actor_stonejinjo->actorTypeSpecificField == BOSSJINJO_5_JINJONATOR) { actor_jinjo = spawn_child_actor(ACTOR_3AC_JINJONATOR, &actor_stonejinjo); } else { - actor_jinjo = spawn_child_actor(ACTOR_3A4_BOSS_JINJO_BASE_IDX + actor_stonejinjo->unkF4_8, &actor_stonejinjo); + actor_jinjo = spawn_child_actor(ACTOR_3A4_BOSS_JINJO_BASE_IDX + actor_stonejinjo->actorTypeSpecificField, &actor_stonejinjo); } - actor_jinjo->unkF4_8 = actor_stonejinjo->unkF4_8; + actor_jinjo->actorTypeSpecificField = actor_stonejinjo->actorTypeSpecificField; actor_jinjo->lifetime_value = actor_stonejinjo->unk1C[0]; actor_jinjo->scale = actor_stonejinjo->scale; } @@ -33,7 +33,7 @@ void chstonejinjo_update(Actor *this) { this->marker->propPtr->unk8_3 = TRUE; actor_collisionOff(this); - if (this->unkF4_8 == BOSSJINJO_5_JINJONATOR) { + if (this->actorTypeSpecificField == BOSSJINJO_5_JINJONATOR) { this->marker->unk40_23 = TRUE; this->marker->unk40_20 = TRUE; this->unk1C[0] = 6.0f; @@ -50,9 +50,9 @@ void chstonejinjo_update(Actor *this) { break; case STONEJINJO_STATE_2_BREAK_OPEN: - if (this->unkF4_8 != BOSSJINJO_5_JINJONATOR) { + if (this->actorTypeSpecificField != BOSSJINJO_5_JINJONATOR) { if (actor_animationIsAt(this, 0.001f)) { - FUNC_8030E8B4(SFX_D_EGGSHELL_BREAKING, 1.2f, 25000, this->position, 1000, 5000); + sfx_playFadeShorthandDefault(SFX_D_EGGSHELL_BREAKING, 1.2f, 25000, this->position, 1000, 5000); func_8030E878(SFX_80_YUMYUM_CLACK, randf2(0.6f, 0.8f), 20000, this->position, 1000.0f, 5000.0f); } @@ -67,7 +67,7 @@ void chstonejinjo_update(Actor *this) { } else { if (actor_animationIsAt(this, 0.001f)) { - FUNC_8030E8B4(SFX_D_EGGSHELL_BREAKING, 1.2f, 25000, this->position, 1000, 5000); + sfx_playFadeShorthandDefault(SFX_D_EGGSHELL_BREAKING, 1.2f, 25000, this->position, 1000, 5000); func_8030E878(SFX_80_YUMYUM_CLACK, randf2(0.4f, 0.6f), 20000, this->position, 1000.0f, 5000.0f); } @@ -91,7 +91,7 @@ void chstonejinjo_update(Actor *this) { actor_animationIsAt(this, 0.9f) || actor_animationIsAt(this, 0.98f)) { - func_8030E6A4(SFX_3_DULL_CANNON_SHOT, randf2(1.2f, 1.4f), 20000); + gcsfx_playWithPitch(SFX_3_DULL_CANNON_SHOT, randf2(1.2f, 1.4f), 20000); } } @@ -118,8 +118,8 @@ void chstonejinjo_breakOpen(ActorMarker *marker) { anctrl_setDuration(actor_stonejinjo->anctrl, actor_stonejinjo->unk1C[0]); SPAWNQUEUE_ADD_1(chstonejinjo_spawnJinjo, actor_stonejinjo->marker); - if (!fileProgressFlag_get(FILEPROG_D1_HAS_ACTIVATED_A_JINJO_STATUE_IN_FINAL_FIGHT) && actor_stonejinjo->unkF4_8 != BOSSJINJO_5_JINJONATOR) { - camera_node = 48 + actor_stonejinjo->unkF4_8 * 2; + 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; bossjinjo_wakeup_time = chbossjinjo_getWakeUpTime(); camera_duration_time = actor_stonejinjo->unk1C[0] + bossjinjo_wakeup_time; chfinalboss_getPosition(position_finalboss); diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index 357b857d..f5ebf351 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -24,15 +24,15 @@ void func_8038BA30(ActorMarker *marker, enum asset_e text_id, s32 arg2){ this = marker_getActor(marker); phi_v1 = this->unk10_12*2; - volatileFlag_getN(VOLATILE_FLAG_20_BEGIN_CHARACTER_PARADE + this->unkF4_8*6 + phi_v1, 2); + volatileFlag_getN(VOLATILE_FLAG_20_BEGIN_CHARACTER_PARADE + this->actorTypeSpecificField*6 + phi_v1, 2); } -void lair_func_8038BA88(ActorMarker *marker, enum asset_e text_id, s32 arg2){ +void healDuoToFull(ActorMarker *marker, enum asset_e textId_unused, s32 arg2){ Actor *this; this = marker_getActor(marker); item_set(ITEM_14_HEALTH, item_getCount(ITEM_15_HEALTH_TOTAL)); - fileProgressFlag_set(this->unkF4_8 - 1 + FILEPROG_E9_HEALED_BY_BRENTILDA_1, TRUE); + fileProgressFlag_set(this->actorTypeSpecificField - 1 + FILEPROG_E9_HEALED_BY_BRENTILDA_1, TRUE); } void func_8038BADC(ActorMarker *marker, enum asset_e text_id, s32 arg2) { @@ -40,13 +40,13 @@ void func_8038BADC(ActorMarker *marker, enum asset_e text_id, s32 arg2) { this = marker_getActor(marker); if (text_id == ((ActorLocal_lair_5640 *)&this->local)->unk0 + 2) { - if (!fileProgressFlag_get(this->unkF4_8 - 1 + FILEPROG_E9_HEALED_BY_BRENTILDA_1)) { + if (!fileProgressFlag_get(this->actorTypeSpecificField - 1 + FILEPROG_E9_HEALED_BY_BRENTILDA_1)) { if (item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL)) { - gcdialog_showText(ASSET_10A2_DIALOG_UNKNOWN, 0xF, this->position, this->marker, func_8038BADC, lair_func_8038BA88); + gcdialog_showDialog(ASSET_10A2_DIALOG_BRENTILDA_HEAL, 0xF, this->position, this->marker, func_8038BADC, healDuoToFull); return; } } - gcdialog_showText(ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, 0xC, this->position, this->marker, func_8038BADC, NULL); + gcdialog_showDialog(ASSET_D38_DIALOG_EMPTY, 0xC, this->position, this->marker, func_8038BADC, NULL); return; } subaddie_set_state(this, 1); @@ -111,7 +111,7 @@ void chBrentilda_update(Actor *this) { } if (!this->volatile_initialized) { - local->unk0 = this->unkF4_8*3 + 0x1080; + local->unk0 = this->actorTypeSpecificField*3 + 0x1080; this->volatile_initialized = TRUE; } @@ -178,9 +178,9 @@ void chBrentilda_update(Actor *this) { if( (phi_f2 < 300.0) && (player_movementGroup() == BSGROUP_0_NONE) && func_8028F20C() - && !func_803114B0()) { + && !gcdialog_hasCurrentTextId()) { if (!fileProgressFlag_get(FILEPROG_96_MET_BRENTILDA)) { - gcdialog_showText(ASSET_10A1_DIALOG_BRENTILDA_MEET, 0xA, this->position, this->marker, func_8038BADC, NULL); + gcdialog_showDialog(ASSET_10A1_DIALOG_BRENTILDA_MEET, 0xA, this->position, this->marker, func_8038BADC, NULL); fileProgressFlag_set(FILEPROG_96_MET_BRENTILDA, TRUE); subaddie_set_state(this, 2); return; @@ -188,7 +188,7 @@ void chBrentilda_update(Actor *this) { if (func_8028EFC8() && (sp78[FACE_BUTTON(BUTTON_B)] == 1)) { this->unk10_12++; this->unk10_12 %= 3; - func_80311174(local->unk0 + this->unk10_12, 0xB, this->position, this->marker, func_8038BADC, NULL, func_8038BA30); + gcdialog_showDialogConditional(local->unk0 + this->unk10_12, 0xB, this->position, this->marker, func_8038BADC, NULL, func_8038BA30); subaddie_set_state(this, 2); return; } diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index b714dd18..f54160d4 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -63,7 +63,7 @@ f32 D_803936E4[] = {0.03f, 0.09f, 0.2f, 0.25f, 0.32f, 0.4f, 0.45f, 1.0f}; /* .code */ bool func_8038A690(Actor *this) { - if (this->unkF4_8 != 3) { + if (this->actorTypeSpecificField != 3) { return subaddie_playerIsWithinCylinder(this, 400, 90); } else{ @@ -72,11 +72,11 @@ bool func_8038A690(Actor *this) { } enum file_progress_e chWarpCauldron_getFileProgressFlagIndex(Actor *this){ - return this->unkF4_8 -1 + 0x49; + return this->actorTypeSpecificField -1 + 0x49; } enum file_progress_e chWarpCauldron_getPairedFileProgressFlagIndex(Actor *this){ - return ((this->unkF4_8 - 1) ^ 1) + 0x49; + return ((this->actorTypeSpecificField - 1) ^ 1) + 0x49; } void func_8038A704(Actor *this){ @@ -135,8 +135,8 @@ void func_8038A96C(Actor *this, s32 arg1) { sp5C = func_8034C2C4(this->marker, 0x1C3); if(sp5C != 0){ for(i = 0; i < 3; i++){ - sp48[i] = D_803935A8[(((s32)this->unkF4_8 - 1)>>1)][0][i]; - sp38[i] = D_803935A8[(((s32)this->unkF4_8 - 1)>>1)][1][i]; + sp48[i] = D_803935A8[(((s32)this->actorTypeSpecificField - 1)>>1)][0][i]; + sp38[i] = D_803935A8[(((s32)this->actorTypeSpecificField - 1)>>1)][1][i]; } sp48[3] = 1.0f; @@ -153,7 +153,7 @@ void func_8038A96C(Actor *this, s32 arg1) { void func_8038AB90(Actor *this, s32 arg1, s32 arg2, enum sfx_e sfx_id, f32 sfx_timing) { if (arg2 == this->unk10_12) { - if (this->unkF4_8 == 7) { + if (this->actorTypeSpecificField == 7) { func_80324CFC(0.5f, COMUSIC_8C_JINJONATOR_POWERUP, 32000); func_80324D2C(7.0f, COMUSIC_8C_JINJONATOR_POWERUP); } @@ -164,9 +164,9 @@ void func_8038AB90(Actor *this, s32 arg1, s32 arg2, enum sfx_e sfx_id, f32 sfx_t if (sfx_id != SFX_0_BLOOP) { timed_playSfx(sfx_timing, sfx_id, 1.0f, 32000); if (arg2 == 2) { - func_8025A6CC(COMUSIC_3F_MAGIC_CARPET_RISING, 32000); + coMusicPlayer_playMusicWeak(COMUSIC_3F_MAGIC_CARPET_RISING, 32000); func_80324D2C(2.6f, COMUSIC_3F_MAGIC_CARPET_RISING); - func_8030E540(SFX_7C_CHEBOOF); + gcsfx_play(SFX_7C_CHEBOOF); } } } @@ -176,15 +176,15 @@ void func_8038AC7C(Actor *this) { u32 sp28; if( - (func_803114C4() != 0xFAD) - && func_80329530(this, 1200) + (gcdialog_getCurrentTextId() != 0xFAD) + && subaddie_playerIsWithinSphereAndActive(this, 1200) && !fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY) ) { this->lifetime_value += time_getDelta(); if (35.0 < this->lifetime_value) { sp2C = (fileProgressFlag_get(FILEPROG_CF_HAS_ENTERED_FINAL_FIGHT)) ? 0xFB7 : 0xFAE; sp28 = (fileProgressFlag_get(FILEPROG_CF_HAS_ENTERED_FINAL_FIGHT)) ? 0xFBC : 0xFB7; - if (gcdialog_showText(sp2C + this->unk38_31, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showDialog(sp2C + this->unk38_31, 0, NULL, NULL, NULL, NULL)) { this->unk38_31++; this->lifetime_value = 0.0f; if (sp2C + this->unk38_31 >= sp28) { @@ -244,11 +244,11 @@ void chWarpCauldron_update(Actor *this) { func_8038A96C(this, 2); sp50 = TRUE; if( ( func_802D677C(-1) != 0 - && (func_802D677C(-1) == D_80393620[this->unkF4_8 - 1].unk0) + && (func_802D677C(-1) == D_80393620[this->actorTypeSpecificField - 1].unk0) && (func_802D67AC(-1) == MAP_16_GV_RUBEES_CHAMBER) - && (func_802D680C(-1) == this->unkF4_8) + && (func_802D680C(-1) == this->actorTypeSpecificField) ) - || (exit_get() == D_80393620[this->unkF4_8 - 1].unk2) + || (exit_get() == D_80393620[this->actorTypeSpecificField - 1].unk2) ) { func_8028F85C(this->position); this->unk10_12 = 1; @@ -256,7 +256,7 @@ void chWarpCauldron_update(Actor *this) { } if (!fileProgressFlag_get(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET) && fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))) { if (func_802D677C(-1) != map_get()) { - gcdialog_showText(ASSET_F7A_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_F7A_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); fileProgressFlag_set(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET, 1); } } @@ -273,15 +273,15 @@ void chWarpCauldron_update(Actor *this) { subaddie_set_state_forward(this, 2); this->unk38_0 = FALSE; func_8038A96C(this, 1); - func_802BAFE4(D_80393620[this->unkF4_8 - 1].unk3); + gcStaticCamera_activate(D_80393620[this->actorTypeSpecificField - 1].unk3); func_802D09B8(this, 2); phi_a0 = (fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this)) != 0) ? SFX_107_CAULDRON_ACTIVATION_1 : SFX_108_CAULDRON_ACTIVATION_2; - sfxsource_play(phi_a0, 32000); + gcsfx_playAtSampleRate(phi_a0, 32000); if (!fileProgressFlag_get(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET) && !fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))) { - gcdialog_showText(ASSET_F79_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showDialog(ASSET_F79_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); } if (fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))){ - switch(this->unkF4_8){ + switch(this->actorTypeSpecificField){ case 2://L8038B204 func_802D6310(2.0f, MAP_6A_GL_TTC_AND_CC_PUZZLE, 0x62, 0x22, 0); break; @@ -351,16 +351,16 @@ void chWarpCauldron_update(Actor *this) { case 5: //L8038B48C func_8038A96C(this, 3); if (actor_animationIsAt(this, 0.01f)) { - func_8030E540(SFX_7C_CHEBOOF); + gcsfx_play(SFX_7C_CHEBOOF); } if (actor_animationIsAt(this, 0.63f)) { volatileFlag_set(VOLATILE_FLAG_1E, 0); func_802D677C(0); func_8028FCAC(); - nodeprop_getPosition(nodeprop_findByActorIdAndActorPosition(D_80393620[this->unkF4_8 - 1].unk6, this), sp54); - if (this->unkF4_8 == 7) { + nodeprop_getPosition(nodeprop_findByActorIdAndActorPosition(D_80393620[this->actorTypeSpecificField - 1].unk6, this), sp54); + if (this->actorTypeSpecificField == 7) { func_8028F66C(BS_INTR_36_DINGPOT); - func_802BAFE4(0x82); + gcStaticCamera_activate(0x82); } else { func_8028F4B8(sp54, 1620.0f, -4100.0f); } @@ -375,17 +375,17 @@ void chWarpCauldron_update(Actor *this) { func_8038A96C(this, 3); if (actor_animationIsAt(this, 0.99f)) { func_802D6344(); - func_802D677C(D_80393620[((this->unkF4_8 - 1) ^ 1)].unk0); + func_802D677C(D_80393620[((this->actorTypeSpecificField - 1) ^ 1)].unk0); func_802D67AC(0x16); - func_802D680C(((this->unkF4_8 - 1) ^ 1) + 1); - func_802D683C(D_80393620[((this->unkF4_8 - 1) ^ 1)].unk1); - func_8031CC40(D_80393620[((this->unkF4_8 - 1) ^ 1)].unk0, D_80393620[((this->unkF4_8 - 1) ^ 1)].unk2); + func_802D680C(((this->actorTypeSpecificField - 1) ^ 1) + 1); + func_802D683C(D_80393620[((this->actorTypeSpecificField - 1) ^ 1)].unk1); + func_8031CC40(D_80393620[((this->actorTypeSpecificField - 1) ^ 1)].unk0, D_80393620[((this->actorTypeSpecificField - 1) ^ 1)].unk2); } break; case 6: //L8038B64C if (func_8038A690(this) && !fileProgressFlag_get(FILEPROG_F3_MET_DINGPOT)) { - gcdialog_showText(ASSET_FAD_DIALOG_UNKNOWN, 0xA, this->position, NULL, __chWarpCauldron_dingpotDialogCallback, NULL); + gcdialog_showDialog(ASSET_FAD_DIALOG_DINGPOT_MEET, 0xA, this->position, NULL, __chWarpCauldron_dingpotDialogCallback, NULL); } this->unk38_0 = TRUE; diff --git a/src/lair/code_0.c b/src/lair/code_0.c index 858ea2f8..2cab0e62 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -4,18 +4,19 @@ #include "prop.h" #include "actor.h" +#include "core2/dustemitter.h" + extern void func_8028F918(s32); extern void func_802D2FB0(Actor *, s32, s32, s32, f32, s32, s32, s32); extern void func_802D3CE8(Actor *); extern void func_802D3D54(Actor *); extern void func_802D3D74(Actor *this); extern void func_802D4830(Actor *, s32, f32); -extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_80324CFC(f32, enum comusic_e, s32); extern int actor_animationIsAt(Actor *, f32); extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_8033A45C(s32, s32); -extern void func_8034E0FC(void *, s32); +extern void setStruct6DsOpacity(void *, s32); @@ -61,8 +62,8 @@ void func_8038A0A4(Actor *this); extern ActorInfo D_80393560; extern ActorInfo D_80393584; -extern ActorInfo D_803947B0; -extern ActorInfo D_803947D4; +extern ActorInfo JIGSAW_PICTURE_ACTOR; +extern ActorInfo JIGSAW_PICTURE_ACTOR_2; extern ActorInfo chBrentilda; extern ActorInfo D_80394A80; extern ActorInfo D_80394AB0; @@ -219,7 +220,7 @@ void chFloorCobweb_update(Actor *this) { func_802D3CE8(this); - if (fileProgressFlag_get(this->unkF4_8 == 1 ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN)) + if (fileProgressFlag_get(this->actorTypeSpecificField == 1 ? FILEPROG_CB_LAIR_COBWEB_OVER_FLIGHTPAD_BROKEN : FILEPROG_CC_LAIR_COBWEB_OVER_GREEN_CAULDRON_BROKEN)) { marker_despawn(this->marker); return; @@ -266,7 +267,7 @@ void lair_func_80386550(Actor *this) { func_802D3CE8(this); - if (fileProgressFlag_get(this->unkF4_8 == 1 ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN)) + if (fileProgressFlag_get(this->actorTypeSpecificField == 1 ? FILEPROG_C8_LAIR_BRICKWALL_TO_WADINGBOOTS_BROKEN : FILEPROG_C9_LAIR_BRICKWALL_TO_SHOCKJUMP_PAD_BROKEN)) { marker_despawn(this->marker); return; @@ -382,7 +383,7 @@ void func_803867A8(Actor *this) { this->velocity[0] += 1.0f; if((this->velocity[0] < 0.0f) || (this->velocity[0] > 19.0f)) { this->velocity[0] = 0.0f; - func_8030E6A4(SFX_3F6_RUBBING, 0.5f, this->alpha_124_19*0x25 + 0x3840); + gcsfx_playWithPitch(SFX_3F6_RUBBING, 0.5f, this->alpha_124_19*0x25 + 0x3840); } } } @@ -390,7 +391,7 @@ void func_803867A8(Actor *this) { this->velocity[0] += 1.0f; if ((this->velocity[0] < 0.0f) || (this->velocity[0] > 19.0f)) { this->velocity[0] = 0.0f; - FUNC_8030E8B4(SFX_3F6_RUBBING, 0.5f, 24000, this->position, 100, 2300); + sfx_playFadeShorthandDefault(SFX_3F6_RUBBING, 0.5f, 24000, this->position, 100, 2300); } } @@ -399,7 +400,7 @@ void func_803867A8(Actor *this) { this->position_y = this->unk1C[1]; sp5C[1] = sp5C[2] =0.0f; - sp5C[0] = this->unkF4_8*2; + sp5C[0] = this->actorTypeSpecificField*2; ml_vec3f_yaw_rotate_copy(sp5C, sp5C, this->lifetime_value); this->position[0] = this->unk1C[0] + sp5C[0]; this->position[2] = this->unk1C[2] + sp5C[2]; @@ -412,7 +413,7 @@ void func_803867A8(Actor *this) { sp50[1] = this->unk1C[1]; sp5C[1] = sp5C[2] = 0.0f; - sp5C[0] = this->unkF4_8*2; + sp5C[0] = this->actorTypeSpecificField*2; ml_vec3f_yaw_rotate_copy(sp5C, sp5C, phi_f0); sp50[0] = this->unk1C[0] + sp5C[0]; sp50[2] = this->unk1C[2] + sp5C[2]; @@ -507,7 +508,7 @@ void func_80386D78(Actor *this) { this->scale = 0.0001f; this->lifetime_value = 26.0f; this->position[1] = this->unk1C[1]; - func_802BAFE4(0x80); + gcStaticCamera_activate(0x80); timedFunc_set_0(3.0f, func_80386D40); } } @@ -524,8 +525,8 @@ void func_803870DC(Actor *this) { f32 sp64[3]; s32 temp_s7; - phi_v1 = fileProgressFlag_get(D_80393454[this->unkF4_8 - 1]) - || (D_80393468[this->unkF4_8 - 1] != 0 && volatileFlag_get(D_80393468[this->unkF4_8 - 1])); + phi_v1 = fileProgressFlag_get(D_80393454[this->actorTypeSpecificField - 1]) + || (D_80393468[this->actorTypeSpecificField - 1] != 0 && volatileFlag_get(D_80393468[this->actorTypeSpecificField - 1])); if (!this->volatile_initialized) { this->volatile_initialized = TRUE; @@ -592,7 +593,7 @@ Actor *lair_func_80387560(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) u32 i; for (i = 0; i != 10; i++) - func_8033A45C(i + 1, actor->unkF4_8 + 1 == i + 2); + func_8033A45C(i + 1, actor->actorTypeSpecificField + 1 == i + 2); return actor_drawFullDepth(marker, gfx, mtx, vtx); } @@ -613,7 +614,7 @@ void func_803875F0(Actor * this) if (mapSpecificFlags_get(0)) { this->unk1C_y = this->position_y; - func_802BAFE4(0x2A); + gcStaticCamera_activate(0x2A); fileProgressFlag_set(FILEPROG_1E_LAIR_GRATE_TO_BGS_PUZZLE_OPEN, TRUE); this->volatile_initialized = TRUE; this->unk38_31 = 0x0C; @@ -662,11 +663,11 @@ void func_80387730(Actor *this) { this->alpha_124_19 = 0xFF; this->unk1C[1] = 0.0f; this->unk1C[2] = 3.5f; - if (fileProgressFlag_get(this->unkF4_8 + FILEPROG_39_CCW_OPEN)) { + if (fileProgressFlag_get(this->actorTypeSpecificField + FILEPROG_39_CCW_OPEN)) { marker_despawn(this->marker); return; } - if ((this->unkF4_8 >= 2U) && (this->unkF4_8 < 8U) && volatileFlag_get(D_80393494[this->unkF4_8 - 2])) { + if ((this->actorTypeSpecificField >= 2U) && (this->actorTypeSpecificField < 8U) && volatileFlag_get(D_80393494[this->actorTypeSpecificField - 2])) { marker_despawn(this->marker); return; } @@ -681,12 +682,12 @@ void func_80387730(Actor *this) { this->unk1C[1] = 0.0f; this->unk1C[2] = 3.5f; } - if (!fileProgressFlag_get(this->unkF4_8 + FILEPROG_39_CCW_OPEN) && ability_isUnlocked(ABILITY_13_1ST_NOTEDOOR)) { + if (!fileProgressFlag_get(this->actorTypeSpecificField + FILEPROG_39_CCW_OPEN) && ability_isUnlocked(ABILITY_13_1ST_NOTEDOOR)) { player_getPosition(spAC); - if ((ml_vec3f_distance(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) { + if ((ml_vec3f_distance(spAC, this->position) < 500.0f) && (gcdialog_getCurrentTextId() != 0xF64)) { func_802FACA4(0xC); } - if (itemscore_noteScores_getTotal() >= D_8039347C[this->unkF4_8 - 1]) { + if (itemscore_noteScores_getTotal() >= D_8039347C[this->actorTypeSpecificField - 1]) { if (this->marker->unk14_21) { func_8032BC60(this, 5, sp90); func_8032BC60(this, 6, sp84); @@ -711,7 +712,7 @@ void func_80387730(Actor *this) { this->alpha_124_19 -= 7; } if (this->alpha_124_19 == 0) { - fileProgressFlag_set(this->unkF4_8 + FILEPROG_39_CCW_OPEN, TRUE); + fileProgressFlag_set(this->actorTypeSpecificField + FILEPROG_39_CCW_OPEN, TRUE); marker_despawn(this->marker); func_8028F918(0); func_8028F66C(BS_INTR_35); @@ -740,8 +741,8 @@ void func_80387730(Actor *this) { } } } - } else if ((this->unkF4_8 >= 2) && (ml_vec3f_distance(spAC, this->position) < 290.0f)) { - volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES); + } else if ((this->actorTypeSpecificField >= 2) && (ml_vec3f_distance(spAC, this->position) < 290.0f)) { + progressDialog_setAndTriggerDialog_0(VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES); } } } @@ -753,7 +754,7 @@ Actor *func_80387DA8(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { // TODO: Think of a better way of doing this, similar to the SM64 one #define NUM_NOTE_DOORS (12) - #define noteDoorIdx unkF4_8 + #define noteDoorIdx actorTypeSpecificField #define opacityTimer unk1C[1] Actor *actor; @@ -769,13 +770,13 @@ Actor *func_80387DA8(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) * Sets opacity of the "note" symbol */ if (var2) - func_8034E0FC(var2, actor->opacityTimer); + setStruct6DsOpacity(var2, actor->opacityTimer); /** * Sets opacity of note door numbers */ if (var1) - func_8034E0FC(var1, 0xFF - (s32)actor->opacityTimer); + setStruct6DsOpacity(var1, 0xFF - (s32)actor->opacityTimer); /** * Hides all note door graphics that don't match this note door's index @@ -804,9 +805,9 @@ void func_80387E94(s32 arg0) // Grab the same pointer again for good measure :^) actor2 = marker_getActor(marker); - actorNew->unkF4_20 = actor2->unk78_13; + actorNew->unkF4_20 = actor2->secondaryId; - actor2->unk100 = actorNew->marker; + actor2->partnerActor = actorNew->marker; actorNew->unk1C[0] = 0; } @@ -815,7 +816,7 @@ void func_80387F1C(void) { f32 tmp[3]; - func_802BAFE4(0x7B); + gcStaticCamera_activate(0x7B); if (nodeProp_findPositionFromActorId(400, tmp)) { @@ -839,7 +840,7 @@ void func_80387F78(Actor *this, enum file_progress_e progress_flag) && fileProgressFlag_get(FILEPROG_9C_LAIR_CC_WITCH_SWITCH_LEFT_EYE_PRESSED) && fileProgressFlag_get(FILEPROG_9D_LAIR_CC_WITCH_SWITCH_RIGHT_EYE_PRESSED)) { - func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); timedFunc_set_0(0.9f, func_80387F1C); } } @@ -884,9 +885,9 @@ void func_803880BC(Actor *this) actor_collisionOn(this); } - if (this->unk100 != NULL && !fileProgressFlag_get(FILEPROG_9D_LAIR_CC_WITCH_SWITCH_RIGHT_EYE_PRESSED)) + if (this->partnerActor != NULL && !fileProgressFlag_get(FILEPROG_9D_LAIR_CC_WITCH_SWITCH_RIGHT_EYE_PRESSED)) { - Actor *actor = marker_getActor(this->unk100); + Actor *actor = marker_getActor(this->partnerActor); actor->position_y = this->unk1C[1]; actor_collisionOn(actor); } @@ -902,9 +903,9 @@ void func_803880BC(Actor *this) fileProgressFlag_set(FILEPROG_9B_LAIR_CC_WITCH_SWITCH_EYES_ACTIVE, TRUE); } - if (this->unk100 != NULL) + if (this->partnerActor != NULL) { - Actor *actor = marker_getActor(this->unk100); + Actor *actor = marker_getActor(this->partnerActor); actor->position_y = this->position_y; } } @@ -955,7 +956,7 @@ void func_803882B0(Actor *this) if (this->lifetime_value == 0 && this->pitch > 42.f) { this->lifetime_value = 1.f; - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); } if (this->pitch > 90.f) @@ -969,7 +970,7 @@ void func_803882B0(Actor *this) void func_80388404(enum file_progress_e progress_flag, enum sfx_e sfx, f32 a2, s32 a3) { if (fileProgressFlag_get(progress_flag) == FALSE) - func_8030E6A4(sfx, a2, a3); + gcsfx_playWithPitch(sfx, a2, a3); fileProgressFlag_set(progress_flag, TRUE); } @@ -1015,61 +1016,61 @@ void func_80388524(Actor *this) { if (!sp34) { switch(this->modelCacheIndex){ case ACTOR_2E5_DOOR_OF_GRUNTY://L80388630 - if (!fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) && func_8038EAE0(0xA)) { + if (!fileProgressFlag_get(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN) && jigsawPicture_isJigsawPictureComplete(0xA)) { fileProgressFlag_set(FILEPROG_E2_DOOR_OF_GRUNTY_OPEN, TRUE); } break; case ACTOR_20E_MM_ENTRANCE_DOOR: //L80388660 - if (!fileProgressFlag_get(FILEPROG_31_MM_OPEN) && func_8038EAE0(1)) { + if (!fileProgressFlag_get(FILEPROG_31_MM_OPEN) && jigsawPicture_isJigsawPictureComplete(1)) { fileProgressFlag_set(FILEPROG_31_MM_OPEN, TRUE); } break; case ACTOR_226_GV_ENTRANCE: //L80388690 - if (!fileProgressFlag_get(FILEPROG_36_GV_OPEN) && func_8038EAE0(6)) { + if (!fileProgressFlag_get(FILEPROG_36_GV_OPEN) && jigsawPicture_isJigsawPictureComplete(6)) { fileProgressFlag_set(FILEPROG_36_GV_OPEN, TRUE); } break; case ACTOR_212_CC_ENTRANCE_BARS: //L803886C0 - if (!fileProgressFlag_get(FILEPROG_33_CC_OPEN) && func_8038EAE0(3)) { + if (!fileProgressFlag_get(FILEPROG_33_CC_OPEN) && jigsawPicture_isJigsawPictureComplete(3)) { fileProgressFlag_set(FILEPROG_33_CC_OPEN, TRUE); } break; case ACTOR_211_TCC_ENTRANCE_CHEST_LID: //L803886F0 - if (!fileProgressFlag_get(FILEPROG_32_TTC_OPEN) && func_8038EAE0(2)) { + if (!fileProgressFlag_get(FILEPROG_32_TTC_OPEN) && jigsawPicture_isJigsawPictureComplete(2)) { fileProgressFlag_set(FILEPROG_32_TTC_OPEN, TRUE); } break; case ACTOR_210_BGS_ENTRANCE_DOOR: //L80388720 - if (!fileProgressFlag_get(FILEPROG_34_BGS_OPEN) && func_8038EAE0(4)) { + if (!fileProgressFlag_get(FILEPROG_34_BGS_OPEN) && jigsawPicture_isJigsawPictureComplete(4)) { fileProgressFlag_set(FILEPROG_34_BGS_OPEN, TRUE); } break; case ACTOR_20F_RBB_ENTRANCE_DOOR: //L80388750 - if (!fileProgressFlag_get(FILEPROG_38_RBB_OPEN) && func_8038EAE0(8)) { + if (!fileProgressFlag_get(FILEPROG_38_RBB_OPEN) && jigsawPicture_isJigsawPictureComplete(8)) { fileProgressFlag_set(FILEPROG_38_RBB_OPEN, TRUE); } break; case ACTOR_228_MMM_ENTRANCE_DOOR: //L80388780 - if (!fileProgressFlag_get(FILEPROG_37_MMM_OPEN) && func_8038EAE0(7)) { + if (!fileProgressFlag_get(FILEPROG_37_MMM_OPEN) && jigsawPicture_isJigsawPictureComplete(7)) { fileProgressFlag_set(FILEPROG_37_MMM_OPEN, TRUE); } break; case ACTOR_234_CCW_ENTRANCE_DOOR: //L803887B0 - if (!fileProgressFlag_get(FILEPROG_39_CCW_OPEN) && func_8038EAE0(9)) { + if (!fileProgressFlag_get(FILEPROG_39_CCW_OPEN) && jigsawPicture_isJigsawPictureComplete(9)) { fileProgressFlag_set(FILEPROG_39_CCW_OPEN, TRUE); } break; case ACTOR_235_FP_ENTANCE_DOOR: //L803887E0 - if (!fileProgressFlag_get(FILEPROG_35_FP_OPEN) && func_8038EAE0(5)) { + if (!fileProgressFlag_get(FILEPROG_35_FP_OPEN) && jigsawPicture_isJigsawPictureComplete(5)) { fileProgressFlag_set(FILEPROG_35_FP_OPEN, TRUE); } break; @@ -1167,7 +1168,7 @@ void func_80388524(Actor *this) { switch (this->state) { case 0x19: //L80388B34 subaddie_set_state_with_direction(this, 0x1A, 0.0f, 1); - func_8025A6EC(JINGLE_END_OF_INTRO, -1); + coMusicPlayer_playMusic(JINGLE_END_OF_INTRO, -1); break; case 26: //L80388B54 @@ -1322,7 +1323,7 @@ void func_80388FC8(Actor *this) { if (this->modelCacheIndex == 0x215) { - func_802BAFE4(0x2B); + gcStaticCamera_activate(0x2B); if (1); // oof } @@ -1357,7 +1358,7 @@ void func_80388FC8(Actor *this) if (this->modelCacheIndex == 0x215) { func_802D48B8(this); - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); } this->lifetime_value = 1.f; @@ -1397,7 +1398,7 @@ void lair_func_80389204(Actor *this) if (mapSpecificFlags_get(2)) { - func_802BAFE4(0x2C); + gcStaticCamera_activate(0x2C); fileProgressFlag_set(FILEPROG_21_CC_LOBBY_PIPE_3_RAISED, TRUE); this->volatile_initialized = TRUE; @@ -1423,7 +1424,7 @@ void lair_func_80389204(Actor *this) this->position_y = this->unk1C[1]; func_802D48B8(this); - func_8030E540(SFX_7F_HEAVYDOOR_SLAM); + gcsfx_play(SFX_7F_HEAVYDOOR_SLAM); this->lifetime_value = 1.f; } @@ -1629,7 +1630,7 @@ void func_80389934(Actor *this) subaddie_set_state_forward(this, 0x17); actor_playAnimationOnce(this); FUNC_8030E624(SFX_3F6_RUBBING, 0.6f, 32000); - func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); + coMusicPlayer_playMusic(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); } break; @@ -1792,7 +1793,7 @@ Actor *func_80389E10(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp90[2] = sp84[2] + ((sp78[2] - sp84[2]) * randf()); - func_802EE6CC(sp90, sp6C, D_80393504, 1, 0.3f, 50.0f, 180, randi2(130, 200), 0); + dustEmitter_emit(sp90, sp6C, D_80393504, 1, 0.3f, 50.0f, 180, randi2(130, 200), DUST_EMITTER_TYPE_DUST); }; } return this; @@ -1885,8 +1886,8 @@ void lair_func_8038A0C4(void) spawnableActorList_add(&D_80393584, actor_new, ACTOR_FLAG_UNKNOWN_1 | ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); spawnableActorList_add(&D_803933E4, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); spawnableActorList_add(&D_80393378, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_15); - spawnableActorList_add(&D_803947B0, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_12 | ACTOR_FLAG_UNKNOWN_17 | ACTOR_FLAG_UNKNOWN_19); - spawnableActorList_add(&D_803947D4, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_12 | ACTOR_FLAG_UNKNOWN_17 | ACTOR_FLAG_UNKNOWN_19); + spawnableActorList_add(&JIGSAW_PICTURE_ACTOR, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_12 | ACTOR_FLAG_UNKNOWN_17 | ACTOR_FLAG_UNKNOWN_19); + spawnableActorList_add(&JIGSAW_PICTURE_ACTOR_2, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_10 | ACTOR_FLAG_UNKNOWN_12 | ACTOR_FLAG_UNKNOWN_17 | ACTOR_FLAG_UNKNOWN_19); spawnableActorList_add(&chBrentilda, actor_new, ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_8); spawnableActorList_add(&D_80394A80, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&D_80394AB0, actor_new, ACTOR_FLAG_UNKNOWN_2 | ACTOR_FLAG_UNKNOWN_6); diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index e8fa2af4..5aa8cb8b 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -525,7 +525,7 @@ void func_8038CC10(void) func_8030DD90(D_8037DCB8->UNK_18, 0); sfxsource_setSampleRate(D_8037DCB8->UNK_18, 32760); sfxsource_playSfxAtVolume(D_8037DCB8->UNK_18, 0.7f); - func_8030E2C4(D_8037DCB8->UNK_18); + sfxSource_func_8030E2C4(D_8037DCB8->UNK_18); } void lair_func_8038CC9C(void) @@ -533,7 +533,7 @@ void lair_func_8038CC9C(void) if (!D_8037DCB8->UNK_18) return; - func_8030E394(D_8037DCB8->UNK_18); + sfxSource_triggerCallbackByIndex(D_8037DCB8->UNK_18); sfxsource_freeSfxsourceByIndex(D_8037DCB8->UNK_18); D_8037DCB8->UNK_18 = 0; } @@ -548,7 +548,7 @@ void func_8038CCEC(void) gcquiz_free(); quizQuestionAskedBitfield_free(); - func_802C5994(); + gameSelect_saveAndExit(); } void lair_func_8038CD48(void) @@ -707,7 +707,7 @@ void func_8038D0BC(s32 a0, s32 a1) void func_8038D16C(s32 a0, u16 a1) { - func_8025A6EC(a0, 0); + coMusicPlayer_playMusic(a0, 0); comusic_8025AB44(a0, 28000, 500); func_80250530(func_8025ADD4(a0), a1, 0); } @@ -831,7 +831,7 @@ void func_8038D4BC(void) // trigger warp after a delay timedFunc_set_3(0.25f, - (GenFunction_3)func_802E4078, + (GenFunction_3)transitionToMap, D_803945B8[D_8037DCB8->unkC].map, D_803945B8[D_8037DCB8->unkC].exit, 1 @@ -956,17 +956,17 @@ void func_8038D670(enum FF_Action next_state) { if (((s32) D_8037DCB8->unk4->unk8 >= 7) && (quizQuestionAskedBitfield_get(func_8038D60C(D_8037DCB8->unk8)) == 0)) { item_adjustByDiffWithHud(ITEM_27_JOKER_CARD, D_8037DCB8->unk4->unk8 - 6); quizQuestionAskedBitfield_set(func_8038D60C(D_8037DCB8->unk8), TRUE); - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A8_FF_GOT_JOKER); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A8_FF_GOT_JOKER); } if (D_8037DCB8->unk8 != 0x1EF) { - func_8030E6A4(SFX_126_AUDIENCE_BOOING, 1.0f, 0x7FF8); + gcsfx_playWithPitch(SFX_126_AUDIENCE_BOOING, 1.0f, 0x7FF8); if (D_8037DCB8->unk4->unk8 == FFTT_5_GRUNTY) { - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A2_FF_GRUNTY_ANSWER_RIGHT); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A2_FF_GRUNTY_ANSWER_RIGHT); } if (volatileFlag_get(VOLATILE_FLAG_A0_FF_FIRST_ANSWER_RIGHT)) { - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A1_FF_NEXT_ANSWER_RIGHT); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A1_FF_NEXT_ANSWER_RIGHT); } - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A0_FF_FIRST_ANSWER_RIGHT); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A0_FF_FIRST_ANSWER_RIGHT); } } else { if (D_8037DCB8->unk4->unk8 == FFTT_6_SKULL) { @@ -993,9 +993,9 @@ void func_8038D670(enum FF_Action next_state) { lair_func_8038C640(D_8037DCB8->unk8, D_8037DCB8->unk4); } if (volatileFlag_get(VOLATILE_FLAG_A3_FF_FIRST_ANSWER_WRONG)) { - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A4_FF_NEXT_ANSWER_WRONG); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A4_FF_NEXT_ANSWER_WRONG); } - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A3_FF_FIRST_ANSWER_WRONG); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A3_FF_FIRST_ANSWER_WRONG); } break; @@ -1157,7 +1157,7 @@ void lair_func_8038E0B0(void) { gcquiz_func_80319EA4(); func_8038C9D0(); controller_copyFaceButtons(0, sp48); - func_8024E60C(0, sp3C); + controller_copySideButtons(0, sp3C); if (D_8037DCB8->currFfMode < 3) { player_getPosition(D_8037DCB8->playerPosition); temp_v0 = func_8033F3E8(D_8037DCB8->unk0, D_8037DCB8->playerPosition, 0x191, 0x1F0); @@ -1231,13 +1231,13 @@ void lair_func_8038E0B0(void) { func_802FACA4(0x16); if (sp38 != FFTT_0_NIL) { sp28 = sp38 - 1 + FILEPROG_55_FF_BK_SQUARE_INSTRUCTIONS; - if (!fileProgressFlag_get(sp28) && gcdialog_showText(sp38 + 0x101E, 0, NULL, NULL, NULL, NULL)) { + if (!fileProgressFlag_get(sp28) && gcdialog_showDialog(sp38 + 0x101E, 0, NULL, NULL, NULL, NULL)) { fileProgressFlag_set(sp28, TRUE); } if ((sp38 == FFTT_6_SKULL) && (item_getCount(ITEM_16_LIFE) == 1)) { - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_AB_LAST_LIFE_ON_SKULL); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_AB_LAST_LIFE_ON_SKULL); } else if (item_getCount(ITEM_14_HEALTH) == 1) { - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_AA_FF_LOW_HEALTH); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_AA_FF_LOW_HEALTH); } if ((D_8037DCB8->unk4->unk9 == 2) && (player_movementGroup() == BSGROUP_0_NONE)) { if (func_8028EFEC() && (sp48[FACE_BUTTON(BUTTON_A)] == 1)) { @@ -1252,8 +1252,8 @@ void lair_func_8038E0B0(void) { if ((item_getCount(ITEM_27_JOKER_CARD) > 0) && (sp28 < 0x5B)) { lair_func_8038C640(D_8037DCB8->unk8, D_8037DCB8->unk4); item_dec(ITEM_27_JOKER_CARD); - func_8030E6D4(SFX_3EA_UNKNOWN); - volatileFlag_setAndTriggerDialog_4(VOLATILE_FLAG_A9_FF_USED_JOKER); + func_8030E6D4(SFX_3EA_BANJO_GUH_HUH); + progressDialog_setAndTriggerDialog_4(VOLATILE_FLAG_A9_FF_USED_JOKER); if (D_8037DCB8->unk8 == 0x1EF) { func_8038D670(8); } diff --git a/src/lair/code_86F0.c b/src/lair/code_86F0.c deleted file mode 100644 index f540cbc4..00000000 --- a/src/lair/code_86F0.c +++ /dev/null @@ -1,549 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -extern void func_8028F3D8(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); -extern void func_80324CFC(f32, enum comusic_e, s32); -extern void rand_seed(s32); -extern void func_8034DF30(s32, f32[3], f32[3], f32); -extern void func_8034E088(s32, s32, s32,f32); - -typedef struct { - s32 unk0; - s32 unk4; - s32 unk8; -}ActorLocal_lair_86F0; - -typedef struct { - u8 cost; - u8 size_bits; - u16 progress_flag; // enum file_progress_e -}Struct_lair_86F0_0; - -void func_8038F350(Actor *this, s32 next_state); -void lair_func_8038F924(Actor *this); - -/* .data */ -ActorInfo D_803947B0 = { 0x1EB, 0x3B7, 0x48B, 0x1, NULL, lair_func_8038F924, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; -ActorInfo D_803947D4 = { 0x1EB, 0x3BC, 0x538, 0x1, NULL, lair_func_8038F924, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; -Struct_lair_86F0_0 D_803947F8[0xb] ={ - { 1, 0x1, FILEPROG_5D_MM_PUZZLE_PIECES_PLACED}, - { 2, 0x2, FILEPROG_5E_TCC_PUZZLE_PIECES_PLACED}, - { 5, 0x3, FILEPROG_60_CC_PUZZLE_PIECES_PLACED}, - { 7, 0x3, FILEPROG_63_BGS_PUZZLE_PIECES_PLACED}, - { 8, 0x4, FILEPROG_66_FP_PUZZLE_PIECES_PLACED}, - { 9, 0x4, FILEPROG_6A_GV_PUZZLE_PIECES_PLACED}, - {10, 0x4, FILEPROG_6E_MMM_PUZZLE_PIECES_PLACED}, - {12, 0x4, FILEPROG_72_RBB_PUZZLE_PIECES_PLACED}, - {15, 0x4, FILEPROG_76_CCW_PUZZLE_PIECES_PLACED}, - {25, 0x5, FILEPROG_7A_DOG_PUZZLE_PIECES_PLACED}, - { 4, 0x3, FILEPROG_7F_DOUBLE_HEALTH_PUZZLE_PIECES_PLACED} -}; -s32 D_80394824[3] = {0xff, 0xff, 0}; -ParticleScaleAndLifetimeRanges D_80394830 = { - {0.17f, 0.24f}, - {0.08f, 0.13f}, - {0.0f, 0.01f}, - {0.9f, 0.9f}, - 0.0f, 0.0f -}; - -/* .code */ -bool func_8038EAE0(s32 arg0) { - return fileProgressFlag_getN(D_803947F8[arg0 -1].progress_flag, D_803947F8[arg0 -1].size_bits) == D_803947F8[arg0 -1].cost; -} - -s32 func_8038EB24(Actor *this){ - return (this->unkF4_8 != 0 && this->unkF4_8 < 0xC) ? D_803947F8[this->unkF4_8 - 1].cost : 0; -} - -bool func_8038EB58(Actor *this){ - ActorLocal_lair_86F0 *local; - - local = (ActorLocal_lair_86F0*)&this->local; - return func_8038EB24(this) == local->unk4; -} - -s32 func_8038EB84(Actor *this){ - return this->unkF4_8 + 0x1B; -} - -void func_8038EB94(void){ - func_802FAFD4(ITEM_14_HEALTH, 0x417); - func_802FAFC0(ITEM_14_HEALTH, COMUSIC_2B_DING_B); - fileProgressFlag_set(FILEPROG_B9_DOUBLE_HEALTH, TRUE); - func_80347958(); - item_adjustByDiffWithHud(ITEM_14_HEALTH, 0); - gcpausemenu_80314AC8(1); -} - -void func_8038EBEC(ActorMarker *marker) { - Actor *this; - u32 temp_t6; - - this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); - if (this->unkF4_8 < 0xA) { - levelSpecificFlags_set(func_8038EB84(this), TRUE); - return; - } - if (this->unkF4_8 == 0xA) { - func_8028F918(0); - func_8028F918(2); - levelSpecificFlags_set(LEVEL_FLAG_3F_LAIR_UNKNOWN, TRUE); - return; - } - if (this->unkF4_8 == 0xB) { - timedFunc_set_0(1.5f, func_8038EB94); - gcpausemenu_80314AC8(0); - } -} - -void func_8038EC94(ActorMarker *marker, ActorMarker *other_marker){ - marker->unk3E_1 = TRUE; -} - -bool func_8038ECA8(ActorMarker *marker) { - return func_8028F20C() && func_8028FB48(0x08000000) && marker->unk3E_1; -} - -s32 func_8038ECFC(Actor *this, s32 arg1){ - ActorLocal_lair_86F0 *local; - - local = (ActorLocal_lair_86F0*)&this->local; - return local->unk0 & (1 << arg1); -} - -s32 func_8038ED10(Actor *this, s32 arg1){ - s32 phi_v1; - switch (this->unkF4_8){ - case 7: - phi_v1 = (arg1 == 2) ? 0x1a4 : 0x190; - break; - - case 3: - phi_v1 = 0x192; - break; - - case 8: - phi_v1 = 0x19A; - break; - - case 11: - phi_v1 = 0x1AE; - break; - default: - phi_v1 = 0x190; - break; - } - return phi_v1 + arg1; -} - -s32 func_8038ED88(Actor *this){ - switch (this->unkF4_8){ - case 3: - case 8: - case 0xb: - return 0x1F; - } - return 0x1E; -} - -void func_8038EDBC(Actor *this) { - s32 sp44; - s32 sp40; - ActorLocal_lair_86F0 *local; - s32 sp38; - f32 sp34; - f32 sp28[3]; - - local = (ActorLocal_lair_86F0*)&this->local; - sp38 = (this->modelCacheIndex == 0x3B7)? 0x190 : 0x192; - sp44 = func_8034C2C4(this->marker, sp38); - sp40 = func_8034C2C4(this->marker, sp38 + 1); - if ((sp44 != 0) && (sp40 != 0) && (this->marker->unk14_21)) { - sp28[0] = 1.0f; - sp28[1] = 1.0f; - sp28[2] = 1.0f; - if (func_8038ECA8(this->marker) && local->unk8 < 0xFF) { - local->unk8 = (local->unk8 + 8 < 0xFF) ? local->unk8 + 8 : 0xFF; - } - else if (!func_8038ECA8(this->marker) && (local->unk8 > 0)) { - local->unk8 = (local->unk8 - 8 > 0) ? local->unk8 - 8 : 0; - } - sp34 = (0xFF - local->unk8) / 255.0; - func_8034DF30(sp44, sp28, sp28, 0); - sp34 = 1.0 - sp34; - func_8034DF30(sp40, sp28, sp28, 0); - if(sp34); - } -} - - -void func_8038EF58(ActorMarker *marker) { - f32 sp24[3]; - Actor *this; - - this = marker_getActor(marker); - func_8034A174(func_803097A0(), func_8038ED88(this), sp24); - func_8028E6EC(2); - func_8028F918(0); - func_8028F94C(4, sp24); - func_8038F350(this, fileProgressFlag_get(FILEPROG_17_HAS_HAD_ENOUGH_JIGSAW_PIECES) ? 4 : 3); -} - -void func_8038EFD8(Actor *this) { - s32 pad3C; - f32 sp30[3]; - f32 sp24[3]; - - this->has_met_before = FALSE; - player_getPosition(sp30); - sp24[0] = this->position[0]; - sp24[1] = this->position[1]; - sp24[2] = this->position[2]; - sp24[1] += 50.0f; - func_8028F3D8(sp24, ml_vec3f_distance(sp30, sp24) / 150.0, func_8038EF58, this->marker); -} - -void func_8038F078(ActorMarker *marker, enum asset_e text_id, s32 arg2){ - Actor *this; - - this = marker_getActor(marker); - func_8038F350(this, (text_id == 0xf58) ? 1 : 4); -} - -void func_8038F0C0(ActorMarker *marker, enum asset_e text_id, s32 arg2){ - func_8030E6D4(SFX_EA_GRUNTY_LAUGH_1); -} - -s32 func_8038F0EC(Actor *this) { - ActorLocal_lair_86F0 *local; - s32 phi_s0; - s32 sp34; - s32 phi_s2; - - phi_s0 = 0; - local = (ActorLocal_lair_86F0*)&this->local; - rand_seed(this->unkF4_8); - if (this->unkF4_8 >= 0xA) { - for(phi_s2 = 0; phi_s2 < local->unk4; phi_s2++){ - sp34 = phi_s2; - phi_s0 |= (1 << sp34); - } - } else { - for(phi_s2 = 0; phi_s2 < local->unk4; phi_s2++){ - do{ - sp34 = randi2(0, func_8038EB24(this)); - } - while(1 << sp34 & phi_s0); - phi_s0 |= 1 << sp34; - } - } - return sp34; -} - - -void func_8038F1EC(Actor *this, s32 arg1, bool arg2) { - s32 temp_v0; - - temp_v0 = func_8034C528(func_8038ED10(this, arg1)); - if (temp_v0 != 0) { - func_8034E088(temp_v0, arg2 ? 0 : 0xff, arg2 ? 0xff : 0, 1.0f); - } -} - -void func_8038F250(Actor *this){ - ActorLocal_lair_86F0 *local; - - local = (ActorLocal_lair_86F0*)&this->local; - if( (this->unkF4_8 >= 2) - && (local->unk4 > 0) - && !func_8038EB58(this) - && !fileProgressFlag_get(FILEPROG_DF_CAN_REMOVE_ALL_PUZZLE_PIECES) - ) { - if (gcdialog_showText(0xF7C, 2, NULL, NULL, NULL, NULL)) { - fileProgressFlag_set(FILEPROG_DF_CAN_REMOVE_ALL_PUZZLE_PIECES, TRUE); - } - } else if ((this->unkF4_8 >= 3) - && (local->unk4 >= 2) - && !func_8038EB58(this) - && !fileProgressFlag_get(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES) - ){ - if(gcdialog_showText(0xF7D, 2, NULL, NULL, NULL, NULL)) { - fileProgressFlag_set(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES, TRUE); - } - } -} - -void func_8038F350(Actor *this, s32 next_state){ - ActorLocal_lair_86F0 *local; - f32 sp50[3]; - s32 sp4C; - s32 temp_s1; - s32 phi_s0; - - local = (ActorLocal_lair_86F0*)&this->local; - func_8034A174(func_803097A0(), func_8038ED88(this), sp50); - switch (next_state) { - case 1: //L8038F3BC - func_8028F918(0); - break; - - case 2: //L8038F3CC - func_8038EFD8(this); - FUNC_8030E8B4(SFX_112_TINKER_ATTENTION, 1.0f, 32000, this->position, 500, 1000); - break; - - case 3: //L8038F3F4 - func_803115C4(0xF7B); - func_803115C4(0xF80); - func_803115C4(0xF7F); - if (item_getCount(ITEM_26_JIGGY_TOTAL) > 0) { - gcdialog_showText(fileProgressFlag_get(FILEPROG_16_STOOD_ON_JIGSAW_PODIUM) ? 0xF5A : 0xF59, 6, sp50, this->marker, func_8038F078, NULL); - fileProgressFlag_set(FILEPROG_17_HAS_HAD_ENOUGH_JIGSAW_PIECES, 1); - } else { - gcdialog_showText(0xF58, 6, sp50, this->marker, func_8038F078, NULL); - } - fileProgressFlag_set(FILEPROG_16_STOOD_ON_JIGSAW_PODIUM, 1); - fileProgressFlag_set(FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT, 1); - break; - - case 8: //L8038F4AC - if (local->unk4 > 0) { - comusic_playTrack(SFX_REMOVE_JIGGY); - this->lifetime_value = 1.0f; - temp_s1 = func_8038F0EC(this); - func_8038F1EC(this, temp_s1, 0); - local->unk4--; - local->unk0 &= ~(1 << temp_s1); - fileProgressFlag_setN(D_803947F8[this->unkF4_8 - 1].progress_flag, local->unk4, D_803947F8[this->unkF4_8 - 1].size_bits); - item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, 1); - } - break; - - case 5: //L8038F550 - if (local->unk4 < func_8038EB24(this)) { - comusic_playTrack(COMUSIC_67_INSERTING_JIGGY); - this->lifetime_value = 1.0f; - local->unk4++; - temp_s1 = func_8038F0EC(this); - func_8038F1EC(this, temp_s1, 1); - local->unk0 |= (1 << temp_s1); - fileProgressFlag_setN(D_803947F8[this->unkF4_8 - 1].progress_flag, local->unk4, D_803947F8[this->unkF4_8 - 1].size_bits); - item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, -1); - func_8038F250(this); - } - break; - - case 6: //L8038F604 - if (local->unk4 < func_8038EB24(this)) { - if(item_getCount(ITEM_26_JIGGY_TOTAL) > func_8038EB24(this) - local->unk4){ - sp4C = func_8038EB24(this) - local->unk4; - } - else{ - sp4C = item_getCount(ITEM_26_JIGGY_TOTAL); - } - comusic_playTrack(COMUSIC_67_INSERTING_JIGGY); - this->lifetime_value = 1.0f; - for(phi_s0 = 0; phi_s0 < sp4C; phi_s0++){ - local->unk4++; - temp_s1 = func_8038F0EC(this); - func_8038F1EC(this, temp_s1, 1); - local->unk0 |= (1 << temp_s1); - item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, -1); - } - fileProgressFlag_setN(D_803947F8[this->unkF4_8 - 1].progress_flag, local->unk4, D_803947F8[this->unkF4_8 - 1].size_bits); - func_8038F250(this); - } - break; - - case 7: //L8038F724 - comusic_playTrack(COMUSIC_65_WORLD_OPENING_B); - if (this->unkF4_8 == 1) { - func_80324DBC(1.0f, 0xF7E, 4, NULL, this->marker, func_8038F0C0, NULL); - } else if (this->unkF4_8 == 0xA) { - func_80324DBC(1.0f, 0xFAC, 4, NULL, this->marker, func_8038F0C0, NULL); - } - timedFunc_set_1(2.0f, (GenFunction_1) func_8038EBEC, (s32) this->marker); - this->lifetime_value = 3.0f; - break; - } - subaddie_set_state(this, next_state); -} - - -void lair_func_8038F800(Actor *this) { - s32 temp_v0; - s32 phi_s0; - - for(phi_s0 = 0; phi_s0 < func_8038EB24(this); phi_s0++){ - temp_v0 = func_8034C528(func_8038ED10(this, phi_s0)); - if (temp_v0 != 0) { - func_8034E0FC(temp_v0, func_8038ECFC(this, phi_s0) ? 0xff : 0); - } - } -} - -void lair_func_8038F894(Actor *this, s32 arg1) { - if (item_getCount(ITEM_26_JIGGY_TOTAL) > 0) { - func_8038F350(this, arg1); - return; - } - comusic_playTrack(COMUSIC_2C_BUZZER); - if (fileProgressFlag_get(FILEPROG_DE_USED_ALL_YOUR_PUZZLE_PIECES) != 0) { - func_8038F350(this, 1); - return; - } - gcdialog_showText(0xFBC, 4, NULL, NULL, NULL, NULL); - fileProgressFlag_set(FILEPROG_DE_USED_ALL_YOUR_PUZZLE_PIECES, 1); -} - -void lair_func_8038F924(Actor *this) { - ActorLocal_lair_86F0 *local; - s32 sp7C[6]; //buttons - s32 phi_v1; - s32 phi_a0; - s32 sp6C[2]; //joystick - f32 sp68; - s32 sp64; - - - local = (ActorLocal_lair_86F0*)&this->local; - sp68 = time_getDelta(); - if (!this->initialized) { - this->initialized = TRUE; - } - - if (!this->volatile_initialized) { - // temp_v0 = &D_803947F8[this->unkF4_8 - 1]; - sp64 = fileProgressFlag_getN(D_803947F8[this->unkF4_8 - 1].progress_flag, D_803947F8[this->unkF4_8 - 1].size_bits); - local->unk0 = 0; - local->unk4 = 0; - local->unk8 = (func_8038ECA8(this->marker)) ? 0xff : 1; - this->has_met_before = TRUE; - for(phi_v1 = 0; phi_v1 < sp64; phi_v1 ++){ - local->unk4++; - local->unk0 |= (1 << func_8038F0EC(this)); - } - lair_func_8038F800(this); - marker_setCollisionScripts(this->marker, func_8038EC94, NULL, NULL); - this->marker->propPtr->unk8_3 = TRUE; - this->volatile_initialized = TRUE; - if (this->unkF4_8 == 9) { - this->unk1C[0] = 8.0f; - if (!fileProgressFlag_get(FILEPROG_53_CCW_PUZZLE_PODIUM_SWITCH_PRESSED)) { - marker_despawn(this->marker); - return; - } - if (!fileProgressFlag_get(FILEPROG_54_CCW_PUZZLE_PODIUM_ACTIVE)) { - __bundle_spawnFromFirstActor(BUNDLE_20__UNKOWN, this); - func_80324CFC(0.0f, COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7FFF); - func_80324D2C(2.1f, COMUSIC_43_ENTER_LEVEL_GLITTER); - func_8030E6D4(SFX_113_PAD_APPEARS); - } - } - } - - if ((this->unkF4_8 == 9) && !fileProgressFlag_get(FILEPROG_54_CCW_PUZZLE_PODIUM_ACTIVE)) { - this->yaw += this->unk1C[0]; - while(this->yaw >= 360.0f){ - this->yaw -= 360.0f; - } - this->unk1C[0] -= 0.089888; - if (this->unk1C[0] < 0.0f) { - this->unk1C[0] = 0.0f; - } - if (this->marker->unk14_21) { - s32 sp58[3] = D_80394824; - ParticleEmitter *sp54; - sp54 = partEmitMgr_newEmitter(6); - particleEmitter_setSprite(sp54, ASSET_710_SPRITE_SPARKLE_PURPLE); - particleEmitter_setAlpha(sp54, 0xFF); - particleEmitter_setScaleAndLifetimeRanges(sp54, &D_80394830); - particleEmitter_setPosition(sp54, this->position); - sp58[2] = randf() * 255.0f; - particleEmitter_setRGB(sp54, sp58); - particleEmitter_setSpawnPositionRange(sp54, -30.0f, -40.0f, -30.0f, 30.0f, 20.0f, 30.0f); - particleEmitter_emitN(sp54, 6); - } - } - controller_copyFaceButtons(0, sp7C); - func_8024E60C(0, sp6C); - func_8038EDBC(this); - switch(this->state){ - case 1://L8038FCD0 - if (!this->has_met_before && (!func_8028F20C() || !func_8028FB48(0x08000000))) { - this->has_met_before = TRUE; - } - if (func_80329530(this, 300)) { - if ((this->unkF4_8 == 0xA) && !fileProgressFlag_get(FILEPROG_F6_SEEN_DOOR_OF_GRUNTY_PUZZLE_PODIUM)) { - phi_a0 = (item_getCount(ITEM_26_JIGGY_TOTAL) < D_803947F8[this->unkF4_8 - 1].cost) ? 0xFAB : 0xFC0; - if (gcdialog_showText(phi_a0, 0, NULL, NULL, NULL, NULL)) { - fileProgressFlag_set(FILEPROG_F6_SEEN_DOOR_OF_GRUNTY_PUZZLE_PODIUM, TRUE); - } - } else if (this->unkF4_8 == 1) { - func_8035644C(FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT); - } - } - if (func_8038ECA8(this->marker) && this->has_met_before && !func_8038EB58(this) && (player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT)) { - func_8038F350(this, 2); - } - break; - - case 4: //L8038FE28 - if ((func_803114C4() != 0xF7C) && (func_803114C4() != 0xF7D)) { - if (sp7C[FACE_BUTTON(BUTTON_A)] == 1) { - lair_func_8038F894(this, 5); - } else if (sp7C[FACE_BUTTON(BUTTON_B)] == 1) { - func_8038F350(this, 1); - } else if ((sp6C[SIDE_BUTTON(BUTTON_Z)] == 1) && fileProgressFlag_get(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES)) { - lair_func_8038F894(this, 6); - } else if (sp7C[FACE_BUTTON(BUTTON_C_DOWN)] == 1) { - if (local->unk4) { - func_8038F350(this, 8); - } else { - comusic_playTrack(COMUSIC_2C_BUZZER); - func_8038F350(this, 1); - } - } - } - break; - - case 5: //L8038FF00 - case 6: //L8038FF00 - case 8: //L8038FF00 - if (this->lifetime_value > 0.0f) { - this->lifetime_value -= sp68; - } else { - func_8038F350(this, func_8038EB58(this) ? 7 :4); - } - break; - - case 7: //L8038FF50 - if (this->lifetime_value > 0.0f) { - this->lifetime_value -= sp68; - } else { - func_8038F350(this, 1); - } - break; - } - - { - s32 pad; - f32 sp44[3]; - s32 pad2; - this->marker->unk3E_1 = FALSE; - player_getPosition(sp44); - if (ml_distanceSquared_vec3f(sp44, this->position) < 250000.0f) { - if (!this->unk38_0) { - itemPrint_reset(); - this->unk38_0 = TRUE; - } - func_802FACA4(0x2B); - } - else if (this->unk38_0) { - func_802FAD64(0x2B); - this->unk38_0 = FALSE; - } - } -} diff --git a/src/lair/code_9C40.c b/src/lair/code_9C40.c index ab6a0e04..225c0fb1 100644 --- a/src/lair/code_9C40.c +++ b/src/lair/code_9C40.c @@ -44,7 +44,7 @@ void func_803900EC(ActorMarker *marker, enum asset_e text_id, s32 arg2){ func_8028F918(0); if (!fileProgressFlag_get(sp1C + FILEPROG_AD_CHEATO_BLUEEGGS_UNLOCKED)) { fileProgressFlag_set(sp1C + FILEPROG_AD_CHEATO_BLUEEGGS_UNLOCKED, 1); - func_8025A6EC(COMUSIC_2B_DING_B, 28000); + coMusicPlayer_playMusic(COMUSIC_2B_DING_B, 28000); } } @@ -63,10 +63,10 @@ void func_80390174(ActorMarker *marker, s32 arg1) { func_8028F94C(2, this->position); if (fileProgressFlag_get(sp28 + FILEPROG_AD_CHEATO_BLUEEGGS_UNLOCKED)) { // cheato hint texts - gcdialog_showText(sp28 + 0xF83, 0xE, this->position, this->marker, func_803900EC, lair_func_803900DC); + gcdialog_showDialog(sp28 + 0xF83, 0xE, this->position, this->marker, func_803900EC, lair_func_803900DC); return; } - func_80311174(func_80390084() + 0xFA5, 0xE, this->position, this->marker, func_803900EC, lair_func_803900DC, func_80390158); + gcdialog_showDialogConditional(func_80390084() + 0xFA5, 0xE, this->position, this->marker, func_803900EC, lair_func_803900DC, func_80390158); } void func_8039024C(Actor *this){ @@ -97,7 +97,7 @@ void func_803902B8(Actor *this) { sp58 = ml_vec3f_within_distance(this->position, sp5C, 1750.0f) && !this->has_met_before; if (sp58 && !this->unk38_0) { func_8032BB88(this, 0, 0x1F4); - func_8025A6EC(COMUSIC_79_CHEATO, 0); + coMusicPlayer_playMusic(COMUSIC_79_CHEATO, 0); comusic_8025AB44(COMUSIC_79_CHEATO, -1, 0x1F4); } else if (!sp58 && this->unk38_0) { diff --git a/src/lair/code_A170.c b/src/lair/code_A170.c index e413f49f..47e16c12 100644 --- a/src/lair/code_A170.c +++ b/src/lair/code_A170.c @@ -36,17 +36,17 @@ void func_803905CC(ActorMarker *marker, ActorMarker *other_marker){ case 0x170: item_setMaxCount(ITEM_D_EGGS); fxSparkle_giantBlueEgg(&marker->propPtr->x); - func_8025A6EC(SFX_EGG_REFILL, -1); + coMusicPlayer_playMusic(SFX_EGG_REFILL, -1); break; case 0x171: item_setMaxCount(ITEM_F_RED_FEATHER); fxSparkle_giantRedFeather(&marker->propPtr->x); - func_8025A6EC(SFX_RED_FEATHER_REFILL, -1); + coMusicPlayer_playMusic(SFX_RED_FEATHER_REFILL, -1); break; case 0x172: item_setMaxCount(ITEM_10_GOLD_FEATHER); fxSparkle_giantGoldFeather(&marker->propPtr->x); - func_8025A6EC(SFX_GOLD_FEATHER_REFILL, -1); + coMusicPlayer_playMusic(SFX_GOLD_FEATHER_REFILL, -1); break; } marker->collidable = FALSE; @@ -81,8 +81,8 @@ void func_803906A0(Actor *this) { } for(phi_s0 = 0; phi_s0 < phi_s2; phi_s0++){ if (randf() < ((1.0 / (f64) phi_s2) / 15.0)) { - func_8033E73C(this->marker, phi_s0 + 5, &func_80329904); - func_8033E3F0(phi_s4, 1); + commonParticle_add(this->marker, phi_s0 + 5, &func_80329904); + commonParticle_new(phi_s4, 1); } } } diff --git a/src/lair/code_A430.c b/src/lair/code_A430.c index 29445e1d..35a327c0 100644 --- a/src/lair/code_A430.c +++ b/src/lair/code_A430.c @@ -10,7 +10,7 @@ ActorInfo D_80394980 = { 0x299, 0x3C3, 0x0, 0x0, NULL, func_80390820, actor_upda /* .code */ void func_80390820(Actor *this) { - if (!this->unk38_0 && func_80329530(this, 200)) + if (!this->unk38_0 && subaddie_playerIsWithinSphereAndActive(this, 200)) { FUNC_8030E624(SFX_61_CARTOONY_FALL, 0.8f, 32000); timed_playSfx(0.5f, SFX_31_BANJO_OHHWAAOOO, 1, 32000); diff --git a/src/lair/code_A4A0.c b/src/lair/code_A4A0.c index 640004a8..37b90ef4 100644 --- a/src/lair/code_A4A0.c +++ b/src/lair/code_A4A0.c @@ -92,10 +92,10 @@ void func_80390AE8(Actor *this) { func_802DB5A0(this); if (this->state == 5) { if (actor_animationIsAt(this, 0.18f)) { - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_2_CLAW_SWIPE, 1.0f, 28000, this->position, 1250, 2500); } if (actor_animationIsAt(this, 0.7f)) { - FUNC_8030E8B4(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); + sfx_playFadeShorthandDefault(SFX_1F_HITTING_AN_ENEMY_3, 1.0f, 28000, this->position, 1250, 2500); } } } diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index 5780c41e..e1c2e294 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -182,7 +182,7 @@ void func_80391810(Actor *this, s32 next_state) { func_803916BC(sp38, 3); break; case 2: - FUNC_8030E8B4(SFX_148_GRUNTY_SPELL_LANDING, 1.0f, 20000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_148_GRUNTY_SPELL_LANDING, 1.0f, 20000, this->position, 1500, 3000); lair_func_80391254(this->position, 2, 0x4A0); lair_func_80391254(this->position, 2, 0x6C1); func_80391160(this->position, 4); @@ -193,7 +193,7 @@ void func_80391810(Actor *this, s32 next_state) { this->lifetime_value = 4.0f; break; case 3: - FUNC_8030E8B4(SFX_96_HOTSAND_EEL_HISS, 0.8f, 25000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_96_HOTSAND_EEL_HISS, 0.8f, 25000, this->position, 1500, 3000); sp38[0] = this->position[0]; sp38[1] = this->position[1]; sp38[2] = this->position[2]; @@ -264,7 +264,7 @@ void func_80391B04(Actor *this) { } } if ((local->unk8 < this->position[1]) && !this->has_met_before) { - FUNC_8030E8B4(SFX_14E_SOFT_EXPLOSION, 1.0f, 20000, this->position, 1500, 3000); + sfx_playFadeShorthandDefault(SFX_14E_SOFT_EXPLOSION, 1.0f, 20000, this->position, 1500, 3000); this->has_met_before = TRUE; } break; @@ -303,7 +303,7 @@ void func_80391EA8(ActorMarker *marker, ActorMarker *a1, f32 a2[3], f32 f1, f32 actor->scale = scale; - actor->unk100 = a1; + actor->partnerActor = a1; *(f32 *)(unk + 0x04) = f2 > 0 ? 0.5 : 0.0; *(s32 *)(unk + 0x0C) = f2 < 0 ? 2.5 : 1.0; diff --git a/src/lair/code_C1C0.c b/src/lair/code_C1C0.c index 3e5c328e..a9e03241 100644 --- a/src/lair/code_C1C0.c +++ b/src/lair/code_C1C0.c @@ -55,11 +55,11 @@ void func_80392690(ActorMarker *marker, enum asset_e text_id, s32 arg2){ void func_80392700(Actor *this) { if (mapSpecificFlags_get(4)) { if (fileProgressFlag_get(FILEPROG_F4_ENTER_FF_CUTSCENE)) { - gcdialog_showText(0x1031, 0xF, this->position, this->marker, func_80392664, func_80392610); + gcdialog_showDialog(0x1031, 0xF, this->position, this->marker, func_80392664, func_80392610); } else { func_802BC280(); ncStaticCamera_setToNode(0x1F); - gcdialog_showText(0x102C, 0xE, this->position, this->marker, func_80392664, func_80392610); + gcdialog_showDialog(0x102C, 0xE, this->position, this->marker, func_80392664, func_80392610); fileProgressFlag_set(FILEPROG_F4_ENTER_FF_CUTSCENE, TRUE); } mapSpecificFlags_set(4, 0); @@ -70,7 +70,7 @@ void func_80392700(Actor *this) { ncStaticCamera_setToNode(9); mapSpecificFlags_set(9, 1); func_8028F94C(2, this->position); - gcdialog_showText(0x103F, 0x2A, this->position, this->marker, func_80392690, func_80392610); + gcdialog_showDialog(0x103F, 0x2A, this->position, this->marker, func_80392690, func_80392610); mapSpecificFlags_set(6, 0); subaddie_set_state_with_direction(this, 3, 0.0f, 1); actor_playAnimationOnce(this); diff --git a/src/lair/code_C6C0.c b/src/lair/code_C6C0.c index 16284c20..7bd78a8a 100644 --- a/src/lair/code_C6C0.c +++ b/src/lair/code_C6C0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_8028F3D8(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); +extern void player_walkToPosition(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); void func_80392B6C(Actor *this); @@ -22,7 +22,7 @@ void func_80392AF4(ActorMarker *marker, enum asset_e text_id, s32 arg2){ void func_80392B1C(ActorMarker *marker) { func_8028E6EC(0); - gcdialog_showText(0x1040, 8, NULL, marker, func_80392AB0, func_80392AF4); + gcdialog_showDialog(0x1040, 8, NULL, marker, func_80392AB0, func_80392AF4); } void func_80392B6C(Actor *this) { @@ -52,6 +52,6 @@ void func_80392B6C(Actor *this) { ncStaticCamera_setToNode(0x10); func_8028F918(0); func_8028F85C(this->position); - func_8028F3D8(this->unk1C, (f32) sp28, &func_80392B1C, this->marker); + player_walkToPosition(this->unk1C, (f32) sp28, &func_80392B1C, this->marker); } } diff --git a/src/lair/jigsawpicture.c b/src/lair/jigsawpicture.c new file mode 100644 index 00000000..bb4f244c --- /dev/null +++ b/src/lair/jigsawpicture.c @@ -0,0 +1,647 @@ +#include +#include "functions.h" +#include "variables.h" +#include "jigsawpicture.h" + +extern void player_walkToPosition(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); +extern void func_80324CFC(f32, enum comusic_e, s32); +extern void rand_seed(s32); +extern void func_8034DF30(s32, f32[3], f32[3], f32); +extern void updateStruct6DsOpacity(s32, s32, s32,f32); + +typedef struct { + s32 placedPieces; + s32 placedJiggyCount; + s32 unk8; +} JigsawPictureActorData; + +typedef struct { + u8 cost; + u8 sizeBits; + u16 progressFlag; // enum file_progress_e +} JigsawPictureInfo; + +void jigsawPicture_setState(Actor *this, s32 next_state); +void updateJigsawPictureActor(Actor *this); + +/* + * Jigsaw Podium Actors: + * actorTypeSpecificField: Basically an ID that corresponds to which picture it's for + * lifetime_value: Timeout for interacting with the picture + */ + +/* .data */ +// Seem to correspond to the two possible jigsaw pictures that can spawn in a map. +// IE, in the first room, the first corresponds to MM. +// In the second room, the first corresponds to CC and the second to TTC +ActorInfo JIGSAW_PICTURE_ACTOR = { 0x1EB, 0x3B7, 0x48B, 0x1, NULL, updateJigsawPictureActor, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; +ActorInfo JIGSAW_PICTURE_ACTOR_2 = { 0x1EB, 0x3BC, 0x538, 0x1, NULL, updateJigsawPictureActor, actor_update_func_80326224, actor_draw, 0, 0, 0.0f, 0}; + +JigsawPictureInfo PICTURE_INFO[0xB] ={ + { 1, 0x1, FILEPROG_5D_MM_PUZZLE_PIECES_PLACED }, + { 2, 0x2, FILEPROG_5E_TCC_PUZZLE_PIECES_PLACED }, + { 5, 0x3, FILEPROG_60_CC_PUZZLE_PIECES_PLACED }, + { 7, 0x3, FILEPROG_63_BGS_PUZZLE_PIECES_PLACED }, + { 8, 0x4, FILEPROG_66_FP_PUZZLE_PIECES_PLACED }, + { 9, 0x4, FILEPROG_6A_GV_PUZZLE_PIECES_PLACED }, + {10, 0x4, FILEPROG_6E_MMM_PUZZLE_PIECES_PLACED }, + {12, 0x4, FILEPROG_72_RBB_PUZZLE_PIECES_PLACED }, + {15, 0x4, FILEPROG_76_CCW_PUZZLE_PIECES_PLACED }, + {25, 0x5, FILEPROG_7A_DOG_PUZZLE_PIECES_PLACED }, + { 4, 0x3, FILEPROG_7F_DOUBLE_HEALTH_PUZZLE_PIECES_PLACED } +}; +s32 D_80394824[3] = { 0xff, 0xff, 0 }; +ParticleScaleAndLifetimeRanges D_80394830 = { + { 0.17f, 0.24f }, + { 0.08f, 0.13f }, + { 0.0f, 0.01f }, + { 0.9f, 0.9f }, + 0.0f, + 0.0f +}; + +/* .code */ +bool jigsawPicture_isJigsawPictureComplete(s32 world) { + return fileProgressFlag_getN(PICTURE_INFO[world - 1].progressFlag, PICTURE_INFO[world - 1].sizeBits) == PICTURE_INFO[world - 1].cost; +} + +s32 getPictureCost(Actor *this) { + // Check bounds of PICTURE_INFO + return (this->actorTypeSpecificField != 0 && this->actorTypeSpecificField < 0xC) + ? PICTURE_INFO[this->actorTypeSpecificField - 1].cost : 0; +} + +bool isPictureComplete(Actor *this) { + JigsawPictureActorData *local; + + local = (JigsawPictureActorData*)&this->local; + + return getPictureCost(this) == local->placedJiggyCount; +} + +s32 getLevelSpecificOpenFlag(Actor *this) { + return this->actorTypeSpecificField + 0x1B; // MM starts at 1C +} + +void activateDoubleHealth(void) { + func_802FAFD4(ITEM_14_HEALTH, SFX_417_DOUBLE_HEALTH_UPGRADE); + func_802FAFC0(ITEM_14_HEALTH, COMUSIC_2B_DING_B); + fileProgressFlag_set(FILEPROG_B9_DOUBLE_HEALTH, TRUE); + func_80347958(); + item_adjustByDiffWithHud(ITEM_14_HEALTH, 0); + gcpausemenu_80314AC8(1); +} + +void afterPictureComplete(ActorMarker *marker) { + Actor *this; + + this = marker_getActor(reinterpret_cast(ActorMarker *, marker)); + + // Normal world pictures + if (this->actorTypeSpecificField < 0xA) { + levelSpecificFlags_set(getLevelSpecificOpenFlag(this), TRUE); + return; + } + + // Final Grunty door + if (this->actorTypeSpecificField == 0xA) { + func_8028F918(0); + func_8028F918(2); + levelSpecificFlags_set(LEVEL_FLAG_3F_LAIR_GRUNTY_DOOR_OPEN, TRUE); + return; + } + + // Double health picture + if (this->actorTypeSpecificField == 0xB) { + timedFunc_set_0(1.5f, activateDoubleHealth); + gcpausemenu_80314AC8(0); + } +} + +void onJigsawPodiumCollide(ActorMarker *marker, ActorMarker *_) { + marker->isBanjoOnTop = TRUE; +} + +bool isBanjoOnPodium(ActorMarker *marker) { + return func_8028F20C() && func_8028FB48(0x08000000) && marker->isBanjoOnTop; +} + +s32 isPicturePiecePlaced(Actor *this, s32 position) { + JigsawPictureActorData *local; + + local = (JigsawPictureActorData*)&this->local; + + return local->placedPieces & (1 << position); +} + +s32 jiggyPositionToID(Actor *this, s32 position) { + s32 start; + + switch (this->actorTypeSpecificField) { + case 7: // MMM + start = (position == 2) ? 0x1a4 : 0x190; + break; + + case 3: // CC + start = 0x192; + break; + + case 8: // RBB + start = 0x19A; + break; + + case 11: // Double health + start = 0x1AE; + break; + + default: + start = 0x190; + break; + } + + return start + position; +} + +s32 getUnknownJigsawPictureIndex(Actor *this) { + switch (this->actorTypeSpecificField) { + case 3: // CC + case 8: // RBB + case 0xB: // Double health + return 0x1F; + } + + return 0x1E; +} + +void func_8038EDBC(Actor *this) { + s32 sp44; + s32 sp40; + JigsawPictureActorData *local; + s32 sp38; + f32 sp34; + f32 sp28[3]; + + local = (JigsawPictureActorData*)&this->local; + sp38 = (this->modelCacheIndex == 0x3B7) ? 0x190 : 0x192; + sp44 = func_8034C2C4(this->marker, sp38); + sp40 = func_8034C2C4(this->marker, sp38 + 1); + + if ((sp44 != 0) && (sp40 != 0) && (this->marker->unk14_21)) { + sp28[0] = 1.0f; + sp28[1] = 1.0f; + sp28[2] = 1.0f; + + if (isBanjoOnPodium(this->marker) && local->unk8 < 0xFF) { + local->unk8 = (local->unk8 + 8 < 0xFF) ? local->unk8 + 8 : 0xFF; + } else if (!isBanjoOnPodium(this->marker) && (local->unk8 > 0)) { + local->unk8 = (local->unk8 - 8 > 0) ? local->unk8 - 8 : 0; + } + + sp34 = (0xFF - local->unk8) / 255.0; + func_8034DF30(sp44, sp28, sp28, 0); + sp34 = 1.0 - sp34; + func_8034DF30(sp40, sp28, sp28, 0); + + if (sp34); // Probably a debug assert + } +} + +void stoodOnPodiumCallback(ActorMarker *marker) { + f32 camera_position[3]; + Actor *this; + + this = marker_getActor(marker); + func_8034A174(func_803097A0(), getUnknownJigsawPictureIndex(this), camera_position); + + // Put Banjo into the idle animation + func_8028E6EC(2); + + func_8028F918(0); + func_8028F94C(4, camera_position); + + jigsawPicture_setState(this, + fileProgressFlag_get(FILEPROG_17_HAS_HAD_ENOUGH_JIGSAW_PIECES) ? JIGSAW_PICTURE_WAITING : JIGSAW_PICTURE_INSTRUCTIONS); +} + +void walkToPodium(Actor *this) { + s32 unused; // Can't remove ;.; + f32 player_position[3]; + f32 target_position[3]; + + this->has_met_before = FALSE; + player_getPosition(player_position); + target_position[0] = this->position[0]; + target_position[1] = this->position[1]; + target_position[2] = this->position[2]; + target_position[1] += 50.0f; + + player_walkToPosition(target_position, ml_vec3f_distance(player_position, target_position) / 150.0, stoodOnPodiumCallback, this->marker); +} + +void bottlesInstructionsCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { + Actor *this; + + this = marker_getActor(marker); + + // If this is the first picture, and the player has no jiggies, then force them to leave the podium + jigsawPicture_setState(this, (text_id == ASSET_F58_DIALOG_FIRST_PICTURE_INSTRUCTION) ? JIGSAW_PICTURE_LEAVE_PODIUM : JIGSAW_PICTURE_WAITING); +} + +void gruntyLaughCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { + func_8030E6D4(SFX_EA_GRUNTY_LAUGH_1); +} + +// Deterministic-randomly returns the next piece that should be added or removed. +// 0 is the upper left continuing to 3 in the upper right, then wrapping around on the next row on the left side +s32 getPicturePiecePosition(Actor *this) { + JigsawPictureActorData *local; + s32 previous; + s32 position; + s32 i; + + previous = 0; + local = (JigsawPictureActorData*)&this->local; + + // The places that pieces are placed is random, but it's deterministic based on the picture + rand_seed(this->actorTypeSpecificField); + + // Final Grunty door or double health + if (this->actorTypeSpecificField >= 0xA) { + for (i = 0; i < local->placedJiggyCount; i++) { + position = i; + previous |= (1 << position); + } + } else { + for (i = 0; i < local->placedJiggyCount; i++) { + do { + position = randi2(0, getPictureCost(this)); + } while ((1 << position) & previous); + previous |= 1 << position; // Funny bitmath to ensure that the value is not the same as a preceding + } + } + + return position; +} + +void addOrRemovePieceFromDisplay(Actor *this, s32 position, bool isAdd) { + s32 piece = func_8034C528(jiggyPositionToID(this, position)); + + if (piece != 0) { + updateStruct6DsOpacity(piece, isAdd ? 0 : 0xFF, isAdd ? 0xFF : 0, 1.0f); + } +} + +void unlockAdditionalActions(Actor *this) { + JigsawPictureActorData *local; + + local = (JigsawPictureActorData*)&this->local; + if ((this->actorTypeSpecificField >= 2) // Trigger at TTC + && (local->placedJiggyCount > 0) + && !isPictureComplete(this) + && !fileProgressFlag_get(FILEPROG_DF_CAN_REMOVE_ALL_PUZZLE_PIECES)) { + + if (gcdialog_showDialog(ASSET_F7C_DIALOG_BOTTLES_REMOVE_PIECE_INSTRUCTIONS, 2, NULL, NULL, NULL, NULL)) { + fileProgressFlag_set(FILEPROG_DF_CAN_REMOVE_ALL_PUZZLE_PIECES, TRUE); + } + } else if ((this->actorTypeSpecificField >= 3) // Trigger at CC + && (local->placedJiggyCount >= 2) // Trigger after the player put 2 jiggies in the picture + && !isPictureComplete(this) + && !fileProgressFlag_get(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES)) { + + if (gcdialog_showDialog(ASSET_F7D_DIALOG_BOTTLES_EXPLAINS_PLACE_ALL, 2, NULL, NULL, NULL, NULL)) { + fileProgressFlag_set(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES, TRUE); + } + } +} + +void jigsawPicture_setState(Actor *this, s32 nextState) { + JigsawPictureActorData *local; + f32 position[3]; + s32 jiggy_add_count; + s32 piece_position; + s32 i; + + local = (JigsawPictureActorData*)&this->local; + func_8034A174(func_803097A0(), getUnknownJigsawPictureIndex(this), position); + + switch (nextState) { + case JIGSAW_PICTURE_LEAVE_PODIUM: + func_8028F918(0); + break; + + case JIGSAW_PICTURE_ENTER_PODIUM: + walkToPodium(this); + sfx_playFadeShorthandDefault(SFX_112_TINKER_ATTENTION, 1.0f, 32000, this->position, 500, 1000); + break; + + case JIGSAW_PICTURE_INSTRUCTIONS: + func_803115C4(0xF7B); + func_803115C4(0xF80); + func_803115C4(0xF7F); + + if (item_getCount(ITEM_26_JIGGY_TOTAL) > 0) { + gcdialog_showDialog( + fileProgressFlag_get(FILEPROG_16_STOOD_ON_JIGSAW_PODIUM) + ? ASSET_F5A_DIALOG_FIRST_PICTURE_FIRST_PIECE_OBTAINED_AFTER + : ASSET_F59_DIALOG_FIRST_PICTURE_FIRST_PIECE_ALREADY_OBTAINED, + 6, + position, + this->marker, + bottlesInstructionsCallback, + NULL); + fileProgressFlag_set(FILEPROG_17_HAS_HAD_ENOUGH_JIGSAW_PIECES, 1); + } else { + gcdialog_showDialog(ASSET_F58_DIALOG_FIRST_PICTURE_INSTRUCTION, 6, position, this->marker, bottlesInstructionsCallback, NULL); + } + + fileProgressFlag_set(FILEPROG_16_STOOD_ON_JIGSAW_PODIUM, 1); + fileProgressFlag_set(FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT, 1); + break; + + case JIGSAW_PICTURE_REMOVE_PIECE: + if (local->placedJiggyCount > 0) { + comusic_playTrack(SFX_REMOVE_JIGGY); + this->lifetime_value = 1.0f; + piece_position = getPicturePiecePosition(this); + addOrRemovePieceFromDisplay(this, piece_position, 0); + local->placedJiggyCount--; + local->placedPieces &= ~(1 << piece_position); + fileProgressFlag_setN(PICTURE_INFO[this->actorTypeSpecificField - 1].progressFlag, local->placedJiggyCount, PICTURE_INFO[this->actorTypeSpecificField - 1].sizeBits); + item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, 1); + } + break; + + case JIGSAW_PICTURE_ADD_PIECE: + if (local->placedJiggyCount < getPictureCost(this)) { + comusic_playTrack(COMUSIC_67_INSERTING_JIGGY); + this->lifetime_value = 1.0f; + local->placedJiggyCount++; + piece_position = getPicturePiecePosition(this); + addOrRemovePieceFromDisplay(this, piece_position, 1); + local->placedPieces |= (1 << piece_position); + fileProgressFlag_setN(PICTURE_INFO[this->actorTypeSpecificField - 1].progressFlag, local->placedJiggyCount, PICTURE_INFO[this->actorTypeSpecificField - 1].sizeBits); + item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, -1); + unlockAdditionalActions(this); + } + + break; + + case JIGSAW_PICTURE_ADD_ALL: + if (local->placedJiggyCount < getPictureCost(this)) { + + // Does the player have enough jiggies to add all? Get the amount left or how many they have + if (item_getCount(ITEM_26_JIGGY_TOTAL) > getPictureCost(this) - local->placedJiggyCount) { + jiggy_add_count = getPictureCost(this) - local->placedJiggyCount; + } else { + jiggy_add_count = item_getCount(ITEM_26_JIGGY_TOTAL); + } + + comusic_playTrack(COMUSIC_67_INSERTING_JIGGY); + this->lifetime_value = 1.0f; + + for (i = 0; i < jiggy_add_count; i++) { + local->placedJiggyCount++; + piece_position = getPicturePiecePosition(this); + addOrRemovePieceFromDisplay(this, piece_position, 1); + local->placedPieces |= (1 << piece_position); + item_adjustByDiffWithoutHud(ITEM_26_JIGGY_TOTAL, -1); + } + + fileProgressFlag_setN(PICTURE_INFO[this->actorTypeSpecificField - 1].progressFlag, local->placedJiggyCount, PICTURE_INFO[this->actorTypeSpecificField - 1].sizeBits); + unlockAdditionalActions(this); + } + + break; + + case JIGSAW_PICTURE_COMPLETE: + comusic_playTrack(COMUSIC_65_WORLD_OPENING_B); + + // If MM or the last Grunty door, make her cackle + if (this->actorTypeSpecificField == 1) { + func_80324DBC(1.0f, 0xF7E, 4, NULL, this->marker, gruntyLaughCallback, NULL); + } else if (this->actorTypeSpecificField == 0xA) { + func_80324DBC(1.0f, 0xFAC, 4, NULL, this->marker, gruntyLaughCallback, NULL); + } + + timedFunc_set_1(2.0f, (GenFunction_1) afterPictureComplete, (s32) this->marker); + this->lifetime_value = 3.0f; + break; + } + + subaddie_set_state(this, nextState); +} + +void setInitialJigsawPictureOpacity(Actor *this) { + s32 piece; + s32 i; + + for (i = 0; i < getPictureCost(this); i++) { + piece = func_8034C528(jiggyPositionToID(this, i)); + if (piece != 0) { + setStruct6DsOpacity(piece, isPicturePiecePlaced(this, i) ? 0xff : 0); + } + } +} + +void addPieces(Actor *this, s32 nextState) { + + // Does the player have any jiggies? + if (item_getCount(ITEM_26_JIGGY_TOTAL) > 0) { + + // Transition to an add state + jigsawPicture_setState(this, nextState); + return; + } + + comusic_playTrack(COMUSIC_2C_BUZZER); + + if (fileProgressFlag_get(FILEPROG_DE_USED_ALL_YOUR_PUZZLE_PIECES) != 0) { + jigsawPicture_setState(this, JIGSAW_PICTURE_LEAVE_PODIUM); + return; + } + + // Bottles tells the player they need more jiggies, then sets flag; on future attempts it'll kick the player out + gcdialog_showDialog(ASSET_FBC_DIALOG_BOTTLES_OUT_OF_JIGGIES, 4, NULL, NULL, NULL, NULL); + fileProgressFlag_set(FILEPROG_DE_USED_ALL_YOUR_PUZZLE_PIECES, TRUE); +} + +void updateJigsawPictureActor(Actor *this) { + JigsawPictureActorData *local; + s32 face_buttons[6]; + s32 i; + s32 text_id; + s32 side_buttons[2]; + f32 delta_time; + s32 jiggiesPlaced; + + local = (JigsawPictureActorData*)&this->local; + delta_time = time_getDelta(); + + if (!this->initialized) { + this->initialized = TRUE; + } + + if (!this->volatile_initialized) { + jiggiesPlaced = fileProgressFlag_getN(PICTURE_INFO[this->actorTypeSpecificField - 1].progressFlag, PICTURE_INFO[this->actorTypeSpecificField - 1].sizeBits); + local->placedPieces = 0; + local->placedJiggyCount = 0; + local->unk8 = (isBanjoOnPodium(this->marker)) ? 0xFF : 1; + this->has_met_before = TRUE; + + // Initialize which jiggies have been placed + for (i = 0; i < jiggiesPlaced; i ++) { + local->placedJiggyCount++; + local->placedPieces |= (1 << getPicturePiecePosition(this)); + } + + setInitialJigsawPictureOpacity(this); + marker_setCollisionScripts(this->marker, onJigsawPodiumCollide, NULL, NULL); + this->marker->propPtr->unk8_3 = TRUE; + this->volatile_initialized = TRUE; + + // Click Clock Wood specific + if (this->actorTypeSpecificField == 9) { + this->unk1C[0] = 8.0f; + + // If the switch hasn't been pressed, then get rid of the podium + if (!fileProgressFlag_get(FILEPROG_53_CCW_PUZZLE_PODIUM_SWITCH_PRESSED)) { + marker_despawn(this->marker); + return; + } + + // Boring CCW podium activation + if (!fileProgressFlag_get(FILEPROG_54_CCW_PUZZLE_PODIUM_ACTIVE)) { + __bundle_spawnFromFirstActor(BUNDLE_20__UNKNOWN, this); + func_80324CFC(0.0f, COMUSIC_43_ENTER_LEVEL_GLITTER, 0x7FFF); + func_80324D2C(2.1f, COMUSIC_43_ENTER_LEVEL_GLITTER); + func_8030E6D4(SFX_113_PAD_APPEARS); + } + } + } + + // CCW podium activation, when it's not specifically active from the sandcastle cheat + if ((this->actorTypeSpecificField == 9) && !fileProgressFlag_get(FILEPROG_54_CCW_PUZZLE_PODIUM_ACTIVE)) { + this->yaw += this->unk1C[0]; + + while (this->yaw >= 360.0f) { + this->yaw -= 360.0f; + } + + this->unk1C[0] -= 0.089888; + + if (this->unk1C[0] < 0.0f) { + this->unk1C[0] = 0.0f; + } + + if (this->marker->unk14_21) { + s32 sp58[3] = D_80394824; + ParticleEmitter *sp54; + sp54 = partEmitMgr_newEmitter(6); + particleEmitter_setSprite(sp54, ASSET_710_SPRITE_SPARKLE_PURPLE); + particleEmitter_setAlpha(sp54, 0xFF); + particleEmitter_setScaleAndLifetimeRanges(sp54, &D_80394830); + particleEmitter_setPosition(sp54, this->position); + sp58[2] = randf() * 255.0f; + particleEmitter_setRGB(sp54, sp58); + particleEmitter_setSpawnPositionRange(sp54, -30.0f, -40.0f, -30.0f, 30.0f, 20.0f, 30.0f); + particleEmitter_emitN(sp54, 6); + } + } + + controller_copyFaceButtons(0, face_buttons); + controller_copySideButtons(0, side_buttons); + func_8038EDBC(this); + + switch (this->state) { + case JIGSAW_PICTURE_LEAVE_PODIUM: + if (!this->has_met_before && (!func_8028F20C() || !func_8028FB48(0x08000000))) { + this->has_met_before = TRUE; + } + + if (subaddie_playerIsWithinSphereAndActive(this, 300)) { + if ((this->actorTypeSpecificField == 0xA) && !fileProgressFlag_get(FILEPROG_F6_SEEN_DOOR_OF_GRUNTY_PUZZLE_PODIUM)) { + text_id = (item_getCount(ITEM_26_JIGGY_TOTAL) < PICTURE_INFO[this->actorTypeSpecificField - 1].cost) + ? ASSET_FAB_DIALOG_GRUNTY_DOOR_NEED_JIGGIES : ASSET_FC0_DIALOG_GRUNTY_DOOR_HAVE_JIGGIES; + if (gcdialog_showDialog(text_id, 0, NULL, NULL, NULL, NULL)) { + fileProgressFlag_set(FILEPROG_F6_SEEN_DOOR_OF_GRUNTY_PUZZLE_PODIUM, TRUE); + } + } else if (this->actorTypeSpecificField == 1) { // MM + progressDialog_showDialogMaskZero(FILEPROG_A7_NEAR_PUZZLE_PODIUM_TEXT); + } + } + + if (isBanjoOnPodium(this->marker) && this->has_met_before && !isPictureComplete(this) && (player_movementGroup() == BSGROUP_0_NONE || player_movementGroup() == BSGROUP_8_TROT)) { + jigsawPicture_setState(this, JIGSAW_PICTURE_ENTER_PODIUM); + } + + break; + + case JIGSAW_PICTURE_WAITING: + if ((gcdialog_getCurrentTextId() != ASSET_F7C_DIALOG_BOTTLES_REMOVE_PIECE_INSTRUCTIONS) + && (gcdialog_getCurrentTextId() != ASSET_F7D_DIALOG_BOTTLES_EXPLAINS_PLACE_ALL)) { + + // Add piece + if (face_buttons[FACE_BUTTON(BUTTON_A)] == TRUE) { + addPieces(this, JIGSAW_PICTURE_ADD_PIECE); + + // Leave Podium + } else if (face_buttons[FACE_BUTTON(BUTTON_B)] == TRUE) { + jigsawPicture_setState(this, JIGSAW_PICTURE_LEAVE_PODIUM); + + // Add all pieces + } else if ((side_buttons[SIDE_BUTTON(BUTTON_Z)] == TRUE) && fileProgressFlag_get(FILEPROG_E0_CAN_PLACE_ALL_PUZZLE_PIECES)) { + addPieces(this, JIGSAW_PICTURE_ADD_ALL); + + // Remove piece + } else if (face_buttons[FACE_BUTTON(BUTTON_C_DOWN)] == TRUE) { + if (local->placedJiggyCount) { + jigsawPicture_setState(this, JIGSAW_PICTURE_REMOVE_PIECE); + } else { // No pieces to remove in picture, exit + comusic_playTrack(COMUSIC_2C_BUZZER); + jigsawPicture_setState(this, JIGSAW_PICTURE_LEAVE_PODIUM); + } + } + } + break; + + case JIGSAW_PICTURE_ADD_PIECE: + case JIGSAW_PICTURE_ADD_ALL: + case JIGSAW_PICTURE_REMOVE_PIECE: + if (this->lifetime_value > 0.0f) { // Wait for timeout + this->lifetime_value -= delta_time; + } else { + jigsawPicture_setState(this, isPictureComplete(this) ? JIGSAW_PICTURE_COMPLETE : JIGSAW_PICTURE_WAITING); + } + + break; + + case JIGSAW_PICTURE_COMPLETE: + if (this->lifetime_value > 0.0f) { // Wait for timeout + this->lifetime_value -= delta_time; + } else { + jigsawPicture_setState(this, JIGSAW_PICTURE_LEAVE_PODIUM); + } + + break; + } + + { + s32 pad; + f32 sp44[3]; + s32 pad2; + this->marker->isBanjoOnTop = FALSE; + player_getPosition(sp44); + + if (ml_distanceSquared_vec3f(sp44, this->position) < 250000.0f) { + if (!this->unk38_0) { + itemPrint_reset(); + this->unk38_0 = TRUE; + } + + func_802FACA4(0x2B); + } else if (this->unk38_0) { + func_802FAD64(0x2B); + this->unk38_0 = FALSE; + } + } +} diff --git a/src/lair/jigsawpicture.h b/src/lair/jigsawpicture.h new file mode 100644 index 00000000..91690bec --- /dev/null +++ b/src/lair/jigsawpicture.h @@ -0,0 +1,10 @@ +typedef enum { + JIGSAW_PICTURE_LEAVE_PODIUM = 1, + JIGSAW_PICTURE_ENTER_PODIUM = 2, + JIGSAW_PICTURE_INSTRUCTIONS = 3, + JIGSAW_PICTURE_WAITING = 4, + JIGSAW_PICTURE_ADD_PIECE = 5, + JIGSAW_PICTURE_ADD_ALL = 6, + JIGSAW_PICTURE_COMPLETE = 7, + JIGSAW_PICTURE_REMOVE_PIECE = 8 +} JigsawPictureState;