diff --git a/decompressed.pal.yaml b/decompressed.pal.yaml index 14e5dbf5..8339909c 100644 --- a/decompressed.pal.yaml +++ b/decompressed.pal.yaml @@ -152,41 +152,41 @@ segments: - [0xF3F680, c, code_1D00] # NONMATCHING - [0xF40490, c, pimanager] - [0xF40650, c, defragmanager] - - [0xF40850, c, code_2FA0] + - [0xF40850, c, stub_2FA0] - [0xF40A70, c, initthread] - [0xF40B00, c, code_3250] - - [0xF41320, c, code_3A70] + - [0xF41320, c, stub_3A70] - [0xF42F00, c, code_5650] - [0xF44940, c, code_7090] - [0xF44b60, c, code_72B0] - [0xF45810, c, code_7F60] - [0xF46500, c, code_8C50] - - [0xF475C0, c, code_ABB0] + - [0xF475C0, c, framebufferdraw] - [0xF49870, c, code_CE60] - - [0xF4AD70, c, code_E360] - - [0xF4B4C0, c, code_EAF0] - - [0xF4D3D0, c, code_10A00] + - [0xF4AD70, c, vimgr] + - [0xF4B4C0, c, viewport] + - [0xF4D3D0, c, pfsmanager] - [0xF4E490, c, code_11AC0] - [0xF4F890, c, rumblemanager] - - [0xF50010, c, code_13640] - - [0xF50050, c, code_13680] + - [0xF50010, c, stub_13640] + - [0xF50050, c, sprite] - [0xF500a0, c, overlaymanager] - - [0xF50360, c, code_13990] + - [0xF50360, c, mlmtx] - [0xF51FC0, hasm, code_155F0] - [0xF52000, c, overlay] - - [0xF52140, c, code_15770] + - [0xF52140, c, depthbuffer] - [0xF52500, c, code_15B30] - [0xF53420, c, memory] - - [0xF54AE0, c, code_18110] - - [0xF54BE0, c, code_18210] - - [0xF54CE0, c, code_18310] - - [0xF54D20, c, code_18350] + - [0xF54AE0, c, eeprom] + - [0xF54BE0, c, ucode] + - [0xF54CE0, c, lookup] + - [0xF54D20, c, ml] - [0xF58860, c, code_1BE90] - - [0xF59F60, c, code_1D590] + - [0xF59F60, c, stub_1D590] - [0xF59F90, hasm, code_1D5C0] - [0xF59FA0, c, code_1D5D0] - - [0xF5AD30, c, code_1E360] - - [0xF5B0B0, c, code_1E6E0] + - [0xF5AD30, c, sns] + - [0xF5B0B0, c, crccalc] - [0xF5B1F0, hasm, code_1E820] - [0xF5B290, c, audio/n_sl] - [0xF5B320, c, audio/n_synthesizer] @@ -365,29 +365,29 @@ segments: - [0xF74830, .data, code_660] - [0xF74930, .data, code_1D00] - [0xF74A10, bin, data_37E30] #unreferenced - - [0xF74A20, .data, code_2FA0] + - [0xF74A20, .data, stub_2FA0] - [0xF74A30, .data, code_3250] - - [0xF74A40, .data, code_3A70] + - [0xF74A40, .data, stub_3A70] - [0xF74A80, .data, code_5650] - [0xF74AA0, .data, code_7090] - [0xF74AB0, bin, data_37ED0] #unreferenced - [0xF74AC0, .data, code_7F60] - [0xF74AD0, .data, code_8C50] - - [0xF74C60, .data, code_ABB0] + - [0xF74C60, .data, framebufferdraw] - [0xF74C70, .data, code_CE60] - - [0xF74CE0, .data, code_E360] - - [0xF74DD0, .data, code_EAF0] - - [0xF74DE0, .data, code_10A00] + - [0xF74CE0, .data, vimgr] + - [0xF74DD0, .data, viewport] + - [0xF74DE0, .data, pfsmanager] - [0xF74DF0, .data, code_11AC0] - [0xF75380, .data, overlaymanager] - - [0xF75620, .data, code_13990] + - [0xF75620, .data, mlmtx] - [0xF75630, .data, code_15B30] - [0xF75640, .data, memory] - - [0xF75670, .data, code_18310] - - [0xF75D60, .data, code_18350] + - [0xF75670, .data, lookup] + - [0xF75D60, .data, ml] - [0xF75EE0, .data, code_1BE90] - [0xF75EF0, .data, code_1D5D0] - - [0xF75F10, .data, code_1E360] + - [0xF75F10, .data, sns] - [0xF75F20, .data, data_1E820] - [0xF75F30, .data, audio/n_sl] - [0xF75F40, .data, audio/n_drvrNew] @@ -411,18 +411,18 @@ segments: - [0xF76680, .data, io/vimodentsclan1] - [0xF766D0, .rodata, code_1D00] - [0xF766F0, .rodata, code_3250] - - [0xF76700, .rodata, code_3A70] + - [0xF76700, .rodata, stub_3A70] - [0xF76710, .rodata, code_5650] - [0xF76770, .rodata, code_72B0] - [0xF76790, .rodata, code_7F60] - [0xF767B0, .rodata, code_CE60] - - [0xF76A80, .rodata, code_EAF0] - - [0xF76B00, .rodata, code_10A00] + - [0xF76A80, .rodata, viewport] + - [0xF76B00, .rodata, pfsmanager] - [0xF77210, .rodata, code_11AC0] - [0xF77220, .rodata, rumblemanager] - [0xF77230, .rodata, overlaymanager] - - [0xF772B0, .rodata, code_13990] - - [0xF772D0, .rodata, code_18350] + - [0xF772B0, .rodata, mlmtx] + - [0xF772D0, .rodata, ml] - [0xF773D0, .rodata, code_1BE90] - [0xF77400, .rodata, code_1D5D0] - [0xF77460, .rodata, audio/n_synthesizer] @@ -463,22 +463,22 @@ segments: - [0xF791D0, .bss, code_7090] - [0xF791D0, .bss, code_72B0] - [0xF791D0, .bss, code_8C50] - - [0xF791D0, .bss, code_ABB0] + - [0xF791D0, .bss, framebufferdraw] - [0xF791D0, .bss, code_CE60] - - [0xF791D0, .bss, code_E360] - - [0xF791D0, .bss, code_EAF0] - - [0xF791D0, .bss, code_10A00] + - [0xF791D0, .bss, vimgr] + - [0xF791D0, .bss, viewport] + - [0xF791D0, .bss, pfsmanager] - [0xF791D0, .bss, code_11AC0] - [0xF791D0, .bss, rumblemanager] - - [0xF791D0, .bss, code_13640] + - [0xF791D0, .bss, stub_13640] - [0xF791D0, .bss, overlaymanager] - - [0xF791D0, .bss, code_13990] - - [0xF791D0, .bss, code_15770] + - [0xF791D0, .bss, mlmtx] + - [0xF791D0, .bss, depthbuffer] - [0xF791D0, .bss, code_15B30] - [0xF791D0, .bss, memory] - - [0xF791D0, .bss, code_18210] + - [0xF791D0, .bss, ucode] - [0xF791D0, .bss, code_1D5D0] - - [0xF791D0, .bss, code_1E360] + - [0xF791D0, .bss, sns] - [0xF791D0, .bss, os/initialize] - [0xF791D0, .bss, io/pimgr] - [0xF791D0, .bss, io/sptask] diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index d1b3db18..9895a65f 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -152,42 +152,42 @@ segments: - [0xF1AF50, c, code_1D00] #DONE - [0xF1BE20, c, pimanager] - [0xF1BFF0, c, defragmanager] #DONE - - [0xF1C1F0, c, code_2FA0] #DONE + - [0xF1C1F0, c, stub_2FA0] #DONE - [0xF1C410, c, initthread] #DONE - [0xF1C4A0, c, code_3250] #DONE - - [0xF1CCC0, c, code_3A70] #DONE + - [0xF1CCC0, c, stub_3A70] #DONE - [0xF1E8A0, c, code_5650] - [0xF202E0, c, code_7090] #DONE - [0xF20500, c, code_72B0] #DONE - [0xF211B0, c, code_7F60] #DONE - [0xF21EA0, c, code_8C50] #DONE - [0xF22F80, c, code_9D30] #DONE - - [0xF23E00, c, code_ABB0] #DONE + - [0xF23E00, c, framebufferdraw] #DONE - [0xF260B0, c, code_CE60] #DONE - - [0xF275B0, c, code_E360] #DONE - - [0xF27D40, c, code_EAF0] #DONE - - [0xF29C50, c,code_10A00] + - [0xF275B0, c, vimgr] #DONE + - [0xF27D40, c, viewport] #DONE + - [0xF29C50, c,pfsmanager] - [0xF2AD10, c, code_11AC0] #DONE - [0xF2C160, c, rumblemanager] #DONE - - [0xF2C890, c, code_13640] #DONE - - [0xF2C8D0, c, code_13680] #DONE + - [0xF2C890, c, stub_13640] #DONE + - [0xF2C8D0, c, sprite] #DONE - [0xF2C920, c, overlaymanager] #DONE - - [0xF2CBE0, c, code_13990] + - [0xF2CBE0, c, mlmtx] - [0xF2E840, hasm, code_155F0] #DONE - [0xF2E880, c, overlay] #DONE - - [0xF2E9C0, c, code_15770] #DONE + - [0xF2E9C0, c, depthbuffer] #DONE - [0xF2ED80, c, code_15B30] #DONE - [0xF2FCA0, c, memory] #DONE - - [0xF31360, c, code_18110] #DONE - - [0xF31460, c, code_18210] #DONE - - [0xF31560, c, code_18310] #DONE - - [0xF315A0, c, code_18350] #DONE + - [0xF31360, c, eeprom] #DONE + - [0xF31460, c, ucode] #DONE + - [0xF31560, c, lookup] #DONE + - [0xF315A0, c, ml] #DONE - [0xF350E0, c, code_1BE90] #DONE - - [0xF367E0, c, code_1D590] #DONE + - [0xF367E0, c, stub_1D590] #DONE - [0xF36810, hasm, code_1D5C0] #DONE - [0xF36820, c, code_1D5D0] #DONE - - [0xF375B0, c, code_1E360] #DONE - - [0xF37930, c, code_1E6E0] #DONE + - [0xF375B0, c, sns] #DONE + - [0xF37930, c, crccalc] #DONE - [0xF37A70, hasm, code_1E820] #DONE - [0xF37B10, c, audio/n_sl] #DONE - [0xF37BA0, c, audio/n_synthesizer] #DONE @@ -365,30 +365,30 @@ segments: - [0xF50EA0, .data, code_660] - [0xF50FA0, .data, code_1D00] - [0xF51080, bin, data_37E30] #unreferenced - - [0xF51090, .data, code_2FA0] + - [0xF51090, .data, stub_2FA0] - [0xF510A0, .data, code_3250] - - [0xF510B0, .data, code_3A70] + - [0xF510B0, .data, stub_3A70] - [0xF510F0, .data, code_5650] - [0xF51110, .data, code_7090] - [0xF51120, bin, data_37ED0] #unreferenced - [0xF51130, .data, code_7F60] - [0xF51140, .data, code_8C50] - [0xF51280, .data, code_9D30] - - [0xF51430, .data, code_ABB0] + - [0xF51430, .data, framebufferdraw] - [0xF51440, .data, code_CE60] - - [0xF514B0, .data, code_E360] - - [0xF51550, .data, code_EAF0] - - [0xF51560, .data, code_10A00] + - [0xF514B0, .data, vimgr] + - [0xF51550, .data, viewport] + - [0xF51560, .data, pfsmanager] - [0xF51570, .data, code_11AC0] - [0xF51B00, .data, overlaymanager] - - [0xF51DA0, .data, code_13990] + - [0xF51DA0, .data, mlmtx] - [0xF51DB0, .data, code_15B30] - [0xF51DC0, .data, memory] - - [0xF51DF0, .data, code_18310] - - [0xF524E0, .data, code_18350] + - [0xF51DF0, .data, lookup] + - [0xF524E0, .data, ml] - [0xF52660, .data, code_1BE90] - [0xF52670, .data, code_1D5D0] - - [0xF52690, .data, code_1E360] + - [0xF52690, .data, sns] - [0xF526A0, .data, data_1E820] - [0xF526B0, .data, audio/n_sl] - [0xF526C0, .data, audio/n_drvrNew] @@ -412,19 +412,19 @@ segments: - [0xF52DB0, .data, io/vimodentsclan1] - [0xF52E50, .rodata, code_1D00] - [0xF52E70, .rodata, code_3250] - - [0xF52E80, .rodata, code_3A70] + - [0xF52E80, .rodata, stub_3A70] - [0xF52E90, .rodata, code_5650] - [0xF52EF0, .rodata, code_72B0] - [0xF52F10, .rodata, code_7F60] - [0xF52F30, .rodata, code_9D30] - [0xF52F50, .rodata, code_CE60] - - [0xF53220, .rodata, code_EAF0] - - [0xF532A0, .rodata, code_10A00] + - [0xF53220, .rodata, viewport] + - [0xF532A0, .rodata, pfsmanager] - [0xF539B0, .rodata, code_11AC0] - [0xF539C0, .rodata, rumblemanager] - [0xF539D0, .rodata, overlaymanager] - - [0xF53A50, .rodata, code_13990] - - [0xF53A70, .rodata, code_18350] + - [0xF53A50, .rodata, mlmtx] + - [0xF53A70, .rodata, ml] - [0xF53B70, .rodata, code_1BE90] - [0xF53BA0, .rodata, code_1D5D0] - [0xF53C00, .rodata, audio/n_synthesizer] @@ -464,22 +464,22 @@ segments: - [0xF55960, .bss, code_7090] - [0xF55960, .bss, code_72B0] - [0xF55960, .bss, code_8C50] - - [0xF55960, .bss, code_ABB0] + - [0xF55960, .bss, framebufferdraw] - [0xF55960, .bss, code_CE60] - - [0xF55960, .bss, code_E360] - - [0xF55960, .bss, code_EAF0] - - [0xF55960, .bss, code_10A00] + - [0xF55960, .bss, vimgr] + - [0xF55960, .bss, viewport] + - [0xF55960, .bss, pfsmanager] - [0xF55960, .bss, code_11AC0] - [0xF55960, .bss, rumblemanager] - - [0xF55960, .bss, code_13640] + - [0xF55960, .bss, stub_13640] - [0xF55960, .bss, overlaymanager] - - [0xF55960, .bss, code_13990] - - [0xF55960, .bss, code_15770] + - [0xF55960, .bss, mlmtx] + - [0xF55960, .bss, depthbuffer] - [0xF55960, .bss, code_15B30] - [0xF55960, .bss, memory] - - [0xF55960, .bss, code_18210] + - [0xF55960, .bss, ucode] - [0xF55960, .bss, code_1D5D0] - - [0xF55960, .bss, code_1E360] + - [0xF55960, .bss, sns] - [0xF55960, .bss, os/initialize] - [0xF55960, .bss, io/pimgr] - [0xF55960, .bss, io/sptask] diff --git a/include/core1/core1.h b/include/core1/core1.h index ab7b7536..a6ef1e11 100644 --- a/include/core1/core1.h +++ b/include/core1/core1.h @@ -1,9 +1,130 @@ -#ifndef __CORE_1_H__ -#define __CORE_1_H__ +#ifndef BANJO_KAZOOIE_CORE1_CORE1_H +#define BANJO_KAZOOIE_CORE1_CORE1_H +#include +#include "bool.h" +#include "enums.h" +#include "structs.h" +#include "prop.h" + +#include "core1/eeprom.h" +#include "core1/framebufferdraw.h" +#include "core1/lookup.h" +#include "core1/main.h" #include "core1/mem.h" +#include "core1/ml.h" +#include "core1/mlmtx.h" +#include "core1/pfsmanager.h" +#include "core1/rarezip.h" +#include "core1/sns.h" +#include "core1/sprite.h" +#include "core1/ucode.h" +#include "core1/viewport.h" +#include "core1/vimgr.h" -void mlMtx_apply_vec3f(f32[3], f32[3]); -void func_80252C08(f32 arg0[3], f32 arg1[3], f32 scale, f32 arg3[3]); + +/* need to sort out in individual header files */ + +void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]); + +void func_80250530(s32 arg0, u16 chan_mask, f32 arg2); + +void func_8025A104(enum comusic_e arg0, s32 arg1); +void func_8025A55C(s32 arg0, s32 arg1, s32 arg2); +s32 func_8025A864(enum comusic_e track_id); +void func_8025ABB8(enum comusic_e comusic_id, s32 arg1, s32 arg2, s32 arg3); +int func_8025AD7C(enum comusic_e arg0); +int func_8025ADBC(enum comusic_e arg0); + + +/* src/core1/code_7090.c */ + +void core1_7090_alloc(void); +void core1_7090_release(void); +void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volume); +void core1_7090_freeSfxSource(int idx); + + +/* src/core1/code_CE60.c */ + +void core1_ce60_setChanMask(s32 chan_mask); +void core1_ce60_setChanMaskWithValue(s32 chan_mask, f32 arg1); +bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance); +f32 core1_ce60_getPlayerDistance(f32 x, f32 z); +bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx); +void core1_ce60_func_8024A9EC(s32 arg0); +void core1_ce60_func_8024AAB0(void); +void core1_ce60_func_8024ADF0(bool arg0); +void core1_ce60_func_8024AE74(void); +void core1_ce60_resetState(void); +void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface); +void core1_ce60_func_8024AF48(void); +void core1_ce60_incOrDecCounter(bool increment); +void core1_ce60_func_8024BD40(s32 arg0, s32 arg1); + + + +/* src/core1/depthbuffer.c */ + +extern u8 D_8000E800; + +void func_80253190(Gfx **gfx); +void func_80253208(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer); +bool func_80253400(void); +bool depthBuffer_isPointerSet(void); +void depthBuffer_stub(void); +void func_80253428(int arg0); +void func_802534A8(int arg0); +void zBuffer_set(Gfx **gfx); +void *zBuffer_get(void); + + + +/* src/core1/code_15B30.c */ + +typedef struct { + s32 unk0; + s32 unk4; + Gfx *unk8; + Gfx *unkC; + s32 unk10; + s32 unk14; +}Struct_Core1_15B30; + +#define DEFAULT_FRAMEBUFFER_WIDTH 292 +#define DEFAULT_FRAMEBUFFER_HEIGHT 216 + +extern s32 gFramebufferWidth; +extern s32 gFramebufferHeight; +extern u16 gFramebuffers[2][DEFAULT_FRAMEBUFFER_WIDTH * DEFAULT_FRAMEBUFFER_HEIGHT]; + +void func_80253550(void); +void func_8025357C(void); +void func_802535A8(Gfx **arg0, Gfx **arg1, UNK_TYPE(s32) arg2, UNK_TYPE(s32) arg3); +void func_80253640(Gfx ** gdl, void *arg1); +void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx); +void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address); +void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx); +void func_80253DC0(Gfx **gfx); +void finishFrame(Gfx **gdl); +void func_80253E14(Gfx *arg0, Gfx *arg1, s32 arg2); +void func_80253EA4(Gfx *arg0, Gfx *arg1); +void func_80253EC4(Gfx *arg0, Gfx *arg1); +void func_80253EE4(Gfx **arg0, Gfx **arg1, s32 arg2); +void func_80253F74(Gfx **arg0, Gfx **arg1); +void func_80253F94(Gfx **arg0, Gfx **arg1); +void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom); +void func_80253FE8(void); +void func_80254008(void); +void func_80254028(void); +void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b); +void graphicsCache_release(void); +void graphicsCache_init(void); +void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom); +void scissorBox_setDefault(void); +void func_80254374(s32 arg0); +void toggleTextureFilterPoint(void); +void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx); +void dummy_func_80254464(void); #endif diff --git a/include/core1/eeprom.h b/include/core1/eeprom.h new file mode 100644 index 00000000..bf6da53a --- /dev/null +++ b/include/core1/eeprom.h @@ -0,0 +1,7 @@ +#ifndef BANJO_KAZOOIE_CORE1_EEPROM_H +#define BANJO_KAZOOIE_CORE1_EEPROM_H + +s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count); +s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count); + +#endif diff --git a/include/core1/framebufferdraw.h b/include/core1/framebufferdraw.h new file mode 100644 index 00000000..1b625218 --- /dev/null +++ b/include/core1/framebufferdraw.h @@ -0,0 +1,28 @@ +#ifndef BANJO_KAZOOIE_CORE1_FRAMEBUFFERDRAW_H +#define BANJO_KAZOOIE_CORE1_FRAMEBUFFERDRAW_H + +void framebufferdraw_drawSpriteCI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled); +void framebufferdraw_drawSpriteCI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled); +void framebufferdraw_drawSpriteRGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled); +void framebufferdraw_drawSpriteI4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled); +void framebufferdraw_drawSpriteIA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled); +void framebufferdraw_drawSpriteI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled); +void framebufferdraw_drawSpriteIA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled); +void framebufferdraw_drawSpriteRGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled); +void framebufferdraw_stub1(s32 arg0, s32 arg1, s32 arg2, s32 arg3); +void framebufferdraw_stub2(s32 arg0, s32 arg1, s32 arg2, s32 arg3); +void framebufferdraw_drawTexture_CI4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled); +void framebufferdraw_draw(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled); +void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4); +void framebufferdraw_func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor); +void framebufferdraw_drawGrid(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing); +void framebufferdraw_setPixel(s32 x, s32 y); +void framebufferdraw_drawOutline(s32 x, s32 y, s32 w, s32 h); +void framebufferdraw_func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 arg6); +void framebufferdraw_drawRect(s32 x, s32 y, s32 w, s32 h); +void framebufferdraw_resetPrimColorAndBuffer(void); +void framebufferdraw_setPrimColor(s32 r, s32 g, s32 b); +void framebufferdraw_setBufferIndex(s32 buffer_indx); +s32 framebufferdraw_getBufferIndex(void); + +#endif diff --git a/include/core1/lookup.h b/include/core1/lookup.h new file mode 100644 index 00000000..ae1041ab --- /dev/null +++ b/include/core1/lookup.h @@ -0,0 +1,8 @@ +#ifndef BANJO_KAZOOIE_CORE1_LOOKUP_H +#define BANJO_KAZOOIE_CORE1_LOOKUP_H + +enum comusic_e lookup_getCoMusicId(s32 idx); +enum sfx_e lookup_getSfxId(s32 idx); +enum asset_e lookup_getAnimAssetId(s32 idx); + +#endif diff --git a/include/core1/main.h b/include/core1/main.h new file mode 100644 index 00000000..65fd50ad --- /dev/null +++ b/include/core1/main.h @@ -0,0 +1,26 @@ +#ifndef BANJO_KAZOOIE_CORE1_MAIN_H +#define BANJO_KAZOOIE_CORE1_MAIN_H + +void func_8023DA20(s32 arg0); +void func_8023DA74(void); +void func_8023DA9C(s32 arg0); +u32 globalTimer_getTimeMasked(u32 mask); +//s32 globalTimer_getTime(void); +void globalTimer_reset(void); +enum map_e getSpecialBootMap(void); +enum map_e getDefaultBootMap(void); +void func_8023DBAC(void); +void func_8023DBDC(void); +void core1_init(void); +void globalTimer_incTimer(void); +void globalTimer_decTimer(void); +void mainLoop(void); +void mainThread_entry(void *arg); +void func_8023DFF0(s32 arg0); +s32 func_8023E000(void); +void setBootMap(enum map_e map_id); +void mainThread_create(void); +OSThread *mainThread_get(void); +void disableInput_set(void); + +#endif diff --git a/include/core1/mem.h b/include/core1/mem.h index 029d7882..c0ed19b1 100644 --- a/include/core1/mem.h +++ b/include/core1/mem.h @@ -1,5 +1,5 @@ -#ifndef __MEM_H__ -#define __MEM_H__ +#ifndef BANJO_KAZOOIE_CORE1_MEMORY_H +#define BANJO_KAZOOIE_CORE1_MEMORY_H /** * copy memory area diff --git a/include/core1/ml.h b/include/core1/ml.h new file mode 100644 index 00000000..ef41b85c --- /dev/null +++ b/include/core1/ml.h @@ -0,0 +1,122 @@ +#ifndef BANJO_KAZOOIE_CORE1_ML_H +#define BANJO_KAZOOIE_CORE1_ML_H + +f32 ml_acosf_deg(f32 x); +void ml_vec3f_sub_and_rotate(f32 vec1[3], f32 rotation[3], f32 vec2[3], f32 dst[3]); +f32 ml_vec3f_cos_between(f32 vec1[3], f32 vec2[3]); +void ml_vec3f_cross_product(f32 dst[3], f32 vec1[3], f32 vec2[3]); +void ml_vec3f_interpolate_fast(f32 dst[3], f32 start[3], f32 end[3], f32 t); +f32 ml_vec3f_dot_product(f32 vec1[3], f32 vec2[3]); +f32 ml_vec3f_distance(f32 vec1[3], f32 vec2[3]); +f32 ml_func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]); +f32 ml_distanceSquared_vec3f(f32 vec1[3], f32 vec2[3]); +void func_802562DC(f32 vec1[3], f32 vec2[3], f32 vec3[3]); +f32 ml_vec3f_length_unused(f32 vec[3]); +void ml_vec3f_normalize_copy(f32 arg0[3], f32 arg1[3]); +void ml_vec3f_normalize(f32 vec[3]); +void ml_vec2f_normalize(f32 vec[2]); +void ml_3f_normalize(f32 *x, f32 *y, f32 *z); +void ml_vec3f_set_length_copy(f32 dst[3], f32 src[3], f32 len); +void func_80256664(f32 ptr[3]); +void func_80256740(f32 vec[3]); +void ml_vec3f_pitch_rotate_copy(f32 dst[3], f32 src[3], f32 pitch); +void ml_vec3f_yaw_rotate_copy(f32 dst[3], f32 src[3], f32 yaw); +void ml_vec3f_roll_rotate_copy(f32 dst[3], f32 src[3], f32 roll); +void ml_vec3f_set_length(f32 vec[3], f32 length); +f32 func_80256AB4(f32 x1, f32 y1, f32 x2, f32 y2); +f32 func_80256B54(f32 vec1[3], f32 vec2[3]); +f32 func_80256C60(f32 vec[3], s32 val); +void func_80256D0C(f32 val1, f32 val2, f32 x, f32 y, f32 z, f32 *dstX, f32 *dstY, f32 *dstZ); +void func_80256E24(f32 dst[3], f32 theta, f32 phi, f32 x, f32 y, f32 z); +void func_80256F44(f32 vec1[3], f32 vec2[3], f32 vec3[3], f32 dst[3]); +f32 ml_acosf(f32 x); +f32 func_8025715C(f32 val1, f32 val2); +f32 func_80257204(f32 val1, f32 val2, f32 val3, f32 val4); +f32 func_80257248(f32 vec1[3], f32 vec2[3]); +void func_8025727C(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 *o1, f32 *o2); +void ml_init(void); +void ml_free(void); +f32 func_802575BC(f32 val); +f32 func_80257618(f32 val); +f32 func_80257658(f32 val); +f32 func_80257680(f32 val1, f32 val2, f32 val3); +void ml_defrag(void); +bool ml_timer_update(f32 *timer, f32 delta); +void func_8025778C(f32 dst[3], f32 arg1[3], f32 arg2[3][3]); +void func_802578A4(f32 dst[3], f32 vec1[3], f32 vec2[3]); +void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]); +bool func_802579B0(f32 vec[3], f32 x1, f32 z1, f32 x2, f32 z2); +f32 func_80257A44(f32 val1, f32 val2); +f32 func_80257A6C(f32 val1, f32 val2); +f32 func_80257AD4(f32 val1, f32 val2); +f32 ml_map_f(f32 val, f32 in_min, f32 in_max, f32 out_min, f32 out_max); +f32 ml_mapRange_f(f32 val, f32 in_min, f32 in_max, f32 out_min, f32 out_max); +f32 ml_interpolate_f(f32 arg0, f32 arg1, f32 arg2); +f32 ml_mapFunction_f(f32 a, f32 b, f32 c, f32 d, f32 e, f32 (*func)(f32)); +f32 func_80257CC0(f32 a, f32 b, f32 c, f32 d, f32 e); +f32 func_80257CF8(f32 a, f32 b, f32 c, f32 d, f32 e); +f32 ml_mapAbsRange_f(f32 val, f32 in_min, f32 in_max, f32 out_min, f32 out_max); +void func_80257DB0(f32 arg0[3], f32 arg1[3], f32 arg2[3]); +void ml_setLength_vec3f(f32 v[3], f32 a); +s32 ml_clamp_w(s32 val, s32 min, s32 max); +f32 ml_clamp_f(f32 val, f32 min, f32 max); +int func_80257F18(f32 src[3], f32 target[3], f32 *yaw); +int func_8025801C(f32 target[3], f32 *yaw); +int func_80258108(f32 vec[3], f32 *arg1, f32 *arg2); +int func_80258210(f32 x, f32 y, f32 *dst); +bool ml_isZero_vec3f(f32 vec[3]); +bool ml_isNonzero_vec3f(f32 vec[3]); +bool ml_vec3f_not_on_vertical_axis(f32 vec[3]); +bool ml_vec3f_inside_box_f(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); +bool ml_vec3f_inside_box_vec3f(f32 vec[3], f32 min[3], f32 max[3]); +bool ml_vec3w_inside_box_w(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ); +f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]); +f32 ml_vec3f_horizontal_distance_squared_zero_likely(f32 vec1[3], f32 vec2[3]); +f32 ml_vec3f_length(f32 vec1[3], f32 vec2[3]); +f32 ml_vec3f_length_sq(f32 vec1[3], f32 vec2[3]); +f32 ml_sin_deg(f32 angle_deg); +f32 ml_cos_deg(f32 angle_deg); +f32 mlNormalizeAngle(f32 angle); +f32 ml_remainder_f(f32 arg0, f32 arg1); +f32 ml_max_f(f32 arg0, f32 arg1); +f32 ml_min_f(f32 arg0, f32 arg1); +int ml_max_w(int arg0, int arg1); +int ml_min_w(int arg0, int arg1); +f32 mlAbsF(f32 arg0); +f32 func_80258994(f32 arg0[3]); +int ml_abs_w(int arg0); +void func_802589E4(f32 dst[3], f32 yaw, f32 length); +void func_80258A4C(f32 vec1[3], f32 arg1, f32 vec2[3], f32 *arg3, f32 *arg4, f32 *arg5); +void ml_vec3f_clear(f32 dst[3]); +void ml_vec3f_copy(f32 dst[3], f32 src[3]); +void ml_vec3f_diff_copy(f32 dst[3], f32 src1[3], f32 src2[3]); +void ml_vec3f_diff(f32 dst[3], f32 src[3]); +void ml_vec3f_assign(f32 dst[3], f32 x, f32 y, f32 z); +void ml_vec3f_add(f32 dst[3], f32 src1[3], f32 src2[3]); +void ml_vec3f_scale(f32 vec[3], f32 scale); +void ml_vec3f_scale_copy(f32 dst[3], f32 src[3], f32 scale); +void func_80258CDC(f32 vec1[3], f32 vec2[3]); +void ml_vec3w_to_vec3f(f32 dst[3], s32 src[3]); +void ml_vec3h_to_vec3f(f32 dst[3], s16 src[3]); +void ml_vec3f_to_vec3w(s32 dst[3], f32 src[3]); +void ml_vec3f_to_vec3h(s16 dst[3], f32 src[3]); +void ml_translate_y_local(f32 position[3], f32 rotation[3], f32 dy); +void ml_translate_z_local(f32 dst[3], f32 src[3], f32 dz); +void ml_translate_x_local(f32 dst[3], f32 src[3], f32 dx); +void func_8025901C(f32 arg0, f32 arg1[3], f32 arg2[3], f32 arg3); +f32 func_80259198(f32 arg0, f32 arg1); +f32 mlDiffDegF(f32 arg0, f32 arg1); +bool ml_vec3f_point_within_horizontal_distance(f32 vec[3], f32 x, f32 z, f32 distance); +bool ml_vec3f_within_horizontal_distance(f32 vec1[3], f32 vec2[3], f32 distance); +bool ml_vec3w_within_horizontal_distance(s32 vec1[3], s32 vec2[3], s32 distance); +bool ml_vec3f_within_distance(f32 vec1[3], f32 vec2[3], f32 distance); +bool ml_stub_80259400(f32 x); +void ml_sub_delta_time(f32 *x); +void func_8025947C(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]); +f32 func_80259554(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 vec3[3]); +void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]); +s32 ml_getViewportYawWithOffset(f32 x); +bool ml_isViewportYawWithOffsetNormalized(f32 x); +void ml_vec3f_interpolate(f32 dst[3], f32 start[3], f32 end[3], f32 t); + +#endif diff --git a/include/core1/mlmtx.h b/include/core1/mlmtx.h new file mode 100644 index 00000000..be949db6 --- /dev/null +++ b/include/core1/mlmtx.h @@ -0,0 +1,45 @@ +#ifndef BANJO_KAZOOIE_CORE1_MLMTX_H +#define BANJO_KAZOOIE_CORE1_MLMTX_H + +void mlMtxGet(MtxF *dst); +MtxF *mlMtx_get_stack_pointer(void); +void mlMtxApply(Mtx *mPtr); +void mlMtxPop(void); +void mlMtx_push_duplicate(void); +void mlMtx_push_identity(void); +void mlMtx_push_translation(f32 x, f32 y, f32 z); +void mlMtx_push_mtx(f32* mtx); +void mlMtx_push_multiplied(f32* l_mtx); +void mlMtx_push_multiplied_2(MtxF * l_mtx, MtxF * r_mtx); +void mlMtxIdent(void); +void func_80251B5C(f32 x, f32 y, f32 z); +void mlMtxSet(MtxF* arg0); +void mlMtxRotate(f32 a, f32 x, f32 y, f32 z); +void mlMtxRotPitch(f32 arg0); +void mlMtxRotYaw(f32 arg0); +void mlMtxRotRoll(f32 arg0); +void mlMtx_rotate_pitch_deg(f32 arg0); +void mlMtx_rotate_yaw_deg(f32 arg0); +void mlMtxRotatePYR(f32 pitch, f32 yaw, f32 roll); +void mlMtxScale_xyz(f32 x, f32 y, f32 z); +void mlMtxScale(f32 scale); +void func_80252330(f32 x, f32 y, f32 z); +void mlMtx_apply_vec3f(f32 dst[3], f32 src[3]); +void mlMtx_apply_vec3f_restricted(f32 dst[3], f32 src[3]); +void mlMtx_apply_f3(f32 dst[3], f32 x, f32 y, f32 z); +void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]); +void func_8025276C(s32 arg0[3], s32 arg1[3], s32 arg2[3], s32 arg3[3]); +void mlMtxTranslate(f32 x, f32 y, f32 z); +void func_80252A38(f32 x, f32 y, f32 z); +void func_80252AF0(f32 arg0[3], f32 arg1[3], f32 rotation[3], f32 scale, f32 arg4[3]); +void func_80252C08(f32 arg0[3], f32 rotation[3], f32 scale, f32 arg3[3]); +void func_80252CC4(f32 position[3], f32 rotation[3], f32 scale, f32 arg3[3]); +void func_80252D8C(f32 position[3], f32 rotation[3]); +void func_80252DDC(f32 position[3], f32 rotation[3]); +void func_80252E4C(f32 position[3], f32 rotation[3]); +void func_80252EC8(f32 position[3], f32 rotation[3]); +void func_80252F50(f32 rotation[3]); +void func_80252F8C(f32 rotation[3]); +void func_80252FC8(f32 rotation[3]); + +#endif diff --git a/include/core1/pfsmanager.h b/include/core1/pfsmanager.h new file mode 100644 index 00000000..2c82f32a --- /dev/null +++ b/include/core1/pfsmanager.h @@ -0,0 +1,68 @@ +#ifndef BANJO_KAZOOIE_CORE1_PFSMANAGER_H +#define BANJO_KAZOOIE_CORE1_PFSMANAGER_H + +typedef struct pfs_manager_face_buttons_s { + bool button_a; + bool button_b; + bool button_c_left; + bool button_c_up; + bool button_c_down; + bool button_c_right; +} PfsManagerFaceButtons; + +typedef struct pfs_manager_side_buttons_s { + bool button_z; + bool button_l; + bool button_r; +} PfsManagerSideButtons; + +typedef struct pfs_manager_controller_data { + union { s32 face_button[6]; PfsManagerFaceButtons face_button2; }; + union { s32 side_button[3]; PfsManagerSideButtons side_button2; }; + s32 unk24[4]; + s32 start_button; +} PfsManagerControllerData; + +typedef struct { + s16 unk0; + s16 unk2; + u16 unk4; + u16 unk6; + f32 unk8[2]; + f32 joystick[2]; +}Struct_core1_10A00_1; + +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 func_8024E640(s32 controller_index, s32 dst[3]); +f32 func_8024E668(s32 controller_index); +s32 controller_getStartButton(s32 controller_index); +s32 func_8024E698(s32 controller_index); +void func_8024E6E0(s32 controller_index, s32 *dst[4]); +void controller_getJoystick(s32 controller_index, f32 dst[2]); +void pfsManager_update(void); +void pfsManager_readData(); +void pfsManager_entry(void *arg); +void pfsManager_init(void); +bool pfsManager_contErr(void); +void func_8024F150(void); +void func_8024F180(void); +void pfsManager_getStartReadData(void); +void func_8024F1F0(void); +void func_8024F224(void); +void func_8024F2E4(s32 arg0, Struct_core1_10A00_1 *arg1); +void func_8024F328(s32 controller_index, s32 arg1); +OSMesgQueue * pfsManager_getFrameReplyQ(void); +OSMesgQueue *pfsManager_getFrameMesgQ(void); +void func_8024F35C(s32 arg0); +bool pfsManager_isBusy(void); +int func_8024F3C4(int arg0); +OSContPad *func_8024F3F4(void); +void func_8024F400(void); +void func_8024F450(void); +void func_8024F4AC(void); + +#endif diff --git a/include/core1/rarezip.h b/include/core1/rarezip.h index 2c472403..c044a6d7 100644 --- a/include/core1/rarezip.h +++ b/include/core1/rarezip.h @@ -1,7 +1,5 @@ -#ifndef RAREZIP_H -#define RAREZIP_H -#include - +#ifndef BANJO_KAZOOIE_CORE1_RAREZIP_H +#define BANJO_KAZOOIE_CORE1_RAREZIP_H extern u8 D_80275670[]; //border[]= { /* Order of the bit length code lengths */ diff --git a/include/SnS.h b/include/core1/sns.h similarity index 98% rename from include/SnS.h rename to include/core1/sns.h index ab978aad..9a3f9dfa 100644 --- a/include/SnS.h +++ b/include/core1/sns.h @@ -1,6 +1,5 @@ -#ifndef __SNS_H__ -#define __SNS_H__ -#include +#ifndef BANJO_KAZOOIE_CORE1_SNS_H +#define BANJO_KAZOOIE_CORE1_SNS_H /** * sns sets diff --git a/include/core1/sprite.h b/include/core1/sprite.h new file mode 100644 index 00000000..60cf77ec --- /dev/null +++ b/include/core1/sprite.h @@ -0,0 +1,11 @@ +#ifndef BANJO_KAZOOIE_CORE1_SPRITE_H +#define BANJO_KAZOOIE_CORE1_SPRITE_H + +u32 sprite_getUnk8(BKSprite *this); +u32 sprite_getUnkA(BKSprite *this); +u32 sprite_getUnk6(BKSprite *this); +u32 sprite_getUnk4(BKSprite *this); +s32 sprite_getFrameCount(BKSprite *this); +BKSpriteFrame *sprite_getFramePtr(BKSprite *this, u32 frame_id); + +#endif diff --git a/include/core1/ucode.h b/include/core1/ucode.h new file mode 100644 index 00000000..fa8e719c --- /dev/null +++ b/include/core1/ucode.h @@ -0,0 +1,10 @@ +#ifndef BANJO_KAZOOIE_CORE1_UCODE_H +#define BANJO_KAZOOIE_CORE1_UCODE_H + +void ucode_load(void); +void ucode_stub1(void); // does nothing +void ucode_stub2(void); // performs dummy read on PI +s32 ucode_stub3(void); // returns always 0 +void ucode_getPtrAndSize(void **ptr, u32 *size); + +#endif diff --git a/include/core1/viewport.h b/include/core1/viewport.h index 70d147a5..509b9b02 100644 --- a/include/core1/viewport.h +++ b/include/core1/viewport.h @@ -1,10 +1,5 @@ -#ifndef BANJO_KAZOOIE_VIEWPORT_H -#define BANJO_KAZOOIE_VIEWPORT_H - -#include -#include // for Cube -#include "ml/mtx.h" // for MtxF - +#ifndef BANJO_KAZOOIE_CORE1_VIEWPORT_H +#define BANJO_KAZOOIE_CORE1_VIEWPORT_H void viewport_moveAlongZAxis(f32 offset); f32 viewport_getDistance(f32 arg0[3]); diff --git a/include/core1/vimgr.h b/include/core1/vimgr.h new file mode 100644 index 00000000..f15a3b79 --- /dev/null +++ b/include/core1/vimgr.h @@ -0,0 +1,28 @@ +#ifndef BANJO_KAZOOIE_CORE1_VIMGR_H +#define BANJO_KAZOOIE_CORE1_VIMGR_H + +typedef struct struct_1_s{ + OSMesgQueue *messageQueue; + OSMesg message; +} struct1; + +u32 getOtherFramebuffer(void); +s32 viMgr_func_8024BD94(void); +s32 getActiveFramebuffer(void); +void viMgr_func_8024BDAC(OSMesgQueue *mq, OSMesg msg); +void viMgr_init(void); +void viMgr_func_8024BF94(s32 arg0); +s32 viMgr_func_8024BFA0(void); +void viMgr_func_8024BFAC(void); +void viMgr_func_8024BFD8(s32 arg0); +void viMgr_func_8024C1B4(void); +void viMgr_func_8024C1DC(void); +void viMgr_func_8024C1FC(OSMesgQueue *mq, OSMesg msg); +void viMgr_setActiveFramebuffer(s32 arg0); +void viMgr_entry(void *arg0); +void viMgr_setScreenBlack(s32 active); +void viMgr_clearFramebuffers(void); +s32 viMgr_func_8024C4E8(void); +void viMgr_func_8024C4F8(s32 arg0); + +#endif diff --git a/include/core2/animctrl.h b/include/core2/animctrl.h index 34062cb2..e044933c 100644 --- a/include/core2/animctrl.h +++ b/include/core2/animctrl.h @@ -3,7 +3,6 @@ #include #include "generic.h" -#include "ml/mtx.h" #ifndef NONMATCHING #define animctrl_start(this, file, line) _animctrl_start(this, file, line) diff --git a/include/core2/camera.h b/include/core2/camera.h new file mode 100644 index 00000000..9ac5d64f --- /dev/null +++ b/include/core2/camera.h @@ -0,0 +1,73 @@ +#ifndef _CAMERA_H_ +#define _CAMERA_H_ +#include +#include + +typedef struct { + s32 type: 24; + s32 valid: 8; + s32 data_ptr; +} CameraNode; + +typedef struct { + f32 position[3]; + f32 horizontalSpeed; + f32 verticalSpeed; + f32 rotation; + f32 accelaration; + f32 pitchYawRoll[3]; // 0 = pitch, 1 = yaw, 2 = roll + s32 unknownFlag; // unknown, some sort of flag value, is &'ed with 1, 2 and 4 +} CameraNodeType1; + +CameraNodeType1 *cameraNodeType1_init(); +void cameraNodeType1_free(CameraNodeType1 *this); +void cameraNodeType1_fromFile(File *file_ptr, CameraNodeType1 *this); +void cameraNodeType1_getPosition(CameraNodeType1 *this, f32 position[3]); +void cameraNodeType1_getHorizontalAndVerticalSpeed(CameraNodeType1 *this, f32 *horizontal_speed, f32 *vertical_speed); +void cameraNodeType1_getRotationAndAccelaration(CameraNodeType1 *this, f32 *rotation, f32 *accelaration); + +typedef struct { + f32 position[3]; + f32 pitchYawRoll[3]; // 0 = pitch, 1 = yaw, 2 = roll +} CameraNodeType2; + +CameraNodeType2 *cameraNodeType2_init(); +void cameraNodeType2_free(CameraNodeType2 *this); +void cameraNodeType2_fromFile(File *file_ptr, CameraNodeType2 *this); +void cameraNodeType2_getPosition(CameraNodeType2 *this, f32 position[3]); +/* + * Sets 0 to pitch, 1 to yaw and 2 to roll + */ +void cameraNodeType2_getPitchYawRoll(CameraNodeType2 *this, f32 pitch_yaw_roll[3]); + +typedef struct { + f32 position[3]; + f32 horizontalSpeed; + f32 verticalSpeed; + f32 rotation; + f32 accelaration; + f32 closeDistance; + f32 farDistance; + f32 pitchYawRoll[3]; // 0 = pitch, 1 = yaw, 2 = roll + s32 unknownFlag; +} CameraNodeType3; +CameraNodeType3 *cameraNodeType3_init(); +void cameraNodeType3_free(CameraNodeType3 *this); +void cameraNodeType3_fromFile(File *file_ptr, CameraNodeType3 *this); +void cameraNodeType3_getPosition(CameraNodeType3 *this, f32 position[3]); +void cameraNodeType3_getHorizontalAndVerticalSpeed(CameraNodeType3 *this, f32 *horizontal_speed, f32 *vertical_speed); +void cameraNodeType3_getRotationAndAccelaration(CameraNodeType3 *this, f32 *rotation, f32 *accelaration); +/* + * Sets 0 to pitch, 1 to yaw and 2 to roll + */ +void cameraNodeType3_getPositionWithPitchYawRoll(CameraNodeType3 *this, f32 pitch_yaw_roll[3]); +f32 cameraNodeType3_getCloseDistance(CameraNodeType3 *this); +f32 cameraNodeType3_getFarDistance(CameraNodeType3 *this); + +typedef struct { + s32 unknownFlag; +} CameraNodeType4; +CameraNodeType4 *cameraNodeType4_init(); +void cameraNodeType4_free(CameraNodeType4 *this); +void cameraNodeType4_fromFile(File *file_ptr, CameraNodeType4 *this); +#endif diff --git a/include/core2/core2.h b/include/core2/core2.h index 7fe1faca..d97b2744 100644 --- a/include/core2/core2.h +++ b/include/core2/core2.h @@ -12,4 +12,7 @@ void func_8035179C_copyPosition(Struct68s* arg0, f32 arg1[3]); void func_80351814(Struct68s *arg0, f32 arg1[3]); f32 func_80351830(Struct68s *arg0); + +extern void sfxsource_setSampleRate(u8, s32); + #endif diff --git a/include/enums.h b/include/enums.h index b3104a48..65603e7d 100644 --- a/include/enums.h +++ b/include/enums.h @@ -328,7 +328,7 @@ enum volatile_flags_e { VOLATILE_FLAG_74_SANDCASTLE_INFINITE_EGGS, VOLATILE_FLAG_75_SANDCASTLE_INFINITE_RED_FEATHERS, VOLATILE_FLAG_76_SANDCASTLE_INFINITE_GOLD_FEATHERS, - VOLATILE_FLAG_77_SANDCASTLE_SET_HEALTH_TO_MAX, + VOLATILE_FLAG_77_SANDCASTLE_SET_HEALTH_TO_MAX, // unused VOLATILE_FLAG_78_SANDCASTLE_NO_BONUS, VOLATILE_FLAG_79, // unused VOLATILE_FLAG_7A, // unused @@ -1633,7 +1633,7 @@ enum honeycomb_e HONEYCOMB_14_SM_WATERFALL, HONEYCOMB_15_SM_UNDERWATER, HONEYCOMB_16_SM_TREE, - HONEYCOMB_17_SM_COLIWOBBLE, + HONEYCOMB_17_SM_COLLIWOBBLE, HONEYCOMB_18_SM_QUARRIES }; @@ -1964,8 +1964,11 @@ enum actor_e ACTOR_151_LOCKUP_SLOW = 0x151, ACTOR_152_LOCKUP_MEDIUM, ACTOR_153_LOCKUP_FAST, - - ACTOR_158_UNKNOWN = 0x158, + ACTOR_154_UNKNOWN, + ACTOR_155_UNKNOWN, + ACTOR_156_UNKNOWN, + ACTOR_157_UNKNOWN, + ACTOR_158_UNKNOWN, ACTOR_15A_UNKNOWN = 0x15A, @@ -1975,9 +1978,9 @@ enum actor_e ACTOR_160_BOGGY_1, ACTOR_163_BAT = 0x163, - ACTOR_164_COLLYWOBBLE_A, - ACTOR_165_BAWL_A, - ACTOR_166_TOPPER_A, + ACTOR_164_COLLYWOBBLE_THE_CAULIFLOWER_A, + ACTOR_165_BAWL_THE_ONION_A, + ACTOR_166_TOPPER_THE_CARROT_A, ACTOR_167_ATTACK_TUTORIAL, ACTOR_16E_UNKNOWN = 0x16E, @@ -2134,6 +2137,9 @@ enum actor_e ACTOR_32B_UNKNOWN = 0x32B, //something with Tanktup + ACTOR_32F_UNKNOWN = 0x32F, + ACTOR_330_UNKNOWN, + ACTOR_332_TWINKLY_BLUE = 0x332, ACTOR_333_TWINKLY_GREEN, ACTOR_334_TWINKLY_ORANGE, @@ -2167,8 +2173,8 @@ enum actor_e ACTOR_36C_25_MUMBO_TOKEN_SIGN, ACTOR_COLLYWOBBLE_B = 0x36D, - ACTOR_BAWL_B = 0x36E, - ACTOR_TOPPER_B = 0x36F, + ACTOR_BAWL_THE_ONION_B = 0x36E, + ACTOR_TOPPER_THE_CARROT_B = 0x36F, ACTOR_370_GOLD_FEATHER = 0x370, ACTOR_374_VACATION_TEXT_TRIGGER = 0x374, @@ -2213,10 +2219,11 @@ enum actor_e ACTOR_3AF_GRUNTY_SHADOW = 0x3AF, + ACTOR_3BA_UNKNOWN = 0x3BA, + ACTOR_3B9_JUMP_TUTORIAL = 0x3B9, - ACTOR_3BA_UNKNOWN, - ACTOR_3BF_GRUNTLING_BLUE = 0x3bf, + ACTOR_3BF_GRUNTLING_BLUE = 0x3BF, ACTOR_3C0_GRUNTLING_BLACK, ACTOR_3C1_PURPLE_TEEHEE, ACTOR_3C2_GIANT_GRAVESTONE, @@ -2226,7 +2233,8 @@ enum actor_e ACTOR_3C7_FF_PRIZE_GRUNTY_DOLL = 0x3C7, ACTOR_3C8_FF_PRIZE_TOOTY = 0x3C8, - ACTOR_3CA_ROCK_TRAPPING_GRUNTY = 0x3CA + ACTOR_3CA_ROCK_TRAPPING_GRUNTY = 0x3CA, + ACTOR_3CB_UNKNOWN }; enum bundle_e { @@ -2447,15 +2455,15 @@ enum sm_specific_flags { SM_SPECIFIC_FLAG_1_TALKED_TO_BOTTLES = 0x1, SM_SPECIFIC_FLAG_2, SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, - SM_SPECIFIC_FLAG_4, - SM_SPECIFIC_FLAG_5, + SM_SPECIFIC_FLAG_4, // if true the claw swipe can be leared + SM_SPECIFIC_FLAG_5, // learned all attack moves - SM_SPECIFIC_FLAG_7 = 0x7, + 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_C = 0xC, + SM_SPECIFIC_FLAG_C = 0xC, // learned all attack moves SM_SPECIFIC_FLAG_E = 0xE, SM_SPECIFIC_FLAG_F, @@ -2476,7 +2484,6 @@ enum mm_specific_flags { MM_SPECIFIC_FLAG_A_UNKNOWN }; - enum ttc_specific_flags { TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN, TTC_SPECIFIC_FLAG_1_UNKNOWN, // something related to the sand castle @@ -2510,10 +2517,11 @@ enum item_e ITEM_6_HOURGLASS, ITEM_7_SKULL_HOURGLASS, + ITEM_9_PROPELLOR = 0x9, ITEM_B_XMAS_TREE = 0xb, - ITEM_C_NOTE, + ITEM_C_NOTE = 0xC, ITEM_D_EGGS, ITEM_E_JIGGY, ITEM_F_RED_FEATHER, @@ -2948,7 +2956,7 @@ enum asset_e ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, ASSET_226_ANIM_BAWL_UNKNOWN, ASSET_227_ANIM_BAWL_UNKNOWN, - ASSET_228_ANIM_BANJO_SLED = 0x228, + ASSET_228_ANIM_BANJO_SLED, ASSET_229_ANIM_WHIPCRACK_ATTACK, ASSET_22A_ANIM_WHIPCRACK_IDLE, ASSET_22B_ANIM_NABNUT_FAT, @@ -3334,7 +3342,7 @@ enum asset_e // 427 (Wooden Plank) ASSET_428_MODEL_BOSS_BOOM_BOX = 0x428, ASSET_429_MODEL_CC_KEY, - // 42a (Smoke 2D?) + ASSET_42A_UNKNOWN, // 42a (Smoke 2D?) // 42b (Orange Triangle?) ASSET_42C_MODEL_BURIED_TREASURE = 0x42C, ASSET_42D_MODEL_QUARRIE = 0x42D, @@ -3411,14 +3419,14 @@ enum asset_e // 472 Blank Picture // 473 Mumbo The BBQ King! He Bares Coconuts! // 474 Roysten The Grill Master! - // 475 (Heart 2D?) - ASSET_476_SPRITE_BLUE_GLOW = 0x476, + ASSET_475_UNKNOWN = 0x475,// 475 (Heart 2D?) + ASSET_476_SPRITE_BLUE_GLOW, ASSET_477_SPRITE_YELLOW_GLOW, // 478 (Yellow Glow?) // 479 Bikini Girl // 47a (Brown Ball?) ASSET_47B_MODEL_ROCK = 0x47b, - // 47c (Snoring Z 2D?) + ASSET_47C_UNKNOWN,// 47c (Snoring Z 2D?) // Unused // Unused ASSET_47F_MODEL_XMAS_GIFT_BLUE = 0x47F, @@ -3531,14 +3539,14 @@ enum asset_e // 4ea FP Finish Banner // 4eb FP Start Banner // 4ec FP Race Rostrum - ASSET_4ED_MODEL_TOPPER = 0x4ed, + ASSET_4ED_MODEL_TOPPER = 0x4ED, ASSET_4EE_MODEL_COLLYWOBBLE, ASSET_4EF_MODEL_BAWL, - ASSET_4F0_MODEL_UNKNOWN, // 4f0 Colliwobble Large Stem (Upon Death) - ASSET_4F1_MODEL_UNKNOWN, // 4f1 Colliwobble Small Stem (Upon Death) - ASSET_4F2_MODEL_UNKNOWN, // 4f2 Colliwobble Large Leaf (Upon Death) - ASSET_4F3_MODEL_UNKNOWN, // 4f3 Colliwobble Small Leaf (Upon Death) - ASSET_4F4_MODEL_UNKNOWN, // 4f4 Colliwobble Stem (Upon Death) + ASSET_4F0_MODEL_TOPPER_UNKNOWN, + ASSET_4F1_MODEL_BAWL_OR_COLLIWOBBLE_UNKNOWN, + ASSET_4F2_MODEL_COLLIWOBBLE_LARGE_DEATH, + ASSET_4F3_MODEL_COLLIWOBBLE_SMALL_DEATH, + ASSET_4F4_MODEL_COLLIWOBBLE_STEM_DEATH, // 4f5 CCW Spring Switch // 4f6 CCW Summer Switch // 4f7 CCW Autumn Switch @@ -3811,7 +3819,7 @@ enum asset_e // Unused // 606 Red Mushroom // 607 Green Mushroom - // 608 White Circle + ASSET_608_UNKNOWN = 0x608, // 608 White Circle // 609 Mushroom (2D) // Unused // Unused @@ -4014,6 +4022,7 @@ enum asset_e ASSET_6DA_SPRITE_HOURGLASS, ASSET_6DB_SPRITE_SKULL_HOURGLASS, ASSET_6DC_SPRITE_XMAS_TREE_TIMER, + ASSET_6DD_UNKNOWN, SPRITE_DIALOG_FONT_ALPHAMASK = 0x6eb, SPRITE_BOLD_FONT_LETTERS_ALPHAMASK, @@ -4037,8 +4046,8 @@ enum asset_e ASSET_711_SPRITE_SPARKLE_DARK_BLUE, ASSET_712_SPRITE_SPARKLE_GREEN, ASSET_713_SPRITE_SPARKLE_YELLOW, - - ASSET_715_SPRITE_SPARKLE_RED = 0x715, + ASSET_714_SPRITE_UNKNOWN, + ASSET_715_SPRITE_SPARKLE_RED, ASSET_716_SPRITE_SPARKLE_WHITE, ASSET_717_SPRITE_SPARKLE_YELLOW_2, ASSET_718_SPRITE_SPARKLE_WHITE_2, @@ -4190,20 +4199,20 @@ enum asset_e ASSET_8A0_SPRITE_WATER_DROP = 0x8A0, - ASSET_A0B_TEXT_BLUBBER_FIRST_MEET = 0xA0B, - ASSET_A0C_TEXT_BLUBBER_HALF_GOLD, - ASSET_A0D_TEXT_BLUBBER_COMPLETE, - ASSET_A0E_TEXT_NIPPER_SPAWNED, + ASSET_A0B_DIALOG_BLUBBER_FIRST_MEET = 0xA0B, + ASSET_A0C_DIALOG_BLUBBER_HALF_GOLD, + ASSET_A0D_DIALOG_BLUBBER_COMPLETE, + ASSET_A0E_DIALOG_NIPPER_SPAWNED, - ASSET_A10_TEXT_TTC_NIPPER_HURT = 0xa10, + ASSET_A10_DIALOG_TTC_NIPPER_HURT = 0xa10, - ASSET_A14_TEXT_CLAM_TAUNT = 0xA14, - ASSET_A15_TEXT_TTC_LOCKUP_SPAWNED, + ASSET_A14_DIALOG_CLAM_TAUNT = 0xA14, + ASSET_A15_DIALOG_TTC_LOCKUP_SPAWNED, - ASSET_A17_TEXT_BURIED_TREASURE_SPAWNED = 0xA17, - ASSET_A18_TEXT_TREASUREHUNT_FOLLOW_CLUES, - ASSET_A19_TEXT_TREASUREHUNT_SECOND_STEP, - ASSET_A1A_TEXT_LEAKY_FIRST_MEET, + ASSET_A17_DIALOG_BURIED_TREASURE_SPAWNED = 0xA17, + ASSET_A18_DIALOG_TREASUREHUNT_FOLLOW_CLUES, + ASSET_A19_DIALOG_TREASUREHUNT_SECOND_STEP, + ASSET_A1A_DIALOG_LEAKY_FIRST_MEET, ASSET_A1F_DIALOG_SHOCKJUMP_LEARN = VER_SELECT(0xa1f, 0x91f, 0, 0), ASSET_A20_DIALOG_FLY_LEARN, @@ -4213,63 +4222,63 @@ enum asset_e ASSET_A24_DIALOG_JUMP_PAD_DISCOVERED, ASSET_A25_DIALOG_FLY_DISC_DISCOVERED, ASSET_A26_DIALOG_NEED_RED_FEATHERS_TO_FLY, - ASSET_A27_TEXT_BOTTLES_ALL_TTC_MOVES_LEARNED, - ASSET_A28_TEXT_LEAKY_DONE, + ASSET_A27_DIALOG_BOTTLES_ALL_TTC_MOVES_LEARNED, + ASSET_A28_DIALOG_LEAKY_DONE, ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED = 0xA2A, - ASSET_A6F_TEXT_CHARMER_MEET = 0xA6F, - ASSET_A70_TEXT_CHARMER_HELPED, - ASSET_A71_TEXT_TRUNKER_MEET, - ASSET_A72_TEXT_TRUNKER_HELPED, - ASSET_A73_TEXT_GOBI_MEET, - ASSET_A74_TEXT_GOBI_HELPED, - ASSET_A75_TEXT_GOBI2_MEET, - ASSET_A76_TEXT_GOBI2_DONE, - ASSET_A77_TEXT_GOBI3_DONE, - ASSET_A78_TEXT_GRABBA_MEET, - ASSET_A79_TEXT_GRABBA_DEFEAT, - ASSET_A7A_TEXT_GRABBA_TOO_FAST, - ASSET_A7B_TEXT_JINXY_MEET, - ASSET_A7C_TEXT_JINXY_ONE_EGG, - ASSET_A7D_TEXT_JINXY_HELPED, - ASSET_A7E_TEXT_SAND_EELS_MEET, - ASSET_A7F_TEXT_ANICIENT_ONES_MEET, - ASSET_A80_TEXT_ANICIENT_ONES_DONE, - ASSET_A81_TEXT_SANDYBUTT_ENTER, - ASSET_A82_TEXT_SANDYBUTT_START_MAZE, - ASSET_A83_TEXT_SANDYBUTT_DONE, + ASSET_A6F_DIALOG_CHARMER_MEET = 0xA6F, + ASSET_A70_DIALOG_CHARMER_HELPED, + ASSET_A71_DIALOG_TRUNKER_MEET, + ASSET_A72_DIALOG_TRUNKER_HELPED, + ASSET_A73_DIALOG_GOBI_MEET, + ASSET_A74_DIALOG_GOBI_HELPED, + ASSET_A75_DIALOG_GOBI2_MEET, + ASSET_A76_DIALOG_GOBI2_DONE, + ASSET_A77_DIALOG_GOBI3_DONE, + ASSET_A78_DIALOG_GRABBA_MEET, + ASSET_A79_DIALOG_GRABBA_DEFEAT, + ASSET_A7A_DIALOG_GRABBA_TOO_FAST, + ASSET_A7B_DIALOG_JINXY_MEET, + ASSET_A7C_DIALOG_JINXY_ONE_EGG, + ASSET_A7D_DIALOG_JINXY_HELPED, + ASSET_A7E_DIALOG_SAND_EELS_MEET, + ASSET_A7F_DIALOG_ANICIENT_ONES_MEET, + ASSET_A80_DIALOG_ANICIENT_ONES_DONE, + ASSET_A81_DIALOG_SANDYBUTT_ENTER, + ASSET_A82_DIALOG_SANDYBUTT_START_MAZE, + ASSET_A83_DIALOG_SANDYBUTT_DONE, ASSET_A84_DIALOG_TURBOTRAINERS_LEARN, ASSET_A85_DIALOG_TURBOTRAINERS_REFRESHER, - ASSET_AD3_TEXT_UNKNOWN = 0xad3, - ASSET_AD4_TEXT_UNKNOWN, - ASSET_AD5_TEXT_UNKNOWN, - ASSET_AD6_TEXT_UNKNOWN, + ASSET_AD3_DIALOG_UNKNOWN = 0xad3, + ASSET_AD4_DIALOG_UNKNOWN, + ASSET_AD5_DIALOG_UNKNOWN, + ASSET_AD6_DIALOG_UNKNOWN, - ASSET_ADA_TEXT_UNKNOWN = 0xada, - ASSET_ADB_TEXT_UNKNOWN, + ASSET_ADA_DIALOG_UNKNOWN = 0xada, + ASSET_ADB_DIALOG_UNKNOWN, ASSET_ADC_DIALOG_UNKNOWN, - ASSET_ADD_TEXT_UNKNOWN, - ASSET_ADE_TEXT_LOGGO_AS_BEAR, - ASSET_ADF_TEXT_ENTER_LOGGO, - ASSET_AE0_TEXT_EXIT_LOGGO, + ASSET_ADD_DIALOG_UNKNOWN, + ASSET_ADE_DIALOG_LOGGO_AS_BEAR, + ASSET_ADF_DIALOG_ENTER_LOGGO, + ASSET_AE0_DIALOG_EXIT_LOGGO, - ASSET_B37_TEXT_CONGA_SAFE_UP_HERE = 0xb37, - ASSET_B38_TEXT_CONGA_DEFEAT, - ASSET_B39_TEXT_CONGA_HIT_BY_EGG, - ASSET_B3A_TEXT_CONGA_HITS_PLAYER, - ASSET_B3B_TEXT_CONGA_ORANGE_PAD_JIGGY, - ASSET_B3C_TEXT_CONGA_MEET, + ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE = 0xb37, + ASSET_B38_DIALOG_CONGA_DEFEAT, + ASSET_B39_DIALOG_CONGA_HIT_BY_EGG, + ASSET_B3A_DIALOG_CONGA_HITS_PLAYER, + ASSET_B3B_DIALOG_CONGA_ORANGE_PAD_JIGGY, + ASSET_B3C_DIALOG_CONGA_MEET, - ASSET_B3E_TEXT_CONGA_MEET_AS_TERMITE = VER_SELECT(0xb3e, 0x95c, 0, 0), + ASSET_B3E_DIALOG_CONGA_MEET_AS_TERMITE = VER_SELECT(0xb3e, 0x95c, 0, 0), ASSET_B3F_DIALOG_CHIMPY_MEET, ASSET_B40_DIALOG_CHIMPY_COMPLETE, ASSET_B41_DIALOG_TERMITE_COOL_SHORTS, ASSET_B42_DIALOG_TERMITE_COOL_BACKPACK, ASSET_B43_DIALOG_TERMITE_MEET_AS_BEAR, - ASSET_B44_TEXT_JUJU_MEET, - ASSET_B45_TEXT_JIGGY_COLLECT_10, + ASSET_B44_DIALOG_JUJU_MEET, + ASSET_B45_DIALOG_JIGGY_COLLECT_10, ASSET_B47_DIALOG_EGGS_LEARN = 0xb47, ASSET_B48_DIALOG_BEAKBUSTER_LEARN, @@ -4277,34 +4286,34 @@ enum asset_e ASSET_B4A_DIALOG_TALON_TROT_REFRESHER, ASSET_B4B_DIALOG_EGGS_REFRESHER, ASSET_B4C_DIALOG_BEAKBUSTER_REFRESHER, - ASSET_B4D_TEXT_UNKNOWN, + ASSET_B4D_DIALOG_UNKNOWN, - ASSET_B4E_TEXT_BOTTLES_ALL_MM_MOVES_LEARNED = 0xB4E, + ASSET_B4E_DIALOG_BOTTLES_ALL_MM_MOVES_LEARNED = 0xB4E, - ASSET_B51_TEXT_BOTTLES_HOW_TO_EXIT_LEVEL = 0xb51, + ASSET_B51_DIALOG_BOTTLES_HOW_TO_EXIT_LEVEL = 0xb51, - ASSET_B9F_TEXT_UNKNOWN = 0xb9f, + ASSET_B9F_DIALOG_UNKNOWN = 0xb9f, - ASSET_BFF_TEXT_UNKNOWN = 0xbff, + ASSET_BFF_DIALOG_UNKNOWN = 0xbff, - ASSET_C01_TEXT_UNKNOWN = 0xc01, - ASSET_C02_TEXT_UNKNOWN, + ASSET_C01_DIALOG_UNKNOWN = 0xc01, + ASSET_C02_DIALOG_UNKNOWN, - ASSET_C05_TEXT_UNKNOWN = 0xc05, + ASSET_C05_DIALOG_UNKNOWN = 0xc05, - ASSET_C08_TEXT_UNKNOWN = 0xc08, - ASSET_C09_TEXT_UNKNOWN, - ASSET_C0A_TEXT_UNKNOWN, + ASSET_C08_DIALOG_UNKNOWN = 0xc08, + ASSET_C09_DIALOG_UNKNOWN, + ASSET_C0A_DIALOG_UNKNOWN, - ASSET_C15_TEXT_TWINKLIE_MINIGAME_LOST = 0xc15, + ASSET_C15_DIALOG_TWINKLIE_MINIGAME_LOST = 0xc15, - ASSET_C17_TEXT_UNKNOWN = 0xC17, - ASSET_C18_TEXT_UNKNOWN, - ASSET_C19_TEXT_UNKNOWN, - ASSET_C1A_TEXT_UNKNOWN, + ASSET_C17_DIALOG_UNKNOWN = 0xC17, + ASSET_C18_DIALOG_UNKNOWN, + ASSET_C19_DIALOG_UNKNOWN, + ASSET_C1A_DIALOG_UNKNOWN, - ASSET_C1E_TEXT_UNKNOWN = 0xc1e, - ASSET_C1F_TEXT_UNKNOWN, + ASSET_C1E_DIALOG_UNKNOWN = 0xc1e, + ASSET_C1F_DIALOG_UNKNOWN, ASSET_C20_DIALOG_PRESENT_COLLECTIBLE_MEET_BLUE = 0xC20, ASSET_C21_DIALOG_PRESENT_COLLECTIBLE_MEET_GREEN, @@ -4312,68 +4321,68 @@ enum asset_e ASSET_C23_DIALOG_BEAKBOMB_LEARN, ASSET_C24_DIALOG_BEAKBOMB_REFRESHER, - ASSET_C26_TEXT_UNKNOWN = 0xc26, - ASSET_C27_TEXT_UNKNOWN, + ASSET_C26_DIALOG_UNKNOWN = 0xc26, + ASSET_C27_DIALOG_UNKNOWN, - ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED = 0xC2A, - ASSET_C2B_TEXT_UNKNOWN, + ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED = 0xC2A, + ASSET_C2B_DIALOG_UNKNOWN, - ASSET_C63_TEXT_MR_VILE_INTRO = 0xC63, - ASSET_C64_TEXT_MR_VILE_ROUND_1_START, - ASSET_C65_TEXT_MR_VILE_PLAYER_DECLINES, - ASSET_C66_TEXT_MR_VILE_WINS_ROUND_1, - ASSET_C67_TEXT_MR_VILE_ROUND_2_START, - ASSET_C68_TEXT_MR_VILE_WINS_ROUND_2, - ASSET_C69_TEXT_MR_VILE_ROUND_3_START, - ASSET_C6A_TEXT_MR_VILE_WINS_ROUND_3, - ASSET_C6B_TEXT_MR_VILE_PLAYER_WINS, - ASSET_C6C_TEXT_MR_VILE_TRY_AGAIN, - ASSET_C6D_TEXT_MR_VILE_LOSE_ROUND_1_REMATCH, - ASSET_C6E_TEXT_MR_VILE_LOSE_ROUND_2_REMATCH, - ASSET_C6F_TEXT_MR_VILE_LOSE_ROUND_3_REMATCH, - ASSET_C70_TEXT_MR_VILE_WIN_ROUND_2_REMATCH, - ASSET_C71_TEXT_MR_VILE_WIN_ROUND_3_REMATCH, - ASSET_C72_TEXT_UNKNOWN, + ASSET_C63_DIALOG_MR_VILE_INTRO = 0xC63, + ASSET_C64_DIALOG_MR_VILE_ROUND_1_START, + ASSET_C65_DIALOG_MR_VILE_PLAYER_DECLINES, + ASSET_C66_DIALOG_MR_VILE_WINS_ROUND_1, + ASSET_C67_DIALOG_MR_VILE_ROUND_2_START, + ASSET_C68_DIALOG_MR_VILE_WINS_ROUND_2, + ASSET_C69_DIALOG_MR_VILE_ROUND_3_START, + ASSET_C6A_DIALOG_MR_VILE_WINS_ROUND_3, + ASSET_C6B_DIALOG_MR_VILE_PLAYER_WINS, + ASSET_C6C_DIALOG_MR_VILE_TRY_AGAIN, + ASSET_C6D_DIALOG_MR_VILE_LOSE_ROUND_1_REMATCH, + ASSET_C6E_DIALOG_MR_VILE_LOSE_ROUND_2_REMATCH, + ASSET_C6F_DIALOG_MR_VILE_LOSE_ROUND_3_REMATCH, + ASSET_C70_DIALOG_MR_VILE_WIN_ROUND_2_REMATCH, + ASSET_C71_DIALOG_MR_VILE_WIN_ROUND_3_REMATCH, + ASSET_C72_DIALOG_UNKNOWN, - ASSET_C74_TEXT_UNKNOWN = 0xc74, + ASSET_C74_DIALOG_UNKNOWN = 0xc74, - ASSET_C76_TEXT_UNKNOWN = 0xc76, + ASSET_C76_DIALOG_UNKNOWN = 0xc76, text_flibbits_meet = 0xc81, text_flibbits_defeat = 0xc82, text_flibbits_return = 0xc83, - ASSET_C86_TEXT_UNKNOWN = 0xc86, + ASSET_C86_DIALOG_UNKNOWN = 0xc86, ASSET_C88_DIALOG_LONGLEG_LEARN = 0xC88, ASSET_C89_DIALOG_LONGLEG_REFRESHER, - ASSET_C8A_TEXT_BOTTLES_ALL_BGS_MOVES_LEARNED, + ASSET_C8A_DIALOG_BOTTLES_ALL_BGS_MOVES_LEARNED, - ASSET_C8D_TEXT_MR_VILE_EXTRA_CHALLENGE_INTRO = 0xC8D, - ASSET_C8E_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_1, - ASSET_C8F_TEXT_MR_VILE_PLAYER_DECLINES_EXTRA_CHALLENGE, - ASSET_C90_TEXT_MR_VILE_EXTRA_CHALLENGE_REMATCH_1, - ASSET_C91_TEXT_MR_VILE_EXTRA_CHALLENGE_REMATCH_2, - ASSET_C92_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_2, - ASSET_C93_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_3, - ASSET_C94_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_4, - ASSET_C95_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_1, - ASSET_C96_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_2, - ASSET_C97_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_3, - ASSET_C98_TEXT_MR_VILE_GIVES_PRIZE, + ASSET_C8D_DIALOG_MR_VILE_EXTRA_CHALLENGE_INTRO = 0xC8D, + ASSET_C8E_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_1, + ASSET_C8F_DIALOG_MR_VILE_PLAYER_DECLINES_EXTRA_CHALLENGE, + ASSET_C90_DIALOG_MR_VILE_EXTRA_CHALLENGE_REMATCH_1, + ASSET_C91_DIALOG_MR_VILE_EXTRA_CHALLENGE_REMATCH_2, + ASSET_C92_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_2, + ASSET_C93_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_3, + ASSET_C94_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_4, + ASSET_C95_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_1, + ASSET_C96_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_2, + ASSET_C97_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_3, + ASSET_C98_DIALOG_MR_VILE_GIVES_PRIZE, - ASSET_CC7_TEXT_UNKNOWN = 0xcc7, + ASSET_CC7_DIALOG_UNKNOWN = 0xcc7, - ASSET_D2B_TEXT_UNKNOWN = 0xd2b, + ASSET_D2B_DIALOG_UNKNOWN = 0xd2b, ASSET_D32_DIALOG_MUTANT_CRAB_MEET = 0xD32, ASSET_D33_DIALOG_MUTANT_CRAB_DEFEAT, - ASSET_D34_TEXT_GLOOP_MEET, + ASSET_D34_DIALOG_GLOOP_MEET, ASSET_D35_DIALOG_WONDERWING_LEARN, ASSET_D36_DIALOG_WONDERWING_REFRESHER, - ASSET_D37_TEXT_BOTTLES_ALL_CC_MOVES_LEARNED, - ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, - ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, + ASSET_D37_DIALOG_BOTTLES_ALL_CC_MOVES_LEARNED, + ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, + ASSET_D39_DIALOG_BOTTLES_REFILL_HEALTH, ASSET_D8F_DIALOG_MUMBO_MEET = 0xD8F, ASSET_D90_DIALOG_MUMBO_MAGIC_PAID_FOR, @@ -4390,7 +4399,7 @@ enum asset_e ASSET_D9B_DIALOG_JINJO_MEET_ORANGE, ASSET_DA5_DIALOG_WADINGBOOTS_MEET = 0xDA5, - ASSET_DA6_TEXT_BEEHIVE_WITH_BEES, + ASSET_DA6_DIALOG_BEEHIVE_WITH_BEES, ASSET_DA7_DIALOG_MUMBO_CCW_SUMMER, ASSET_DA8_DIALOG_MUMBO_CCW_AUTUMN, @@ -4407,59 +4416,59 @@ enum asset_e ASSET_DB4_DIALOG_SNS_EGG_2_TEXT, ASSET_DB5_DIALOG_ICE_KEY_TEXT, - ASSET_DF3_TEXT_BOTTLES_INTRODUCTION = 0xDF3, - ASSET_DF4_TEXT_BOTTLES_CAMERA_CONTROL_LEARN, - ASSET_DF5_TEXT_BOTTLES_CAMERA_CONTROL_REFRESHER, - ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN, - ASSET_DF7_TEXT_BOTTLES_FEATHERY_FLAP_LEARN, - ASSET_DF8_TEXT_BOTTLES_FLAP_FLIP_LEARN, - ASSET_DF9_TEXT_BOTTLES_UNKNOWN, - ASSET_DFA_TEXT_BOTTLES_JUMP_REFRESHER, - ASSET_DFB_TEXT_BOTTLES_DIVE_LEARN, - ASSET_DFC_TEXT_UNKNOWN, - ASSET_DFD_TEXT_BOTTLES_SWIM_LEARN, - ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER, - ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN, - ASSET_E00_TEXT_BOTTLES_ATTACK_REFRESHER = 0xE00, - ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, - ASSET_E02_TEXT_UNKNOWN, - ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER, - ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN, - ASSET_E05_TEXT_UNKNOWN, - ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER, - ASSET_E07_TEXT_BOTTLES_UNKNOWN, - ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL, - ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL, - ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1, - ASSET_E0B_TEXT_BOTTLES_REFUSE_HELP_2, - ASSET_E0C_TEXT_BOTTLES_REFUSE_HELP_3, - ASSET_E0D_TEXT_BOTTLES_REFUSE_HELP_4, - ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5, - ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN, // Skip tutorial, bother bottles, gives help, retalk to bottles - ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, - ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, - ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, + ASSET_DF3_DIALOG_BOTTLES_INTRODUCTION = 0xDF3, + ASSET_DF4_DIALOG_BOTTLES_CAMERA_CONTROL_LEARN, + ASSET_DF5_DIALOG_BOTTLES_CAMERA_CONTROL_REFRESHER, + ASSET_DF6_DIALOG_BOTTLES_HIGH_JUMP_LEARN, + ASSET_DF7_DIALOG_BOTTLES_FEATHERY_FLAP_LEARN, + ASSET_DF8_DIALOG_BOTTLES_FLAP_FLIP_LEARN, + ASSET_DF9_DIALOG_BOTTLES_UNKNOWN, + ASSET_DFA_DIALOG_BOTTLES_JUMP_REFRESHER, + ASSET_DFB_DIALOG_BOTTLES_DIVE_LEARN, + ASSET_DFC_DIALOG_UNKNOWN, + 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_E03_DIALOG_BOTTLES_CLIMB_REFRESHER, + ASSET_E04_DIALOG_BOTTLES_BEAK_BARGE_LEARN, + ASSET_E05_DIALOG_UNKNOWN, + ASSET_E06_DIALOG_BOTTLES_BEAK_BARGE_REFRESHER, + ASSET_E07_DIALOG_BOTTLES_UNKNOWN, + ASSET_E08_DIALOG_BOTTLES_FIND_ANOTHER_MOLEHILL, + ASSET_E09_DIALOG_BOTTLES_SKIPPED_TUTORIAL, + ASSET_E0A_DIALOG_BOTTLES_REFUSE_HELP_1, + ASSET_E0B_DIALOG_BOTTLES_REFUSE_HELP_2, + ASSET_E0C_DIALOG_BOTTLES_REFUSE_HELP_3, + ASSET_E0D_DIALOG_BOTTLES_REFUSE_HELP_4, + ASSET_E0E_DIALOG_BOTTLES_REFUSE_HELP_5, + ASSET_E0F_DIALOG_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN, // Skip tutorial, bother bottles, gives help, retalk to bottles + ASSET_E10_DIALOG_BOTTLES_BRIDGE_BROKEN, + ASSET_E11_DIALOG_BOTTLES_BRIDGE_STILL_BROKEN, + ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES, - ASSET_E14_TEXT_UNKNOWN = 0xE14, - ASSET_E15_TEXT_UNKNOWN, - ASSET_E16_TEXT_UNKNOWN, - ASSET_E17_TEXT_UNKNOWN, - ASSET_E18_TEXT_UNKNOWN, - ASSET_E19_TEXT_UNKNOWN, - ASSET_E1A_TEXT_BOTTLES_UNKNOWN, - ASSET_E1B_TEXT_BOTTLES_UNKNOWN, - ASSET_E1C_TEXT_BOTTLES_UNKNOWN, - ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT, + ASSET_E14_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL = 0xE14, + ASSET_E15_DIALOG_ATTACK_TUTORIAL_FORWARD_ROLL, + ASSET_E16_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL, + ASSET_E17_DIALOG_ATTACK_TUTORIAL_RATATAT_RAP, + ASSET_E18_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL, + ASSET_E19_DIALOG_ATTACK_TUTORIAL_LEARNED_ALL_MOVES, + ASSET_E1A_DIALOG_BOTTLES_UNKNOWN, + ASSET_E1B_DIALOG_BOTTLES_UNKNOWN, + ASSET_E1C_DIALOG_BOTTLES_UNKNOWN, + ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT, - ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER = VER_SELECT(0xE1F, 0xa61, 0, 0), + ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER = VER_SELECT(0xE1F, 0xa61, 0, 0), ASSET_E20_DIALOG_BOTTLES_BONUS_NOT_READY, ASSET_E21_DIALOG_BOTTLES_BONUS_DISCOVERED, - ASSET_E24_TEXT_UNKNOWN = 0xE24, + ASSET_E24_DIALOG_UNKNOWN = 0xE24, ASSET_E35_DIALOG_BOTTLES_BONUS_REMINDER = VER_SELECT(0xE35, 0xa77, 0, 0), - ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN = 0xE37, // Talk to bottles after beating furnace fun + 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), @@ -4474,60 +4483,60 @@ enum asset_e ASSET_F66_DIALOG_UNKNOWN, ASSET_F67_DIALOG_UNKNOWN, - ASSET_F79_TEXT_UNKNOWN = 0xf79, - ASSET_F7A_TEXT_UNKNOWN, + ASSET_F79_DIALOG_UNKNOWN = 0xf79, + ASSET_F7A_DIALOG_UNKNOWN, - ASSET_FAD_TEXT_UNKNOWN = 0xfad, + ASSET_FAD_DIALOG_UNKNOWN = 0xfad, - ASSET_FBE_DIALOG_CHEATING_ERASE_SAVE_WARNING = 0xfbe, + ASSET_FBE_DIALOG_CHEATING_ERASE_SAVE_WARNING = 0xFBE, ASSET_FBF_DIALOG_ERASED_SAVE, ASSET_10A1_DIALOG_BRENTILDA_MEET = 0x10A1, - ASSET_10A2_TEXT_UNKNOWN, + ASSET_10A2_DIALOG_UNKNOWN, - ASSET_10E7_TEXT_UNKNOWN = 0x10E7, + ASSET_10E7_DIALOG_UNKNOWN = 0x10E7, - ASSET_10ED_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1 = 0x10ED, - ASSET_10EE_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_2, - ASSET_10EF_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_3, - ASSET_10F0_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_4, - ASSET_10F1_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_5, + ASSET_10ED_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1 = 0x10ED, + ASSET_10EE_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_2, + ASSET_10EF_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_3, + ASSET_10F0_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_4, + ASSET_10F1_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_5, - ASSET_10F2_TEXT_FINALBOSS_PHASE_1_OPTION_1 = 0x10F2, - ASSET_10F3_TEXT_FINALBOSS_PHASE_1_OPTION_2, - ASSET_10F4_TEXT_FINALBOSS_PHASE_1_OPTION_3, - ASSET_10F5_TEXT_FINALBOSS_PHASE_1_OPTION_4, - ASSET_10F6_TEXT_FINALBOSS_PHASE_1_OPTION_5, + ASSET_10F2_DIALOG_FINALBOSS_PHASE_1_OPTION_1 = 0x10F2, + ASSET_10F3_DIALOG_FINALBOSS_PHASE_1_OPTION_2, + ASSET_10F4_DIALOG_FINALBOSS_PHASE_1_OPTION_3, + ASSET_10F5_DIALOG_FINALBOSS_PHASE_1_OPTION_4, + ASSET_10F6_DIALOG_FINALBOSS_PHASE_1_OPTION_5, - ASSET_110B_TEXT_FINALBOSS_PHASE_2_OPTION_1 = 0x110B, - ASSET_110C_TEXT_FINALBOSS_PHASE_2_OPTION_2, - ASSET_110D_TEXT_FINALBOSS_PHASE_2_OPTION_3, - ASSET_110E_TEXT_FINALBOSS_PHASE_2_OPTION_4, - ASSET_110F_TEXT_FINALBOSS_PHASE_2_OPTION_5, + ASSET_110B_DIALOG_FINALBOSS_PHASE_2_OPTION_1 = 0x110B, + ASSET_110C_DIALOG_FINALBOSS_PHASE_2_OPTION_2, + ASSET_110D_DIALOG_FINALBOSS_PHASE_2_OPTION_3, + ASSET_110E_DIALOG_FINALBOSS_PHASE_2_OPTION_4, + ASSET_110F_DIALOG_FINALBOSS_PHASE_2_OPTION_5, - ASSET_111D_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1 = 0x111D, - ASSET_111E_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_2, - ASSET_111F_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_3, - ASSET_1120_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_4, - ASSET_1121_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_5, + ASSET_111D_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1 = 0x111D, + ASSET_111E_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_2, + ASSET_111F_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_3, + ASSET_1120_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_4, + ASSET_1121_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_5, - ASSET_1122_TEXT_FINALBOSS_PHASE_3_OPTION_1 = 0x1122, - ASSET_1123_TEXT_FINALBOSS_PHASE_3_OPTION_2, - ASSET_1124_TEXT_FINALBOSS_PHASE_3_OPTION_3, - ASSET_1125_TEXT_FINALBOSS_PHASE_3_OPTION_4, - ASSET_1126_TEXT_FINALBOSS_PHASE_3_OPTION_5, + ASSET_1122_DIALOG_FINALBOSS_PHASE_3_OPTION_1 = 0x1122, + ASSET_1123_DIALOG_FINALBOSS_PHASE_3_OPTION_2, + ASSET_1124_DIALOG_FINALBOSS_PHASE_3_OPTION_3, + ASSET_1125_DIALOG_FINALBOSS_PHASE_3_OPTION_4, + ASSET_1126_DIALOG_FINALBOSS_PHASE_3_OPTION_5, - ASSET_113B_TEXT_FINALBOSS_PHASE_4_OPTION_1 = 0x113B, - ASSET_113C_TEXT_FINALBOSS_PHASE_4_OPTION_2, - ASSET_113D_TEXT_FINALBOSS_PHASE_4_OPTION_3, - ASSET_113E_TEXT_FINALBOSS_PHASE_4_OPTION_4, - ASSET_113F_TEXT_FINALBOSS_PHASE_4_OPTION_5, + ASSET_113B_DIALOG_FINALBOSS_PHASE_4_OPTION_1 = 0x113B, + ASSET_113C_DIALOG_FINALBOSS_PHASE_4_OPTION_2, + ASSET_113D_DIALOG_FINALBOSS_PHASE_4_OPTION_3, + ASSET_113E_DIALOG_FINALBOSS_PHASE_4_OPTION_4, + ASSET_113F_DIALOG_FINALBOSS_PHASE_4_OPTION_5, - ASSET_1154_TEXT_FINALBOSS_PHASE_5_OPTION_1 = 0x1154, - ASSET_1155_TEXT_FINALBOSS_PHASE_5_OPTION_2, - ASSET_1156_TEXT_FINALBOSS_PHASE_5_OPTION_3, - ASSET_1157_TEXT_FINALBOSS_PHASE_5_OPTION_4, - ASSET_1158_TEXT_FINALBOSS_PHASE_5_OPTION_5, + ASSET_1154_DIALOG_FINALBOSS_PHASE_5_OPTION_1 = 0x1154, + ASSET_1155_DIALOG_FINALBOSS_PHASE_5_OPTION_2, + ASSET_1156_DIALOG_FINALBOSS_PHASE_5_OPTION_3, + ASSET_1157_DIALOG_FINALBOSS_PHASE_5_OPTION_4, + ASSET_1158_DIALOG_FINALBOSS_PHASE_5_OPTION_5, ASSET_1213_FF_QUIZ_QUESTION = 0x1213, ASSET_1214_FF_QUIZ_QUESTION, @@ -5088,11 +5097,10 @@ enum marker_e{ MARKER_124_BOGGY_1 = 0x124, - MARKER_126_UNKNOWN = 0x126, MARKER_127_BAT = 0x127, - MARKER_128_COLLYWOBBLE_A, - MARKER_129_BAWL_A, - MARKER_12A_TOPPER_A, + MARKER_128_COLLYWOBBLE_THE_CAULIFLOWER_A, + MARKER_129_BAWL_THE_ONION_A, + MARKER_12A_TOPPER_THE_CARROT_A, MARKER_12B_ATTACK_TUTORIAL, MARKER_134_UNKNOWN = 0x134, @@ -5166,14 +5174,13 @@ enum marker_e{ MARKER_1E5_GOLD_FEATHER_COLLECTIBLE = 0x1E5, - MARKER_1E6_TOPPER_B, - MARKER_1E7_BAWL_B, - MARKER_1E8_COLLYWOBBLE_B, + MARKER_1E6_TOPPER_THE_CARROT_B, + MARKER_1E7_BAWL_THE_ONION_B, + MARKER_1E8_COLLYWOBBLE_THE_CAULIFLOWER_B, MARKER_1E9_MUMBO_COST_SIGN, MARKER_1EA_GRUNTLING_RED, MARKER_1ED_JUMP_TUTORIAL = 0x1ED, - MARKER_1F1_GRUNTLING_BLACK = 0x1F1, MARKER_1F4_TOOTS = 0x1F4, @@ -5378,5 +5385,4 @@ enum vegetable_e { VEGETABLE_3_COLLY_WOBBLE }; - #endif diff --git a/include/functions.h b/include/functions.h index 53d20c45..4c9feb4e 100644 --- a/include/functions.h +++ b/include/functions.h @@ -14,8 +14,6 @@ #include "core2/core2.h" #include "math.h" // ToDo: sort out actual dependencies -#include "ml.h" -#include "ml/mtx.h" #include "bs_funcs.h" #include "bsint.h" @@ -45,20 +43,8 @@ void * malloc(s32 size); void free(void*); void *realloc(void* ptr, s32 size); -f32 ml_map_f(f32 val, f32 in_min, f32 in_max, f32 out_min, f32 out_max); -float mlNormalizeAngle(float); -f32 ml_max_f(f32, f32); -f32 ml_min_f(f32, f32); -void ml_vec3f_copy(f32 dst[3], f32 src[3]); - -void ml_vec3f_add(f32 dst[3], f32 src1[3], f32 src2[3]); -void ml_vec3f_scale(f32 vec[3], f32 scale); -void ml_vec3f_scale_copy(f32 dst[3], f32 src[3], f32 scale); - float gu_sqrtf(float val); -BKSpriteFrame *spriteGetFramePtr(BKSprite *, u32); - bool baanim_isAt(f32); void baanim_playForDuration_once(enum asset_e anim_id, f32 duration); void baanim_setEnd(f32); @@ -198,7 +184,7 @@ ParticleEmitter *partEmitMgr_newEmitter(u32); void func_802BB3DC(s32, f32, f32); void __spawnQueue_add_4(GenFunction_4, s32, s32, s32, s32); Actor *spawnQueue_actor_f32(enum actor_e actor_id, s32 x, s32 y, s32 z); -void func_8030DA44(u8); +void sfxsource_freeSfxsourceByIndex(u8); void particleEmitter_emitInVolume(ParticleEmitter *, f32[3], f32[3], s32); @@ -226,22 +212,7 @@ void particleEmitter_setSpawnInterval(ParticleEmitter *, f32); OSContPad *func_8024F3F4(void); OSMesgQueue *pfsManager_getFrameReplyQ(void); -void ml_vec3f_clear(f32 dst[3]); -void ml_vec3f_roll_rotate_copy(f32[3], f32[3], f32); void rumbleManager_80250D94(f32, f32, f32); -void func_80256E24(f32[3], f32, f32, f32, f32, f32); -void func_8025727C(f32 x1, f32 y1, f32 z1, f32 x2, f32 y2, f32 z2, f32 *o1, f32 *o2); -f32 func_80257A44(f32, f32); -f32 ml_interpolate_f(f32, f32, f32); -f32 ml_mapAbsRange_f(f32, f32, f32, f32, f32); -int func_80257F18(f32 src[3], f32 target[3], f32 *yaw); -bool func_8025801C(f32[3], f32*); - -f32 mlAbsF(f32); -f32 ml_clamp_f(f32, f32, f32); -f32 ml_remainder_f(f32, f32); -void func_802589E4(f32 dst[3], f32 yaw, f32 length); -f32 mlDiffDegF(f32, f32); void func_8025A6EC(enum comusic_e, s32); void comusic_playTrack(enum comusic_e); @@ -450,23 +421,20 @@ void func_80352CF4(f32 *, f32 *, f32, f32); AnimCtrl *baanim_getAnimCtrlPtr(void); void player_setYPosition(f32); -NodeProp *nodeprop_findByActorIdAndActorPosition(enum actor_e arg0, Actor *arg1); -NodeProp *func_80304CAC(s32 arg0, f32 position[3]); +NodeProp *nodeprop_findByActorIdAndActorPosition(enum actor_e actor_id, Actor *actor_ptr); +NodeProp *nodeprop_findByActorIdAndPosition_f32(enum actor_e actor_id, f32 position[3]); Actor *actorArray_findClosestActorFromActorId(f32 position[3], enum actor_e actor_id, s32 arg2, f32 *min_distance_ptr); Actor *subaddie_getLinkedActor(Actor *); /* used in RBB */ -void ml_vec3f_pitch_rotate_copy(f32 dst[3], f32 src[3], f32 pitch); -int ml_timer_update(f32 *arg0, f32 arg1); Actor *actor_draw(ActorMarker *, Gfx**, Mtx**, Vtx **); Actor *func_80325340(ActorMarker *, Gfx **, Mtx **, Vtx **); void func_8032AA58(Actor *, f32); void func_80324E38(f32, s32); void timed_playSfx(f32, enum sfx_e, f32, s32); -f32 ml_distance_vec3f(f32 [3], f32 [3]); void timed_setStaticCameraToNode(f32, s32); -void timed_exitStaticCamera(f32); +void timed_exitStaticCamera(f32 time); int actor_animationIsAt(Actor*, f32); void rumbleManager_80250E94(f32, f32, f32, f32, f32, f32); @@ -479,10 +447,8 @@ void func_802FA060(s32, s32, s32, f32); Actor *actorArray_findActorFromActorId(enum actor_e); f32 func_8038A6B8(ActorMarker *); void *defrag_asset(void *); -void ml_interpolate_vec3f(f32 [3], f32 [3], f32 [3], f32); void sfxsource_set_fade_distances(u8, f32, f32); void func_8030DB04(u8, s32, f32 position[3], f32, f32); -void func_80258A4C(f32 [3], f32, f32 [3], f32 *, f32 *, f32 *); void func_802E4078(enum map_e map, s32 exit, s32 transition); @@ -494,7 +460,6 @@ void mapSpecificFlags_set(s32, s32); struct0 *func_8031B9D8(void); -extern int func_80259808(f32); void actor_playAnimationOnce(Actor *); void actor_loopAnimation(Actor *); @@ -504,7 +469,6 @@ void actor_update_func_80326224(Actor *this); void func_802F9FD0(s32, f32, f32, f32); void func_80324D54(f32, enum sfx_e, f32, s32, f32 [3], f32, f32); -void glcrc_calc_checksum(void *start, void *end, u32 *checksum); f32 climbGetBottomY(void); f32 climbGetTopY(void); void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]); diff --git a/include/ml.h b/include/ml.h deleted file mode 100644 index 5e168f1f..00000000 --- a/include/ml.h +++ /dev/null @@ -1,10 +0,0 @@ -#ifndef __MATH_LIBRARY_H__ -#define __MATH_LIBRARY_H__ - -void ml_vec3f_normalize_copy(f32 arg0[3], f32 arg1[3]); -void ml_vec3f_yaw_rotate_copy(f32 arg0[3], f32 arg1[3], f32 arg2); -void ml_vec3f_diff_copy(f32 dst[3], f32 src1[3], f32 src2[3]); -void ml_vec3f_set_length_copy(f32 dst[3], f32 src[3], f32 len); -void ml_vec3f_set_length(f32 arg0[3], f32 arg2); - -#endif diff --git a/include/ml/mtx.h b/include/ml/mtx.h deleted file mode 100644 index 9ac1a288..00000000 --- a/include/ml/mtx.h +++ /dev/null @@ -1,35 +0,0 @@ -#ifndef __ML_MTX__ -#define __ML_MTX__ - -typedef struct { - f32 m[4][4]; -} MtxF; - -void mlMtxGet(MtxF *dst); -MtxF *mlMtx_get_stack_pointer(void); -void mlMtxApply(Mtx *mPtr); -void mlMtxPop(void); -void mlMtx_push_duplicate(void); -void mlMtx_push_identity(void); -void mlMtx_push_translation(f32 x, f32 y, f32 z); -void mlMtx_push_mtx(f32* mtx); -void mlMtx_push_multiplied(f32* l_mtx); -void mlMtx_push_multiplied_2(MtxF * l_mtx, MtxF * r_mtx); -void mlMtxIdent(void); -void mlMtxSet(MtxF* arg0); -void mlMtxRotPitch(f32 arg0); -void mlMtxRotYaw(f32 arg0); -void mlMtxRotRoll(f32 arg0); -void mlMtx_rotate_pitch_deg(f32 arg0); -void mlMtx_rotate_yaw_deg(f32 arg0); -void mlMtxRotatePYR(f32 pitch, f32 yaw, f32 roll); -void mlMtxScale_xyz(f32 x, f32 y, f32 z); -void mlMtxScale(f32 scale); -void mlMtx_apply_f3(f32 dst[3], f32 x, f32 y, f32 z); -void mlMtx_apply_vec3s(s16 dst[3], s16 src[3]); -void mlMtxTranslate(f32 x, f32 y, f32 z); - -MtxF *func_8024DD90(void); -MtxF *func_8024DD9C(void); - -#endif diff --git a/include/prop.h b/include/prop.h index fc5bcef2..b1c9b80e 100644 --- a/include/prop.h +++ b/include/prop.h @@ -155,7 +155,7 @@ typedef struct actor_s{ u32 state:6; /* unk10_31*/ u32 unk10_25:7; u32 unk10_18:6; - u32 unk10_12:4; + u32 unk10_12:4; // number of defeated enemies in SM attack tutorial u32 unk10_8:1; u32 unk10_7:1; u32 unk10_6:2; @@ -186,7 +186,7 @@ typedef struct actor_s{ f32 unk4C; /* 0x50 */ f32 yaw; //0x50 f32 unk54; //0x54 - u32 unk58_31: 15; + u32 animctrl_asset_id: 15; // animation asset id (enum asset_id) u32 stored_animctrl_index: 14; //animctrlAnimIndex; u32 unk58_2: 1; u32 unk58_1: 1; diff --git a/include/structs.h b/include/structs.h index a6bcd9cc..1232d677 100644 --- a/include/structs.h +++ b/include/structs.h @@ -47,6 +47,10 @@ typedef struct freelist_s{ #define FREE_LIST(T) struct freelist_s //^defined to keep element type with sla +typedef struct { + f32 m[4][4]; +} MtxF; + typedef struct bk_sprite_s{ s16 frameCnt; s16 type; diff --git a/include/variables.h b/include/variables.h index 2a3aded3..3a59f3cc 100644 --- a/include/variables.h +++ b/include/variables.h @@ -14,9 +14,6 @@ struct Overlay { extern struct Overlay gOverlayTable[]; -extern s32 framebuffer_width; -extern s32 framebuffer_height; - extern f32 climbPoleBottom[3]; extern f32 climbPoleTop[3]; #endif diff --git a/manual_syms.pal.txt b/manual_syms.pal.txt index 2fa6f976..160078ac 100644 --- a/manual_syms.pal.txt +++ b/manual_syms.pal.txt @@ -21,7 +21,7 @@ D_803FBE00 = 0x803FBE00; D_803FFE00 = 0x803FFE00; D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; -D_803A5D00 = 0x803A5D00; /* framebuffers */ +gFramebuffers = 0x803A5D00; /* framebuffers */ /* Renames for the boot segment */ boot_D_8002D500 = D_8002D500; @@ -259,9 +259,9 @@ func_802F9F80 = 0x802fa160; func_802F9FD0 = 0x802fa1b0; func_802FA060 = 0x802fa240; func_802FADD4 = 0x802fafb4; -cubeList_findNodePropByActorId = 0x80304b6c; -nodeprop_findByActorIdAndActorPosition = 0x80304dd8; -func_80304CAC = 0x80304e4c; +cubeList_findNodePropByActorIdAndPosition_s32 = 0x80304b6c; +nodeprop_findByActorIdAndActorPosition = 0x80304dd8; +nodeprop_findByActorIdAndPosition_f32 = 0x80304e4c; nodeprop_getPosition_s32 = 0x80304eec; nodeprop_getPosition = 0x80304f08; _nodeProp_findPositionFromActorId = 0x80304f70; @@ -278,7 +278,7 @@ func_8030C704 = 0x8030c8a4; scissorBox_setSmall = 0x8030c8b0; func_8030C77C = 0x8030c91c; sfxsource_createSfxsourceAndReturnIndex = 0x8030daac; -func_8030DA44 = 0x8030dbe4; +sfxsource_freeSfxsourceByIndex = 0x8030dbe4; sfxsource_setSfxId = 0x8030dc20; sfxsource_setSampleRate = 0x8030dc5c; sfxsource_playSfxAtVolume = 0x8030dd54; diff --git a/manual_syms.us.v10.txt b/manual_syms.us.v10.txt index d1b2f670..ba725a80 100644 --- a/manual_syms.us.v10.txt +++ b/manual_syms.us.v10.txt @@ -20,7 +20,7 @@ D_803FBE00 = 0x803FBE00; D_803FFE00 = 0x803FFE00; D_803FFE10 = 0x803FFE10; gOverlayTable = 0x803FFE10; -D_803A5D00 = 0x803A5D00; /* framebuffers */ +gFramebuffers = 0x803A5D00; /* framebuffers */ /* Renames for the boot segment */ boot_D_8002D500 = D_8002D500; diff --git a/src/BGS/ch/code_2270.c b/src/BGS/ch/code_2270.c index c555ab04..874cfff8 100644 --- a/src/BGS/ch/code_2270.c +++ b/src/BGS/ch/code_2270.c @@ -147,10 +147,10 @@ void chTiptup_setState(Actor *this, s32 arg1){ this->has_met_before = TRUE; if (unqPtr->unkA == 0) { - gcdialog_showText(ASSET_C72_TEXT_UNKNOWN, 0xe, this->position, this->marker, chTiptup_textEvent, 0); + gcdialog_showText(ASSET_C72_DIALOG_UNKNOWN, 0xe, this->position, this->marker, chTiptup_textEvent, 0); } else { - gcdialog_showText(ASSET_C74_TEXT_UNKNOWN, 0xf, this->position, this->marker, chTiptup_textEvent, 0); + gcdialog_showText(ASSET_C74_DIALOG_UNKNOWN, 0xf, this->position, this->marker, chTiptup_textEvent, 0); } } else { @@ -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_TEXT_UNKNOWN, 0, 0, 0, 0, 0)) + if(!mapSpecificFlags_get(0) && gcdialog_showText(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); @@ -321,7 +321,7 @@ void chTiptup_update(Actor *this){ } } else{ - if(ml_distance_vec3f(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){ + if(ml_vec3f_distance(this->position, player_position) < 300.0f && player_getTransformation() == TRANSFORM_1_BANJO && !jiggyscore_isSpawned(JIGGY_27_BGS_TIPTUP)){ chTiptup_setState(this, 2); } } @@ -335,12 +335,12 @@ void chTiptup_update(Actor *this){ } } //L80389370 else{ - if(ml_distance_vec3f(this->position, player_position) >= 300.0f) + if(ml_vec3f_distance(this->position, player_position) >= 300.0f) chTiptup_setState(this, 1); } }//L803893A0 if(this->state == 6){ - if(ml_distance_vec3f(this->position, player_position) < 300.0f && !unqPtr->unk8){ + if(ml_vec3f_distance(this->position, player_position) < 300.0f && !unqPtr->unk8){ unqPtr->unk8 = 1; gcdialog_showText(0xc7d, 4, 0, 0, 0, 0); } diff --git a/src/BGS/ch/croctus.c b/src/BGS/ch/croctus.c index 5a6400d6..d68623df 100644 --- a/src/BGS/ch/croctus.c +++ b/src/BGS/ch/croctus.c @@ -143,7 +143,7 @@ void func_80387FD4(Actor *this){ func_8025A6EC(COMUSIC_2B_DING_B, 28000); //TODO ISSUE HERE if (this->unkF4_8 == 1) { func_8028F94C(2, this->position); - gcdialog_showText(ASSET_C86_TEXT_UNKNOWN, 0xE, this->position, this->marker, func_80387E68, NULL); + gcdialog_showText(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 diff --git a/src/BGS/ch/flibbit.c b/src/BGS/ch/flibbit.c index 7290ed2f..158abdc8 100644 --- a/src/BGS/ch/flibbit.c +++ b/src/BGS/ch/flibbit.c @@ -17,7 +17,6 @@ typedef struct{ extern f32 mapModel_getFloorY(f32 *); -extern void func_80256E24(f32 [3], f32, f32, f32, f32, f32); void chflibbit_update(Actor *this); Actor *chflibbit_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); @@ -373,7 +372,7 @@ void chflibbit_update(Actor *this){ sp84[0] = (f32)local->unkE[0]; sp84[1] = (f32)local->unkE[1]; sp84[2] = (f32)local->unkE[2]; - if(ml_distance_vec3f(this->position, sp84) < 30.0f){ + if(ml_vec3f_distance(this->position, sp84) < 30.0f){ func_80386AEC(this, 1); } else{ diff --git a/src/BGS/ch/mrvile.c b/src/BGS/ch/mrvile.c index e4a9c338..28ad119f 100644 --- a/src/BGS/ch/mrvile.c +++ b/src/BGS/ch/mrvile.c @@ -260,7 +260,7 @@ bool func_8038C2A8(ActorMarker *marker) { local = (ActorLocal_MrVile *)&this->local; player_getPosition(player_position); if (this->state == 6) { - return ml_distance_vec3f(this->position, player_position) < 150.0f; + return ml_vec3f_distance(this->position, player_position) < 150.0f; } return local->unk0 == 1; } @@ -351,7 +351,7 @@ void chvile_update(Actor *this) { local->game_marker = actorArray_findClosestActorFromActorId(this->position, 0x138, -1, &sp90)->marker; } player_getPosition(player_position); - sp90 = ml_distance_vec3f(this->position, player_position); + sp90 = ml_vec3f_distance(this->position, player_position); if (sp90 <= 300.0f) { local->unk0 = (local->unk0 == 0) ? 1 : 2; } else if (sp90 > 300.0f) { @@ -411,7 +411,7 @@ void chvile_update(Actor *this) { if (this->state == 4) { player_getPosition(local->target_position); local->unk10 = 500.0f; - if ((local->unkC == 102) && (ml_distance_vec3f(this->position, local->target_position) < 200.0f)) { + if ((local->unkC == 102) && (ml_vec3f_distance(this->position, local->target_position) < 200.0f)) { BGS_func_8038BBA0(this, 103); } if ((local->unkC == 103) && (skeletalAnim_getLoopCount(this->unk148) >= 2)) { @@ -420,7 +420,7 @@ void chvile_update(Actor *this) { } if (this->state == 5) { local->unk10 = 200.0f; - if (ml_distance_vec3f(this->position, local->target_position) < 100.0f) { + if (ml_vec3f_distance(this->position, local->target_position) < 100.0f) { local->target_position[0] = randf2(-500.0f, 500.0f); local->target_position[1] = 0.0f; local->target_position[2] = randf2(-500.0f, 500.0f); @@ -428,12 +428,12 @@ void chvile_update(Actor *this) { } if ((this->state == 6)){ local->unk10 = 400.0f; - if((ml_distance_vec3f(this->position, local->target_position) < 100.0f) || (ml_distance_vec3f(player_position, local->target_position) < 300.0f)) { + if((ml_vec3f_distance(this->position, local->target_position) < 100.0f) || (ml_vec3f_distance(player_position, local->target_position) < 300.0f)) { for(i = 0; i < 10; i++){ random_position[0] = randf2(-500.0f, 500.0f); random_position[1] = 0.0f; random_position[2] = randf2(-500.0f, 500.0f); - if ((i == 0) || (ml_distance_vec3f(player_position, random_position) > ml_distance_vec3f(player_position, local->target_position))) { + if ((i == 0) || (ml_vec3f_distance(player_position, random_position) > ml_vec3f_distance(player_position, local->target_position))) { local->target_position[0] = random_position[0]; local->target_position[1] = random_position[1]; local->target_position[2] = random_position[2]; diff --git a/src/BGS/ch/tanktup.c b/src/BGS/ch/tanktup.c index 9f862bed..08469fc9 100644 --- a/src/BGS/ch/tanktup.c +++ b/src/BGS/ch/tanktup.c @@ -140,7 +140,7 @@ void func_8038F6A4(Actor *this) player_getPosition(sp48); if (!this->has_met_before) { - if ((((ml_distance_vec3f(local->unk18, sp48) < 250.0f) && (ml_distance_vec3f(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO)) + if ((((ml_vec3f_distance(local->unk18, sp48) < 250.0f) && (ml_vec3f_distance(local->unk18, sp48) > 80.0f)) && (!func_8028ECAC())) && (player_getTransformation() == TRANSFORM_1_BANJO)) { gcdialog_showText(0xC7E, 0, 0, 0, 0, 0); this->has_met_before = TRUE; diff --git a/src/BGS/ch/yellowflibbit.c b/src/BGS/ch/yellowflibbit.c index 7a91819b..50e7810a 100644 --- a/src/BGS/ch/yellowflibbit.c +++ b/src/BGS/ch/yellowflibbit.c @@ -423,7 +423,7 @@ void BGS_func_8038E034(Actor *this) { sp7C[0] = (f32) local->unk10[0]; sp7C[1] = (f32) local->unk10[1]; sp7C[2] = (f32) local->unk10[2]; - if (ml_distance_vec3f(this->position, sp7C) < 30.0f) { + if (ml_vec3f_distance(this->position, sp7C) < 30.0f) { func_8038D9D0(this, 1); } else { func_8038D9D0(this, 5); diff --git a/src/BGS/code_3420.c b/src/BGS/code_3420.c index d8b1276e..0dbeb67f 100644 --- a/src/BGS/code_3420.c +++ b/src/BGS/code_3420.c @@ -3,8 +3,6 @@ #include "math.h" #include "variables.h" -extern f32 func_80256AB4(f32, f32, f32, f32); -extern f32 func_8025715C(f32, f32); extern f32 *chVile_getPostion(ActorMarker *); extern void bundle_setRandomVelocity(f32); extern void func_802FDCB8(s32); @@ -47,43 +45,43 @@ ActorInfo D_80390960 = { // Vile Wins enum asset_e D_80390984[] = { 0, - ASSET_C66_TEXT_MR_VILE_WINS_ROUND_1, - ASSET_C68_TEXT_MR_VILE_WINS_ROUND_2, - ASSET_C6A_TEXT_MR_VILE_WINS_ROUND_3, - ASSET_C92_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_2, - ASSET_C93_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_3, - ASSET_C94_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_4, + ASSET_C66_DIALOG_MR_VILE_WINS_ROUND_1, + ASSET_C68_DIALOG_MR_VILE_WINS_ROUND_2, + ASSET_C6A_DIALOG_MR_VILE_WINS_ROUND_3, + ASSET_C92_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_2, + ASSET_C93_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_3, + ASSET_C94_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_4, 0 }; // Player Wins enum asset_e D_803909A4[] = { 0, - ASSET_C67_TEXT_MR_VILE_ROUND_2_START, - ASSET_C69_TEXT_MR_VILE_ROUND_3_START, + ASSET_C67_DIALOG_MR_VILE_ROUND_2_START, + ASSET_C69_DIALOG_MR_VILE_ROUND_3_START, 0, - ASSET_C95_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_1, - ASSET_C96_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_2, - ASSET_C97_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_3 + ASSET_C95_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_1, + ASSET_C96_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_2, + ASSET_C97_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_3 }; // Player Wins Rematch enum asset_e D_803909C0[] = { 0, - ASSET_C6E_TEXT_MR_VILE_LOSE_ROUND_2_REMATCH, - ASSET_C6F_TEXT_MR_VILE_LOSE_ROUND_3_REMATCH, + ASSET_C6E_DIALOG_MR_VILE_LOSE_ROUND_2_REMATCH, + ASSET_C6F_DIALOG_MR_VILE_LOSE_ROUND_3_REMATCH, 0, - ASSET_C95_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_1, - ASSET_C96_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_2, - ASSET_C97_TEXT_MR_VILE_LOSES_EXTRA_CHALLENGE_3 + ASSET_C95_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_1, + ASSET_C96_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_2, + ASSET_C97_DIALOG_MR_VILE_LOSES_EXTRA_CHALLENGE_3 }; // Player Declines enum asset_e D_803909DC[] = { - ASSET_C65_TEXT_MR_VILE_PLAYER_DECLINES, - ASSET_C65_TEXT_MR_VILE_PLAYER_DECLINES, - ASSET_C65_TEXT_MR_VILE_PLAYER_DECLINES, - ASSET_C8F_TEXT_MR_VILE_PLAYER_DECLINES_EXTRA_CHALLENGE, + ASSET_C65_DIALOG_MR_VILE_PLAYER_DECLINES, + ASSET_C65_DIALOG_MR_VILE_PLAYER_DECLINES, + ASSET_C65_DIALOG_MR_VILE_PLAYER_DECLINES, + ASSET_C8F_DIALOG_MR_VILE_PLAYER_DECLINES_EXTRA_CHALLENGE, 0, 0, 0 @@ -91,10 +89,10 @@ enum asset_e D_803909DC[] = { // Round 1 Regular & Extra Challenge enum asset_e BGS_D_803909F8[] = { - ASSET_C64_TEXT_MR_VILE_ROUND_1_START, + ASSET_C64_DIALOG_MR_VILE_ROUND_1_START, 0, 0, - ASSET_C8E_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_1, + ASSET_C8E_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_1, 0, 0, 0, @@ -102,10 +100,10 @@ enum asset_e BGS_D_803909F8[] = { }; enum asset_e D_80390A18[] = { - ASSET_C6D_TEXT_MR_VILE_LOSE_ROUND_1_REMATCH, - ASSET_C70_TEXT_MR_VILE_WIN_ROUND_2_REMATCH, - ASSET_C71_TEXT_MR_VILE_WIN_ROUND_3_REMATCH, - ASSET_C8E_TEXT_MR_VILE_WINS_EXTRA_CHALLENGE_1, + ASSET_C6D_DIALOG_MR_VILE_LOSE_ROUND_1_REMATCH, + ASSET_C70_DIALOG_MR_VILE_WIN_ROUND_2_REMATCH, + ASSET_C71_DIALOG_MR_VILE_WIN_ROUND_3_REMATCH, + ASSET_C8E_DIALOG_MR_VILE_WINS_EXTRA_CHALLENGE_1, 0, 0, 0, @@ -171,7 +169,7 @@ void BGS_func_80389850(Actor *this, s32 arg1) { sp7C[2] = 0.0f; sp7C[1] = sp94[1]; sp7C[0] = 0.0f; - if(ml_distance_vec3f(sp94, sp7C) <= 1000.0f){ + if(ml_vec3f_distance(sp94, sp7C) <= 1000.0f){ break; } } @@ -430,7 +428,7 @@ void chvilegame_player_consume_piece(Actor *this) { if ((end != begin) && BGS_func_80389810(sp44)){ sp44[1] = 0.0f; for(i_ptr = begin; i_ptr < end; i_ptr++){ - if ((ml_distance_vec3f(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) { + if ((ml_vec3f_distance(i_ptr->position, sp44) < 65.25) && chyumblie_is_edible(i_ptr->marker)) { is_correct_type = ((local->current_type != YUMBLIE) && (i_ptr->type != YUMBLIE)) || (((local->current_type == YUMBLIE) && i_ptr->type == YUMBLIE)); if (is_correct_type) { local->player_score++; @@ -468,7 +466,7 @@ bool chvilegame_cpu_consume_piece(ActorMarker *marker, f32 position[3]) { begin = vector_getBegin(local->game_pieces); end = vector_getEnd(local->game_pieces); for(i_ptr = begin; i_ptr < end; i_ptr++){ - if ((ml_distance_vec3f(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) { + if ((ml_vec3f_distance(i_ptr->position, position) < 50.0f) && func_8038B684(i_ptr->marker)) { local->vile_score++; timedFunc_set_1(0.0f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE); timedFunc_set_1(0.5f, (GenFunction_1)func_802FDCB8, ITEM_1B_VILE_VILE_SCORE); @@ -547,12 +545,12 @@ bool chvilegame_find_closest_piece(ActorMarker *marker, f32 position[0], f32 yaw piece_direction[0] = i_ptr->position[0] - position[0]; piece_direction[1] = i_ptr->position[1] - position[1]; piece_direction[2] = i_ptr->position[2] - position[2]; - distance = ml_distance_vec3f(i_ptr->position, position); + distance = ml_vec3f_distance(i_ptr->position, position); angle_diff = func_80256AB4(target_direction[0], target_direction[2], piece_direction[0], piece_direction[2]); if( (distance > 300.0f) || ((-0.8 < angle_diff) && (angle_diff < 0.8) && ((piece_direction[0]*target_direction[0] + piece_direction[1]*target_direction[1] + piece_direction[2]*target_direction[2]) >= 0.0f)) ) { - if ((closest_piece == NULL) || (distance < ml_distance_vec3f(position, closest_piece->position))){ + if ((closest_piece == NULL) || (distance < ml_vec3f_distance(position, closest_piece->position))){ closest_piece = i_ptr; } } diff --git a/src/CC/code_13C0.c b/src/CC/code_13C0.c index 3723775d..41c6669f 100644 --- a/src/CC/code_13C0.c +++ b/src/CC/code_13C0.c @@ -1,9 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "CC.h" -#include #include "core2/modelRender.h" typedef struct{ diff --git a/src/CC/code_1F70.c b/src/CC/code_1F70.c index a039910c..a7a09e06 100644 --- a/src/CC/code_1F70.c +++ b/src/CC/code_1F70.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/modelRender.h" extern BKCollisionTri *func_8028EF48(void); @@ -19,7 +19,6 @@ extern int func_80340020(s32, f32[3], s32, f32, s32, BKVertexList *, f32[3], f32 extern void boneTransformList_getBoneScale(s32, s32, f32[3]); extern void boneTransformList_setBoneScale(s32, s32, f32[3]); extern void func_8033A9A8(s32, s32, f32[3]); -extern void ml_vec3f_normalize(f32[3]); extern void func_8033A45C(s32, s32); extern void modelRender_setBoneTransformList(s32); extern void func_8028FAB0(f32[3]); @@ -249,7 +248,7 @@ int CC_func_80388CA0(void){ void func_80388CB4(void){ if(D_80389FA0.unk21){ skeletalAnim_free(D_80389FA0.unk0); - func_8030DA44(D_80389FA0.sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(D_80389FA0.sfxsourceIdx); func_80340690(D_80389FA0.unk18); func_8034A2A8(D_80389FA0.unk34); if(model_getVtxList(D_80389FA0.unk24) != D_80389FA0.unk40) @@ -331,7 +330,7 @@ void CC_func_80388F4C(void){ CC_func_80387D4C(); if(D_80389FA0.unk21 != 0 && func_80334904() == 2){ player_getPosition(sp6C); - D_80389FA0.unk20 = (ml_distance_vec3f(sp6C, D_80389FA0.unkC) < 200.0f); + D_80389FA0.unk20 = (ml_vec3f_distance(sp6C, D_80389FA0.unkC) < 200.0f); D_80389FA0.unk38 += sp68; sp64 = skeletalAnim_getProgress(D_80389FA0.unk0); @@ -362,7 +361,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_TEXT_UNKNOWN, 0xE, D_80389FA0.unk28, NULL, NULL, NULL); + gcdialog_showText(ASSET_D2B_DIALOG_UNKNOWN, 0xE, D_80389FA0.unk28, NULL, NULL, NULL); D_80389FA0.unk48 = TRUE; } }//L8038918C @@ -381,7 +380,7 @@ void CC_func_80388F4C(void){ if(D_80389FA0.unk21 == 3){ func_8034A174(D_80389FA0.unk34, 6, sp48); - if(ml_distance_vec3f(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){ + if(ml_vec3f_distance(sp48, sp6C) <= 130.0f && sp6C[1] - sp48[1] < 50.0f){ func_8031D04C(MAP_21_CC_WITCH_SWITCH_ROOM, 1); } }//L80389260 diff --git a/src/CC/code_530.c b/src/CC/code_530.c index 80565216..e20f628d 100644 --- a/src/CC/code_530.c +++ b/src/CC/code_530.c @@ -77,7 +77,7 @@ void func_80386AD0(ActorMarker *arg0, s32 arg1) { void func_80386AF8(Actor *arg0) { ActorLocal_CC_530 *local = (ActorLocal_CC_530 *)&arg0->local; CC_func_80386920(arg0, 0); - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); } void func_80386B28(Actor *this){ diff --git a/src/CC/code_BF0.c b/src/CC/code_BF0.c index eda3acbd..9946c601 100644 --- a/src/CC/code_BF0.c +++ b/src/CC/code_BF0.c @@ -136,7 +136,7 @@ void func_803870F8(Actor *this){ sp3C[0] = this->position_x; sp3C[1] = this->position_y + 100; sp3C[2] = this->position_z; - if(ml_distance_vec3f(&sp3C, &sp70) < 120.0f){ + if(ml_vec3f_distance(&sp3C, &sp70) < 120.0f){ func_8031D04C(MAP_22_CC_INSIDE_CLANKER, (local->unk0 == 1)? 7 : 6); } }//L80387500 diff --git a/src/CCW/code_14B0.c b/src/CCW/code_14B0.c index a5e03fee..55ec10e5 100644 --- a/src/CCW/code_14B0.c +++ b/src/CCW/code_14B0.c @@ -45,7 +45,7 @@ void func_803878A0(Actor *this, s32 next_state) { local->unkC[0] = randf2(-500.0f, 500.0f); local->unkC[1] = randf2(400.0f, 900.0f); local->unkC[2] = randf2(-400.0f, 700.0f); - if(ml_distance_vec3f(this->position, local->unkC) > 800.0f) + if(ml_vec3f_distance(this->position, local->unkC) > 800.0f) break; } local->unk8 = randf2(500.0f, 1000.0f); @@ -55,7 +55,7 @@ void func_803878A0(Actor *this, s32 next_state) { void CCW_func_80387A20(Actor *this){ ActorLocal_CCW_14B0 *local = (ActorLocal_CCW_14B0 *)&this->local; - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); } void CCW_func_80387A40(Actor *this) { @@ -90,7 +90,7 @@ void CCW_func_80387A40(Actor *this) { sp5C[0] = local->unkC[0] - this->position[0]; sp5C[1] = local->unkC[1] - this->position[1]; sp5C[2] = local->unkC[2] - this->position[2]; - if (ml_distance_vec3f(this->position, local->unkC) < 500.0f) { + if (ml_vec3f_distance(this->position, local->unkC) < 500.0f) { ml_vec3f_set_length(sp5C, local->unk8 * 8.0f); } else { ml_vec3f_set_length(sp5C, local->unk8 * 2); @@ -106,7 +106,7 @@ void CCW_func_80387A40(Actor *this) { } func_80258A4C(this->position, this->yaw - 90.0f, local->unkC, &sp58, &sp54, &sp50); this->yaw += 140.0f * sp50 * sp68; - if (ml_distance_vec3f(this->position, local->unkC) < 100.0f) { + if (ml_vec3f_distance(this->position, local->unkC) < 100.0f) { func_803878A0(this, 1); } } diff --git a/src/CCW/code_160.c b/src/CCW/code_160.c index 2842c8d7..160a2af9 100644 --- a/src/CCW/code_160.c +++ b/src/CCW/code_160.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct{ @@ -183,10 +183,10 @@ void func_8038687C(Actor *this) { sp4C[1] = -100.0f; sp4C[2] = randf2(-500.0f, 900.0f); - if(ml_distance_vec3f(this->position, sp4C) < 400.0f) + if(ml_vec3f_distance(this->position, sp4C) < 400.0f) continue; - tmp = ml_distance_vec3f(sp5C, sp4C); + tmp = ml_vec3f_distance(sp5C, sp4C); phi_v0 = (phi_s0 < 0xA) ? 500 : 200; if(tmp < (f32) phi_v0) continue; @@ -207,7 +207,7 @@ void func_8038687C(Actor *this) { func_803865F4(this, 3); } else if ((local->unk0 != NULL) && (map_get() == MAP_5A_CCW_SUMMER_ZUBBA_HIVE)) { player_getPosition(sp40); - if ((ml_distance_vec3f(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) { + if ((ml_vec3f_distance(this->position, sp40) < 300.0f) && (player_getTransformation() == TRANSFORM_1_BANJO)) { func_803865F4(this, 2); } } diff --git a/src/CCW/code_2270.c b/src/CCW/code_2270.c index 06901e73..b6040616 100644 --- a/src/CCW/code_2270.c +++ b/src/CCW/code_2270.c @@ -161,7 +161,7 @@ void chGobiCCW_update(Actor *this) { if(this->state == 1){ if (!this->has_met_before) { player_getPosition(sp48); - if (ml_distance_vec3f(this->position, sp48) < 600.0f) { + 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); } diff --git a/src/CCW/code_2B00.c b/src/CCW/code_2B00.c index 92aed154..f60d02bd 100644 --- a/src/CCW/code_2B00.c +++ b/src/CCW/code_2B00.c @@ -118,7 +118,7 @@ void func_803891B0(void* marker) { void func_8038921C(void* marker) { Actor* actor = marker_getActor(reinterpret_cast(ActorMarker*, marker)); func_8030E394(actor->unk44_31); - func_8030DA44(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_3310.c b/src/CCW/code_3310.c index a172ea10..601cf9d9 100644 --- a/src/CCW/code_3310.c +++ b/src/CCW/code_3310.c @@ -271,7 +271,7 @@ void CCW_func_80389BFC(Actor *this) { } if ((local->unk0->map_id != MAP_43_CCW_SPRING) && ((this->position[0] + 500.0f) < sp4C[0])) { player_setCarryObjectPoseInCylinder(this->position, 1110.0f, 200.0f, ACTOR_2A2_CATERPILLAR, &this); - if ((local->unk0->unkE != 0) && (carriedObj_getActorId() == ACTOR_2A2_CATERPILLAR) && (ml_distance_vec3f(this->position, sp4C) < 1010.0f) && (player_throwCarriedObject() != 0)) { + 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); diff --git a/src/CCW/code_3DA0.c b/src/CCW/code_3DA0.c index be0acaf1..494876a8 100644 --- a/src/CCW/code_3DA0.c +++ b/src/CCW/code_3DA0.c @@ -111,13 +111,13 @@ void chcaterpillar_update(Actor *this){ if(this->state == 1){ skeletalAnim_getProgressRange(this->unk148, &sp64, &sp60); player_getPosition(sp74); - if(ml_distance_vec3f(this->position, local->unk0) < 10.0f){ + if(ml_vec3f_distance(this->position, local->unk0) < 10.0f){ for(i = 0; i < 10; i++){ local->unk0[0] = randf2(-300.0f, 300.0f) + this->position_x; local->unk0[1] = this->position_y; local->unk0[2] = randf2(-300.0f, 300.0f) + this->position_z; - if( !(ml_distance_vec3f(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0)) + if( !(ml_vec3f_distance(local->unk0, this->position) < 50.0f) && func_80329210(this, local->unk0)) break; }//L8038A544 if(i == 10){ @@ -150,10 +150,10 @@ void chcaterpillar_update(Actor *this){ } }//L8038A714 - if(ml_distance_vec3f(this->position, sp74) < 50.0f){ + if(ml_vec3f_distance(this->position, sp74) < 50.0f){ func_8028F030(ACTOR_2A2_CATERPILLAR); if(!volatileFlag_get(VOLATILE_FLAG_B2)){ - gcdialog_showText(ASSET_CC7_TEXT_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(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); @@ -177,7 +177,7 @@ void chcaterpillar_update(Actor *this){ local->unk24 += 3.3333333333333335*sp84; local->unk24 = (1.0 < local->unk24) ? 1.0 : local->unk24; - ml_interpolate_vec3f(this->position, local->unkC, local->unk18, local->unk24); + ml_vec3f_interpolate_fast(this->position, local->unkC, local->unk18, local->unk24); this->position[1] += 50.0f*sinf(local->unk24*3.141592654); if(1.0 == local->unk24){ diff --git a/src/CCW/code_4530.c b/src/CCW/code_4530.c index 07220be6..21b29100 100644 --- a/src/CCW/code_4530.c +++ b/src/CCW/code_4530.c @@ -101,7 +101,7 @@ void func_8038AA8C(Actor *this) { } player_getPosition(sp54); - if (ml_distance_vec3f(this->position, sp54) < 850.0f) { + if (ml_vec3f_distance(this->position, sp54) < 850.0f) { func_8038A950(this, 2); } } diff --git a/src/CCW/code_5540.c b/src/CCW/code_5540.c index 0b59e1f6..ed9cb535 100644 --- a/src/CCW/code_5540.c +++ b/src/CCW/code_5540.c @@ -133,7 +133,7 @@ void chnabnut_update(Actor *this) { if (this->state == NABNUT_STATE_1_SAD) { player_getPosition(sp30); - if (!this->has_met_before && (ml_distance_vec3f(this->position, sp30) < 400.0f)) { + 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); } @@ -143,7 +143,7 @@ void chnabnut_update(Actor *this) { } if (this->has_met_before && !func_803114B0()) { player_setCarryObjectPoseInCylinder(this->position, 500.0f, 200.0f, ACTOR_2A9_ACORN, &this); - if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_distance_vec3f(this->position, sp30) < 300.0f) && player_throwCarriedObject()) { + if ((carriedObj_getActorId() == ACTOR_2A9_ACORN) && (ml_vec3f_distance(this->position, sp30) < 300.0f) && player_throwCarriedObject()) { player_setThrowTargetPosition(D_8038F350); local->returned_acorn_count++; if (local->returned_acorn_count == 6) { diff --git a/src/CCW/code_5BF0.c b/src/CCW/code_5BF0.c index 6f153fb4..d2db3f6d 100644 --- a/src/CCW/code_5BF0.c +++ b/src/CCW/code_5BF0.c @@ -114,7 +114,7 @@ void func_8038C41C(Actor *this) { if ((this->marker->id == 0x1CB) && (this->state == 2)) { player_getPosition(sp2C); - if (!this->has_met_before && (ml_distance_vec3f(this->position, sp2C) < 400.0f)) { + 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); } diff --git a/src/CCW/code_61E0.c b/src/CCW/code_61E0.c index 22ec335f..0e348d76 100644 --- a/src/CCW/code_61E0.c +++ b/src/CCW/code_61E0.c @@ -73,7 +73,7 @@ void func_8038C7A8(Actor *this) { if (this->state == 1) { player_getPosition(sp38); - if (ml_distance_vec3f(this->position, sp38) < 50.0f) { + 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); CCW_func_8038C6A0(this, 5); @@ -91,7 +91,7 @@ void func_8038C7A8(Actor *this) { if (this->state == 3) { local->unk18 += 3.3333333333333333 * sp44; local->unk18 = (local->unk18 > 1.0) ? 1.0 : local->unk18; - ml_interpolate_vec3f(this->position, local->unk0, local->unkC, local->unk18); + ml_vec3f_interpolate_fast(this->position, local->unk0, local->unkC, local->unk18); this->position[1] += 50.0f * sinf(local->unk18 * BAD_PI); if (local->unk18 == 1.0) { CCW_func_8038C6A0(this, 4); diff --git a/src/CCW/code_6620.c b/src/CCW/code_6620.c index ce37aaea..535d1bc2 100644 --- a/src/CCW/code_6620.c +++ b/src/CCW/code_6620.c @@ -118,7 +118,7 @@ void func_8038CC4C(Actor *this) { } if (!this->has_met_before) { player_getPosition(sp38); - if (ml_distance_vec3f(this->position, sp38) < 900.0f) { + 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); this->has_met_before = TRUE; diff --git a/src/CCW/code_6AC0.c b/src/CCW/code_6AC0.c index 207917c4..beef5702 100644 --- a/src/CCW/code_6AC0.c +++ b/src/CCW/code_6AC0.c @@ -116,7 +116,7 @@ void func_8038CFB4(Actor *this) { if (this->state == 1) { if (!this->has_met_before) { player_getPosition(sp60); - if (ml_distance_vec3f(this->position, sp60) < 900.0f) { + if (ml_vec3f_distance(this->position, sp60) < 900.0f) { gcdialog_showText(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 8b18e347..f4a772f6 100644 --- a/src/CCW/code_6EC0.c +++ b/src/CCW/code_6EC0.c @@ -69,7 +69,7 @@ void func_8038D368(Actor *this) { if(!this->has_met_before){ player_getPosition(plyr_pos); - if (ml_distance_vec3f(this->position, plyr_pos) < 600.0f) { + 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); } else { diff --git a/src/CCW/code_950.c b/src/CCW/code_950.c index ef8a104b..e2f2e842 100644 --- a/src/CCW/code_950.c +++ b/src/CCW/code_950.c @@ -91,7 +91,7 @@ void func_8038717C(Actor *this){ ActorLocal_CCW_950 *local; local = (ActorLocal_CCW_950 *)&this->local; - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); } void chwasp_update(Actor *this) { diff --git a/src/FP/ch/bearcub.c b/src/FP/ch/bearcub.c index d90bddcc..003ba09a 100644 --- a/src/FP/ch/bearcub.c +++ b/src/FP/ch/bearcub.c @@ -84,7 +84,7 @@ void func_8038A318(ActorMarker *caller, enum asset_e text_id, s32 arg1){ func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 32000); func_8025A6EC(COMUSIC_5B_FP_IGLOO_HAPPY, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } } @@ -124,9 +124,9 @@ void func_8038A384(Actor *this){ }//L8038A4E4 sp34 = levelSpecificFlags_get(LEVEL_FLAG_11_FP_UNKNOWN) + levelSpecificFlags_get(LEVEL_FLAG_12_FP_UNKNOWN) + levelSpecificFlags_get(LEVEL_FLAG_13_FP_UNKNOWN); - sp38 = (sp34 == 1) ? ASSET_C17_TEXT_UNKNOWN - : (sp34 == 2) ? ASSET_C18_TEXT_UNKNOWN - : ASSET_C19_TEXT_UNKNOWN; + sp38 = (sp34 == 1) ? ASSET_C17_DIALOG_UNKNOWN + : (sp34 == 2) ? ASSET_C18_DIALOG_UNKNOWN + : ASSET_C19_DIALOG_UNKNOWN; this->yaw_ideal = (f32)func_80329784(this); func_80328FB0(this, 2.0f); @@ -140,7 +140,7 @@ void func_8038A384(Actor *this){ && !jiggyscore_isCollected(JIGGY_2C_FP_BOGGY_3) && !jiggyscore_isSpawned(JIGGY_2C_FP_BOGGY_3) ){ - if (gcdialog_showText(ASSET_C1A_TEXT_UNKNOWN, 0x2a, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(ASSET_C1A_DIALOG_UNKNOWN, 0x2a, NULL, NULL, NULL, NULL)) { levelSpecificFlags_set(LEVEL_FLAG_19_FP_UNKNOWN, TRUE); } } @@ -163,7 +163,7 @@ 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_TEXT_UNKNOWN) { + if (sp38 == ASSET_C19_DIALOG_UNKNOWN) { gcdialog_showText(sp38, 0x2f, this->position, this->marker, func_8038A318, NULL); } else { diff --git a/src/FP/ch/boggy1.c b/src/FP/ch/boggy1.c index 50e1ce2f..542a831a 100644 --- a/src/FP/ch/boggy1.c +++ b/src/FP/ch/boggy1.c @@ -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_TEXT_UNKNOWN, 0xf, NULL, this->marker, NULL, func_803877A8); + gcdialog_showText(ASSET_C2B_DIALOG_UNKNOWN, 0xf, NULL, this->marker, NULL, func_803877A8); } } @@ -149,7 +149,7 @@ void func_8038794C(Actor *this){ if(!this->has_met_before && func_80329530(this, 0x1f4)){ if(!func_8028ECAC() || func_8028ECAC() == BSGROUP_8_TROT){ - if (gcdialog_showText(ASSET_BFF_TEXT_UNKNOWN, 0x2a, this->position, NULL, NULL, NULL)) { + if (gcdialog_showText(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); } diff --git a/src/FP/ch/boggy2.c b/src/FP/ch/boggy2.c index e39ab5d4..78d140bd 100644 --- a/src/FP/ch/boggy2.c +++ b/src/FP/ch/boggy2.c @@ -4,7 +4,7 @@ extern void func_8028E668(f32[3], f32, f32, f32); extern Actor *func_80328230(enum actor_e id, f32 pos[3], f32 rot[3]); -extern NodeProp *cubeList_findNodePropByActorId(enum actor_e, s32[3]); +extern NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e, s32[3]); extern f32 func_8038BE20(f32 arg0[3]); typedef struct { @@ -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_TEXT_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(ASSET_C0A_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); } else{ - gcdialog_showText(ASSET_C09_TEXT_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(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_TEXT_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(ASSET_C05_DIALOG_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); } else{ - gcdialog_showText(ASSET_C02_TEXT_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(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_TEXT_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ + if(gcdialog_showText(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_TEXT_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ + if(gcdialog_showText(ASSET_C08_DIALOG_UNKNOWN, 0xe, this->position, this->marker, func_80388D70, NULL)){ volatileFlag_set(VOLATILE_FLAG_B4, TRUE); func_80388A50(this); } @@ -201,7 +201,7 @@ void func_80388D70(ActorMarker *caller, enum asset_e text_id, s32 arg2){ case 0xc29://L80388DC4 func_8025A6EC(COMUSIC_3A_FP_BOGGY_RACE, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_802BE720(); local->unk0 = partEmitMgr_newEmitter(16); local->unk4 = partEmitMgr_newEmitter(16); @@ -383,8 +383,8 @@ void func_803895E0(void){ for (i = 0; i< 7; i++){ s0 = (i < 3) - ? cubeList_findNodePropByActorId(D_80391DB8[i].unk0, D_80391DA0) - : cubeList_findNodePropByActorId(D_80391DB8[i].unk0, D_80391DAC); + ? cubeList_findNodePropByActorIdAndPosition_s32(D_80391DB8[i].unk0, D_80391DA0) + : cubeList_findNodePropByActorIdAndPosition_s32(D_80391DB8[i].unk0, D_80391DAC); nodeprop_getPosition(s0, sp64); f20 = (f32)func_80304DA8(s0); @@ -478,13 +478,13 @@ void func_803896FC(Actor *this){ && player_getTransformation() != TRANSFORM_4_WALRUS && volatileFlag_get(VOLATILE_FLAG_B3) ){ - gcdialog_showText(ASSET_C01_TEXT_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(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_TEXT_UNKNOWN, 0xf, this->position, this->marker, func_80388D70, NULL); + gcdialog_showText(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 d9e0d484..fc605b85 100644 --- a/src/FP/ch/boggy3.c +++ b/src/FP/ch/boggy3.c @@ -77,14 +77,14 @@ void func_80390388(Actor *this){ && (func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT) ){ if(0.0f == this->unk1C[0] && func_80390334()){ - if(gcdialog_showText(ASSET_C1F_TEXT_UNKNOWN, 0xb, this->position, NULL, NULL, NULL)){ + if(gcdialog_showText(ASSET_C1F_DIALOG_UNKNOWN, 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_TEXT_UNKNOWN, 0x2b, this->position, NULL, NULL, NULL)){ + if(gcdialog_showText(ASSET_C1E_DIALOG_UNKNOWN, 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 7271be98..9d5f25b1 100644 --- a/src/FP/ch/cavewozza.c +++ b/src/FP/ch/cavewozza.c @@ -69,14 +69,14 @@ void func_80390630(Actor *this){ if (func_80329530(this, 350)) { if (player_getTransformation() == TRANSFORM_4_WALRUS) { if (!levelSpecificFlags_get(LEVEL_FLAG_31_FP_UNKNOWN)) { - if (gcdialog_showText(ASSET_C27_TEXT_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(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_TEXT_UNKNOWN, 0x23, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(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 6438f440..e4f658fb 100644 --- a/src/FP/ch/scarfsled.c +++ b/src/FP/ch/scarfsled.c @@ -1,7 +1,6 @@ #include #include "functions.h" #include "variables.h" -#include "ml/mtx.h" void chScarfSled_update(Actor *this); diff --git a/src/FP/ch/twinklybox.c b/src/FP/ch/twinklybox.c index c3da8851..3ce1b78e 100644 --- a/src/FP/ch/twinklybox.c +++ b/src/FP/ch/twinklybox.c @@ -199,7 +199,7 @@ void func_8038D3D8(void){ comusic_8025AB44(COMUSIC_68_TWINKLY_MINIGAME, 0, 4000); func_8025AABC(COMUSIC_68_TWINKLY_MINIGAME); func_8025A58C(-1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8038D41C(ActorMarker *marker){ @@ -265,7 +265,7 @@ void func_8038D5C8(ActorMarker *this_marker, ActorMarker *other_marker){ this->unk1C[1] = 0.0f; func_8025A6EC(COMUSIC_68_TWINKLY_MINIGAME, 25000); func_8025A58C(0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); this->unk1C[2] = 428571.0f; func_8025AEA0(0x68, (s32)this->unk1C[2]); subaddie_set_state_with_direction(this, 3, 0.001f, 1); diff --git a/src/FP/ch/twinklymuncher.c b/src/FP/ch/twinklymuncher.c index f1ef8082..54bbbd2e 100644 --- a/src/FP/ch/twinklymuncher.c +++ b/src/FP/ch/twinklymuncher.c @@ -127,7 +127,7 @@ void func_8038E094(Actor *this){ if(this->unkF4_8 == 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_TEXT_TWINKLIE_MINIGAME_LOST, 0x2b, this->position, this->marker, func_8038E040, NULL); + gcdialog_showText(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); diff --git a/src/FP/ch/wozza.c b/src/FP/ch/wozza.c index 7522b056..97e7e615 100644 --- a/src/FP/ch/wozza.c +++ b/src/FP/ch/wozza.c @@ -140,7 +140,7 @@ bool func_8038F5D4(Actor *this, f32 arg1[3], f32 arg2, f32 arg3, s32 arg4){ } this->actor_specific_1_f = (1.0f- sp24)*arg2; func_80329054(this, 2); - if(ml_distance_vec3f(this->position, arg1) <= arg4) + if(ml_vec3f_distance(this->position, arg1) <= arg4) return TRUE; return FALSE; diff --git a/src/FP/ch/xmastree.c b/src/FP/ch/xmastree.c index f6ae70b6..269901d9 100644 --- a/src/FP/ch/xmastree.c +++ b/src/FP/ch/xmastree.c @@ -28,7 +28,7 @@ void __chXmasTree_free(Actor *this){ item_set(ITEM_6_HOURGLASS, FALSE); tmp_a0 = this->unk44_31; if(tmp_a0){ - func_8030DA44(tmp_a0); + sfxsource_freeSfxsourceByIndex(tmp_a0); this->unk44_31 = 0; } } @@ -165,7 +165,7 @@ void chXmasTree_update(Actor *this){ item_set(ITEM_6_HOURGLASS, FALSE); tmp_a0 = this->unk44_31; if(tmp_a0){ - func_8030DA44(tmp_a0); + sfxsource_freeSfxsourceByIndex(tmp_a0); this->unk44_31 = 0; } func_80324E38(0.0f, 3); diff --git a/src/FP/ch/xmastreeeggtoll.c b/src/FP/ch/xmastreeeggtoll.c index e1baf1f6..42b6cf9a 100644 --- a/src/FP/ch/xmastreeeggtoll.c +++ b/src/FP/ch/xmastreeeggtoll.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include void func_80390EB0(Actor *this); diff --git a/src/FP/code_ABD0.c b/src/FP/code_ABD0.c index a377e63b..b36fcec6 100644 --- a/src/FP/code_ABD0.c +++ b/src/FP/code_ABD0.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "prop.h" -#include "SnS.h" #include "actor.h" extern ActorInfo D_80367FE0; diff --git a/src/FP/code_B4D0.c b/src/FP/code_B4D0.c index cc5525b8..5e6c31f6 100644 --- a/src/FP/code_B4D0.c +++ b/src/FP/code_B4D0.c @@ -27,7 +27,7 @@ void func_803918C0(void){ void func_8039195C(void){ if(D_803935E0.sfxsourceIdx){ - func_8030DA44(D_803935E0.sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(D_803935E0.sfxsourceIdx); D_803935E0.sfxsourceIdx = 0; } } diff --git a/src/FP/racectrl.c b/src/FP/racectrl.c index 8f917310..3c7875c4 100644 --- a/src/FP/racectrl.c +++ b/src/FP/racectrl.c @@ -69,7 +69,7 @@ void func_8038ABDC(void){ comusic_8025AB44(COMUSIC_3A_FP_BOGGY_RACE, 0, 4000); func_8025AABC(COMUSIC_3A_FP_BOGGY_RACE); func_8025A58C(-1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8038AC20(s32 gate_indx, s32 arg1){ diff --git a/src/GV/ch/ancientone.c b/src/GV/ch/ancientone.c index c57cab94..c8f39daa 100644 --- a/src/GV/ch/ancientone.c +++ b/src/GV/ch/ancientone.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); typedef struct { f32 unk0[3]; @@ -75,13 +75,13 @@ void func_80386620(Actor *this){ } void func_8038678C(void){ - func_80244BB0(3, 0x85, 0x7ff8, 1.0f); - func_80244BB0(4, 0x85, 0x7ff8, 1.0f); + core1_7090_initSfxSource(3, 0x85, 0x7ff8, 1.0f); + core1_7090_initSfxSource(4, 0x85, 0x7ff8, 1.0f); } void func_803867CC(void){ - func_80244C78(3); - func_80244C78(4); + core1_7090_freeSfxSource(3); + core1_7090_freeSfxSource(4); } void func_803867F4(void){ @@ -149,7 +149,7 @@ void chAncientOne_update(Actor *this){ mapSpecificFlags_set(sp38, TRUE); if(sp38== 0xB){ if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){ - gcdialog_showText(ASSET_A80_TEXT_ANICIENT_ONES_DONE, 0xE, NULL, this->marker, func_80386850, NULL); + gcdialog_showText(ASSET_A80_DIALOG_ANICIENT_ONES_DONE, 0xE, NULL, this->marker, func_80386850, NULL); } else{ func_80386850(this->marker, 0xA80, -1); @@ -158,7 +158,7 @@ void chAncientOne_update(Actor *this){ else { if(sp38== 7){ if(!jiggyscore_isCollected(JIGGY_46_GV_ANCIENT_ONES)){ - gcdialog_showText(ASSET_A7F_TEXT_ANICIENT_ONES_MEET, 0x4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A7F_DIALOG_ANICIENT_ONES_MEET, 0x4, NULL, NULL, NULL, NULL); } } @@ -167,7 +167,7 @@ void chAncientOne_update(Actor *this){ if(this->unkF4_8 < 5){ D_80390C28[this->unkF4_8]->propPtr->unk8_4 = TRUE; func_802BAFE4(GV_D_80390C20[this->unkF4_8 - 1]); - func_80244BB0(2, 0x86, 0x7ff8, 0.3f); + core1_7090_initSfxSource(2, 0x86, 0x7ff8, 0.3f); timedFunc_set_0(0.45f, func_8038678C); }//L80386DB0 @@ -190,7 +190,7 @@ void chAncientOne_update(Actor *this){ }//L80386D80 } if(LOCAL_CH_ANCIENT_ONE(this)->unk1C <= this->position_y){ - func_80244C78(2); + core1_7090_freeSfxSource(2); timedFunc_set_0(0.5f, func_803867CC); } }//L80386DB0 diff --git a/src/GV/ch/gobi1.c b/src/GV/ch/gobi1.c index 27fa47f1..5d27ceef 100644 --- a/src/GV/ch/gobi1.c +++ b/src/GV/ch/gobi1.c @@ -89,8 +89,8 @@ s32 func_80387360(void){ void func_8038736C(Actor *this){ ActorLocal_chGobi1 *local = (ActorLocal_chGobi1 *)&this->local; chGobi1_setState(this, 0); - func_8030DA44(local->unk0[0]); - func_8030DA44(local->unk0[1]); + sfxsource_freeSfxsourceByIndex(local->unk0[0]); + sfxsource_freeSfxsourceByIndex(local->unk0[1]); } void func_803873B0(ActorMarker *this_marker, ActorMarker *other_marker){ @@ -158,7 +158,7 @@ void chGobi1_update(Actor *this){ timed_playSfx(1.0f, SFX_84_GOBI_CRYING, 1.1f, 30000); timed_playSfx(2.0f, SFX_84_GOBI_CRYING, 1.3f, 30000); timed_playSfx(2.5f, SFX_74_WALKING_NOISE_5, 0.5f, 30000); - func_80324DBC(3.0f, ASSET_A74_TEXT_GOBI_HELPED, 0x2a, this->position, NULL, NULL, NULL); + func_80324DBC(3.0f, ASSET_A74_DIALOG_GOBI_HELPED, 0x2a, this->position, NULL, NULL, NULL); timed_playSfx(5.0f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000); timed_playSfx(5.6f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000); timed_playSfx(6.5f, SFX_2E_BIGBUTT_RUNNING, 1.0f, 20000); diff --git a/src/GV/ch/gobi2.c b/src/GV/ch/gobi2.c index 0a95c9e2..9e78e898 100644 --- a/src/GV/ch/gobi2.c +++ b/src/GV/ch/gobi2.c @@ -85,7 +85,7 @@ void chGobi2_setState(Actor *this, s32 next_state){ timed_playSfx(0.8f, SFX_4B_GULPING, 0.8f, 28000); timed_playSfx(1.4f, SFX_4B_GULPING, 0.8f, 28000); timed_playSfx(2.0f, SFX_4B_GULPING, 0.8f, 28000); - func_80324DBC(3.0f, ASSET_A72_TEXT_TRUNKER_HELPED, 0x2A, D_80390CEC, this->marker, func_80387A2C, NULL); + func_80324DBC(3.0f, ASSET_A72_DIALOG_TRUNKER_HELPED, 0x2A, D_80390CEC, this->marker, func_80387A2C, NULL); }//L80387C94 if(next_state == 4){ @@ -203,7 +203,7 @@ void chGobi2_update(Actor *this){ if(!this->has_met_before){ if(func_80329530(this, 0xFA) && !func_80329530(this, 0x50)){ if(func_8028F2A0()){ - if(gcdialog_showText(ASSET_A75_TEXT_GOBI2_MEET, 0, this->position, NULL, NULL, NULL)) + if(gcdialog_showText(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 7cd9deb8..3633cbae 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_TEXT_GOBI3_DONE, 0xe, this->position, this->marker, __chGobi3_runaway, NULL); + gcdialog_showText(ASSET_A77_DIALOG_GOBI3_DONE, 0xe, this->position, this->marker, __chGobi3_runaway, NULL); } if(next_state == 4){ diff --git a/src/GV/ch/histup.c b/src/GV/ch/histup.c index 70342b4a..d2bf5556 100644 --- a/src/GV/ch/histup.c +++ b/src/GV/ch/histup.c @@ -98,7 +98,7 @@ void func_8038DB88(Actor *this){ if(func_8030E3FC(tmp)){ func_8030E394(this->unk44_31); } - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } } diff --git a/src/GV/ch/mazectrl.c b/src/GV/ch/mazectrl.c index 6c54201e..a5380640 100644 --- a/src/GV/ch/mazectrl.c +++ b/src/GV/ch/mazectrl.c @@ -85,7 +85,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ } if (!levelSpecificFlags_get(LEVEL_FLAG_16_GV_UNKNOWN)) { - gcdialog_showText(ASSET_A82_TEXT_SANDYBUTT_START_MAZE, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A82_DIALOG_SANDYBUTT_START_MAZE, 4, NULL, NULL, NULL, NULL); levelSpecificFlags_set(LEVEL_FLAG_16_GV_UNKNOWN, TRUE); } }//L8038F794 @@ -135,7 +135,7 @@ void __chMazeCtrl_setState(Actor *this, s32 next_state){ func_8025A6EC(COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7fff); if(!levelSpecificFlags_get(LEVEL_FLAG_17_GV_UNKNOWN)){ - gcdialog_showText(ASSET_A83_TEXT_SANDYBUTT_DONE, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(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_TEXT_SANDYBUTT_ENTER, 0, NULL, NULL, NULL, NULL) + && gcdialog_showText(ASSET_A81_DIALOG_SANDYBUTT_ENTER, 0, NULL, NULL, NULL, NULL) ) { levelSpecificFlags_set(LEVEL_FLAG_15_GV_UNKNOWN, TRUE); } diff --git a/src/GV/ch/trunker.c b/src/GV/ch/trunker.c index 8beefe2b..6c22d026 100644 --- a/src/GV/ch/trunker.c +++ b/src/GV/ch/trunker.c @@ -74,7 +74,7 @@ void chTrucker_update(Actor *this){ && !func_80329530(this, 80) && func_8028F2A0() ){ - gcdialog_showText(ASSET_A71_TEXT_TRUNKER_MEET, 0xe, this->position, NULL, NULL, NULL); + gcdialog_showText(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 0180d3d4..29c603dc 100644 --- a/src/GV/code_3630.c +++ b/src/GV/code_3630.c @@ -29,14 +29,14 @@ void func_80389A20(ActorMarker *caller, enum asset_e text_id, s32 arg2){ } void func_80389A60(Actor *this){ - gcdialog_showText(ASSET_A70_TEXT_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); + gcdialog_showText(ASSET_A70_DIALOG_CHARMER_HELPED, 4, NULL, this->marker, func_80389A20, NULL); this->has_met_before = TRUE; subaddie_set_state(this, 5); } void func_80389ABC(Actor *this){ if(this->unk138_23){ - func_80389A20(this->marker, ASSET_A70_TEXT_CHARMER_HELPED, -1); + func_80389A20(this->marker, ASSET_A70_DIALOG_CHARMER_HELPED, -1); } else{ this->unk138_23 = TRUE; @@ -63,7 +63,7 @@ void func_80389B1C(Actor *this){ if(this->state == 1 || this->state == 2){ if(! this->has_met_before && func_80329530(this, 250) && !func_80329530(this, 0x50)){ - gcdialog_showText(ASSET_A6F_TEXT_CHARMER_MEET, 0xe, this->position, NULL, NULL, NULL); + gcdialog_showText(ASSET_A6F_DIALOG_CHARMER_MEET, 0xe, this->position, NULL, NULL, NULL); this->has_met_before = TRUE; mapSpecificFlags_set(0, TRUE); } diff --git a/src/GV/code_3BB0.c b/src/GV/code_3BB0.c index 7e012b3f..1eab7428 100644 --- a/src/GV/code_3BB0.c +++ b/src/GV/code_3BB0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include void GV_func_8038A084(Actor *this); diff --git a/src/GV/code_4740.c b/src/GV/code_4740.c index 3ec5a757..cebc4a72 100644 --- a/src/GV/code_4740.c +++ b/src/GV/code_4740.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -f32 func_80257204(f32, f32, f32, f32); void func_8038B124(Actor *this); /* .data */ diff --git a/src/GV/code_5570.c b/src/GV/code_5570.c index 1f3b6770..1b374d10 100644 --- a/src/GV/code_5570.c +++ b/src/GV/code_5570.c @@ -63,7 +63,7 @@ void func_8038BA08(Actor *this){ if(func_8028ECAC() == BSGROUP_6_TURBO_TALON_TRAINERS) player_stateTimer_set(STATE_TIMER_3_TURBO_TALON, 0.0f); - gcdialog_showText(ASSET_A79_TEXT_GRABBA_DEFEAT, 0xf, this->position, this->marker, func_8038B988, NULL); + gcdialog_showText(ASSET_A79_DIALOG_GRABBA_DEFEAT, 0xf, this->position, this->marker, func_8038B988, NULL); comusic_8025AB44(COMUSIC_57_TURBO_TRAINERS, 7000, 700); } @@ -245,7 +245,7 @@ void GV_func_8038BEA0(Actor *this){ } else{ if(!this->has_met_before){ - if(gcdialog_showText(ASSET_A78_TEXT_GRABBA_MEET, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showText(ASSET_A78_DIALOG_GRABBA_MEET, 0, NULL, NULL, NULL, NULL)){ this->has_met_before = TRUE; } } @@ -276,7 +276,7 @@ void GV_func_8038BEA0(Actor *this){ } if(!this->unk138_23){ - if(gcdialog_showText(ASSET_A7A_TEXT_GRABBA_TOO_FAST, 0, NULL, NULL, NULL, NULL)){ + if(gcdialog_showText(ASSET_A7A_DIALOG_GRABBA_TOO_FAST, 0, NULL, NULL, NULL, NULL)){ this->unk138_23 = TRUE; } } diff --git a/src/GV/code_6370.c b/src/GV/code_6370.c index 8125cfd8..0894465c 100644 --- a/src/GV/code_6370.c +++ b/src/GV/code_6370.c @@ -74,7 +74,7 @@ void func_8038C8A0(Actor *this, s32 next_state){ this->marker->propPtr->unk8_3 = (next_state == 1) ? FALSE : TRUE; this->marker->collidable = (next_state == 1) ? FALSE : TRUE; if(this->state == 4 || this->state == 5) - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); if(next_state == 4 || next_state == 5){ local->sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); diff --git a/src/GV/code_7060.c b/src/GV/code_7060.c index d65b7513..5c928be5 100644 --- a/src/GV/code_7060.c +++ b/src/GV/code_7060.c @@ -38,7 +38,7 @@ void func_8038D47C(Actor *this){ this->spawn_position_y = 2997.0f; this->spawn_position_z = 5884.0f; }//L8038D4FC - tmp_v0 = func_80304CAC(0x32f, this->spawn_position); + tmp_v0 = nodeprop_findByActorIdAndPosition_f32(ACTOR_32F_UNKNOWN, this->spawn_position); if(!tmp_v0){ this->unk1C_x = -1394.0f; this->unk1C_y = 2811.0f; @@ -48,7 +48,7 @@ void func_8038D47C(Actor *this){ nodeprop_getPosition(tmp_v0, this->unk1C); } - tmp_v0 = func_80304CAC(0x330, this->spawn_position); + tmp_v0 = nodeprop_findByActorIdAndPosition_f32(ACTOR_330_UNKNOWN, this->spawn_position); if(!tmp_v0){ this->velocity_x = -1424.0f; this->velocity_y = 2811.0f; @@ -72,8 +72,8 @@ void func_8038D47C(Actor *this){ if(!mapSpecificFlags_get(0x14)){ player_getPosition(sp3C); if(func_8028ECAC() == 0){ - if( ml_distance_vec3f(sp3C, this->unk1C) < 100.0f || ml_distance_vec3f(sp3C, this->velocity) < 100.0f){ - if(gcdialog_showText(ASSET_A7B_TEXT_JINXY_MEET, 0, NULL, NULL, NULL, NULL)){ + 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)){ mapSpecificFlags_set(0x14, 1); } } @@ -102,7 +102,7 @@ void func_8038D47C(Actor *this){ } if( actor_animationIsAt(this, 0.99f) ){ if(--this->unk38_31 == 0){ - gcdialog_showText(ASSET_A7C_TEXT_JINXY_ONE_EGG, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(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_7FF0.c b/src/GV/code_7FF0.c index b458937b..1694e790 100644 --- a/src/GV/code_7FF0.c +++ b/src/GV/code_7FF0.c @@ -1,10 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" #include "actor.h" -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); extern void func_802D3D54(Actor *this); extern void func_802D3D74(Actor *this); extern Actor *func_80325F2C(ActorMarker *this_marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); @@ -177,7 +177,7 @@ void func_8038E460(Actor *this){//banjo_door if(!mapSpecificFlags_get(2)){ mapSpecificFlags_set(2, TRUE); func_8028F918(0); - func_80324DBC(4.0f, ASSET_A7D_TEXT_JINXY_HELPED, 4, NULL, NULL, NULL, NULL); + func_80324DBC(4.0f, ASSET_A7D_DIALOG_JINXY_HELPED, 4, NULL, NULL, NULL, NULL); } } } @@ -231,7 +231,7 @@ void func_8038E648(Actor *this){ func_802BAFE4(2); subaddie_set_state(this, 6); this->unk38_31 = 600; - func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f); func_802D68F0(25); item_set(ITEM_6_HOURGLASS, 1); } @@ -243,7 +243,7 @@ void func_8038E648(Actor *this){ subaddie_set_state(this, 7); this->pitch = 90.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(0); + core1_7090_freeSfxSource(0); } break; @@ -251,7 +251,7 @@ void func_8038E648(Actor *this){ this->unk38_31 -= time_getDelta(); if(this->unk38_31 == 0){ subaddie_set_state(this, 8); - func_80244BB0(0, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7ff8, 0.3f); } break; @@ -262,7 +262,7 @@ void func_8038E648(Actor *this){ this->pitch = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(5, FALSE); - func_80244C78(0); + core1_7090_freeSfxSource(0); volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED); } break; @@ -296,7 +296,7 @@ void func_8038E97C(Actor *this){ this->position_y += 130.0; this->unk38_31 = 30; subaddie_set_state(this, 8); - func_80244BB0(1, 0x6A, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6A, 0x7ff8, 0.3f); } }//L8038EA6C @@ -314,7 +314,7 @@ void func_8038E97C(Actor *this){ this->unk38_31 -= 1; if(this->unk38_31 == 0){ subaddie_set_state(this, 1); - func_80244C78(1); + core1_7090_freeSfxSource(1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); } @@ -330,7 +330,7 @@ void chKazooieDoor_update(Actor *this){ func_8025A6EC(COMUSIC_2B_DING_B, -1); func_802BAFE4(3); subaddie_set_state(this, 6); - func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f); this->unk1C[1] = this->position_y + 210.0f; this->unk1C[0] = this->position_y; } @@ -342,7 +342,7 @@ void chKazooieDoor_update(Actor *this){ if(this->unk1C[1] <= this->position_y){ subaddie_set_state(this, 7); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(1); + core1_7090_freeSfxSource(1); this->unk38_31 = 450; } break; @@ -351,7 +351,7 @@ void chKazooieDoor_update(Actor *this){ this->unk38_31--; if(this->unk38_31 == 0){ subaddie_set_state(this, 8); - func_80244BB0(1, 0x6a, 0x7ff8, 0.3f); + core1_7090_initSfxSource(1, 0x6a, 0x7ff8, 0.3f); } break; @@ -362,7 +362,7 @@ void chKazooieDoor_update(Actor *this){ this->position_y = this->unk1C[0]; subaddie_set_state(this, 1); func_8030E540(SFX_7F_HEAVYDOOR_SLAM); - func_80244C78(1); + core1_7090_freeSfxSource(1); mapSpecificFlags_set(6, FALSE); } break; diff --git a/src/MM/ch/chimpystump.c b/src/MM/ch/chimpystump.c index 7266e0d2..8e6ba542 100644 --- a/src/MM/ch/chimpystump.c +++ b/src/MM/ch/chimpystump.c @@ -8,7 +8,7 @@ /* external function declarations */ void func_80353064(f32 *, f32); void func_802BB3DC(s32, f32, f32); -void func_80244BB0(s32, s32, s32, f32); +void core1_7090_initSfxSource(s32, s32, s32, f32); /* public function declarations */ void chchimpystump_update(Actor *this); @@ -33,7 +33,7 @@ void __chchimpystump_updateShaking(Actor *this) { if (this->unk10_12 == 0) { this->unk10_12 = 1; func_802BB3DC(1, 3.0f, 1.0f); - func_80244BB0(0, 0x6A, 0x7FF8, 0.2f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.2f); }//L80386D0C this->position_x = ((globalTimer_getTime() & 1) * 2) ^ (s32) this->position_x; @@ -67,7 +67,7 @@ void chchimpystump_update(Actor *this) { this->position_y = this->actor_specific_1_f; subaddie_set_state(this, CHIMPY_STUMP_STATE_3_RAISED); func_802BB41C(1); - func_80244C78(0); + core1_7090_freeSfxSource(0); } if ((globalTimer_getTime() & 3) == 2) { diff --git a/src/MM/ch/conga.c b/src/MM/ch/conga.c index 60cfb28e..b04cef54 100644 --- a/src/MM/ch/conga.c +++ b/src/MM/ch/conga.c @@ -140,7 +140,7 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ ){ func_8038708C(actorPtr, 2); if(actorPtr->unk38_31 == 1){ - gcdialog_showText(ASSET_B39_TEXT_CONGA_HIT_BY_EGG, 4, actorPtr->position, 0, 0, 0); + gcdialog_showText(ASSET_B39_DIALOG_CONGA_HIT_BY_EGG, 4, actorPtr->position, 0, 0, 0); } } } @@ -150,12 +150,12 @@ void func_80387168(ActorMarker *marker, ActorMarker *other_marker){ int func_803872EC(void){ s32 text_id = func_803114C4(); - return text_id == ASSET_B37_TEXT_CONGA_SAFE_UP_HERE - || text_id == ASSET_B38_TEXT_CONGA_DEFEAT + return text_id == ASSET_B37_DIALOG_CONGA_SAFE_UP_HERE + || text_id == ASSET_B38_DIALOG_CONGA_DEFEAT || volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE) - || text_id == ASSET_B3B_TEXT_CONGA_ORANGE_PAD_JIGGY - || text_id == ASSET_B45_TEXT_JIGGY_COLLECT_10 - || text_id == ASSET_B51_TEXT_BOTTLES_HOW_TO_EXIT_LEVEL; + || text_id == ASSET_B3B_DIALOG_CONGA_ORANGE_PAD_JIGGY + || text_id == ASSET_B45_DIALOG_JIGGY_COLLECT_10 + || text_id == ASSET_B51_DIALOG_BOTTLES_HOW_TO_EXIT_LEVEL; } void func_80387370(ActorMarker *this, enum asset_e text_id, s32 arg2){ @@ -249,14 +249,14 @@ void func_803876D0(Actor *this){ sp3C = func_80329530(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_TEXT_CONGA_SAFE_UP_HERE, 0, 0, 0, 0, 0) + && gcdialog_showText(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_TEXT_CONGA_MEET_AS_TERMITE : ASSET_B3C_TEXT_CONGA_MEET, 0, this->position, 0,0,0)){ + 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)){ this->has_met_before = TRUE; } } //L80387968 @@ -348,7 +348,7 @@ void func_803876D0(Actor *this){ actor_playAnimationOnce(this); if(actor_animationIsAt(this, 0.99f)){ subaddie_set_state_with_direction(this, 3, 0.0f, 1); - gcdialog_showText(ASSET_B38_TEXT_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); + gcdialog_showText(ASSET_B38_DIALOG_CONGA_DEFEAT, 0xe, this->position, this->marker, func_80387370, NULL); } break; diff --git a/src/MM/ch/jujuhitbox.c b/src/MM/ch/jujuhitbox.c index f9f15a40..7e0edd13 100644 --- a/src/MM/ch/jujuhitbox.c +++ b/src/MM/ch/jujuhitbox.c @@ -138,7 +138,7 @@ void chjujuhitbox_update(Actor *this) { } if (func_80329530(this, 0xfa) && !func_80329530(this, 0x50) && !func_8028ECAC()) { - if (!this->has_met_before && gcdialog_showText(ASSET_B44_TEXT_JUJU_MEET, 0, 0, 0, NULL, NULL)) { + if (!this->has_met_before && gcdialog_showText(ASSET_B44_DIALOG_JUJU_MEET, 0, 0, 0, NULL, NULL)) { this->has_met_before = TRUE; } } diff --git a/src/MM/ch/orange.c b/src/MM/ch/orange.c index ff0aa018..60925a33 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_TEXT_CONGA_HITS_PLAYER, 0, 0, 0, NULL, NULL)) { + gcdialog_showText(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/MMM/ch/loggo.c b/src/MMM/ch/loggo.c index 3513d7f0..95dff097 100644 --- a/src/MMM/ch/loggo.c +++ b/src/MMM/ch/loggo.c @@ -2,9 +2,6 @@ #include "functions.h" #include "variables.h" -/* extern functions */ -extern void ml_vec3f_assign(f32[3], f32, f32, f32); - /* public functions */ void chLoggo_update(Actor *this); @@ -44,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_TEXT_ENTER_LOGGO, 0x2B, this->position, this->marker, &__chLoggo_textCallback, 0) != 0) { + if (gcdialog_showText(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); } @@ -58,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_TEXT_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) { + if (gcdialog_showText(ASSET_ADE_DIALOG_LOGGO_AS_BEAR, 0x2A, this->position, NULL, NULL, NULL)) { fileProgressFlag_set(FILEPROG_88_TRIED_LOGGO_AS_BEAR, TRUE); } } @@ -84,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_TEXT_EXIT_LOGGO, 4, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(ASSET_AE0_DIALOG_EXIT_LOGGO, 4, NULL, NULL, NULL, NULL)) { fileProgressFlag_set(FILEPROG_8A_EXITED_LOGGO, TRUE); } } diff --git a/src/MMM/ch/napper.c b/src/MMM/ch/napper.c index da82b62d..496637db 100644 --- a/src/MMM/ch/napper.c +++ b/src/MMM/ch/napper.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct{ ActorMarker *jiggy_marker; diff --git a/src/MMM/code_16B0.c b/src/MMM/code_16B0.c index 8ac7db39..82411909 100644 --- a/src/MMM/code_16B0.c +++ b/src/MMM/code_16B0.c @@ -210,7 +210,7 @@ void chChompa_update(Actor *this) { }//L803880B4 player_getPosition(plyr_position); - plyr_dist = ml_distance_vec3f(this->position, plyr_position); + plyr_dist = ml_vec3f_distance(this->position, plyr_position); if (this->state == CHOMPA_STATE_4_BITING) { actor_collisionOn(this); diff --git a/src/MMM/code_2040.c b/src/MMM/code_2040.c index 763dfc70..b57abd13 100644 --- a/src/MMM/code_2040.c +++ b/src/MMM/code_2040.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" #include "actor.h" extern ActorInfo D_8038BC28; @@ -33,7 +33,7 @@ extern ActorInfo D_8038BEFC; extern ActorInfo D_80367E70; extern ActorInfo D_80372C3C; -extern void func_80244BB0(s32, s32, s32, f32); +extern void core1_7090_initSfxSource(s32, s32, s32, f32); extern void func_8025AE0C(s32, f32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void *func_80309B48(f32[3], f32[3], f32[3], u32); @@ -307,7 +307,7 @@ void func_80388BDC(Actor *this) { if(mapSpecificFlags_get(MMM_SPECIFIC_FLAG_0_UNKNOWN)) { func_802BAFE4(0x21); subaddie_set_state(this, 6); - func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_2_UNKNOWN, FALSE); func_8025A6EC(COMUSIC_4_MMM_CLOCK_VERSION, -1); func_8025AE0C(2000, 3.0f); @@ -320,7 +320,7 @@ void func_80388BDC(Actor *this) { subaddie_set_state(this, 7U); this->yaw = 270.0f; func_8030E540(0x7F); - func_80244C78(0); + core1_7090_freeSfxSource(0); func_802D68F0(0xE); item_set(6, 1); } @@ -341,7 +341,7 @@ void func_80388BDC(Actor *this) { func_802BAFE4(0x23); } subaddie_set_state(this, 8); - func_80244BB0(0, 0x6A, 0x7FF8, 0.3f); + core1_7090_initSfxSource(0, 0x6A, 0x7FF8, 0.3f); } break; case 8: @@ -351,7 +351,7 @@ void func_80388BDC(Actor *this) { this->yaw = 0.0f; func_8030E540(SFX_7F_HEAVYDOOR_SLAM); mapSpecificFlags_set(MMM_SPECIFIC_FLAG_0_UNKNOWN, FALSE); - func_80244C78(0); + core1_7090_freeSfxSource(0); if (!this->unk38_31) { func_8025A6EC(COMUSIC_3C_MINIGAME_LOSS, 0x7FF8); func_8025AE0C(0x7D0, 2.5f); diff --git a/src/MMM/code_3420.c b/src/MMM/code_3420.c index 2a15e7f9..d2b65b20 100644 --- a/src/MMM/code_3420.c +++ b/src/MMM/code_3420.c @@ -177,7 +177,7 @@ void func_803898EC() { } void func_80389910() { - gcdialog_showText(ASSET_AD5_TEXT_UNKNOWN, 0xE, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD5_DIALOG_UNKNOWN, 0xE, NULL, NULL, MMM_func_80389810, NULL); timedFunc_set_2(0.0f, func_8025A6EC, COMUSIC_2D_PUZZLE_SOLVED_FANFARE, 0x7FFF); timed_setStaticCameraToNode(2.0f, 0); timedFunc_set_0(2.1f, MMM_func_803898A0); @@ -198,10 +198,10 @@ void organMinigame_setState(s32 next_state){ if (next_state == 2) { if (D_8038C4F0.pattern == 0) { D_8038C4F0.pattern = 1; - gcdialog_showText(ASSET_AD3_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD3_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } else {//L80389A84 - gcdialog_showText(ASSET_AD6_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD6_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); } }//L80389A9C @@ -218,13 +218,13 @@ void organMinigame_setState(s32 next_state){ }//L80389AF4 if(next_state == 4){ - gcdialog_showText(ASSET_ADD_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_ADD_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(D_8038C4F0.motzhand_marker); } if(next_state == 5){ D_8038C4F0.pattern++; - gcdialog_showText(ASSET_AD4_TEXT_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); + gcdialog_showText(ASSET_AD4_DIALOG_UNKNOWN, 4, NULL, NULL, MMM_func_80389810, NULL); func_80387720(D_8038C4F0.motzhand_marker); } @@ -385,7 +385,7 @@ void organMinigame_update(void){ if(func_8038769C(D_8038C4F0.motzhand_marker)){ player_getPosition(plyr_pos); motzhand_2 = marker_getActor(D_8038C4F0.motzhand_marker); - if( ml_distance_vec3f(motzhand_2->position, plyr_pos) < 400.0f + if( ml_vec3f_distance(motzhand_2->position, plyr_pos) < 400.0f && motzhand_2->position_y - 50.0f <= plyr_pos[1] ){ organMinigame_setState(2); diff --git a/src/MMM/code_47D0.c b/src/MMM/code_47D0.c index b2d971d2..943d76ce 100644 --- a/src/MMM/code_47D0.c +++ b/src/MMM/code_47D0.c @@ -1,11 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include /* extern functions */ extern void sfxsource_setSampleRate(u8, s32); -extern f32 ml_vec3f_horizontal_distance_zero_likely(f32[3], f32[3]); /* data */ enum chTumblar_state_e { @@ -120,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_TEXT_UNKNOWN, 4, NULL, arg0->jiggy_marker, __chTumblar_congratulationTextCallback, NULL); + gcdialog_showText(ASSET_ADB_DIALOG_UNKNOWN, 4, NULL, arg0->jiggy_marker, __chTumblar_congratulationTextCallback, NULL); arg0->state = TUMBLAR_STATE_1_CONGRATULATING; } @@ -213,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_TEXT_UNKNOWN, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(ASSET_ADA_DIALOG_UNKNOWN, 0, NULL, NULL, NULL, NULL)) { mapSpecificFlags_set(0, TRUE); } } diff --git a/src/RBB/ch/axle.c b/src/RBB/ch/axle.c index e4627898..2444deca 100644 --- a/src/RBB/ch/axle.c +++ b/src/RBB/ch/axle.c @@ -119,7 +119,7 @@ void func_803890BC(Actor *this){ local->unk1C += 0.25 * sp38; if(1.0f < local->unk1C) local->unk1C = 1.0f; - ml_interpolate_vec3f(sp2C, local->unk4, local->unk10, local->unk1C); + ml_vec3f_interpolate_fast(sp2C, local->unk4, local->unk10, local->unk1C); this->pitch = sp2C[0]; this->yaw = sp2C[1]; this->roll = sp2C[2]; diff --git a/src/RBB/ch/boombox.c b/src/RBB/ch/boombox.c index 3f79a4e9..4433d546 100644 --- a/src/RBB/ch/boombox.c +++ b/src/RBB/ch/boombox.c @@ -4,7 +4,6 @@ #include "core2/particle.h" -extern void ml_interpolate_vec3f(f32 [3], f32 [3], f32 [3], f32); extern void bundle_setYaw(f32); extern int func_80309EB0(f32(*)[3], f32, f32 (*)[3], s32); extern int func_803342AC(f32(*)[3], f32(*)[3],f32); @@ -276,7 +275,7 @@ void func_8038F430(ActorMarker *marker, s32 arg1){ if(actor->state < 3){ player_getPosition(&sp18); - if(ml_distance_vec3f(&actor->position, &sp18) < 300.0f) + if(ml_vec3f_distance(&actor->position, &sp18) < 300.0f) func_8028F55C(5, actor->marker); func_8038F190(actor, 3); }//L8038F4A4 @@ -353,7 +352,7 @@ void func_8038F618(Actor *this){ } func_8038E92C(this); if(this->state == 1){ - if(sp78 && ml_distance_vec3f(&this->position, &sp7C) < 500.0f){ + if(sp78 && ml_vec3f_distance(&this->position, &sp7C) < 500.0f){ func_8038F190(this, 2); } }//L8038F7A0 @@ -372,7 +371,7 @@ void func_8038F618(Actor *this){ skeletalAnim_getProgressRange(this->unk148, &sp6C, &sp68); if(0.1 <= sp68 && sp68 <= 0.6) - ml_interpolate_vec3f(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 ); + ml_vec3f_interpolate_fast(this->position, &local->unk14, &local->unk20, (sp68 - 0.1) /0.5 ); if(sp6C < 0.6 && 0.6 <= sp68) func_8030E878(SFX_6C_LOCKUP_CLOSING, 1.1 + randf2(-0.05f, 0.05f), 20000, this->position, 500.0f, 1000.0f); @@ -387,7 +386,7 @@ void func_8038F618(Actor *this){ this->yaw += (sp44*400.0f)*sp70; if(skeletalAnim_getLoopCount(this->unk148) > 0){ - if(ml_distance_vec3f(&this->position, &local->unk8) < 10.0f){ + if(ml_vec3f_distance(&this->position, &local->unk8) < 10.0f){ func_8038F190(this, 1); }else{ func_8038F190(this, 2); diff --git a/src/RBB/ch/bossboombox.c b/src/RBB/ch/bossboombox.c index b3204aa3..2caec6fb 100644 --- a/src/RBB/ch/bossboombox.c +++ b/src/RBB/ch/bossboombox.c @@ -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_TEXT_UNKNOWN, 4, 0, 0, 0, 0); + gcdialog_showText(ASSET_B9F_DIALOG_UNKNOWN, 4, 0, 0, 0, 0); } }//L8038D278 } @@ -546,7 +546,7 @@ void func_8038D8BC(Actor *this){ } } else{//L8038DAA8 - if(ml_distance_vec3f(this->position, player_position) < 1200.0f){ + if(ml_vec3f_distance(this->position, player_position) < 1200.0f){ RBB_func_8038CC9C(this, 2); } } @@ -582,7 +582,7 @@ void func_8038D8BC(Actor *this){ skeletalAnim_getProgressRange(this->unk148, &sp54, &sp50); if(0.1 <= sp50 && sp50 <= 0.6){ sp4C = (sp50 - 0.1)/0.5; - ml_interpolate_vec3f(this->position, local->unk8, local->unk14, sp4C); + ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, sp4C); this->yaw = local->unk24 + sp4C*(local->unk28 - local->unk24); } @@ -600,7 +600,7 @@ void func_8038D8BC(Actor *this){ tmp_f2 = tmp_f2/0.3; else tmp_f2 = 1.0f; - ml_interpolate_vec3f(this->position, local->unk8, local->unk14, tmp_f2); + ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk14, tmp_f2); } }//L8038DE10 diff --git a/src/RBB/ch/cog.c b/src/RBB/ch/cog.c index c100a461..71d2a457 100644 --- a/src/RBB/ch/cog.c +++ b/src/RBB/ch/cog.c @@ -38,7 +38,7 @@ void func_80388BD0(Actor *this, s32 arg1){ void func_80388BE8(Actor *actor){ ActorLocal_RBB_27E0 *local = (ActorLocal_RBB_27E0 *)&actor->local; if(actor->modelCacheIndex == 0x17b){ - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); } } diff --git a/src/RBB/code_640.c b/src/RBB/code_640.c index 2f361023..3477c064 100644 --- a/src/RBB/code_640.c +++ b/src/RBB/code_640.c @@ -1,9 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "prop.h" #include "actor.h" -#include extern ActorInfo D_80390D20; diff --git a/src/RBB/code_CA0.c b/src/RBB/code_CA0.c index 682cb44a..271f18ba 100644 --- a/src/RBB/code_CA0.c +++ b/src/RBB/code_CA0.c @@ -101,7 +101,7 @@ void func_80387488(ActorMarker *marker){ player_getPosition(&sp1C); if(-50.0f < sp1C[1] && sp1C[1] < 600.0f){ sp1C[1] = 0; - if(ml_distance_vec3f(&sp1C, &D_80390264) < 500.0f){ + if(ml_vec3f_distance(&sp1C, &D_80390264) < 500.0f){ timedFunc_set_1(1.0f, (GenFunction_1) func_80387488, (s32)actor->marker); return; } diff --git a/src/SM/ch/attacktutorial.c b/src/SM/ch/attacktutorial.c index 6e9ec693..ae90094b 100644 --- a/src/SM/ch/attacktutorial.c +++ b/src/SM/ch/attacktutorial.c @@ -2,249 +2,252 @@ #include "functions.h" #include "variables.h" -/* extern functions */ -void timed_exitStaticCamera(f32); -void func_8028F918(s32); +/* chAttackTutorial - controls bottle teaching moves in spiral */ -/* public functions */ -void chAttackTutorial_talk(ActorMarker *); -void chAttackTutorial_setState(Actor *this, s32 state); -void chAttackTutorial_update(Actor *); +extern void timed_exitStaticCamera(f32 time); +extern void func_8028F918(s32); -/* .data */ -enum chAttackTutorial_state_e { - ATTACK_TUTORIAL_STATE_1_UNKNOWN = 1, - ATTACK_TUTORIAL_STATE_2_UNKNOWN, - ATTACK_TUTORIAL_STATE_3_UNKNOWN, - ATTACK_TUTORIAL_STATE_4_UNKNOWN, - ATTACK_TUTORIAL_STATE_5_UNKNOWN +enum ch_attack_tutorial_states { + CH_ATTACK_TUTORIAL_STATE_1_UNKNOWN = 0x1, // L80387610 + CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE, // L803873E0 + CH_ATTACK_TUTORIAL_STATE_3_LEARNED_ALL_MOVES, // L8038742C + CH_ATTACK_TUTORIAL_STATE_4_TUTORIAL_COMPLETED, // L80387454 + CH_ATTACK_TUTORIAL_STATE_5_SHOW_LEARN_MOVE_DIALOG // L80387680 }; -ActorInfo D_8038AC20 = { +static void __chAttackTutorial_showDialogText(ActorMarker *); +static void __chAttackTutorial_setState(Actor* this, enum ch_attack_tutorial_states state); +static void __chAttackTutorial_update(Actor *); + +/* .data */ +ActorInfo gChAttackTutorial = { MARKER_12B_ATTACK_TUTORIAL, ACTOR_167_ATTACK_TUTORIAL, NULL, 1, NULL, - chAttackTutorial_update, actor_update_func_80326224, func_80325340, + __chAttackTutorial_update, actor_update_func_80326224, func_80325340, 0, 0, 0.0f, 0 }; /* .code */ -void __chAttackTutorial_enemy(ActorMarker *marker, enum actor_e enemy_id) { - Actor *actor = marker_getActor(marker); +static void __chAttackTutorial_spawnEnemyActorForMarker(ActorMarker* marker, enum actor_e enemy_id) { + Actor* actor = marker_getActor(marker); s32 pad; - Actor *enemy = spawn_child_actor(enemy_id, &actor); + Actor *other = spawn_child_actor(enemy_id, &actor); - actor->unk100 = enemy->marker; - enemy->unk100 = actor->marker; - - if (actor->unk10_12 == VEGETABLE_3_COLLY_WOBBLE && actor->unk38_31 == 1) { - enemy->unk38_31 = 1; - } - else {//L803871D4 - enemy->unk38_31 = 0; + actor->unk100 = other->marker; + other->unk100 = actor->marker; + if (actor->unk10_12 == 3 && actor->unk38_31 == 1) { + other->unk38_31 = 1; + } else { + other->unk38_31 = 0; } - enemy->unk10_12 = VEGETABLE_1_TOPPER; + other->unk10_12 = 1; if (marker); } -s32 __chAttackTutorial_spawnEnemy(Actor *this, enum vegetable_e vegetable_id) { - volatile enum actor_e enemy_id; - - enemy_id = vegetable_id == VEGETABLE_1_TOPPER ? ACTOR_166_TOPPER_A : - vegetable_id == VEGETABLE_2_BAWL ? ACTOR_165_BAWL_A : ACTOR_164_COLLYWOBBLE_A; - - __spawnQueue_add_2(__chAttackTutorial_enemy, this->marker, enemy_id); +// spawn topper, bawl or collywobble based on already_killed_enemies (actor->unk10_12) +static s32 __chAttackTutorial_spawnEnemyActor(Actor *this, s32 already_killed_enemies) { + volatile enum actor_e sp1C; + s32 tmp_v0; + + if (already_killed_enemies == 1) { + sp1C = ACTOR_166_TOPPER_THE_CARROT_A; + } else { + sp1C = tmp_v0 = (already_killed_enemies == 2) + ? ACTOR_165_BAWL_THE_ONION_A + : ACTOR_164_COLLYWOBBLE_THE_CAULIFLOWER_A; + } + + __spawnQueue_add_2(__chAttackTutorial_spawnEnemyActorForMarker, this->marker, sp1C); + } -void __chAttackTutorial_learnedTextActions(ActorMarker *marker, enum asset_e text_id, s32 arg2) { - chAttackTutorial_setState(marker_getActor(marker), ATTACK_TUTORIAL_STATE_2_UNKNOWN); +static void __chAttackTutorial_advanceMarkToState2(ActorMarker *marker, enum asset_e text_id, s32 arg2) { + __chAttackTutorial_setState(marker_getActor(marker), CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE); } -void __chAttackTutorial_learnedTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { - Actor *actor = marker_getActor(marker); +static void __chAttackTutorial_learnAbilityBasedOnDialog(ActorMarker *marker, enum asset_e dialog_id, s32 arg2) { + Actor* actor = marker_getActor(marker); func_8028F918(0); - - switch (text_id) { - case ASSET_E15_TEXT_UNKNOWN://L803872C8 + switch(dialog_id) { + case ASSET_E15_DIALOG_ATTACK_TUTORIAL_FORWARD_ROLL: ability_unlock(ABILITY_C_ROLL); - chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN); + __chAttackTutorial_setState(actor, CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE); break; - case ASSET_E17_TEXT_UNKNOWN://L803872E4 + case ASSET_E17_DIALOG_ATTACK_TUTORIAL_RATATAT_RAP: ability_unlock(ABILITY_B_RATATAT_RAP); - chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN); + __chAttackTutorial_setState(actor, CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE); break; - }//L803872FC - + } timed_exitStaticCamera(0.0f); } -void chAttackTutorial_setState(Actor *this, s32 state) { - switch (state) { - case ATTACK_TUTORIAL_STATE_5_UNKNOWN: - if (this->unk10_12 == NULL) { +static void __chAttackTutorial_setState(Actor* this, enum ch_attack_tutorial_states state) { + switch (state) + { + 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_TEXT_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnedTextCallback, __chAttackTutorial_learnedTextActions); + gcdialog_showText(ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnAbilityBasedOnDialog, __chAttackTutorial_advanceMarkToState2); } - else { - gcdialog_showText(this->unk10_12 == VEGETABLE_1_TOPPER ? ASSET_E15_TEXT_UNKNOWN : ASSET_E17_TEXT_UNKNOWN, 0xE, this->unk1C, this->marker, __chAttackTutorial_learnedTextCallback, NULL); + else{ + gcdialog_showText( + (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 + ); } break; - case ATTACK_TUTORIAL_STATE_2_UNKNOWN://L803873E0 + case CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE: this->unk38_31 = 0; - __chAttackTutorial_spawnEnemy(this, ++this->unk10_12); + __chAttackTutorial_spawnEnemyActor(this, ++this->unk10_12); break; - case ATTACK_TUTORIAL_STATE_3_UNKNOWN://L8038742C - mapSpecificFlags_set(SM_SPECIFIC_FLAG_5, TRUE); - mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, TRUE); + case CH_ATTACK_TUTORIAL_STATE_3_LEARNED_ALL_MOVES: + mapSpecificFlags_set(SM_SPECIFIC_FLAG_5, 1); + mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, 1); marker_despawn(this->marker); break; - case ATTACK_TUTORIAL_STATE_4_UNKNOWN://L80387454 - mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, TRUE); - - if (!honeycombscore_get(HONEYCOMB_17_SM_COLIWOBBLE)) { - this->unk10_12 = VEGETABLE_3_COLLY_WOBBLE; + case CH_ATTACK_TUTORIAL_STATE_4_TUTORIAL_COMPLETED: + mapSpecificFlags_set(SM_SPECIFIC_FLAG_C, 1); + if (!honeycombscore_get(HONEYCOMB_17_SM_COLLIWOBBLE)) { + this->unk10_12 = 3; this->unk38_31 = 1; - __chAttackTutorial_spawnEnemy(this, this->unk10_12); + __chAttackTutorial_spawnEnemyActor(this, this->unk10_12); } + break; - }//L803874A8 + } subaddie_set_state(this, state); } -int __chAttackTutorial_isEveryAbilitiesUnlocked(void) { - return ability_isUnlocked(ABILITY_4_CLAW_SWIPE) && - ability_isUnlocked(ABILITY_C_ROLL) && - ability_isUnlocked(ABILITY_B_RATATAT_RAP); +static bool __chAttackTutorial_areLearnableAbilitiesUnlocked() { + return ability_isUnlocked(ABILITY_4_CLAW_SWIPE) + && ability_isUnlocked(ABILITY_C_ROLL) + && ability_isUnlocked(ABILITY_B_RATATAT_RAP); } -void chAttackTutorial_update(Actor *this) { - f32 distance_to_bottles; - Actor *bottles_ptr; - - if (!this->initialized) { - bottles_ptr = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &distance_to_bottles); - - if (bottles_ptr != NULL) { - this->unk1C_x = bottles_ptr->position_x; - this->unk1C_y = bottles_ptr->position_y; - this->unk1C_z = bottles_ptr->position_z; - } - else { +static void __chAttackTutorial_update(Actor *this) { + f32 minimum_distance; + Actor *bottles; + + if (!this->initialized) { + bottles = actorArray_findClosestActorFromActorId(this->position, ACTOR_12B_TUTORIAL_BOTTLES, -1, &minimum_distance); + if (bottles != NULL) { + this->unk1C_x = bottles->position_x; + this->unk1C_y = bottles->position_y; + this->unk1C_z = bottles->position_z; + } else { this->unk1C_x = this->position_x; this->unk1C_y = this->position_y; this->unk1C_z = this->position_z; } - - this->unk10_12 = ability_isUnlocked(ABILITY_C_ROLL) ? VEGETABLE_2_BAWL : - ability_isUnlocked(ABILITY_4_CLAW_SWIPE) ? VEGETABLE_1_TOPPER : NULL; + this->unk10_12 = ability_isUnlocked(ABILITY_C_ROLL) + ? 2 + : ability_isUnlocked(ABILITY_4_CLAW_SWIPE) + ? 1 + : 0; this->initialized = TRUE; } - switch (this->state) { - case ATTACK_TUTORIAL_STATE_1_UNKNOWN://L80387610 - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_4)) { - chAttackTutorial_setState(this, ATTACK_TUTORIAL_STATE_5_UNKNOWN); - } - - if (__chAttackTutorial_isEveryAbilitiesUnlocked() || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) { - chAttackTutorial_setState(this, ATTACK_TUTORIAL_STATE_4_UNKNOWN); - } + switch(this->state) { + case CH_ATTACK_TUTORIAL_STATE_1_UNKNOWN: + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_4)) + __chAttackTutorial_setState(this, CH_ATTACK_TUTORIAL_STATE_5_SHOW_LEARN_MOVE_DIALOG); + + if (__chAttackTutorial_areLearnableAbilitiesUnlocked() || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) + __chAttackTutorial_setState(this, CH_ATTACK_TUTORIAL_STATE_4_TUTORIAL_COMPLETED); break; - case ATTACK_TUTORIAL_STATE_2_UNKNOWN://L80387658 + case CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE: if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_7)) { - chAttackTutorial_talk(this->marker); + __chAttackTutorial_showDialogText(this->marker); mapSpecificFlags_set(SM_SPECIFIC_FLAG_7, FALSE); } break; - case ATTACK_TUTORIAL_STATE_5_UNKNOWN://L80387680 + case CH_ATTACK_TUTORIAL_STATE_5_SHOW_LEARN_MOVE_DIALOG: break; - }////L80387680 + } } -void __chAttackTutorial_attackTextCallback(ActorMarker *marker, enum asset_e text_id, s32 arg2) { +static void __chAttackTutorial_handleDialog(ActorMarker *marker, enum asset_e text_id, s32 arg2) { Actor *actor = marker_getActor(marker); - switch (text_id) { - case ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN: + case ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN: func_8028F918(0); break; - case ASSET_E14_TEXT_UNKNOWN: - case ASSET_E16_TEXT_UNKNOWN: - case ASSET_E18_TEXT_UNKNOWN: - __chAttackTutorial_spawnEnemy(actor, actor->unk10_12); + case ASSET_E14_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL: // WOW...NICE ONE! TRY ANOTHER! + case ASSET_E16_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL: // BULLS-EYE! ONE MORE... + case ASSET_E18_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL: // MMMM...NOT BAD, FEATHER FACE! + __chAttackTutorial_spawnEnemyActor(actor, actor->unk10_12); break; - case ASSET_E15_TEXT_UNKNOWN: + case ASSET_E15_DIALOG_ATTACK_TUTORIAL_FORWARD_ROLL: ability_unlock(ABILITY_C_ROLL); - chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN); + __chAttackTutorial_setState(actor, CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE); break; - case ASSET_E17_TEXT_UNKNOWN: + case ASSET_E17_DIALOG_ATTACK_TUTORIAL_RATATAT_RAP: ability_unlock(ABILITY_B_RATATAT_RAP); - chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_2_UNKNOWN); + __chAttackTutorial_setState(actor, CH_ATTACK_TUTORIAL_STATE_2_APPLY_LEARNED_MOVE); break; - - case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES: - case ASSET_E19_TEXT_UNKNOWN: - chAttackTutorial_setState(actor, ATTACK_TUTORIAL_STATE_3_UNKNOWN); + + case ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES: + case ASSET_E19_DIALOG_ATTACK_TUTORIAL_LEARNED_ALL_MOVES: + __chAttackTutorial_setState(actor, CH_ATTACK_TUTORIAL_STATE_3_LEARNED_ALL_MOVES); break; } - timed_exitStaticCamera(0.0f); } -void chAttackTutorial_talk(ActorMarker *marker) { - s32 text_id; - int try_count; - s32 text_flags = 4; - - Actor *actor = marker_getActor(marker); - try_count = BOOL(actor->unk38_31); - - if (try_count) { - text_flags = 0xE; +static void __chAttackTutorial_showDialogText(ActorMarker* marker) { + s32 dialog_text; + bool has_killed_enemy; + s32 dialog_flag = 0x4; + + Actor* actor = marker_getActor(marker); + + has_killed_enemy = actor->unk38_31 ? TRUE : FALSE; + if (has_killed_enemy) { + dialog_flag = 0xE; } switch (actor->unk10_12) { - case VEGETABLE_1_TOPPER: //L803877D8 - text_id = try_count ? ASSET_E15_TEXT_UNKNOWN : ASSET_E14_TEXT_UNKNOWN; + case VEGETABLE_1_TOPPER: + dialog_text = has_killed_enemy ? ASSET_E15_DIALOG_ATTACK_TUTORIAL_FORWARD_ROLL : ASSET_E14_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL; break; - case VEGETABLE_2_BAWL: //L803877F4 - text_id = try_count ? ASSET_E17_TEXT_UNKNOWN : ASSET_E16_TEXT_UNKNOWN; + case VEGETABLE_2_BAWL: + dialog_text = has_killed_enemy ? ASSET_E17_DIALOG_ATTACK_TUTORIAL_RATATAT_RAP : ASSET_E16_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL; break; - case VEGETABLE_3_COLLY_WOBBLE: //L80387810 - text_id = try_count ? ASSET_E19_TEXT_UNKNOWN : ASSET_E18_TEXT_UNKNOWN; + case VEGETABLE_3_COLLY_WOBBLE: + dialog_text = has_killed_enemy ? ASSET_E19_DIALOG_ATTACK_TUTORIAL_LEARNED_ALL_MOVES : ASSET_E18_DIALOG_ATTACK_TUTORIAL_SUCCESSFUL_KILL; break; default: - //sp34 = actor->unk38_31; break; - }//L8038782C + } - if (text_id == ASSET_E19_TEXT_UNKNOWN) { + if (dialog_text == ASSET_E19_DIALOG_ATTACK_TUTORIAL_LEARNED_ALL_MOVES) { func_8028F94C(2, actor->unk1C); - }//L80387848 + } - if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities() && try_count) { + if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities() && has_killed_enemy) { mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE); - text_id = ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES; - }//L80387898 + dialog_text = ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES; + } - if (try_count) { + if (has_killed_enemy) { timed_setStaticCameraToNode(0.0f, 6); - }//L803878B0 + } - gcdialog_showText(text_id, text_flags, actor->unk1C, actor->marker, __chAttackTutorial_attackTextCallback, NULL); + gcdialog_showText(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 2f276b03..cd3f1b41 100644 --- a/src/SM/ch/jumptutorial.c +++ b/src/SM/ch/jumptutorial.c @@ -17,7 +17,7 @@ enum chJumpTutorial_state_e { JUMP_TUTORIAL_STATE_3_DISAPPEARED }; -ActorInfo D_8038B0B0 = { +ActorInfo gChJumpTutorial = { MARKER_1ED_JUMP_TUTORIAL, ACTOR_3B9_JUMP_TUTORIAL, NULL, 1, NULL, chJumpTutorial_update, actor_update_func_80326224, func_80325340, @@ -32,7 +32,7 @@ void __chJumpTutorial_setStaticCameraToNode4(Actor *this) { void __chJumpTutorial_textCallback(ActorMarker *caller, enum asset_e text_id, s32 arg2) { Actor *actor = marker_getActor(caller); - if (text_id == ASSET_DF9_TEXT_BOTTLES_UNKNOWN || text_id == ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES) { + if (text_id == ASSET_DF9_DIALOG_BOTTLES_UNKNOWN || text_id == ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES) { chJumpTutorial_setState(actor, JUMP_TUTORIAL_STATE_3_DISAPPEARED); } @@ -56,8 +56,8 @@ void chJumpTutorial_setState(Actor *this, s32 state) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_A_HOLD_A_JUMP_HIGHER); - gcdialog_showText(ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); - this->sm_4070.dialog_id = ASSET_E1A_TEXT_BOTTLES_UNKNOWN; + gcdialog_showText(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); } break; @@ -112,8 +112,8 @@ void chJumpTutorial_update(Actor *this) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_7_FEATHERY_FLAP); - gcdialog_showText(ASSET_DF7_TEXT_BOTTLES_FEATHERY_FLAP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); - this->sm_4070.dialog_id = ASSET_E1B_TEXT_BOTTLES_UNKNOWN; + gcdialog_showText(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,8 +121,8 @@ void chJumpTutorial_update(Actor *this) { __chJumpTutorial_setStaticCameraToNode4(this); ability_unlock(ABILITY_8_FLAP_FLIP); - gcdialog_showText(ASSET_DF8_TEXT_BOTTLES_FLAP_FLIP_LEARN, 0xa, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); - this->sm_4070.dialog_id = ASSET_E1C_TEXT_BOTTLES_UNKNOWN; + gcdialog_showText(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 @@ -132,10 +132,10 @@ void chJumpTutorial_update(Actor *this) { if (!mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED) && chmole_learnedAllSpiralMountainAbilities()) { mapSpecificFlags_set(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED, TRUE); - dialog_id = ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES; + dialog_id = ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES; } else { - dialog_id = ASSET_DF9_TEXT_BOTTLES_UNKNOWN; + dialog_id = ASSET_DF9_DIALOG_BOTTLES_UNKNOWN; } gcdialog_showText(dialog_id, 0xe, this->unk1C, this->marker, __chJumpTutorial_textCallback, NULL); diff --git a/src/SM/ch/smbottles.c b/src/SM/ch/smbottles.c index 48f41e98..7532044e 100644 --- a/src/SM/ch/smbottles.c +++ b/src/SM/ch/smbottles.c @@ -6,7 +6,7 @@ Actor *func_802D94B4(ActorMarker *, Gfx **, Mtx **, Vtx **); void func_8028E668(f32 *, f32, f32, f32); void func_80328FB0(Actor *, f32); -void func_8030DA44(u8); +void sfxsource_freeSfxsourceByIndex(u8); void timed_exitStaticCamera(f32); void subaddie_set_state_with_direction(Actor *, s32, f32, s32); @@ -40,7 +40,7 @@ ActorAnimationInfo chSmBottlesAnimations[6] = { {ASSET_13A_ANIM_BOTTLES_ENTER, 2000000000.0f} }; -ActorInfo chBottles = { +ActorInfo gChBottles = { MARKER_B7_TUTORIAL_BOTTLES, ACTOR_12B_TUTORIAL_BOTTLES, ASSET_387_MODEL_BOTTLES, 1, chSmBottlesAnimations, chSmBottles_update, actor_update_func_80326224, func_802D94B4, @@ -48,14 +48,14 @@ ActorInfo chBottles = { }; ChSmBottlesDialog chSmBottlesDialogTable[8] = { - {ASSET_DF3_TEXT_BOTTLES_INTRODUCTION, ASSET_E08_TEXT_BOTTLES_FIND_ANOTHER_MOLEHILL, 0x1, -1}, - {ASSET_DF4_TEXT_BOTTLES_CAMERA_CONTROL_LEARN, ASSET_DF5_TEXT_BOTTLES_CAMERA_CONTROL_REFRESHER, 0x3, ABILITY_3_CAMERA_CONTROL}, - {ASSET_DFB_TEXT_BOTTLES_DIVE_LEARN, ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER, 0x5, ABILITY_F_DIVE}, - {-1, ASSET_E00_TEXT_BOTTLES_ATTACK_REFRESHER, 0x6, ABILITY_B_RATATAT_RAP}, - {ASSET_E04_TEXT_BOTTLES_BEAK_BARGE_LEARN, ASSET_E06_TEXT_BOTTLES_BEAK_BARGE_REFRESHER, 0x8, ABILITY_0_BARGE}, - {-1, ASSET_DFA_TEXT_BOTTLES_JUMP_REFRESHER, 0x4, ABILITY_8_FLAP_FLIP}, - {ASSET_E01_TEXT_BOTTLES_CLIMB_LEARN, ASSET_E03_TEXT_BOTTLES_CLIMB_REFRESHER, 0x7, ABILITY_5_CLIMB}, - {ASSET_E10_TEXT_BOTTLES_BRIDGE_BROKEN, ASSET_E11_TEXT_BOTTLES_BRIDGE_STILL_BROKEN, 0x11, -1}, + {ASSET_DF3_DIALOG_BOTTLES_INTRODUCTION, ASSET_E08_DIALOG_BOTTLES_FIND_ANOTHER_MOLEHILL, 0x1, -1}, + {ASSET_DF4_DIALOG_BOTTLES_CAMERA_CONTROL_LEARN, ASSET_DF5_DIALOG_BOTTLES_CAMERA_CONTROL_REFRESHER, 0x3, ABILITY_3_CAMERA_CONTROL}, + {ASSET_DFB_DIALOG_BOTTLES_DIVE_LEARN, ASSET_DFE_DIALOG_BOTTLES_DIVE_REFRESHER, 0x5, ABILITY_F_DIVE}, + {-1, ASSET_E00_DIALOG_BOTTLES_ATTACK_REFRESHER, 0x6, ABILITY_B_RATATAT_RAP}, + {ASSET_E04_DIALOG_BOTTLES_BEAK_BARGE_LEARN, ASSET_E06_DIALOG_BOTTLES_BEAK_BARGE_REFRESHER, 0x8, ABILITY_0_BARGE}, + {-1, ASSET_DFA_DIALOG_BOTTLES_JUMP_REFRESHER, 0x4, ABILITY_8_FLAP_FLIP}, + {ASSET_E01_DIALOG_BOTTLES_CLIMB_LEARN, ASSET_E03_DIALOG_BOTTLES_CLIMB_REFRESHER, 0x7, ABILITY_5_CLIMB}, + {ASSET_E10_DIALOG_BOTTLES_BRIDGE_BROKEN, ASSET_E11_DIALOG_BOTTLES_BRIDGE_STILL_BROKEN, 0x11, -1}, }; s32 chSmBottlesDialogIndex = 0; @@ -137,7 +137,7 @@ void __chSmBottles_setState(Actor *this, s32 next_state) { this->unk138_23 = 0; case SM_BOTTLES_STATE_2_UNKNOWN://L80389004 - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; break; @@ -241,43 +241,43 @@ 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_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, __chSmBottles_textCallback, NULL); + gcdialog_showText(ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES, 0xe, actor->position, actor->marker, __chSmBottles_textCallback, NULL); }//L8038933C else { - if (!(text_id == ASSET_DF3_TEXT_BOTTLES_INTRODUCTION || text_id == ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER || text_id == ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT)) { + 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)) { timed_exitStaticCamera(0.0f); } switch (text_id) { - case ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED: + case ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED: break; - case ASSET_DF3_TEXT_BOTTLES_INTRODUCTION: /* 2FB8 803893A8 3C188039 */ - gcdialog_showText(ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER, 0x8e, actor->position, actor->marker, __chSmBottles_textCallback, __chSmBottles_textActions); + 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); break; - case ASSET_E1F_TEXT_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */ + case ASSET_E1F_DIALOG_BOTTLES_TUTORIAL_OFFER: /* 2FEC 803893DC 9209003B */ actor->unk38_0 = TRUE; break; - case ASSET_E1D_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */ + case ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT: /* 2FFC 803893EC 920B0138 */ actor->has_met_before = FALSE; actor->lifetime_value = 0.0f; break; - case ASSET_DF6_TEXT_BOTTLES_HIGH_JUMP_LEARN: /* 3014 80389404 0C0A3E46 */ - case ASSET_DFF_TEXT_BOTTLES_CLAW_SWIPE_LEARN: /* 3014 80389404 0C0A3E46 */ + case ASSET_DF6_DIALOG_BOTTLES_HIGH_JUMP_LEARN: /* 3014 80389404 0C0A3E46 */ + case ASSET_DFF_DIALOG_BOTTLES_CLAW_SWIPE_LEARN: /* 3014 80389404 0C0A3E46 */ func_8028F918(0); break; - case ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL: - case ASSET_E12_TEXT_BOTTLES_LEARNED_TUTORIAL_MOVES: + case ASSET_E09_DIALOG_BOTTLES_SKIPPED_TUTORIAL: + case ASSET_E12_DIALOG_BOTTLES_LEARNED_TUTORIAL_MOVES: __chSmBottles_setState(actor, SM_BOTTLES_STATE_4_UNKNOWN); break; default: if (actor->state != SM_BOTTLES_STATE_5_UNKNOWN) { - gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 0x4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, 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); @@ -291,11 +291,11 @@ void __chSmBottles_getRefresherDialog(Actor *this, s32 *text_id, s32 *text_flags // Gives the player the ability if not learned. if (ability_isUnlocked(chSmBottlesDialogTable[this->unkF4_8 - 1].ability)) { if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) { - *text_id = chSmBottlesDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1; + *text_id = chSmBottlesDialogIndex + ASSET_E0A_DIALOG_BOTTLES_REFUSE_HELP_1; chSmBottlesDialogIndex++; chSmBottlesDialogIndex = MIN(chSmBottlesDialogIndex, 5); - if (*text_id != ASSET_E0E_TEXT_BOTTLES_REFUSE_HELP_5) { + if (*text_id != ASSET_E0E_DIALOG_BOTTLES_REFUSE_HELP_5) { *text_flags |= 1; } } @@ -303,8 +303,8 @@ void __chSmBottles_getRefresherDialog(Actor *this, s32 *text_id, s32 *text_flags *text_flags |= 1; *text_id = chSmBottlesDialogTable[this->unkF4_8 - 1].refresher_text_id; - if (*text_id == ASSET_DFE_TEXT_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)) { - *text_id = ASSET_DFD_TEXT_BOTTLES_SWIM_LEARN; + if (*text_id == ASSET_DFE_DIALOG_BOTTLES_DIVE_REFRESHER && !ability_hasUsed(ABILITY_3_CAMERA_CONTROL)) { + *text_id = ASSET_DFD_DIALOG_BOTTLES_SWIM_LEARN; } } } @@ -327,7 +327,7 @@ void __chSmBottles_talk(Actor *this) { text_flags |= 1; if (fileProgressFlag_get(FILEPROG_DB_SKIPPED_TUTORIAL)) { - text_id = chSmBottlesDialogIndex + ASSET_E0A_TEXT_BOTTLES_REFUSE_HELP_1; + text_id = chSmBottlesDialogIndex + ASSET_E0A_DIALOG_BOTTLES_REFUSE_HELP_1; chSmBottlesDialogIndex++; chSmBottlesDialogIndex = MIN(chSmBottlesDialogIndex, 5); } @@ -344,11 +344,11 @@ void __chSmBottles_talk(Actor *this) { case 8://L80389720 if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_3_ALL_SM_ABILITIES_LEARNED)) { if (fileProgressFlag_get(FILEPROG_A6_FURNACE_FUN_COMPLETE)) { - text_id = ASSET_E37_TEXT_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN; + text_id = ASSET_E37_DIALOG_BOTTLES_STOP_WASTING_TIME_AFTER_FURNACE_FUN; text_flags |= 1; } else if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_F)) { //L80389758 - text_id = ASSET_E0F_TEXT_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN; + text_id = ASSET_E0F_DIALOG_BOTTLES_STOP_WASTING_TIME_BEFORE_FURNACE_FUN; text_flags |= 1; } else {//L80389780 @@ -418,7 +418,7 @@ void __chSmBottles_free(Actor *this) { u8 tmp = this->unk44_31; if (tmp) { - func_8030DA44(tmp); + sfxsource_freeSfxsourceByIndex(tmp); } } @@ -495,7 +495,7 @@ void chSmBottles_update(Actor *this) { (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)) ) {//L80389C50 - if (((ml_distance_vec3f(plyr_pos, this->unk1C) < this->actor_specific_1_f) && func_8028F20C()) || + 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)) { @@ -610,7 +610,7 @@ void chSmBottles_update(Actor *this) { if (button_pressed != -1) { fileProgressFlag_set(FILEPROG_DB_SKIPPED_TUTORIAL, button_pressed ? 0 : 1); - gcdialog_showText(button_pressed ? ASSET_E07_TEXT_BOTTLES_UNKNOWN : ASSET_E09_TEXT_BOTTLES_SKIPPED_TUTORIAL, 0xe, this->position, this->marker, __chSmBottles_textCallback,__chSmBottles_textActions); + gcdialog_showText(button_pressed ? ASSET_E07_DIALOG_BOTTLES_UNKNOWN : ASSET_E09_DIALOG_BOTTLES_SKIPPED_TUTORIAL, 0xe, this->position, this->marker, __chSmBottles_textCallback,__chSmBottles_textActions); if (!button_pressed) { __chSmBottles_skipIntroTutorial(); @@ -619,7 +619,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_TEXT_BOTTLES_TUTORIAL_OFFER_WAIT, 0x86, this->position, this->marker, __chSmBottles_textCallback, NULL); + gcdialog_showText(ASSET_E1D_DIALOG_BOTTLES_TUTORIAL_OFFER_WAIT, 0x86, this->position, this->marker, __chSmBottles_textCallback, NULL); this->has_met_before = TRUE; } } diff --git a/src/SM/ch/vegetables.c b/src/SM/ch/vegetables.c index 83993e8c..4e826891 100644 --- a/src/SM/ch/vegetables.c +++ b/src/SM/ch/vegetables.c @@ -2,262 +2,252 @@ #include "functions.h" #include "variables.h" -/* extern functions */ -f32 mapModel_getFloorY(f32 *); -void spawnQueue_bundle_f32(s32, f32, f32, f32); -void timed_mapSpecificFlags_setTrue(f32, s32); -void subaddie_set_state_with_direction(Actor *, s32, f32, s32); +extern f32 mapModel_getFloorY(f32*); +extern void spawnQueue_bundle_f32(s32, f32, f32, f32); +extern void timed_mapSpecificFlags_setTrue(f32 time, enum sm_specific_flags flag); +extern void subaddie_set_state_with_direction(Actor* , s32, f32, s32); -/* typedefs and declarations */ -enum chVegetables_state_e { - VEGETABLES_STATE_1_UNKNOWN = 1, - VEGETABLES_STATE_2_UNKNOWN, - VEGETABLES_STATE_3_UNKNOWN, - VEGETABLES_STATE_4_UNKNOWN +enum ch_vegetable_type { + CH_VEGETABLE_1_TOPPER = 0x1, + CH_VEGETABLE_2_BAWL, + CH_VEGETABLE_3_COLLIWOBBLE }; -typedef struct ch_vegetable { - TUPLE(f32, unk0); - s32 vegetable_id; - u32 pad10_31: 19; - u32 unk10_12: 4; - u32 pad10_8: 9; -} ChVeg; +enum ch_vegetables_states { + CH_VEGETABLES_STATE_1_UNKNOWN = 0x1, //L803882B0 + CH_VEGETABLES_STATE_2_UNKNOWN, //L803884E4 + CH_VEGETABLES_STATE_3_UNKNOWN, //L80388BFC + CH_VEGETABLES_STATE_4_UNKNOWN //L8038839C +}; -/* public functions */ -Actor *chVegetablesDraw(ActorMarker *, Gfx **, Mtx **, Vtx **); -void chVegetablesUpdate(Actor *); +typedef struct ch_vegatable { + TUPLE(f32, unk0); + enum ch_vegetable_type vegetable_type; + u32 unk10_12; + u32 pad10_31; + u32 pad10_8; +} sChVegetable; + +static Actor* __chVegetables_draw(ActorMarker*, Gfx**, Mtx**, Vtx **); +static void __chVegetables_update(Actor*); /* .data */ -ActorAnimationInfo chTopperAnimations[5] = { - {NULL, 0.0f}, +static ActorAnimationInfo sChCarrotAnimations[5] = { + {NULL, NULL}, {ASSET_223_ANIM_TOPPER_UNKNOWN, 1000000.0f}, {ASSET_223_ANIM_TOPPER_UNKNOWN, 1.0f}, {ASSET_224_ANIM_TOPPER_UNKNOWN, 0.75f}, {ASSET_223_ANIM_TOPPER_UNKNOWN, 1.0f} }; -ActorInfo D_8038AC78 = { - MARKER_12A_TOPPER_A, ACTOR_166_TOPPER_A, ASSET_4ED_MODEL_TOPPER, - 1, chTopperAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesTopperA = { + MARKER_12A_TOPPER_THE_CARROT_A, ACTOR_166_TOPPER_THE_CARROT_A, ASSET_4ED_MODEL_TOPPER, + 1, sChCarrotAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 2000, 0, 1.0f, 0 }; -ActorInfo D_8038AC9C = { - MARKER_1E6_TOPPER_B, ACTOR_TOPPER_B, ASSET_4ED_MODEL_TOPPER, - 1, chTopperAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesTopperB = { + MARKER_1E6_TOPPER_THE_CARROT_B, ACTOR_TOPPER_THE_CARROT_B, ASSET_4ED_MODEL_TOPPER, + 1, sChCarrotAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 2000, 0, 1.0f, 0 }; -ActorAnimationInfo chBawlAnimations[5] = { - {NULL, 0.0f}, +static ActorAnimationInfo sChOnionAnimations[5] = { + {NULL, NULL}, {ASSET_226_ANIM_BAWL_UNKNOWN, 1000000.0f}, {ASSET_226_ANIM_BAWL_UNKNOWN, 1.0f}, {ASSET_227_ANIM_BAWL_UNKNOWN, 0.75f}, {ASSET_226_ANIM_BAWL_UNKNOWN, 1.0f} }; -ActorInfo D_8038ACE8 = { - MARKER_129_BAWL_A, ACTOR_165_BAWL_A, ASSET_4EF_MODEL_BAWL, - 1, chBawlAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesBawlA = { + MARKER_129_BAWL_THE_ONION_A, ACTOR_165_BAWL_THE_ONION_A, ASSET_4EF_MODEL_BAWL, + 1, sChOnionAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 0, 0, 1.0f, 0 }; -ActorInfo D_8038AD0C = { - MARKER_1E7_BAWL_B, ACTOR_BAWL_B, ASSET_4EF_MODEL_BAWL, - 1, chBawlAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesBawlB = { + MARKER_1E7_BAWL_THE_ONION_B, ACTOR_BAWL_THE_ONION_B, ASSET_4EF_MODEL_BAWL, + 1, sChOnionAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 0, 0, 1.0f, 0 }; -ActorAnimationInfo chCollywobbleAnimations[5] = { - {NULL, 0.0f}, +static ActorAnimationInfo sChCauliflowerAnimations[5] = { + {NULL, NULL}, {ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 10000000.0f}, {ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 1.0f}, {ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 10000000.0f}, {ASSET_225_ANIM_COLLYWOBBLE_UNKNOWN, 1.0f} }; -ActorInfo D_8038AD58 = { - MARKER_128_COLLYWOBBLE_A, ACTOR_164_COLLYWOBBLE_A, ASSET_4EE_MODEL_COLLYWOBBLE, - 1, chCollywobbleAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesCollywobbleA = { + MARKER_128_COLLYWOBBLE_THE_CAULIFLOWER_A, ACTOR_164_COLLYWOBBLE_THE_CAULIFLOWER_A, ASSET_4EE_MODEL_COLLYWOBBLE, + 1, sChCauliflowerAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 0, 0, 2.0f, 0 }; -ActorInfo D_8038AD7C = { - MARKER_1E8_COLLYWOBBLE_B, ACTOR_COLLYWOBBLE_B, ASSET_4EE_MODEL_COLLYWOBBLE, - 1, chCollywobbleAnimations, - chVegetablesUpdate, actor_update_func_80326224, chVegetablesDraw, +ActorInfo gChVegetablesCollywobbleB = { + MARKER_1E8_COLLYWOBBLE_THE_CAULIFLOWER_B, ACTOR_COLLYWOBBLE_B, ASSET_4EE_MODEL_COLLYWOBBLE, + 1, sChCauliflowerAnimations, __chVegetables_update, actor_update_func_80326224, __chVegetables_draw, 0, 0, 2.0f, 0 }; -s32 D_8038ADA0[3] = {0xFF, 0xFF, 0xFF}; +static s32 sChVegetablesParticleRGB[3] = {0xFF, 0xFF, 0xFF}; -ParticleScaleAndLifetimeRanges D_8038ADAC = { - {0.1f, 0.5f}, - {1.5f, 3.0f}, - {0.0f, 0.01f}, - {1.0f, 1.5f}, +static ParticleScaleAndLifetimeRanges sD_8038ADAC = { + {0.1f, 0.5f}, + {1.5f, 3.0f}, + {0.0f, 0.01f}, + {1.0f, 1.5f}, 0.0f, 0.01f, }; -ParticleSettingsVelocityPosition D_8038ADD4 = { +static ParticleSettingsVelocityPosition sD_8038ADD4 = { {{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}, - {{-40.0f, -40.0f, -40.0f}, {40.0f, 40.0f, 40.0f}} + {{-40.0f, -40.0f, -40.0f}, {40.0f, 40.0f, 40.0f}} }; -ParticleScaleAndLifetimeRanges D_8038AE04 = { +static ParticleScaleAndLifetimeRanges sD_8038AE04 = { {0.5f, 0.75f}, - {0.4f, 0.6f}, + {0.4f, 0.6f}, {0.0f, 0.01f}, - {4.0f, 4.0f}, + {4.0f, 4.0f}, 0.0f, 0.2f }; -ParticleSettingsVelocityAccelerationPosition D_8038AE2C = { - {{-100.0f, 200.0f, -100.0f}, {100.0f, 400.0f, 100.0f}}, - {{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}}, - {{-80.0f, -80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}} +static ParticleSettingsVelocityAccelerationPosition sD_8038AE2C = { + {{-100.0f, 200.0f, -100.0f}, {100.0f, 400.0f, 100.0f}}, + {{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}}, + {{-80.0f, -80.0f, -80.0f}, {80.0f, 80.0f, 80.0f}} }; -ParticleScaleAndLifetimeRanges D_8038AE74 = { - {1.0f, 1.0f}, - {1.0f, 1.0f}, - {0.0f, 0.01f}, - {2.0f, 2.0f}, +static ParticleScaleAndLifetimeRanges sD_8038AE74 = { + {1.0f, 1.0f}, + {1.0f, 1.0f}, + {0.0f, 0.01f}, + {2.0f, 2.0f}, 0.0f, 0.5f }; -ParticleSettingsVelocityAccelerationPosition D_8038AE9C = { - {{-100.0f, 400.0f, -100.0f}, {100.0f, 600.0f, 100.0f}}, - {{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}}, - {{-20.0f, -20.0f, -20.0f}, {20.0f, 20.0f, 20.0f}} +static ParticleSettingsVelocityAccelerationPosition sD_8038AE9C = { + {{-100.0f, 400.0f, -100.0f}, {100.0f, 600.0f, 100.0f}}, + {{0.0f, -600.0f, 0.0f}, {0.0f, -600.0f, 0.0f}}, + {{-20.0f, -20.0f, -20.0f}, {20.0f, 20.0f, 20.0f}} }; -ParticleScaleAndLifetimeRanges D_8038AEE4 = { - {0.6f, 0.8f}, - {0.5f, 0.7f}, - {0.0f, 0.01f}, - {4.0f, 4.0f}, +static ParticleScaleAndLifetimeRanges sD_8038AEE4 = { + {0.6f, 0.8f}, + {0.5f, 0.7f}, + {0.0f, 0.01f}, + {4.0f, 4.0f}, 0.0f, 0.5f }; -ParticleSettingsVelocityAccelerationPosition D_8038AF0C = { - {{-200.0f, 200.0f, -200.0f}, {200.0f, 600.0f, 200.0f}}, - {{ 0.0f, -900.0f, 0.0f}, { 0.0f, -900.0f, 0.0f}}, - {{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}, +static ParticleSettingsVelocityAccelerationPosition sD_8038AF0C = { + {{-200.0f, 200.0f, -200.0f}, {200.0f, 600.0f, 200.0f}}, + {{0.0f, -900.0f, 0.0f}, {0.0f, -900.0f, 0.0f}}, + {{-100.0f, -100.0f, -100.0f}, {100.0f, 100.0f, 100.0f}}, }; /* .code */ -void __chVegetables_emitDust(ParticleEmitter *pCtrl, f32 *pos, s32 n) { - s32 sp24[3] = D_8038ADA0; - particleEmitter_setRGB(pCtrl, sp24); - particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST); - particleEmitter_setStartingFrameRange(pCtrl, 0, 7); - particleEmitter_setPosition(pCtrl, pos); - particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038ADAC); - particleEmitter_setPositionAndVelocityRanges(pCtrl, &D_8038ADD4); - particleEmitter_emitN(pCtrl, n); +static void __chVegetables_setSpriteDustParticles(ParticleEmitter *emitter, f32 *position, s32 emit_count) { + s32 sp24[3] = sChVegetablesParticleRGB; + particleEmitter_setRGB(emitter, sp24); + particleEmitter_setSprite(emitter, ASSET_700_SPRITE_DUST); + particleEmitter_setStartingFrameRange(emitter, 0, 7); + particleEmitter_setPosition(emitter, position); + particleEmitter_setScaleAndLifetimeRanges(emitter, &sD_8038ADAC); + particleEmitter_setPositionAndVelocityRanges(emitter, &sD_8038ADD4); + particleEmitter_emitN(emitter, emit_count); } -void func_803879B8(ParticleEmitter *pCtrl, f32 *pos, s32 n, enum asset_e model_id) { - particleEmitter_func_802EF9F8(pCtrl, 0.6f); - particleEmitter_func_802EFA18(pCtrl, 2); - particleEmitter_setModel(pCtrl, model_id); - particleEmitter_setPosition(pCtrl, pos); - particleEmitter_setDrawMode(pCtrl, 2); - particleEmitter_setAngularVelocityRange(pCtrl, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); - particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AE04); - particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AE2C); - particleEmitter_emitN(pCtrl, n); +static void __chVegetables_setParticlesForModel(ParticleEmitter *emitter, f32 *position, s32 emit_count, enum asset_e model_id) { + particleEmitter_func_802EF9F8(emitter, 0.6f); + particleEmitter_func_802EFA18(emitter, 2); + particleEmitter_setModel(emitter, model_id); + particleEmitter_setPosition(emitter, position); + particleEmitter_setDrawMode(emitter, 2); + particleEmitter_setAngularVelocityRange(emitter, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); + particleEmitter_setScaleAndLifetimeRanges(emitter, &sD_8038AE04); + particleEmitter_setVelocityAccelerationAndPositionRanges(emitter, &sD_8038AE2C); + particleEmitter_emitN(emitter, emit_count); } -void func_80387A80(ParticleEmitter *pCtrl, f32 *pos, s32 n, enum asset_e model_id) { - particleEmitter_func_802EF9F8(pCtrl, 0.6f); - particleEmitter_func_802EFA18(pCtrl, 3); - particleEmitter_setModel(pCtrl, model_id); - particleEmitter_setPosition(pCtrl, pos); - particleEmitter_setDrawMode(pCtrl, 2); - particleEmitter_setAngularVelocityRange(pCtrl, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); - particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AE74); - particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AE9C); - particleEmitter_emitN(pCtrl, n); +static void __chVegetables_setParticlesForModel2(ParticleEmitter *emitter, f32 *position, s32 emit_count, enum asset_e model_id) { + particleEmitter_func_802EF9F8(emitter, 0.6f); + particleEmitter_func_802EFA18(emitter, 3); + particleEmitter_setModel(emitter, model_id); + particleEmitter_setPosition(emitter, position); + particleEmitter_setDrawMode(emitter, 2); + particleEmitter_setAngularVelocityRange(emitter, -300.0f, -300.0f, -300.0f, 300.0f, 300.0f, 300.0f); + particleEmitter_setScaleAndLifetimeRanges(emitter, &sD_8038AE74); + particleEmitter_setVelocityAccelerationAndPositionRanges(emitter, &sD_8038AE9C); + particleEmitter_emitN(emitter, emit_count); } -void func_80387B48(ParticleEmitter *pCtrl, f32 pos[3], s32 n, enum asset_e model_id) { - particleEmitter_func_802EF9F8(pCtrl, 0.7f); - particleEmitter_func_802EFA18(pCtrl, 4); - particleEmitter_setModel(pCtrl, model_id); - particleEmitter_setPosition(pCtrl, pos); - particleEmitter_setDrawMode(pCtrl, 2); - particleEmitter_setAngularVelocityRange(pCtrl, 150.0f, -300.0f, -300.0f, 300.0f, 300.0f, -150.0f); - particleEmitter_setSfx(pCtrl, SFX_1F_HITTING_AN_ENEMY_3, 8000); - particleEmitter_setScaleAndLifetimeRanges(pCtrl, &D_8038AEE4); - particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8038AF0C); - particleEmitter_emitN(pCtrl, n); +static void __chVegetables_setParticlesForHittingEnemyModel(ParticleEmitter *emitter, f32 position[3], s32 emit_count, enum asset_e model_id) { + particleEmitter_func_802EF9F8(emitter, 0.7f); + particleEmitter_func_802EFA18(emitter, 4); + particleEmitter_setModel(emitter, model_id); + particleEmitter_setPosition(emitter, position); + particleEmitter_setDrawMode(emitter, 2); + particleEmitter_setAngularVelocityRange(emitter, 150.0f, -300.0f, -300.0f, 300.0f, 300.0f, -150.0f); + particleEmitter_setSfx(emitter, SFX_1F_HITTING_AN_ENEMY_3, 8000); + particleEmitter_setScaleAndLifetimeRanges(emitter, &sD_8038AEE4); + particleEmitter_setVelocityAccelerationAndPositionRanges(emitter, &sD_8038AF0C); + particleEmitter_emitN(emitter, emit_count); } -void __chVegetables_dieActor(Actor *this) { - ChVeg *local = (ChVeg *) &this->local; - f32 pos[3]; +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); - - if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE) { - pos[0] = this->position_x; - pos[1] = this->position_y; - pos[2] = this->position_z; - pos[1] += 50.0f; - - func_80387B48(partEmitMgr_newEmitter(12), pos, 0xC, ASSET_4F4_MODEL_UNKNOWN); - func_803879B8(partEmitMgr_newEmitter(4), pos, 0x4, ASSET_4F2_MODEL_UNKNOWN); - func_803879B8(partEmitMgr_newEmitter(4), pos, 0x4, ASSET_4F3_MODEL_UNKNOWN); - - pos[1] += 50.0f; - __chVegetables_emitDust(partEmitMgr_newEmitter(8), pos, 8); - }//L80387D18 + if (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) { + particles_position[0] = this->position_x; + particles_position[1] = this->position_y; + particles_position[2] = this->position_z; + particles_position[1] += 50.0f; + __chVegetables_setParticlesForHittingEnemyModel(partEmitMgr_newEmitter(0xC), particles_position, 0xC, ASSET_4F4_MODEL_COLLIWOBBLE_STEM_DEATH); + __chVegetables_setParticlesForModel(partEmitMgr_newEmitter(4), particles_position, 0x4, ASSET_4F2_MODEL_COLLIWOBBLE_LARGE_DEATH); + __chVegetables_setParticlesForModel(partEmitMgr_newEmitter(4), particles_position, 0x4, ASSET_4F3_MODEL_COLLIWOBBLE_SMALL_DEATH); + particles_position[1] += 50.0f; + __chVegetables_setSpriteDustParticles(partEmitMgr_newEmitter(8), particles_position, 8); + } if (this->unk38_31) { this->position_y += 100.0f; - func_802CA1CC(HONEYCOMB_17_SM_COLIWOBBLE); + func_802CA1CC(HONEYCOMB_17_SM_COLLIWOBBLE); __spawnQueue_add_4((GenFunction_4) spawnQueue_bundle_f32, BUNDLE_1F_SM_EMPTY_HONEYCOMB, reinterpret_cast(s32, this->position_x), reinterpret_cast(s32, this->position_y), reinterpret_cast(s32, this->position_z)); - }//L80387D64 + } timed_mapSpecificFlags_setTrue(1.5f, SM_SPECIFIC_FLAG_7); actor_collisionOff(this); - - if (local->vegetable_id != VEGETABLE_3_COLLY_WOBBLE) { - subaddie_set_state_with_direction(this, VEGETABLES_STATE_3_UNKNOWN, 0.0f, 1); + if (local->vegetable_type != CH_VEGETABLE_3_COLLIWOBBLE) { + subaddie_set_state_with_direction(this, CH_VEGETABLES_STATE_3_UNKNOWN, 0.0f, 1); actor_playAnimationOnce(this); - } - else { + } else { marker_despawn(this->marker); } } -void __chVegetables_die(ActorMarker *marker, ActorMarker *other_marker) { - __chVegetables_dieActor(marker_getActor(marker)); +static void __chVegetables_vegetableMarkerDeathParticles(ActorMarker* marker, ActorMarker* other_marker) { + __chVegetables_vegetableDeathParticles(marker_getActor(marker)); } -Actor *chVegetablesDraw(ActorMarker *marker, Gfx **gdl, Mtx **mptr, Vtx **arg3) { - Actor *actor = marker_getActor(marker); +static Actor* __chVegetables_draw(ActorMarker* marker, Gfx **gdl, Mtx **mptr, Vtx **arg3) { + Actor* actor = marker_getActor(marker); - if (actor->has_met_before) { + if (actor->has_met_before) func_8033A470(3, 7); - } - else { + else func_8033A45C(3, 0); - } return actor_draw(marker, gdl, mptr, arg3); } -void func_80387E64(Actor *this) { - ChVeg *local = (ChVeg *) &this->local; +static void __chVegetables_moveVegetable(Actor* this) { + sChVegetable* local = (sChVegetable*)&this->local; this->unk1C_x = randf2(-50.0f, 50.0f); this->unk1C_y = randf2(-50.0f, 50.0f); @@ -268,293 +258,257 @@ void func_80387E64(Actor *this) { this->unk1C_z = local->unk0_z + this->unk1C_z; } -void func_80387F00(Actor *this) { - ChVeg *local = (ChVeg *) &this->local; - - this->position_y += mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) ? 120.0 : 180.0; - +static void __chVegetables_elevateAndMoveVegetable(Actor* this) { + sChVegetable* local = (sChVegetable*)&this->local; + + this->position_y += ( + mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || + volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) + ) ? 120.0 : 180.0; local->unk0_x = this->position_x; local->unk0_y = this->position_y; local->unk0_z = this->position_z; - this->velocity_x = 0.0f; this->velocity_y = 0.0f; this->velocity_z = 0.0f; - - func_80387E64(this); + __chVegetables_moveVegetable(this); } -int func_80387FA8(Actor *this, ChVeg *local, s32 yaw, s32 arg3) { +// determine some kind of position logic +static bool __chVegetables_func_80387FA8(Actor* this, sChVegetable* local, s32 yaw, s32 arg3) { f32 sp24[3]; f32 sp18[3]; - + sp18[0] = arg3; sp18[1] = 0.0f; sp18[2] = 0.0f; - ml_vec3f_yaw_rotate_copy(sp18, sp18, yaw - 90.0); sp24[0] = sp18[0] + local->unk0_x; sp24[1] = sp18[1] + local->unk0_y; sp24[2] = sp18[2] + local->unk0_z; - if (func_80307258(sp24, this->unk10_25 - 1, this->unk10_18 - 1) == -1) { - return 0; - } - else { - return 1; - } + if (func_80307258(sp24, this->unk10_25 - 1, this->unk10_18 - 1) == -1) + return FALSE; + else + return TRUE; } -void chVegetablesUpdate(Actor *this) { +static void __chVegetables_update(Actor* this) { f32 temp_velZ; f32 temp_velX; f32 temp_f0; - f32 tick; + f32 sp78; f32 sp6C[3]; f32 sp60[3]; - f32 position[3]; - ChVeg *local = (ChVeg *) &this->local; //sp38 - f32 unused; + f32 sp54[3]; + sChVegetable* local = (sChVegetable*)&this->local; //sp38 + f32 sp30; if (!this->initialized) { - switch (this->marker->id) { + switch(this->marker->id) { default: - local->vegetable_id = VEGETABLE_3_COLLY_WOBBLE; //cauliflower + local->vegetable_type = CH_VEGETABLE_3_COLLIWOBBLE; break; - case MARKER_12A_TOPPER_A: //L803880F0 - case MARKER_1E6_TOPPER_B: //L803880F0 - local->vegetable_id = VEGETABLE_1_TOPPER; //carrot + case MARKER_12A_TOPPER_THE_CARROT_A: + case MARKER_1E6_TOPPER_THE_CARROT_B: + local->vegetable_type = CH_VEGETABLE_1_TOPPER; break; - case MARKER_129_BAWL_A: //L80388100 - case MARKER_1E7_BAWL_B: //L80388100 - local->vegetable_id = VEGETABLE_2_BAWL; //onion + case MARKER_129_BAWL_THE_ONION_A: + case MARKER_1E7_BAWL_THE_ONION_B: + local->vegetable_type = CH_VEGETABLE_2_BAWL; break; } actor_collisionOff(this); - marker_setCollisionScripts(this->marker, NULL, NULL, __chVegetables_die); - + marker_setCollisionScripts(this->marker, NULL, NULL, __chVegetables_vegetableMarkerDeathParticles); this->unk1C_x = this->position_x; this->unk1C_y = this->position_y; this->unk1C_z = this->position_z; this->position_y -= 200.f; - do {//L80388154 + // set temp_velX/Z to > 5 + do{ temp_velX = randf2(-10.0f, 10.0f); - temp_f0 = 0.0f <= temp_velX ? temp_velX : -temp_velX; + temp_f0 = (0.0f <= temp_velX) ? temp_velX : -temp_velX; } while (temp_f0 < 5.0); - do {//L803881AC + do{ temp_velZ = randf2(-10.0f, 10.0f); - temp_f0 = 0.0f <= temp_velZ ? temp_velZ : -temp_velZ; - } while (temp_f0 < 5.0); + temp_f0 = (0.0f <= temp_velZ) ? temp_velZ : -temp_velZ; + } while(temp_f0 < 5.0); this->velocity_x = temp_velX; - this->velocity_y = local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 90.0f : 70.0f; + this->velocity_y = (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) ? 90.0f : 70.0f; this->velocity_z = temp_velZ; - this->has_met_before = TRUE; this->unk138_23 = 0; this->unk38_0 = 0; this->initialized = TRUE; this->scale = 0.5; - }//L80388278 + } - switch (this->state) { - case VEGETABLES_STATE_1_UNKNOWN: //L803882B0 - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get( - VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) || this->unk10_12) {//L803882E4 - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) { //L8038830C - this->unk1C_y += local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 120.0 : 0.0; - } - else {//L80388350 - this->unk1C_y += local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE ? 270.0 : 85.0; - } - //L80388384 - subaddie_set_state(this, VEGETABLES_STATE_4_UNKNOWN); + switch (this->state) + { + case CH_VEGETABLES_STATE_1_UNKNOWN: + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) || this->unk10_12) { + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) { + this->unk1C_y += (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) ? 120.0 : 0.0; + } else { + this->unk1C_y += (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) ? 270.0 : 85.0; } - break; + subaddie_set_state(this, CH_VEGETABLES_STATE_4_UNKNOWN); + } + break; + case CH_VEGETABLES_STATE_4_UNKNOWN: + this->position_x = this->velocity_x + this->position_x; + this->position_y = this->velocity_y + this->position_y; + this->position_z = this->velocity_z + this->position_z; + this->velocity_y -= 5.0f; + this->scale = MIN(this->scale + 0.05, 1.0); + if (this->velocity_y < 0.0f && this->position_y < this->unk1C_y) { + this->position_y = mapModel_getFloorY(this->position); + if (local->vegetable_type == CH_VEGETABLE_3_COLLIWOBBLE) + __chVegetables_elevateAndMoveVegetable(this); - case VEGETABLES_STATE_4_UNKNOWN: //L8038839C - this->position_x = this->velocity_x + this->position_x; - this->position_y = this->velocity_y + this->position_y; - this->position_z = this->velocity_z + this->position_z; + actor_collisionOn(this); + subaddie_set_state(this, CH_VEGETABLES_STATE_2_UNKNOWN); + } - this->velocity_y -= 5.0f; - this->scale = MIN(this->scale + 0.05, 1.0); - - if (this->velocity_y < 0.0f && this->position_y < this->unk1C_y) { - this->position_y = mapModel_getFloorY(this->position); - - if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE) { - func_80387F00(this); - } - - actor_collisionOn(this); - subaddie_set_state(this, VEGETABLES_STATE_2_UNKNOWN); - }//L80388494 - - if (!this->unk138_23) { - if (0.0f < this->position_y) { - FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000); - this->unk138_23 = 1; - this->scale = 1.0f; - } + if (!this->unk138_23) { + if (0.0f < this->position_y) { + FUNC_8030E8B4(SFX_C5_TWINKLY_POP, 1.0f, 32000, this->position, 1000, 2000); + this->unk138_23 = 1; + this->scale = 1.0f; } - break; + } - case VEGETABLES_STATE_2_UNKNOWN: //L803884E4 - if (this->unk38_0) { - if (func_80329480(this)) { - this->unk38_0 = 0; - } + break; + case CH_VEGETABLES_STATE_2_UNKNOWN: + if (this->unk38_0) { + if (func_80329480(this)) { + this->unk38_0 = 0; } - else {//L80388520 - if (local->vegetable_id == VEGETABLE_1_TOPPER) { - this->actor_specific_1_f = 3.0f; - - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) {//L80388554 - if (!func_80329030(this, 0) && func_80329480(this)) { - func_80328CEC(this, (s32) this->yaw, 0x78, 0xb4); - this->unk38_0 = 1; - }//L803885A0 - - if (func_803292E0(this)) { - this->yaw_ideal = func_80329784(this); - }//L803885CC - else if (randf() < 0.02) { - func_80328CEC(this, (s32) this->yaw, 0x1E, 0x5A); - }//L80388B68 - } - else {//L80388618 - this->yaw_ideal = func_80329784(this); - } - } - else if (local->vegetable_id == VEGETABLE_2_BAWL) {//L80388634 - this->actor_specific_1_f = 4.0f; - + } else { + if (local->vegetable_type == CH_VEGETABLE_1_TOPPER) { + this->actor_specific_1_f = 3.0f; + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE)) {//L80388554 if (!func_80329030(this, 0) && func_80329480(this)) { - func_80328CEC(this, (s32) this->yaw, 0x78, 0xB4); + func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4); this->unk38_0 = 1; - }//L80388698 - - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) && func_803292E0( - this))) { - this->yaw_ideal = func_80329784(this); - }//L803886E4 - else if (randf() < 0.02) {//D_8038B1D0){ - func_80328CEC(this, (s32) this->yaw, 0x1E, 0x5A); } - } - else {//L80388730 - tick = time_getDelta(); - - sp6C[0] = this->unk1C_x - this->position_x; - sp6C[1] = this->unk1C_y - this->position_y; - sp6C[2] = this->unk1C_z - this->position_z; - - if (LENGTH_VEC3F(sp6C) < 40.0f) { - ml_vec3f_set_length(sp6C, 400.0f); + if (func_803292E0(this)) { + this->yaw_ideal = func_80329784(this); } else { - ml_vec3f_set_length(sp6C, 100.0f); - } - - this->position_x += this->velocity_x * tick + sp6C[0] * tick * tick; - this->position_y += this->velocity_y * tick + sp6C[1] * tick * tick; - this->position_z += this->velocity_z * tick + sp6C[2] * tick * tick; - - this->velocity_x += sp6C[0] * tick; - this->velocity_y += sp6C[1] * tick; - this->velocity_z += sp6C[2] * tick; - - if (gu_sqrtf(SQ(this->velocity_z) + (SQ(this->velocity_x) + SQ(this->velocity_y))) > 50.0f) { - ml_vec3f_set_length(this->velocity, 50.0f); - } - - if (ml_distance_vec3f(this->position, this->unk1C) < 20.0f) { - func_80387E64(this); - } - - this->actor_specific_1_f = 5.0f; - - if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))) { //L8038892C - if (!func_80387FA8(this, local, (s32) this->yaw, (s32) this->actor_specific_1_f)) { - if (func_80329480(this)) { - func_80328CEC(this, (s32) this->yaw, 0x78, 0xb4); - this->unk38_0 = 1; - }//L80388994 - } - else { //L803889A0 - this->position_x -= local->unk0_x; - this->position_y -= local->unk0_y; - this->position_z -= local->unk0_z; - - this->unk1C_x -= local->unk0_x; - this->unk1C_y -= local->unk0_y; - this->unk1C_z -= local->unk0_z; - - TUPLE_ASSIGN(sp60, this->actor_specific_1_f, 0.0f, 0.0f) - ml_vec3f_yaw_rotate_copy(sp60, sp60, this->yaw - 90.0); - - local->unk0_x = sp60[0] + local->unk0_x; - local->unk0_y = sp60[1] + local->unk0_y; - local->unk0_z = sp60[2] + local->unk0_z; - - this->position_x = local->unk0_x + this->position_x; - this->position_y = local->unk0_y + this->position_y; - this->position_z = local->unk0_z + this->position_z; - - this->unk1C_x = local->unk0_x + this->unk1C_x; - this->unk1C_y = local->unk0_y + this->unk1C_y; - this->unk1C_z = local->unk0_z + this->unk1C_z; - }//L80388AD8 - - if (func_803292E0(this)) { - this->yaw_ideal = func_80329784(this); - }//L80388B04 - else if (randf() < 0.01) { - func_80328CEC(this, (s32) this->yaw, 0x1e, 0x5A); + if (randf() < 0.02) { + func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A); } } - else { //L80388B50 + } + else { + this->yaw_ideal = func_80329784(this); + } + } + else if (local->vegetable_type == CH_VEGETABLE_2_BAWL) { + this->actor_specific_1_f = 4.0f; + if (!func_80329030(this, 0) && func_80329480(this)) { + func_80328CEC(this, (s32)this->yaw, 0x78, 0xB4); + this->unk38_0 = 1; + } + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) && func_803292E0(this))) { + this->yaw_ideal = func_80329784(this); + } else { + if (randf() < 0.02) { + func_80328CEC(this, (s32)this->yaw, 0x1E, 0x5A); + } + } + } else { + sp78 = time_getDelta(); + sp6C[0] = this->unk1C_x - this->position_x; + sp6C[1] = this->unk1C_y - this->position_y; + sp6C[2] = this->unk1C_z - this->position_z; + if (LENGTH_VEC3F(sp6C) < 40.0f) { + ml_vec3f_set_length(sp6C, 400.0f); + } + else { + ml_vec3f_set_length(sp6C, 100.0f); + } + this->position_x += this->velocity_x*sp78 + sp6C[0]*sp78*sp78; + this->position_y += this->velocity_y*sp78 + sp6C[1]*sp78*sp78; + this->position_z += this->velocity_z*sp78 + sp6C[2]*sp78*sp78; + this->velocity_x += sp6C[0]*sp78; + this->velocity_y += sp6C[1]*sp78; + this->velocity_z += sp6C[2]*sp78; + if (gu_sqrtf(this->velocity_z*this->velocity_z + (this->velocity_x*this->velocity_x + this->velocity_y*this->velocity_y)) > 50.0f) { + ml_vec3f_set_length(this->velocity, 50.0f); + } + if (ml_vec3f_distance(this->position, this->unk1C) < 20.0f) { + __chVegetables_moveVegetable(this); + } + this->actor_specific_1_f = 5.0f; + if (mapSpecificFlags_get(SM_SPECIFIC_FLAG_C) || (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE))) { //L8038892C + if (!__chVegetables_func_80387FA8(this, local, (s32)this->yaw, (s32)this->actor_specific_1_f)) { + if (func_80329480(this)) { + func_80328CEC(this, (s32)this->yaw, 0x78, 0xb4); + this->unk38_0 = 1; + } + } else { + this->position_x -= local->unk0_x; + this->position_y -= local->unk0_y; + this->position_z -= local->unk0_z; + this->unk1C_x -= local->unk0_x; + this->unk1C_y -= local->unk0_y; + this->unk1C_z -= local->unk0_z; + TUPLE_ASSIGN(sp60, this->actor_specific_1_f, 0.0f, 0.0f); + ml_vec3f_yaw_rotate_copy(sp60, sp60, this->yaw - 90.0); + local->unk0_x = sp60[0] + local->unk0_x; + local->unk0_y = sp60[1] + local->unk0_y; + local->unk0_z = sp60[2] + local->unk0_z; + this->position_x = local->unk0_x + this->position_x; + this->position_y = local->unk0_y + this->position_y; + this->position_z = local->unk0_z + this->position_z; + this->unk1C_x = local->unk0_x + this->unk1C_x; + this->unk1C_y = local->unk0_y + this->unk1C_y; + this->unk1C_z = local->unk0_z + this->unk1C_z; + } + if (func_803292E0(this)) { this->yaw_ideal = func_80329784(this); + } else { + if (randf() < 0.01) { + func_80328CEC(this, (s32)this->yaw, 0x1e, 0x5A); + } } - } - }//L80388B68 - - func_80328FB0(this, 2.0f); - - if (local->vegetable_id != VEGETABLE_3_COLLY_WOBBLE && actor_animationIsAt(this, 0.3f)) { - FUNC_8030E8B4(SFX_3F2_UNKNOWN, 1.0f, 22000, this->position, 1000, 2000); - } - - if (local->vegetable_id == VEGETABLE_3_COLLY_WOBBLE && actor_animationIsAt(this, 0.4f)) { - FUNC_8030E8B4(SFX_2_CLAW_SWIPE, 0.9f, 8000, this->position, 1000, 2000); - } - break; - - case VEGETABLES_STATE_3_UNKNOWN: //L80388BFC - if (actor_animationIsAt(this, local->vegetable_id == VEGETABLE_2_BAWL ? 0.4 : 0.05)) { - position[0] = this->position_x; - position[1] = this->position_y; - position[2] = this->position_z; - - if (local->vegetable_id == VEGETABLE_1_TOPPER) { - position[1] += 150.0f; + } else { + this->yaw_ideal = func_80329784(this); } - this->has_met_before = FALSE; - func_80387A80(partEmitMgr_newEmitter(3), position, 3, - local->vegetable_id == VEGETABLE_1_TOPPER ? ASSET_4F0_MODEL_UNKNOWN : ASSET_4F1_MODEL_UNKNOWN); - }//L80388CC4 - - if (actor_animationIsAt(this, 0.75f)) { - func_80326310(this); } - break; - }//L80388CE0 -}//*/ + } + 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); + + 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); + + break; + case CH_VEGETABLES_STATE_3_UNKNOWN: + if (actor_animationIsAt(this, (local->vegetable_type == CH_VEGETABLE_2_BAWL) ? 0.4 : 0.05)) { + sp54[0] = this->position_x; + sp54[1] = this->position_y; + sp54[2] = this->position_z; + if (local->vegetable_type == CH_VEGETABLE_1_TOPPER) + sp54[1] += 150.0f; + this->has_met_before = FALSE; + __chVegetables_setParticlesForModel2(partEmitMgr_newEmitter(3), sp54, 3, (local->vegetable_type == CH_VEGETABLE_1_TOPPER) ? ASSET_4F0_MODEL_TOPPER_UNKNOWN: ASSET_4F1_MODEL_BAWL_OR_COLLIWOBBLE_UNKNOWN); + } + + if (actor_animationIsAt(this, 0.75f)) + func_80326310(this); + break; + } +} diff --git a/src/SM/code_44D0.c b/src/SM/code_44D0.c index 62905d89..0d1bd775 100644 --- a/src/SM/code_44D0.c +++ b/src/SM/code_44D0.c @@ -40,7 +40,7 @@ void func_8038A8F8(Actor *this){ this->volatile_initialized = TRUE; }//L8038A968 player_getPosition(this->velocity); - sp2C = ml_distance_vec3f(this->velocity, this->position); + sp2C = ml_vec3f_distance(this->velocity, this->position); if(sp2C < (f32) this->unkF4_8) func_80388D48(); @@ -48,7 +48,7 @@ void func_8038A8F8(Actor *this){ 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_distance_vec3f(this->velocity, this->unk1C) / 150.0; + this->yaw_ideal = ml_vec3f_distance(this->velocity, this->unk1C) / 150.0; func_8028F3D8(this->unk1C, this->yaw_ideal, func_8038A8C0, this->marker); mapSpecificFlags_set(SM_SPECIFIC_FLAG_10, TRUE); } diff --git a/src/SM/code_F0.c b/src/SM/code_F0.c index d46ee5b5..83cb6207 100644 --- a/src/SM/code_F0.c +++ b/src/SM/code_F0.c @@ -11,15 +11,15 @@ extern s32 D_80275650; extern ActorInfo D_8038AB00; extern ActorInfo D_8038ABF0; -extern ActorInfo D_8038AC20; //chAttackTutorial -extern ActorInfo D_8038AC78; //chCarrot Slave? -extern ActorInfo D_8038ACE8; //ch onion A -extern ActorInfo D_8038AD58; //ch cauliflower A -extern ActorInfo D_8038AC9C; //chCarrot FreeRange? -extern ActorInfo D_8038AD0C; //ch onion B -extern ActorInfo D_8038AD7C; //ch cauliflower B -extern ActorInfo chBottles; //chSmMole bottles -extern ActorInfo D_8038B0B0; //chJumpTutorial code_4070 +extern ActorInfo gChAttackTutorial; +extern ActorInfo gChVegetablesTopperA; +extern ActorInfo gChVegetablesBawlA; +extern ActorInfo gChVegetablesCollywobbleA; +extern ActorInfo gChVegetablesTopperB; +extern ActorInfo gChVegetablesBawlB; +extern ActorInfo gChVegetablesCollywobbleB; +extern ActorInfo gChBottles; +extern ActorInfo gChJumpTutorial; extern ActorInfo D_8038B0E0; extern ActorInfo D_8038B008; //chBanjosBed extern ActorInfo D_8038B044; //chBanjosChair @@ -142,15 +142,15 @@ void SM_func_80386810(void) { spawnableActorList_add(&D_8038AB00, actor_new, ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); spawnableActorList_add(&D_8038ABF0, actor_new, ACTOR_FLAG_UNKNOWN_7); - spawnableActorList_add(&D_8038AC20, actor_new, ACTOR_FLAG_NONE); - spawnableActorList_add(&D_8038AC78, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&D_8038ACE8, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&D_8038AD58, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&D_8038AC9C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&D_8038AD0C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&D_8038AD7C, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25); - spawnableActorList_add(&chBottles, actor_new, ACTOR_FLAG_UNKNOWN_8); - spawnableActorList_add(&D_8038B0B0, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add(&gChAttackTutorial, actor_new, ACTOR_FLAG_NONE); + spawnableActorList_add(&gChVegetablesTopperA, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChVegetablesBawlA, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChVegetablesCollywobbleA, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChVegetablesTopperB, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChVegetablesBawlB, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChVegetablesCollywobbleB, actor_new, ACTOR_FLAG_UNKNOWN_0 | ACTOR_FLAG_UNKNOWN_5 | ACTOR_FLAG_UNKNOWN_8 | ACTOR_FLAG_UNKNOWN_21 | ACTOR_FLAG_UNKNOWN_25); + spawnableActorList_add(&gChBottles, actor_new, ACTOR_FLAG_UNKNOWN_8); + spawnableActorList_add(&gChJumpTutorial, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&D_8038B0E0, actor_new, ACTOR_FLAG_NONE); spawnableActorList_add(&D_8038B008, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10); spawnableActorList_add(&D_8038B044, actor_new, ACTOR_FLAG_UNKNOWN_3 | ACTOR_FLAG_UNKNOWN_6 | ACTOR_FLAG_UNKNOWN_7 | ACTOR_FLAG_UNKNOWN_9 | ACTOR_FLAG_UNKNOWN_10); diff --git a/src/TTC/ch/blubber.c b/src/TTC/ch/blubber.c index d73a1b50..2bccad31 100644 --- a/src/TTC/ch/blubber.c +++ b/src/TTC/ch/blubber.c @@ -37,10 +37,10 @@ ActorAnimationInfo gChBlubberAnimations[6] = { {ASSET_B8_ANIM_BLUBBER_RUN, 0.8f} }; -ActorInfo gChBlubber = { +ActorInfo gChBlubber = { MARKER_A3_BLUBBER, ACTOR_115_BLUBBER, ASSET_370_MODEL_BLUBBER, - 0x1, gChBlubberAnimations, - __chBlubber_updateFunc, __chBlubber_update2Func, __chBlubber_drawFunc, + 0x1, gChBlubberAnimations, + __chBlubber_updateFunc, __chBlubber_update2Func, __chBlubber_drawFunc, 0, 0x399, 1.8f, 0 }; @@ -63,7 +63,7 @@ static void __chBlubber_showTextCallback(ActorMarker *caller, enum asset_e text_ Actor *this = marker_getActor(caller); ActorLocal_Blubber *local = (ActorLocal_Blubber*)&this->local; - if(text_id == ASSET_A0D_TEXT_BLUBBER_COMPLETE || text_id == ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED){ + if(text_id == ASSET_A0D_DIALOG_BLUBBER_COMPLETE || text_id == ASSET_A2A_BLUBBER_COMPLETE_JIGGY_COLLECTED){ local->unk24 = 0; } else{ @@ -89,7 +89,7 @@ static void __chBlubber_showJiggySpawnedText(ActorMarker *marker){ this->actor_specific_1_f = 0.0f; 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_TEXT_BLUBBER_COMPLETE; + 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); mapSpecificFlags_set(TTC_SPECIFIC_FLAG_2_BLUBBER_JIGGY_SPAWNED_TEXT_SHOWN, TRUE); } @@ -157,16 +157,16 @@ static void __chBlubber_updateFunc(Actor *this){ && !this->has_met_before && item_getCount(ITEM_18_GOLD_BULLIONS) == 0 ){ - gcdialog_showText(ASSET_A0B_TEXT_BLUBBER_FIRST_MEET, 0xe, this->position, this->marker, __chBlubber_showTextCallback, NULL); + gcdialog_showText(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); } - if( mapSpecificFlags_get(TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN) + if( mapSpecificFlags_get(TTC_SPECIFIC_FLAG_0_BLUBBER_UNKNOWN) && !this->unk138_23 ){ if (item_getCount(ITEM_18_GOLD_BULLIONS) == 0) { - gcdialog_showText(ASSET_A0C_TEXT_BLUBBER_HALF_GOLD, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A0C_DIALOG_BLUBBER_HALF_GOLD, 4, NULL, NULL, NULL, NULL); } this->unk138_23 = TRUE; @@ -214,7 +214,7 @@ static void __chBlubber_updateFunc(Actor *this){ __chBlubber_checkJiggySpawnedTextAndAdvanceState(this); break; - case CH_BLUBBER_STATE_3_UNKNOWN: + case CH_BLUBBER_STATE_3_UNKNOWN: break; case CH_BLUBBER_STATE_4_UNKNOWN: diff --git a/src/TTC/ch/clam.c b/src/TTC/ch/clam.c index 417ccf92..869f5e80 100644 --- a/src/TTC/ch/clam.c +++ b/src/TTC/ch/clam.c @@ -3,7 +3,6 @@ #include "variables.h" extern Actor *spawnQueue_bundle_f32(s32, s32, s32, s32); -extern f32 func_80257204(f32, f32, f32, f32); extern ActorProp * func_80320EB0(ActorMarker *, f32, s32); static void __chClam_updateFunc(Actor *this); @@ -245,7 +244,7 @@ static void __chClam_attackOther(ActorMarker *this_marker, ActorMarker *other_ma if(func_80297C6C() == 3) return; - if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN) && gcdialog_showText(ASSET_A14_TEXT_CLAM_TAUNT, 0, NULL, NULL, NULL, NULL)){ + if( !mapSpecificFlags_get(TTC_SPECIFIC_FLAG_5_CLAM_FIRST_MEET_TEXT_SHOWN) && gcdialog_showText(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 528e23fc..df8719b7 100644 --- a/src/TTC/ch/leaky.c +++ b/src/TTC/ch/leaky.c @@ -60,7 +60,7 @@ static void __chLeaky_updateFunc(Actor *this) { && !this->has_met_before && func_80329530(this, 250) && !func_80329530(this, 160) && !func_8028ECAC() - && gcdialog_showText(ASSET_A1A_TEXT_LEAKY_FIRST_MEET, 0, NULL, NULL, NULL, NULL) + && gcdialog_showText(ASSET_A1A_DIALOG_LEAKY_FIRST_MEET, 0, NULL, NULL, NULL, NULL) ){ this->has_met_before = TRUE; } @@ -118,6 +118,6 @@ bool chLeaky_eggCollision(ActorMarker *marker){ levelSpecificFlags_set(2, TRUE); levelSpecificFlags_set(5, TRUE); - gcdialog_showText(ASSET_A28_TEXT_LEAKY_DONE, 0x2a, this->position, this->marker, __chLeaky_showDoneText, NULL); + gcdialog_showText(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 3ead4eb2..99ff2b22 100644 --- a/src/TTC/ch/lockup.c +++ b/src/TTC/ch/lockup.c @@ -87,7 +87,7 @@ static void __chLockup_updateFunc(Actor *this){ && func_80329530(this, 320) && !func_80329530(this, 160) && !func_8028ECAC() - && gcdialog_showText(ASSET_A15_TEXT_TTC_LOCKUP_SPAWNED, 0, NULL, NULL, NULL, NULL) + && gcdialog_showText(ASSET_A15_DIALOG_TTC_LOCKUP_SPAWNED, 0, NULL, NULL, NULL, NULL) ){ this->has_met_before = TRUE; } diff --git a/src/TTC/ch/nipper.c b/src/TTC/ch/nipper.c index ec5c51ab..9a4ee99a 100644 --- a/src/TTC/ch/nipper.c +++ b/src/TTC/ch/nipper.c @@ -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_TEXT_TTC_NIPPER_HURT, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A10_DIALOG_TTC_NIPPER_HURT, 4, NULL, NULL, NULL, NULL); return; } @@ -213,13 +213,13 @@ static void __chNipper_updateFunc(Actor *this){ if(0.0f == this->velocity_x && xVelocity){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, -1, 5000); func_8032BB88(this, 0, 4000); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } else if(!xVelocity && 0.0f != this->velocity_x){ comusic_8025AB44(COMUSIC_12_TTC_NIPPER, 0, 300); func_8025AABC(COMUSIC_12_TTC_NIPPER); func_8032BB88(this, -1, 300); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } this->velocity_x = xVelocity; } @@ -243,7 +243,7 @@ static void __chNipper_updateFunc(Actor *this){ && temp_v0 != 10 ){ subaddie_set_state_with_direction(this, CH_NIPPER_STATE_5_SPAWNED, 0.01f, 1); - if(gcdialog_showText(ASSET_A0E_TEXT_NIPPER_SPAWNED, 0xf, this->position, this->marker, __chNipper_spawnedShowTextCallback, NULL)){ + if(gcdialog_showText(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); diff --git a/src/TTC/ch/treasurehunt.c b/src/TTC/ch/treasurehunt.c index aeee0923..2583629e 100644 --- a/src/TTC/ch/treasurehunt.c +++ b/src/TTC/ch/treasurehunt.c @@ -116,10 +116,10 @@ static void __chTreasurehunt_spawnActorForNextStep(void) { static void __chTreasurehunt_checkStepProgress(s32 currentStep){ if(CH_TREASUREHUNT_PUZZLE_CURRENT_STEP == currentStep && __chTreasurehunt_isActiveHitboxBeakBusterHitbox()){ if(currentStep == 0 && !jiggyscore_isCollected(JIGGY_11_TTC_RED_X)){ - gcdialog_showText(ASSET_A18_TEXT_TREASUREHUNT_FOLLOW_CLUES, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A18_DIALOG_TREASUREHUNT_FOLLOW_CLUES, 4, NULL, NULL, NULL, NULL); } else if(currentStep == 4){ - gcdialog_showText(ASSET_A19_TEXT_TREASUREHUNT_SECOND_STEP, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A19_DIALOG_TREASUREHUNT_SECOND_STEP, 4, NULL, NULL, NULL, NULL); } CH_TREASUREHUNT_PUZZLE_CURRENT_STEP++; @@ -170,7 +170,7 @@ void chTreasurehunt_checkStepProgress5(s16 arg0[3], s32 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_TEXT_BURIED_TREASURE_SPAWNED, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_A17_DIALOG_BURIED_TREASURE_SPAWNED, 4, NULL, NULL, NULL, NULL); CH_TREASUREHUNT_PUZZLE_CURRENT_STEP++; } } diff --git a/src/TTC/code_26D0.c b/src/TTC/code_26D0.c index a7e484dc..ccd49e98 100644 --- a/src/TTC/code_26D0.c +++ b/src/TTC/code_26D0.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "prop.h" -#include "SnS.h" #include "actor.h" extern ActorInfo gChClam; diff --git a/src/TTC/code_3E30.c b/src/TTC/code_3E30.c index b6df2004..63f486b5 100644 --- a/src/TTC/code_3E30.c +++ b/src/TTC/code_3E30.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" /* extern */ extern void func_802D6310(f32, enum map_e, s32, s32, enum file_progress_e); @@ -501,13 +501,11 @@ static void __code3E30_resetCheatCodeProgress(void) __code3E30_resetSecretCheatCodeProgress(); } -void code3E30_overlayRelease(void) -{ - if (sMapState.model1) - { +void code3E30_overlayRelease(void) { + if (sMapState.model1) { __code3E30_setupCheatCodeTimer(0); - func_8030DA44(sMapState.doorOpeningSfxSourceIdx); - func_8030DA44(sMapState.dullCannonShotSfxSourceId); + sfxsource_freeSfxsourceByIndex(sMapState.doorOpeningSfxSourceIdx); + sfxsource_freeSfxsourceByIndex(sMapState.dullCannonShotSfxSourceId); } } diff --git a/src/core1/code_0.c b/src/core1/code_0.c index c08d5b28..c3dabb3d 100644 --- a/src/core1/code_0.c +++ b/src/core1/code_0.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" @@ -6,10 +7,6 @@ #define MAIN_THREAD_STACK_SIZE 0x17F0 - -void setBootMap(enum map_e); -void func_8023DFF0(s32); - #if VERSION == VERSION_PAL extern s32 D_80000300; #endif @@ -17,10 +14,7 @@ void func_8023DFF0(s32); s32 D_80275610 = 0; s32 D_80275614 = 0; u32 gGlobalTimer = 0; -u32 sDebugVar_8027561C[] = { // never used - 0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0, - 0x1, 0x6, 0xD, -1 -}; +u32 sDebugVar_8027561C[] = { 0x9, 0x4, 0xA, 0x3, 0xB, 0x2, 0xC, 0x5, 0x0, 0x1, 0x6, 0xD, -1 }; // never used u32 D_80275650 = VER_SELECT(0xAD019D3C, 0xA371A8F3, 0, 0); //SM_DATA_CRC_1 u32 D_80275654 = VER_SELECT(0xD381B72F, 0xD0709154, 0, 0); //SM_DATA_CRC_2 char sDebugVar_80275658[] = VER_SELECT("HjunkDire:218755", "HjunkDire:300875", "HjunkDire:", "HjunkDire:"); @@ -33,13 +27,11 @@ u64 sDebugVar_8027A540; // never used u8 sMainThreadStack[MAIN_THREAD_STACK_SIZE]; // The real size of the stack is unclear yet, maybe there are some out-optimized debug variables below the stack OSThread sMainThread; s32 gBootMap; -s32 gDisableInput; -u64 sDebugVar_8027BEF0; // never used +static bool sDisableInput; +static u64 sDebugVar_8027BEF0; // never used extern u8 core2_TEXT_START[]; -extern u16 D_803A5D00[2][0x1ECC0/2]; - void func_8023DA20(s32 arg0){ bzero(&D_8027A130, core2_TEXT_START - (u8*)&D_8027A130); osWriteBackDCacheAll(); @@ -55,7 +47,7 @@ void func_8023DA74(void){ void func_8023DA9C(s32 arg0){ func_80254008(); - func_8024C428(); + viMgr_clearFramebuffers(); if (D_8027A130 == 4){ func_802E3580(); } @@ -70,7 +62,7 @@ void func_8023DA9C(s32 arg0){ if (D_8027A130 == 4){ dummy_func_802E35D0(); } - dummy_func_80255CD8(); + ucode_stub1(); } u32 globalTimer_getTimeMasked(u32 mask){ @@ -107,10 +99,10 @@ void core1_init(void) { #if VERSION == VERSION_PAL osTvType = 0; #endif - func_80255C30(); + ucode_load(); setBootMap(getDefaultBootMap()); rarezip_init(); //initialize decompressor's huft table - func_8024BE30(); + viMgr_init(); overlayManagerloadCore2(); sDebugVar_8027BEF0 = sDebugVar_8027A538; heap_init(); @@ -151,14 +143,14 @@ void mainLoop(void){ if(D_8027A130 != 3 || getGameMode() != GAME_MODE_4_PAUSED) globalTimer_incTimer(); - if(!gDisableInput) + if (!sDisableInput) pfsManager_update(); - gDisableInput = 0; + sDisableInput = FALSE; rumbleManager_80250C08(); if(!mapSpecificFlags_validateCRC1()){ - write_file_blocks(0, 0, 0x80397AD0, 0x40); + eeprom_writeBlocks(0, 0, 0x80397AD0, 0x40); } switch(D_8027A130){ @@ -185,7 +177,7 @@ void mainLoop(void){ ){ s32 offset; //render weird CRC failure image - for(y= 0x1e; y < framebuffer_height - 0x1e; y++){//L8023DEB4 + for(y= 0x1e; y < gFramebufferHeight - 0x1e; y++){//L8023DEB4 for(x = 0x14; x < 0xeb; x++){ tmp = ((8 * globalTimer_getTime()) + ((x*x) + (y*y))); @@ -196,9 +188,9 @@ void mainLoop(void){ rgba = b | r | g | a; - offset = ((framebuffer_width - 0xFF) / 2) + x + (y*framebuffer_width); - D_803A5D00[0][offset] = (s32) rgba; - D_803A5D00[1][offset] = (s32) rgba; + offset = ((gFramebufferWidth - 0xFF) / 2) + x + (y*gFramebufferWidth); + gFramebuffers[0][offset] = (s32) rgba; + gFramebuffers[1][offset] = (s32) rgba; } } }//L8023DF70 @@ -234,5 +226,5 @@ OSThread *mainThread_get(void) { } void disableInput_set(void){ - gDisableInput = 1; + sDisableInput = TRUE; } diff --git a/src/core1/code_11AC0.c b/src/core1/code_11AC0.c index ce2db4e8..6447b8bf 100644 --- a/src/core1/code_11AC0.c +++ b/src/core1/code_11AC0.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -23,7 +24,6 @@ u8 func_8025F4A0(ALCSPlayer *, u8); void func_8025F3F0(ALCSPlayer *, f32, f32); u16 func_80250474(s32 arg0); -void func_8024AF48(void); void func_8024FB8C(void); /* .data */ @@ -602,7 +602,7 @@ u16 func_80250474(s32 arg0){ D_80282110[i].unk10 = -1.0f; } osSetIntMask(sp1C); - func_8024AF48(); + core1_ce60_func_8024AF48(); if(D_802762C0 == -1){ D_802762C0 = 0xFFFF; } diff --git a/src/core1/code_13640.c b/src/core1/code_13640.c deleted file mode 100644 index 48bce137..00000000 --- a/src/core1/code_13640.c +++ /dev/null @@ -1,21 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -void func_8025108C(s32 arg0); - -/* .bss */ -s32 D_802827F0; - -/* .code */ -s32 func_80251060(void){ - return D_802827F0; -} - -void func_8025106C(void){ - func_8025108C(0); -} - -void func_8025108C(s32 arg0){ - D_802827F0 = arg0; -} diff --git a/src/core1/code_13680.c b/src/core1/code_13680.c deleted file mode 100644 index 020048e4..00000000 --- a/src/core1/code_13680.c +++ /dev/null @@ -1,31 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -u32 func_802510A0(BKSprite *this){ - return this->unk8; -} - -u32 func_802510A8(BKSprite *this){ - return this->unkA; -} - -u32 func_802510B0(BKSprite *this){ - return this->unk6; -} - -u32 func_802510B8(BKSprite *this){ - return this->unk4; -} - -s32 spriteGetFrameCount(BKSprite *this){ - return this->frameCnt; -} - -BKSpriteFrame *spriteGetFramePtr(BKSprite *this, u32 frame) -{ - BKSpriteFrame * new_var; - new_var = this->offsets[frame] + ((s32) ((*this).offsets + this->frameCnt)); - return new_var; -} diff --git a/src/core1/code_15770.c b/src/core1/code_15770.c deleted file mode 100644 index 3201401e..00000000 --- a/src/core1/code_15770.c +++ /dev/null @@ -1,74 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -struct { - u16 *data; - int unk4; -} gzBuffer; - -extern u8 D_8000E800; -extern u16 D_803A5D00[2][0xF660]; - -void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer); - -void func_80253190(Gfx **gdl){ - func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, D_803A5D00[getActiveFramebuffer()]); -} - -void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer){ - if( gzBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){ - //draw z_buffer - gDPPipeSync((*gdl)++); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(gzBuffer.data)); - gDPSetCycleType((*gdl)++, G_CYC_FILL); - gDPSetRenderMode((*gdl)++, G_RM_NOOP, G_RM_NOOP2); - gDPSetFillColor((*gdl)++, 0xFFFCFFFC); - gDPScisFillRectangle((*gdl)++, x, y, x + w - 1, y + h - 1); - - //draw color_buffer - gDPPipeSync((*gdl)++); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(color_buffer)); - } -} - -int func_80253400(void){ - return gzBuffer.unk4; -} - -int func_8025340C(void){ - return gzBuffer.data != NULL; -} - -void dummy_func_80253420(void){} - -void func_80253428(int arg0) { - u16 *var_v0; - int new_var; - if (arg0) { - var_v0 = (gzBuffer.data = &D_8000E800); - while (((s32) gzBuffer.data) % 0x40) {\ - var_v0 = (gzBuffer.data = var_v0 + 1); - } - - do { } while ((&D_8000E800 && 1) * 0); //remove this - }else{ - gzBuffer.data = 0; - } - gzBuffer.unk4 = 0; -} - -void func_802534A8(int arg0){ - gzBuffer.unk4 = (gzBuffer.data != NULL && arg0); -} - -void zBuffer_set(Gfx **gdl){ - if(gzBuffer.data && getGameMode() != GAME_MODE_4_PAUSED){ - gDPPipeSync((*gdl)++); - gDPSetDepthImage((*gdl)++, gzBuffer.data); - } -} - -void *zBuffer_get(void){ - return gzBuffer.data; -} diff --git a/src/core1/code_15B30.c b/src/core1/code_15B30.c index ff7f2593..c399068b 100644 --- a/src/core1/code_15B30.c +++ b/src/core1/code_15B30.c @@ -1,29 +1,13 @@ #include -#include "functions.h" -#include "variables.h" +#include "core1/core1.h" -#include +static Gfx *sGfxStack[2] = { NULL, NULL }; +s32 gFramebufferWidth = DEFAULT_FRAMEBUFFER_WIDTH; +s32 gFramebufferHeight = DEFAULT_FRAMEBUFFER_HEIGHT; -typedef struct { - s32 unk0; - s32 unk4; - Gfx *unk8; - Gfx *unkC; - s32 unk10; - s32 unk14; -}Struct_Core1_15B30; - -extern u8 D_803A5D00[2][0x1ecc0]; - -/* .data */ -Gfx *gGfxStack[2] = {NULL, NULL}; -s32 framebuffer_width = 292; -s32 framebuffer_height = 216; - -/* .bss */ -Mtx *gMtxStack[2]; -Vtx *gVtxStack[2]; -s32 gStackSelector; +static Mtx *sMtxStack[2]; +static Vtx *sVtxStack[2]; +static s32 sStackSelector; s32 gTextureFilterPoint; Struct_Core1_15B30 D_80283008[20]; s32 D_802831E8; @@ -35,11 +19,6 @@ u16 gScissorBoxTop; u16 gScissorBoxBottom; Gfx *D_80283214; -/* .h */ -void scissorBox_setDefault(void); -void dummy_func_80254464(void); - -/* .code */ void func_80253550(void){ osRecvMesg(&D_802831F0, NULL, OS_MESG_BLOCK); } @@ -74,8 +53,8 @@ void func_80253640(Gfx ** gdl, void *arg1){ gDPSetAlphaCompare((*gdl)++, G_AC_NONE); gDPSetColorDither((*gdl)++, G_CD_MAGICSQ); gDPSetScissor((*gdl)++, G_SC_NON_INTERLACE, gScissorBoxLeft, gScissorBoxRight, gScissorBoxTop, gScissorBoxBottom); - func_80253208(gdl, 0, 0, framebuffer_width, framebuffer_height, arg1); - gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_K0_TO_PHYSICAL(arg1)); + func_80253208(gdl, 0, 0, gFramebufferWidth, gFramebufferHeight, arg1); + gDPSetColorImage((*gdl)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(arg1)); gDPSetCycleType((*gdl)++, G_CYC_1CYCLE); gDPSetTextureConvert((*gdl)++, G_TC_FILT); gDPSetTextureDetail((*gdl)++, G_TD_CLAMP); @@ -98,13 +77,13 @@ void scissorBox_SetForGameMode(Gfx **gdl, s32 framebuffer_idx) { } else{ scissorBox_setDefault(); - func_80253640(gdl, D_803A5D00[framebuffer_idx]); + func_80253640(gdl, gFramebuffers[framebuffer_idx]); } } void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){ gSPSegment((*gfx)++, 0x00, 0x00000000); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(framebuffer_address)); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(framebuffer_address)); gSPClearGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH); gSPTexture((*gfx)++, 0, 0, 0, G_TX_RENDERTILE, G_OFF); gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_SHADE | G_SHADING_SMOOTH); @@ -121,7 +100,7 @@ void setupScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_address){ void setupDefaultScissorBoxAndFramebuffer(Gfx **gfx, s32 framebuffer_idx){ scissorBox_setDefault(); - setupScissorBoxAndFramebuffer(gfx, D_803A5D00[framebuffer_idx]); + setupScissorBoxAndFramebuffer(gfx, gFramebuffers[framebuffer_idx]); } void func_80253DC0(Gfx **gfx){ @@ -184,7 +163,7 @@ void scissorBox_get(u32 *left, u32 *top, u32 *right, u32 *bottom){ } void func_80253FE8(void){ - func_8024BFAC(); + viMgr_func_8024BFAC(); } void func_80254008(void){ @@ -208,29 +187,29 @@ void drawRectangle2D(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, s32 r, s32 g, s32 b) gDPScisFillRectangle((*gfx)++, x, y, x + w -1, y + h -1); } -void graphicsCache_release(void){ - if(gGfxStack[0]){ - free(gGfxStack[0]); - free(gGfxStack[1]); - free(gMtxStack[0]); - free(gMtxStack[1]); - free(gVtxStack[0]); - free(gVtxStack[1]); - gGfxStack[0] = NULL; +void graphicsCache_release(void) { + if (sGfxStack[0]) { + free(sGfxStack[0]); + free(sGfxStack[1]); + free(sMtxStack[0]); + free(sMtxStack[1]); + free(sVtxStack[0]); + free(sVtxStack[1]); + sGfxStack[0] = NULL; } } void graphicsCache_init(void){ - if(gGfxStack[0] == NULL){ - gGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands - gGfxStack[1] = (Gfx *)malloc(29600); - gMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices - gMtxStack[1] = (Mtx *)malloc(44800); - gVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices - gVtxStack[1] = (Vtx *)malloc(6880); + if(sGfxStack[0] == NULL){ + sGfxStack[0] = (Gfx *)malloc(29600); // 3700 dlist commands + sGfxStack[1] = (Gfx *)malloc(29600); + sMtxStack[0] = (Mtx *)malloc(44800); // 700 matrices + sMtxStack[1] = (Mtx *)malloc(44800); + sVtxStack[0] = (Vtx *)malloc(6880); // 430 vertices + sVtxStack[1] = (Vtx *)malloc(6880); dummy_func_80254464(); } - gStackSelector = 0; + sStackSelector = 0; gTextureFilterPoint = 0; } @@ -239,8 +218,8 @@ void scissorBox_set(s32 left, s32 top, s32 right, s32 bottom) { gScissorBoxTop = top; gScissorBoxRight = right; gScissorBoxBottom = bottom; - framebuffer_width = top - left; - framebuffer_height = bottom - right; + gFramebufferWidth = top - left; + gFramebufferHeight = bottom - right; viewport_pushFramebufferExtendsToVpStack(); } @@ -253,7 +232,7 @@ void func_80254374(s32 arg0) { Struct_Core1_15B30 *sp1C; func_80253550(); - func_8024C2A0(arg0); + viMgr_setActiveFramebuffer(arg0); sp1C = &D_80283008[D_802831E8]; D_802831E8 = (s32) (D_802831E8 + 1) % 20; func_8025357C(); @@ -267,10 +246,10 @@ void toggleTextureFilterPoint(void){ } void getGraphicsStacks(Gfx **gfx, Mtx **mtx, Vtx **vtx){ - gStackSelector = (1 - gStackSelector); - *gfx = gGfxStack[gStackSelector]; - *mtx = gMtxStack[gStackSelector]; - *vtx = gVtxStack[gStackSelector]; + sStackSelector = (1 - sStackSelector); + *gfx = sGfxStack[sStackSelector]; + *mtx = sMtxStack[sStackSelector]; + *vtx = sVtxStack[sStackSelector]; } -void dummy_func_80254464(void){} +void dummy_func_80254464(void) {} diff --git a/src/core1/code_18110.c b/src/core1/code_18110.c deleted file mode 100644 index 3dbf0361..00000000 --- a/src/core1/code_18110.c +++ /dev/null @@ -1,28 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" -#include "save.h" - -#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b)) -// The round up divide is not technically needed, but will come in handy for modding -#define gameFile_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData),EEPROM_BLOCK_SIZE) - -s32 write_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) { - s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset; - s32 ret; - - func_8024F35C(3); - ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE); - func_8024F35C(0); - return ret; -} - -s32 load_file_blocks(s32 filenum, s32 blockOffset, u8 *buffer, s32 blockCount) { - s32 address = (filenum * gameFile_NUM_BLOCKS) + blockOffset; - s32 ret; - - func_8024F35C(3); - ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, blockCount * EEPROM_BLOCK_SIZE); - func_8024F35C(0); - return ret; -} diff --git a/src/core1/code_18210.c b/src/core1/code_18210.c deleted file mode 100644 index 3c3ed161..00000000 --- a/src/core1/code_18210.c +++ /dev/null @@ -1,32 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -/* .bss */ -u8 D_80283280[0x100]; -s32 D_80283380; -s32 D_80283384; -s32 D_80283388; - -void func_80255C30(void) { - D_80283384 = *(s32 *)0xA4000000 ^ -1; - D_80283388 = (D_80283384) ? 1 :0; - D_80283380 = *(s32 *)0xA4001000 ^ 6103; - D_80283388 |= (D_80283380) ? 2 :0; - if (D_80283388 == 0) { - piMgr_read(&D_80283280, 0xB0000B70, 0x100); - } -} - -void dummy_func_80255CD8(void){} - -void func_80255CE0(void){ - osPiReadIo(0, NULL); -} - -s32 func_80255D04(void){return 0;} - -void func_80255D0C(u64 **ucode_ptr, u32 *ucode_size){ - *ucode_ptr = &D_80283280; - *ucode_size = 0x100; -} diff --git a/src/core1/code_1BE90.c b/src/core1/code_1BE90.c index db457be2..d98fcba8 100644 --- a/src/core1/code_1BE90.c +++ b/src/core1/code_1BE90.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" diff --git a/src/core1/code_1D00.c b/src/core1/code_1D00.c index da1f2a26..68452329 100644 --- a/src/core1/code_1D00.c +++ b/src/core1/code_1D00.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" diff --git a/src/core1/code_1D590.c b/src/core1/code_1D590.c deleted file mode 100644 index a75c8e12..00000000 --- a/src/core1/code_1D590.c +++ /dev/null @@ -1,15 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - - -void dummy_func_8025AFB0(void) {} - -void dummy_func_8025AFB8(void) {} - -void dummy_func_8025AFC0(Gfx **arg0, Mtx **arg1, Vtx **arg2) {} - -s32 dummy_func_8025AFD0(void) -{ - return 0; -} diff --git a/src/core1/code_1D5D0.c b/src/core1/code_1D5D0.c index a228ac93..e39c6e7e 100644 --- a/src/core1/code_1D5D0.c +++ b/src/core1/code_1D5D0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" #include "save.h" bool snsToRestoreItems = FALSE; diff --git a/src/core1/code_2FA0.c b/src/core1/code_2FA0.c deleted file mode 100644 index 17d87b9e..00000000 --- a/src/core1/code_2FA0.c +++ /dev/null @@ -1,71 +0,0 @@ -#include -#include "functions.h" -#include "variables.h" - -#include - - -s32 D_80275860 = 0; - -void func_802409C0(f32 arg0[3], f32 arg1){ - f32 vp_rotation[3]; - f32 sp30[3]; - f32 sp28[2]; - f32 dt; - - dt = time_getDelta()*arg1; - controller_getJoystick(0, sp28); - - sp30[0] = sp28[0] * dt; - sp30[1] = 0.0f; - sp30[2] = -(sp28[1] * dt); - - viewport_getRotation_vec3f(vp_rotation); - ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]); - - arg0[0] = arg0[0] + sp30[0]; - arg0[1] = arg0[1] + sp30[1]; - arg0[2] = arg0[2] + sp30[2]; -} - -void func_80240A74(f32 arg0[3]){ - func_802409C0(arg0, 400.0f); -} - -f32 func_80240A94(s32 arg0, f32 arg1){ - if(arg0 >= 0x29){ - arg0 = 0x28; - } - return arg1 + (f32)arg0*(arg1)/16 ; -} - -void func_80240AC8(f32 arg0[3], f32 arg1){ - f32 vp_rotation[3]; - f32 sp30[3]; - f32 sp28[2]; - f32 dt; - - dt = time_getDelta()*arg1; - controller_getJoystick(0, sp28); - - if(0.0f != sp28[0] || 0.0f != sp28[1]){ - D_80275860++; - if(D_80275860 >= 0x12D) - D_80275860 = 0x12C; - } - else{ - D_80275860 = 1; - } - - dt = func_80240A94(D_80275860, dt); - sp30[0] = sp28[0] * dt; - sp30[1] = 0.0f; - sp30[2] = -(sp28[1] * dt); - - viewport_getRotation_vec3f(vp_rotation); - ml_vec3f_yaw_rotate_copy(sp30, sp30, vp_rotation[1]); - - arg0[0] = arg0[0] + sp30[0]; - arg0[1] = arg0[1] + sp30[1]; - arg0[2] = arg0[2] + sp30[2]; -} diff --git a/src/core1/code_3250.c b/src/core1/code_3250.c index 3a914880..a9f89401 100644 --- a/src/core1/code_3250.c +++ b/src/core1/code_3250.c @@ -1,4 +1,6 @@ #include +#include "core1/core1.h" + extern f32 gu_sqrtf(f32); static void __guMtxF2L(float mf[4][4], Mtx *m) diff --git a/src/core1/code_5650.c b/src/core1/code_5650.c index b677532c..bb2eea59 100644 --- a/src/core1/code_5650.c +++ b/src/core1/code_5650.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "n_libaudio.h" diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 107227ab..22f28607 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -1,7 +1,5 @@ #include -#include "functions.h" -#include "variables.h" -#include "core1/rarezip.h" +#include "core1/core1.h" static int _rarezip_uncompress(u8 **arg0, u8 **arg1, struct huft * arg2); diff --git a/src/core1/code_7090.c b/src/core1/code_7090.c index 2997c0d9..22358da3 100644 --- a/src/core1/code_7090.c +++ b/src/core1/code_7090.c @@ -1,70 +1,62 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -extern void sfxsource_setSampleRate(u8, s32); -extern void func_8030E2C4(u8); +s16 *D_802758E0 = NULL; - -typedef struct struct_27_s{ - s16 unk0; - u8 pad2[0x12]; -}struct27s; - -s16 * D_802758E0 = NULL; - -void func_80244C78(int arg0); - -/* .code */ -void func_80244AB0(void){ +void core1_7090_alloc(void) { int i; - if(D_802758E0) + + if (D_802758E0) return; - D_802758E0 = (struct16s *) malloc(10*sizeof(s16)); - for(i = 0; i < 10; i++){ + D_802758E0 = (s16 *) malloc(10 * sizeof(s16)); + + for (i = 0; i < 10; i++) { D_802758E0[i] = 0; } } -void func_80244B3C(void){ +void core1_7090_release(void) { int i; - if(!D_802758E0) + if (!D_802758E0) return; - for(i = 0; i < 10; i++){ - if(D_802758E0[i]) - func_8030E394((u8)D_802758E0[i]); + for (i = 0; i < 10; i++) { + if (D_802758E0[i]) + func_8030E394(D_802758E0[i]); } + free(D_802758E0); D_802758E0 = NULL; - } -void func_80244BB0(s32 arg0, s32 arg1, s32 arg2, f32 arg3){ - s32 i; - u8 indx; - if(func_8030ED70(func_80255D44(arg1))){ - i = sfxsource_createSfxsourceAndReturnIndex(); - indx = i; - if(i){ - sfxsource_setSfxId(indx, func_80255D44(arg1)); - sfxsource_playSfxAtVolume(indx, arg3); - sfxsource_setSampleRate(indx, arg2); - func_8030E2C4(indx); - func_80244C78(arg0); - D_802758E0[arg0] = indx; +void core1_7090_initSfxSource(s32 idx, s32 lookup_idx, s32 sample_rate, f32 volume) { + u8 sfx_source_index; + + if (func_8030ED70(lookup_getSfxId(lookup_idx))) { + sfx_source_index = sfxsource_createSfxsourceAndReturnIndex(); + + if (sfx_source_index) { + sfxsource_setSfxId(sfx_source_index, lookup_getSfxId(lookup_idx)); + sfxsource_playSfxAtVolume(sfx_source_index, volume); + sfxsource_setSampleRate(sfx_source_index, sample_rate); + func_8030E2C4(sfx_source_index); + core1_7090_freeSfxSource(idx); + D_802758E0[idx] = sfx_source_index; } } - else{ - func_8030E6A4(func_80255D44(arg1), arg3, arg2); + else { + func_8030E6A4(lookup_getSfxId(lookup_idx), volume, sample_rate); } } -void func_80244C78(int arg0){ - if(D_802758E0[arg0]){ - func_8030DA44(D_802758E0[arg0]); +void core1_7090_freeSfxSource(int idx) { + if (D_802758E0[idx]) { + sfxsource_freeSfxsourceByIndex(D_802758E0[idx]); } - D_802758E0[arg0] = 0; + + D_802758E0[idx] = 0; } diff --git a/src/core1/code_72B0.c b/src/core1/code_72B0.c index 3c026f4b..8e284361 100644 --- a/src/core1/code_72B0.c +++ b/src/core1/code_72B0.c @@ -1,11 +1,11 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" int collisionTri_isHitFromAbove_actor(f32 arg0[3], Actor *arg1, s32 arg2); extern bool func_80320DB0(f32[3], f32, f32[3], u32); extern bool func_80323240(struct56s *, f32, f32[3]); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); extern BKCollisionTri *func_80320B98(f32[3], f32[3], f32[3], u32); extern BKCollisionTri *func_80320C94(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5); extern f32 func_8031C5D4(struct0*); @@ -121,7 +121,7 @@ void func_802450DC(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[ ml_vec3f_diff_copy(sp3C, arg1, arg0); ml_vec3f_diff_copy(sp30, arg3, arg2); ml_vec3f_diff_copy(sp24, sp3C, sp30); - phi_f12 = -ml_dotProduct_vec3f(arg4, sp24); + phi_f12 = -ml_vec3f_dot_product(arg4, sp24); phi_f12 = MAX(5.0f, phi_f12); arg1[0] += phi_f12 * arg4[0]; arg1[1] += phi_f12 * arg4[1]; @@ -144,13 +144,13 @@ void func_802451A4(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[ ml_vec3f_diff_copy(sp54, sp6C, sp60); ml_vec3f_normalize_copy(sp3C, sp54); ml_vec3f_yaw_rotate_copy(sp30, sp3C, 90.0f); - sp28 = ml_dotProduct_vec3f(arg4, sp3C); + sp28 = ml_vec3f_dot_product(arg4, sp3C); if (arg5 != 0) { - D_8027EF30 = ml_dotProduct_vec3f(arg4, sp30); + D_8027EF30 = ml_vec3f_dot_product(arg4, sp30); } phi_v0 = (D_8027EF30 < 0.0f) ? -1 : 1; ml_vec3f_yaw_rotate_copy(sp48, arg4,(phi_v0 * sp28) * 45.0); - phi_f12 = -ml_dotProduct_vec3f(sp48, sp54); + phi_f12 = -ml_vec3f_dot_product(sp48, sp54); phi_f12 = MAX(5.0f, phi_f12); arg1[0] += phi_f12 * sp48[0]; arg1[1] += phi_f12 * sp48[1]; @@ -279,7 +279,7 @@ void func_8024560C(f32 arg0[3], struct0 *arg1, UNK_TYPE(s32) arg2, u8 *arg3, f32 } BKCollisionTri *func_8024575C(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5){ - if(arg2 < ml_distance_vec3f(arg0, arg1)){ + if(arg2 < ml_vec3f_distance(arg0, arg1)){ return NULL; } return func_80320C94(arg0, arg1, arg2, arg3, arg4, arg5); diff --git a/src/core1/code_7F60.c b/src/core1/code_7F60.c index 57e10ce8..b3efda6c 100644 --- a/src/core1/code_7F60.c +++ b/src/core1/code_7F60.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" diff --git a/src/core1/code_8C50.c b/src/core1/code_8C50.c index f9686d2a..16b0a0b9 100644 --- a/src/core1/code_8C50.c +++ b/src/core1/code_8C50.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" @@ -120,7 +121,7 @@ void func_80246744(OSMesg arg0){ } void func_80246794(Struct_Core1_8C50_s * arg0){ - func_80255D0C(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size); + ucode_getPtrAndSize(&D_80275910.t.ucode_boot, &D_80275910.t.ucode_boot_size); D_80275910.t.ucode = n_aspMainTextStart; D_80275910.t.ucode_data = n_aspMainDataStart; D_80275910.t.data_ptr = (void*) arg0->unk8; @@ -134,7 +135,7 @@ void func_80246794(Struct_Core1_8C50_s * arg0){ } void func_80246844(Struct_Core1_8C50_s * arg0){ - func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size); + ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size); D_80275950.t.ucode = gSPF3DEX_fifoTextStart; D_80275950.t.ucode_data = gSPF3DEX_fifoDataStart; D_80275950.t.data_ptr = (void*) arg0->unk8; @@ -152,7 +153,7 @@ void func_80246844(Struct_Core1_8C50_s * arg0){ } void func_8024692C(Struct_Core1_8C50_s * arg0){ - func_80255D0C(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size); + ucode_getPtrAndSize(&D_80275950.t.ucode_boot, &D_80275950.t.ucode_boot_size); D_80275950.t.ucode = gSPL3DEX_fifoTextStart; D_80275950.t.ucode_data = gSPL3DEX_fifoDataStart; D_80275950.t.data_ptr = (void*) arg0->unk8; @@ -218,7 +219,7 @@ void func_80246C2C(void){ if((D_8027FC14 << 1) < 0){ osDpSetStatus(DPC_SET_FREEZE); D_80280688 = osViGetCurrentFramebuffer(); - func_8024BFAC(); + viMgr_func_8024BFAC(); } D_8027FC14 = D_8027FC18 = 2; D_80275998 = 0; @@ -473,7 +474,7 @@ void func_80247560(void){ osSetEventMesg(OS_EVENT_SP, &D_8027FB60, CORE1_8C50_EVENT_SP); osSetEventMesg(OS_EVENT_FAULT, &D_8027FB60, CORE1_8C50_EVENT_FAULT); osSetEventMesg(OS_EVENT_PRENMI, &D_8027FB60, CORE1_8C50_EVENT_PRENMI); - func_8024BDAC(&D_8027FB60, 5); + viMgr_func_8024BDAC(&D_8027FB60, 5); D_8027FC0C = 0; D_8027FC10 = 0; D_8027FC14 = D_8027FC18 = 2; diff --git a/src/core1/code_9D30.c b/src/core1/code_9D30.c index 607f178c..a8dc6945 100644 --- a/src/core1/code_9D30.c +++ b/src/core1/code_9D30.c @@ -1,13 +1,11 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" #if VERSION == VERSION_USA_1_0 -extern u16 D_803A5D00[2][0xF660]; //framebuffer -extern s32 framebuffer_width; //framebuffer width -extern s32 framebuffer_height; //framebuffer height /* .data */ u8 D_80275A50[8][3] = { @@ -95,11 +93,11 @@ void func_80247750(s32 r, s32 g, s32 b){ void func_8024776C(s32 x, s32 y) { s32 rgba16; - if( ((x >= 0) && (x < framebuffer_width)) - && ((y >= 0) && (y < framebuffer_height)) + if( ((x >= 0) && (x < gFramebufferWidth)) + && ((y >= 0) && (y < gFramebufferHeight)) ) { - D_803A5D00[0][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); - D_803A5D00[1][x + y*framebuffer_width] = _SHIFTL(D_80275A68 >> 3, 11, 5) | _SHIFTL(D_80275A6C >> 3, 6, 5) | _SHIFTL(D_80275A70 >> 3, 1, 5) | _SHIFTL(1, 0, 1); + 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); } } @@ -119,7 +117,7 @@ void func_80247818(s32 x, s32 y, s32 w, s32 h) { void func_802478C0(s32 r, s32 g, s32 b) { func_80247750(r, g, b); - func_80247818((framebuffer_width - 128) / 2, (framebuffer_height - 100) / 2, 128, 100); + func_80247818((gFramebufferWidth - 128) / 2, (gFramebufferHeight - 100) / 2, 128, 100); } void func_8024792C(void){} @@ -206,9 +204,9 @@ void func_80247C20(void) { } if (D_80275BE0) { - for(i = 0; i < framebuffer_width * framebuffer_height; i++){ - D_803A5D00[0][i] = 0; - D_803A5D00[1][i] = 0; + for(i = 0; i < gFramebufferWidth * gFramebufferHeight; i++){ + gFramebuffers[0][i] = 0; + gFramebuffers[1][i] = 0; } osWriteBackDCacheAll(); } diff --git a/src/core1/code_CE60.c b/src/core1/code_CE60.c index 630010d9..51b736a7 100644 --- a/src/core1/code_CE60.c +++ b/src/core1/code_CE60.c @@ -1,538 +1,514 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" -typedef struct { +typedef struct bounding_box_s { s16 x_min; s16 x_max; s16 y_min; s16 y_max; s16 z_min; s16 z_max; -} Struct_Core1_CE60_0s; +} BoundingBox; -void func_80250530(s32, u16 chan_mask, f32); - -/* .data */ -s32 D_80275C10 = -1; -s32 D_80275C14 = 0; -u8 D_80275C18 = 0; -u8 D_80275C1C = 0; -Struct_Core1_CE60_0s D_80275C20[] = { - {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34}, - {0xF95C, 0xFE73, 0xDCD8, 0x2328, 0xE69C, 0xF711}, - {0xFA83, 0xFFAB, 0xDCD8, 0x2328, 0xE886, 0xEFFB}, - {0xEA84, 0xF85B, 0xDCD8, 0x2328, 0xF830, 0xFD90}, - {0xFEC0, 0x0140, 0x05DC, 0x0960, 0xE890, 0xFE7B}, - {0xFD44, 0x05D8, 0xFD44, 0x06C2, 0xFC2E, 0x03D2}, - {0xE890, 0xF9D4, 0xDCD8, 0x2328, 0xE7C8, 0xFB34} +static s32 D_80275C10 = -1; +static s32 D_80275C14 = 0; +static u8 D_80275C18 = FALSE; +static u8 D_80275C1C = FALSE; +static BoundingBox sBoundingBoxes[] = { + { -6000, -1580, -9000, 9000, -6200, -1228 }, + { -1700, -397, -9000, 9000, -6500, -2287 }, + { -1405, -85, -9000, 9000, -6010, -4101 }, + { -5500, -1957, -9000, 9000, -2000, -624 }, + { -320, 320, 1500, 2400, -6000, -389 }, + { -700, 1496, -700, 1730, -978, 978 }, + { -6000, -1580, -9000, 9000, -6200, -1228 } }; -/* .bss */ -s32 D_802806F0; -int D_802806F4; -s32 D_802806F8[4]; -s32 D_80280708[4]; +static s32 sUnusedCounter; // is only incremented and decremented, but not used +static bool D_802806F4; +static s32 sPlayerPosition[4]; +static enum comusic_e sTrackId[4]; - -/* .code */ -void func_8024A880(s32 chan_mask){ +void core1_ce60_setChanMask(s32 chan_mask) { func_80250530(0, chan_mask, 3.0f); } -void func_8024A8AC(s32 chan_mask, f32 arg1){ - func_80250530(0, chan_mask, arg1); +void core1_ce60_setChanMaskWithValue(s32 chan_mask, f32 value) { + func_80250530(0, chan_mask, value); } -int func_8024A8DC(s32 arg0, s32 arg1, s32 arg2){ - return (arg0 - D_802806F8[0])*(arg0 - D_802806F8[0]) + (arg1 - D_802806F8[2])*(arg1 - D_802806F8[2]) < arg2*arg2; +bool core1_ce60_isPlayerInRange(s32 x, s32 z, s32 distance) { + return (x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2]) < distance * distance; } -f32 func_8024A928(f32 arg0, f32 arg1){ - return gu_sqrtf((arg0 - D_802806F8[0])*(arg0 - D_802806F8[0]) + (arg1 - D_802806F8[2])*(arg1 - D_802806F8[2])); +f32 core1_ce60_getPlayerDistance(f32 x, f32 z) { + return gu_sqrtf((x - sPlayerPosition[0]) * (x - sPlayerPosition[0]) + (z - sPlayerPosition[2]) * (z - sPlayerPosition[2])); } -int func_8024A984(s32 arg0){ - func_802585E0(D_802806F8, D_80275C20[arg0].x_min, D_80275C20[arg0].y_min, D_80275C20[arg0].z_min, D_80275C20[arg0].x_max, D_80275C20[arg0].y_max, D_80275C20[arg0].z_max); +bool core1_ce60_isPlayerInsideBoundingBox(s32 box_idx) { + return ml_vec3w_inside_box_w(sPlayerPosition, + sBoundingBoxes[box_idx].x_min, sBoundingBoxes[box_idx].y_min, sBoundingBoxes[box_idx].z_min, + sBoundingBoxes[box_idx].x_max, sBoundingBoxes[box_idx].y_max, sBoundingBoxes[box_idx].z_max + ); } -void func_8024A9EC(s32 arg0){ - if(!func_8025ADBC(D_80280708[0]) && D_80280708[2]){ - func_8025A104(D_80280708[0], 0); +void core1_ce60_func_8024A9EC(s32 arg0) { + if (!func_8025ADBC(sTrackId[0]) && sTrackId[2]) { + func_8025A104(sTrackId[0], 0); } - func_8025A55C(D_80280708[2], arg0 ? arg0 : 0x1f4, 4 ); - if(func_8025AD7C(D_80280708[1]) || D_80280708[3]){ - func_8025ABB8(D_80280708[1], D_80280708[3], arg0 ? arg0 : 0x1f4, 4 ); - }//L8024AA94 - func_8025A864(D_80280708[1]); + + func_8025A55C(sTrackId[2], arg0 ? arg0 : 0x1f4, 4); + + if (func_8025AD7C(sTrackId[1]) || sTrackId[3]) { + func_8025ABB8(sTrackId[1], sTrackId[3], arg0 ? arg0 : 0x1f4, 4 ); + } + + func_8025A864(sTrackId[1]); } -void func_8024AAB0(void){ - f32 plyr_pos[3]; //sp34 - f32 sp30; +void core1_ce60_func_8024AAB0(void) { + f32 player_position[3]; + f32 player_distance; - player_getPosition_s32(&D_802806F8); - player_getPosition(plyr_pos); - D_80280708[0] = func_8032274C(); - D_80280708[1] = func_80322758(); - D_80280708[2] = D_80280708[3] = 0; - if(0 <= D_80280708[0]) - D_80280708[2] = func_80250034(D_80280708[0]); - if(0 <= D_80280708[1]) - D_80280708[3] = func_80250034(D_80280708[1]); - switch(map_get()){ - case MAP_7_TTC_TREASURE_TROVE_COVE: //L8024ABA8 - D_80280708[2] = ml_map_f(4700 - D_802806F8[1], 0.0f, 900.0f, 0.0f, D_80280708[2]); - D_80280708[3] = ml_map_f(4700 - D_802806F8[1], 0.0f, 900.0f, D_80280708[3], 0.0f); + player_getPosition_s32(sPlayerPosition); + player_getPosition(player_position); + + sTrackId[0] = func_8032274C(); + sTrackId[1] = func_80322758(); + sTrackId[2] = sTrackId[3] = COMUSIC_0_DING_A; + + if (0 <= sTrackId[0]) + sTrackId[2] = func_80250034(sTrackId[0]); + + if (0 <= sTrackId[1]) + sTrackId[3] = func_80250034(sTrackId[1]); + + switch (map_get()) { + case MAP_7_TTC_TREASURE_TROVE_COVE: + sTrackId[2] = ml_map_f(4700 - sPlayerPosition[1], 0.0f, 900.0f, 0.0f, sTrackId[2]); + sTrackId[3] = ml_map_f(4700 - sPlayerPosition[1], 0.0f, 900.0f, sTrackId[3], 0.0f); break; - case MAP_B_CC_CLANKERS_CAVERN: // - sp30 = func_8024A928(13909.0f, -26.0f); - D_80280708[2] = ml_map_f(sp30, 1500.0f, 1800.0f, 0.0f, D_80280708[2]); - D_80280708[3] = ml_map_f(sp30, 1500.0f, 1800.0f, D_80280708[3], 0.0f); + + case MAP_B_CC_CLANKERS_CAVERN: + player_distance = core1_ce60_getPlayerDistance(13909.0f, -26.0f); + sTrackId[2] = ml_map_f(player_distance, 1500.0f, 1800.0f, 0.0f, sTrackId[2]); + sTrackId[3] = ml_map_f(player_distance, 1500.0f, 1800.0f, sTrackId[3], 0.0f); break; - case MAP_1_SM_SPIRAL_MOUNTAIN: //L8024ACC4 - if(func_8024A984(4)) - D_80280708[2] = 0; - else - D_80280708[3] = 0; - break; - case MAP_1B_MMM_MAD_MONSTER_MANSION: //L8024ACE4 - if(func_80309D58(plyr_pos, 1)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1_SM_SPIRAL_MOUNTAIN: + if (core1_ce60_isPlayerInsideBoundingBox(4)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_41_FP_BOGGYS_IGLOO: //L8024AD08 - if( jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) - || (levelSpecificFlags_get(LEVEL_FLAG_11_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_12_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_13_FP_UNKNOWN)) - ){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1B_MMM_MAD_MONSTER_MANSION: + if (func_80309D58(player_position, 1)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_1D_MMM_CELLAR: //L8024AD58 - if(sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && D_802806F8[0] >= 0x23A){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_41_FP_BOGGYS_IGLOO: + if (jiggyscore_isCollected(JIGGY_2E_FP_PRESENTS) || + (levelSpecificFlags_get(LEVEL_FLAG_11_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_12_FP_UNKNOWN) && levelSpecificFlags_get(LEVEL_FLAG_13_FP_UNKNOWN))) + { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_7F_FP_WOZZAS_CAVE: //L8024AD8C - if(sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && func_8024A8DC(0x619, 0x97a, 0x69a)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_1D_MMM_CELLAR: + if (sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && sPlayerPosition[0] >= 0x23A) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - case MAP_45_CCW_AUTUMN: //L8024ADC0 - case MAP_46_CCW_WINTER: //L8024ADC0 - if(func_8024A984(5)){ - D_80280708[2] = 0; - } - else{ - D_80280708[3] = 0; + + case MAP_7F_FP_WOZZAS_CAVE: + if (sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(0x619, 0x97a, 0x69a)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; } break; - }//L8024ADE0 + + case MAP_45_CCW_AUTUMN: + case MAP_46_CCW_WINTER: + if (core1_ce60_isPlayerInsideBoundingBox(5)) { + sTrackId[2] = COMUSIC_0_DING_A; + } else { + sTrackId[3] = COMUSIC_0_DING_A; + } + break; + } } -void func_8024ADF0(s32 arg0){ - func_8024AAB0(); - if(arg0) +void core1_ce60_func_8024ADF0(bool arg0) { + core1_ce60_func_8024AAB0(); + + if (arg0) func_8025A9D4(); - if(0 < D_80280708[0] && 0 < D_80280708[2]) - func_8025A104(D_80280708[0], D_80280708[2]); + if (0 < sTrackId[0] && 0 < sTrackId[2]) + func_8025A104(sTrackId[0], sTrackId[2]); - if(0 < D_80280708[1] && 0 < D_80280708[3]) - func_8025A6CC(D_80280708[1], D_80280708[3]); + if (0 < sTrackId[1] && 0 < sTrackId[3]) + func_8025A6CC(sTrackId[1], sTrackId[3]); } -void func_8024AE74(void){ - D_802806F0 = 0; +void core1_ce60_func_8024AE74(void) { + sUnusedCounter = 0; D_80275C10 = -1; D_80275C14 = 0; - D_80275C1C = D_80275C18 = func_8024A8DC(0xb43, -0x2918, 0x1950) ? 1 : 0; + D_80275C1C = D_80275C18 = core1_ce60_isPlayerInRange(2883, -10520, 6480) ? TRUE : FALSE; } -void func_8024AED8(void){ +void core1_ce60_resetState(void) { D_80275C10 = -1; D_80275C14 = 0; - D_80275C18 = 0; - D_80275C1C = 0; + D_80275C18 = FALSE; + D_80275C1C = FALSE; } -void func_8024AF00(s32 arg0, s32 arg1){ - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(arg0); - } - else{ - func_8024A880(arg1); +void core1_ce60_setChanMaskFromWaterState(s32 chan_mask_underwater, s32 chan_mask_surface) { + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(chan_mask_underwater); + } else { + core1_ce60_setChanMask(chan_mask_surface); } } -void func_8024AF48(void){ - - if(!D_802806F4) return; - if(volatileFlag_get(VOLATILE_FLAG_1)) return; - if(volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) return; - if(func_802D686C()) return; - if(player_isDead()) return; - if(gctransition_8030BDC0()) return; - if(getGameMode() == GAME_MODE_A_SNS_PICTURE) return; +void core1_ce60_func_8024AF48(void) { + if (!D_802806F4 || + volatileFlag_get(VOLATILE_FLAG_1) || + volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE) || + func_802D686C() || + player_isDead() || + gctransition_8030BDC0() || + getGameMode() == GAME_MODE_A_SNS_PICTURE) + { + return; + } + + player_getPosition_s32(sPlayerPosition); + core1_ce60_func_8024AAB0(); - player_getPosition_s32(D_802806F8); - func_8024AAB0(); switch(map_get()){ - case MAP_2_MM_MUMBOS_MOUNTAIN: // L8024B000 - if(func_8024A8DC(-4450, 4550, 1900) ||func_8024A8DC(-0x1777, 0x1820, 0x26c)){ - func_8024A880(0x1cc0); - } - else if(func_8024A8DC(0x119F, -0x760, 0x7d0)){ - func_8024A880(0xb0c0); - } - else if(func_8024A8DC(0x12c, -0x35a, 0x898)){ - func_8024A880(0x513f); - } - else{ - func_8024AF00(0x200, 0x103f); + case MAP_2_MM_MUMBOS_MOUNTAIN: + if (core1_ce60_isPlayerInRange(-4450, 4550, 1900) || core1_ce60_isPlayerInRange(-6007, 6176, 620)) { + core1_ce60_setChanMask(0x1cc0); + } else if (core1_ce60_isPlayerInRange(4511, -1888, 2000)) { + core1_ce60_setChanMask(0xb0c0); + } else if (core1_ce60_isPlayerInRange(300, -858, 2200)) { + core1_ce60_setChanMask(0x513f); + } else { + core1_ce60_setChanMaskFromWaterState(0x200, 0x103f); } break; - case MAP_7_TTC_TREASURE_TROVE_COVE: // L8024B094 - func_8024A9EC(0); - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x600); - } - else if(func_8024A8DC(-0x12C, 0x58c, 0x866) - || (func_8024A8DC(-0x12c, 0x58c, 0xc1c) - && D_802806F8[1] < 0x514 - && !func_8024A8DC(-0x49, 0x2c43, 0x1c0c) - && !func_8024A8DC(0x6c8, 0xe04, 0x1c7) - && !func_8024A8DC(0x564, 0xf9a, 0x190) - ) - ){ - func_8024A880(0x7800); - } - else{ - func_8024A880(0x60ff); + case MAP_7_TTC_TREASURE_TROVE_COVE: + core1_ce60_func_8024A9EC(0); + + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x600); + } else if (core1_ce60_isPlayerInRange(-300, 1420, 2150) || + (core1_ce60_isPlayerInRange(-300, 1420, 3100) && + sPlayerPosition[1] < 1300 && + !core1_ce60_isPlayerInRange(-73, 11331, 7180) && + !core1_ce60_isPlayerInRange(1736, 3588, 455) && + !core1_ce60_isPlayerInRange(1380, 3994, 400))) + { + core1_ce60_setChanMask(0x7800); + } else { + core1_ce60_setChanMask(0x60ff); } break; - case MAP_B_CC_CLANKERS_CAVERN: // L8024B158 - func_8024A9EC(0); - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - if(!(D_802806F8[1] < 0x28b)){ - func_8024A8AC(0x8180, 5.0f); + case MAP_B_CC_CLANKERS_CAVERN: + core1_ce60_func_8024A9EC(0); + + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + if(!(sPlayerPosition[1] < 651)) { + core1_ce60_setChanMaskWithValue(0x8180, 5.0f); + } else { + core1_ce60_setChanMaskWithValue(0x3e00, 5.0f); } - else{ - func_8024A8AC(0x3e00, 5.0f); + } else { + core1_ce60_setChanMask(0x407f); + } + break; + + case MAP_12_GV_GOBIS_VALLEY: + if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ + core1_ce60_setChanMask(0x8020); + } else if (core1_ce60_isPlayerInRange(-3990, 5670, 3700)){ + core1_ce60_setChanMask(0x797f); + } else { + core1_ce60_setChanMask(0x67fe); + } + break; + + case MAP_3_UNUSED: + core1_ce60_setChanMaskFromWaterState(0x1800, 0x67fe); + break; + + case MAP_5_TTC_BLUBBERS_SHIP: + core1_ce60_setChanMaskFromWaterState(0x600, 0x7800); + break; + + case MAP_1_SM_SPIRAL_MOUNTAIN: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x9000); + } else { + if (chmole_learnedAllSpiralMountainAbilities()) { + core1_ce60_func_8024A9EC(0); } - } - else{ - func_8024A880(0x407f); + + core1_ce60_setChanMask(0x6fff); } break; - case MAP_12_GV_GOBIS_VALLEY:// L8024B1BC - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8020); - } - else if(func_8024A8DC(-0xf96, 0x1626, 0xe74)){ - func_8024A880(0x797f); - } - else{ - func_8024A880(0x67fe); - } + case MAP_21_CC_WITCH_SWITCH_ROOM: + case MAP_22_CC_INSIDE_CLANKER: + case MAP_23_CC_GOLDFEATHER_ROOM: + core1_ce60_setChanMaskFromWaterState(0x3c00, 0x61ff); break; - case MAP_3_UNUSED: // L8024B214 - func_8024AF00(0x1800, 0x67fe); + case MAP_25_MMM_WELL: + case MAP_2F_MMM_WATERDRAIN_BARREL: + core1_ce60_setChanMaskFromWaterState(0x1000, 0xcfff); break; - case MAP_5_TTC_BLUBBERS_SHIP: // L8024B228 - func_8024AF00(0x600, 0x7800); + case MAP_13_GV_MEMORY_GAME: + case MAP_14_GV_SANDYBUTTS_MAZE: + case MAP_15_GV_WATER_PYRAMID: + case MAP_16_GV_RUBEES_CHAMBER: + case MAP_1A_GV_INSIDE_JINXY: + core1_ce60_setChanMaskFromWaterState(0x3ffe, 0x4ffe); break; - case MAP_1_SM_SPIRAL_MOUNTAIN: // L8024B23C - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x9000); - } - else{ - if(chmole_learnedAllSpiralMountainAbilities()) - func_8024A9EC(0); - func_8024A880(0x6fff); - } - break; - - case MAP_21_CC_WITCH_SWITCH_ROOM:// L8024B288 - case MAP_22_CC_INSIDE_CLANKER:// L8024B288 - case MAP_23_CC_GOLDFEATHER_ROOM:// L8024B288 - func_8024AF00(0x3c00, 0x61ff); - break; - - case MAP_25_MMM_WELL:// L8024B29C - case MAP_2F_MMM_WATERDRAIN_BARREL:// L8024B29C - func_8024AF00(0x1000, 0xcfff); - break; - - case MAP_13_GV_MEMORY_GAME:// L8024B2B0 - case MAP_14_GV_SANDYBUTTS_MAZE:// L8024B2B0 - case MAP_15_GV_WATER_PYRAMID:// L8024B2B0 - case MAP_16_GV_RUBEES_CHAMBER:// L8024B2B0 - case MAP_1A_GV_INSIDE_JINXY:// L8024B2B0 - func_8024AF00(0x3ffe, 0x4ffe); - break; - - case MAP_1B_MMM_MAD_MONSTER_MANSION:// L8024B2C4 - if( !mapSpecificFlags_get(1) - && !func_8025AD7C(COMUSIC_4_MMM_CLOCK_VERSION) - && !func_8025AD7C(COMUSIC_3C_MINIGAME_LOSS) - ){ - func_8024A9EC(0); + case MAP_1B_MMM_MAD_MONSTER_MANSION: + if (!mapSpecificFlags_get(1) && !func_8025AD7C(COMUSIC_4_MMM_CLOCK_VERSION) && !func_8025AD7C(COMUSIC_3C_MINIGAME_LOSS)) { + core1_ce60_func_8024A9EC(0); } - func_8024A880((mapSpecificFlags_get(1) ? 0x2000: 0) + 0xcfff); + core1_ce60_setChanMask((mapSpecificFlags_get(1) ? 0x2000 : 0) + 0xcfff); break; - case MAP_D_BGS_BUBBLEGLOOP_SWAMP: // L8024B328 - if( func_8024A8DC(0x762, -0x542, 0x578) - || func_8024A8DC(-0x85, 0x7d8, 0x384) - || func_8024A8DC(-0xe2d, -0x217, 0x578) - ){ - func_8024A8AC(0x2f4f, 2.0f); - } - else{ - func_8024A8AC(0x6f4f, 2.0f); + case MAP_D_BGS_BUBBLEGLOOP_SWAMP: + if (core1_ce60_isPlayerInRange(1890, -1346, 1400) || core1_ce60_isPlayerInRange(-133, 2008, 900) || core1_ce60_isPlayerInRange(-3629, -535, 1400)) { + core1_ce60_setChanMaskWithValue(0x2f4f, 2.0f); + } else { + core1_ce60_setChanMaskWithValue(0x6f4f, 2.0f); } break; - case MAP_31_RBB_RUSTY_BUCKET_BAY:// L8024B38C - if( (-4200 <= D_802806F8[0] && D_802806F8[0] < -3700) - && (-900 <= D_802806F8[2] && D_802806F8[2] < 900) - ){ - func_8024A880(0x51ff); - } - else{ - func_8024AF00(0x800, 0x71bf); + case MAP_31_RBB_RUSTY_BUCKET_BAY: + if ((-4200 <= sPlayerPosition[0] && sPlayerPosition[0] < -3700) && (-900 <= sPlayerPosition[2] && sPlayerPosition[2] < 900)) { + core1_ce60_setChanMask(0x51ff); + } else { + core1_ce60_setChanMaskFromWaterState(0x800, 0x71bf); } break; - case MAP_35_RBB_WAREHOUSE:// L8024B3E8 - case MAP_36_RBB_BOATHOUSE:// L8024B3E8 - case MAP_37_RBB_CONTAINER_1:// L8024B3E8 - case MAP_38_RBB_CONTAINER_3:// L8024B3E8 - case MAP_3E_RBB_CONTAINER_2:// L8024B3E8 - func_8024AF00(0x800, 0xfe); + case MAP_35_RBB_WAREHOUSE: + case MAP_36_RBB_BOATHOUSE: + case MAP_37_RBB_CONTAINER_1: + case MAP_38_RBB_CONTAINER_3: + case MAP_3E_RBB_CONTAINER_2: + core1_ce60_setChanMaskFromWaterState(0x800, 0xfe); break; - case MAP_40_CCW_HUB:// L8024B3FC - if(func_8024A8DC(0, 0, 0x802)){ - func_8024A8AC(7, 2.0f); - } - else if(0x5aa <= D_802806F8[2]){ - func_8024A8AC(0x407, 2.0f); - } - else if(D_802806F8[0] < -0x5a9){ - func_8024A8AC(0x707, 2.0f); - } - else if(D_802806F8[2] < -0x5a9){ - func_8024A8AC(0x1067, 2.0f); - } - else if(0x5aa <= D_802806F8[0]) { - func_8024A8AC(0x7007, 2.0f); + case MAP_40_CCW_HUB: + if (core1_ce60_isPlayerInRange(0, 0, 2050)) { + core1_ce60_setChanMaskWithValue(7, 2.0f); + } else if (1450 <= sPlayerPosition[2]){ + core1_ce60_setChanMaskWithValue(0x407, 2.0f); + } else if (sPlayerPosition[0] < -1449) { + core1_ce60_setChanMaskWithValue(0x707, 2.0f); + } else if (sPlayerPosition[2] < -1449) { + core1_ce60_setChanMaskWithValue(0x1067, 2.0f); + } else if (1450 <= sPlayerPosition[0]) { + core1_ce60_setChanMaskWithValue(0x7007, 2.0f); } break; - case MAP_A_TTC_SANDCASTLE: // L8024B4AC - func_8024AF00(0xCE, 0x3C); + case MAP_A_TTC_SANDCASTLE: + core1_ce60_setChanMaskFromWaterState(0xCE, 0x3C); break; - case MAP_43_CCW_SPRING:// L8024B4C0 - func_8024AF00(0x400, 0x7bbf); + case MAP_43_CCW_SPRING: + core1_ce60_setChanMaskFromWaterState(0x400, 0x7bbf); break; - case MAP_45_CCW_AUTUMN:// L8024B4D4 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x600); - } - else{ - func_8024A9EC(0); - func_8024A880(0x7BEF); + case MAP_45_CCW_AUTUMN: + if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x600); + } else { + core1_ce60_func_8024A9EC(0); + core1_ce60_setChanMask(0x7BEF); } break; - case MAP_54_UNUSED:// L8024B510 - case MAP_55_UNUSED:// L8024B510 - case MAP_57_UNUSED:// L8024B510 - case MAP_58_UNUSED:// L8024B510 - case MAP_59_UNUSED:// L8024B510 - func_8024AF00(0xc, 0x307b); + case MAP_54_UNUSED: + case MAP_55_UNUSED: + case MAP_57_UNUSED: + case MAP_58_UNUSED: + case MAP_59_UNUSED: + core1_ce60_setChanMaskFromWaterState(0xc, 0x307b); break; - case MAP_56_UNUSED:// L8024B524 - func_8024AF00(0x10, 0x4f6f); + case MAP_56_UNUSED: + core1_ce60_setChanMaskFromWaterState(0x10, 0x4f6f); break; - case MAP_27_FP_FREEZEEZY_PEAK:// L8024B538 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x400); - } - else if( mapSpecificFlags_get(0) && !jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)){ - func_8024A880(0x4bff); - } - else{ - func_8024A880(0x43ff); + case MAP_27_FP_FREEZEEZY_PEAK: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x400); + } else if (mapSpecificFlags_get(0) && !jiggyscore_isCollected(JIGGY_2F_FP_XMAS_TREE)) { + core1_ce60_setChanMask(0x4bff); + } else { + core1_ce60_setChanMask(0x43ff); } break; - case MAP_65_CCW_SPRING_WHIPCRACK_ROOM:// L8024B59C - func_8024A880(0x107); + case MAP_65_CCW_SPRING_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x107); break; - case MAP_66_CCW_SUMMER_WHIPCRACK_ROOM:// L8024B5AC - func_8024A880(0x1C7); + case MAP_66_CCW_SUMMER_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x1C7); break; - case MAP_67_CCW_AUTUMN_WHIPCRACK_ROOM:// L8024B5BC - func_8024A880(0xC07); + case MAP_67_CCW_AUTUMN_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0xC07); break; - case MAP_68_CCW_WINTER_WHIPCRACK_ROOM:// L8024B5CC - func_8024A880(0x1407); + case MAP_68_CCW_WINTER_WHIPCRACK_ROOM: + core1_ce60_setChanMask(0x1407); break; - case MAP_5E_CCW_SPRING_NABNUTS_HOUSE:// L8024B5DC - func_8024A880(0x41fe); + case MAP_5E_CCW_SPRING_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x41fe); break; - case MAP_5F_CCW_SUMMER_NABNUTS_HOUSE:// L8024B5EC - func_8024A880(0x71fe); + case MAP_5F_CCW_SUMMER_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x71fe); break; - case MAP_60_CCW_AUTUMN_NABNUTS_HOUSE:// L8024B5FC - func_8024A880(0x7fe); + case MAP_60_CCW_AUTUMN_NABNUTS_HOUSE: + core1_ce60_setChanMask(0x7fe); break; - case MAP_61_CCW_WINTER_NABNUTS_HOUSE:// L8024B60C - func_8024A880(0xbfe); + case MAP_61_CCW_WINTER_NABNUTS_HOUSE: + core1_ce60_setChanMask(0xbfe); break; - case MAP_63_CCW_AUTUMN_NABNUTS_WATER_SUPPLY:// L8024B61C - func_8024AF00(1, 0x7fe); + case MAP_63_CCW_AUTUMN_NABNUTS_WATER_SUPPLY: + core1_ce60_setChanMaskFromWaterState(1, 0x7fe); break; - case MAP_64_CCW_WINTER_NABNUTS_WATER_SUPPLY:// L8024B630 - func_8024AF00(1, 0xbfe); + case MAP_64_CCW_WINTER_NABNUTS_WATER_SUPPLY: + core1_ce60_setChanMaskFromWaterState(1, 0xbfe); break; - case MAP_69_GL_MM_LOBBY:// L8024B644 - if(func_8024A8DC(0xdb6, -0x65e, 0x4e2)) - func_8024A880(0x7c00); - else - func_8024A880(0x41ff); - break; - - case MAP_6A_GL_TTC_AND_CC_PUZZLE:// L8024B67C - if(0x2b8 <= D_802806F8[1] && func_8024A8DC(-0x615, -0x389, 0x1dd)){ - func_8024A880(0x8e40); - } - else if(func_8024A8DC(0x5dc, -0x37a, 0x226) || func_8024A8DC(0x754, -0x453, 0x172)){ - func_8024A880(0xf040); - } - else{ - func_8024A880(0x81ff); + case MAP_69_GL_MM_LOBBY: + if (core1_ce60_isPlayerInRange(3510, -1630, 1250)) { + core1_ce60_setChanMask(0x7c00); + } else { + core1_ce60_setChanMask(0x41ff); } break; - case MAP_6B_GL_180_NOTE_DOOR:// L8024B704 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8800); + case MAP_6A_GL_TTC_AND_CC_PUZZLE: + if (696 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-1557, -905, 477)) { + core1_ce60_setChanMask(0x8e40); + } else if (core1_ce60_isPlayerInRange(1500, -890, 550) || core1_ce60_isPlayerInRange(1876, -1107, 370)) { + core1_ce60_setChanMask(0xf040); + } else { + core1_ce60_setChanMask(0x81ff); } - else if(func_8024A8DC(0x10eb, 0x4f5, 0x730)) { - func_8024A880(0x8640); - } - else if(func_8024A8DC(-0x526, 0x777, 0x125) || func_8024A8DC(-0x515, 0x878, 0xea)){ - func_8024A880(0xf000); - }else{ - func_8024A880(0x81bf); + break; + + case MAP_6B_GL_180_NOTE_DOOR: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8800); + } else if (core1_ce60_isPlayerInRange(4331, 1269, 1840)) { + core1_ce60_setChanMask(0x8640); + } else if (core1_ce60_isPlayerInRange(-1318, 1911, 293) || core1_ce60_isPlayerInRange(-1301, 2168, 234)) { + core1_ce60_setChanMask(0xf000); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_6C_GL_RED_CAULDRON_ROOM:// L8024B794 - func_8024A880(0x81bf); + case MAP_6C_GL_RED_CAULDRON_ROOM: + core1_ce60_setChanMask(0x81bf); break; - case MAP_6D_GL_TTC_LOBBY:// L8024B7A4 - func_8024A880(0xf000); + case MAP_6D_GL_TTC_LOBBY: + core1_ce60_setChanMask(0xf000); break; - case MAP_70_GL_CC_LOBBY:// L8024B7B4 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8100); - } - else if(func_8024A8DC(-0x19d6, -0x1d3, 0x71e)){ - func_8024A880(0xf047); - } - else{ - func_8024A880(0x8e41); + case MAP_70_GL_CC_LOBBY: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8100); + } else if (core1_ce60_isPlayerInRange(-6614, -467, 1822)) { + core1_ce60_setChanMask(0xf047); + } else { + core1_ce60_setChanMask(0x8e41); } break; - case MAP_6E_GL_GV_LOBBY:// L8024B80C - if(func_8024A8DC(0, -0x1996, 0xe42)){ - func_8024A880(0xfe00); - } - else{ - func_8024A880(0x81ff); + case MAP_6E_GL_GV_LOBBY: + if (core1_ce60_isPlayerInRange(0, -6550, 3650)) { + core1_ce60_setChanMask(0xfe00); + } else { + core1_ce60_setChanMask(0x81ff); } break; - case MAP_6F_GL_FP_LOBBY:// L8024B844 - if(0xe75 <= D_802806F8[2]){ - func_8024A880(0xe040); - } - else{ - func_8024A880(0x81bf); + case MAP_6F_GL_FP_LOBBY: + if (3701 <= sPlayerPosition[2]){ + core1_ce60_setChanMask(0xe040); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_74_GL_GV_PUZZLE:// L8024B878 - if(func_8024A8DC(-0xa49, -0x1f, 0x203)){ - func_8024A880(0xe600); - } - else{ - func_8024A880(0x81ff); + case MAP_74_GL_GV_PUZZLE: + if (core1_ce60_isPlayerInRange(-2633, -31, 515)) { + core1_ce60_setChanMask(0xe600); + } else { + core1_ce60_setChanMask(0x81ff); } break; - case MAP_75_GL_MMM_LOBBY:// L8024B8B0 - case MAP_7A_GL_CRYPT:// L8024B8B0 - func_8024A880(0xd800); + case MAP_75_GL_MMM_LOBBY: + case MAP_7A_GL_CRYPT: + core1_ce60_setChanMask(0xd800); break; - case MAP_71_GL_STATUE_ROOM:// L8024B8C0 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x200); - } - else if(func_8024A8DC(-0xf0e, -0x15a, 0x302)){ - func_8024A880(0x9c00); - } - else{ - func_8024A880(0x81bf); + case MAP_71_GL_STATUE_ROOM: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x200); + } else if (core1_ce60_isPlayerInRange(-3854, -346, 770)) { + core1_ce60_setChanMask(0x9c00); + } else { + core1_ce60_setChanMask(0x81bf); } break; - case MAP_72_GL_BGS_LOBBY:// L8024B918 - if(D_80275C10 == -1 && D_80275C18 == 0){ + case MAP_72_GL_BGS_LOBBY: + if (D_80275C10 == -1 && D_80275C18 == FALSE) { D_80275C10 = func_802F9AA8(0x410); func_802F9F80(D_80275C10, 3.0f, 16777216.0f, 0.0f); func_802FA060(D_80275C10, 3500, 3500, 0.0f); @@ -540,120 +516,116 @@ void func_8024AF48(void){ D_80275C14 = func_802F9AA8(0x411); func_802F9F80(D_80275C14, 3.0f, 16777216.0f, 0.0f); func_802FA060(D_80275C14, 3500, 3500, 0.0f); - }//L8024B9BC + } - if(D_80275C1C != D_80275C18){ + if (D_80275C1C != D_80275C18) { D_80275C1C = D_80275C18; - if(D_80275C18){ + if (D_80275C18) { func_802F9FD0(D_80275C10, 0.0f, 0.0f, 3.0f); func_802F9FD0(D_80275C14, 0.0f, 0.0f, 3.0f); D_80275C10 = -1; D_80275C14 = 0; } - }//L8024BA2C - if(func_8024A8DC(0xb43, -0x2918, 0x1950)){ - D_80275C18 = 1; - func_8024A880(0xe040); } - else{ - D_80275C18 = 0; - func_8024A880(0x9c00); + + if (core1_ce60_isPlayerInRange(2883, -10520, 6480)) { + D_80275C18 = TRUE; + core1_ce60_setChanMask(0xe040); + } else { + D_80275C18 = FALSE; + core1_ce60_setChanMask(0x9c00); } break; - case MAP_76_GL_640_NOTE_DOOR:// L8024BA70 - func_8024AF00(0x8200, 0x81bf); + case MAP_76_GL_640_NOTE_DOOR: + core1_ce60_setChanMaskFromWaterState(0x8200, 0x81bf); break; - case MAP_77_GL_RBB_LOBBY:// L8024BA84 - func_8024AF00(0x8200, 0xf000); + case MAP_77_GL_RBB_LOBBY: + core1_ce60_setChanMaskFromWaterState(0x8200, 0xf000); break; - case MAP_78_GL_RBB_AND_MMM_PUZZLE:// L8024BA98 - if(player_getWaterState() == BSWATERGROUP_2_UNDERWATER){ - func_8024A880(0x8200); - } - else if(0x15a <= D_802806F8[1] && func_8024A8DC(-0x89a, 0x21a, 0x368)){ - func_8024A880(0x8C00); - } - else if(func_8024A8DC(-0x36, 0x14, 0xa5c)){ - func_8024A880(0x81bf); - } - else{ - func_8024A880(0xf000); + case MAP_78_GL_RBB_AND_MMM_PUZZLE: + if (player_getWaterState() == BSWATERGROUP_2_UNDERWATER) { + core1_ce60_setChanMask(0x8200); + } else if (346 <= sPlayerPosition[1] && core1_ce60_isPlayerInRange(-2202, 538, 872)) { + core1_ce60_setChanMask(0x8C00); + } else if (core1_ce60_isPlayerInRange(-54, 20, 2652)) { + core1_ce60_setChanMask(0x81bf); + } else { + core1_ce60_setChanMask(0xf000); } break; - case MAP_79_GL_CCW_LOBBY:// L8024BB2C - if(0x31c <= D_802806F8[1] && D_802806F8[1] < 0x44c && func_8024A8DC(0x1c, 0x11c9, 0x431)) - func_8024A880(0x81bf); - else if(-4 <= D_802806F8[1] && D_802806F8[1] < 0x168 && func_8024A8DC(0x87, 0x1373, 0x86c)) - func_8024A880(0x81bf); + case MAP_79_GL_CCW_LOBBY: + if(796 <= sPlayerPosition[1] && sPlayerPosition[1] < 1100 && core1_ce60_isPlayerInRange(28, 4553, 1073)) { + core1_ce60_setChanMask(0x81bf); + } else if (-4 <= sPlayerPosition[1] && sPlayerPosition[1] < 360 && core1_ce60_isPlayerInRange(135, 4979, 2156)) { + core1_ce60_setChanMask(0x81bf); + } else { + core1_ce60_setChanMask(0x9e00); + } + break; + + case MAP_80_GL_FF_ENTRANCE: + if(sPlayerPosition[2] < 0x4e2) + core1_ce60_setChanMask(0xe040); else - func_8024A880(0x9e00); + core1_ce60_setChanMask(0x9e00); break; - case MAP_80_GL_FF_ENTRANCE:// L8024BBBC - if(D_802806F8[2] < 0x4e2) - func_8024A880(0xe040); - else - func_8024A880(0x9e00); + case MAP_7F_FP_WOZZAS_CAVE: + core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && core1_ce60_isPlayerInRange(1561, 2426, 1690)) ? 0x7ff8 : 0); + core1_ce60_setChanMaskFromWaterState(0x20, 0x1f); break; - case MAP_7F_FP_WOZZAS_CAVE:// L8024BBF0 - func_8024A9EC((sns_get_item_state(SNS_ITEM_ICE_KEY, 1) && func_8024A8DC(0x619, 0x97a, 0x69a))? 0x7ff8 : 0); - func_8024AF00(0x20, 0x1f); + case MAP_8B_RBB_ANCHOR_ROOM: + core1_ce60_setChanMaskFromWaterState(0x800, 0x51ff); break; - case MAP_8B_RBB_ANCHOR_ROOM:// L8024BC40 - func_8024AF00(0x800, 0x51ff); + case MAP_34_RBB_ENGINE_ROOM: + core1_ce60_setChanMaskFromWaterState(0x800, 0x43fe); break; - case MAP_34_RBB_ENGINE_ROOM:// L8024BC54 - func_8024AF00(0x800, 0x43fe); - break; - - case MAP_91_FILE_SELECT:// L8024BC68 - if(!func_802C5A30()){ - func_8024A8AC(0x200, 0.5f); - } - else{ - func_8024A8AC(0x1ff, 0.5f); + case MAP_91_FILE_SELECT: + if (!func_802C5A30()) { + core1_ce60_setChanMaskWithValue(0x200, 0.5f); + } else { + core1_ce60_setChanMaskWithValue(0x1ff, 0.5f); } break; - case MAP_8C_SM_BANJOS_HOUSE:// L8024BC9C - func_8024A8AC(0x1ff, 0.5f); + case MAP_8C_SM_BANJOS_HOUSE: + core1_ce60_setChanMaskWithValue(0x1ff, 0.5f); break; - case MAP_1D_MMM_CELLAR:// L8024BCB0 - func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(D_802806F8[0] < 0x23a))? 0x7ff8 : 0); + case MAP_1D_MMM_CELLAR: + core1_ce60_func_8024A9EC((sns_get_item_state(SNS_ITEM_EGG_CYAN, 1) && !(sPlayerPosition[0] < 570)) ? 0x7ff8 : 0); break; - case MAP_46_CCW_WINTER:// L8024BCF0 - func_8024A9EC(0); + case MAP_46_CCW_WINTER: + core1_ce60_func_8024A9EC(0); break; - }//L8024BCF8 -} - -void func_8024BD08(s32 arg0){ - if(arg0){ - D_802806F0++; - } - else{ - D_802806F0--; } } -void func_8024BD40(s32 arg0, s32 arg1){ - if(arg1 == 3){ +void core1_ce60_incOrDecCounter(bool increment) { + if (increment) { + sUnusedCounter++; } - else{ - if(arg1 == 2){ - D_802806F4 = TRUE; - } - else{ - D_802806F4 = FALSE; - } + else { + sUnusedCounter--; + } +} + +void core1_ce60_func_8024BD40(s32 arg0, s32 arg1) { + if (arg1 == 3) + return; + + if (arg1 == 2) { + D_802806F4 = TRUE; + } + else { + D_802806F4 = FALSE; } } diff --git a/src/core1/code_1E6E0.c b/src/core1/crccalc.c similarity index 72% rename from src/core1/code_1E6E0.c rename to src/core1/crccalc.c index 1dd29784..1cd513ba 100644 --- a/src/core1/code_1E6E0.c +++ b/src/core1/crccalc.c @@ -1,44 +1,30 @@ #include -#include "functions.h" -#include "variables.h" +#include "core1/core1.h" // transform seed (in mips3 file) -u32 func_8025C29C(u32 *seed); +u32 func_8025C29C(u32 *seed); // TODO: This function does not exist in source code, why does it work? -void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]) -{ +void glcrc_calc_checksum(void *start, void *end, u32 checksum[2]) { u8 *p; - u32 shift = 0; - u64 seed = 0x8F809F473108B3C1; - u32 crc1 = 0; u32 crc2 = 0; - u32 tmp; // CRC1: Iterate forwards over bytes - for (p = start; (void *)p < end; p++) - { + for (p = start; (void *)p < end; p++) { seed += *p << (shift & 15); - tmp = func_8025C29C(&seed); - shift += 7; - crc1 ^= tmp; } // CRC2: Iterate backwards over bytes - for (p = (u8 *)end - 1; (void *)p >= start; p--) - { + for (p = (u8 *)end - 1; (void *)p >= start; p--) { seed += *p << (shift & 15); - tmp = func_8025C29C(&seed); - shift += 3; - crc2 ^= tmp; } diff --git a/src/core1/defragmanager.c b/src/core1/defragmanager.c index 10d62cb0..636b3adc 100644 --- a/src/core1/defragmanager.c +++ b/src/core1/defragmanager.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" diff --git a/src/core1/depthbuffer.c b/src/core1/depthbuffer.c new file mode 100644 index 00000000..d1c9b28d --- /dev/null +++ b/src/core1/depthbuffer.c @@ -0,0 +1,70 @@ +#include +#include "core1/core1.h" +#include "functions.h" +#include "variables.h" + +struct { + void *data; + int unk4; +} sDepthBuffer; + +void func_80253190(Gfx **gfx) { + func_80253208(gfx, 0, 0, gFramebufferWidth, gFramebufferHeight, gFramebuffers[getActiveFramebuffer()]); +} + +void func_80253208(Gfx **gfx, s32 x, s32 y, s32 w, s32 h, void *color_buffer){ + if( sDepthBuffer.data != NULL && (getGameMode() != GAME_MODE_4_PAUSED || func_80335134())){ + //draw z_buffer + gDPPipeSync((*gfx)++); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(sDepthBuffer.data)); + gDPSetCycleType((*gfx)++, G_CYC_FILL); + gDPSetRenderMode((*gfx)++, G_RM_NOOP, G_RM_NOOP2); + gDPSetFillColor((*gfx)++, 0xFFFCFFFC); + gDPScisFillRectangle((*gfx)++, x, y, x + w - 1, y + h - 1); + + //draw color_buffer + gDPPipeSync((*gfx)++); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_K0_TO_PHYSICAL(color_buffer)); + } +} + +int func_80253400(void){ + return sDepthBuffer.unk4; +} + +bool depthBuffer_isPointerSet(void) { + return sDepthBuffer.data != NULL; +} + +void depthBuffer_stub(void) {} + +void func_80253428(int arg0) { + u16 *var_v0; + int new_var; + if (arg0) { + var_v0 = (sDepthBuffer.data = &D_8000E800); + while (((s32) sDepthBuffer.data) % 0x40) { + var_v0 = (sDepthBuffer.data = var_v0 + 1); + } + + do { } while ((&D_8000E800 && 1) * 0); //remove this + }else{ + sDepthBuffer.data = NULL; + } + sDepthBuffer.unk4 = FALSE; +} + +void func_802534A8(int arg0) { + sDepthBuffer.unk4 = (sDepthBuffer.data != NULL && arg0); +} + +void zBuffer_set(Gfx **gfx) { + if (sDepthBuffer.data && getGameMode() != GAME_MODE_4_PAUSED) { + gDPPipeSync((*gfx)++); + gDPSetDepthImage((*gfx)++, sDepthBuffer.data); + } +} + +void *zBuffer_get(void) { + return sDepthBuffer.data; +} diff --git a/src/core1/eeprom.c b/src/core1/eeprom.c new file mode 100644 index 00000000..b8eed6cc --- /dev/null +++ b/src/core1/eeprom.c @@ -0,0 +1,30 @@ +#include +#include "core1/core1.h" +#include "save.h" + +#define ROUND_UP_DIVIDE(a, b) (((a) + (b) - 1) / (b)) + +// The round up divide is not technically needed, but will come in handy for modding +#define GAMEFILE_NUM_BLOCKS ROUND_UP_DIVIDE(sizeof(SaveData), EEPROM_BLOCK_SIZE) + +s32 eeprom_writeBlocks(s32 file, s32 offset, void *buffer, s32 count) { + s32 address = file * GAMEFILE_NUM_BLOCKS + offset; + s32 ret; + + func_8024F35C(3); + ret = osEepromLongWrite(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE); + func_8024F35C(0); + + return ret; +} + +s32 eeprom_readBlocks(s32 file, s32 offset, void *buffer, s32 count) { + s32 address = file * GAMEFILE_NUM_BLOCKS + offset; + s32 ret; + + func_8024F35C(3); + ret = osEepromLongRead(pfsManager_getFrameReplyQ(), address, buffer, count * EEPROM_BLOCK_SIZE); + func_8024F35C(0); + + return ret; +} diff --git a/src/core1/code_ABB0.c b/src/core1/framebufferdraw.c similarity index 64% rename from src/core1/code_ABB0.c rename to src/core1/framebufferdraw.c index 5b53b136..cd867003 100644 --- a/src/core1/code_ABB0.c +++ b/src/core1/framebufferdraw.c @@ -1,7 +1,5 @@ #include -#include "functions.h" -#include "variables.h" - +#include "core1/core1.h" #define IA8_I(ia) ((ia) >> 4) #define IA8_A(ia) ((ia) & 0xF) @@ -14,24 +12,12 @@ #define C5_TO_C8(c5) ((c5) << 3) #define C8_TO_C5(c5) ((c5) >> 3) +static s32 sPrimColor_r; +static s32 sPrimColor_g; +static s32 sPrimColor_b; +static s32 sBufferIndex; -void func_8024A3C8(s32 x, s32 y); -void draw_prim_rect(s32 x, s32 y, s32 w, s32 h); -void set_prim_color(s32 r, s32 g, s32 b); -void func_8024A85C(s32 buffer_indx); - - -extern u16 D_803A5D00[2][0xF660]; //framebuffer -extern s32 framebuffer_width; //framebuffer width -extern s32 framebuffer_height; //framebuffer height - -/* .bss */ -s32 D_802806E0; -s32 D_802806E4; -s32 D_802806E8; -s32 D_802806EC; - -void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) +void framebufferdraw_draw_CI4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { BKSpriteFrame *sprite_frame; s32 palette_offset; @@ -50,11 +36,11 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable s32 color1; s32 color2; - framebuffer = D_803A5D00[D_802806EC]; - sprite_frame = spriteGetFramePtr(sprite, (u32) frame); + framebuffer = gFramebuffers[sBufferIndex]; + sprite_frame = sprite_getFramePtr(sprite, (u32) frame); if (!alpha_enabled){ - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h); } //align palette @@ -78,12 +64,12 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable indx1 = ((*tmem) >> 4) & 0xF; indx2 = *tmem & 0xF; fb_x = (chunk->x + x) + ix; - if ((0 <= fb_x) && (fb_x < framebuffer_width)) + if ((0 <= fb_x) && (fb_x < gFramebufferWidth)) { fb_y = (chunk->y + y) + iy; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { - pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); + pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth); color1 = palette[indx1]; if (color1 & 1) { *pxl_ptr = color1; @@ -105,7 +91,7 @@ void draw_sprite_ci4(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable } } -void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) +void framebufferdraw_draw_CI8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { static s32 D_80275C00 = 0; u16 *palette; @@ -126,11 +112,11 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable if (D_80275C00 == 0xA) { D_80275C00 = 0; } - framebuffer = D_803A5D00[D_802806EC]; - sprite_frame = spriteGetFramePtr(sprite, (u32) frame); + framebuffer = gFramebuffers[sBufferIndex]; + sprite_frame = sprite_getFramePtr(sprite, (u32) frame); if (!alpha_enabled){ - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h); } palette = (u16 *) (sprite_frame + 1); @@ -149,12 +135,12 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable for (iy = 0; iy < chunk->h; iy++){ for (ix = 0; ix < chunk->w; ix++){ fb_x = (chunk->x + x) + ix; - if ((0 <= fb_x) && (fb_x < framebuffer_width)) + if ((0 <= fb_x) && (fb_x < gFramebufferWidth)) { fb_y = (chunk->y + y) + iy; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { - pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); + pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth); if (palette[*tmem] & 1){ *pxl_ptr = palette[*tmem]; } @@ -179,7 +165,7 @@ void draw_sprite_ci8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enable } -void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) { +void framebufferdraw_draw_RGBA16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) { BKSpriteFrame *sprite_ptr; BKSpriteTextureBlock *chunk_ptr; s16 *tmem; @@ -192,11 +178,11 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en u16 *pxl_ptr; u16 rgba; - framebuffer_ptr = &D_803A5D00[D_802806EC][0]; - sprite_ptr = spriteGetFramePtr(sprite, frame); + framebuffer_ptr = &gFramebuffers[sBufferIndex][0]; + sprite_ptr = sprite_getFramePtr(sprite, frame); if (!alpha_enabled) { - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, sprite_ptr->w, sprite_ptr->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, sprite_ptr->w, sprite_ptr->h); } chunk_ptr = (BKSpriteTextureBlock *)(sprite_ptr + 1); for(i_chunk = 0; i_chunk < sprite_ptr->chunkCnt; i_chunk++) { @@ -205,10 +191,10 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < framebuffer_width)) { + if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { + pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth); rgba = *tmem; if (rgba & 1) { *pxl_ptr = rgba; @@ -224,7 +210,7 @@ void draw_sprite_rgba16(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_en } } -void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) { +void framebufferdraw_draw_I4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) { BKSpriteFrame *frame_ptr; BKSpriteTextureBlock *chunk_ptr; s16 *temp_v0; @@ -239,11 +225,11 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable s32 txtr_x; u16 *fb_pxl_ptr; - framebuffer_ptr = &D_803A5D00[D_802806EC][0]; - frame_ptr = spriteGetFramePtr(sprite, frame); + framebuffer_ptr = &gFramebuffers[sBufferIndex][0]; + frame_ptr = sprite_getFramePtr(sprite, frame); if (!aplha_enabled) { - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h); } chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1); for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++) { @@ -252,12 +238,12 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < framebuffer_width)) { + if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) { + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { p1 = (*tmem >> 4); p2 = (*tmem & 0xF); - fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width); + fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth); if (p1) { *fb_pxl_ptr = (p1 << 0xC) | (p1 << 0x7) | (p1 << 0x2) | 1; } else if (!aplha_enabled) { @@ -277,7 +263,7 @@ void draw_sprite_i4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enable } } -void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) { +void framebufferdraw_draw_IA4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabled) { BKSpriteFrame *frame_ptr; BKSpriteTextureBlock *chunk_ptr; s16 *temp_v0; @@ -296,11 +282,11 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl s32 txtr_x; u16 *fb_pxl_ptr; - framebuffer_ptr = &D_803A5D00[D_802806EC][0]; - frame_ptr = spriteGetFramePtr(sprite, frame); + framebuffer_ptr = &gFramebuffers[sBufferIndex][0]; + frame_ptr = sprite_getFramePtr(sprite, frame); if (!aplha_enabled) { - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h); } chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1); for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++) { @@ -309,10 +295,10 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl for(txtr_y = 0; txtr_y < chunk_ptr->h; txtr_y++) { for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x += 2) { fb_x = chunk_ptr->x + x + txtr_x; - if ((fb_x >= 0) && (fb_x < framebuffer_width)) { + if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * framebuffer_width);\ + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { + fb_pxl_ptr = framebuffer_ptr + fb_x + (fb_y * gFramebufferWidth);\ p1 = (*tmem >> 4); p2 = (*tmem & 0xF); p1_i = p1 & 0xE; @@ -338,7 +324,7 @@ void draw_sprite_ia4(s32 x, s32 y, BKSprite *sprite, s32 frame, bool aplha_enabl } } -void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { +void framebufferdraw_draw_I8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { BKSpriteFrame *frame_ptr; BKSpriteTextureBlock *chunk_ptr; s16 *pixel_ptr; @@ -351,11 +337,11 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled s32 i_chunk; s32 txtr_y; - framebuffer_ptr = &D_803A5D00[D_802806EC][0]; - frame_ptr = spriteGetFramePtr(sprite, frame); + framebuffer_ptr = &gFramebuffers[sBufferIndex][0]; + frame_ptr = sprite_getFramePtr(sprite, frame); if (!alpha_enabled) { - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, frame_ptr->w, frame_ptr->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, frame_ptr->w, frame_ptr->h); } chunk_ptr = (BKSpriteTextureBlock *)(frame_ptr + 1); for(i_chunk = 0; i_chunk < frame_ptr->chunkCnt; i_chunk++){ @@ -366,10 +352,10 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled for(txtr_x = 0; txtr_x < chunk_ptr->w; txtr_x++){ fb_x = chunk_ptr->x + x + txtr_x; if (fb_x >= 0) { - if (fb_x < framebuffer_width) { + if (fb_x < gFramebufferWidth) { fb_y = chunk_ptr->y + y + txtr_y; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - pixel_ptr = framebuffer_ptr + fb_x + fb_y * framebuffer_width; + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { + pixel_ptr = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth; intensity = (s32) *txtr_ptr >> 3; if (intensity != 0) { *pixel_ptr = (intensity << 0xB) | (intensity << 6) | (intensity << 1) | 1; @@ -386,7 +372,7 @@ void draw_sprite_i8(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled } } -void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) { +void framebufferdraw_draw_IA8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabled) { BKSpriteFrame *sprite_frame; BKSpriteTextureBlock *chunk_ptr; s16 *temp_a1; @@ -400,12 +386,12 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl s32 var_t3; u32 temp_a2; - framebuffer_ptr = &D_803A5D00[D_802806EC][0]; - sprite_frame = spriteGetFramePtr(sprite, frame); + framebuffer_ptr = &gFramebuffers[sBufferIndex][0]; + sprite_frame = sprite_getFramePtr(sprite, frame); if (!alpha_enabled) { //draw blue rect over display area - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h); } chunk_ptr = (BKSpriteTextureBlock *)(sprite_frame + 1); for(i_chunk = 0; i_chunk < sprite_frame->chunkCnt; i_chunk++) { @@ -414,10 +400,10 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl for(var_t3 = 0; var_t3 < chunk_ptr->h; var_t3++){ for(var_a3 = 0; var_a3 < chunk_ptr->w; var_a3++) { fb_x = chunk_ptr->x + x + var_a3; - if ((fb_x >= 0) && (fb_x < framebuffer_width)) { + if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) { fb_y = chunk_ptr->y + y + var_t3; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) { - temp_a1 = framebuffer_ptr + fb_x + fb_y * framebuffer_width; + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { + temp_a1 = framebuffer_ptr + fb_x + fb_y * gFramebufferWidth; temp_a2 = *var_t2; if (IA8_A(temp_a2)) { *temp_a1 = I4_2_RGBA16(IA8_I(temp_a2), 1); @@ -433,7 +419,7 @@ void draw_sprite_ia8(s32 x, s32 y, BKSprite *sprite, s32 frame, bool alpha_enabl } } -void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled){ +void framebufferdraw_draw_RGBA32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled){ BKSpriteTextureBlock *chunk_ptr; u32 *tmem; u32 fb_value; @@ -455,11 +441,11 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena s32 blue8; - framebuffer = &D_803A5D00[D_802806EC][0]; - sprite_frame = spriteGetFramePtr(sprite, frame); + framebuffer = &gFramebuffers[sBufferIndex][0]; + sprite_frame = sprite_getFramePtr(sprite, frame); if (!alpha_enabled) { - set_prim_color(0, 0, 0x80); - draw_prim_rect(x, y, sprite_frame->w, sprite_frame->h); + framebufferdraw_setPrimColor(0, 0, 0x80); + framebufferdraw_drawRect(x, y, sprite_frame->w, sprite_frame->h); } chunk_ptr = (BKSpriteTextureBlock *) (sprite_frame + 1); for (i_chunk = 0; i_chunk < sprite_frame->chunkCnt; i_chunk++) { @@ -477,13 +463,13 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena for (ix = 0; ix < chunk_ptr->w; ix++) { fb_x = (chunk_ptr->x + x) + ix; - if ((fb_x >= 0) && (fb_x < framebuffer_width)) + if ((fb_x >= 0) && (fb_x < gFramebufferWidth)) { fb_y = (chunk_ptr->y + y) + iy; - if ((fb_y >= 0) && (fb_y < framebuffer_height)) + if ((fb_y >= 0) && (fb_y < gFramebufferHeight)) { txtr_value = *tmem; - pxl_ptr = (framebuffer + fb_x) + (fb_y * framebuffer_width); + pxl_ptr = (framebuffer + fb_x) + (fb_y * gFramebufferWidth); fb_value = (unsigned int) (*pxl_ptr); alpha = _SHIFTR(txtr_value, 0, 8); if (alpha) {//blend texture with existing pixel color @@ -507,13 +493,10 @@ void draw_sprite_rgba32(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_ena } } -void func_802499BC(s32 arg0, s32 arg1, s32 arg2, s32 arg3){//signature may have more variables passed in -} +void framebufferdraw_stub1(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {} //signature may have more variables passed in +void framebufferdraw_stub2(s32 arg0, s32 arg1, s32 arg2, s32 arg3) {} //signature may have more variables passed in -void func_802499D0(s32 arg0, s32 arg1, s32 arg2, s32 arg3){//signature may have more variables passed in -} - -void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled){ +void framebufferdraw_drawTexture_CI4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled) { s32 ix; s32 iy; s32 icolor; @@ -523,7 +506,7 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled palette_ptr = (u16*)tmem; pixel_ptr = (u8*)&palette_ptr[0x10]; - framebuffer_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width]; + framebuffer_ptr = &gFramebuffers[sBufferIndex][x + y * gFramebufferWidth]; for(iy = 0; iy < h; iy++){ for(ix = 0; ix < w; ix++){ icolor = (ix & 1)? pixel_ptr[ix/2 + (iy*w)/2] & 0xF @@ -531,35 +514,35 @@ void draw_texture_ci4(s32 x, s32 y, void *tmem, s32 w, s32 h, bool alpha_enabled *framebuffer_ptr = palette_ptr[icolor]; framebuffer_ptr++; } - framebuffer_ptr += (framebuffer_width - w); + framebuffer_ptr += (gFramebufferWidth - w); } } -void draw_sprite(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { - s16 temp_v0; +void framebufferdraw_draw(s32 x, s32 y, BKSprite *sprite, s32 frame, s32 alpha_enabled) { + s16 type; - temp_v0 = sprite->type; - if (temp_v0 & SPRITE_TYPE_I4) { - draw_sprite_i4(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_IA4) { - draw_sprite_ia4(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_I8) { - draw_sprite_i8(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_IA8) { - draw_sprite_ia8(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_RGBA16) { - draw_sprite_rgba16(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_RGBA32) { - draw_sprite_rgba32(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_CI4) { - draw_sprite_ci4(x, y, sprite, frame, alpha_enabled); - } else if (temp_v0 & SPRITE_TYPE_CI8) { - draw_sprite_ci8(x, y, sprite, frame, alpha_enabled); + type = sprite->type; + if (type & SPRITE_TYPE_I4) { + framebufferdraw_draw_I4(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_IA4) { + framebufferdraw_draw_IA4(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_I8) { + framebufferdraw_draw_I8(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_IA8) { + framebufferdraw_draw_IA8(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_RGBA16) { + framebufferdraw_draw_RGBA16(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_RGBA32) { + framebufferdraw_draw_RGBA32(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_CI4) { + framebufferdraw_draw_CI4(x, y, sprite, frame, alpha_enabled); + } else if (type & SPRITE_TYPE_CI8) { + framebufferdraw_draw_CI8(x, y, sprite, frame, alpha_enabled); } } //arg4 = alpha enabled? -void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { +void framebufferdraw_func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { s32 ix; s32 var_t2; s32 iy; @@ -571,11 +554,11 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { temp_v0 = func_8033EFB0(arg2, arg3); texture_ptr = (u16*)(temp_v0 + 1); if (*arg2 == SPRITE_TYPE_CI4) { - draw_texture_ci4(x, y, temp_v0 + 1, temp_v0->w, temp_v0->h, arg4); + framebufferdraw_drawTexture_CI4(x, y, temp_v0 + 1, temp_v0->w, temp_v0->h, arg4); return; } //otherwise RGBA16 - framebuffer_ptr = &D_803A5D00[D_802806EC][x + y*framebuffer_width]; + framebuffer_ptr = &gFramebuffers[sBufferIndex][x + y*gFramebufferWidth]; for(iy = 0; iy < temp_v0->h; iy++){ for(ix = 0; ix < temp_v0->w; ix++){ temp_v1 = *texture_ptr; @@ -587,11 +570,11 @@ void func_80249DE0(s32 x, s32 y, s16 *arg2, s32 arg3, s32 arg4) { texture_ptr++; framebuffer_ptr++; } - framebuffer_ptr += (framebuffer_width - temp_v0->w); + framebuffer_ptr += (gFramebufferWidth - temp_v0->w); } } -void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor) { +void framebufferdraw_func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mY, s32 mW, s32 mH, s32 maskColor, s32 mStride, bool dim, s32 replacementColor) { BKSpriteTextureBlock* mask_texture; s32 ix; s32 iy; @@ -600,7 +583,7 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mask_texture = func_8033EFB0(maskList, maskIndex); mask_ptr = (u16*)(mask_texture + 1) + mX + mY * mask_texture->w; - color_ptr = &D_803A5D00[D_802806EC][x + y * framebuffer_width]; + color_ptr = &gFramebuffers[sBufferIndex][x + y * gFramebufferWidth]; for(iy = 0; iy < mH; iy += mStride){ for(ix = 0; ix < mW; ix++){ @@ -618,126 +601,108 @@ void func_80249F34(s32 x, s32 y, Struct84s* maskList, s32 maskIndex, s32 mX, s32 mask_ptr++; } mask_ptr += ((mStride * mask_texture->w) - mW); - color_ptr += (framebuffer_width - mW); + color_ptr += (gFramebufferWidth - mW); } } -//fill framebuffer with vert and horz lines -void func_8024A284(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing) { - s32 var_s2; - s32 var_s3; +void framebufferdraw_drawGrid(s32 x, s32 y, s32 arg2, s32 arg3, s32 horz_spacing, s32 vert_spacing) { + s32 x1; + s32 y1; - for(var_s2 = 0; var_s2 < framebuffer_width; var_s2 += horz_spacing){ - for(var_s3 = 0; var_s3 < framebuffer_height; var_s3++){ - func_8024A3C8(x + var_s2, y + var_s3); + for (x1 = 0; x1 < gFramebufferWidth; x1 += horz_spacing) { + for (y1 = 0; y1 < gFramebufferHeight; y1++) { + framebufferdraw_setPixel(x + x1, y + y1); } } - for(var_s3 = 0; var_s3 < framebuffer_height; var_s3 += vert_spacing) { - for(var_s2 = 0; var_s2 < framebuffer_width; var_s2++){ - func_8024A3C8(x + var_s2, y + var_s3); + for (y1 = 0; y1 < gFramebufferHeight; y1 += vert_spacing) { + for (x1 = 0; x1 < gFramebufferWidth; x1++) { + framebufferdraw_setPixel(x + x1, y + y1); } } } -//fills in pixel in frame buffer with D_802806E0 color -void func_8024A3C8(s32 x, s32 y) { - s32 temp_v0; - - if (x >= 0) { - if ((x < framebuffer_width) && (y >= 0) && (y < framebuffer_height)) { - D_803A5D00[D_802806EC][x + y * framebuffer_width] = _SHIFTL(D_802806E0 >> 3, 11, 5) | _SHIFTL(D_802806E4 >> 3, 6, 5) | _SHIFTL(D_802806E8 >> 3, 1, 5) | _SHIFTL(1, 0, 1); - } +void framebufferdraw_setPixel(s32 x, s32 y) { + if ((x >= 0) && (x < gFramebufferWidth) && (y >= 0) && (y < gFramebufferHeight)) { + gFramebuffers[sBufferIndex][x + y * gFramebufferWidth] = _SHIFTL(sPrimColor_r >> 3, 11, 5) | _SHIFTL(sPrimColor_g >> 3, 6, 5) | _SHIFTL(sPrimColor_b >> 3, 1, 5) | _SHIFTL(1, 0, 1); } } -//draw rectangular outline -void func_8024A490(s32 x, s32 y, s32 w, s32 h) { - s32 var_s1; +void framebufferdraw_drawOutline(s32 x, s32 y, s32 w, s32 h) { + s32 x1; - for(var_s1 = 0; var_s1 < w; var_s1++){ - func_8024A3C8(x + var_s1, y); - func_8024A3C8(x + var_s1, y + h - 1); + for (x1 = 0; x1 < w; x1++) { + framebufferdraw_setPixel(x + x1, y); + framebufferdraw_setPixel(x + x1, y + h - 1); } - for(var_s1 = 1; var_s1 < h - 1; var_s1++){ - func_8024A3C8(x, y + var_s1); - func_8024A3C8(x + w - 1, y + var_s1); + + for (x1 = 1; x1 < h - 1; x1++) { + framebufferdraw_setPixel(x, y + x1); + framebufferdraw_setPixel(x + w - 1, y + x1); } } -void func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 arg6) -{ - s32 temp_a2; - s32 temp_a2_2; - s32 temp_a2_3; - s32 temp_f6; - s32 temp_f6_2; - s32 temp_lo; - s32 temp_t5; - s32 var_a0; - s32 var_a2; - s32 new_var; - f32 new_var3; - s32 new_var2; - s32 var_t1; - s32 var_t3; - s32 var_v0; - s32 var_v1; - u16 temp_t8; - s16 *var_t0; - s16 *var_t2; - var_v0 = 0; - var_v1 = framebuffer_width; - var_t0 = &D_803A5D00[D_802806EC][x + (y * framebuffer_width)]; - new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5); - new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5); - for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--) - { - temp_lo = (arg3 * arg5) + 0.5; - var_a2 = ((var_v0 >> 8) * arg3) << 8; - var_t2 = var_t0; - for (var_t3 = temp_lo; var_t3 != 0; var_t3--) +void framebufferdraw_func_8024A564(s32 x, s32 y, u16 *arg2, s32 arg3, s32 arg4, f32 arg5, f32 arg6) { + s32 temp_lo; + s32 var_a2; + s32 new_var; + f32 new_var3; + s32 new_var2; + s32 var_t1; + s32 var_t3; + s32 var_v0; + s32 fb_width; + s16 *pixel; + s16 *var_t2; + + var_v0 = 0; + fb_width = gFramebufferWidth; + pixel = &gFramebuffers[sBufferIndex][x + (y * gFramebufferWidth)]; + new_var = (s32) (((f64) (256.0f / (new_var3 = arg6))) + 0.5); + new_var2 = (s32) (((f64) (256.0f / arg5)) + 0.5); + + for (var_t1 = (arg4 * arg6) + 0.5; var_t1 != 0; var_t1--) { - *var_t2 = arg2[var_a2 >> 8]; - var_a2 += new_var2; - var_t2++; + temp_lo = (arg3 * arg5) + 0.5; + var_a2 = ((var_v0 >> 8) * arg3) << 8; + var_t2 = pixel; + + for (var_t3 = temp_lo; var_t3 != 0; var_t3--) { + *var_t2 = arg2[var_a2 >> 8]; + var_a2 += new_var2; + var_t2++; + } + + pixel += gFramebufferWidth; + var_v0 += new_var; } - - var_t0 += framebuffer_width; - var_v0 += new_var; - } - } -//fills in rectangle in frame buffer with D_802806E0 color -void draw_prim_rect(s32 x, s32 y, s32 w, s32 h) { - s32 var_s0; - s32 var_s1; - s32 var_s4; +void framebufferdraw_drawRect(s32 x, s32 y, s32 w, s32 h) { + s32 y1, x1; - var_s4 = 0; - for(var_s4 = 0; var_s4 < w; var_s4++) { - for(var_s0 = 0; var_s0 < h; var_s0++){ - func_8024A3C8(x + var_s4, y + var_s0); + for (x1 = 0; x1 < w; x1++) { + for (y1 = 0; y1 < h; y1++) { + framebufferdraw_setPixel(x + x1, y + y1); } } } -void func_8024A810(void){ - set_prim_color(0, 0x80, 0); - func_8024A85C(0); +void framebufferdraw_resetPrimColorAndBuffer(void) { + framebufferdraw_setPrimColor(0, 128, 0); + framebufferdraw_setBufferIndex(0); } -void set_prim_color(s32 r, s32 g, s32 b){ - D_802806E0 = r; - D_802806E4 = g; - D_802806E8 = b; +void framebufferdraw_setPrimColor(s32 r, s32 g, s32 b) { + sPrimColor_r = r; + sPrimColor_g = g; + sPrimColor_b = b; } -void func_8024A85C(s32 buffer_indx){ - D_802806EC = buffer_indx; +void framebufferdraw_setBufferIndex(s32 buffer_indx) { + sBufferIndex = buffer_indx; } -s32 func_8024A868(void){ - return D_802806EC; +s32 framebufferdraw_getBufferIndex(void) { + return sBufferIndex; } diff --git a/src/core1/inflate.c b/src/core1/inflate.c index cae594e4..9561cabb 100644 --- a/src/core1/inflate.c +++ b/src/core1/inflate.c @@ -1,8 +1,5 @@ #include -#include "functions.h" -#include "variables.h" - -#include "core1/rarezip.h" +#include "core1/core1.h" /* static */ int huft_build(b, n, s, d, e, t, m) unsigned *b; /* code lengths in bits (all assumed <= BMAX) */ diff --git a/src/core1/initthread.c b/src/core1/initthread.c index 3b3c57cb..14bf7474 100644 --- a/src/core1/initthread.c +++ b/src/core1/initthread.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" diff --git a/src/core1/code_18310.c b/src/core1/lookup.c similarity index 95% rename from src/core1/code_18310.c rename to src/core1/lookup.c index 152adaf3..c9647995 100644 --- a/src/core1/code_18310.c +++ b/src/core1/lookup.c @@ -1,8 +1,7 @@ #include -#include "functions.h" -#include "variables.h" +#include "core1/core1.h" -s16 D_802765C0[] ={ +static s16 sAnimAssetIds[] = { 0x0001, 0x0002, 0x0003, 0x0004, 0x0005, 0x0006, 0x0007, 0x0008, 0x0009, 0x000A, 0x029E, 0x000C, 0x000D, 0x000E, 0x029F, 0x0010, 0x0011, 0x0012, 0x0013, 0x0014, 0x0015, 0x0016, 0x0017, 0x0018, @@ -68,7 +67,7 @@ s16 D_802765C0[] ={ 0x012B, 0x012C, 0x012D, 0x012E, 0x012F, 0xFFFF }; -s16 D_802769AC[] = { +static s16 sSfxIds[] = { 0x0000, 0x0001, 0x0002, 0x0003, 0x018F, 0x0005, 0x008C, 0x0007, 0x0008, 0xFFFE, 0x000A, 0x000B, 0x000C, 0x000D, 0x000E, 0x000F, 0x0010, 0x0063, @@ -103,7 +102,7 @@ s16 D_802769AC[] = { 0x00A8, 0x00A9, 0xFFFF, 0x0000 }; -s16 D_80276B98[] = { +static s16 sCoMusicIds[] = { 0x002F, 0x0030, 0x0099, 0x005F, 0x0002, 0x0003, 0xFFFE, 0x0005, 0x0006, 0xFFFE, 0x0008, 0x0009, 0x000A, 0x000B, 0x000C, 0x000D, 0xFFFE, 0x000F, 0x0010, 0xFFFE, @@ -124,14 +123,14 @@ s16 D_80276B98[] = { 0xFFFE, 0xFFFE, 0xFFFE, 0x0044, 0xFFFF, 0x0000, 0x0000, 0x0000, }; -s32 func_80255D30(s32 arg0){ - return D_80276B98[arg0]; +enum comusic_e lookup_getCoMusicId(s32 idx) { + return sCoMusicIds[idx]; } -s32 func_80255D44(s32 arg0){ - return D_802769AC[arg0]; +enum sfx_e lookup_getSfxId(s32 idx) { + return sSfxIds[idx]; } -s32 func_80255D58(s32 arg0){ - return D_802765C0[arg0]; +enum asset_e lookup_getAnimAssetId(s32 idx) { + return sAnimAssetIds[idx]; } diff --git a/src/core1/memory.c b/src/core1/memory.c index 1e19f039..e2d65102 100644 --- a/src/core1/memory.c +++ b/src/core1/memory.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" #include "version.h" /* * Every chunk of allocated memory is prefixed with a HeapHeader. diff --git a/src/core1/code_18350.c b/src/core1/ml.c similarity index 91% rename from src/core1/code_18350.c rename to src/core1/ml.c index 3f586876..d1d7d7d7 100644 --- a/src/core1/code_18350.c +++ b/src/core1/ml.c @@ -1,12 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" -#include - - -/* .data*/ #if VERSION == VERSION_USA_1_0 u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS? u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS? @@ -14,9 +11,11 @@ u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS? u32 D_80276CB0 = 0x90FA97CB; //WHAT IS THIS? u32 D_80276CB4 = 0x8D96D002; //WHAT IS THIS? #endif + u16 *D_80276CB8 = NULL; //! ml_acosPrecValTblPtr + //! Might not be 90, but 91 or 92? Initial lowerIdx is OOB if 90 -f32 ml_acosValTbl[90] = { //D_80276CBC +f32 sLookupTableAcosDegrees[90] = { 1.0000000000, 0.9998480080, 0.9993910190, 0.9986299870, 0.9975640180, 0.9961950180, 0.9945219760, 0.9925460220, 0.9902679920, 0.9876880050, 0.9848080280, 0.9816269870, 0.9781479840, 0.9743700030, 0.9702960250, @@ -37,42 +36,27 @@ f32 ml_acosValTbl[90] = { //D_80276CBC 0.0871559978, 0.0697569996, 0.0523359999, 0.0348990001, 0.0174519997 }; -// .h -void func_80257918(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3]); -void ml_vec3f_roll_rotate_copy(f32 arg0[3], f32 arg1[3], f32); - #define _SQ2(x, y) ((x) * (x) + (y) * (y)) #define _SQ3(x, y, z) (((x) * (x)) + ((y) * (y)) + ((z) * (z))) -/* .code */ -f32 func_80255D70(f32 x) -{ +f32 ml_acosf_deg(f32 x) { s32 sign; s32 upperIdx; s32 lowerIdx; - f32 res; + f32 *table = sLookupTableAcosDegrees; - f32 *table = &ml_acosValTbl[0]; - - if (x < 0) - { - // Invert the result + if (x < 0) { sign = -1; - - // Precomputed values are all positive x = -x; - } - else - { + } else { sign = 1; } upperIdx = 0; - lowerIdx = 90 + 1; + lowerIdx = 91; - while (TRUE) - { + while (TRUE) { s32 idx = (upperIdx + lowerIdx) / 2; if (x > table[idx]) @@ -81,8 +65,7 @@ f32 func_80255D70(f32 x) upperIdx = idx; if (upperIdx + 1 == lowerIdx) - // Found the 1 degree range containing the result - break; + break; // Found the 1 degree range containing the result } // Check for trivial result @@ -95,19 +78,17 @@ f32 func_80255D70(f32 x) return sign > 0 ? res : 180 - res; } -void func_80255E58(f32 vec1[3], f32 vec2[3], f32 vec3[3], f32 vec4[3]) -{ +void ml_vec3f_sub_and_rotate(f32 vec1[3], f32 rotation[3], f32 vec2[3], f32 dst[3]) { f32 tmp[3]; - TUPLE_DIFF_COPY(tmp, vec3, vec1) + TUPLE_DIFF_COPY(tmp, vec2, vec1) - ml_vec3f_yaw_rotate_copy(tmp, tmp, -vec2[1]); - ml_vec3f_pitch_rotate_copy( tmp, tmp, -vec2[0]); - ml_vec3f_roll_rotate_copy(vec4, tmp, -vec2[2]); + ml_vec3f_yaw_rotate_copy(tmp, tmp, -rotation[1]); + ml_vec3f_pitch_rotate_copy( tmp, tmp, -rotation[0]); + ml_vec3f_roll_rotate_copy(dst, tmp, -rotation[2]); } -f32 func_80255F14(f32 vec1[3], f32 vec2[3]) -{ +f32 ml_vec3f_cos_between(f32 vec1[3], f32 vec2[3]) { f32 tmp1[3]; f32 tmp2[3]; @@ -117,32 +98,27 @@ f32 func_80255F14(f32 vec1[3], f32 vec2[3]) return TUPLE_DOT_PRODUCT(tmp1, tmp2); } -//ml_vec3f_cross_product -void ml_crossProduct_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3]) -{ +void ml_vec3f_cross_product(f32 dst[3], f32 vec1[3], f32 vec2[3]) { TUPLE_CROSS_PRODUCT(dst, vec1, vec2) } -void ml_interpolate_vec3f(f32 dst[3], f32 vec1[3], f32 vec2[3], f32 scale) -{ - dst[0] = vec1[0] + (vec2[0] - vec1[0]) * scale; - dst[1] = vec1[1] + (vec2[1] - vec1[1]) * scale; - dst[2] = vec1[2] + (vec2[2] - vec1[2]) * scale; +void ml_vec3f_interpolate_fast(f32 dst[3], f32 start[3], f32 end[3], f32 t) { + dst[0] = start[0] + (end[0] - start[0]) * t; + dst[1] = start[1] + (end[1] - start[1]) * t; + dst[2] = start[2] + (end[2] - start[2]) * t; } -f32 ml_dotProduct_vec3f(f32 vec1[3], f32 vec2[3]) -{ +f32 ml_vec3f_dot_product(f32 vec1[3], f32 vec2[3]) { return TUPLE_DOT_PRODUCT(vec1, vec2); } -f32 ml_distance_vec3f(f32 vec1[3], f32 vec2[3]) -{ +f32 ml_vec3f_distance(f32 vec1[3], f32 vec2[3]) { f32 diff[3]; TUPLE_DIFF_COPY(diff, vec1, vec2) return LENGTH_VEC3F(diff); } -f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) { +f32 ml_func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) { f32 sp4C[3]; f32 pad48; f32 sp3C[3]; @@ -157,7 +133,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) { sp20 = LENGTH_VEC3F(sp24); if (sp20 < 0.01) { - return ml_distance_vec3f(arg0, arg2); + return ml_vec3f_distance(arg0, arg2); } TUPLE_DIFF_COPY(sp3C, arg2, arg0) @@ -172,7 +148,7 @@ f32 func_802560D0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) { sp4C[0] = arg0[0] + (sp24[0] * sp30); sp4C[1] = arg0[1] + (sp24[1] * sp30); sp4C[2] = arg0[2] + (sp24[2] * sp30); - return ml_distance_vec3f(sp4C, arg2); + return ml_vec3f_distance(sp4C, arg2); } f32 ml_distanceSquared_vec3f(f32 vec1[3], f32 vec2[3]) @@ -651,7 +627,7 @@ void func_802578A4(f32 dst[3], f32 vec1[3], f32 vec2[3]) ml_vec3f_diff_copy(tmp1, &vec2[3], vec2); ml_vec3f_diff_copy(tmp2, &vec2[6], vec2); - ml_crossProduct_vec3f(tmp3, tmp1, tmp2); + ml_vec3f_cross_product(tmp3, tmp1, tmp2); ml_vec3f_normalize(tmp3); func_80257918(dst, vec1, vec2, tmp3); } @@ -767,7 +743,7 @@ void func_80257DB0(f32 arg0[3], f32 arg1[3], f32 arg2[3]) f32 tmp[3]; ml_vec3f_scale_copy(arg0, arg1, -1); - dot_product = ml_dotProduct_vec3f(arg0, arg2); + dot_product = ml_vec3f_dot_product(arg0, arg2); ml_vec3f_scale_copy(tmp, arg2, 2 * dot_product); ml_vec3f_diff_copy(arg0, tmp, arg0); } @@ -900,7 +876,7 @@ int func_80258210(f32 x, f32 y, f32 *dst) return TRUE; } -int ml_isZero_vec3f(f32 vec[3]) +bool ml_isZero_vec3f(f32 vec[3]) { return !(vec[0] != 0 || vec[1] != 0 || vec[2] != 0); } @@ -910,31 +886,26 @@ bool ml_isNonzero_vec3f(f32 vec[3]) return vec[0] != 0 || vec[1] != 0 || vec[2] != 0; } -//ml_vec3f_not_on_vertical_axis -int func_802583D8(f32 vec[3]) +bool ml_vec3f_not_on_vertical_axis(f32 vec[3]) { return vec[0] != 0 && vec[2] != 0; } -//ml_vec3f_inside_box_f -int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ) +bool ml_vec3f_inside_box_f(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ) { return vec[0] > minX && vec[0] < maxX && vec[1] > minY && vec[1] < maxY && vec[2] > minZ && vec[2] < maxZ; } -//ml_vec3f_inside_box_vec3f -int func_802584FC(f32 vec[3], f32 min[3], f32 max[3]) +bool ml_vec3f_inside_box_vec3f(f32 vec[3], f32 min[3], f32 max[3]) { return vec[0] > min[0] && vec[0] < max[0] && vec[1] > min[1] && vec[1] < max[1] && vec[2] > min[2] && vec[2] < max[2]; } -//ml_vec3w_inside_box_w -int func_802585E0(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ) -{ +bool ml_vec3w_inside_box_w(s32 vec[3], s32 minX, s32 minY, s32 minZ, s32 maxX, s32 maxY, s32 maxZ) { return vec[0] > minX && vec[0] < maxX && vec[1] > minY && vec[1] < maxY && vec[2] > minZ && vec[2] < maxZ; @@ -951,8 +922,7 @@ f32 ml_vec3f_horizontal_distance_zero_likely(f32 vec1[3], f32 vec2[3]) { return 0; } -//ml_vec3f_horizontal_distance_squared_zero_likely -f32 func_802586B0(f32 vec1[3], f32 vec2[3]) +f32 ml_vec3f_horizontal_distance_squared_zero_likely(f32 vec1[3], f32 vec2[3]) { f32 dX = vec1[0] - vec2[0]; f32 dZ = vec1[2] - vec2[2]; @@ -1281,20 +1251,16 @@ bool ml_vec3f_within_distance(f32 vec1[3], f32 vec2[3], f32 distance) return LENGTH_SQ_VEC3F(t) <= distance * distance; } -bool func_80259400(f32 a0) -{ +bool ml_stub_80259400(f32 x) { // wtf? - return *(u32 *)&a0 == 0x80 || *(u32 *)&a0 == 0x2A8800; + return *(u32 *)&x == 0x80 || *(u32 *)&x == 0x2A8800; } -void func_80259430(f32 *val) -{ - *val -= time_getDelta(); +void ml_sub_delta_time(f32 *x) { + *x -= time_getDelta(); - if (*val < 0) - *val = 0; - - return; + if (*x < 0) + *x = 0; } void func_8025947C(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]) @@ -1392,9 +1358,8 @@ void func_802596AC(f32 a0[3], f32 a1[3], f32 a2[3], f32 a3[3]) } -s32 func_8025975C(f32 a0) -{ - f32 val = (s32)(viewport_getYaw() - a0); +s32 ml_getViewportYawWithOffset(f32 x) { + f32 val = (s32)(viewport_getYaw() - x); while (val < 0) val += 360; @@ -1405,14 +1370,13 @@ s32 func_8025975C(f32 a0) return val; } -bool func_80259808(f32 a0) -{ - return func_8025975C(a0) < 0xB4; +bool ml_isViewportYawWithOffsetNormalized(f32 x) { + return ml_getViewportYawWithOffset(x) < 180; } -void func_8025982C(f32 dst[3], f32 arg1[3], f32 arg2[3], f32 arg3){ +void ml_vec3f_interpolate(f32 dst[3], f32 start[3], f32 end[3], f32 t) { int i; - for(i=0; i< 3; i++){ - dst[i] = arg1[i] + (arg2[i]-arg1[i])*arg3; + for (i = 0; i < 3; i++) { + dst[i] = start[i] + (end[i] - start[i]) * t; } } diff --git a/src/core1/code_13990.c b/src/core1/mlmtx.c similarity index 99% rename from src/core1/code_13990.c rename to src/core1/mlmtx.c index 0c593bf7..3bb4e7fd 100644 --- a/src/core1/code_13990.c +++ b/src/core1/mlmtx.c @@ -1,11 +1,11 @@ #include +#include "core1/core1.h" + #include "functions.h" #include "variables.h" #include "version.h" -#include "ml/mtx.h" - void _guRotateF(f32 mf[4][4], f32, f32, f32, f32); f32 func_80263FF0(f32); f32 cosf(f32); diff --git a/src/core1/os/jammesg.c b/src/core1/os/jammesg.c index 43fa40b0..aa777886 100644 --- a/src/core1/os/jammesg.c +++ b/src/core1/os/jammesg.c @@ -1,6 +1,4 @@ #include -#include "functions.h" -#include "variables.h" extern OSThread *__osRunningThread; diff --git a/src/core1/os/stopthread.c b/src/core1/os/stopthread.c index b410a019..a5a2cdef 100644 --- a/src/core1/os/stopthread.c +++ b/src/core1/os/stopthread.c @@ -1,6 +1,4 @@ #include -#include "functions.h" -#include "variables.h" extern OSThread *__osRunningThread; diff --git a/src/core1/overlay.c b/src/core1/overlay.c index 0d6aea64..3cb11bc6 100644 --- a/src/core1/overlay.c +++ b/src/core1/overlay.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -10,7 +11,6 @@ typedef struct{ extern struct49s D_803FFE10[]; -extern u8 D_8000E800; extern u8 D_8002D500; extern u32 D_8027BF2C; extern u32 D_8027BF30; diff --git a/src/core1/overlaymanager.c b/src/core1/overlaymanager.c index 21a9f7e2..da31303a 100644 --- a/src/core1/overlaymanager.c +++ b/src/core1/overlaymanager.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -17,7 +18,6 @@ typedef struct struct_2a_s{ } OverlayAddressMap; -extern u8 D_803A5D00; #define SEGMENT_EXTERNS(segname) \ extern u8 segname##_VRAM[]; \ @@ -111,7 +111,7 @@ s32 __overlayManager80251178(void){ sp18 = func_802546DC(); sp1C = __overlayManager80251170(); - return ((sp1C + &D_803A5D00) - largest_overlay->ram_end) + sp18; + return ((sp1C + (u8 *)gFramebuffers) - largest_overlay->ram_end) + sp18; } void __overlayManager802511C4(void){ diff --git a/src/core1/code_10A00.c b/src/core1/pfsmanager.c similarity index 95% rename from src/core1/code_10A00.c rename to src/core1/pfsmanager.c index 88727b35..ef5337e7 100644 --- a/src/core1/code_10A00.c +++ b/src/core1/pfsmanager.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -6,8 +7,6 @@ #define PFSMANAGER_THREAD_STACK_SIZE 0x200 -extern s32 D_803727F4; - extern struct { u8 pad0[4]; s32 unk4; @@ -15,22 +14,7 @@ extern struct { s32 unkC; } D_80379B90; -typedef struct { - s32 face_button[6]; - s32 side_button[3]; - s32 unk24[4]; - s32 start_button; -}Struct_core1_10A00_0; - -typedef struct { - s16 unk0; - s16 unk2; - u16 unk4; - u16 unk6; - f32 unk8[2]; - f32 joystick[2]; -}Struct_core1_10A00_1; - +extern s32 D_803727F4; extern s32 D_80276574; /* .data */ @@ -41,13 +25,14 @@ extern s32 D_80276574; s32 D_80275D30 = 0xED7BCDB7; //WHAT IS THIS? s32 D_80275D34 = 0xF82DC7AC; //WHAT IS THIS? #endif -s32 D_80275D38 = 0; + +static s32 D_80275D38 = 0; /* .bss */ UNK_TYPE(s32) D_802810E0[4][5]; u8 pfsManagerBitPattern; -Struct_core1_10A00_0 D_80281138[4]; -Struct_core1_10A00_0 D_80281218; +PfsManagerControllerData D_80281138[4]; +PfsManagerControllerData D_80281218; Struct_core1_10A00_1 D_80281250[4]; OSMesg pfsManagerContPollingMsqBuf; OSMesg pfsManagerContReplyMsgBuf; @@ -66,13 +51,6 @@ OSMesgQueue D_802816E8; OSMesg D_80281700[4]; u8 pad_D_80281710[1]; -/* .h */ -void func_8024F224(void); -void func_8024F35C(bool arg0); -void func_8024F450(void); -void func_8024F4AC(void); - -/* .code */ f32 func_8024E420(s32 arg0, s32 arg1, s32 arg2) { f32 phi_f2; @@ -101,7 +79,7 @@ void controller_copyFaceButtons(s32 controller_index, s32 dst[6]){ dst[FACE_BUTTON(BUTTON_C_RIGHT)] = D_80281138[controller_index].face_button[FACE_BUTTON(BUTTON_C_RIGHT)]; } -void func_8024E5A8(s32 controller_index, s32 dst[6]){ +void pfsManager_getFirstControllerFaceButtonState(s32 controller_index, s32 dst[6]){ dst[FACE_BUTTON(BUTTON_A)] = D_80281218.face_button[FACE_BUTTON(BUTTON_A)]; dst[FACE_BUTTON(BUTTON_B)] = D_80281218.face_button[FACE_BUTTON(BUTTON_B)]; dst[FACE_BUTTON(BUTTON_C_LEFT)] = D_80281218.face_button[FACE_BUTTON(BUTTON_C_LEFT)]; @@ -171,7 +149,9 @@ void pfsManager_update(void) { if (func_8023E000() == 3) { func_802E4384(); } + osSetThreadPri(0, 0x29); + D_802812D0.stick_x = pfsManagerContPadData[0].stick_x; D_802812D0.stick_y = pfsManagerContPadData[0].stick_y; D_802812D0.button = pfsManagerContPadData[0].button; @@ -304,7 +284,7 @@ void pfsManager_entry(void *arg) { } while (1); } -void pfsManager_init(void){ +void pfsManager_init(void) { osCreateMesgQueue(&pfsManagerContPollingMsqQ, &pfsManagerContPollingMsqBuf, 1); osCreateMesgQueue(&pfsManagerContReplyMsgQ, &pfsManagerContReplyMsgBuf, 1); osCreateThread(&sPfsManagerThread, 7, pfsManager_entry, NULL, sPfsManagerThreadStack + PFSMANAGER_THREAD_STACK_SIZE, 40); @@ -384,7 +364,7 @@ OSMesgQueue *pfsManager_getFrameMesgQ(void){ return &pfsManagerContPollingMsqQ; } -void func_8024F35C(bool arg0){ +void func_8024F35C(s32 arg0) { if(!arg0) func_8024F4AC(); else @@ -408,10 +388,10 @@ OSContPad *func_8024F3F4(void){ } /* initilizes D_802816E8 message queue */ -void func_8024F400(void){ +void func_8024F400(void) { D_80275D38 = TRUE; osCreateMesgQueue(&D_802816E8, &D_80281700, 5); - osSendMesg(&D_802816E8, 0, 0); + osSendMesg(&D_802816E8, 0, OS_MESG_NOBLOCK); } void func_8024F450(void){ @@ -422,5 +402,5 @@ void func_8024F450(void){ } void func_8024F4AC(void){ - osSendMesg(&D_802816E8, 0, 0); + osSendMesg(&D_802816E8, NULL, OS_MESG_NOBLOCK); } diff --git a/src/core1/pimanager.c b/src/core1/pimanager.c index 910e3df3..81b16c66 100644 --- a/src/core1/pimanager.c +++ b/src/core1/pimanager.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" diff --git a/src/core1/rumblemanager.c b/src/core1/rumblemanager.c index f8f7cf58..34e76908 100644 --- a/src/core1/rumblemanager.c +++ b/src/core1/rumblemanager.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -125,7 +126,7 @@ void rumbleManager_init(void) { osCreateMesgQueue(&D_80282390, &D_802823A8, 1); osCreateThread(&sRumbleThread, 8, rumbleThread_entry, NULL, sRumbleThreadStack + RUMBLE_THREAD_STACK_SIZE, 25); osStartThread(&sRumbleThread); - func_8024BDAC(&D_80282390, 0); + viMgr_func_8024BDAC(&D_80282390, 0); } } diff --git a/src/core1/code_1E360.c b/src/core1/sns.c similarity index 99% rename from src/core1/code_1E360.c rename to src/core1/sns.c index 7a1b029e..a2c760c4 100644 --- a/src/core1/code_1E360.c +++ b/src/core1/sns.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" /* .data*/ /** diff --git a/src/core1/sprite.c b/src/core1/sprite.c new file mode 100644 index 00000000..17fc5534 --- /dev/null +++ b/src/core1/sprite.c @@ -0,0 +1,28 @@ +#include +#include "core1/core1.h" + +u32 sprite_getUnk8(BKSprite *this) { + return this->unk8; +} + +u32 sprite_getUnkA(BKSprite *this) { + return this->unkA; +} + +u32 sprite_getUnk6(BKSprite *this) { + return this->unk6; +} + +u32 sprite_getUnk4(BKSprite *this) { + return this->unk4; +} + +s32 sprite_getFrameCount(BKSprite *this) { + return this->frameCnt; +} + +BKSpriteFrame *sprite_getFramePtr(BKSprite *this, u32 frame_id) { + BKSpriteFrame *sprite_frame; + sprite_frame = (BKSpriteFrame *) (this->offsets[frame_id] + ((s32) ((*this).offsets + this->frameCnt))); + return sprite_frame; +} diff --git a/src/core1/stub_13640.c b/src/core1/stub_13640.c new file mode 100644 index 00000000..0c9389d5 --- /dev/null +++ b/src/core1/stub_13640.c @@ -0,0 +1,20 @@ +#include +#include "core1/core1.h" + +s32 stub_13640_get(void); +void stub_13640_init(void); +void stub_13640_set(s32 value); + +static s32 sUnused; + +s32 stubVar_13640_get(void) { + return sUnused; +} + +void stub_13640_init(void) { + stub_13640_set(0); +} + +void stub_13640_set(s32 arg0) { + sUnused = arg0; +} diff --git a/src/core1/stub_1D590.c b/src/core1/stub_1D590.c new file mode 100644 index 00000000..7d3e710e --- /dev/null +++ b/src/core1/stub_1D590.c @@ -0,0 +1,7 @@ +#include +#include "core1/core1.h" + +void dummy_func_8025AFB0(void) {} +void dummy_func_8025AFB8(void) {} +void dummy_func_8025AFC0(Gfx **gfx, Mtx **mtx, Vtx **vtx) {} +s32 dummy_func_8025AFD0(void) { return 0; } diff --git a/src/core1/stub_2FA0.c b/src/core1/stub_2FA0.c new file mode 100644 index 00000000..bf8b1e8a --- /dev/null +++ b/src/core1/stub_2FA0.c @@ -0,0 +1,75 @@ +#include +#include "core1/core1.h" +#include "functions.h" + +// all functions in this file are unsued + +void stub_802409C0(f32 position[3], f32 speed); +void stub_80240A74(f32 position[3]); +f32 stub_80240A94(s32 time_out, f32 arg1); +void stub_80240AC8(f32 position[3], f32 speed); + +static s32 sTimeout = 0; + +void stub_802409C0(f32 position[3], f32 speed) { + f32 vp_rotation[3]; + f32 delta_position[3]; + f32 joystick_data[2]; + f32 dt; + + dt = time_getDelta() * speed; + controller_getJoystick(0, joystick_data); + + delta_position[0] = joystick_data[0] * dt; + delta_position[1] = 0.0f; + delta_position[2] = -(joystick_data[1] * dt); + + viewport_getRotation_vec3f(vp_rotation); + ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]); + + position[0] = position[0] + delta_position[0]; + position[1] = position[1] + delta_position[1]; + position[2] = position[2] + delta_position[2]; +} + +void stub_80240A74(f32 position[3]) { + stub_802409C0(position, 400.0f); +} + +f32 stub_80240A94(s32 time_out, f32 delta_time) { + if (time_out > 40) + time_out = 40; + + return delta_time + (f32) time_out * delta_time / 16; +} + +void stub_80240AC8(f32 position[3], f32 speed) { + f32 vp_rotation[3]; + f32 delta_position[3]; + f32 joystick_data[2]; + f32 dt; + + dt = time_getDelta() * speed; + controller_getJoystick(0, joystick_data); + + if (0.0f != joystick_data[0] || 0.0f != joystick_data[1]) { + sTimeout++; + if (sTimeout > 300) + sTimeout = 300; + } else { + sTimeout = 1; + } + + dt = stub_80240A94(sTimeout, dt); + + delta_position[0] = joystick_data[0] * dt; + delta_position[1] = 0.0f; + delta_position[2] = -(joystick_data[1] * dt); + + viewport_getRotation_vec3f(vp_rotation); + ml_vec3f_yaw_rotate_copy(delta_position, delta_position, vp_rotation[1]); + + position[0] = position[0] + delta_position[0]; + position[1] = position[1] + delta_position[1]; + position[2] = position[2] + delta_position[2]; +} diff --git a/src/core1/code_3A70.c b/src/core1/stub_3A70.c similarity index 73% rename from src/core1/code_3A70.c rename to src/core1/stub_3A70.c index be828b00..1da6873a 100644 --- a/src/core1/code_3A70.c +++ b/src/core1/stub_3A70.c @@ -1,13 +1,9 @@ #include -#include "functions.h" -#include "variables.h" +#include "core1/core1.h" -#include +// all functions in this file are unsued -extern f32 ml_cos_deg(f32); -extern f32 ml_sin_deg(f32); - -Gfx D_80275880[] = { +static Gfx sGfxSublist[] = { gsSPClearGeometryMode(G_CULL_BOTH | G_FOG | G_LIGHTING | G_TEXTURE_GEN | G_TEXTURE_GEN_LINEAR | G_LOD | G_SHADING_SMOOTH | G_CLIPPING | 0x0060CD00), gsSPTexture(0, 0, 0, G_TX_RENDERTILE, G_OFF), gsDPPipeSync(), @@ -18,34 +14,37 @@ Gfx D_80275880[] = { gsSPEndDisplayList() }; -/* .code */ -void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) { - s32 spB4[3]; +void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], bool cull_front, s32 arg7) { + s32 vp_position[3]; s32 var_a0; s32 var_v0; s32 var_v1; - s32 sp78[3][4]; + s32 colors[3][4]; s32 i; - viewport_getPosition_vec3w(spB4); - gSPDisplayList((*gfx)++, D_80275880); - if (arg6 != 0) { + viewport_getPosition_vec3w(vp_position); + + gSPDisplayList((*gfx)++, sGfxSublist); + + if (cull_front != FALSE) { gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_BACK); } else { gSPSetGeometryMode((*gfx)++, G_ZBUFFER | G_CULL_FRONT); } + gSPVertex((*gfx)++, *vtx, 8, 0); + for(i = 0; i < 2; i++){ for(var_a0 = 0; var_a0 < 2; var_a0++){ for(var_v1 = 0; var_v1 < 2; var_v1++){ var_v0 = (var_v1 == 0) ? arg2[0] : arg3[0]; - (*vtx)->v.ob[0] = (s16) (var_v0 - spB4[0]); + (*vtx)->v.ob[0] = (s16) (var_v0 - vp_position[0]); var_v0 = (i == 0) ? arg2[1] : arg3[1]; - (*vtx)->v.ob[1] = (s16) (var_v0 - spB4[1]); + (*vtx)->v.ob[1] = (s16) (var_v0 - vp_position[1]); var_v0 = (var_a0 == 0) ? arg2[2] : arg3[2]; - (*vtx)->v.ob[2] = (s16) (var_v0 - spB4[2]); + (*vtx)->v.ob[2] = (s16) (var_v0 - vp_position[2]); (*vtx)->v.flag = 0; (*vtx)->v.tc[0] = 0; @@ -62,50 +61,50 @@ void func_80241490(Gfx **gfx, Vtx **vtx, s32 arg2[3], s32 arg3[3], s32 arg4[3], if (arg7 != 0) { for(i = 0; i < 3; i++){ for(var_v1 = 0; var_v1 < 3; var_v1++){ - sp78[i][var_v1] = (arg4[var_v1] * arg5[i]) / 255; + colors[i][var_v1] = (arg4[var_v1] * arg5[i]) / 255; } - sp78[i][3] = 0xFF; + colors[i][3] = 0xFF; } } else { for(i = 0; i < 3; i++){ for(var_v1 = 0; var_v1 < 3; var_v1++){ - sp78[i][var_v1] = arg4[var_v1]; + colors[i][var_v1] = arg4[var_v1]; } - sp78[i][3] = arg5[i]; + colors[i][3] = arg5[i]; } } gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, sp78[0][0], sp78[0][1], sp78[0][2], sp78[0][3]); + gDPSetPrimColor((*gfx)++, 0, 0, colors[0][0], colors[0][1], colors[0][2], colors[0][3]); gSP2Triangles((*gfx)++, 7, 3, 5, 0, 5, 3, 1, 0); gSP1Quadrangle((*gfx)++, 6, 4, 0, 2, 0); gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, sp78[1][0], sp78[1][1], sp78[1][2], sp78[1][3]); + gDPSetPrimColor((*gfx)++, 0, 0, colors[1][0], colors[1][1], colors[1][2], colors[1][3]); gSP1Quadrangle((*gfx)++, 7, 6, 2, 3, 0); gSP2Triangles((*gfx)++, 4, 5, 0, 0, 5, 1, 0, 0); gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, sp78[2][0], sp78[2][1], sp78[2][2], sp78[2][3]); + gDPSetPrimColor((*gfx)++, 0, 0, colors[2][0], colors[2][1], colors[2][2], colors[2][3]); gSP1Quadrangle((*gfx)++, 5, 4, 6, 7, 0); gSP2Triangles((*gfx)++, 0, 1, 2, 0, 1, 3, 2, 0); } void func_80241928(Gfx** gfx, Vtx** vtx, s32 arg2[3], s32 arg3, s32 arg4[3]) { - s32 spB4[3]; + s32 vp_position[3]; f32 var_f26; s32 var_fp; s32 var_s0; - viewport_getPosition_vec3w(spB4); + viewport_getPosition_vec3w(vp_position); for(var_fp = 0; var_fp < 4; var_fp++){ - gSPDisplayList((*gfx)++, D_80275880); + gSPDisplayList((*gfx)++, sGfxSublist); gSPSetGeometryMode((*gfx)++, G_ZBUFFER); gSPVertex((*gfx)++, *vtx, 10, 0); for(var_f26 = 0; var_f26 <= 90; var_f26 += 22.5){ for(var_s0 = -300; var_s0 < 900; var_s0 += 600){ - (*vtx)->v.ob[0] = ((ml_sin_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[0]) - spB4[0]; - (*vtx)->v.ob[1] = ((var_s0 / 2) + arg2[1]) - spB4[1]; - (*vtx)->v.ob[2] = ((ml_cos_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[2]) - spB4[2]; + (*vtx)->v.ob[0] = ((ml_sin_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[0]) - vp_position[0]; + (*vtx)->v.ob[1] = ((var_s0 / 2) + arg2[1]) - vp_position[1]; + (*vtx)->v.ob[2] = ((ml_cos_deg(var_fp*90 + var_f26) * arg3) + (f32) arg2[2]) - vp_position[2]; (*vtx)->v.tc[0] = 0; (*vtx)->v.tc[1] = 0; (*vtx)->v.cn[0] = 0; @@ -164,7 +163,7 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3 sp68[2] *= arg5; viewport_getPosition_vec3f(sp5C); - gSPDisplayList((*gfx)++, D_80275880); + gSPDisplayList((*gfx)++, sGfxSublist); gSPSetGeometryMode((*gfx)++, G_ZBUFFER); gSPVertex((*gfx)++, *vtx, 8, 0); for( var_a0 = 0; var_a0 < 2; var_a0++){ @@ -203,51 +202,58 @@ void func_802424D4(Gfx **gfx, Mtx **mtx, Vtx **vtx, f32 arg3[3], f32 arg4[3], f3 } } -void func_80242BE8(Gfx **gfx, Vtx **arg1, f32 arg2[2][2][2][3], s32 arg3[3], s32 *arg4, s32 arg5) +void func_80242BE8(Gfx **gfx, Vtx **vtx, f32 arg2[2][2][2][3], s32 color[3], s32 alpha_values[3], s32 cull_back) { - f32 sp84[3]; + f32 vp_position[3]; #define var_v0 ((f32*)((u8*)arg2 + (i << 2) * sizeof(f32[3]) + (j << 1) * sizeof(f32[3]) + k * sizeof(f32[3]))) s32 i; s32 j; s32 k; - viewport_getPosition_vec3f(sp84); - gSPDisplayList((*gfx)++, D_80275880); - if (arg5){ + + viewport_getPosition_vec3f(vp_position); + + gSPDisplayList((*gfx)++, sGfxSublist); + + if (cull_back){ gSPSetGeometryMode((*gfx)++, G_CULL_BACK); } else { gSPSetGeometryMode((*gfx)++, G_CULL_FRONT); } - gSPVertex((*gfx)++, *arg1, 8, 0); - for(i = 0; i < 2; i++){ - for(j = 0; j < 2; j++){ - for(k = 0; k < 2; k++){ - (*arg1)->v.ob[0] = var_v0[0] - sp84[0]; - (*arg1)->v.ob[1] = var_v0[1] - sp84[1]; - (*arg1)->v.ob[2] = var_v0[2] - sp84[2]; - (*arg1)->v.flag = 0; - (*arg1)->v.tc[0] = 0; - (*arg1)->v.tc[1] = 0; - (*arg1)->v.cn[0] = 0; - (*arg1)->v.cn[1] = 0; - (*arg1)->v.cn[2] = 0; - (*arg1)->v.cn[3] = 0; - (*arg1)++; + + gSPVertex((*gfx)++, *vtx, 8, 0); + + for (i = 0; i < 2; i++) { + for (j = 0; j < 2; j++) { + for (k = 0; k < 2; k++) { + (*vtx)->v.ob[0] = var_v0[0] - vp_position[0]; + (*vtx)->v.ob[1] = var_v0[1] - vp_position[1]; + (*vtx)->v.ob[2] = var_v0[2] - vp_position[2]; + (*vtx)->v.flag = 0; + (*vtx)->v.tc[0] = 0; + (*vtx)->v.tc[1] = 0; + (*vtx)->v.cn[0] = 0; + (*vtx)->v.cn[1] = 0; + (*vtx)->v.cn[2] = 0; + (*vtx)->v.cn[3] = 0; + (*vtx)++; } } } + #undef var_v0 + gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[0]); + gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[0]); gSP2Triangles((*gfx)++, 7, 3, 5, 0, 5, 3, 1, 0); gSP1Quadrangle((*gfx)++, 6, 4, 0, 2, 0); gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[1]); + gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[1]); gSP1Quadrangle((*gfx)++, 7, 6, 2, 3, 0); gSP2Triangles((*gfx)++, 4, 5, 0, 0, 5, 1, 0, 0); gDPPipeSync((*gfx)++); - gDPSetPrimColor((*gfx)++, 0, 0, arg3[0], arg3[1], arg3[2], arg4[2]); + gDPSetPrimColor((*gfx)++, 0, 0, color[0], color[1], color[2], alpha_values[2]); gSP1Quadrangle((*gfx)++, 5, 4, 6, 7, 0); gSP2Triangles((*gfx)++, 0, 1, 2, 0, 1, 3, 2, 0); } diff --git a/src/core1/ucode.c b/src/core1/ucode.c new file mode 100644 index 00000000..99acb522 --- /dev/null +++ b/src/core1/ucode.c @@ -0,0 +1,39 @@ +#include +#include +#include "core1/core1.h" +#include "functions.h" +#include "variables.h" + +#define UCODE_SIZE 256 + +static u8 sUcodeData[UCODE_SIZE]; +static s32 D_80283380; +static s32 D_80283384; +static s32 D_80283388; + +void ucode_load(void) { + D_80283384 = *(s32 *)PHYS_TO_K1(0x04000000) ^ -1; + D_80283388 = D_80283384 ? 0x01 : 0x00; + + D_80283380 = *(s32 *)PHYS_TO_K1(0x04001000) ^ 0x17D7; + D_80283388 |= D_80283380 ? 0x02 : 0x00; + + if (D_80283388 == 0) { + piMgr_read(&sUcodeData, 0xB0000B70, UCODE_SIZE); + } +} + +void ucode_stub1(void) {} + +void ucode_stub2(void) { + osPiReadIo(0, NULL); +} + +s32 ucode_stub3(void) { + return 0; +} + +void ucode_getPtrAndSize(void **ptr, u32 *size) { + *ptr = &sUcodeData; + *size = UCODE_SIZE; +} diff --git a/src/core1/code_EAF0.c b/src/core1/viewport.c similarity index 95% rename from src/core1/code_EAF0.c rename to src/core1/viewport.c index 18baba1f..11cf7586 100644 --- a/src/core1/code_EAF0.c +++ b/src/core1/viewport.c @@ -1,12 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "core1/viewport.h" - extern void guPerspective(Mtx *, u16*, f32, f32, f32, f32, f32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); #define VIEWPORT_FOVY_DEFAULT (40.0f) #define VIEWPORT_STACK_SIZE (8) @@ -37,7 +35,7 @@ void viewport_moveAlongZAxis(f32 offset) { } f32 viewport_getDistance(f32 arg0[3]) { - ml_distance_vec3f(arg0, sViewportPosition); + ml_vec3f_distance(arg0, sViewportPosition); } void viewport_getLookVector(f32 arg0[3]) { @@ -77,7 +75,7 @@ void viewport_getRotation_f3(f32 *pitch, f32 *yaw, f32 *roll) { void viewport_setRenderViewportAndOrthoMatrix(Gfx **gfx, Mtx **mtx) { gSPViewport((*gfx)++, &sViewportStack[sViewportStackIndex]); - guOrtho(*mtx, -(2*(f32)framebuffer_width), (2*(f32)framebuffer_width), -(2*(f32)framebuffer_height), (2*(f32)framebuffer_height), 1.0f, 20.0f, 1.0f); + guOrtho(*mtx, -(2*(f32)gFramebufferWidth), (2*(f32)gFramebufferWidth), -(2*(f32)gFramebufferHeight), (2*(f32)gFramebufferHeight), 1.0f, 20.0f, 1.0f); gSPMatrix((*gfx)++, OS_K0_TO_PHYSICAL((*mtx)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION); guTranslate(*mtx, 0.0f, 0.0f, 0.0f); @@ -134,7 +132,7 @@ f32 viewport_debug3(void) { } void viewport_pushFramebufferExtendsToVpStack(void) { - viewport_pushVpScaleAndTranslation((s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2), (s32) ((f32)framebuffer_width/2), (s32) ((f32)framebuffer_height/2)); + viewport_pushVpScaleAndTranslation((s32) ((f32)gFramebufferWidth/2), (s32) ((f32)gFramebufferHeight/2), (s32) ((f32)gFramebufferWidth/2), (s32) ((f32)gFramebufferHeight/2)); } void viewport_reset(void) { @@ -365,7 +363,7 @@ bool viewport_func_8024DB50(f32 pos[3], f32 distance) { delta[2] = pos[2] - sViewportPosition[2]; for(i = 0; i < 4; i++) { - if(distance <= ml_dotProduct_vec3f(delta, sViewportFrustumPlanes[i])) { + if(distance <= ml_vec3f_dot_product(delta, sViewportFrustumPlanes[i])) { return FALSE; } } @@ -428,13 +426,13 @@ f32 viewport_transformCoordinate(f32 x, f32 y, f32 viewport_translation[3], f32 if ((sViewportFOVy != fovy) || (sViewportNear != near)) { fovy_rad = (sViewportFOVy * M_PI) / 360.0; - scale = (500.0 + sViewportNear) / (((framebuffer_height / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad)); + scale = (500.0 + sViewportNear) / (((gFramebufferHeight / (f32)2) / sinf(fovy_rad)) * cosf(fovy_rad)); fovy = sViewportFOVy; near = sViewportNear; } - x = x - (framebuffer_width / (f32)2); - y = (framebuffer_height / (f32)2) - y; + x = x - (gFramebufferWidth / (f32)2); + y = (gFramebufferHeight / (f32)2) - y; viewport_rotation[0] = sViewportRotation[0]; viewport_rotation[1] = sViewportRotation[1]; @@ -482,16 +480,16 @@ bool viewport_func_8024E030(f32 pos[3], f32 *arg1) } temp_f2 = gu_sqrtf((delta[1] * delta[1]) + (delta[2] * delta[2])) * sinf(fovy_radians); - temp_f2_2 = (((f32) framebuffer_width) / ((f32) framebuffer_height)) * temp_f2; + temp_f2_2 = (((f32) gFramebufferWidth) / ((f32) gFramebufferHeight)) * temp_f2; - arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) framebuffer_width) / 2)); - arg1[1] = (f32) ((1 - (delta[1] / temp_f2)) * (((f32) framebuffer_height) / 2)); + arg1[0] = (f32) (((delta[0] / temp_f2_2) + 1) * (((f32) gFramebufferWidth) / 2)); + arg1[1] = (f32) ((1 - (delta[1] / temp_f2)) * (((f32) gFramebufferHeight) / 2)); - if ((arg1[0] < (-((f32) framebuffer_width))) || ((((f32) framebuffer_width) * 2) < arg1[0])) { + if ((arg1[0] < (-((f32) gFramebufferWidth))) || ((((f32) gFramebufferWidth) * 2) < arg1[0])) { return FALSE; } - if ((arg1[1] < (-((f32) framebuffer_height))) || ((((f32) framebuffer_height) * 2) < arg1[1])) { + if ((arg1[1] < (-((f32) gFramebufferHeight))) || ((((f32) gFramebufferHeight) * 2) < arg1[1])) { return FALSE; } diff --git a/src/core1/code_E360.c b/src/core1/vimgr.c similarity index 54% rename from src/core1/code_E360.c rename to src/core1/vimgr.c index b45c4066..f10fc96d 100644 --- a/src/core1/code_E360.c +++ b/src/core1/vimgr.c @@ -1,20 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "version.h" +#define VIMANAGER_THREAD_STACK_SIZE 0x400 -void func_8024BF94(s32 arg0); -void func_8024C2F8(void *); - -typedef struct struct_1_s{ - OSMesgQueue *messageQueue; - OSMesg message; -} struct1; - -extern u32 D_80000300; - -OSViMode D_80275C80 = { +// Used in US 1.0 NTSC +static OSViMode sViMode_US10_NTSC = { OS_VI_NTSC_LPN1, { VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ @@ -33,7 +26,8 @@ OSViMode D_80275C80 = { } }; -OSViMode D_80275CD0 = { +// Used in US 1.0 MPAL (N64 SDK says: "mainly brazil") +static OSViMode sViMode_US10_MPAL = { OS_VI_MPAL_LPN1, { VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | 0x3200, /*ctrl*/ @@ -53,7 +47,8 @@ OSViMode D_80275CD0 = { }; #if VERSION == VERSION_PAL -OSViMode D_PAL_80275CD0 = { +// Used in PAL +static OSViMode sViMode_PAL = { OS_VI_PAL_LPN1, { VI_CTRL_TYPE_16 | VI_CTRL_GAMMA_DITHER_ON | VI_CTRL_GAMMA_ON | VI_CTRL_DIVOT_ON | 0x3100, /*ctrl*/ @@ -76,43 +71,34 @@ OSViMode D_PAL_80275CD0 = { // 42200000 3FAD097B 41F00000 457A0000 // C3A68832 DDC3A724 00000000 00000000 - -u32 gActiveFramebuffer; +static u32 sActiveFramebuffer; u32 D_80280724; u32 D_80280728; struct1 D_80280730[8]; -OSMesgQueue D_80280770; -OSMesg D_80280788[10]; -OSMesgQueue D_802807B0; -OSMesg D_802807C8[1]; -OSMesgQueue D_802807D0; -OSMesg D_802807E8[FRAMERATE]; +static OSMesgQueue sMesgQueue1; +static OSMesg sMesgBuffer1[10]; +static OSMesgQueue sMesgQueue2; +static OSMesg sMesgBuffer2[1]; +static OSMesgQueue sMesgQueue3; +static OSMesg sMesgBuffer3[FRAMERATE]; volatile s32 D_802808D8; s32 D_802808DC; -OSThread D_802808E0; -#define THREAD0_STACK_SIZE 0x400 -u8 thread0_stack[THREAD0_STACK_SIZE]; +static OSThread sViManagerThread; +static u8 sViManagerThreadStack[VIMANAGER_THREAD_STACK_SIZE]; - -extern u8 D_803A5D00[2][0x1ECC0]; //framebuffer - -void func_8024C428(void); - -/* .code */ -bool func_8024BD80(void){ - sizeof(OSThread); - return NOT(gActiveFramebuffer); +u32 getOtherFramebuffer(void) { + return NOT(sActiveFramebuffer); } -s32 func_8024BD94(void){ +s32 viMgr_func_8024BD94(void){ return D_80280724; } s32 getActiveFramebuffer(void){ - return gActiveFramebuffer; + return sActiveFramebuffer; } -void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ +void viMgr_func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ s32 i; for(i = 0; i < 8; i++){ if(D_80280730[i].messageQueue == NULL){ @@ -124,72 +110,79 @@ void func_8024BDAC(OSMesgQueue *mq, OSMesg msg){ } -void func_8024BE30(void){ +void viMgr_init(void) { s32 i; - func_8024C428(); + viMgr_clearFramebuffers(); + osCreateViManager(OS_PRIORITY_VIMGR); #if VERSION == VERSION_USA_1_0 if(osTvType != OS_TV_NTSC) - osViSetMode(&D_80275CD0); //PAL + osViSetMode(&sViMode_US10_MPAL); else - osViSetMode(&D_80275C80); //NTSC + osViSetMode(&sViMode_US10_NTSC); #elif VERSION == VERSION_PAL - osViSetMode(&D_PAL_80275CD0); //PAL + osViSetMode(&sViMode_PAL); #endif + osViSetSpecialFeatures(OS_VI_DITHER_FILTER_ON); osViSetSpecialFeatures(OS_VI_GAMMA_OFF); - osViSwapBuffer(&D_803A5D00); - osCreateMesgQueue(&D_80280770, D_80280788, 10); - osCreateMesgQueue(&D_802807B0, D_802807C8, 1); - osCreateMesgQueue(&D_802807D0, D_802807E8, FRAMERATE); - osViSetEvent(&D_80280770,NULL,1); - gActiveFramebuffer = 0; + osViSwapBuffer(&gFramebuffers[0]); + + osCreateMesgQueue(&sMesgQueue1, sMesgBuffer1, 10); + osCreateMesgQueue(&sMesgQueue2, sMesgBuffer2, 1); + osCreateMesgQueue(&sMesgQueue3, sMesgBuffer3, FRAMERATE); + osViSetEvent(&sMesgQueue1, NULL, 1); + + sActiveFramebuffer = 0; D_80280724 = 1; D_80280728 = 0; - for(i = 0; i<8; i++){ + + for (i = 0; i < 8; i++) { D_80280730[i].messageQueue = NULL; } + D_802808D8 = 0; - func_8024BF94(2); - osCreateThread(&D_802808E0,0,func_8024C2F8,NULL, thread0_stack + THREAD0_STACK_SIZE, 80); - osStartThread(&D_802808E0); + viMgr_func_8024BF94(2); + + osCreateThread(&sViManagerThread, 0, viMgr_entry, NULL, sViManagerThreadStack + VIMANAGER_THREAD_STACK_SIZE, 80); + osStartThread(&sViManagerThread); } -void func_8024BF94(s32 arg0){ +void viMgr_func_8024BF94(s32 arg0){ D_802808DC = arg0; } -s32 func_8024BFA0(void){ +s32 viMgr_func_8024BFA0(void){ return D_802808DC; } -void func_8024BFAC(void){ - osSendMesg(&D_802807B0, 0, OS_MESG_NOBLOCK); +void viMgr_func_8024BFAC(void){ + osSendMesg(&sMesgQueue2, 0, OS_MESG_NOBLOCK); } -void func_8024BFD8(s32 arg0){ +void viMgr_func_8024BFD8(s32 arg0){ static s32 D_80280E90; osSetThreadPri(NULL, 0x7f); defragManager_setPriority(0x1E); defragManager_80240874(); if(arg0){ - osRecvMesg(&D_802807B0, NULL, OS_MESG_BLOCK); + osRecvMesg(&sMesgQueue2, NULL, OS_MESG_BLOCK); } - while(D_802808D8 < func_8024BFA0() - D_80280E90){ - osRecvMesg(&D_802807D0, NULL, OS_MESG_BLOCK); + while(D_802808D8 < viMgr_func_8024BFA0() - D_80280E90){ + osRecvMesg(&sMesgQueue3, NULL, OS_MESG_BLOCK); } - while(D_802807D0.validCount){ - osRecvMesg(&D_802807D0, NULL, OS_MESG_NOBLOCK); + while(sMesgQueue3.validCount){ + osRecvMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK); } - osViSwapBuffer(D_803A5D00[gActiveFramebuffer = func_8024BD80()]); + osViSwapBuffer(gFramebuffers[sActiveFramebuffer = getOtherFramebuffer()]); D_80280E90 = 0; while(!(osDpGetStatus() & 2) && osViGetCurrentFramebuffer() != osViGetNextFramebuffer()){ - osRecvMesg(&D_802807D0, NULL, OS_MESG_BLOCK); + osRecvMesg(&sMesgQueue3, NULL, OS_MESG_BLOCK); D_80280E90++; }//L8024C178 D_80280724 = D_802808D8; @@ -199,35 +192,36 @@ void func_8024BFD8(s32 arg0){ defragManager_setPriority(0xA); } -void func_8024C1B4(void){ - func_8024BFD8(0); +void viMgr_func_8024C1B4(void){ + viMgr_func_8024BFD8(0); dummy_func_8025AFB8(); } -void func_8024C1DC(void){ - func_8024BFD8(1); +void viMgr_func_8024C1DC(void){ + viMgr_func_8024BFD8(1); } -void func_8024C1FC(OSMesgQueue *mq, OSMesg msg){ +void viMgr_func_8024C1FC(OSMesgQueue *mq, OSMesg msg) { s32 i; - for(i = 0; i < 8; i++){ - if(D_80280730[i].messageQueue == mq && D_80280730[i].message == msg){ + + for (i = 0; i < 8; i++) { + if (D_80280730[i].messageQueue == mq && D_80280730[i].message == msg) { D_80280730[i].messageQueue = NULL; return; } } } -void func_8024C2A0(s32 arg0) { - gActiveFramebuffer = arg0; - osViSwapBuffer(D_803A5D00[gActiveFramebuffer]); +void viMgr_setActiveFramebuffer(s32 fb_idx) { + sActiveFramebuffer = fb_idx; + osViSwapBuffer(gFramebuffers[sActiveFramebuffer]); } -void func_8024C2F8(void *arg0){ +void viMgr_entry(void *arg0){ s32 i; OSMesg sp48; do{ - osRecvMesg(&D_80280770, &sp48, OS_MESG_BLOCK); + osRecvMesg(&sMesgQueue1, &sp48, OS_MESG_BLOCK); func_80247380(); D_802808D8++; if(D_802808D8 == 420){ @@ -235,7 +229,7 @@ void func_8024C2F8(void *arg0){ func_802485BC(); #endif } - osSendMesg(&D_802807D0, NULL, OS_MESG_NOBLOCK); + osSendMesg(&sMesgQueue3, NULL, OS_MESG_NOBLOCK); for(i = 0; i < 8; i++){ if(D_80280730[i].messageQueue != NULL){ @@ -245,20 +239,19 @@ void func_8024C2F8(void *arg0){ }while(1); } -void func_8024C408(s32 arg0){ - osViBlack(arg0); +void viMgr_setScreenBlack(s32 active) { + osViBlack(active); } -void func_8024C428(void) { - //zeros all both framebuffers - func_80253034(&D_803A5D00, 0, (s32) ((f32)framebuffer_width*2*framebuffer_height*2)); - osWritebackDCache(&D_803A5D00, (s32) ((f32)framebuffer_width*2* framebuffer_height*2)); +void viMgr_clearFramebuffers(void) { + func_80253034(&gFramebuffers, 0, (s32) ((f32)gFramebufferWidth*2*gFramebufferHeight*2)); // TODO: This function does not exist in source code, why does it work? + osWritebackDCache(&gFramebuffers, (s32) ((f32)gFramebufferWidth*2*gFramebufferHeight*2)); } -s32 func_8024C4E8(void){ +s32 viMgr_func_8024C4E8(void) { return D_802808D8; } -void func_8024C4F8(s32 arg0){ +void viMgr_func_8024C4F8(s32 arg0) { D_802808D8 = arg0; } diff --git a/src/core2/abilityprogress.c b/src/core2/abilityprogress.c index b32c1547..535368ca 100644 --- a/src/core2/abilityprogress.c +++ b/src/core2/abilityprogress.c @@ -30,24 +30,24 @@ void ability_use(s32 arg0){ break; case 0x3://L8029569C // if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_DFC_TEXT_UNKNOWN; + sp2C = ASSET_DFC_DIALOG_UNKNOWN; } break; case 0x4://L802956B8 // if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_E02_TEXT_UNKNOWN; + sp2C = ASSET_E02_DIALOG_UNKNOWN; } break; case 0x5://L802956D4 //barge if(map_get() == MAP_1_SM_SPIRAL_MOUNTAIN){ - sp2C = ASSET_E05_TEXT_UNKNOWN; + sp2C = ASSET_E05_DIALOG_UNKNOWN; } break; case 0x6://L802956F0 //slide sp28 = 0; if (!ability_isUnlocked(ABILITY_10_TALON_TROT)) { if (map_get() == MAP_2_MM_MUMBOS_MOUNTAIN) { - sp2C = ASSET_B4D_TEXT_UNKNOWN; + sp2C = ASSET_B4D_DIALOG_UNKNOWN; } else { return; diff --git a/src/core2/ba/anim.c b/src/core2/ba/anim.c index d2624627..e7b4fc21 100644 --- a/src/core2/ba/anim.c +++ b/src/core2/ba/anim.c @@ -6,7 +6,6 @@ extern f32 func_802E4B38(void); -extern f32 ml_mapRange_f(f32, f32, f32, f32, f32); void baanim_80289F30(void); diff --git a/src/core2/ba/flap.c b/src/core2/ba/flap.c index 438fb996..ebd499ea 100644 --- a/src/core2/ba/flap.c +++ b/src/core2/ba/flap.c @@ -91,7 +91,7 @@ void baflap_update(void) { if (s_active != 0) { //update timers for(i = 0; i < 5; i++){ - func_80259430(&s_flap_list[i]); + ml_sub_delta_time(&s_flap_list[i]); } if (s_flap_max_timer != 0.0f) { temp_f0 = s_flap_max_timer; diff --git a/src/core2/ba/marker.c b/src/core2/ba/marker.c index f5e3b51c..7a3668e8 100644 --- a/src/core2/ba/marker.c +++ b/src/core2/ba/marker.c @@ -1,20 +1,18 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "core2/ba/physics.h" #include "version.h" #include "prop.h" -#include "SnS.h" extern void func_803012F8(void); -extern f32 ml_distanceSquared_vec3f(f32 arg0[3], f32 arg1[3]); extern void __baMarker_8028BA00(s32); extern void spawnQueue_actor_s16(void); extern void func_802A6388(f32); extern f32 chwadingboots_802D6E4C(Actor *); extern void set_turbo_duration(f32); extern f32 chtrainers_getDuration(Actor *); -extern int ml_vec3f_point_within_horizontal_distance(f32 vec[3], f32 x, f32 z, f32 val); 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); @@ -24,7 +22,7 @@ extern Actor *baModel_80291AAC(ActorMarker *marker, Gfx **gfx, Mtx **mtx, 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_findNodePropByActorId(enum actor_e actor_id, s32 position[3]); +extern NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e actor_id, s32 position[3]); typedef struct { @@ -116,7 +114,7 @@ void __baMarker_8028B848(void){ s0 = ASSET_E57_DIALOG_FIRST_JIGGY; } else if(map_get() == MAP_2_MM_MUMBOS_MOUNTAIN){ - s0 = ASSET_B45_TEXT_JIGGY_COLLECT_10; + s0 = ASSET_B45_DIALOG_JIGGY_COLLECT_10; } if(s0){ @@ -157,7 +155,7 @@ void __baMarker_8028B9A8(s32 arg0){ NodeProp *tmp_v0; s32 ideal_yaw[3]; - tmp_v0 = cubeList_findNodePropByActorId(0x1F6, 0); + tmp_v0 = cubeList_findNodePropByActorIdAndPosition_s32(0x1F6, NULL); nodeprop_getPosition_s32(tmp_v0, &ideal_yaw); func_802CA1CC(arg0); actor_spawnWithYaw_s32(ACTOR_47_EMPTY_HONEYCOMB, &ideal_yaw, 0); diff --git a/src/core2/ba/model.c b/src/core2/ba/model.c index c907e327..f3724cf0 100644 --- a/src/core2/ba/model.c +++ b/src/core2/ba/model.c @@ -6,9 +6,7 @@ #include "core2/ba/physics.h" void func_80254008(void); -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); void assetcache_release(void *); //assetcache_free -extern void ml_vec3f_assign(f32[3], f32, f32, f32); void func_8033A280(f32); extern s32 osCicId; diff --git a/src/core2/ba/physics.c b/src/core2/ba/physics.c index a575dfce..42864216 100644 --- a/src/core2/ba/physics.c +++ b/src/core2/ba/physics.c @@ -3,10 +3,6 @@ #include "variables.h" #include "core2/ba/physics.h" -extern f32 ml_sin_deg(f32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); -extern void func_80256D0C(f32, f32, f32, f32, f32, f32 *, f32 *, f32 *); -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); extern f32 climbGetRadius(void); extern f32 func_8029CED0(void); @@ -61,7 +57,7 @@ void __baphysics_update_normal(void){ if(func_80294548()){ func_80294480(sp54); ml_vec3f_normalize_copy(sp48, sp60); - sp44 = ml_dotProduct_vec3f(sp48, sp54); + sp44 = ml_vec3f_dot_product(sp48, sp54); sp40 = get_slope_timer(); if(sp44 != 0.0f){ if(sp44 < 0){ diff --git a/src/core2/bs/ant.c b/src/core2/bs/ant.c index 86fb00a1..157e963b 100644 --- a/src/core2/bs/ant.c +++ b/src/core2/bs/ant.c @@ -440,7 +440,7 @@ void bsant_die_update(void){ } void bsant_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/bFlap.c b/src/core2/bs/bFlap.c index e68c7040..29720a32 100644 --- a/src/core2/bs/bFlap.c +++ b/src/core2/bs/bFlap.c @@ -196,5 +196,5 @@ void bsbflap_end(void) { baphysics_reset_gravity(); baphysics_reset_terminal_velocity(); func_8029E090(0, 0.2f); - func_8030DA44(D_8037D30C); + sfxsource_freeSfxsourceByIndex(D_8037D30C); } diff --git a/src/core2/bs/bFly.c b/src/core2/bs/bFly.c index 566399af..14d9e529 100644 --- a/src/core2/bs/bFly.c +++ b/src/core2/bs/bFly.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/ba/physics.h" #include "core2/ba/flap.h" diff --git a/src/core2/bs/bLongLeg.c b/src/core2/bs/bLongLeg.c index fd80bdcd..c80ff853 100644 --- a/src/core2/bs/bLongLeg.c +++ b/src/core2/bs/bLongLeg.c @@ -152,7 +152,7 @@ void bsblongleg_enter_update(void){ void bsblongleg_enter_end(void){ func_802A5404(); - func_8030DA44(D_8037D361); + sfxsource_freeSfxsourceByIndex(D_8037D361); } void bsblongleg_stand_enter(void){ @@ -308,7 +308,7 @@ void bsblongleg_exit_update(void){ } void bsblongleg_exit_end(void){ - func_8030DA44(D_8037D361); + sfxsource_freeSfxsourceByIndex(D_8037D361); func_802A5404(); } diff --git a/src/core2/bs/bShock.c b/src/core2/bs/bShock.c index a8eed1ef..8f0aa431 100644 --- a/src/core2/bs/bShock.c +++ b/src/core2/bs/bShock.c @@ -116,7 +116,7 @@ void bsbshock_charge_update(void){ } void bsbshock_charge_end(void){ - func_8030DA44(D_8037D382); + sfxsource_freeSfxsourceByIndex(D_8037D382); func_8029E064(0); func_8029E070(0); if(baModel_80292230() != 0.0f){ diff --git a/src/core2/bs/bSwim.c b/src/core2/bs/bSwim.c index a862f573..aa7f1b42 100644 --- a/src/core2/bs/bSwim.c +++ b/src/core2/bs/bSwim.c @@ -464,7 +464,7 @@ void func_802A8098(void) { void func_802A82D4(void) { func_802906A4(1); func_80291548(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOn(); if (bs_getNextState() != BS_5A_LOADZONE) { func_80346CE8(); diff --git a/src/core2/bs/bWhirl.c b/src/core2/bs/bWhirl.c index 55780af8..cda6162c 100644 --- a/src/core2/bs/bWhirl.c +++ b/src/core2/bs/bWhirl.c @@ -39,7 +39,7 @@ static void __bsbwhirl_end(void){ func_8029B0C0(); func_8029E070(0); func_8025A55C(-1, 0xfa0, 0xd); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A7DC(COMUSIC_25_USING_GOLD_FEATHERS); } baanim_setUpdateType(BAANIM_UPDATE_1_NORMAL); @@ -86,7 +86,7 @@ void bsbwhirl_enter_init(void){ func_8029B324(1, 1.0f); func_8029E070(1); D_8037D3B0 = 0.0f; - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 0xfa0, 0xd); func_8025A6EC(0x25, 0x6d60); func_80299BD4(); diff --git a/src/core2/bs/beeMain.c b/src/core2/bs/beeMain.c index 8b7eddb9..ba6082c2 100644 --- a/src/core2/bs/beeMain.c +++ b/src/core2/bs/beeMain.c @@ -14,7 +14,6 @@ f32 baanim_getTimer(void); void baanim_setEndAndDuration(f32, f32); f32 func_8029B2E8(void); f32 func_8029B33C(void); -f32 ml_interpolate_f(f32, f32, f32); f32 func_8029B30C(); /* .data */ @@ -469,7 +468,7 @@ void func_802A1DD8(void){ } void func_802A1F2C(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); func_80291548(); func_80292EA4(); @@ -508,7 +507,7 @@ void func_802A2014(void){ void func_802A2054(void){ baMarker_collisionOn(); func_8025A2FC(-1, 0xFA0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_80291548(); func_80298A64(); } @@ -519,7 +518,7 @@ void func_802A2098(void){ yaw_setIdeal(func_8029B41C()); func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0, 0xFA0); func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE, -1); func_8029151C(0xC); diff --git a/src/core2/bs/croc.c b/src/core2/bs/croc.c index b0fd9ba7..df29eaeb 100644 --- a/src/core2/bs/croc.c +++ b/src/core2/bs/croc.c @@ -490,7 +490,7 @@ void bscroc_die_update(void){ } void bscroc_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/die.c b/src/core2/bs/die.c index 8b11a0e9..8ea676c6 100644 --- a/src/core2/bs/die.c +++ b/src/core2/bs/die.c @@ -124,7 +124,7 @@ void bsdie_update(void){ } void bsdie_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); func_8029E070(0); pitch_setIdeal(0.0f); diff --git a/src/core2/bs/dronexform.c b/src/core2/bs/dronexform.c index 56fa28a8..2e3219c0 100644 --- a/src/core2/bs/dronexform.c +++ b/src/core2/bs/dronexform.c @@ -1,16 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/ba/physics.h" extern void player_setYPosition(f32); extern void yaw_applyIdeal(void); -extern f32 func_80257A44(f32, f32); extern f32 cosf(f32); -extern f32 ml_remainder_f(f32, f32); -extern f32 func_80257AD4(f32, f32); /* .bss */ struct { diff --git a/src/core2/bs/jig.c b/src/core2/bs/jig.c index 7f183e11..13f9d8d0 100644 --- a/src/core2/bs/jig.c +++ b/src/core2/bs/jig.c @@ -32,7 +32,7 @@ void bsjig_jiggy_init(void){ yaw_setIdeal(func_8029B41C()); //face camera func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0,0xfa0); tmp = (item_getCount(ITEM_E_JIGGY) == 9); if(tmp == 0) //weird if... @@ -106,7 +106,7 @@ void bsjig_jiggy_end(void){ if(bs_getNextState() != BS_34_JIG_NOTEDOOR){ func_8025A2FC(-1, 0xfa0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } baMarker_collisionOn(); if( jiggyscore_total() == 100 @@ -148,7 +148,7 @@ void bsjig_jiggy_interrupt(void){ void bsjig_notedoor_end(void){ baMarker_collisionOn(); func_8025A2FC(-1, 0xfa0); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8029E070(0); func_80291548(); if( D_8037D4B2 @@ -174,7 +174,7 @@ void bsjig_notedoor_init(void){ func_8029C7F4(1,1,3, BA_PHYSICS_NORMAL); baphysics_set_target_horizontal_velocity(0.0f); if(bs_getPrevState() != BS_44_JIG_JIGGY){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A2FC(0,0xfa0); } func_8025A6EC(COMUSIC_42_NOTEDOOR_OPENING_FANFARE,-1); diff --git a/src/core2/bs/pumpkin.c b/src/core2/bs/pumpkin.c index f4a8dd22..29868e48 100644 --- a/src/core2/bs/pumpkin.c +++ b/src/core2/bs/pumpkin.c @@ -524,7 +524,7 @@ void bspumpkin_die_update(void){ void bspumpkin_die_end(void) { func_802B229C(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); diff --git a/src/core2/bs/timeout.c b/src/core2/bs/timeout.c index 67666b5f..1c159e76 100644 --- a/src/core2/bs/timeout.c +++ b/src/core2/bs/timeout.c @@ -17,7 +17,7 @@ void func_802B6270(void){ ncDynamicCamD_func_802BF2C0(80.0f); func_8025A58C(0,0xfa0); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8029E070(1); baMarker_collisionOff(); } @@ -42,7 +42,7 @@ void func_802B6314(void){ void func_802B63C8(void){ func_80292EA4(); func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_802B63F8(void){ @@ -58,7 +58,7 @@ void func_802B63F8(void){ ncDynamicCamD_func_802BF2C0(80.0f); func_8025A58C(0,0xfa0); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOff(); func_8029E3C0(0, 2.9f); } @@ -71,6 +71,6 @@ void func_802B64D0(void){ void func_802B6500(void){ func_8029E070(0); func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A904(); } diff --git a/src/core2/bs/walk.c b/src/core2/bs/walk.c index c9afc348..60ba74f4 100644 --- a/src/core2/bs/walk.c +++ b/src/core2/bs/walk.c @@ -11,7 +11,6 @@ f32 func_8029B2E8(void); void func_8029AD28(f32, s32); void baanim_scaleDuration(f32); f32 func_8029B30C(void); -f32 ml_interpolate_f(f32, f32, f32); void func_80299594(s32, f32); // .data diff --git a/src/core2/bs/walrus.c b/src/core2/bs/walrus.c index 61f9191d..a0960fa9 100644 --- a/src/core2/bs/walrus.c +++ b/src/core2/bs/walrus.c @@ -5,7 +5,6 @@ #include "core2/ba/physics.h" extern void func_8029AD68(f32, s32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); int bswalrus_inSet(enum bs_e state); @@ -77,7 +76,7 @@ void func_802B7F28(void) { if (900.0 < sp20[0] * sp20[0] + sp20[1] * sp20[1] + sp20[2] * sp20[2]) { ml_vec3f_normalize(sp20); func_80294480(sp2C); - if ( ml_dotProduct_vec3f(sp20, sp2C) < -0.2) { + if ( ml_vec3f_dot_product(sp20, sp2C) < -0.2) { sp3C += D_8037D5C0 * 350.0; } } @@ -508,7 +507,7 @@ void bswalrus_die_update(void){ } void bswalrus_die_end(void){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baphysics_reset_gravity(); pitch_setIdeal(0.0f); roll_setIdeal(0.0f); @@ -732,7 +731,7 @@ void bswalrus_timeout_init(void) { ncDynamicCamD_func_802BF2C0(60.0f); func_8025A58C(0, 4000); comusic_playTrack(COMUSIC_3C_MINIGAME_LOSS); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); baMarker_collisionOff(); func_8029E3C0(0, 2.9f); func_802B813C(); @@ -749,7 +748,7 @@ void func_802B9830(void) { void func_802B9880(void) { func_80291548(); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); func_8025A904(); func_80292EA4(); func_802B80D0(); diff --git a/src/core2/ch/badShad.c b/src/core2/ch/badShad.c index 1a222c26..cbc9483a 100644 --- a/src/core2/ch/badShad.c +++ b/src/core2/ch/badShad.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void __spawnQueue_add_2(void (*)(s32, s32), s32, s32); diff --git a/src/core2/ch/bat.c b/src/core2/ch/bat.c index 65726619..e014a398 100644 --- a/src/core2/ch/bat.c +++ b/src/core2/ch/bat.c @@ -4,7 +4,6 @@ #include extern f32 mapModel_getFloorY(f32[3]); -extern f32 func_80257204(f32, f32, f32, f32); typedef enum { CH_BAT_STATE_ROOSTING = 1, diff --git a/src/core2/ch/beehive.c b/src/core2/ch/beehive.c index 78df9245..e29e7947 100644 --- a/src/core2/ch/beehive.c +++ b/src/core2/ch/beehive.c @@ -35,7 +35,7 @@ void chBeehive_die(ActorMarker *this, ActorMarker *other){ __spawnQueue_add_4((GenFunction_4)spawnQueue_actor_f32, ACTOR_4A_WOOD_EXPLOSION, reinterpret_cast(s32, actor->position[0]), reinterpret_cast(s32, actor->position[1]), reinterpret_cast(s32, actor->position[2])); actor->marker->propPtr->unk8_3 = 0; func_803115C4(ASSET_D96_DIALOG_BEEHIVE_MEET); - func_803115C4(ASSET_DA6_TEXT_BEEHIVE_WITH_BEES); + func_803115C4(ASSET_DA6_DIALOG_BEEHIVE_WITH_BEES); } void chBeehive_update(Actor *this){ diff --git a/src/core2/ch/bigbutt.c b/src/core2/ch/bigbutt.c index ec0903ef..01ed1a4a 100644 --- a/src/core2/ch/bigbutt.c +++ b/src/core2/ch/bigbutt.c @@ -263,7 +263,7 @@ void func_802C6240(Actor *this){ if (0.0f == this->actor_specific_1_f) { animctrl_setPlaybackType(this->animctrl, ANIMCTRL_LOOP); subaddie_set_state_with_direction(this, 1, 0.65f, 1); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; sfxsource_playHighPriority(SFX_19_BANJO_LANDING_08); } @@ -358,7 +358,7 @@ Actor *func_802C6E84(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx){ break; case 4://L802C6F50 if((globalTimer_getTime() & 1) == 1){ - if(func_80259808(actor->yaw)){ + if(ml_isViewportYawWithOffsetNormalized(actor->yaw)){ func_802C6E3C(0xb, sp34); func_802C6E3C(0xa, sp34); } diff --git a/src/core2/ch/bottlesbonus.c b/src/core2/ch/bottlesbonus.c index 1ef89412..46631dcf 100644 --- a/src/core2/ch/bottlesbonus.c +++ b/src/core2/ch/bottlesbonus.c @@ -1,9 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include -extern void func_8025982C(f32[3], f32[3], f32[3], f32); extern void func_8025A6CC(enum comusic_e arg0, s32 arg1); extern void chBottlesBonusCursor_func_802DF99C(void); extern f32 *chBottlesBonusCursor_func_802E05AC(s32); @@ -327,8 +326,8 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { switch(chBottlesBonusCursor_func_802E0538(i)){ case 1://L802DDBB4 chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2); - func_8025982C(D_8037DEBC[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2)); - func_8025982C(D_8037DEBC[i].unk1C, D_8037DEB8[i].unk1C, D_8037DEC4[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i]/ 0.2)); + ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2)); + ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEB8[i].unk1C, D_8037DEC4[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i]/ 0.2)); func_80345D30(spAC, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC); func_803458E4(spBC, D_8037DEB8[i].unkC, spAC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); @@ -346,7 +345,7 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { break; case 2://L802DDD9C chBottlesBonus_func_802DD484(spD8, spD4, 1.0f, 0.2); - func_8025982C(D_8037DEBC[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2)); + ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD60C(i), chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.2)); func_80345D30(sp9C, chBottlesBonusCursor_func_802E068C(i), D_8037DEB8[i].unkC); func_80345D30(sp8C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC); func_803458E4(D_8037DEBC[i].unkC, sp9C, sp8C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2)); @@ -363,15 +362,15 @@ void chBottlesBonus_func_802DD8AC(BoneTransformList *arg0, s32 arg1) { case 3://L802DDF48 chBottlesBonusCursor_func_802DF460(40 + i, chBottlesBonusMarker, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0); - func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); - func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); + ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); + ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEC4[chBottlesBonusCursor_func_802E0588(i)].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); func_80345D30(sp7C, chBottlesBonusCursor_func_802E0664(i), D_8037DEB8[i].unkC); func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, sp7C, chBottlesBonus_func_802DD804(D_8037DF18[i] / 0.2)); break; case 0://L802DE084 - func_8025982C(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); - func_8025982C(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEB8[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); + ml_vec3f_interpolate(D_8037DEBC[i].unk0, D_8037DEC0[i].unk0, D_8037DEB8[i].unk0, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); + ml_vec3f_interpolate(D_8037DEBC[i].unk1C, D_8037DEC0[i].unk1C, D_8037DEB8[i].unk1C, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); func_803458E4(D_8037DEBC[i].unkC, D_8037DEC0[i].unkC, D_8037DEB8[i].unkC, chBottlesBonus_func_802DD804(D_8037DEC8[i] / 0.4)); break; } @@ -521,7 +520,7 @@ void chBottlesBonus_update(Actor *this) { func_8025A7DC(COMUSIC_98_BBONUS_PIECES_SHUFFLE); if (D_8037DCC7 == 0) { func_80311714(0); - gcdialog_showText(ASSET_E24_TEXT_UNKNOWN, 0x87, this->position, chBottlesBonusMarker, chBottlesBonus_startTimer, NULL); + gcdialog_showText(ASSET_E24_DIALOG_UNKNOWN, 0x87, this->position, chBottlesBonusMarker, chBottlesBonus_startTimer, NULL); func_80311714(1); D_8037DCC7 = 1; } diff --git a/src/core2/ch/bottlesbonuscursor.c b/src/core2/ch/bottlesbonuscursor.c index a9ab5bd3..b1a60543 100644 --- a/src/core2/ch/bottlesbonuscursor.c +++ b/src/core2/ch/bottlesbonuscursor.c @@ -1,18 +1,16 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #ifndef ABS #define ABS(d) ((d) >= 0) ? (d) : -(d) #endif -extern s16 D_803A5D00[2][0xF660]; //framebuffer extern u8 D_8037DCC8; //bottles bonus flags??? -extern void ml_vec3f_assign(f32[3], f32, f32, f32); extern void func_8025AABC(enum comusic_e); extern f32 func_8024E420(s32, s32, s32); extern f32 func_8033DDB8(void); @@ -156,7 +154,7 @@ void chBottlesBonusCursor_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { func_80253208(gfx, (s32)(D_8037E5C0.unk18[0] - sp3C/2), (s32)(D_8037E5C0.unk18[1] - sp3C/2), (s32)sp3C, (s32)sp3C, - D_803A5D00[getActiveFramebuffer()] + gFramebuffers[getActiveFramebuffer()] ); modelRender_draw(gfx, mtx, this->position, rotation, this->scale, NULL, marker_loadModelBin(chBottlesBonusCursorMarker)); viewport_func_8024E030(this->position, D_8037E5C0.unk10); diff --git a/src/core2/ch/clankerwhipcrack.c b/src/core2/ch/clankerwhipcrack.c index 910107a3..f9c9317a 100644 --- a/src/core2/ch/clankerwhipcrack.c +++ b/src/core2/ch/clankerwhipcrack.c @@ -37,7 +37,7 @@ void func_803567EC(Actor *this){ } player_getPosition(plyr_pos); - plyr_dist = ml_distance_vec3f(plyr_pos, this->position); + plyr_dist = ml_vec3f_distance(plyr_pos, this->position); if(this->state == 1){ if(plyr_dist < 700.0f) func_80356770(this, 2); diff --git a/src/core2/ch/climbBase.c b/src/core2/ch/climbBase.c index 434828db..a6864ff5 100644 --- a/src/core2/ch/climbBase.c +++ b/src/core2/ch/climbBase.c @@ -5,7 +5,6 @@ void func_802D77D4(Actor *this); extern void player_setClimbParams(f32[3], f32[3], f32, u32); -extern f32 ml_vec3f_horizontal_distance_zero_likely(f32[3], f32[3]); typedef struct { f32 unk0[3]; diff --git a/src/core2/ch/clucker.c b/src/core2/ch/clucker.c index 27911f4b..c2b46874 100644 --- a/src/core2/ch/clucker.c +++ b/src/core2/ch/clucker.c @@ -148,7 +148,7 @@ void func_8035765C(Actor *this){ }//L803576EC player_getPosition(sp5C); - sp58 = ml_distance_vec3f(this->position, sp5C); + sp58 = ml_vec3f_distance(this->position, sp5C); if(this->state == 1){ if(sp58 < this->scale*800.0f){ func_80357264(this, 2); diff --git a/src/core2/ch/code_468E0.c b/src/core2/ch/code_468E0.c index b1cb9007..e141c927 100644 --- a/src/core2/ch/code_468E0.c +++ b/src/core2/ch/code_468E0.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include void func_802CD898(Actor *); void func_802CD8C0(Actor *); diff --git a/src/core2/ch/code_CFA60.c b/src/core2/ch/code_CFA60.c index b102d835..bac2a31d 100644 --- a/src/core2/ch/code_CFA60.c +++ b/src/core2/ch/code_CFA60.c @@ -96,7 +96,7 @@ void func_80356CCC(Actor *this){ func_803569F0(this, (this->state < 5)? 1 : 6); }//L80356D48 player_getPosition(sp5C); - sp58 = ml_distance_vec3f(this->position, sp5C); + sp58 = ml_vec3f_distance(this->position, sp5C); if( this->state == 1){ if( sp58 < this->scale*400.0f && (map_get() != MAP_3C_RBB_KITCHEN || this->position_z < sp5C[2]) diff --git a/src/core2/ch/crab.c b/src/core2/ch/crab.c index 44549163..cab76e25 100644 --- a/src/core2/ch/crab.c +++ b/src/core2/ch/crab.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern bool ml_vec3f_point_within_horizontal_distance(f32[3], f32, f32, f32); - /* .data */ ActorAnimationInfo chCrabAnimations[] ={ { 0, 0.0f}, diff --git a/src/core2/ch/firefx.c b/src/core2/ch/firefx.c index 2da1186b..8e2327e8 100644 --- a/src/core2/ch/firefx.c +++ b/src/core2/ch/firefx.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include void chfirefx_update(Actor *this); diff --git a/src/core2/ch/flotsam.c b/src/core2/ch/flotsam.c index ca953359..ac5f4f58 100644 --- a/src/core2/ch/flotsam.c +++ b/src/core2/ch/flotsam.c @@ -146,7 +146,7 @@ void func_8035C080(Actor *this, s32 next_state){ } } else if(next_state == 3){//L8035C4C0 - if(ml_distance_vec3f(local->unk28, this->position) < 10.0f){ + if(ml_vec3f_distance(local->unk28, this->position) < 10.0f){ func_8035C080(this, 1); return; } @@ -293,11 +293,11 @@ void func_8035C8F4(Actor *this){ local->unk0 += 1.9047619047619049*sp34; if(1.0f <= local->unk0) local->unk0 = 1.0f; - ml_interpolate_vec3f(this->position, local->unk10, local->unk1C, local->unk0); + ml_vec3f_interpolate_fast(this->position, local->unk10, local->unk1C, local->unk0); this->position_y += 100.0f*sinf(local->unk0*3.141592654); this->yaw = local->unk0*(local->unk34[2] - local->unk34[1]) + local->unk34[1]; if(skeletalAnim_getLoopCount(this->unk148) > 0){ - if(ml_distance_vec3f(this->position, local->unk28) < 10.0f){ + if(ml_vec3f_distance(this->position, local->unk28) < 10.0f){ func_8035C080(this, 1); } else if(local->unkC > 0){//L8035CB8C diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index 50b8b9aa..91102ff5 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -24,8 +24,6 @@ extern void func_802C74F4(Actor *, s32, f32 ); extern void warp_lairEnterLairFromSMLevel(s32, s32); extern void warp_smExitBanjosHouse(s32, s32); extern void func_80335110(s32); - -extern void func_8024E60C(s32, s32[3]); extern void controller_getJoystick(s32, f32*); extern char *gcpausemenu_TimeToA(int); diff --git a/src/core2/ch/gloop.c b/src/core2/ch/gloop.c index bd97fa88..ba5d505d 100644 --- a/src/core2/ch/gloop.c +++ b/src/core2/ch/gloop.c @@ -60,7 +60,7 @@ void chgloop_update(Actor *this){ if( !mapSpecificFlags_get(2) && func_80329530(this, 350) - && gcdialog_showText(ASSET_D34_TEXT_GLOOP_MEET, 0, NULL, NULL, NULL, NULL) + && gcdialog_showText(ASSET_D34_DIALOG_GLOOP_MEET, 0, NULL, NULL, NULL, NULL) ){ mapSpecificFlags_set(2, TRUE); } diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index ee3de36f..9ef509a7 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -7,7 +7,6 @@ Actor *func_8035ECA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_8035F138(Actor *this); BKModelBin *func_803257B4(ActorMarker *marker); extern void actor_postdrawMethod(ActorMarker *); -extern f32 func_80257204(f32, f32, f32, f32); typedef struct { s32 unk0; @@ -91,7 +90,7 @@ void func_8035EDB0(f32 position[3], s32 count, enum asset_e sprite) { void func_8035EE48(Actor *this){ u8 val = this->unk44_31; if(val != 0){ - func_8030DA44(val); + sfxsource_freeSfxsourceByIndex(val); this->unk44_31 = 0; } } diff --git a/src/core2/ch/icecube.c b/src/core2/ch/icecube.c index 954493af..e4c0f549 100644 --- a/src/core2/ch/icecube.c +++ b/src/core2/ch/icecube.c @@ -4,7 +4,6 @@ #define _HorzDist3v(v1, v2) ((v1[0]-v2[0])*(v1[0]-v2[0]) + (v1[2]-v2[2])*(v1[2]-v2[2])) extern void func_802D729C(Actor *, f32); -extern f32 func_80257204(f32, f32, f32, f32); extern Actor *bundle_spawn_f32(enum actor_e, f32[3]); void chicecube_update(Actor *this); diff --git a/src/core2/ch/jinjo.c b/src/core2/ch/jinjo.c index df850953..938cd45e 100644 --- a/src/core2/ch/jinjo.c +++ b/src/core2/ch/jinjo.c @@ -173,7 +173,7 @@ void chJinjo_update(Actor * this){ sp40[1] += 50.0f; jiggy_spawn(10*level_get()-9, sp40); }//L802CE0CC - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8032BB88(this, 0, 4000); if(local->unk4){ func_8025A6EC(COMUSIC_30_5TH_JINJO_COLLECTED, 28000); @@ -248,7 +248,7 @@ void chJinjo_update(Actor * this){ func_80326310(this); if(local->unk4 == 0){ func_8032BB88(this, -1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } }//L802CE518 @@ -263,7 +263,7 @@ void chJinjo_update(Actor * this){ if(local->unk4 && actor_animationIsAt(this,0.95f)){ func_8032BB88(this, -1, 4000); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } }//L802CE598 diff --git a/src/core2/ch/mole.c b/src/core2/ch/mole.c index 31822185..65d0a6c4 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_TEXT_BOTTLES_ALL_MM_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_B4E_DIALOG_BOTTLES_ALL_MM_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_2_TREASURE_TROVE_COVE: - return learned_all_moves ? ASSET_A27_TEXT_BOTTLES_ALL_TTC_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_A27_DIALOG_BOTTLES_ALL_TTC_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_3_CLANKERS_CAVERN: - return learned_all_moves ? ASSET_D37_TEXT_BOTTLES_ALL_CC_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_D37_DIALOG_BOTTLES_ALL_CC_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_4_BUBBLEGLOOP_SWAMP: - return learned_all_moves ? ASSET_C8A_TEXT_BOTTLES_ALL_BGS_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C8A_DIALOG_BOTTLES_ALL_BGS_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_5_FREEZEEZY_PEAK: - return learned_all_moves ? ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; case LEVEL_7_GOBIS_VALLEY: - return learned_all_moves ? ASSET_C2A_TEXT_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return learned_all_moves ? ASSET_C2A_DIALOG_BOTTLES_ALL_FP_GV_MOVES_LEARNED : ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; default: - return ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED; + return ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED; } } @@ -157,9 +157,9 @@ void chmole_healthRefill(ActorMarker *marker, enum asset_e arg1, s32 arg2){ if( arg1 == moleTable[actor->unkF4_8-9].teach_text_id && item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL) ){ - gcdialog_showText(ASSET_D39_TEXT_BOTTLES_REFILL_HEALTH, 7, 0, actor->marker, chmole_healthRefill, chmole_additionalAbilityLearnActions); + gcdialog_showText(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_TEXT_BOTTLES_REFILL_HEALTH){ + 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{//L802D97BC @@ -294,7 +294,7 @@ void chmole_spawnMolehill(ActorMarker *marker){ void func_802D9C90(Actor *this){ u8 tmp_a1 = this->unk44_31; if(tmp_a1){ - func_8030DA44(tmp_a1); + sfxsource_freeSfxsourceByIndex(tmp_a1); } } @@ -387,7 +387,7 @@ void chmole_update(Actor *this){ && (func_8028ECAC() == 0 || func_8028ECAC() == BSGROUP_8_TROT) ){ player_getPosition(sp34); - if (ml_distance_vec3f(sp34, this->velocity) < this->actor_specific_1_f) { + if (ml_vec3f_distance(sp34, this->velocity) < this->actor_specific_1_f) { chmole_startingDialog(this); } } @@ -413,7 +413,7 @@ void chmole_update(Actor *this){ }//L802DA128 if(actor_animationIsAt(this, 0.9999f)){ chmole_setFacingDirection(this); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } else if(actor_animationIsAt(this, 0.14f)){//L802DA154 @@ -466,7 +466,7 @@ void chmole_update(Actor *this){ } else if(actor_animationIsAt(this, 0.9999f)){//L802DA45C func_802D9600(this); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } break; diff --git a/src/core2/ch/overlaynocontroller.c b/src/core2/ch/overlaynocontroller.c index 3102ee81..15a047c2 100644 --- a/src/core2/ch/overlaynocontroller.c +++ b/src/core2/ch/overlaynocontroller.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern Actor *actor_spawnWithYaw_f32(enum actor_e, f32[3], s32); diff --git a/src/core2/ch/overlaypressstart.c b/src/core2/ch/overlaypressstart.c index d0601760..9a83be17 100644 --- a/src/core2/ch/overlaypressstart.c +++ b/src/core2/ch/overlaypressstart.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); diff --git a/src/core2/ch/snacker.c b/src/core2/ch/snacker.c index eef36918..837df3c3 100644 --- a/src/core2/ch/snacker.c +++ b/src/core2/ch/snacker.c @@ -4,7 +4,6 @@ #include "snacker.h" -extern f32 ml_distanceSquared_vec3f(f32 [3], f32 [3]); extern f32 func_80309B24(f32[3]); extern void func_80328FF0(Actor *, f32); extern void mapSpecificFlags_setN(s32, s32, s32); @@ -333,7 +332,7 @@ void chSnacker_spawn(void) { _player_getPosition(spawn_position); if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) != 0) { - nodeprop_getPosition(func_80304CAC(0x3CB, spawn_position), spawn_position); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_f32(ACTOR_3CB_UNKNOWN, spawn_position), spawn_position); } else{ spawn_angle_rad = randf2(0.0f, 3.28f); @@ -374,10 +373,10 @@ void chSnacker_spawn(void) { } if (volatileFlag_get(VOLATILE_FLAG_C1_IN_FINAL_CHARACTER_PARADE) == 0) { func_8032BB88(snacker, 5000, 750); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A6EC(COMUSIC_34_SNACKER_DANGER, 0); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } s_chSnacker_spawnTimer = 0.0f; func_8032CA80(snacker, s_chSnacker_inRbb ? 15 : 9); diff --git a/src/core2/ch/snowman.c b/src/core2/ch/snowman.c index 5ace6a27..a234e937 100644 --- a/src/core2/ch/snowman.c +++ b/src/core2/ch/snowman.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern int ml_vec3f_within_horizontal_distance(f32[3], f32[3], f32); extern void func_802EFA20(ParticleEmitter *, f32, f32); extern void subaddie_set_state_with_direction(Actor *, s32, f32, s32); extern void func_80328FB0(Actor *, f32); diff --git a/src/core2/ch/soundsource.c b/src/core2/ch/soundsource.c index 901aee85..987306e8 100644 --- a/src/core2/ch/soundsource.c +++ b/src/core2/ch/soundsource.c @@ -47,7 +47,7 @@ void func_802D0500(Actor *this){ void func_802D05A0(Actor *this, s32 next_state){ ActorLocal_Core2_49570 *local = (ActorLocal_Core2_49570 *)this->local; if(this->state == 2 && local->sfxsourceIdx){ - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); local->sfxsourceIdx = 0; } if(next_state == 2){ @@ -84,7 +84,7 @@ void func_802D07C8(Actor *this){ func_802D05A0(this, 1); } player_getPosition(sp2C); - sp28 = ml_distance_vec3f(sp2C, this->position); + sp28 = ml_vec3f_distance(sp2C, this->position); if( this->state == 1){ if(sp28 < D_80367340[(s32)this->yaw].unk6*this->scale){ func_802D05A0(this, 2); diff --git a/src/core2/ch/termite.c b/src/core2/ch/termite.c index db60cdd0..069e8de6 100644 --- a/src/core2/ch/termite.c +++ b/src/core2/ch/termite.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include bool func_8034A6FC(f32, f32); diff --git a/src/core2/ch/whipcrack.c b/src/core2/ch/whipcrack.c index 1bc11e76..e87ba64b 100644 --- a/src/core2/ch/whipcrack.c +++ b/src/core2/ch/whipcrack.c @@ -105,7 +105,7 @@ void chwhipcrack_update(Actor *this){ __chwhipcrack_setState(this, 1); } player_getPosition(plyr_pos); - plyr_dist = ml_distance_vec3f(plyr_pos, this->position); + plyr_dist = ml_vec3f_distance(plyr_pos, this->position); if(this->state == 1){ if(plyr_dist < 700.0f){ __chwhipcrack_setState(this, 2); diff --git a/src/core2/code_12360.c b/src/core2/code_12360.c index e39e3a48..4ec15b7e 100644 --- a/src/core2/code_12360.c +++ b/src/core2/code_12360.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 ml_mapAbsRange_f(f32, f32, f32, f32, f32); -extern void func_8025901C(f32, f32 *, f32 *, f32); extern f32 func_8029B2D0(void); void func_8029957C(s32 arg0); diff --git a/src/core2/code_126C0.c b/src/core2/code_126C0.c index a04524ff..94bd653f 100644 --- a/src/core2/code_126C0.c +++ b/src/core2/code_126C0.c @@ -77,7 +77,7 @@ void func_802997E8(void){ if(D_8037C6D0.sfxsourceIdx){ D_8037C6D0.unk4 += time_getDelta(); if(D_8037C6D0.unk8 <= D_8037C6D0.unk4){ - func_8030DA44(D_8037C6D0.sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(D_8037C6D0.sfxsourceIdx); D_8037C6D0.sfxsourceIdx = 0; } else{ @@ -127,13 +127,13 @@ void func_80299900(void){ } void func_80299A20(void){ - func_8030DA44(D_8037C6C1); - func_8030DA44(D_8037C6C0); - func_8030DA44(D_8037C6C3); - func_8030DA44(D_8037C6C2); - func_8030DA44(D_8037C6C4); + sfxsource_freeSfxsourceByIndex(D_8037C6C1); + sfxsource_freeSfxsourceByIndex(D_8037C6C0); + sfxsource_freeSfxsourceByIndex(D_8037C6C3); + sfxsource_freeSfxsourceByIndex(D_8037C6C2); + sfxsource_freeSfxsourceByIndex(D_8037C6C4); if(D_8037C6D0.sfxsourceIdx){ - func_8030DA44(D_8037C6D0.sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(D_8037C6D0.sfxsourceIdx); } } diff --git a/src/core2/code_13FC0.c b/src/core2/code_13FC0.c index df1df256..134e6a80 100644 --- a/src/core2/code_13FC0.c +++ b/src/core2/code_13FC0.c @@ -1,10 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void controller_getJoystick(s32, f32*); -extern f32 ml_acosf(f32); extern f32 player_getYaw(void); extern void particleEmitter_setSphericalParticleVelocityRange(ParticleEmitter *this, f32 pitch_min, f32 yaw_min, f32 radial_min, f32 pitch_max, f32 yaw_max, f32 radial_max); ParticleEmitter * func_802EDD8C(f32[3], f32, f32); diff --git a/src/core2/code_14420.c b/src/core2/code_14420.c index dfd1b811..3aed725a 100644 --- a/src/core2/code_14420.c +++ b/src/core2/code_14420.c @@ -1,14 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "core2/yaw.h" #include "core2/statetimer.h" #include "core2/ba/anim.h" #include "core2/ba/physics.h" -#include extern void controller_getJoystick(s32, f32*); -extern f32 ml_acosf(f32); extern f32 player_getYaw(void); extern void particleEmitter_setSphericalParticleVelocityRange(ParticleEmitter *this, f32 pitch_min, f32 yaw_min, f32 radial_min, f32 pitch_max, f32 yaw_max, f32 radial_max); ParticleEmitter * func_802EDD8C(f32[3], f32, f32); @@ -823,7 +822,7 @@ void func_8029C984(void){ func_8025AB00(); func_8025A2FC(0, 4000); comusic_playTrack(COMUSIC_1A_DEATH); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } s32 func_8029C9C0(s32 arg0){ @@ -885,7 +884,7 @@ void func_8029CB84(void){ void func_8029CBC4(void){ func_8025A55C(-1, 4000, 0xc); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_8029CBF4(void){ @@ -920,7 +919,7 @@ void func_8029CCC4(void){ if(jiggyscore_total() == 100 && fileProgressFlag_get(FILEPROG_FC_DEFEAT_GRUNTY)){ func_8028F918(2); } - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 0xC); func_8025A6EC(COMUSIC_D_JINGLE_JIGGY_COLLECTED, -1); timedFunc_set_0(4.0f, func_8029CBF4); diff --git a/src/core2/code_16010.c b/src/core2/code_16010.c index 33cfd739..64ca786e 100644 --- a/src/core2/code_16010.c +++ b/src/core2/code_16010.c @@ -4,8 +4,6 @@ #include "core2/statetimer.h" -extern int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); - /* .bss */ u8 D_8037D210; u8 D_8037D211; @@ -19,7 +17,7 @@ bool func_8029CFA0(void){ } void func_8029CFF8(void){ - func_8030DA44(D_8037D210); + sfxsource_freeSfxsourceByIndex(D_8037D210); } void func_8029D01C(void){ @@ -190,7 +188,7 @@ bool func_8029D66C(void){ case MAP_31_RBB_RUSTY_BUCKET_BAY: player_getPosition(sp2C); - return player_inWater() && func_80258424(sp2C, -9000.0f, -3000.0f, -3850.0f, -6820.0f, -700.0f, -1620.0f); + 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: diff --git a/src/core2/code_33250.c b/src/core2/code_33250.c index 56d1d3c5..ef80ffc8 100644 --- a/src/core2/code_33250.c +++ b/src/core2/code_33250.c @@ -2,32 +2,35 @@ #include "functions.h" #include "variables.h" +#include #include -void func_802BA23C(s32 *arg0, s32 arg1); +static void __code33250_func_802BA23C(CameraNodeType4 *this, s32 arg1); /* .code */ -s32 * func_802BA1E0(void){ - s32 * sp1C = malloc(4); - func_802BA23C(sp1C, 1); - return sp1C; +CameraNodeType4 *cameraNodeType4_init(){ + CameraNodeType4 * this; + + this = malloc(sizeof(CameraNodeType4)); + __code33250_func_802BA23C(this, 1); + return this; } -void func_802BA214(s32 *arg0){ - free(arg0); +void cameraNodeType4_free(CameraNodeType4 *this){ + free(this); } -s32 func_802BA234(s32 *arg0){ - return *arg0; +s32 code33250_func_802BA234(CameraNodeType4 *this){ + return this->unknownFlag; } -void func_802BA23C(s32 *arg0, s32 arg1){ - *arg0 = arg1; +static void __code33250_func_802BA23C(CameraNodeType4 *this, s32 arg1){ + this->unknownFlag = arg1; } -void func_802BA244(File *file_ptr, s32 *arg1){ +void cameraNodeType4_fromFile(File *file_ptr, CameraNodeType4 *this){ while(!file_isNextByteExpected(file_ptr, 0)){ - file_getWord_ifExpected(file_ptr, 1, arg1); + file_getWord_ifExpected(file_ptr, 1, &this->unknownFlag); } } diff --git a/src/core2/code_33310.c b/src/core2/code_33310.c index 8290ac87..ce77fe92 100644 --- a/src/core2/code_33310.c +++ b/src/core2/code_33310.c @@ -3,154 +3,142 @@ #include "variables.h" #include +#include -typedef struct{ - f32 unk0[3]; - f32 unkC; - f32 unk10; - f32 unk14; - f32 unk18; - f32 unk1C; - f32 unk20; - f32 unk24[3]; - s32 unk30; -}Struct_core2_33310; - - -void func_802BA3E8(Struct_core2_33310 *arg0, f32 arg1[3]); -void func_802BA414(Struct_core2_33310 *arg0, f32 arg1); -void func_802BA428(Struct_core2_33310 *arg0, f32 arg1); -void func_802BA460(Struct_core2_33310 *arg0, f32 arg1[3]); -void func_802BA494(Struct_core2_33310 *arg0, f32 arg1, f32 arg2); -void func_802BA4BC(Struct_core2_33310 *arg0, f32 arg1, f32 arg2); -void func_802BA510(Struct_core2_33310 *arg0, bool arg1); -void func_802BA530(Struct_core2_33310 *arg0, bool arg1); +static void __cameraNodeType3_setPitchYawRoll(CameraNodeType3 *this, f32 pitch_yaw_roll[3]); +static void __cameraNodeType3_setFarDistance(CameraNodeType3 *this, f32 far_distance); +static void __cameraNodeType3_setCloseDistance(CameraNodeType3 *this, f32 close_distnace); +static void __cameraNodeType3_setPosition(CameraNodeType3 *this, f32 position[3]); +static void __cameraNodeType3_setHorizontalAndVerticalSpeed(CameraNodeType3 *this, f32 horizontal_speed, f32 vertical_speed); +static void __cameraNodeType3_setRotationAndAccelaration(CameraNodeType3 *this, f32 rotation, f32 accelaration); +static void __code33310_func_802BA510(CameraNodeType3 *this, bool arg1); +static void __code33310_func_802BA530(CameraNodeType3 *this, bool arg1); /* .code */ -void func_802BA2A0(Struct_core2_33310 *arg0, bool arg1, s32 arg2){ - if(arg1){ - arg0->unk30 |= arg2; +static void __code33310_func_802BA2A0(CameraNodeType3 *this, bool arg1, s32 arg2) { + if(arg1) { + this->unknownFlag |= arg2; } else{ - arg0->unk30 &= ~arg2; + this->unknownFlag &= ~arg2; } } -bool func_802BA2D0(Struct_core2_33310 *arg0, s32 arg1){ - if(arg0->unk30 & arg1) +bool __code33310_func_802BA2D0(CameraNodeType3 *this, s32 arg1) { + if(this->unknownFlag & arg1) return TRUE; return FALSE; } -Struct_core2_33310 *func_802BA2F4(void){ - Struct_core2_33310 * this; +CameraNodeType3 *cameraNodeType3_init() { + CameraNodeType3 * this; f32 sp20[3]; - this = (Struct_core2_33310 *)malloc(sizeof(Struct_core2_33310)); + this = (CameraNodeType3 *)malloc(sizeof(CameraNodeType3)); ml_vec3f_clear(sp20); - func_802BA460(this, sp20); - func_802BA3E8(this, sp20); - func_802BA494(this, 2.84f, 5.68f); - func_802BA4BC(this, 4.0f, 16.0f); - func_802BA428(this, 1000.0f); - func_802BA414(this, 1000.0f); - func_802BA530(this, FALSE); - func_802BA510(this, FALSE); + __cameraNodeType3_setPosition(this, sp20); + __cameraNodeType3_setPitchYawRoll(this, sp20); + __cameraNodeType3_setHorizontalAndVerticalSpeed(this, 2.84f, 5.68f); + __cameraNodeType3_setRotationAndAccelaration(this, 4.0f, 16.0f); + __cameraNodeType3_setCloseDistance(this, 1000.0f); + __cameraNodeType3_setFarDistance(this, 1000.0f); + __code33310_func_802BA530(this, FALSE); + __code33310_func_802BA510(this, FALSE); return this; } -void func_802BA398(Struct_core2_33310 *arg0){ - free(arg0); +void cameraNodeType3_free(CameraNodeType3 *this) { + free(this); } -void func_802BA3B8(Struct_core2_33310 *arg0, f32 arg1[3]){ - ml_vec3f_add(arg1, arg0->unk0, arg0->unk24); +void cameraNodeType3_getPositionWithPitchYawRoll(CameraNodeType3 *this, f32 pitch_yaw_roll[3]) { + ml_vec3f_add(pitch_yaw_roll, this->position, this->pitchYawRoll); } -void func_802BA3E8(Struct_core2_33310 *arg0, f32 arg1[3]){ - ml_vec3f_diff_copy(arg0->unk24, arg1, arg0->unk0); +static void __cameraNodeType3_setPitchYawRoll(CameraNodeType3 *this, f32 pitch_yaw_roll[3]) { + ml_vec3f_diff_copy(this->pitchYawRoll, pitch_yaw_roll, this->position); } -f32 func_802BA40C(Struct_core2_33310 *arg0){ - return arg0->unk20; +f32 cameraNodeType3_getFarDistance(CameraNodeType3 *this) { + return this->farDistance; } -void func_802BA414(Struct_core2_33310 *arg0, f32 arg1){ - arg0->unk20 = arg1; +static void __cameraNodeType3_setFarDistance(CameraNodeType3 *this, f32 far_distance) { + this->farDistance = far_distance; } -f32 func_802BA420(Struct_core2_33310 *arg0){ - return arg0->unk1C; +f32 cameraNodeType3_getCloseDistance(CameraNodeType3 *this) { + return this->closeDistance; } -void func_802BA428(Struct_core2_33310 *arg0, f32 arg1){ - arg0->unk1C = arg1; +static void __cameraNodeType3_setCloseDistance(CameraNodeType3 *this, f32 close_distance) { + this->closeDistance = close_distance; } -void func_802BA434(Struct_core2_33310 *arg0, f32 arg1[3]){ - ml_vec3f_copy(arg1, arg0->unk0); +void cameraNodeType3_getPosition(CameraNodeType3 *this, f32 position[3]) { + ml_vec3f_copy(position, this->position); } -void func_802BA460(Struct_core2_33310 *arg0, f32 arg1[3]){ - ml_vec3f_copy(arg0->unk0, arg1); +static void __cameraNodeType3_setPosition(CameraNodeType3 *this, f32 position[3]) { + ml_vec3f_copy(this->position, position); } -void func_802BA480(Struct_core2_33310 *arg0, f32 *arg1, f32 *arg2){ - *arg1 = arg0->unkC; - *arg2 = arg0->unk10; +void cameraNodeType3_getHorizontalAndVerticalSpeed(CameraNodeType3 *this, f32 *horizontal_speed, f32 *vertical_speed) { + *horizontal_speed = this->horizontalSpeed; + *vertical_speed = this->verticalSpeed; } -void func_802BA494(Struct_core2_33310 *arg0, f32 arg1, f32 arg2){ - arg0->unkC = arg1; - arg0->unk10 = arg2; +static void __cameraNodeType3_setHorizontalAndVerticalSpeed(CameraNodeType3 *this, f32 horizontal_speed, f32 vertical_speed) { + this->horizontalSpeed = horizontal_speed; + this->verticalSpeed = vertical_speed; } -void func_802BA4A8(Struct_core2_33310 *arg0, f32 *arg1, f32 *arg2){ - *arg1 = arg0->unk14; - *arg2 = arg0->unk18; +void cameraNodeType3_getRotationAndAccelaration(CameraNodeType3 *this, f32 *rotation, f32 *accelaration) { + *rotation = this->rotation; + *accelaration = this->accelaration; } -void func_802BA4BC(Struct_core2_33310 *arg0, f32 arg1, f32 arg2){ - arg0->unk14 = arg1; - arg0->unk18 = arg2; +static void __cameraNodeType3_setRotationAndAccelaration(CameraNodeType3 *this, f32 rotation, f32 accelaration) { + this->rotation = rotation; + this->accelaration = accelaration; } -bool func_802BA4D0(Struct_core2_33310 *arg0){ - return func_802BA2D0(arg0, 4); +bool code33310_func_802BA4D0(CameraNodeType3 *this) { + return __code33310_func_802BA2D0(this, 4); } -bool func_802BA4F0(Struct_core2_33310 *arg0){ - return func_802BA2D0(arg0, 1); +bool code33310_func_802BA4F0(CameraNodeType3 *this) { + return __code33310_func_802BA2D0(this, 1); } -void func_802BA510(Struct_core2_33310 *arg0, bool arg1){ - func_802BA2A0(arg0, arg1, 4); +static void __code33310_func_802BA510(CameraNodeType3 *this, bool arg1) { + __code33310_func_802BA2A0(this, arg1, 4); } -void func_802BA530(Struct_core2_33310 *arg0, bool arg1){ - func_802BA2A0(arg0, arg1, 1); +static void __code33310_func_802BA530(CameraNodeType3 *this, bool arg1) { + __code33310_func_802BA2A0(this, arg1, 1); } -void func_802BA550(File *file_ptr, Struct_core2_33310 *arg1){ - while(!file_isNextByteExpected(file_ptr, 0)){ - if(!file_getNFloats_ifExpected(file_ptr, 1, arg1->unk0, 3)){ - if(file_isNextByteExpected(file_ptr, 2)){ - file_getFloat(file_ptr, &arg1->unkC); - file_getFloat(file_ptr, &arg1->unk10); +void cameraNodeType3_fromFile(File *file_ptr, CameraNodeType3 *this) { + while(!file_isNextByteExpected(file_ptr, 0)) { + if(!file_getNFloats_ifExpected(file_ptr, 1, this->position, 3)) { + if(file_isNextByteExpected(file_ptr, 2)) { + file_getFloat(file_ptr, &this->horizontalSpeed); + file_getFloat(file_ptr, &this->verticalSpeed); } - else if(file_isNextByteExpected(file_ptr, 3)){ - file_getFloat(file_ptr, &arg1->unk14); - file_getFloat(file_ptr, &arg1->unk18); + else if(file_isNextByteExpected(file_ptr, 3)) { + file_getFloat(file_ptr, &this->rotation); + file_getFloat(file_ptr, &this->accelaration); } - else if(file_isNextByteExpected(file_ptr, 6)){ - file_getFloat(file_ptr, &arg1->unk1C); - file_getFloat(file_ptr, &arg1->unk20); + else if(file_isNextByteExpected(file_ptr, 6)) { + file_getFloat(file_ptr, &this->closeDistance); + file_getFloat(file_ptr, &this->farDistance); } else{ - if(!file_getNFloats_ifExpected(file_ptr, 4, arg1->unk24, 3)){ - file_getWord_ifExpected(file_ptr, 5, &arg1->unk30); + if(!file_getNFloats_ifExpected(file_ptr, 4, this->pitchYawRoll, 3)) { + file_getWord_ifExpected(file_ptr, 5, &this->unknownFlag); } } - }//L802BA654 + } } } diff --git a/src/core2/code_336F0.c b/src/core2/code_336F0.c index 8ab4922b..7802ccf2 100644 --- a/src/core2/code_336F0.c +++ b/src/core2/code_336F0.c @@ -4,132 +4,124 @@ #include "functions.h" #include "variables.h" +#include -typedef struct { - f32 unk0[3]; - f32 unkC; - f32 unk10; - f32 unk14; - f32 unk18; - f32 unk1C[3]; - s32 unk28; -} Struct_core2_336F0; -void func_802BA7B8(Struct_core2_336F0 *arg0, f32 arg1[3]); -void func_802BA808(Struct_core2_336F0 *arg0, f32 arg1[3]); -void func_802BA840(Struct_core2_336F0 *arg0, f32 arg1, f32 arg2); -void func_802BA868(Struct_core2_336F0 *arg0, f32 arg1, f32 arg2); -void func_802BA8DC(Struct_core2_336F0 *arg0, s32 arg1); -void func_802BA8FC(Struct_core2_336F0 *arg0, s32 arg1); -void func_802BA91C(Struct_core2_336F0 *arg0, s32 arg1); +static void __cameraNodeType1_setPosition(CameraNodeType1 *this, f32 position[3]); +static void __cameraNodeType1_func_802BA808(CameraNodeType1 *this, f32 arg1[3]); +static void __cameraNodeType1_setHorizontalAndVerticalSpeed(CameraNodeType1 *this, f32 horizontal_speed, f32 vertical_speed); +static void __cameraNodeType1_setRotationAndAccelaration(CameraNodeType1 *this, f32 rotation, f32 accelaration); +static void __code336F0_func_802BA8DC(CameraNodeType1 *this, s32 arg1); +static void __code336F0_func_802BA8FC(CameraNodeType1 *this, s32 arg1); +static void __code336F0_func_802BA91C(CameraNodeType1 *this, s32 arg1); -void func_802BA680(Struct_core2_336F0 *arg0, s32 arg1, s32 arg2){ - if(arg1){ - arg0->unk28 |= arg2; - }else{ - arg0->unk28 &= ~arg2; +static void __code336F0_func_802BA680(CameraNodeType1 *this, s32 arg1, s32 arg2) { + if(arg1) { + this->unknownFlag |= arg2; + } else{ + this->unknownFlag &= ~arg2; } } -bool func_802BA6B0(Struct_core2_336F0 *arg0, s32 arg1){ - if (arg0->unk28 & arg1) +static bool __code336F0_func_802BA6B0(CameraNodeType1 *this, s32 arg1) { + if (this->unknownFlag & arg1) return TRUE; return FALSE; } -Struct_core2_336F0 *func_802BA6D4(void){ - Struct_core2_336F0 *this; +CameraNodeType1 *cameraNodeType1_init() { + CameraNodeType1 *this; f32 sp20[3]; - this = (Struct_core2_336F0 *)malloc(sizeof(Struct_core2_336F0)); + this = (CameraNodeType1 *)malloc(sizeof(CameraNodeType1)); ml_vec3f_clear(sp20); - func_802BA7B8(this, sp20); - func_802BA808(this, sp20); - func_802BA840(this, 0.7f, 2.33f); - func_802BA868(this, 4.0f, 16.0f); - func_802BA8DC(this, 0); - func_802BA91C(this, 1); - func_802BA8FC(this, 0); + __cameraNodeType1_setPosition(this, sp20); + __cameraNodeType1_func_802BA808(this, sp20); + __cameraNodeType1_setHorizontalAndVerticalSpeed(this, 0.7f, 2.33f); + __cameraNodeType1_setRotationAndAccelaration(this, 4.0f, 16.0f); + __code336F0_func_802BA8DC(this, 0); + __code336F0_func_802BA91C(this, 1); + __code336F0_func_802BA8FC(this, 0); return this; } -void func_802BA76C(Struct_core2_336F0 *arg0){ - free(arg0); +void cameraNodeType1_free(CameraNodeType1 *this) { + free(this); } -void func_802BA78C(Struct_core2_336F0 *arg0, f32 arg1[3]){ - ml_vec3f_copy(arg1, arg0->unk0); +void cameraNodeType1_getPosition(CameraNodeType1 *this, f32 position[3]) { + ml_vec3f_copy(position, this->position); } -void func_802BA7B8(Struct_core2_336F0 *arg0, f32 arg1[3]){ - ml_vec3f_copy(arg0->unk0, arg1); +static void __cameraNodeType1_setPosition(CameraNodeType1 *this, f32 position[3]) { + ml_vec3f_copy(this->position, position); } -void func_802BA7D8(Struct_core2_336F0 *arg0, f32 arg1[3]){ - ml_vec3f_add(arg1, arg0->unk0, arg0->unk1C); +void code336F0_func_802BA7D8(CameraNodeType1 *this, f32 arg1[3]) { + ml_vec3f_add(arg1, this->position, this->pitchYawRoll); } -void func_802BA808(Struct_core2_336F0 *arg0, f32 arg1[3]){ - ml_vec3f_diff_copy(arg0->unk1C, arg1, arg0->unk0); +static void __cameraNodeType1_func_802BA808(CameraNodeType1 *this, f32 arg1[3]) { + ml_vec3f_diff_copy(this->pitchYawRoll, arg1, this->position); } -void func_802BA82C(Struct_core2_336F0 *arg0, f32 *arg1, f32 *arg2){ - *arg1 = arg0->unkC; - *arg2 = arg0->unk10; +void cameraNodeType1_getHorizontalAndVerticalSpeed(CameraNodeType1 *this, f32 *horizontal_speed, f32 *vertical_speed) { + *horizontal_speed = this->horizontalSpeed; + *vertical_speed = this->verticalSpeed; } -void func_802BA840(Struct_core2_336F0 *arg0, f32 arg1, f32 arg2){ - arg0->unkC = arg1; - arg0->unk10 = arg2; +static void __cameraNodeType1_setHorizontalAndVerticalSpeed(CameraNodeType1 *this, f32 horizontal_speed, f32 vertical_speed) { + this->horizontalSpeed = horizontal_speed; + this->verticalSpeed = vertical_speed; } -void func_802BA854(Struct_core2_336F0 *arg0, f32 *arg1, f32 *arg2){ - *arg1 = arg0->unk14; - *arg2 = arg0->unk18; +void cameraNodeType1_getRotationAndAccelaration(CameraNodeType1 *this, f32 *rotation, f32 *accelaration) { + *rotation = this->rotation; + *accelaration = this->accelaration; } -void func_802BA868(Struct_core2_336F0 *arg0, f32 arg1, f32 arg2){ - arg0->unk14 = arg1; - arg0->unk18 = arg2; +static void __cameraNodeType1_setRotationAndAccelaration(CameraNodeType1 *this, f32 rotation, f32 accelaration) { + this->rotation = rotation; + this->accelaration = accelaration; } -bool func_802BA87C(Struct_core2_336F0 *arg0){ - return func_802BA6B0(arg0, 1); +bool code336F0_func_802BA87C(CameraNodeType1 *this) { + return __code336F0_func_802BA6B0(this, 0x1); } -bool func_802BA89C(Struct_core2_336F0 *arg0){ - return func_802BA6B0(arg0, 4); +bool code336F0_func_802BA89C(CameraNodeType1 *this) { + return __code336F0_func_802BA6B0(this, 0x4); } -bool func_802BA8BC(Struct_core2_336F0 *arg0){ - return func_802BA6B0(arg0, 2); +bool code336F0_func_802BA8BC(CameraNodeType1 *this) { + return __code336F0_func_802BA6B0(this, 0x2); } -void func_802BA8DC(Struct_core2_336F0 *arg0, s32 arg1){ - func_802BA680(arg0, arg1, 1); +static void __code336F0_func_802BA8DC(CameraNodeType1 *this, s32 arg1) { + __code336F0_func_802BA680(this, arg1, 0x1); } -void func_802BA8FC(Struct_core2_336F0 *arg0, s32 arg1){ - func_802BA680(arg0, arg1, 4); +static void __code336F0_func_802BA8FC(CameraNodeType1 *this, s32 arg1) { + __code336F0_func_802BA680(this, arg1, 0x4); } -void func_802BA91C(Struct_core2_336F0 *arg0, s32 arg1){ - func_802BA680(arg0, arg1, 2); +static void __code336F0_func_802BA91C(CameraNodeType1 *this, s32 arg1) { + __code336F0_func_802BA680(this, arg1, 0x2); } -void func_802BA93C(File *file_ptr, Struct_core2_336F0 *arg1){ - while(!file_isNextByteExpected(file_ptr, 0)){ - if(!file_getNFloats_ifExpected(file_ptr, 1, arg1->unk0, 3)){ - if(file_isNextByteExpected(file_ptr, 2)){ - file_getFloat(file_ptr, &arg1->unkC); - file_getFloat(file_ptr, &arg1->unk10); +void cameraNodeType1_fromFile(File *file_ptr, CameraNodeType1 *this) { + while(!file_isNextByteExpected(file_ptr, 0)) { + if(!file_getNFloats_ifExpected(file_ptr, 1, this->position, 3)) { + if(file_isNextByteExpected(file_ptr, 2)) { + file_getFloat(file_ptr, &this->horizontalSpeed); + file_getFloat(file_ptr, &this->verticalSpeed); } - else if(file_isNextByteExpected(file_ptr, 3)){ - file_getFloat(file_ptr, &arg1->unk14); - file_getFloat(file_ptr, &arg1->unk18); + else if(file_isNextByteExpected(file_ptr, 3)) { + file_getFloat(file_ptr, &this->rotation); + file_getFloat(file_ptr, &this->accelaration); } - else if(!file_getNFloats_ifExpected(file_ptr, 4, arg1->unk1C, 3)){ - file_getWord_ifExpected(file_ptr, 5, &arg1->unk28); + else if(!file_getNFloats_ifExpected(file_ptr, 4, this->pitchYawRoll, 3)) { + file_getWord_ifExpected(file_ptr, 5, &this->unknownFlag); } }//L802BAA0C } diff --git a/src/core2/code_33AB0.c b/src/core2/code_33AB0.c index 85ed8322..cefd9826 100644 --- a/src/core2/code_33AB0.c +++ b/src/core2/code_33AB0.c @@ -3,51 +3,47 @@ #include "variables.h" #include +#include -typedef struct { - f32 position[3]; - f32 rotation[3]; -} CameraNodeType2; - -void ncCameraNodeType2_setPosition(CameraNodeType2 *this, f32 src[3]); -void ncCameraNodeType2_setRotation(CameraNodeType2 *this, f32 src[3]); +static void __cameraNodeType2_setPosition(CameraNodeType2 *this, f32 position[3]); +static void __cameraNodeType2_setPitchYawRoll(CameraNodeType2 *this, f32 pitch_yaw_roll[3]); /* .code */ -CameraNodeType2 *ncCameraNodeType2_new(void){ +CameraNodeType2 *cameraNodeType2_init() { CameraNodeType2 *this; f32 sp18[3]; this = (CameraNodeType2 *)malloc(sizeof(CameraNodeType2)); ml_vec3f_clear(sp18); - ncCameraNodeType2_setPosition(this, sp18); - ncCameraNodeType2_setRotation(this, sp18); + __cameraNodeType2_setPosition(this, sp18); + __cameraNodeType2_setPitchYawRoll(this, sp18); return this; } -void ncCameraNodeType2_free(CameraNodeType2 *this){ +void cameraNodeType2_free(CameraNodeType2 *this) { free(this); } -void ncCameraNodeType2_getPosition(CameraNodeType2 *this, f32 dst[3]){\ - ml_vec3f_copy(dst, this->position); +void cameraNodeType2_getPosition(CameraNodeType2 *this, f32 position[3]) { + ml_vec3f_copy(position, this->position); } -void ncCameraNodeType2_setPosition(CameraNodeType2 *this, f32 src[3]){ - ml_vec3f_copy(this->position, src); +void __cameraNodeType2_setPosition(CameraNodeType2 *this, f32 position[3]) { + ml_vec3f_copy(this->position, position); } -void ncCameraNodeType2_getRotation(CameraNodeType2 *this, f32 dst[3]){\ - ml_vec3f_copy(dst, this->rotation); +void cameraNodeType2_getPitchYawRoll(CameraNodeType2 *this, f32 pitch_yaw_roll[3]) {\ + ml_vec3f_copy(pitch_yaw_roll, this->pitchYawRoll); } -void ncCameraNodeType2_setRotation(CameraNodeType2 *this, f32 src[3]){ - ml_vec3f_copy(this->rotation, src); +void __cameraNodeType2_setPitchYawRoll(CameraNodeType2 *this, f32 pitch_yaw_roll[3]) { + ml_vec3f_copy(this->pitchYawRoll, pitch_yaw_roll); } -void ncCameraNodeType2_fromFile(File *file_ptr, CameraNodeType2 *arg1){ - while(!file_isNextByteExpected(file_ptr, 0)){ - if(!file_getNFloats_ifExpected(file_ptr, 1, arg1->position, 3)){ - file_getNFloats_ifExpected(file_ptr, 2, arg1->rotation, 3); - }//L802BAA0C +void cameraNodeType2_fromFile(File *file_ptr, CameraNodeType2 *this) { + while(!file_isNextByteExpected(file_ptr, 0)) { + if(!file_getNFloats_ifExpected(file_ptr, 1, &this->position, 3)) { + file_getNFloats_ifExpected(file_ptr, 2, &this->pitchYawRoll, 3); + } } } diff --git a/src/core2/code_33C30.c b/src/core2/code_33C30.c index fb0ed47a..519e2266 100644 --- a/src/core2/code_33C30.c +++ b/src/core2/code_33C30.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void func_802BEA4C(f32[3], f32[3], f32, f32[3]); extern ActorProp *func_80320EB0(ActorMarker *, f32, s32); diff --git a/src/core2/code_34310.c b/src/core2/code_34310.c index 82a63b29..0d674489 100644 --- a/src/core2/code_34310.c +++ b/src/core2/code_34310.c @@ -4,9 +4,6 @@ extern void rumbleManager_80250E6C(f32, f32); -extern void ml_translate_y_local(f32[3], f32[3], f32); -extern void ml_translate_z_local(f32[3], f32[3], f32); -extern void ml_translate_x_local(f32[3], f32[3], f32); extern void func_802BE720(void); typedef struct { diff --git a/src/core2/code_34790.c b/src/core2/code_34790.c index 7821d774..89492be7 100644 --- a/src/core2/code_34790.c +++ b/src/core2/code_34790.c @@ -1,15 +1,15 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "core2/nc/camera.h" -#include #include "core2/coords.h" extern Actor *func_80328230(enum actor_e, f32[3], f32[3]); extern void func_802BEA4C(f32[3], f32[3], f32, f32[3]); extern void func_802BEBE8(f32[3], f32[3], f32, f32[3]); extern void func_802BEAAC(f32[3], f32[3], f32, f32[3], f32[3], f32[3], f32[3]); -extern NodeProp *cubeList_findNodePropByActorId(enum actor_e, s32[3]); +extern NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e, s32[3]); extern BKCollisionTri *func_80320B98(f32[3], f32[3], f32[3], s32); f32 func_802BB938(f32[3], f32[3]); f32 func_802BBD48(void); @@ -60,7 +60,7 @@ bool func_802BB720(s32 arg0, f32 arg1[3], f32 arg2[3], s32 *arg3) { if ((arg0 >= 0x5B) && (arg0 < 0x63)) { arg0 -= 0x40; } - temp_v0 = cubeList_findNodePropByActorId(D_803657E0[arg0], NULL); + temp_v0 = cubeList_findNodePropByActorIdAndPosition_s32(D_803657E0[arg0], NULL); if (temp_v0 != NULL) { nodeprop_getPosition(temp_v0, arg1); *arg3 = func_80304DB8(temp_v0); @@ -217,7 +217,7 @@ f32 func_802BBEA4(f32 arg0[3], f32 arg1[3], f32 arg2, s32 arg3, s32 arg4) { ml_vec3f_copy(sp4C, sp58[D_8037D8D0.unk30]); sp38 = func_80320B98(arg0, sp4C, sp3C, arg4); if (sp38 != NULL) { - phi_f2 = ml_distance_vec3f(arg0, sp4C); + phi_f2 = ml_vec3f_distance(arg0, sp4C); D_8037D8D0.unk0[D_8037D8D0.unk30] = sp38->flags; } else { phi_f2 = arg2; diff --git a/src/core2/code_379B0.c b/src/core2/code_379B0.c index f9d6f31e..e7939787 100644 --- a/src/core2/code_379B0.c +++ b/src/core2/code_379B0.c @@ -20,7 +20,7 @@ void func_802BE940(void) sp3C[0] = (sp3C[1] = (sp3C[2] = 0.0f)); sp3C[1] = -1.0f; ml_vec3f_pitch_rotate_copy(sp24, sp3C, 68.0f); - sp30[0] = sp24[1] * ((f32) framebuffer_width / framebuffer_height); + sp30[0] = sp24[1] * ((f32) gFramebufferWidth / gFramebufferHeight); sp30[1] = 0; D_8037DA40[1] = sp24[1]; diff --git a/src/core2/code_37E50.c b/src/core2/code_37E50.c index f44243a9..07ecbb2c 100644 --- a/src/core2/code_37E50.c +++ b/src/core2/code_37E50.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct{ u8 map_id; diff --git a/src/core2/code_39D0.c b/src/core2/code_39D0.c index 8c5af87c..18fe91a9 100644 --- a/src/core2/code_39D0.c +++ b/src/core2/code_39D0.c @@ -1,14 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "prop.h" #include "core2/statetimer.h" #include "core2/ba/physics.h" -#include -extern int ml_vec3f_point_within_horizontal_distance(f32 vec[3], f32 x, f32 z, f32 val); extern f32 player_getYaw(void); /* .bss */ diff --git a/src/core2/code_3B2C0.c b/src/core2/code_3B2C0.c index dcb3cad2..c76d52ed 100644 --- a/src/core2/code_3B2C0.c +++ b/src/core2/code_3B2C0.c @@ -3,9 +3,6 @@ #include "variables.h" -f32 mlDiffDegF(f32, f32); - - /* .bss */ static f32 s_position[3]; static f32 s_rotation[3]; diff --git a/src/core2/code_41FB0.c b/src/core2/code_41FB0.c index 34775003..096882c1 100644 --- a/src/core2/code_41FB0.c +++ b/src/core2/code_41FB0.c @@ -7,8 +7,6 @@ extern bool func_80320C94(f32[3], f32[3], f32, f32 sp54[3], s32, s32); extern f32 func_8033229C(ActorMarker *); extern bool func_80309D58(f32[3], s32); -extern void ml_vec3f_normalize(f32 [3]); - typedef struct { s16 flags; // u8 pad2[0x2]; diff --git a/src/core2/code_43800.c b/src/core2/code_43800.c index 11933b57..02c8df85 100644 --- a/src/core2/code_43800.c +++ b/src/core2/code_43800.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 func_8028E82C(void); diff --git a/src/core2/code_45310.c b/src/core2/code_45310.c index 006b08d9..638d0ade 100644 --- a/src/core2/code_45310.c +++ b/src/core2/code_45310.c @@ -1,10 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include -extern f32 func_8025715C(f32, f32); -extern f32 func_802575BC(f32); extern f32 func_80309B24(f32[3]); extern void sfxsource_playSfxAtVolume(u8, f32); extern void func_802CC340(Actor *, f32[3]); @@ -49,7 +47,7 @@ bool func_802CC2A0(Actor *this) { if (!this->marker->unk14_21) { return TRUE; } - ml_interpolate_vec3f(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05)); + ml_vec3f_interpolate_fast(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05)); sp20[1] += 60.0f; return func_80320DB0(sp20, 50.0f, sp2C, 0) == 0; } @@ -262,7 +260,7 @@ void func_802CCBC8(Actor *this) { local = (ActorLocal_Core2_45310 * )&this->local; if(local->unk0 != 0){ - func_8030DA44(local->unk0); + sfxsource_freeSfxsourceByIndex(local->unk0); } } @@ -324,7 +322,7 @@ void func_802CCC5C(Actor *this) { } if (!subaddie_playerIsWithinSphere(this, 4000)) { if (local->unk0 != 0) { - func_8030DA44(local->unk0); + sfxsource_freeSfxsourceByIndex(local->unk0); local->unk0 = 0; } } else { @@ -351,7 +349,7 @@ void func_802CCC5C(Actor *this) { spB0 = (spB0 < spAC) ? spAC : MIN(spA8 , spB0); } sfxsource_playSfxAtVolume(local->unk0, spB0); - phi_f12 = 1.0f - ml_distance_vec3f(spC4, this->position) / 2000.0f; + phi_f12 = 1.0f - ml_vec3f_distance(spC4, this->position) / 2000.0f; if(0.0f > phi_f12){ phi_f12 = 0.0f; } @@ -411,7 +409,7 @@ void func_802CCC5C(Actor *this) { local->unk4 = 1.0f; } sp9C = func_802575BC(local->unk4); - ml_interpolate_vec3f(this->position, local->unk8, local->unk18, sp9C); + ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk18, sp9C); this->yaw = local->unk14 + (sp9C * (local->unk24 - local->unk14)); if ((skeletalAnim_getAnimId(this->unk148) == 0x10E) && (skeletalAnim_getLoopCount(this->unk148) > 0)) { skeletalAnim_set(this->unk148, 0x10F, 0.1f, 0.45f); @@ -455,7 +453,7 @@ void func_802CCC5C(Actor *this) { sp68[1] = this->position[1]; sp68[2] = this->position[2]; sp68[0] = 0.0f; - if (ml_distance_vec3f(sp8C, sp68) < 800.0f) { + if (ml_vec3f_distance(sp8C, sp68) < 800.0f) { spBC = 3; } } diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index 29106801..60c08399 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -11,7 +11,6 @@ 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_setSampleRate(u8, s32); -extern void ml_vec3f_normalize(f32[3]); typedef struct{ f32 unk0[3]; @@ -122,7 +121,7 @@ void func_802CEDE4(f32 target_position[3], f32 p_ctrl[3], f32 distance, f32 *arg p_ctrl[1] = randf2(-distance, distance); p_ctrl[2] = randf2(-distance, distance); phi_s1++; - }while(phi_s1 < 10 && ml_distance_vec3f(target_position, p_ctrl) < distance); + }while(phi_s1 < 10 && ml_vec3f_distance(target_position, p_ctrl) < distance); *arg3 = randf2(arg4, arg5); } @@ -237,7 +236,7 @@ void chBeeSwarm_802CF434(Actor *this) { local = (ActorLocal_core2_47BD0 *) &this->local; for(phi_s2 = 0, phi_s0 = local->unk8; phi_s2 < local->unk0; phi_s2++){ chBeeSwarm_802CF1C8(phi_s0->unk18, phi_s0->unk0, phi_s0->unkC, phi_s0->unk24[2], 150.0f, phi_s0->unk24, &sp58); - if (ml_distance_vec3f(phi_s0->unk0, phi_s0->unk18) < 50.0f) { + if (ml_vec3f_distance(phi_s0->unk0, phi_s0->unk18) < 50.0f) { func_802CEEA4(this, phi_s0); } phi_s0++; @@ -385,7 +384,7 @@ void chBeeSwarm_update(Actor *this) { return; if (!subaddie_playerIsWithinSphere(this, 0x5DC)) { if ((u8)this->unk44_31 != 0) { - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; D_8037DCBC = 0; } @@ -455,12 +454,12 @@ void chBeeSwarm_update(Actor *this) { if (chBeeSwarm_802CF5E4(this)) { subaddie_set_state(this, 2U); } - if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) { func_802CEF54(this, local->unkC, 100.0f); } break; case 2: - if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) { func_802CEF54(this, local->unkC, 100.0f); } chBeeSwarm_802CF518(this); @@ -471,7 +470,7 @@ void chBeeSwarm_update(Actor *this) { this->unk1C[2] = spB4[2]; this->unk1C[1] += 50.0f; this->actor_specific_1_f = 400.0f; - if (ml_distance_vec3f(this->position, this->unk1C) < 100.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 100.0f) { func_802CEF54(this, spB4, 50.0f); subaddie_set_state(this, 4); } @@ -496,22 +495,22 @@ void chBeeSwarm_update(Actor *this) { if (local->unk0 == 0) { marker_despawn(this->marker); } - if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) { func_802CEF54(this, (s32 *) spB4, 50.0f); } - if (ml_distance_vec3f(this->position, spB4) > 100.0f) { + if (ml_vec3f_distance(this->position, spB4) > 100.0f) { subaddie_set_state(this, 3); } chBeeSwarm_802CF57C(this); break; case 5: - if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) { subaddie_set_state(this, 2); } chBeeSwarm_802CF518(this); break; case 6: - if (ml_distance_vec3f(this->position, this->unk1C) < 50.0f) { + if (ml_vec3f_distance(this->position, this->unk1C) < 50.0f) { subaddie_set_state(this, local->unk6); } break; diff --git a/src/core2/code_4A6F0.c b/src/core2/code_4A6F0.c index ae8efa66..553b8d56 100644 --- a/src/core2/code_4A6F0.c +++ b/src/core2/code_4A6F0.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern void func_80256E24(f32 [3], f32, f32, f32, f32, f32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_803255FC(Actor *); extern void func_80325760(Actor *); @@ -105,7 +104,7 @@ bool chMumbo_withinHorzDistToPlayer(s32 x, s32 z, s32 dist) { bool chMumbo_func_802D181C(s32 arg0) { s32 search_start_cube[3] = D_80367504; - return BOOL(cubeList_findNodePropByActorId(arg0, search_start_cube)); + return BOOL(cubeList_findNodePropByActorIdAndPosition_s32(arg0, search_start_cube)); } void chMumbo_func_802D186C(Actor *this) { diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index fed5a115..9cffb360 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -1,16 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" - -extern f32 ml_vec3f_horizontal_distance_zero_likely(f32 [3], f32[3]); 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 ml_vec3f_assign(f32[3], f32, f32, f32); 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); diff --git a/src/core2/code_517A0.c b/src/core2/code_517A0.c index 64c2f1c6..5b4d838e 100644 --- a/src/core2/code_517A0.c +++ b/src/core2/code_517A0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 func_8028EF88(void); void func_802D8730(Actor *this); diff --git a/src/core2/code_53C10.c b/src/core2/code_53C10.c index 94cbc3a5..eb319825 100644 --- a/src/core2/code_53C10.c +++ b/src/core2/code_53C10.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_80257248(f32[3], f32[3]); - typedef struct { f32 unk0; f32 unk4; diff --git a/src/core2/code_55180.c b/src/core2/code_55180.c index 9fbc48df..2f8f859f 100644 --- a/src/core2/code_55180.c +++ b/src/core2/code_55180.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "core2/particle.h" -#include void func_802DC208(Actor *this); diff --git a/src/core2/code_55390.c b/src/core2/code_55390.c index 11b7e116..9f970640 100644 --- a/src/core2/code_55390.c +++ b/src/core2/code_55390.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void actor_postdrawMethod(ActorMarker *); diff --git a/src/core2/code_55850.c b/src/core2/code_55850.c index 13c6384b..9a329d42 100644 --- a/src/core2/code_55850.c +++ b/src/core2/code_55850.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void actor_postdrawMethod(ActorMarker *); diff --git a/src/core2/code_59780.c b/src/core2/code_59780.c index aab5e542..1a27e0a5 100644 --- a/src/core2/code_59780.c +++ b/src/core2/code_59780.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void func_802C71F0(Actor *); extern void actor_postdrawMethod(ActorMarker *); diff --git a/src/core2/code_5C240.c b/src/core2/code_5C240.c index 28940722..d0b16520 100644 --- a/src/core2/code_5C240.c +++ b/src/core2/code_5C240.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void func_8023DFF0(s32); extern void comusicPlayer_update(void); @@ -11,10 +11,6 @@ extern void func_8033DC18(void); extern f32 func_8033DC20(void); extern void func_8033DC9C(f32); -extern s32 framebuffer_width; //framebuffer_width -extern s32 framebuffer_height; //framebuffer_height -extern s16 D_803A5D00[2][0xF660]; //framebuffer - /* .bss */ struct { f32 unk0; @@ -33,9 +29,9 @@ void func_802E31D0(s32 arg0) { temp_v0 = D_8037E8C0.unk14; if ((temp_v0 == 0) || (temp_v0 == 3)) { - func_8024A85C(arg0); - func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0); - osWritebackDCache(D_803A5D00[arg0], (s32) ((f32) framebuffer_width * (f32) framebuffer_height * sizeof(s16))); + framebufferdraw_setBufferIndex(arg0); + framebufferdraw_func_80249DE0(0, 0, D_8037E8C0.unkC, 0, 0); + osWritebackDCache(gFramebuffers[arg0], (s32) ((f32) gFramebufferWidth * (f32) gFramebufferHeight * sizeof(s16))); } } @@ -53,14 +49,14 @@ void func_802E329C(s32 arg0, Gfx **gfx_begin, Gfx **gfx_end) { vtx_start = vtx; scissorBox_SetForGameMode(&gfx, arg0); if (D_8037E8C0.unk14 == 2) { - drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0); + drawRectangle2D(&gfx, 0, 0, (s32) (f32) gFramebufferWidth, (s32) (f32) gFramebufferHeight, 0, 0, 0); } if ((D_8037E8C0.unk14 == 0) || (D_8037E8C0.unk14 == 3)) { viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx); gcbound_draw(&gfx); } if (D_8037E8C0.unk14 == 1) { - drawRectangle2D(&gfx, 0, 0, (s32) (f32) framebuffer_width, (s32) (f32) framebuffer_height, 0, 0, 0); + drawRectangle2D(&gfx, 0, 0, (s32) (f32) gFramebufferWidth, (s32) (f32) gFramebufferHeight, 0, 0, 0); viewport_setRenderViewportAndPerspectiveMatrix(&gfx, &mtx); func_802F1858(D_8037E8C0.unk10, &gfx, &mtx, &vtx); } @@ -95,11 +91,11 @@ void func_802E3524(s32 arg0) { Gfx *gfx_begin; Gfx *gfx_end; - func_802E31D0(func_8024BD80()); - func_802E329C(func_8024BD80(), &gfx_begin, &gfx_end); + func_802E31D0(getOtherFramebuffer()); + func_802E329C(getOtherFramebuffer(), &gfx_begin, &gfx_end); func_80253EA4(gfx_begin, gfx_end); func_80254008(); - func_8024C1B4(); + viMgr_func_8024C1B4(); } void func_802E3580(void) { @@ -107,8 +103,8 @@ void func_802E3580(void) { func_802F1884(D_8037E8C0.unk10); func_802E5F68(); comusicPlayer_free(); - dummy_func_80253420(); - func_8024BF94(2); + depthBuffer_stub(); + viMgr_func_8024BF94(2); } void dummy_func_802E35D0(void){} diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index 75a1e6f7..79c0b928 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "gc/gctransition.h" extern void func_802F5374(void); @@ -166,7 +166,7 @@ void func_802E39D0(Gfx **gdl, Mtx **mptr, Vtx **vptr, s32 framebuffer_idx, s32 a } void func_802E3BD0(s32 frame_buffer_indx){ - func_8024A85C(frame_buffer_indx); + framebufferdraw_setBufferIndex(frame_buffer_indx); } void func_802E3BF0(void){ @@ -301,7 +301,7 @@ void game_draw(s32 arg0){ if(D_8037E8E0.unkC == 0){ sp2C = gfx; - func_8024C1DC(); + viMgr_func_8024C1DC(); func_80253EC4(gfx_start, sp2C); if(arg0) { @@ -365,7 +365,7 @@ void func_802E4170(void){ timedFuncQueue_free(); func_802F9C48(); modelRender_free(); - dummy_func_80253420(); + depthBuffer_stub(); func_802E398C(0); func_8030AFD8(0); func_80321854(); diff --git a/src/core2/code_5DBC0.c b/src/core2/code_5DBC0.c index 317ff79c..66999553 100644 --- a/src/core2/code_5DBC0.c +++ b/src/core2/code_5DBC0.c @@ -121,7 +121,7 @@ BKSpriteTextureBlock **func_802E4D8C(BKSprite *sprite) { s32 i; s32 chunk_size; - frame = spriteGetFramePtr(sprite, 0); + frame = sprite_getFramePtr(sprite, 0); chunkPtrArray = (BKSpriteTextureBlock **)malloc((frame->chunkCnt + 1)*4); chunk = (BKSpriteTextureBlock *)(frame + 1); for (i = 0; i < frame->chunkCnt; i++) { @@ -481,7 +481,7 @@ void func_802E6628(s32 arg0, char *arg1) { sp2C = func_802E4E54(0); arg0 *= D_8037E900->unk4[sp2C].height; - func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28); + func_802E502C((s32) (((f32) gFramebufferWidth - (f32) func_802E51A4(arg1, sp2C, 0, D_8037E900->flags)) / 2), arg0, sp2C, arg1, sp28); } void func_802E66F0(s32 arg0, char *arg1) { @@ -491,7 +491,7 @@ void func_802E66F0(s32 arg0, char *arg1) { sp24 = func_802E4E54(0); arg0 *= D_8037E900->unk4[sp24].height; - func_802E502C((s32) (((f32) framebuffer_width - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C); + func_802E502C((s32) (((f32) gFramebufferWidth - (f32) func_802E51A4(arg1, sp24, 0, D_8037E900->flags)) / 2), arg0, sp24, arg1, D_8037E900->unk1C); } void func_802E67AC(void){ @@ -530,7 +530,7 @@ void func_802E6820(s32 arg0) { prev_sprite_ptr = D_8037E900->unk4[var_s5].font_bin; if (D_8037E900->unk4[var_s5].font_bin != NULL) { - chunk_count = spriteGetFramePtr(prev_sprite_ptr, 0U)->chunkCnt; + chunk_count = sprite_getFramePtr(prev_sprite_ptr, 0U)->chunkCnt; D_8037E900->unk4[var_s5].font_bin = (BKSprite *)defrag_asset(D_8037E900->unk4[var_s5].font_bin); for(i_chunk = 0; i_chunk < chunk_count; i_chunk++){ D_8037E900->unk4[var_s5].letter_texture[i_chunk] = ((u32)(((s32)D_8037E900->unk4[var_s5].letter_texture[i_chunk] - (s32)prev_sprite_ptr)) + (u32)D_8037E900->unk4[var_s5].font_bin); diff --git a/src/core2/code_5FD90.c b/src/core2/code_5FD90.c index 3a0f33ae..430171ae 100644 --- a/src/core2/code_5FD90.c +++ b/src/core2/code_5FD90.c @@ -4,9 +4,6 @@ #include "model.h" -extern void func_80252C08(f32[3],f32[3], f32, f32[3]); -extern void func_80252CC4(f32[3],s32, f32, s32); -extern f32 func_802560D0(f32[3], f32[3], f32[3]); extern f32 vtxList_getGlobalNorm(BKVertexList *); extern void points_to_boundingBoxWithMargin(f32 arg0[3], f32 arg1[3], f32 margin, f32 min[3], f32 max[3]); @@ -207,21 +204,21 @@ bool func_802E74A0(f32 arg0[3], f32 arg1, f32 arg2[3], f32 arg3[3]) { f32 sp24[3]; f32 sp20; - if (arg1 <= func_802560D0(arg2, arg3, arg0)) { + if (arg1 <= ml_func_802560D0(arg2, arg3, arg0)) { return FALSE; } sp24[0] = (arg2[0] + arg3[0]) / 2; sp24[1] = (arg2[1] + arg3[1]) / 2; sp24[2] = (arg2[2] + arg3[2]) / 2; - sp20 = ml_distance_vec3f(sp24, arg0); - if ((ml_distance_vec3f(sp24, arg2) + arg1) <= sp20) { + sp20 = ml_vec3f_distance(sp24, arg0); + if ((ml_vec3f_distance(sp24, arg2) + arg1) <= sp20) { return FALSE; } return TRUE; } bool func_802E7588(f32 arg0[3], f32 arg1, f32 arg2[3], f32 arg3) { - return (ml_distance_vec3f(arg0, arg2) < (arg1 + arg3)); + return (ml_vec3f_distance(arg0, arg2) < (arg1 + arg3)); } void calculateBoundsAndDirection(f32 startPoint[3], f32 endPoint[3], s32 minBounds[3], s32 maxBounds[3], f32 directionVector[3]) { @@ -745,7 +742,7 @@ s32 func_802E9118(BKCollisionList * collision_list, BKVertexList *vtx_list, f32 s32 sp3C; s32 i; - if (((f32)vtx_list->global_norm * arg4) <= (ml_distance_vec3f(arg6, arg2) - arg7)) { + if (((f32)vtx_list->global_norm * arg4) <= (ml_vec3f_distance(arg6, arg2) - arg7)) { return 0; } mlMtxIdent(); @@ -982,7 +979,7 @@ s32 func_802E9DD8(BKCollisionList *collisionList, BKVertexList *vtxList, f32 pos s32 i; // check if (sphere around vtx's) <= ((distance between origins) - (radius of B)) - if ((vtxList->global_norm * scaleA) <= (ml_distance_vec3f(posB, posA) - radB)) { + if ((vtxList->global_norm * scaleA) <= (ml_vec3f_distance(posB, posA) - radB)) { return 0; } mlMtxIdent(); diff --git a/src/core2/code_630D0.c b/src/core2/code_630D0.c index 5d5aef8c..2c501aaf 100644 --- a/src/core2/code_630D0.c +++ b/src/core2/code_630D0.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" #include "animation.h" -#include "ml/mtx.h" void *defrag(void *); diff --git a/src/core2/code_637D0.c b/src/core2/code_637D0.c index 50dcd2d3..677f32d3 100644 --- a/src/core2/code_637D0.c +++ b/src/core2/code_637D0.c @@ -1,10 +1,7 @@ #include #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -extern void func_80252C08(f32[3], f32[3], f32, f32[3]); -extern void func_80252CC4(f32[3], f32[3], f32, f32[3]); extern void mlMtx_apply_f3(f32[3], f32, f32, f32); extern s32 func_802EBAE0(BKModelUnk14List *arg0, f32 position[3], f32 rotation[3], f32 scale, f32 arg4[3], AnimMtxList* arg5, f32 arg6[3], f32 arg7, f32 arg8[3]); extern MtxF *animMtxList_get(AnimMtxList *this, s32 arg1); @@ -348,7 +345,7 @@ s32 func_802EB8A0(BKModelUnk14List *arg0, f32 *position, f32 *rotation, f32 scal sp44[1] = sp5C[1] - sp68[1]; sp44[2] = sp5C[2] - sp68[2]; temp_f0 = gu_sqrtf(sp44[0]*sp44[0] + sp44[1]*sp44[1] + sp44[2]*sp44[2]); - if ((arg7 + temp_f0 >= ml_distance_vec3f(sp68, sp74))) { + if ((arg7 + temp_f0 >= ml_vec3f_distance(sp68, sp74))) { return (s32) i_ptr->unk8; } } @@ -530,7 +527,7 @@ s32 func_802EC238(BKModelUnk14List *arg0, f32 arg1[3], f32 rotation[3], f32 scal sp40[1] = i_ptr->unk2[1]; sp40[2] = i_ptr->unk2[2]; scale = i_ptr->unk0; - if (ml_distance_vec3f(sp40, sp54) < scale) + if (ml_vec3f_distance(sp40, sp54) < scale) return i_ptr->unk8; if (!i_ptr->unk0){ } } diff --git a/src/core2/code_654C0.c b/src/core2/code_654C0.c index e210f192..00aca9a9 100644 --- a/src/core2/code_654C0.c +++ b/src/core2/code_654C0.c @@ -1,9 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include -extern void func_80252CC4(f32[3], f32 [3], f32, f32[3]); extern f32 func_8034A9D0(f32[4], f32); /*.bss */ diff --git a/src/core2/code_66FB0.c b/src/core2/code_66FB0.c index 43cf98e8..e967bf7d 100644 --- a/src/core2/code_66FB0.c +++ b/src/core2/code_66FB0.c @@ -23,14 +23,14 @@ s32 D_80368860[] = { }; s32 D_8036889C[] = { - 0x608, + ASSET_608_UNKNOWN, ASSET_702_SPRITE_UNKNOWN, - 0x712, + ASSET_712_SPRITE_SPARKLE_GREEN, ASSET_713_SPRITE_SPARKLE_YELLOW, ASSET_717_SPRITE_SPARKLE_YELLOW_2, ASSET_710_SPRITE_SPARKLE_PURPLE, ASSET_711_SPRITE_SPARKLE_DARK_BLUE, - 0x714, + ASSET_714_SPRITE_UNKNOWN, ASSET_715_SPRITE_SPARKLE_RED, ASSET_716_SPRITE_SPARKLE_WHITE, ASSET_718_SPRITE_SPARKLE_WHITE_2, diff --git a/src/core2/code_6A4B0.c b/src/core2/code_6A4B0.c index 6f8b4c06..6937d57e 100644 --- a/src/core2/code_6A4B0.c +++ b/src/core2/code_6A4B0.c @@ -1,12 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include -extern s16 D_803A5D00[2][0xF660]; - typedef struct Struct_Core2_6A4B0_2{ s16 (*vtx_coord)[3]; u16 *tmem_raw_ptr; @@ -76,8 +74,8 @@ void func_802F1440(Struct_Core2_6A4B0_2 *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx) gSPVertex((*gfx)++, osVirtualToPhysical(i_vtx), 16, 0); for(sp4C = 0; sp4C < 6; sp4C++){ for(sp50 = 0; sp50 < 9; sp50++){ - s16 *tmem = arg0->tmem_ptr + (0x20*sp50 + 1) + (0x20*sp4C + 0xC)*framebuffer_width; - gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(tmem), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); + s16 *tmem = arg0->tmem_ptr + (0x20*sp50 + 1) + (0x20*sp4C + 0xC)*gFramebufferWidth; + gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(tmem), G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, 0, 0, 0, 33, 33, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOLOD); for(sp54 = 0; sp54 < 2; sp54++){ gSP1Triangle((*gfx)++, var_s3, var_s3 + 1, var_s3 + 2, 0); var_s3 += 3; @@ -130,12 +128,12 @@ Struct_Core2_6A4B0_2 *func_802F18F0(void){ void func_802F1934(Struct_Core2_6A4B0_2 * arg0, s32 arg1){ func_802F18B8(arg0); - arg0->tmem_raw_ptr = malloc(framebuffer_width*framebuffer_height*sizeof(u16) + 0x10); + arg0->tmem_raw_ptr = malloc(gFramebufferWidth*gFramebufferHeight*sizeof(u16) + 0x10); arg0->tmem_ptr = arg0->tmem_raw_ptr; while(((s32)arg0->tmem_ptr & 0x10) == 0){ arg0->tmem_ptr = (u16*)((s32)arg0->tmem_ptr + 1); } - func_80253010(arg0->tmem_ptr, D_803A5D00[arg1], framebuffer_width*framebuffer_height*sizeof(u16)); + func_80253010(arg0->tmem_ptr, gFramebuffers[arg1], gFramebufferWidth*gFramebufferHeight*sizeof(u16)); osWriteBackDCacheAll(); } @@ -164,8 +162,8 @@ void func_802F1A10(Struct_Core2_6A4B0_2 *arg0, f32 angle_degrees) { cos = cosf(angle_degrees * 2 * BAD_PI); sin = sinf(angle_degrees * 2 * BAD_PI); viewport_getPosition_vec3f(spC0); - spCC[0] = (-(framebuffer_width / 2) * 4) + 8; - spCC[1] = ((framebuffer_height / 2) * 4) - 0x38; + spCC[0] = (-(gFramebufferWidth / 2) * 4) + 8; + spCC[1] = ((gFramebufferHeight / 2) * 4) - 0x38; spCC[2] = -0xA; for(var_s6 = 0; var_s6 < 6; var_s6++){ for(var_s4 = 0; var_s4 < 9; var_s4++){ diff --git a/src/core2/code_6B030.c b/src/core2/code_6B030.c index aadb5353..26396bd1 100644 --- a/src/core2/code_6B030.c +++ b/src/core2/code_6B030.c @@ -1,17 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include - - -extern s16 D_803A5D00[2][0xF660]; - - -extern f32 func_80257680(f32, f32, f32); -extern void func_80252330(f32, f32, f32); - typedef struct { s16 unk0; s16 unk2; @@ -87,23 +78,23 @@ void func_802F1FC0(Struct65s *self, Gfx **gfx, Mtx **mtx, Vtx **vtx) { mlMtx_apply_vec3f(spD0, spD0); spD0[0] = (-297.0f * spD0[0]) / spD0[2]; spD0[1] = (297.0f * spD0[1]) / spD0[2]; - spC4 = (s32) (spD0[0] + (f32) (framebuffer_width / 2)); - spC0 = (s32) (spD0[1] + (f32) (framebuffer_height / 2)); + spC4 = (s32) (spD0[0] + (f32) (gFramebufferWidth / 2)); + spC0 = (s32) (spD0[1] + (f32) (gFramebufferHeight / 2)); if (spC4 < 0) { spC4 = 0; - } else if (framebuffer_width - 0x20 < spC4) { - spC4 = framebuffer_width - 0x20; + } else if (gFramebufferWidth - 0x20 < spC4) { + spC4 = gFramebufferWidth - 0x20; } if (spC0 < 0) { spC0 = 0; - } else if (framebuffer_height - 0x20 < spC0) { - spC0 = framebuffer_height - 0x20; + } else if (gFramebufferHeight - 0x20 < spC0) { + spC0 = gFramebufferHeight - 0x20; } gSPDisplayList((*gfx)++, D_80368AC0); func_80347FC0(gfx, D_80368AB0[1].unk0, 0, 0, 0, 0, 0, NULL, NULL, &width, &height); - temp_addr = &D_803A5D00[func_8024BD80()][spC0*framebuffer_width + (spC4 & 0xFFFC)]; - gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, temp_addr); + temp_addr = &gFramebuffers[getOtherFramebuffer()][spC0*gFramebufferWidth + (spC4 & 0xFFFC)]; + gDPSetTextureImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, temp_addr); gDPSetTile((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, 9, 0x0080, G_TX_LOADTILE, 0, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD, G_TX_NOMIRROR | G_TX_CLAMP, G_TX_NOMASK, G_TX_NOLOD); gDPLoadSync((*gfx)++); gDPLoadTile((*gfx)++, G_TX_LOADTILE, 0, 0, 0x008C, 0x007C); diff --git a/src/core2/code_6D270.c b/src/core2/code_6D270.c index 251a0712..bacb45d0 100644 --- a/src/core2/code_6D270.c +++ b/src/core2/code_6D270.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern func_802EFAB0(ParticleEmitter *, s32, f32); @@ -49,7 +49,7 @@ ParticleEmitter *func_802F4274(f32 arg0[3]) { if (sp20 != 0) { func_802EFAB0(temp_v0, sp20, sp2C[1]); } - particleEmitter_setSprite(temp_v0, 0x42A); + particleEmitter_setSprite(temp_v0, ASSET_42A_UNKNOWN); particleEmitter_setAlpha(temp_v0, 0xFF); particleEmitter_setFade(temp_v0, 0, 0.78f); particleEmitter_setStartingFrameRange(temp_v0, 0, 0); diff --git a/src/core2/code_6D490.c b/src/core2/code_6D490.c index 7f0ac3cb..592fd9e1 100644 --- a/src/core2/code_6D490.c +++ b/src/core2/code_6D490.c @@ -155,8 +155,8 @@ void func_802F46F4(Struct5Ds *this){ } void func_802F4798(Struct5Ds *this){ - func_8030DA44(this->unk1C); - func_8030DA44(this->unk1D); + sfxsource_freeSfxsourceByIndex(this->unk1C); + sfxsource_freeSfxsourceByIndex(this->unk1D); free(this); } diff --git a/src/core2/code_6DA30.c b/src/core2/code_6DA30.c index 559805df..ecf8e7de 100644 --- a/src/core2/code_6DA30.c +++ b/src/core2/code_6DA30.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct{ @@ -283,7 +283,7 @@ void func_802F4B58(BKSpriteTextureBlock *alphaMask, BKSpriteTextureBlock *textur //This functions seperates the fonts into letters FontLetter *func_802F4C3C(BKSprite *alphaMask, BKSprite *textureSprite){ - BKSpriteFrame * font = spriteGetFramePtr(alphaMask, 0); + BKSpriteFrame * font = sprite_getFramePtr(alphaMask, 0); BKSpriteTextureBlock *chunkPtr; FontLetter * sp2C = malloc((font->chunkCnt + 1)*sizeof(FontLetter)); u8* palDataPtr; @@ -320,7 +320,7 @@ FontLetter *func_802F4C3C(BKSprite *alphaMask, BKSprite *textureSprite){ { chunkPtr = (BKSpriteTextureBlock *)(font + 1); for( i = 0; i < font->chunkCnt; i++){ - func_802F4B58(chunkPtr, (BKSpriteTextureBlock *)(spriteGetFramePtr(textureSprite, 0) + 1)); + func_802F4B58(chunkPtr, (BKSpriteTextureBlock *)(sprite_getFramePtr(textureSprite, 0) + 1)); sp2C[i].unk0 = chunkPtr; chunkSize = chunkPtr->w*chunkPtr->h; chunkDataPtr = (u8*)(chunkPtr + 1); @@ -740,8 +740,8 @@ void _printbuffer_draw_letter(char letter, f32* xPtr, f32* yPtr, f32 arg3, Gfx * temp_f24 = (sp214->x - 1.0); spD0 = sp214->y - 1.0; - temp_f26 = (f64) sp200 - (f32) framebuffer_width * 0.5; - spC0 = (f64)f28 - (f32)framebuffer_height*0.5 -0.5f; + temp_f26 = (f64) sp200 - (f32) gFramebufferWidth * 0.5; + spC0 = (f64)f28 - (f32)gFramebufferHeight*0.5 -0.5f; gSPVertex((*gfx)++, *vtx, 4, 0); for(iy = 0.0f; iy < 2.0; iy+= 1.0){ for(ix = 0.0f; ix < 2.0; ix += 1.0){ diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index b63ce46f..e81f72ba 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -98,8 +98,8 @@ void func_8028E0F0(s32 arg0, s32 arg1[3]) { case 1: sp68 = 1; ml_vec3f_copy(sp40, sp7C); - nodeprop_getPosition(func_80304CAC(0x156, sp40), sp58); - nodeprop_getPosition(func_80304CAC(0x157, sp40), sp4C); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_f32(ACTOR_156_UNKNOWN, sp40), sp58); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_f32(ACTOR_157_UNKNOWN, sp40), sp4C); sp40[0] = ((sp4C[0] - sp58[0]) * D_8037BFB0[0]) + sp58[0]; sp40[2] = ((sp4C[2] - sp58[2]) * D_8037BFB0[1]) + sp58[2]; ml_vec3f_copy(sp7C, sp40); @@ -107,8 +107,8 @@ void func_8028E0F0(s32 arg0, s32 arg1[3]) { case 2: sp64 = 1; ml_vec3f_copy(sp1C, sp7C); - nodeprop_getPosition(func_80304CAC(0x154, sp1C), sp34); - nodeprop_getPosition(func_80304CAC(0x155, sp1C), sp28); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_f32(ACTOR_154_UNKNOWN, sp1C), sp34); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_f32(ACTOR_155_UNKNOWN, sp1C), sp28); sp1C[1] = ((sp28[1] - sp34[1]) * D_8037BFB0[0]) + sp34[1]; ml_vec3f_copy(sp7C, sp1C); break; diff --git a/src/core2/code_70F20.c b/src/core2/code_70F20.c index 31012587..aa4991f4 100644 --- a/src/core2/code_70F20.c +++ b/src/core2/code_70F20.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include /* .code */ void func_802F7EB0(struct3s *this){ @@ -166,7 +166,7 @@ void func_802F83AC(struct3s *arg0) { arg0->unk1C++; if (arg0->unk1C < vector_size(arg0->unk20)) { temp_v0 = (struct4s *)vector_at(arg0->unk20, arg0->unk1C); - if (1210.0 < ml_distance_vec3f(temp_v0->unk0, sp3C)) { + if (1210.0 < ml_vec3f_distance(temp_v0->unk0, sp3C)) { vector_remove(arg0->unk20, arg0->unk1C); } } else { diff --git a/src/core2/code_71820.c b/src/core2/code_71820.c index a3562a72..6d083feb 100644 --- a/src/core2/code_71820.c +++ b/src/core2/code_71820.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #define _SQ3(x, y, z) (((x) * (x)) + ((y) * (y)) + ((z) * (z))) @@ -168,7 +168,7 @@ void func_802F8CD0(struct6s * this){ this->unk18++; if((s32)this->unk18 < vector_size(this->unk1C)){ iPtr = vector_at(this->unk1C, this->unk18); - if(1320.0 < ml_distance_vec3f(iPtr->unk4, plyr_pos)){ + if(1320.0 < ml_vec3f_distance(iPtr->unk4, plyr_pos)){ vector_remove(this->unk1C, this->unk18); } } diff --git a/src/core2/code_72060.c b/src/core2/code_72060.c index fdefcfa1..ca0e5236 100644 --- a/src/core2/code_72060.c +++ b/src/core2/code_72060.c @@ -1,16 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include typedef struct { u8 pad0[0xC]; f32 unkC[3]; }Struct_core2_72060_0; -extern void func_80251B5C(f32, f32, f32); -extern void func_80252A38(f32, f32, f32); extern f32 vtxList_getGlobalNorm(BKVertexList *); struct4Cs *D_80369280 = NULL; @@ -143,7 +140,7 @@ void func_802F919C(void) { D_8036928C++; if (D_8036928C < D_80369284) { sp5C = &D_80369280[0].unk1C[D_8036928C]; - if (ml_distance_vec3f((*sp5C).unk0, D_80381040) > 1300.0f) { + if (ml_vec3f_distance((*sp5C).unk0, D_80381040) > 1300.0f) { func_802F9134(D_8036928C); } } else { diff --git a/src/core2/code_72B10.c b/src/core2/code_72B10.c index 1c690219..8ecbb9dd 100644 --- a/src/core2/code_72B10.c +++ b/src/core2/code_72B10.c @@ -86,7 +86,7 @@ void func_802F9D38(s32 arg0){ ptr = vector_at(D_803810A0, arg0); if(ptr->unk0){ func_8030E394(ptr->unk0); - func_8030DA44(ptr->unk0); + sfxsource_freeSfxsourceByIndex(ptr->unk0); ptr->unk0 = 0; } } diff --git a/src/core2/code_77E50.c b/src/core2/code_77E50.c index 987ecc94..7abc743a 100644 --- a/src/core2/code_77E50.c +++ b/src/core2/code_77E50.c @@ -1,9 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -extern s16 D_803A5D00[2][0xF660]; - void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_offset){ u16 *sp24; u16 *frame_buffer_ptr; @@ -11,10 +10,10 @@ void func_802FEDE0(BKTextureList *texture_list, s32 indx, s32 x_offset, s32 y_of s32 x; sp24 = (u16*)func_802EA620(texture_list) + indx*32*32; - frame_buffer_ptr = D_803A5D00[getActiveFramebuffer()]; + frame_buffer_ptr = gFramebuffers[getActiveFramebuffer()]; for(y = 0; y < 32; y++){//L802FEE60 for(x = 0; x < 32; x++){//L802FEE68 - sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*framebuffer_width + (x_offset + x)] | 1; //framebuffer to texture??? + sp24[32*(31 - y) + x] = frame_buffer_ptr[(y_offset + y)*gFramebufferWidth + (x_offset + x)] | 1; //framebuffer to texture??? }; }; } @@ -25,12 +24,12 @@ void func_802FEF48(BKModelBin *model_bin){ s32 x, y; texture_list = model_getTextureList(model_bin); - osInvalDCache((void *)D_803A5D00[getActiveFramebuffer()], framebuffer_width * framebuffer_height*2); + osInvalDCache((void *)gFramebuffers[getActiveFramebuffer()], gFramebufferWidth * gFramebufferHeight*2); for(y = 0; y < 8; y++){//L802FEFEC for(x = 0; x < 10; x++){ //get textures from framebuffer??? - func_802FEDE0(texture_list, 10*y + x, 32*x + (framebuffer_width - 10*32)/2, (s32)32*y + (framebuffer_height - 8*32)/2); + func_802FEDE0(texture_list, 10*y + x, 32*x + (gFramebufferWidth - 10*32)/2, (s32)32*y + (gFramebufferHeight - 8*32)/2); } }; diff --git a/src/core2/code_7AF80.c b/src/core2/code_7AF80.c index 7d2ef178..5794cd4b 100644 --- a/src/core2/code_7AF80.c +++ b/src/core2/code_7AF80.c @@ -1,14 +1,12 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include #include #include "prop.h" -extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); -extern f32 func_802586B0(f32[3], f32[3]); extern void mapModel_getCubeBounds(s32 min[3], s32 max[3]); extern f32 func_803243D0(struct56s *arg0, f32 arg1[3]); extern void bitfield_setBit(u32*, s32, bool); @@ -32,7 +30,7 @@ typedef struct { Struct_core2_7AF80_2 *unk8; } Struct_core2_7AF80_1; -NodeProp *cubeList_findNodePropByActorId(enum actor_e actor_id, s32 arg1[3]); +NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e actor_id, s32 arg1[3]); s32 func_80304FC4(enum actor_e *actor_id_list, NodeProp **node_list, s32 arg2); void cube_positionToIndices(s32 arg0[3], f32 arg1[3]); NodeProp *func_803080C8(s32 arg0); @@ -932,18 +930,18 @@ s32 func_803048E0(s32 arg0[3], s32 arg1[3], s32 arg2, s32 arg3, s32 arg4) { return func_8032F170(arg1, arg2); } -s32 func_80304984(s32 arg0, u32 *arg1) { - NodeProp *temp_v0; +s32 func_80304984(s32 actor_id, u32 *arg1) { + NodeProp *temp_v0 = cubeList_findNodePropByActorIdAndPosition_s32(actor_id, NULL); - temp_v0 = cubeList_findNodePropByActorId(arg0, 0); if (temp_v0 != 0) { *arg1 = temp_v0->unk6.radius; return 1; } + return 0; } -NodeProp *cubeList_findNodePropByActorId(enum actor_e actor_id, s32 position[3]) { +NodeProp *cubeList_findNodePropByActorIdAndPosition_s32(enum actor_e actor_id, s32 position[3]) { s32 cube_indices[3]; s32 i; f32 position_f32[3]; @@ -995,42 +993,42 @@ NodeProp *cubeList_findNodePropByActorId(enum actor_e actor_id, s32 position[3]) return NULL; } -NodeProp *nodeprop_findByActorIdAndActorPosition(enum actor_e actor_id, Actor *actor){ - s32 tmp_position[3]; +NodeProp *nodeprop_findByActorIdAndActorPosition(enum actor_e actor_id, Actor *actor_ptr) { + s32 pos_s32[3]; s32 *position; - if (actor != NULL) { - tmp_position[0] = actor->position_x; - tmp_position[1] = actor->position_y; - tmp_position[2] = actor->position_z; + if (actor_ptr != NULL) { + pos_s32[0] = actor_ptr->position_x; + pos_s32[1] = actor_ptr->position_y; + pos_s32[2] = actor_ptr->position_z; } - if (actor == NULL) { + if (actor_ptr == NULL) { position = NULL; } else { - position = tmp_position; + position = pos_s32; } - return cubeList_findNodePropByActorId(actor_id, position); + return cubeList_findNodePropByActorIdAndPosition_s32(actor_id, position); } -NodeProp *func_80304CAC(s32 arg0, f32 *arg1) { - s32 vec[3]; +NodeProp *nodeprop_findByActorIdAndPosition_f32(enum actor_e actor_id, f32 *position) { + s32 pos_s32[3]; - vec[0] = (s32)arg1[0]; - vec[1] = (s32)arg1[1]; - vec[2] = (s32)arg1[2]; - return cubeList_findNodePropByActorId(arg0, vec); + pos_s32[0] = (s32) position[0]; + pos_s32[1] = (s32) position[1]; + pos_s32[2] = (s32) position[2]; + return cubeList_findNodePropByActorIdAndPosition_s32(actor_id, pos_s32); } -NodeProp *func_80304D04(s32 arg0, s16 *arg1) { - s32 arr[3]; +NodeProp *nodeprop_findByActorIdAndPosition_s16(enum actor_e actor_id, s16 *position) { + s32 pos_s32[3]; - arr[0] = (s32)arg1[0]; - arr[1] = (s32)arg1[1]; - arr[2] = (s32)arg1[2]; - return cubeList_findNodePropByActorId(arg0, arr); + pos_s32[0] = (s32) position[0]; + pos_s32[1] = (s32) position[1]; + pos_s32[2] = (s32) position[2]; + return cubeList_findNodePropByActorIdAndPosition_s32(actor_id, pos_s32); } s32 nodeprop_getRadius(NodeProp *arg0) { @@ -1056,7 +1054,7 @@ s32 func_80304DB8(NodeProp *arg0) { bool _nodeProp_findPositionFromActorId(enum actor_e actor_id, s32 *position) { NodeProp *node_prop; - node_prop = cubeList_findNodePropByActorId(actor_id, NULL); + node_prop = cubeList_findNodePropByActorIdAndPosition_s32(actor_id, NULL); if (node_prop != 0) { position[0] = (s32) node_prop->x; position[1] = (s32) node_prop->y; @@ -1168,7 +1166,7 @@ bool func_80305248(f32 arg0[3], s32 arg1, s32 arg2){ } bool func_8030526C(f32 arg0[3], s32 arg1, s32 arg2){ - return func_8030515C(arg0, arg1, arg2, func_802586B0); + return func_8030515C(arg0, arg1, arg2, ml_vec3f_horizontal_distance_squared_zero_likely); } bool func_80305290(bool (* arg0)(NodeProp *), bool (* arg1)(Prop *)){ @@ -1187,7 +1185,7 @@ bool func_80305290(bool (* arg0)(NodeProp *), bool (* arg1)(Prop *)){ bool func_80305344(s32 arg0, u32 *arg1) { NodeProp *temp_v0; - temp_v0 = cubeList_findNodePropByActorId(arg0, NULL); + temp_v0 = cubeList_findNodePropByActorIdAndPosition_s32(arg0, NULL); if (temp_v0 != NULL) { *arg1 = temp_v0->unkC_31; return 1; diff --git a/src/core2/code_851D0.c b/src/core2/code_851D0.c index e39b1218..7dd2bc94 100644 --- a/src/core2/code_851D0.c +++ b/src/core2/code_851D0.c @@ -1,9 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -extern u8 D_803A5D00[2][0x1ecc0]; - #define TILE_SIZE 32 #define TILE_COUNT_X 5 @@ -91,7 +90,7 @@ void func_8030C27C(void){ void func_8030C2D4(Gfx **gdl, Mtx **mptr, Vtx **vptr){ scissorBox_setDefault(); - func_80253640(gdl, D_803A5D00[getActiveFramebuffer()]); + func_80253640(gdl, gFramebuffers[getActiveFramebuffer()]); } // Draws a 160x128 image pointed to by D_80382450 into the center of the screen diff --git a/src/core2/code_85800.c b/src/core2/code_85800.c index 169dadd7..13a1ef31 100644 --- a/src/core2/code_85800.c +++ b/src/core2/code_85800.c @@ -1,10 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "n_libaudio.h" -#include -extern f32 func_80256AB4(f32, f32, f32, f32); extern void func_80335394(s32, f32); extern f32 sfx_randf2(f32, f32); @@ -358,7 +357,7 @@ void func_8030D310(u8 indx){ switch(func_8030C7E8(ptr)){ case 1://L8030D468 if( func_8030C814(ptr, 0) || (func_8030C814(ptr, 1) && !ptr->unk40)) - func_8030DA44(indx); + sfxsource_freeSfxsourceByIndex(indx); break; case 2://L8030D4A4 if(func_8030C814(ptr, 1) && sfxsource_isFlagCleared(ptr, 1)) @@ -444,7 +443,7 @@ void func_8030D778(void){ int temp_s1; for(i = 1; i < 35; i++){ if(sfxsources[i].busy) - func_8030DA44(i); + sfxsource_freeSfxsourceByIndex(i); } do{ temp_s1 = 0; @@ -458,7 +457,7 @@ void func_8030D778(void){ void func_8030D86C(void){ func_8030D750(); - func_80244AB0(); + core1_7090_alloc(); func_8030EDAC(0.0f, 1.0f); } @@ -472,7 +471,7 @@ void func_8030D8B4(void){ } void func_8030D8DC(void){ - func_80244B3C(); + core1_7090_release(); func_8030D778(); func_8030D8B4(); } @@ -511,8 +510,8 @@ u8 sfxsource_createSfxsourceAndReturnIndex(void){ return s1; } -void func_8030DA44(u8 indx){ - SfxSource * sp1C = sfxsource_at(indx); +void sfxsource_freeSfxsourceByIndex(u8 indx) { + SfxSource *sp1C = sfxsource_at(indx); func_8030E394(indx); func_8030C7F8(sp1C, 3); } @@ -536,7 +535,7 @@ void func_8030DB04(u8 indx, s32 arg1, f32 arg2[3], f32 min_dist, f32 max_dist){ f32 dist; f32 temp_f2; __sfx_getPlayerPositionIfPresent(sp24); - dist = ml_distance_vec3f(arg2, sp24); + dist = ml_vec3f_distance(arg2, sp24); if(max_dist <= dist) temp_f2 = 0.0f; else{ @@ -904,7 +903,7 @@ void sfx_play(enum sfx_e uid, f32 volume, u32 sampleRate, f32 position[3], f32 m f32 player_position[3]; __sfx_getPlayerPositionIfPresent(player_position); - if( !(maxFadeDistance <= ml_distance_vec3f(player_position, position)) + if( !(maxFadeDistance <= ml_vec3f_distance(player_position, position)) && levelSpecificFlags_validateCRC2() && dummy_func_80320240() ){ diff --git a/src/core2/code_8DC20.c b/src/core2/code_8DC20.c index 518bec41..f09152e0 100644 --- a/src/core2/code_8DC20.c +++ b/src/core2/code_8DC20.c @@ -1,9 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -extern s16 D_803A5D00[2][0xF660]; Gfx D_8036C630[] = { @@ -40,10 +40,10 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void s32 y; gSPDisplayList((*gfx)++, D_8036C630); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(frame_buffer_1)); - for(y = 0; y < framebuffer_height / 32 + 1; y++){ - for(x = 0; x < framebuffer_width / 32 + 1; x++){ - gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, framebuffer_height, + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(frame_buffer_1)); + for(y = 0; y < gFramebufferHeight / 32 + 1; y++){ + for(x = 0; x < gFramebufferWidth / 32 + 1; x++){ + gDPLoadTextureTile((*gfx)++, osVirtualToPhysical(frame_buffer_2), G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, gFramebufferHeight, 0x20*x, 0x20*y, 0x20*(x + 1) - 1, 0x20*(y + 1) - 1, NULL, G_TX_CLAMP, G_TX_CLAMP, G_TX_NOMASK, G_TX_NOMASK, 0, 0 ); @@ -53,13 +53,13 @@ void func_80314BB0(Gfx **gfx, Mtx **mtx, Vtx **vtx, void * frame_buffer_1, void } } gSPDisplayList((*gfx)++, D_8036C690); - gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, framebuffer_width, OS_PHYSICAL_TO_K0(D_803A5D00[getActiveFramebuffer()])); + gDPSetColorImage((*gfx)++, G_IM_FMT_RGBA, G_IM_SIZ_16b, gFramebufferWidth, OS_PHYSICAL_TO_K0(gFramebuffers[getActiveFramebuffer()])); } void func_80315084(Gfx **gfx, Mtx **mtx, Vtx **vtx){ func_80335128(0); D_803830A0 = 2; - func_80314BB0(gfx, mtx, vtx, zBuffer_get(), D_803A5D00[getActiveFramebuffer()]); + func_80314BB0(gfx, mtx, vtx, zBuffer_get(), gFramebuffers[getActiveFramebuffer()]); } void func_80315110(Gfx **gfx, Mtx **mtx, Vtx **vtx){ @@ -72,7 +72,7 @@ void func_80315110(Gfx **gfx, Mtx **mtx, Vtx **vtx){ else{ D_803830A0--; } - func_80314BB0(gfx, mtx, vtx, D_803A5D00[getActiveFramebuffer()], zBuffer_get()); + func_80314BB0(gfx, mtx, vtx, gFramebuffers[getActiveFramebuffer()], zBuffer_get()); } void func_803151D0(Gfx **gfx, Mtx **mtx, Vtx **vtx){ diff --git a/src/core2/code_956B0.c b/src/core2/code_956B0.c index 1b547460..cef79a4a 100644 --- a/src/core2/code_956B0.c +++ b/src/core2/code_956B0.c @@ -9,10 +9,8 @@ extern s32 fileProgressFlag_get(s32); extern s32 fileProgressFlag_getN(s32 offset, s32 numBits); extern void func_8031FFAC(void); extern void fileProgressFlag_set(enum file_progress_e index, s32 set); -extern void ml_vec3h_to_vec3f(f32 *, s32); extern NodeProp *func_80304ED0(void*, f32 *); extern void func_8031CD44(enum map_e, s32, f32, f32, s32); -extern void func_80256E24(f32 *, f32, f32, f32, f32, f32); extern void mapSpecificFlags_set(s32, s32); bool cutscene_skipEnterLairCutsceneCheck(void); @@ -128,7 +126,7 @@ void func_8031CB50(enum map_e map_id, s32 exit_id, s32 arg2) { if ((func_803226E8(map_id) != sp1C) && (func_80322914() == 0)) { func_8025A388(0, 0x4E2); func_8025AB00(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); } if (func_802E4A08()) { func_802E40D0(map_id, exit_id); @@ -214,7 +212,7 @@ void func_8031CE70(f32 *arg0, enum map_e arg1, s32 arg2) { if (phi_s0->unk8 == 0x186) { phi_f2 = 1000.0f; } - if (ml_distance_vec3f(arg0, sp38) < phi_f2) { + if (ml_vec3f_distance(arg0, sp38) < phi_f2) { if (phi_s0->unk8 == 0x184) { ncDynamicCamera_setUpdateEnabled(0); func_8031CB50(arg1, arg2, 1); @@ -287,7 +285,7 @@ void warp_gvEnterWaterPyramidLower(s32 arg0, s32 arg1) { void warp_gvEnterRubeePyramid(s32 arg0, s32 arg1) { item_set(ITEM_6_HOURGLASS, 0); - func_80244C78(1); + core1_7090_freeSfxSource(1); func_8031CC8C(arg0, 0x1607); } @@ -297,7 +295,7 @@ void warp_gvEnterMatchingPyramid(s32 arg0, s32 arg1) { } void warp_gvEnterWaterPyramidUpper(s32 arg0, s32 arg1) { - func_80244C78(0); + core1_7090_freeSfxSource(0); volatileFlag_set(VOLATILE_FLAG_AC_GV_TRAPDOOR_MISSED, 1); func_8031CC8C(arg0, 0x1502); } @@ -536,7 +534,7 @@ void func_8031DAA8(enum map_e arg0, s32 arg1) { void func_8031DAE0(s32 arg0, s32 arg1) { if (mapSpecificFlags_get(2) == 0) { volatileFlag_set(VOLATILE_FLAG_AD_MMM_CHURCH_DOOR_MISSED, 1); - func_80244C78(0); + core1_7090_freeSfxSource(0); mapSpecificFlags_set(2, 1); func_8025A6EC(COMUSIC_3B_MINIGAME_VICTORY, 0x6D60); func_8028F918(1); @@ -737,8 +735,8 @@ void func_8031E204(NodeProp *node, s32 arg1, s32 arg2){ f32 sp28[3]; f32 sp1C[3]; - nodeprop_getPosition(func_80304D04(0x154, &node->x), sp34); - nodeprop_getPosition(func_80304D04(0x155, &node->x), sp28); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_s16(ACTOR_154_UNKNOWN, &node->x), sp34); + nodeprop_getPosition(nodeprop_findByActorIdAndPosition_s16(ACTOR_155_UNKNOWN, &node->x), sp28); player_getPosition(sp1C); if(sp28[1] < sp1C[1]){ sp1C[1] = sp28[1]; diff --git a/src/core2/code_98CB0.c b/src/core2/code_98CB0.c index 2cb555f1..0f9eb3f6 100644 --- a/src/core2/code_98CB0.c +++ b/src/core2/code_98CB0.c @@ -13,11 +13,9 @@ 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 ml_vec3h_to_vec3f(f32 *, s32); void func_8028F3D8(f32 *, f32, void(*)(ActorMarker *), ActorMarker *); struct unkfunc_80304ED0 *func_80304ED0(void*, f32 *); void func_8031CD44(s32, s32, f32, f32, s32); -void func_80256E24(f32 *, f32, f32, f32, f32, f32); #define OBSCURE(ptr) (((((s32)(ptr) ^ 0x746DF219) & 0xFF) + ((((s32)(ptr) >> 0x18) & 0xFF) << 0x18) + ((((s32)(ptr) >> 8) & 0xFFFF) << 8)) ^ 0x19) diff --git a/src/core2/code_9900.c b/src/core2/code_9900.c index d96c30a9..8c0db8ef 100644 --- a/src/core2/code_9900.c +++ b/src/core2/code_9900.c @@ -44,7 +44,7 @@ f32 func_80290920(f32 arg0, f32 arg1, f32 arg2){ } void func_8029099C(void){ - func_8030DA44(D_8037C040); + sfxsource_freeSfxsourceByIndex(D_8037C040); D_8037C040 = 0; } diff --git a/src/core2/code_9A9D0.c b/src/core2/code_9A9D0.c index 55070648..8bf8298f 100644 --- a/src/core2/code_9A9D0.c +++ b/src/core2/code_9A9D0.c @@ -34,12 +34,12 @@ void func_803219F4(s32 arg0){ switch(D_80383310){ case 2: //L80321A30 func_8025A55C(-1, 4000, 7); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); comusic_8025AB44(COMUSIC_58_WADING_BOOTS, 0, 4000); func_8025AABC(COMUSIC_58_WADING_BOOTS); break; case 4: //L80321A6C - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){ func_8025A55C(-1, 4000, 7); } @@ -48,7 +48,7 @@ void func_803219F4(s32 arg0){ break; case 3: //L80321AC0 func_8025A55C(-1, 4000, 7); - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); comusic_8025AB44(COMUSIC_95_BBONUS_A, 0, 4000); func_8025AABC(COMUSIC_95_BBONUS_A); break; @@ -60,7 +60,7 @@ void func_803219F4(s32 arg0){ switch(D_80383310){ case 2: //L80321B28 - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); func_8025A6EC(COMUSIC_58_WADING_BOOTS, -1); func_8025A8B8(COMUSIC_58_WADING_BOOTS, 1); @@ -72,7 +72,7 @@ void func_803219F4(s32 arg0){ else{ D_80383314 = COMUSIC_57_TURBO_TRAINERS; } - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); if(D_80383314 == COMUSIC_57_TURBO_TRAINERS){ func_8025A55C(0, 4000, 7); } @@ -81,7 +81,7 @@ void func_803219F4(s32 arg0){ break; case 3: //L80321BDC func_803228D8(); - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 7); func_8025A6EC(COMUSIC_95_BBONUS_A, -1); func_8025A8B8(COMUSIC_95_BBONUS_A, 1); diff --git a/src/core2/code_9B180.c b/src/core2/code_9B180.c index e67f7b51..28284645 100644 --- a/src/core2/code_9B180.c +++ b/src/core2/code_9B180.c @@ -130,7 +130,7 @@ void func_803223AC(void) { func_80244A98(1); for(i_ptr = D_8036DE00; i_ptr != &D_8036DE00[6]; i_ptr++){ - i_ptr->unk4 = cubeList_findNodePropByActorId(i_ptr->unk0, 0); + i_ptr->unk4 = cubeList_findNodePropByActorIdAndPosition_s32(i_ptr->unk0, NULL); if(i_ptr->unk4 != 0 && i_ptr->unk8 != NULL){ i_ptr->unk8(i_ptr); } @@ -143,7 +143,7 @@ void func_803223AC(void) { func_8032236C(0x1C, 4, &sp28); func_8032236C(0x1D, 5, &sp28); sp28 = (sp28 == 0) ? 2 : sp28; - func_8024BF94(sp28); + viMgr_func_8024BF94(sp28); } void func_80322490(void) { diff --git a/src/core2/code_9B650.c b/src/core2/code_9B650.c index a171866b..11d194bd 100644 --- a/src/core2/code_9B650.c +++ b/src/core2/code_9B650.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "SnS.h" typedef struct{ s16 unk0; @@ -233,13 +233,13 @@ void func_8032278C(s32 arg0, s32 arg1) { D_8036E2B4 = 0; if (D_80383348 == 0) { if ((temp_v0 & 1) != 0) { - func_8024ADF0(0); + core1_ce60_func_8024ADF0(FALSE); } else { - func_8024ADF0(1); + core1_ce60_func_8024ADF0(TRUE); } } else { D_80383348 = 0; - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } } if ((arg0 == 1) && (arg1 == 2)) { @@ -253,7 +253,7 @@ void func_8032278C(s32 arg0, s32 arg1) { void func_803228D8(void){ if(!D_80383348){ - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); D_80383348 = TRUE; } } diff --git a/src/core2/code_9BD0.c b/src/core2/code_9BD0.c index b9473951..fa8b5fc0 100644 --- a/src/core2/code_9BD0.c +++ b/src/core2/code_9BD0.c @@ -75,12 +75,12 @@ int func_80290D48(void){ sp1C = bs_getState(); switch(ncCameraNodeList_getNodeType(camera_node_index)){ case 4: - sp28 = func_802B9E34(camera_node_index); - sp24 = func_802BA234(sp28); + sp28 = ncCameraNodeList_getCameraNodeType4(camera_node_index); + sp24 = code33250_func_802BA234(sp28); func_80290BC0(sp24); return FALSE; case 3: //L80290DD8 - if(bsBeeFly_inSet(sp1C) && !func_802BA4D0(func_802B9E48(camera_node_index))){ + if(bsBeeFly_inSet(sp1C) && !code33310_func_802BA4D0(ncCameraNodeList_getCameraNodeType3(camera_node_index))){ return FALSE; } ncDynamicCamera_setState(0x11); @@ -88,7 +88,7 @@ int func_80290D48(void){ func_80291488(0x9); return TRUE; case 1://L80290E28 - if(bsBeeFly_inSet(sp1C) && !func_802BA89C(func_802B9E5C(camera_node_index))){ + if(bsBeeFly_inSet(sp1C) && !code336F0_func_802BA89C(ncCameraNodeList_getCameraNodeType1(camera_node_index))){ return FALSE; } ncDynamicCamera_setState(0x8); diff --git a/src/core2/code_9C170.c b/src/core2/code_9C170.c index 4f3ecf7f..251d4866 100644 --- a/src/core2/code_9C170.c +++ b/src/core2/code_9C170.c @@ -7,20 +7,20 @@ u8 D_80383370; /* .code */ void func_80323100(void){ - func_8024AED8(); + core1_ce60_resetState(); } void func_80323120(void){ - func_8024AE74(); + core1_ce60_func_8024AE74(); } void func_80323140(s32 arg0, s32 arg1){ - func_8024BD40(arg0, arg1); + core1_ce60_func_8024BD40(arg0, arg1); func_8032278C(arg0, arg1); } void func_80323170(void){ - func_8024AF48(); + core1_ce60_func_8024AF48(); } void func_80323190(void){ @@ -31,7 +31,7 @@ void func_80323190(void){ } void func_803231E8(void){ - func_8030DA44(D_80383370); + sfxsource_freeSfxsourceByIndex(D_80383370); } void func_8032320C(void){ @@ -46,7 +46,6 @@ void func_80323238(void){} // =============================================BREAK ??? extern f32 ml_vec3f_length(f32 [3], f32[3]); -extern f32 ml_distanceSquared_vec3f(f32 [3], f32 [3]); extern void func_80341180(f32, s32, s32, f32 *, f32 [3]); /* .code */ diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index 3efb9289..a2287a2f 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -1,15 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "actor.h" #include "prop.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 f32 ml_vec3f_length(f32[3], f32[3]); -extern bool ml_vec3f_within_distance(f32[3], f32[3], f32); extern void func_802D7124(Actor *, f32); extern void func_802EE6CC(f32[3], s32[4], s32[4], s32, f32, f32, s32, s32, s32); @@ -376,7 +374,7 @@ void func_80325FE8(Actor *this) { } temp_v0 = this->unk44_31; if (temp_v0 != 0) { - func_8030DA44(temp_v0); + sfxsource_freeSfxsourceByIndex(temp_v0); } this->animctrl = NULL; this->unk44_31 = 0; @@ -819,7 +817,7 @@ Actor *actor_new(s32 position[3], s32 yaw, ActorInfo* actorInfo, u32 flags){ suLastBaddie->unk10_7 = 0; suLastBaddie->unk10_6 = 0; suLastBaddie->unk54 = 0.0f; - suLastBaddie->unk58_31 = 0; + suLastBaddie->animctrl_asset_id = 0; suLastBaddie->unk5C = 0.0f; suLastBaddie->unkF4_31 = 0; suLastBaddie->unk138_30 = 0; diff --git a/src/core2/code_A4D00.c b/src/core2/code_A4D00.c index 3f258024..9674d9e6 100644 --- a/src/core2/code_A4D00.c +++ b/src/core2/code_A4D00.c @@ -15,10 +15,6 @@ extern f32 func_8033229C(ActorMarker *marker); extern f32 func_80309B24(f32 [3]); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); - -extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); - extern BKCollisionTri *func_80320C94(f32 arg0[3], f32 arg1[3], f32 arg2, f32 arg3[3], s32 arg4, u32 arg5); /* .h */ @@ -213,7 +209,7 @@ bool func_8032BD88(Actor *arg0, f32 arg1[3], s32 arg2, s32 arg3) { arg0->position[0] = var_fp->unk0[0]; arg0->position[1] = var_fp->unk0[1]; arg0->position[2] = var_fp->unk0[2]; - if ((temp_f20 != 0.0f) && ((ml_dotProduct_vec3f(var_fp->unk1C, sp284) / temp_f20) < 0.93969262)) { + if ((temp_f20 != 0.0f) && ((ml_vec3f_dot_product(var_fp->unk1C, sp284) / temp_f20) < 0.93969262)) { var_fp = NULL; } } diff --git a/src/core2/code_A5BC0.c b/src/core2/code_A5BC0.c index 9e9b0cf1..14b261c8 100644 --- a/src/core2/code_A5BC0.c +++ b/src/core2/code_A5BC0.c @@ -1,9 +1,9 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "enums.h" -#include #include #define AssetCacheSize 0x3D5 @@ -191,7 +191,7 @@ void func_8032CD60(Prop *prop) { sp30 = (sp44 == 3) ? sp38 : (sp38 - sp34)*2; sp2C = (s32)((((u32)(((u16*)prop)[5]) << 0x15) >> 0x1B) * sp30) / 32; - var_v1 = (((globalTimer_getTime(sp34, sp30, prop, sp40) % (sp30 * sp48)) / sp48) + sp2C) % sp30; + var_v1 = (((globalTimer_getTime(sp34, sp30, prop, sp40) % (sp30 * sp48)) / sp48) + sp2C) % sp30; // TODO: globalTimer_getTime has no parameters, but if we remove them here (to forward declare them in include/core1/main.h, it doesn't match anymore) var_t5 = 0; switch (sp40) { /* irregular */ default: @@ -1975,7 +1975,7 @@ f32 func_80331D20(BKSprite *sprite) { if (sprite == 0) { return 1.0f; } - frame = spriteGetFramePtr(sprite, 0); + frame = sprite_getFramePtr(sprite, 0); temp_lo = (s32) (((frame->unk10 - frame->unkC) + 1) * sprite->unk8) / (s32) frame->w; temp_lo_2 = (s32) (((frame->unk12 - frame->unkE) + 1) * sprite->unkA) / (s32) frame->h; phi_v0 = (temp_lo_2 < temp_lo) ? temp_lo : temp_lo_2; diff --git a/src/core2/code_ABC00.c b/src/core2/code_ABC00.c index d70fad02..3df108c1 100644 --- a/src/core2/code_ABC00.c +++ b/src/core2/code_ABC00.c @@ -142,7 +142,7 @@ s32 s_jiggylist_current_index; /* .code */ void func_80332B90(void){ - func_8024BD08(1); + core1_ce60_incOrDecCounter(TRUE); } void func_80332BB0(void) { @@ -245,7 +245,7 @@ void jiggy_spawn(enum jiggy_e jiggy_id, f32 pos[3]) { temp_v0->init(&temp_v0->unk10); jiggyscore_setSpawned(jiggy_id, TRUE); if (!jiggyscore_isCollected(jiggy_id) && (jiggy_id != JIGGY_3E_GV_GRABBA) && (jiggy_id != JIGGY_0B_TTC_JINJO)) { - func_8024BD08(0); + core1_ce60_incOrDecCounter(FALSE); func_8025A55C(0, 4000, 5); func_8025A6EC(COMUSIC_3D_JIGGY_SPAWN, 0x7FFF); timedFunc_set_0(3.5f, func_80332BB0); diff --git a/src/core2/code_AC520.c b/src/core2/code_AC520.c index 3845e56e..54505f7b 100644 --- a/src/core2/code_AC520.c +++ b/src/core2/code_AC520.c @@ -5,7 +5,6 @@ #include #include -extern void func_80252CC4(f32[3], f32[3], f32, f32[3]); extern f32 vtxList_getGlobalNorm(BKVertexList *arg0); static void __lighting_init(f32 position[3], f32 rotation[3], f32 scale, f32[3], f32); @@ -33,7 +32,7 @@ static void __lighting_init(f32 position[3], f32 rotation[3], f32 scale, f32 arg sLightingVectorList.unk44 = sLightingVectorList.unk4; iPtr = start_ptr; for(; iPtr < end_ptr && sLightingVectorList.unk44 < sLightingVectorList.unk48; iPtr++) { - if(iPtr->unk34 && ml_distance_vec3f(position, iPtr->position) < iPtr->unk1C + global_norm) { + if(iPtr->unk34 && ml_vec3f_distance(position, iPtr->position) < iPtr->unk1C + global_norm) { mlMtx_apply_vec3f(iPtr->positionCopy, iPtr->position); iPtr->unk20 = iPtr->unk18/scale; iPtr->unk24 = iPtr->unk1C/scale; @@ -144,7 +143,7 @@ s32 __codeAC520_pad_func_803339A4(f32 arg0[3]) { for(iPtr = beginPtr; iPtr < endPtr; iPtr++) { if(iPtr->unk34) { - if(tmp_s0 == NULL || ml_distance_vec3f(arg0, iPtr->position) < ml_distance_vec3f(arg0, tmp_s0->position)) { + if(tmp_s0 == NULL || ml_vec3f_distance(arg0, iPtr->position) < ml_distance_vec3f(arg0, tmp_s0->position)) { tmp_s0 = iPtr; } } @@ -231,7 +230,7 @@ void codeAC520_func_80333D48(BKVertexList *vertex_list, f32 position[3], f32 rot for(struct_ptr_ptr = &sLightingVectorList.unk4[0]; struct_ptr_ptr < sLightingVectorList.unk44;struct_ptr_ptr++) { struct_ptr = *struct_ptr_ptr; - distance_between_vtx_and_lighting_node = ml_distance_vec3f(struct_ptr->positionCopy, vtx_position); + distance_between_vtx_and_lighting_node = ml_vec3f_distance(struct_ptr->positionCopy, vtx_position); if (!(struct_ptr->unk24 <= distance_between_vtx_and_lighting_node)) { if (distance_between_vtx_and_lighting_node <= struct_ptr->unk20) { rgb_modifier[0] = rgb_modifier[0] + struct_ptr->rgb[0]; diff --git a/src/core2/code_AD5B0.c b/src/core2/code_AD5B0.c index abe88ffe..6b4efd2f 100644 --- a/src/core2/code_AD5B0.c +++ b/src/core2/code_AD5B0.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/anim/sprite.h" #include #include "core2/particle.h" @@ -31,14 +31,14 @@ void func_80334540(Gfx** gdl, Mtx **mptr, Vtx **vptr) { f32 sp40; if (D_803835E0 == 0) { - drawRectangle2D(gdl, 0, 0, framebuffer_width, framebuffer_height, 0, 0, 0); + drawRectangle2D(gdl, 0, 0, gFramebufferWidth, gFramebufferHeight, 0, 0, 0); func_802BBD2C(&sp44, &sp40); viewport_setNearAndFar(sp44, sp40); viewport_setRenderViewportAndPerspectiveMatrix(gdl, mptr); return; } if (func_80320708() == 0) { - write_file_blocks(0, 0, 0x80BC7230, EEPROM_MAXBLOCKS); + eeprom_writeBlocks(0, 0, 0x80BC7230, EEPROM_MAXBLOCKS); } spawnQueue_unlock(); sky_draw(gdl, mptr, vptr); @@ -181,7 +181,7 @@ void func_80334910(void) { if (func_80322914() == 0) { func_8024F7C4(func_803226E8(D_803835D0.map_4)); } - func_80244B3C(); + core1_7090_release(); AnimTextureListCache_free(); func_80322FDC(); func_8033BD6C(); @@ -197,7 +197,7 @@ void func_80334B20(enum map_e arg0, s32 arg1, s32 arg2) { func_80335110(1); func_80335128(1); func_802D2CB8(); - func_80244AB0(); + core1_7090_alloc(); if (map_get() == MAP_8E_GL_FURNACE_FUN) { func_8038E7C4(); } diff --git a/src/core2/code_AEDA0.c b/src/core2/code_AEDA0.c index 4e79d895..f50ac2f5 100644 --- a/src/core2/code_AEDA0.c +++ b/src/core2/code_AEDA0.c @@ -1,10 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include -void func_80252330(f32, f32, f32); void func_803382D8(s32 arg0); void func_803382E4(s32 arg0); void spriteRender_set1Primative(bool boolean); @@ -260,7 +258,7 @@ void spriteRender_drawWithSegment(Gfx **gfx, Vtx **vtx, BKSprite *sprite, u32 fr gDPPipelineMode((*gfx)++, G_PM_1PRIMITIVE); } - frame_ptr = spriteGetFramePtr(sprite, frame); + frame_ptr = sprite_getFramePtr(sprite, frame); //load palette in indexed pixels var_t2 = (BKSpriteTextureBlock *)(frame_ptr + 1); diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index 4457b83b..fbe2fcc5 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -338,7 +338,7 @@ BKSprite *func_8033B6C4(enum asset_e sprite_id, BKSpriteDisplayData **arg1){ s0 = assetcache_get(sprite_id); if(D_80383CD4[assetCacheCurrentIndex] == NULL){ func_803382E4(-1); - func_80338308(func_802510A0(s0), func_802510A8(s0)); + func_80338308(sprite_getUnk8(s0), sprite_getUnkA(s0)); D_80383CD4[assetCacheCurrentIndex] = func_80344A1C(s0); } *arg1 = D_80383CD4[assetCacheCurrentIndex]; diff --git a/src/core2/code_B5040.c b/src/core2/code_B5040.c index e41a75d4..bec8101a 100644 --- a/src/core2/code_B5040.c +++ b/src/core2/code_B5040.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -318,7 +319,7 @@ void __savedata_save_abilities(u8 *savedata){ //savedata_save_abilities s32 savedata_8033CA2C(s32 filenum, SaveData *save_data){ s32 sp1C; - sp1C = load_file_blocks(filenum, 0, save_data, 0xF); + sp1C = eeprom_readBlocks(filenum, 0, save_data, 0xF); if( sp1C || savedata_verify(0x78, save_data) || ((u8*)save_data)[baseOffset] != 0x11 @@ -331,7 +332,7 @@ s32 savedata_8033CA2C(s32 filenum, SaveData *save_data){ s32 savedata_8033CA9C(SaveData *savedata){ s32 sp1C; - sp1C = load_file_blocks(0, 0x3C, savedata, 0x4); + sp1C = eeprom_readBlocks(0, 0x3C, savedata, 0x4); if( sp1C || savedata_verify(0x20, savedata) ){ @@ -384,7 +385,7 @@ void saveData_create(SaveData *savedata){ int savedata_8033CC98(s32 filenum, u8 *buffer){ int out; - out = write_file_blocks(filenum, 0, buffer, 0xF); + out = eeprom_writeBlocks(filenum, 0, buffer, 0xF); if(out){ out = 1; } @@ -393,7 +394,7 @@ int savedata_8033CC98(s32 filenum, u8 *buffer){ int savedata_8033CCD0(s32 filenum){ int out; - out = write_file_blocks(filenum, 0, D_80383D18, 1); + out = eeprom_writeBlocks(filenum, 0, D_80383D18, 1); if(out){ out = 1; } @@ -403,7 +404,7 @@ int savedata_8033CCD0(s32 filenum){ int savedata_8033CE40(u8 *buffer){ int out; savedata_update_crc(buffer, sizeof(GlobalData)); - out = write_file_blocks(0, 0x3C, buffer, 4); + out = eeprom_writeBlocks(0, 0x3C, buffer, 4); if(out){ out = 1; } diff --git a/src/core2/code_B62B0.c b/src/core2/code_B62B0.c index 155cb8ee..4e2907ea 100644 --- a/src/core2/code_B62B0.c +++ b/src/core2/code_B62B0.c @@ -17,13 +17,13 @@ typedef struct{ /* .data */ Struct_core2_B62B0_0 D_80370AC0[0xBB] = { - {MARKER_12A_TOPPER_A, 0x0000, {0x0904, 0x8504, 0x8504, 0x0000, 0x8504, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7484}}, - {MARKER_129_BAWL_A, 0x0000, {0x0504, 0x0984, 0x8504, 0x0000, 0x8504, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7484}}, - {MARKER_128_COLLYWOBBLE_A, 0x0000, {0x0000, 0x0000, 0x8404, 0x0984, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7404}}, + {MARKER_12A_TOPPER_THE_CARROT_A, 0x0000, {0x0904, 0x8504, 0x8504, 0x0000, 0x8504, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7484}}, + {MARKER_129_BAWL_THE_ONION_A, 0x0000, {0x0504, 0x0984, 0x8504, 0x0000, 0x8504, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7484}}, + {MARKER_128_COLLYWOBBLE_THE_CAULIFLOWER_A, 0x0000, {0x0000, 0x0000, 0x8404, 0x0984, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x0000, 0x7404}}, {MARKER_135_QUARRIE, 0x0000, {0x0000, 0x0000, 0x0000, 0x0000, 0x0804, 0x0804, 0x0000, 0x0804, 0x0804, 0x0000, 0x0000}}, - {MARKER_1E6_TOPPER_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, - {MARKER_1E7_BAWL_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, - {MARKER_1E8_COLLYWOBBLE_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, + {MARKER_1E6_TOPPER_THE_CARROT_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, + {MARKER_1E7_BAWL_THE_ONION_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, + {MARKER_1E8_COLLYWOBBLE_THE_CAULIFLOWER_B, 0x0001, {0x0904, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0000, 0x0984, 0x0A04, 0x0000, 0x1020}}, {MARKER_1EA_GRUNTLING_RED, 0x0001, {0x0A08, 0x0984, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0A84, 0x0984, 0x0A04, 0x0984, 0x2020}}, {MARKER_295_GRUNTLING_BLUE, 0x0001, {0x0A0C, 0x8988, 0x8100, 0x0984, 0x0A04, 0x0A04, 0x0A84, 0x0988, 0x0A04, 0x0000, 0x2020}}, {MARKER_1F1_GRUNTLING_BLACK, 0x0001, {0x0A10, 0x898C, 0x8100, 0x8988, 0x8A08, 0x8A08, 0x0A84, 0x098C, 0x0A04, 0x0000, 0x2020}}, diff --git a/src/core2/code_B6C60.c b/src/core2/code_B6C60.c index 6c459b7a..5634e619 100644 --- a/src/core2/code_B6C60.c +++ b/src/core2/code_B6C60.c @@ -21,7 +21,7 @@ void func_8033DC18(void){} f32 func_8033DC20(void){ f32 out; - D_80384470 = func_8024BD94(); + D_80384470 = viMgr_func_8024BD94(); out = 0.016666666666666666*D_80384470; return out; } diff --git a/src/core2/code_B6CE0.c b/src/core2/code_B6CE0.c index 815e00af..1f9d3ed2 100644 --- a/src/core2/code_B6CE0.c +++ b/src/core2/code_B6CE0.c @@ -39,7 +39,7 @@ f32 time_getDelta(void){ } f32 func_8033DDB8(void){ - return func_8024BD94()*(1/60.0); + return viMgr_func_8024BD94()*(1/60.0); } f32 func_8033DDEC(void){ diff --git a/src/core2/code_B850.c b/src/core2/code_B850.c index 5520c05e..2c71deae 100644 --- a/src/core2/code_B850.c +++ b/src/core2/code_B850.c @@ -4,7 +4,6 @@ #include "core2/ba/physics.h" -extern void ml_vec3f_assign(f32[3], f32, f32, f32); /* .data */ s32 D_80363790 = 0; diff --git a/src/core2/code_B8860.c b/src/core2/code_B8860.c index 929730cf..8c4b4516 100644 --- a/src/core2/code_B8860.c +++ b/src/core2/code_B8860.c @@ -1,12 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include extern void mlMtxRotatePYR(f32, f32, f32); -extern void func_80252330(f32, f32, f32); typedef struct { BKSprite *sprite_0; diff --git a/src/core2/code_B9090.c b/src/core2/code_B9090.c index 7d013a18..b0c66c8e 100644 --- a/src/core2/code_B9090.c +++ b/src/core2/code_B9090.c @@ -4,8 +4,6 @@ #define ABS(s) (((s) >= 0) ? (s) : -(s)) -extern void func_80252CC4(f32[3], f32[3], f32, f32[3]); - /* .code */ bool func_80340020(Struct83s *self, f32 position[3], f32 arg2[3], f32 arg3, f32 *arg4, BKVertexList *arg5, f32 arg6[3], f32 arg7[3]) { f32 sp6C[3]; @@ -20,7 +18,7 @@ bool func_80340020(Struct83s *self, f32 position[3], f32 arg2[3], f32 arg3, f32 } self->unk1A = FALSE; - if (0.1 < ml_distance_vec3f(arg6, self->unk8)) { + if (0.1 < ml_vec3f_distance(arg6, self->unk8)) { return FALSE; } for(i = 0; i < 3; i++){ diff --git a/src/core2/code_B9770.c b/src/core2/code_B9770.c index dac9e251..d8e7a21a 100644 --- a/src/core2/code_B9770.c +++ b/src/core2/code_B9770.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern void func_80250530(s32, u16, f32); -extern s32 func_80255D44(s32); extern void sfxsource_setSampleRate(u8, s32); extern bool func_80323240(struct56s *, f32, f32[3]); extern f32 func_803234FC(struct56s *, f32, f32); @@ -528,13 +526,13 @@ void func_80341A54(void) { for(var_s0 = 0; var_s0 < 0x40; var_s0++){ if (D_803858A0[var_s0] != 0) { - func_8030DA44(D_803858A0[var_s0]); + sfxsource_freeSfxsourceByIndex(D_803858A0[var_s0]); } } for(var_s0 = 0x40; var_s0 < 0x80; var_s0++){ if (D_803858A0[var_s0] != 0) { - func_8025A7DC(func_80255D30(D_803858A0[var_s0])); + func_8025A7DC(lookup_getCoMusicId(D_803858A0[var_s0])); } } @@ -783,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(func_80255D30(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8); + func_8025A6EC(lookup_getCoMusicId(arg1->t0.unk4.common.bit31), arg1->t0.unk4.common.bit15 * 8); break; case 3: @@ -791,21 +789,21 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){ sp7C = arg1->t0.unk8.bit31 / 8.388608e6f; sp74 = arg1->t0.unk4.common.bit15 * 8; sp70 = arg1->t0.unk10.common.bit7; - if (func_8030ED70(func_80255D44(sp78))){ + if (func_8030ED70(lookup_getSfxId(sp78))){ sfxsourceIdx = sfxsource_createSfxsourceAndReturnIndex(); if (sfxsourceIdx == 0){ return sp84; } - sfxsource_setSfxId(sfxsourceIdx, func_80255D44(sp78)); + sfxsource_setSfxId(sfxsourceIdx, lookup_getSfxId(sp78)); sfxsource_playSfxAtVolume(sfxsourceIdx, sp7C); sfxsource_setSampleRate(sfxsourceIdx, sp74); func_8030E2C4(sfxsourceIdx); if (D_803858A0[sp70] != 0){ - func_8030DA44(D_803858A0[sp70]); + sfxsource_freeSfxsourceByIndex(D_803858A0[sp70]); } D_803858A0[sp70] = sfxsourceIdx; } else { - func_8030E6A4(func_80255D44(sp78), sp7C, sp74); + func_8030E6A4(lookup_getSfxId(sp78), sp7C, sp74); } break; @@ -829,14 +827,14 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){ case 4: if (D_803858A0[arg1->t0.unk10.common.bit7] != 0){ - func_8025A7DC(func_80255D30(D_803858A0[arg1->t0.unk10.common.bit7])); + func_8025A7DC(lookup_getCoMusicId(D_803858A0[arg1->t0.unk10.common.bit7])); D_803858A0[arg1->t0.unk10.common.bit7] = 0; } break; case 5: if (D_803858A0[arg1->t0.unk10.common.bit7] != 0){ - func_8030DA44(D_803858A0[arg1->t0.unk10.common.bit7]); + sfxsource_freeSfxsourceByIndex(D_803858A0[arg1->t0.unk10.common.bit7]); D_803858A0[arg1->t0.unk10.common.bit7] = 0; } break; @@ -885,12 +883,12 @@ s32 func_803422D4(Actor *arg0, Union_glspline *arg1, SplineList *arg2){ } if (arg1->t1.unk8.bit10){ arg0->unk5C = ((f32) arg1->t1.unk8.bit21) / 4; - arg0->unk58_31 = func_80255D58(arg1->t1.unk8.bit31); + arg0->animctrl_asset_id = lookup_getAnimAssetId(arg1->t1.unk8.bit31); if (arg0->animctrl == 0) { arg0->animctrl = animctrl_new(0); animctrl_reset(arg0->animctrl); } - animctrl_setIndex(arg0->animctrl, arg0->unk58_31); + animctrl_setIndex(arg0->animctrl, arg0->animctrl_asset_id); animctrl_setDuration(arg0->animctrl, arg0->unk5C); animctrl_setDirection(arg0->animctrl, 1); if (arg0->animctrl != 0) { @@ -1266,20 +1264,20 @@ void func_80343DEC(Actor *this){ void func_80343E20(s32 arg0, s32 arg1, f32 arg2, s32 arg3) { u8 temp_v0; - if (func_8030ED70(func_80255D44(arg0)) != 0) { + if (func_8030ED70(lookup_getSfxId(arg0)) != 0) { temp_v0 = sfxsource_createSfxsourceAndReturnIndex(); if (temp_v0 != 0) { - sfxsource_setSfxId(temp_v0, func_80255D44(arg0)); + sfxsource_setSfxId(temp_v0, lookup_getSfxId(arg0)); sfxsource_playSfxAtVolume(temp_v0, arg2); sfxsource_setSampleRate(temp_v0, arg1); func_8030E2C4(temp_v0); if (D_803858A0[arg3] != 0) { - func_8030DA44(D_803858A0[arg3]); + sfxsource_freeSfxsourceByIndex(D_803858A0[arg3]); } D_803858A0[arg3] = temp_v0; } } else { - func_8030E6A4(func_80255D44(arg0), arg2, arg1); + func_8030E6A4(lookup_getSfxId(arg0), arg2, arg1); } } diff --git a/src/core2/code_BD100.c b/src/core2/code_BD100.c index a90a20c3..76c3bed7 100644 --- a/src/core2/code_BD100.c +++ b/src/core2/code_BD100.c @@ -1,12 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include extern void spriteRender_drawWithSegment(Gfx**, Vtx**, BKSprite *, s32, s32); -extern void func_80252330(f32, f32, f32);\ extern void func_80349AD0(void); diff --git a/src/core2/code_BE2C0.c b/src/core2/code_BE2C0.c index 15da711f..6be762c5 100644 --- a/src/core2/code_BE2C0.c +++ b/src/core2/code_BE2C0.c @@ -1,11 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" - -extern f32 func_80255D70(f32); - #define LENGTH_SQ_VEC4F(v) (v[0]*v[0] + v[1]*v[1] + v[2]*v[2] + v[3]*v[3]) /* .data */ @@ -98,7 +95,7 @@ void func_80345650(f32 arg0[4], f32 arg1[4], f32 arg2[4], f32 arg3) { temp_f12 = (arg1[0]*arg2[0]) + (arg1[1]*arg2[1]) + (arg1[2]*arg2[2]) + (arg1[3]*arg2[3]); if (0.00001 < (1.0 + temp_f12)) { if (0.00001 < (1.0 - temp_f12)) { - sp3C = (BAD_PI/180.0) * func_80255D70(temp_f12); + sp3C = (BAD_PI/180.0) * ml_acosf_deg(temp_f12); sp40 = sinf(sp3C); if (0.0f != sp40) { sp48 = sinf((1.0 - arg3) * sp3C) / sp40; diff --git a/src/core2/code_BEF20.c b/src/core2/code_BEF20.c index 32275ece..0e7654fc 100644 --- a/src/core2/code_BEF20.c +++ b/src/core2/code_BEF20.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -59,7 +60,7 @@ s32 item_adjustByDiff(enum item_e item, s32 diff, s32 no_hud){ oldVal = D_80385F30[item]; - if(func_80255D04()) + if(ucode_stub3()) diff = 0; if(diff < 0){ diff --git a/src/core2/code_C0E60.c b/src/core2/code_C0E60.c index 743230b2..0f758d7d 100644 --- a/src/core2/code_C0E60.c +++ b/src/core2/code_C0E60.c @@ -135,7 +135,7 @@ void func_80348044(Gfx **gfx, BKSprite* sprite, s32 frame, s32 tmem, s32 rtile, s32 var_v0; s32 maskt; - sprite_frame = spriteGetFramePtr(sprite, frame); + sprite_frame = sprite_getFramePtr(sprite, frame); *frame_width = (s32) sprite_frame->w; *frame_height = (s32) sprite_frame->h; if (*textureCount == -1) { diff --git a/src/core2/code_C4B0.c b/src/core2/code_C4B0.c index b2fe6bc9..6bc48512 100644 --- a/src/core2/code_C4B0.c +++ b/src/core2/code_C4B0.c @@ -1,10 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "core2/ba/physics.h" -extern int func_80258424(f32 vec[3], f32 minX, f32 minY, f32 minZ, f32 maxX, f32 maxY, f32 maxZ); extern f32 func_8031C5D4(struct0*); extern void func_8031C5AC(struct0 *, f32 *); extern f32 func_8031C5E4(struct0*); @@ -12,7 +12,6 @@ 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); extern BKCollisionTri *func_802457C4(f32[3], f32[3], f32, f32, f32[3], s32, u32); -extern f32 func_80255D70(f32 arg0); extern s32 func_8029463C(void); extern BKCollisionTri *func_80320C94(f32[3], f32[3], f32, f32[3], s32, u32); @@ -297,7 +296,7 @@ void func_80293F0C(void){ f32 sp2C[3]; _player_getPosition(sp44); - if(map_get() == MAP_34_RBB_ENGINE_ROOM && func_80258424(sp44, -900.0f, -940.0f, 200.0f, 900.0f, 940.0f, 800.0f)){ + if(map_get() == MAP_34_RBB_ENGINE_ROOM && ml_vec3f_inside_box_f(sp44, -900.0f, -940.0f, 200.0f, 900.0f, 940.0f, 800.0f)){ func_8031C5FC(D_8037C200, 150.0f); } else{ func_8031C608(D_8037C200); @@ -429,7 +428,7 @@ void func_80294480(f32 arg0[3]){ f32 func_802944A8(void){ f32 sp1C[3]; func_80294480(sp1C); - return func_80255D70(sp1C[1]); + return ml_acosf_deg(sp1C[1]); } void func_802944D0(f32 dst[3]){ diff --git a/src/core2/code_C62B0.c b/src/core2/code_C62B0.c index e5988f86..6d7aecbe 100644 --- a/src/core2/code_C62B0.c +++ b/src/core2/code_C62B0.c @@ -30,7 +30,7 @@ void func_8034D554(s32 *mesh_id, BKVtxRef *src, Vtx *dst, Struct6Ds *arg3){ temp_f0 = arg3->unk44 / arg3->unk48; temp_f0 = temp_f0 * temp_f0 * temp_f0 * temp_f0; - ml_interpolate_vec3f(sp18, arg3->unk2C, arg3->unk38, temp_f0); + ml_vec3f_interpolate_fast(sp18, arg3->unk2C, arg3->unk38, temp_f0); dst->v.ob[0] = (s16)(src->v.v.ob[0] + sp18[0]); dst->v.ob[1] = (s16)(src->v.v.ob[1] + sp18[1]); dst->v.ob[2] = (s16)(src->v.v.ob[2] + sp18[2]); @@ -41,7 +41,7 @@ void func_8034D634(s32 *mesh_id, BKVtxRef *src, Vtx *dst, Struct6Ds *arg3){ f32 sp18[3]; temp_f0 = arg3->unk44 / arg3->unk48; - ml_interpolate_vec3f(sp18, arg3->unk2C, arg3->unk38, temp_f0); + ml_vec3f_interpolate_fast(sp18, arg3->unk2C, arg3->unk38, temp_f0); dst->v.ob[0] = (s16)(src->v.v.ob[0] + sp18[0]); dst->v.ob[1] = (s16)(src->v.v.ob[1] + sp18[1]); dst->v.ob[2] = (s16)(src->v.v.ob[2] + sp18[2]); @@ -127,7 +127,7 @@ bool func_8034DC80(Struct6Ds *arg0, f32 arg1[3]) { void func_8034DD48(Struct6Ds *arg0){ if(arg0->unk0 != 0){ - func_8030DA44(arg0->unk0); + sfxsource_freeSfxsourceByIndex(arg0->unk0); } } @@ -359,7 +359,7 @@ void func_8034E26C(Struct6Ds *arg0, BKModel *model, s32 mesh_id) { arg0->unk10(arg0); } if (arg0->unk0 != 0) { - func_8030DA44(arg0->unk0); + sfxsource_freeSfxsourceByIndex(arg0->unk0); arg0->unk0 = 0; } } diff --git a/src/core2/code_C8760.c b/src/core2/code_C8760.c index 5ab5112c..8ecc91af 100644 --- a/src/core2/code_C8760.c +++ b/src/core2/code_C8760.c @@ -21,7 +21,7 @@ void func_8034F6F0(Gfx **gdl, Mtx **mptr, s32 vptr){ void func_8034F734(void){ if(D_803720A0.unk0){ - func_8030DA44(D_803720A0.sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(D_803720A0.sfxsourceIdx); particleEmitter_free(D_803720A0.unk0); } } diff --git a/src/core2/code_C89C0.c b/src/core2/code_C89C0.c index d3371771..7b834ddb 100644 --- a/src/core2/code_C89C0.c +++ b/src/core2/code_C89C0.c @@ -5,7 +5,6 @@ extern void func_8032F64C(f32[3], s32); extern void func_80323240(struct56s *, f32, f32[3]); extern f32 func_80323F74(struct56s *, f32, f32); -extern f32 func_80256AB4(f32, f32, f32, f32); typedef struct { s32 unk0; @@ -226,7 +225,7 @@ void func_80350250(void) { if ((D_80386150.unk0 != NULL) && (func_80334904() == 2)) { player_getPosition(sp7C); for(var_s0 = D_80386150.unk8; var_s0 < D_80386150.unkC; var_s0++) { - var_s0->unk4 = (ml_distance_vec3f(var_s0->unkC, sp7C) < 2000.0f); + var_s0->unk4 = (ml_vec3f_distance(var_s0->unkC, sp7C) < 2000.0f); if (var_s0->unk4) { if (var_s0->unk8 > 0) { var_s0->unk28 -= temp_f22; diff --git a/src/core2/code_C97F0.c b/src/core2/code_C97F0.c index 3766e3a7..e497386e 100644 --- a/src/core2/code_C97F0.c +++ b/src/core2/code_C97F0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern bool func_8028F170(f32, f32); @@ -136,14 +136,14 @@ void func_80350818(Gfx **gfx, Mtx **mtx, Vtx **vtx) { sp9C[2] = temp_s1->unk4[2]; ml_vec3f_yaw_rotate_copy(sp9C, sp9C, -spD0[1]); ml_vec3f_pitch_rotate_copy(sp9C, sp9C, -spD0[0]); - if (!(((1.2 * (f32)framebuffer_width) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)framebuffer_width) / 2))) { - if (!(((1.2 * (f32)framebuffer_height) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)framebuffer_height) / 2))) { + if (!(((1.2 * (f32)gFramebufferWidth) / 2) < sp9C[0]) && !(sp9C[0] < ((-1.2 * (f32)gFramebufferWidth) / 2))) { + if (!(((1.2 * (f32)gFramebufferHeight) / 2) < sp9C[1]) && !(sp9C[1] < ((-1.2 * (f32)gFramebufferHeight) / 2))) { sp90[0] = -sp9C[0]; sp90[1] = -sp9C[1]; sp90[2] = sp9C[2]; ml_vec3f_pitch_rotate_copy(sp90, sp90, spD0[0]); ml_vec3f_yaw_rotate_copy(sp90, sp90, spD0[1]); - var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)framebuffer_height * (f32)framebuffer_height)); + var_f22 = 1.0f - (((sp9C[0] * sp9C[0]) + (sp9C[1] * sp9C[1])) / ((f32)gFramebufferHeight * (f32)gFramebufferHeight)); if (var_f22 < 0.0f) { var_f22 = 0.0f; } @@ -181,7 +181,7 @@ void func_80350BFC(void) { if (D_80386170.unk4 != NULL) { D_80386170.unk0 = func_80350780(D_80386170.unk4->unk10); D_80386170.unk8 = assetcache_get(0x882); - ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)framebuffer_width) / 2); + ml_vec3f_set_length(D_80386170.unk4->unk4, (2*(f32)gFramebufferWidth) / 2); D_8038617C.unk0 = 1; D_8038617C.unk1 = 0; } diff --git a/src/core2/code_C9F00.c b/src/core2/code_C9F00.c index 495f1872..0048f6f3 100644 --- a/src/core2/code_C9F00.c +++ b/src/core2/code_C9F00.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern void func_80252CC4(f32[3], f32[3], f32, s32); extern int func_802E805C(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, s32 arg7, s32 arg8); extern int func_802E9118(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, s32 arg6, f32 arg7, s32 arg8, s32 arg9, s32 arg10); extern int func_802E9DD8(BKCollisionList *arg0, BKVertexList *vtxList, f32 arg2[3], f32 arg3[3], f32 arg4, s32 arg5, f32 arg6, s32 arg7, s32 arg8); @@ -345,7 +344,7 @@ void func_803518E8(void){ void func_80351954(Struct68s *arg0){ if(arg0->unk0){ func_8030E394(arg0->unk0); - func_8030DA44(arg0->unk0); + sfxsource_freeSfxsourceByIndex(arg0->unk0); arg0->unk0 = 0; } } diff --git a/src/core2/code_CB050.c b/src/core2/code_CB050.c index 46b92aa2..0caf4bd3 100644 --- a/src/core2/code_CB050.c +++ b/src/core2/code_CB050.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 ml_vec3f_length_sq(f32[3], f32[3]); - typedef struct{ f32 unk0; f32 unk4[3]; diff --git a/src/core2/code_CC1E0.c b/src/core2/code_CC1E0.c index 401f0b44..2099e1f7 100644 --- a/src/core2/code_CC1E0.c +++ b/src/core2/code_CC1E0.c @@ -7,8 +7,6 @@ extern void func_80244D94(f32[3], f32[3], f32[3], u32, f32); -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); - extern f32 func_8033EA14(s32); extern void func_8033EA40(s32, f32); extern void projectile_setSprite(u8, enum asset_e); diff --git a/src/core2/code_D0CA0.c b/src/core2/code_D0CA0.c index 4eac6687..c4ecf1d2 100644 --- a/src/core2/code_D0CA0.c +++ b/src/core2/code_D0CA0.c @@ -2,9 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_8025715C(f32, f32); -extern f32 func_802575BC(f32); -extern void ml_interpolate_vec3f(f32[3], f32[3], f32[3], f32); extern bool func_80320DB0(f32[3], f32, f32[3], u32); /* .h */ @@ -46,7 +43,7 @@ bool func_80357C30(Actor *this) { if (!this->marker->unk14_21) { return TRUE; } - ml_interpolate_vec3f(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05)); + ml_vec3f_interpolate_fast(sp20, local->unk8, local->unk18, func_802575BC(local->unk4 + 0.05)); sp20[1] += 60.0f; return !func_80320DB0(sp20, 50.0f, sp2C, 0); } @@ -221,7 +218,7 @@ void func_80358490(Actor *this) { local = (ActorLocal_core2_D0CA0 *)&this->local; if(local->sfxsourceIdx != 0){ - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); } } @@ -307,7 +304,7 @@ void func_80358684(Actor *this) { if (!subaddie_playerIsWithinSphere(this, 4000)) { if (local->sfxsourceIdx != 0) { - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); local->sfxsourceIdx = 0U; } return; @@ -337,7 +334,7 @@ void func_80358684(Actor *this) { : sp84; } sfxsource_playSfxAtVolume(local->sfxsourceIdx, sp84); - sp78 = 1.0f - ml_distance_vec3f(sp94, this->position) / 2000.0f; + sp78 = 1.0f - ml_vec3f_distance(sp94, this->position) / 2000.0f; sp78 = (0.0f > sp78) ? 0 : sp78; if (sp78 > 0.0f) { sfxsource_setSampleRate(local->sfxsourceIdx, (s32) (sp78 * 10000.0f)); @@ -393,7 +390,7 @@ void func_80358684(Actor *this) { local->unk4 = 1.0f; } sp70 = func_802575BC(local->unk4); - ml_interpolate_vec3f(this->position, local->unk8, local->unk18, sp70); + ml_vec3f_interpolate_fast(this->position, local->unk8, local->unk18, sp70); this->yaw = local->unk14 + (sp70 * (local->unk24 - local->unk14)); if ((skeletalAnim_getAnimId(this->unk148) == 0x23B) && (skeletalAnim_getLoopCount(this->unk148) > 0)) { skeletalAnim_set(this->unk148, 0x23C, 0.1f, 0.45f); @@ -419,7 +416,7 @@ void func_80358684(Actor *this) { sp54[1] = this->position[1]; sp54[2] = this->position[2]; sp54[0] = 0.0f; - if (ml_distance_vec3f(sp60, sp54) < 800.0f) { + if (ml_vec3f_distance(sp60, sp54) < 800.0f) { next_state = 3; } } diff --git a/src/core2/code_DA3A0.c b/src/core2/code_DA3A0.c index abbe6b1d..06ab0cc1 100644 --- a/src/core2/code_DA3A0.c +++ b/src/core2/code_DA3A0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct { u8 *unk0; @@ -97,7 +97,7 @@ void func_8036158C(Actor *this){ if(this->state == 1){ player_getPosition(sp24); actor_collisionOff(this); - if( ml_distance_vec3f(this->position, sp24) < 1000.0f + if( ml_vec3f_distance(this->position, sp24) < 1000.0f && viewport_isPointOutsideFrustum_3f(this->position_x, this->position_y, this->position_z) && ml_timer_update(&local->unk4, sp30) ){ diff --git a/src/core2/code_DAAA0.c b/src/core2/code_DAAA0.c index db7911e0..6d2f0049 100644 --- a/src/core2/code_DAAA0.c +++ b/src/core2/code_DAAA0.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void func_80288C7C(VLA**); extern void func_80288D84(s32, f32, void (*)(s32,s32), s32, s32); diff --git a/src/core2/code_DB010.c b/src/core2/code_DB010.c index cb7019a1..b0b92643 100644 --- a/src/core2/code_DB010.c +++ b/src/core2/code_DB010.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern void func_802EFF5C(ParticleEmitter *, f32, f32, f32); extern void func_802EFF7C(ParticleEmitter *, f32, f32, f32); @@ -62,7 +62,7 @@ void func_80362084(f32 position[3]) { ParticleEmitter *pCtrl; pCtrl = partEmitMgr_newEmitter(1U); - particleEmitter_setSprite(pCtrl, 0x702); + particleEmitter_setSprite(pCtrl, ASSET_702_SPRITE_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 3, 5); particleEmitter_setRGB(pCtrl, D_8037337C); particleEmitter_setAlpha(pCtrl, 0xA0); @@ -86,7 +86,7 @@ void func_8036215C(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(0xFU); - particleEmitter_setSprite(pCtrl, 0x700); + particleEmitter_setSprite(pCtrl, ASSET_700_SPRITE_DUST); particleEmitter_setStartingFrameRange(pCtrl, 3, 4); particleEmitter_setRGB(pCtrl, D_803733E8); particleEmitter_setAlpha(pCtrl, 0x28); @@ -105,7 +105,7 @@ void func_803621F0(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(0x12U); - particleEmitter_setSprite(pCtrl, 0x702); + particleEmitter_setSprite(pCtrl, ASSET_702_SPRITE_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 3, 5); particleEmitter_setAlpha(pCtrl, 0xD2); particleEmitter_setPosition(pCtrl, arg0); @@ -162,7 +162,7 @@ void func_80362404(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1U); - particleEmitter_setSprite(pCtrl, 0x6DD); + particleEmitter_setSprite(pCtrl, ASSET_6DD_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 2, 2); particleEmitter_setPosition(pCtrl, arg0); particleEmitter_setPositionAndVelocityRanges(pCtrl, &D_80373604); @@ -179,7 +179,7 @@ void func_8036247C(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1U); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setRGB(pCtrl, &D_80373634); particleEmitter_setAlpha(pCtrl, 0x64); @@ -196,7 +196,7 @@ void func_80362510(Actor *actor) { f32 sp30[3]; pCtrl = partEmitMgr_newEmitter(0x19U); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 0, 5); particleEmitter_setRGB(pCtrl, D_803736A0); particleEmitter_setAlpha(pCtrl, 0x1E); @@ -224,7 +224,7 @@ void func_80362680(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1U); - particleEmitter_setSprite(pCtrl, 0x45A); + particleEmitter_setSprite(pCtrl, ASSET_45A_SPRITE_GREEN_GLOW); particleEmitter_setStartingFrameRange(pCtrl, 2, 2); particleEmitter_setPosition(pCtrl, arg0); particleEmitter_setPositionAndVelocityRanges(pCtrl, &D_8037370C); @@ -241,7 +241,7 @@ void func_803626F8(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(1U); - particleEmitter_setSprite(pCtrl, 0x713); + particleEmitter_setSprite(pCtrl, ASSET_713_SPRITE_SPARKLE_YELLOW); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setPosition(pCtrl, arg0); particleEmitter_setVelocityAccelerationAndPositionRanges(pCtrl, &D_8037376C); @@ -259,7 +259,7 @@ void func_80362770(f32 arg0[3]) { ParticleEmitter *pCtrl = partEmitMgr_newEmitter(0x10U); - particleEmitter_setSprite(pCtrl, 0x714); + particleEmitter_setSprite(pCtrl, ASSET_714_SPRITE_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 7, 8); particleEmitter_setRGB(pCtrl, &D_803737B4); particleEmitter_setPosition(pCtrl, arg0); diff --git a/src/core2/code_EE40.c b/src/core2/code_EE40.c index b9b06f9d..2391341e 100644 --- a/src/core2/code_EE40.c +++ b/src/core2/code_EE40.c @@ -33,7 +33,7 @@ void func_80295DD0(void){ void func_80295E74(void){ f32 sp1C[3]; _player_getPosition(sp1C); - if(!func_802584FC(sp1C, D_8037C3C0.unkC, D_8037C3C0.unk0)){ + if(!ml_vec3f_inside_box_vec3f(sp1C, D_8037C3C0.unkC, D_8037C3C0.unk0)){ if(D_8037C3C0.unk18 == 0){ D_8037C3C0.unk18 = 1; func_8029B6F0(); diff --git a/src/core2/code_EF50.c b/src/core2/code_EF50.c index 9bd09b71..0f434da3 100644 --- a/src/core2/code_EF50.c +++ b/src/core2/code_EF50.c @@ -4,7 +4,6 @@ #include "core2/ba/physics.h" -extern void func_80256E24(f32[3], f32, f32, f32, f32, f32); extern f32 player_getYaw(void); extern void chJigsawDance_setState(Actor *, s32); extern void bsjig_setJiggyMarkerPtr(ActorMarker *); diff --git a/src/core2/fx/airscore.c b/src/core2/fx/airscore.c index 7efec759..3ccdc443 100644 --- a/src/core2/fx/airscore.c +++ b/src/core2/fx/airscore.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #define AIRSCORE_COUNT (6) @@ -86,8 +86,8 @@ void fxairscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, 0x78); } x = func_802FB0E4(arg1); - x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) framebuffer_width / 2); - y = ((78 + (i_part * 15.5)) - ((f32) framebuffer_height / 2)); + x = ((-40 + x) + D_80381F68[var_s6]) - ((f32) gFramebufferWidth / 2); + y = ((78 + (i_part * 15.5)) - ((f32) gFramebufferHeight / 2)); //stagger x position x = (i_part & 1) ? x + 5.0f : x - 5.0f; diff --git a/src/core2/fx/common2score.c b/src/core2/fx/common2score.c index c5694113..6fd22108 100644 --- a/src/core2/fx/common2score.c +++ b/src/core2/fx/common2score.c @@ -1,16 +1,13 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include f32 time_getDelta(void); f32 func_802FB0DC(struct8s *); f32 func_802FB0E4(struct8s *); -extern s32 framebuffer_width; //framebuffer_w -extern s32 framebuffer_height; //framebuffer_h - Gfx D_80369920[] = { gsDPPipeSync(), @@ -154,8 +151,8 @@ void func_802FD360(struct8s *arg0, Gfx **gfx, Mtx **mtx, Vtx **vtx){ tmp_f26 = (arg0->unk20 == ITEM_0_HOURGLASS_TIMER && texture_width == 0x10) ? 1.0f : 0.0f; for(tmp_s4 = 0; tmp_s4 < 2; tmp_s4++){//L802FD528 for(tmp_s2 = 0; tmp_s2 < 2; tmp_s2++){// - (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)framebuffer_width/2) + arg0->unk38)) + tmp_f26) * 4.0f; - (*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)framebuffer_height/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; + (*vtx)->v.ob[0] = ((func_802FB0DC(arg0) + (((texture_width*arg0->unk40*tmp_s2 - texture_width*arg0->unk40/2) - (f32)gFramebufferWidth/2) + arg0->unk38)) + tmp_f26) * 4.0f; + (*vtx)->v.ob[1] = ((((texture_height*arg0->unk40/2 - texture_height*arg0->unk40*tmp_s4) + (f32)gFramebufferHeight/2) - arg0->unk3C) - func_802FB0E4(arg0)*arg0->unk4C)*4.0f; (*vtx)->v.ob[2] = -0x14; (*vtx)->v.tc[0] = ((texture_width -1) * tmp_s2) << 6; (*vtx)->v.tc[1] = ((texture_height -1) * tmp_s4) << 6; diff --git a/src/core2/fx/common3score.c b/src/core2/fx/common3score.c index ec06491e..bf18ce56 100644 --- a/src/core2/fx/common3score.c +++ b/src/core2/fx/common3score.c @@ -1,13 +1,12 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 vtxList_getGlobalNorm(BKVertexList *); extern void func_80253208(Gfx **gdl, s32 x, s32 y, s32 w, s32 h, void *color_buffer); -extern s16 D_803A5D00[2][0xF660]; extern f32 func_802FB0E4(struct8s*); typedef struct { @@ -210,7 +209,7 @@ void fxcommon3score_draw(enum item_e item_id, void *arg1, Gfx **gfx, Mtx **mtx, if(a1->unk6C == 0.0f){ a1->unk6C = 1.1*(vtxList_getGlobalNorm(model_getVtxList(a1->model)) * a1->unk3C); } - func_80253208(gfx, a1->unk30 - a1->unk6C, sp40 - a1->unk6C, 2*a1->unk6C, 2*a1->unk6C, D_803A5D00[getActiveFramebuffer()]); + func_80253208(gfx, a1->unk30 - a1->unk6C, sp40 - a1->unk6C, 2*a1->unk6C, 2*a1->unk6C, gFramebuffers[getActiveFramebuffer()]); if(a1->anim_ctrl != NULL){ animctrl_drawSetup(a1->anim_ctrl, sp5C, 1); } diff --git a/src/core2/fx/healthscore.c b/src/core2/fx/healthscore.c index 65d16d5b..0a693ded 100644 --- a/src/core2/fx/healthscore.c +++ b/src/core2/fx/healthscore.c @@ -1,14 +1,11 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 func_802FB0E4(struct8s*); -extern s32 framebuffer_width; -extern s32 framebuffer_height; - /* .data */ BKSprite * gSpriteHealth = NULL; BKSprite * gSpriteRedHealth = NULL; @@ -112,8 +109,8 @@ void fxhealthscore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mt gDPSetPrimColor((*gfx)++, 0, 0, 0xFF, 0xFF, 0xFF, 0x78); } - f20 = 96.0f - (f32) framebuffer_width / 2 + (i * 13); - f14 = (f32) framebuffer_height / 2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f; + f20 = 96.0f - (f32) gFramebufferWidth / 2 + (i * 13); + f14 = (f32) gFramebufferHeight / 2 - func_802FB0E4(arg1) - D_80381F08[s6] - -48.0f; f14 = (i & 1) ? f14 + 5.75 : f14 - 5.75; gSPVertex((*gfx)++, *vtx, 4, 0); diff --git a/src/core2/fx/honeycarrierscore.c b/src/core2/fx/honeycarrierscore.c index 3eae4891..4778c2cb 100644 --- a/src/core2/fx/honeycarrierscore.c +++ b/src/core2/fx/honeycarrierscore.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #define _76D90_MAX(s,t) ((s < t)? t : s) #define _76D90_MIN(s,t) ((s > t)? t : s) @@ -141,8 +141,8 @@ void fxhoneycarrierscore_draw(s32 arg0, struct8s *arg1, Gfx **arg2, Mtx **arg3, } } } - sp128 = (244.0f - ((f32) framebuffer_width / 2)); - sp124 = func_802FB0E4(arg1) + ((f32) framebuffer_height / 2) - 246.0f; + sp128 = (244.0f - ((f32) gFramebufferWidth / 2)); + sp124 = func_802FB0E4(arg1) + ((f32) gFramebufferHeight / 2) - 246.0f; guTranslate(*arg3, sp128 * 4.0f, sp124 * 4.0f, 0.0f); gSPMatrix((*arg2)++, OS_K0_TO_PHYSICAL((*arg3)++), G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_MODELVIEW); guRotate(*arg3, func_802FDE60(D_803815D8 + D_803815DC), 0.0f, 0.0f, 1.0f); diff --git a/src/core2/fx/jinjoscore.c b/src/core2/fx/jinjoscore.c index fca34533..5130cb97 100644 --- a/src/core2/fx/jinjoscore.c +++ b/src/core2/fx/jinjoscore.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 func_802FB0E4(struct8s *); @@ -176,8 +176,8 @@ void fxjinjoscore_draw(s32 arg0, struct8s *arg1, Gfx **gfx, Mtx **mtx, Vtx **vtx // If the jinjo is collected then it's drawn fully opaque, otherwise it's drawn with partial alpha gDPSetPrimColor((*gfx)++, 0, 0, 0x00, 0x00, 0x00, jinjo_collected ? 0xFF : 0x6E); } - center_x = pos_x - (f32) framebuffer_width / 2 + x_offset; - center_y = (f32) framebuffer_height / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; + center_x = pos_x - (f32) gFramebufferWidth / 2 + x_offset; + center_y = (f32) gFramebufferHeight / 2 + func_802FB0E4(arg1) - 266.0f + 40.0f + y_offset - D_80381E78[jinjo_id]; gSPVertex((*gfx)++, *vtx, 4, 0); // Set up the positions of the four vertices for(i = 0; i < 2; i++){ diff --git a/src/core2/fx/lifescore.c b/src/core2/fx/lifescore.c index e479535c..5b00bebd 100644 --- a/src/core2/fx/lifescore.c +++ b/src/core2/fx/lifescore.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern f32 func_802FB0E4(struct8s*); @@ -102,8 +102,8 @@ void fxlifescore_draw(enum item_e item_id, struct8s *arg1, Gfx **gfx, Mtx **mtx, sp104 = sp104 + 4; } - var_s5 = (40.0f - ((f32) framebuffer_width / 2)) + spE0; - var_s4 = (((((f32) framebuffer_height / 2) - func_802FB0E4(arg1)) - -16.0f) - spDC); + var_s5 = (40.0f - ((f32) gFramebufferWidth / 2)) + spE0; + var_s4 = (((((f32) gFramebufferHeight / 2) - func_802FB0E4(arg1)) - -16.0f) - spDC); for(var_v1 = 0; var_v1 < 2; var_v1++){ for(var_v0 = 0; var_v0 < 2; var_v0++){ (*vtx)->v.ob[0] = (s16) (s32) (((((f32) spF0 * D_80381EB8 * (f32) var_v0) - (((f32) spE8 * D_80381EB8) / 2)) + var_s5) * 4.0f); diff --git a/src/core2/gc/bound.c b/src/core2/gc/bound.c index 437331c7..1860a233 100644 --- a/src/core2/gc/bound.c +++ b/src/core2/gc/bound.c @@ -26,7 +26,7 @@ u8 _gcbound_blue; //D_80380902 void _gcbound_draw(Gfx** dl, s32 a, s32 r, s32 g, s32 b){ gSPDisplayList((*dl)++, &D_803688E8); gDPSetFogColor((*dl)++, r, g, b, a); - gSPTextureRectangle((*dl)++, 0, 0, (framebuffer_width-1)<<2, (framebuffer_height-1)<<2, 0, 0, 0, 0x100, 0x100); + gSPTextureRectangle((*dl)++, 0, 0, (gFramebufferWidth-1)<<2, (gFramebufferHeight-1)<<2, 0, 0, 0, 0x100, 0x100); } void gcbound_draw(Gfx** dl){ diff --git a/src/core2/gc/dialog.c b/src/core2/gc/dialog.c index 07f80bf0..c70935d3 100644 --- a/src/core2/gc/dialog.c +++ b/src/core2/gc/dialog.c @@ -1,4 +1,5 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" @@ -373,7 +374,7 @@ void gcdialog_update(void) { ret = -1; if (g_Dialog.u8.unk128_31 & 0x80) { - func_8024E5A8(0, controller_face_buttons); + pfsManager_getFirstControllerFaceButtonState(0, controller_face_buttons); func_8024E640(0, controller_side_buttons); } else { controller_copyFaceButtons(0, controller_face_buttons); diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 1115e5a4..79f02fa0 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -1,8 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include "ml/mtx.h" -#include #include "zoombox.h" @@ -31,9 +30,6 @@ f32 func_8024DE1C(f32, f32, f32 *, f32 *); void func_80310D2C(void); s32 level_get(void); -void func_8024E6E0(s32, void *); -void func_8024E60C(s32, void *); -void controller_getJoystick(s32, void *); s32 getGameMode(void); void func_802DC5B8(void); @@ -764,12 +760,12 @@ void gcpausemenu_init(void) { func_80311604(); gcpausemenu_zoomboxes_initMainMenu(); D_80383010.joystick_sprite = assetcache_get(0x7EB); - D_80383010.joystick_frame_count = spriteGetFrameCount(D_80383010.joystick_sprite); + D_80383010.joystick_frame_count = sprite_getFrameCount(D_80383010.joystick_sprite); D_80383010.left_joystick_alpha = temp_v1 = D_80383010.right_joystick_alpha = 0; D_80383010.joystick_frame = D_80383010.unk3_4 = temp_v1; D_80383010.b_button_sprite = assetcache_get(0x7ED); - D_80383010.b_button_frame_count = spriteGetFrameCount(D_80383010.b_button_sprite); + D_80383010.b_button_frame_count = sprite_getFrameCount(D_80383010.b_button_sprite); D_80383010.b_button_frame = D_80383010.unk3_0 = D_80383010.b_button_alpha = 0; D_80383010.page_cnt = gcpausemenu_initLargestPageIndex(); D_80383010.sns_alpha = D_80383010.sns_visible = D_80383010.unk70_31 = D_80383010.unk70_30 = 0; @@ -1306,7 +1302,7 @@ void __gcpausemenu_drawSprite(Gfx **gdl, Mtx **mptr, Vtx **vptr, BKSprite *sprit f32 sp2C; f32 sp28; - _frame = spriteGetFramePtr(sprite, frame); + _frame = sprite_getFramePtr(sprite, frame); sp2C = _frame->w; sp28 = _frame->h; func_803382E4(5); @@ -1337,7 +1333,7 @@ void gcpausemenu_drawSprite(Gfx **gdl, Mtx **mptr, Vtx **vptr, BKSprite *sprite, BKSpriteFrame *_frame; s32 w; s32 h; - _frame = spriteGetFramePtr(sprite, frame); + _frame = sprite_getFramePtr(sprite, frame); w = ((mirror) ? -1 : 1) * _frame->w; h = _frame->h; __gcpausemenu_drawSprite(gdl, mptr, vptr, sprite, frame, (x - w * 0.5), (y - h * 0.5), w, h, a); @@ -1376,7 +1372,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { } gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, 30.0f, 196.0f, 1, (s32) D_80383010.left_joystick_alpha); - gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32)(framebuffer_width - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha); + gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.joystick_sprite, D_80383010.joystick_frame, (f32)(gFramebufferWidth - 0x1E), 196.0f, 0, (s32) D_80383010.right_joystick_alpha); var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1c) >> 0x1f); //left_joystick_visible if (var_a0 != 0) { if (D_80383010.left_joystick_alpha < 0xFF) { @@ -1399,7 +1395,7 @@ void gcpausemenu_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { D_80383010.right_joystick_alpha = (D_80383010.right_joystick_alpha - 0xC > 0) ? D_80383010.right_joystick_alpha - 0xC : 0; } } - gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, framebuffer_width * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha); + gcpausemenu_drawSprite(gfx, mtx, vtx, D_80383010.b_button_sprite, (s32) D_80383010.b_button_frame, gFramebufferWidth * 0.5, 196.0f, 0, (s32) D_80383010.b_button_alpha); var_a0 = ((*((u32 * ) & D_80383010.state) << 0x1e) >> 0x1f);//b_button_visible if (var_a0 != 0) { if (D_80383010.b_button_alpha < 0xFF) { diff --git a/src/core2/gc/sky.c b/src/core2/gc/sky.c index 3d8a799a..9dea25a6 100644 --- a/src/core2/gc/sky.c +++ b/src/core2/gc/sky.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include typedef struct { s16 model_id; @@ -75,7 +75,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ viewport_setNearAndFar(5.0f, 15000.0f); if(gcSky.model_bins[0]){ - drawRectangle2D(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height,0, 0, 0); //fill screen with black + drawRectangle2D(gfx, 0, 0, (s32)(f32) gFramebufferWidth, (s32)(f32)gFramebufferHeight,0, 0, 0); //fill screen with black viewport_setRenderViewportAndPerspectiveMatrix(gfx, mtx); viewport_getPosition_vec3f(position); for(i = 0; i < 3; i++){ @@ -89,7 +89,7 @@ void sky_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx){ } } else{//L8030B200 - drawRectangle2D(gfx, 0, 0, (s32)(f32) framebuffer_width, (s32)(f32)framebuffer_height, 0, 0, 0); + drawRectangle2D(gfx, 0, 0, (s32)(f32) gFramebufferWidth, (s32)(f32)gFramebufferHeight, 0, 0, 0); }//L8030B254 } diff --git a/src/core2/gc/transition.c b/src/core2/gc/transition.c index af354f28..8d5db1ca 100644 --- a/src/core2/gc/transition.c +++ b/src/core2/gc/transition.c @@ -1,13 +1,11 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" - -#include #include "gc/gctransition.h" void animctrl_setAnimTimer(AnimCtrl*, f32); void func_8025AC20(s32, s32, s32, f32, char*, s32); -f32 func_80257618(void); typedef enum { TRANSITION_ID_1_BLACK_IN = 1, @@ -321,7 +319,7 @@ void gctransition_draw(Gfx **gdl, Mtx **mptr, Vtx **vptr){ case 0xA: //zoom out only vp_rotation[2] = 0.0f; - scale = (1.0f - func_80257618())*s_current_transition.transistion_info->scale + 0.1; + scale = (1.0f - func_80257618(percentage))*s_current_transition.transistion_info->scale + 0.1; break; } if(!(s_current_transition.substate < 3) || s_current_transition.transistion_info->uid != 0x11){ diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 71863daa..f64e2b44 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -1,16 +1,12 @@ #include +#include "core1/core1.h" +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "zoombox.h" -#include "ml/mtx.h" -#include -void func_80252330(f32, f32, f32); extern f32 func_8033DDB8(void); -extern void func_8024E60C(s32, void *); -extern void func_8024E640(s32, void *); -extern void func_8024E5A8(s32, void *); extern void func_80344090(BKSpriteDisplayData *self, s32 frame, Gfx **gfx); BKSprite *func_8033B6C4(enum asset_e sprite_id, BKSpriteDisplayData **arg1); @@ -429,7 +425,7 @@ s32 D_8036D924[] = { 70, 35, 18, 9, 4, 2, 1}; /* .bss */ char D_803830B0[0x30]; -void func_8030DA44(u8); +void sfxsource_freeSfxsourceByIndex(u8); void func_80338338(s32, s32, s32); void func_803382FC(u8); @@ -443,7 +439,7 @@ void func_80315200(GcZoombox *this){ }else{ for(s1 =0; s1 < 5; s1++){ if(this->unk108[s1]){ - func_8030DA44(this->unk108[s1]); + sfxsource_freeSfxsourceByIndex(this->unk108[s1]); this->sfx_count--; } } @@ -863,7 +859,7 @@ void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BK } sp2C[1] = this->unk172 + ((f32) arg4 * this->unk198); sp2C[2] = -10.0f; - func_80252330((sp2C[0] * 4.0f) - ((f32)framebuffer_width * 2), ((f32)framebuffer_height * 2) - (sp2C[1] * 4.0f), sp2C[2]); + func_80252330((sp2C[0] * 4.0f) - ((f32)gFramebufferWidth * 2), ((f32)gFramebufferHeight * 2) - (sp2C[1] * 4.0f), sp2C[2]); temp_f12 = (f32) ((f64) this->unk198 * 0.8); mlMtxScale_xyz(temp_f12, temp_f12, 1.0f); mlMtxApply(*mtx); @@ -885,7 +881,7 @@ void func_80316764(GcZoombox *this, s32 arg1) { func_8024E60C(0, sp2C); phi_f0 = time_getDelta(); } else { - func_8024E5A8(0, sp38); + pfsManager_getFirstControllerFaceButtonState(0, sp38); func_8024E640(0, sp2C); phi_f0 = func_8033DDB8(); } @@ -1072,7 +1068,7 @@ void gczoombox_update(GcZoombox *this){ tmp_f0 = time_getDelta(); } else{ - func_8024E5A8(0, sp58); + pfsManager_getFirstControllerFaceButtonState(0, sp58); func_8024E640(0, sp4C); tmp_f0 = func_8033DDB8(); } @@ -1345,7 +1341,7 @@ void __gczoombox_load_sprite(GcZoombox *this, GcZoomboxSprite portrait_id){ this->frame_count = this->unkF8->frameCnt; func_803382E4(-1); - func_80338308(func_802510A0(this->unkF8), func_802510A8(this->unkF8)); + func_80338308(sprite_getUnk8(this->unkF8), sprite_getUnkA(this->unkF8)); } void __gczoombox_load_sfx(GcZoombox *this, GcZoomboxSprite portrait_id){ @@ -1404,8 +1400,8 @@ GcZoombox *gczoombox_new(s32 y, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3, this->unk1A4_24 = arg3; if(this->unk1A4_24){ this->unk16A = 45; - this->unk174 = framebuffer_width - 0x25; - this->unk170 = framebuffer_width + 0x66; + this->unk174 = gFramebufferWidth - 0x25; + this->unk170 = gFramebufferWidth + 0x66; }else{ this->unk16A = 71; this->unk174 = 0x25; @@ -1606,9 +1602,9 @@ void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { if (this != NULL) { if (this->unk1A4_24) { - this->unk174 = framebuffer_width - arg1; + this->unk174 = gFramebufferWidth - arg1; this->unk16A = arg1 + (8.0f * arg2); - this->unk170 = (framebuffer_width - arg1) + 0x8B; + this->unk170 = (gFramebufferWidth - arg1) + 0x8B; } else { this->unk174 = arg1; phi_v0 = arg4 ? 0x28 : 0x22; diff --git a/src/core2/modelRender.c b/src/core2/modelRender.c index e324e848..ffed8de8 100644 --- a/src/core2/modelRender.c +++ b/src/core2/modelRender.c @@ -1,18 +1,16 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/modelRender.h" #include "animation.h" -#include "ml/mtx.h" #define ARRAYLEN(x) (sizeof(x) / sizeof((x)[0])) extern bool func_802ED420(BKModelUnk20List *arg0, u8 *arg1, u32 arg2); extern void func_802ED52C(BKModelUnk20List *, f32[3], f32); -extern void func_80252AF0(f32[3], f32[3], f32[3], f32, f32[3]); extern void mlMtxRotatePYR(f32, f32, f32); extern void assetCache_free(BKModelBin *); extern s32 func_8024DB50(f32[3], f32); diff --git a/src/core2/nc/cameranodelist.c b/src/core2/nc/cameranodelist.c index 03b6e2ee..9202d4f0 100644 --- a/src/core2/nc/cameranodelist.c +++ b/src/core2/nc/cameranodelist.c @@ -3,177 +3,167 @@ #include "variables.h" #include +#include #define NC_CAMERA_NODE_LIST_CAPACITY 0x46 -typedef struct { - s32 type:24; - s32 valid:8; - s32 data_ptr; -} Struct_Core2_32DB0_0s; - -void __ncCameraNodeList_removeNode(s32 arg0); -s32 ncCameraNodeList_nodeIsValid(s32 arg0); -void func_802B9EBC(s32 arg0, s32 arg1); +static void __ncCameraNodeList_removeNode(int camera_node_index); +s32 ncCameraNodeList_nodeIsValid(int camera_node_index); +static void __ncCameraNodeList_setCameraNodeType(int camera_node_index, s32 type); /* .bss */ -Struct_Core2_32DB0_0s ncCameraNodeList[NC_CAMERA_NODE_LIST_CAPACITY]; +CameraNode sNcCameraNodeList[NC_CAMERA_NODE_LIST_CAPACITY]; /* .code */ -void ncCameraNodeList_init(void){ +void ncCameraNodeList_init() { int i; - for(i = 0; i< NC_CAMERA_NODE_LIST_CAPACITY; i++){ - ncCameraNodeList[i].valid = FALSE; + for(i = 0; i< NC_CAMERA_NODE_LIST_CAPACITY; i++) { + sNcCameraNodeList[i].valid = FALSE; } } -void ncCameraNodeList_free(void){ +void ncCameraNodeList_free() { int i; - for(i=0; i< NC_CAMERA_NODE_LIST_CAPACITY; i++){ + for(i=0; i< NC_CAMERA_NODE_LIST_CAPACITY; i++) { if(ncCameraNodeList_nodeIsValid(i)) __ncCameraNodeList_removeNode(i); } } -void __ncCameraNodeList_addNode(s32 camera_node_index){ - ncCameraNodeList[camera_node_index].valid = TRUE; - ncCameraNodeList[camera_node_index].type = 0; +static void __ncCameraNodeList_addNode(int camera_node_index) { + sNcCameraNodeList[camera_node_index].valid = TRUE; + sNcCameraNodeList[camera_node_index].type = 0; } -void __ncCameraNodeList_removeNode(s32 camera_node_index){ - func_802B9EBC(camera_node_index, 0); - ncCameraNodeList[camera_node_index].valid = 0; +static void __ncCameraNodeList_removeNode(int camera_node_index) { + __ncCameraNodeList_setCameraNodeType(camera_node_index, 0); + sNcCameraNodeList[camera_node_index].valid = 0; } -//ncCameraNodeList_getdata_ptr_type4 -s32 func_802B9E34(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].data_ptr; +CameraNodeType4* ncCameraNodeList_getCameraNodeType4(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].data_ptr; } -//ncCameraNodeList_getdata_ptr_type3 -s32 func_802B9E48(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].data_ptr; +CameraNodeType3* ncCameraNodeList_getCameraNodeType3(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].data_ptr; } -//ncCameraNodeList_getdata_ptr_type1 -s32 func_802B9E5C(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].data_ptr; +CameraNodeType1* ncCameraNodeList_getCameraNodeType1(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].data_ptr; } -//ncCameraNodeList_getdata_ptr_type2 -s32 func_802B9E70(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].data_ptr; +CameraNodeType2* ncCameraNodeList_getCameraNodeType2(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].data_ptr; } -s32 ncCameraNodeList_capacity(void){ +s32 __ncCameraNodeList_capacity() { return NC_CAMERA_NODE_LIST_CAPACITY; } -s32 ncCameraNodeList_getNodeType(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].type; +s32 ncCameraNodeList_getNodeType(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].type; } -s32 ncCameraNodeList_nodeIsValid(s32 camera_node_index){ - return ncCameraNodeList[camera_node_index].valid; +s32 ncCameraNodeList_nodeIsValid(int camera_node_index) { + return sNcCameraNodeList[camera_node_index].valid; } -void func_802B9EBC(s32 camera_node_index, s32 arg1){ - if(arg1 == ncCameraNodeList[camera_node_index].type) +static void __ncCameraNodeList_setCameraNodeType(int camera_node_index, s32 type) { + if(type == sNcCameraNodeList[camera_node_index].type) return; - //remove old cameraNodedata_ptr - switch(ncCameraNodeList[camera_node_index].type){ - case 4:// L802B9F08 - func_802BA214(ncCameraNodeList[camera_node_index].data_ptr); + + switch(sNcCameraNodeList[camera_node_index].type) { + case 4: + cameraNodeType4_free(sNcCameraNodeList[camera_node_index].data_ptr); break; - case 3:// L802B9F18 - func_802BA398(ncCameraNodeList[camera_node_index].data_ptr); + case 3: + cameraNodeType3_free(sNcCameraNodeList[camera_node_index].data_ptr); break; - case 1:// L802B9F28 - func_802BA76C(ncCameraNodeList[camera_node_index].data_ptr); + case 1: + cameraNodeType1_free(sNcCameraNodeList[camera_node_index].data_ptr); break; - case 2:// L802B9F38 - ncCameraNodeType2_free(ncCameraNodeList[camera_node_index].data_ptr); + case 2: + cameraNodeType2_free(sNcCameraNodeList[camera_node_index].data_ptr); break; - case 0:// L802B9F40 + case 0: break; } - ncCameraNodeList[camera_node_index].type = arg1; + sNcCameraNodeList[camera_node_index].type = type; - //init new camera node data_ptr - switch (arg1) + switch (type) { - case 4:// L802B9F80 - ncCameraNodeList[camera_node_index].data_ptr = func_802BA1E0(); - break; - case 3:// L802B9F90 - ncCameraNodeList[camera_node_index].data_ptr = func_802BA2F4(); - break; - case 1:// L802B9FA0 - ncCameraNodeList[camera_node_index].data_ptr = func_802BA6D4(); - break; - case 2:// L802B9FB0 - ncCameraNodeList[camera_node_index].data_ptr = ncCameraNodeType2_new(); - break; - case 0:// L802B9FBC - break; + case 4: + sNcCameraNodeList[camera_node_index].data_ptr = cameraNodeType4_init(); + break; + case 3: + sNcCameraNodeList[camera_node_index].data_ptr = cameraNodeType3_init(); + break; + case 1: + sNcCameraNodeList[camera_node_index].data_ptr = cameraNodeType1_init(); + break; + case 2: + sNcCameraNodeList[camera_node_index].data_ptr = cameraNodeType2_init(); + break; + case 0: + break; } } -void __ncCameraNodeList_nodeFromFile(File *file_ptr, s32 arg1){ - u8 sp27; - __ncCameraNodeList_addNode(arg1); - file_getByte_ifExpected(file_ptr, 2, &sp27); - func_802B9EBC(arg1, sp27); - switch(ncCameraNodeList_getNodeType(arg1)){ - case 4:// L802BA030 - func_802BA244(file_ptr, func_802B9E34(arg1)); +void __ncCameraNodeList_nodeFromFile(File *file_ptr, int camera_node_index) { + u8 camera_node_type; + __ncCameraNodeList_addNode(camera_node_index); + file_getByte_ifExpected(file_ptr, 2, &camera_node_type); + __ncCameraNodeList_setCameraNodeType(camera_node_index, camera_node_type); + switch(ncCameraNodeList_getNodeType(camera_node_index)) { + case 4: + cameraNodeType4_fromFile(file_ptr, ncCameraNodeList_getCameraNodeType4(camera_node_index)); break; - case 3:// L802BA04C - func_802BA550(file_ptr, func_802B9E48(arg1)); + case 3: + cameraNodeType3_fromFile(file_ptr, ncCameraNodeList_getCameraNodeType3(camera_node_index)); break; - case 1:// L802BA068 - func_802BA93C(file_ptr, func_802B9E5C(arg1)); + case 1: + cameraNodeType1_fromFile(file_ptr, ncCameraNodeList_getCameraNodeType1(camera_node_index)); break; - case 2:// L802BA084 - ncCameraNodeType2_fromFile(file_ptr, func_802B9E70(arg1)); + case 2: + cameraNodeType2_fromFile(file_ptr, ncCameraNodeList_getCameraNodeType2(camera_node_index)); break; - case 0:// L802BA098 + case 0: break; } } -void ncCameraNodeList_fromFile(File *file_ptr){ - s16 sp26; +void ncCameraNodeList_fromFile(File *file_ptr) { + s16 camera_node_index; ncCameraNodeList_free(); ncCameraNodeList_init(); - while(!file_isNextByteExpected(file_ptr, 0)){ - if(file_getShort_ifExpected(file_ptr, 1, &sp26)) - __ncCameraNodeList_nodeFromFile(file_ptr, sp26); + while(!file_isNextByteExpected(file_ptr, 0)) { + if(file_getShort_ifExpected(file_ptr, 1, &camera_node_index)) + __ncCameraNodeList_nodeFromFile(file_ptr, camera_node_index); } } -void ncCameraNodeList_defrag(void){ +void ncCameraNodeList_defrag() { int i; - for(i = 0; i< NC_CAMERA_NODE_LIST_CAPACITY; i++){ - if(ncCameraNodeList[i].valid){ - switch(ncCameraNodeList[i].type){ - case 4:// L802BA17C - ncCameraNodeList[i].data_ptr = defrag(ncCameraNodeList[i].data_ptr); + for(i = 0; i < NC_CAMERA_NODE_LIST_CAPACITY; i++) { + if(sNcCameraNodeList[i].valid) { + switch(sNcCameraNodeList[i].type) { + case 4: + sNcCameraNodeList[i].data_ptr = defrag(sNcCameraNodeList[i].data_ptr); break; - case 3:// L802BA18C - ncCameraNodeList[i].data_ptr = defrag(ncCameraNodeList[i].data_ptr); + case 3: + sNcCameraNodeList[i].data_ptr = defrag(sNcCameraNodeList[i].data_ptr); break; - case 1:// L802BA19C - ncCameraNodeList[i].data_ptr = defrag(ncCameraNodeList[i].data_ptr); + case 1: + sNcCameraNodeList[i].data_ptr = defrag(sNcCameraNodeList[i].data_ptr); break; - case 2:// L802BA1AC - ncCameraNodeList[i].data_ptr = defrag(ncCameraNodeList[i].data_ptr); + case 2: + sNcCameraNodeList[i].data_ptr = defrag(sNcCameraNodeList[i].data_ptr); break; - case 0:// L802BA1B8 + case 0: break; } } diff --git a/src/core2/nc/dynamicCam1.c b/src/core2/nc/dynamicCam1.c index 1714290e..fd28a665 100644 --- a/src/core2/nc/dynamicCam1.c +++ b/src/core2/nc/dynamicCam1.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_80259198(f32, f32); extern f32 func_802BD51C(void); extern f32 player_getYaw(void); extern void func_802BD870(f32, f32, f32, f32); diff --git a/src/core2/nc/dynamicCam11.c b/src/core2/nc/dynamicCam11.c index ac325890..9b78cf65 100644 --- a/src/core2/nc/dynamicCam11.c +++ b/src/core2/nc/dynamicCam11.c @@ -2,8 +2,8 @@ #include "functions.h" #include "variables.h" -extern f32 func_802BA40C(void *); -extern f32 func_802BA420(void *); +extern f32 cameraNodeType3_getFarDistance(void *); +extern f32 cameraNodeType3_getCloseDistance(void *); /* .bss */ f32 D_8037DAC0[3]; @@ -74,17 +74,17 @@ void func_802BF798(void) { f32 sp28; s32 temp_v0; - temp_v0 = func_802B9E48(); - D_8037DAE4 = func_802BA4F0(temp_v0); - func_802BA3B8(temp_v0, &D_8037DAD0); - func_802BA434(temp_v0, &D_8037DAC0); - func_802BA480(temp_v0, &sp2C, &sp28); + temp_v0 = ncCameraNodeList_getCameraNodeType3(); + D_8037DAE4 = code33310_func_802BA4F0(temp_v0); + cameraNodeType3_getPositionWithPitchYawRoll(temp_v0, &D_8037DAD0); + cameraNodeType3_getPosition(temp_v0, &D_8037DAC0); + cameraNodeType3_getHorizontalAndVerticalSpeed(temp_v0, &sp2C, &sp28); func_802BE230(sp2C, sp28); - func_802BA4A8(temp_v0, &sp2C, &sp28); + cameraNodeType3_getRotationAndAccelaration(temp_v0, &sp2C, &sp28); func_802BE244(sp2C, sp28); D_8037DAE8 = sp2C; D_8037DAEC = sp28; - D_8037DAE0 = func_802BA420(temp_v0); - D_8037DADC = func_802BA40C(temp_v0); + D_8037DAE0 = cameraNodeType3_getCloseDistance(temp_v0); + D_8037DADC = cameraNodeType3_getFarDistance(temp_v0); D_8037DAE5 = 0; } diff --git a/src/core2/nc/dynamicCam12.c b/src/core2/nc/dynamicCam12.c index 227ca436..86a86b4e 100644 --- a/src/core2/nc/dynamicCam12.c +++ b/src/core2/nc/dynamicCam12.c @@ -3,7 +3,6 @@ #include "variables.h" extern f32 func_802453DC(struct56s *, f32, f32[3], s32); -extern f32 func_80259198(f32, f32); extern f32 func_802BD51C(void); extern f32 player_getYaw(void); extern void func_802BE244(f32, f32); @@ -101,7 +100,7 @@ f32 func_802C1030(struct56s *arg0, f32 arg1[3], f32 arg2[3]) { ml_vec3f_set_length_copy(sp30, sp30, 400.0f); ml_vec3f_add(sp3C, sp30, sp48); func_80259554(sp54, sp48, sp3C, arg1); - return ml_distance_vec3f(sp54, arg2); + return ml_vec3f_distance(sp54, arg2); } else{ func_80323240(arg0, sp2C, sp54); @@ -140,8 +139,8 @@ s32 func_802C11C8(f32 arg0[3]) { sp3C = func_80323F74(sp2C, D_8037DBE0.unk8, -1000.0f); func_80323240(sp2C, sp40, sp64); func_80323240(sp2C, sp3C, sp58); - sp48 = ml_distance_vec3f(sp4C, sp64); - sp44 = ml_distance_vec3f(sp4C, sp58); + sp48 = ml_vec3f_distance(sp4C, sp64); + sp44 = ml_vec3f_distance(sp4C, sp58); sp38 = 0.0f; sp38 = 0.0f; if (mlAbsF(sp48 - sp44) > 3.0f) { @@ -231,7 +230,7 @@ void func_802C16CC(s32 arg0) { if(sp38 != D_8037DBE0.unk28 && D_8037DBE0.unk28 != -1){ player_getPosition(sp54); ml_vec3f_to_vec3w(sp48, sp54); - sp30 = cubeList_findNodePropByActorId(sp38, sp48); + sp30 = cubeList_findNodePropByActorIdAndPosition_s32(sp38, sp48); if(sp30 != NULL) { nodeprop_getPosition(sp30, sp54); switch (func_80304DB8(sp30)) { /* irregular */ diff --git a/src/core2/nc/dynamicCam3.c b/src/core2/nc/dynamicCam3.c index a89d634d..250c6e30 100644 --- a/src/core2/nc/dynamicCam3.c +++ b/src/core2/nc/dynamicCam3.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_80259198(f32, f32); extern f32 player_getYaw(void); extern void func_802BD870(f32, f32, f32, f32); diff --git a/src/core2/nc/dynamicCam4.c b/src/core2/nc/dynamicCam4.c index 0400100e..b7b5a662 100644 --- a/src/core2/nc/dynamicCam4.c +++ b/src/core2/nc/dynamicCam4.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_80259198(f32, f32); extern f32 player_getYaw(void); extern f32 player_getPitch(void); extern void func_802BD870(f32, f32, f32, f32); diff --git a/src/core2/nc/dynamicCam8.c b/src/core2/nc/dynamicCam8.c index b3f2de07..6d5fc497 100644 --- a/src/core2/nc/dynamicCam8.c +++ b/src/core2/nc/dynamicCam8.c @@ -63,14 +63,14 @@ void ncDynamicCam8_func_802BF9B8(s32 arg0) { f32 sp28; s32 temp_s0; - temp_s0 = func_802B9E5C(arg0); - D_8037DB0C = func_802BA8BC(temp_s0); - D_8037DB0D = func_802BA87C(temp_s0); - func_802BA7D8(temp_s0, &D_8037DB00); - func_802BA78C(temp_s0, &D_8037DAF0); - func_802BA82C(temp_s0, &sp2C, &sp28); + temp_s0 = ncCameraNodeList_getCameraNodeType1(arg0); + D_8037DB0C = code336F0_func_802BA8BC (temp_s0); + D_8037DB0D = code336F0_func_802BA87C(temp_s0); + code336F0_func_802BA7D8(temp_s0, &D_8037DB00); + cameraNodeType1_getPosition(temp_s0, &D_8037DAF0); + cameraNodeType1_getHorizontalAndVerticalSpeed(temp_s0, &sp2C, &sp28); func_802BE230(sp2C, sp28); - func_802BA854(temp_s0, &sp2C, &sp28); + cameraNodeType1_getRotationAndAccelaration(temp_s0, &sp2C, &sp28); func_802BE244(sp2C, sp28); D_8037DB0E = 0; } diff --git a/src/core2/nc/dynamicCam9.c b/src/core2/nc/dynamicCam9.c index 2328a096..99de8693 100644 --- a/src/core2/nc/dynamicCam9.c +++ b/src/core2/nc/dynamicCam9.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 func_80259198(f32, f32); extern void func_802BD870(f32, f32, f32, f32); /* .bss */ diff --git a/src/core2/nc/dynamicCamF.c b/src/core2/nc/dynamicCamF.c index fd543b87..4656ce03 100644 --- a/src/core2/nc/dynamicCamF.c +++ b/src/core2/nc/dynamicCamF.c @@ -1,6 +1,6 @@ #include +#include "core1/core1.h" #include "functions.h" -#include static f32 __playerStartPosition[3]; diff --git a/src/core2/nc/dynamicCamera.c b/src/core2/nc/dynamicCamera.c index 833e7884..d2fb9ef0 100644 --- a/src/core2/nc/dynamicCamera.c +++ b/src/core2/nc/dynamicCamera.c @@ -1,19 +1,16 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include extern bool func_80245314(f32[3], f32[3], f32, f32, u32); extern int func_80244D94(f32[3], f32[3], f32[3], u32, f32); extern int func_8024575C(f32[3], f32[3], f32, f32[3], s32, u32); -extern f32 ml_vec3f_length(f32[3], f32[3]); -extern f32 func_80259198(f32, f32); extern f32 func_8028E82C(void); extern f32 player_getYaw(void); extern f32 func_8028EF88(void); extern int func_80320DB0(f32[3], f32, f32[3], u32); -extern f32 ml_dotProduct_vec3f(f32[3], f32[3]); typedef struct { f32* unk0; @@ -875,7 +872,7 @@ void func_802BE384(f32 arg0[3], f32 arg1[3], f32 arg2[3], f32 arg3[3], f32 arg4[ sp1C[0] = sp34[0] - sp28[0]; sp1C[1] = sp34[1] - sp28[1]; sp1C[2] = sp34[2] - sp28[2]; - dp = -ml_dotProduct_vec3f(arg4, sp1C); + dp = -ml_vec3f_dot_product(arg4, sp1C); arg3[0] += dp*arg4[0]; arg3[1] += dp*arg4[1]; arg3[2] += dp*arg4[2]; diff --git a/src/core2/nc/firstpersoncamera.c b/src/core2/nc/firstpersoncamera.c index 5af38183..f4d001b2 100644 --- a/src/core2/nc/firstpersoncamera.c +++ b/src/core2/nc/firstpersoncamera.c @@ -4,7 +4,6 @@ extern void func_802BD780(f32[3], f32[3], f32, f32, f32, f32); -extern f32 func_80257CF8(f32, f32, f32, f32, f32); void ncFirstPersonCamera_setState(enum nc_first_person_state state); @@ -22,13 +21,13 @@ struct{ /* .code */ bool __ncFirstPersonCamera_fullyZoomedIn(void) { - return (ml_distance_vec3f(D_8037DC60.position, D_8037DC60.zoomed_in_position) < 40.0f); + return (ml_vec3f_distance(D_8037DC60.position, D_8037DC60.zoomed_in_position) < 40.0f); } void __ncFirstPersonCamera_getPositionAndRotation_entering(f32 arg0[3], f32 arg1[3]) { s32 i; - func_80259430(&D_8037DC60.transistion_timer); + ml_sub_delta_time(&D_8037DC60.transistion_timer); for( i = 0; i<3; i++){ D_8037DC60.position[i] = func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.0f, D_8037DC60.zoomed_out_position[i], D_8037DC60.zoomed_in_position[i]); D_8037DC60.rotation[i] = mlNormalizeAngle(D_8037DC60.zoomed_out_rotation[i] + func_80257CF8(D_8037DC60.transistion_timer, 0.5f, 0.0f, 0.0f, mlDiffDegF(D_8037DC60.zoomed_in_rotation[i], D_8037DC60.zoomed_out_rotation[i]))); @@ -47,7 +46,7 @@ void __ncFirstPersonCamera_getPositionAndRotation_entering(f32 arg0[3], f32 arg1 void __ncFirstPersonCamera_getPositionAndRotation_exiting(f32 arg0[3], f32 arg1[3]) { s32 i; - func_80259430(&D_8037DC60.transistion_timer); + ml_sub_delta_time(&D_8037DC60.transistion_timer); for( i = 0; i<3; i++){ D_8037DC60.position[i] = func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.0f, D_8037DC60.zoomed_in_position[i], arg0[i]); D_8037DC60.rotation[i] = mlNormalizeAngle(D_8037DC60.zoomed_in_rotation[i] + func_80257CF8(D_8037DC60.transistion_timer, 1.0f, 0.5f, 0.0f, mlDiffDegF(arg1[i], D_8037DC60.zoomed_in_rotation[i]))); diff --git a/src/core2/nc/randomCamera.c b/src/core2/nc/randomCamera.c index d1ac5439..36ddf587 100644 --- a/src/core2/nc/randomCamera.c +++ b/src/core2/nc/randomCamera.c @@ -1,7 +1,7 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include /* .bss */ struct { diff --git a/src/core2/nc/staticCamera.c b/src/core2/nc/staticCamera.c index 8d72502b..38371fae 100644 --- a/src/core2/nc/staticCamera.c +++ b/src/core2/nc/staticCamera.c @@ -1,11 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/nc/camera.h" -extern void func_8025727C(f32, f32, f32, f32, f32, f32, f32*, f32*); /* .bss */ static f32 ncStaticCameraPosition[3]; @@ -41,9 +40,9 @@ void ncStaticCamera_update(void){ void __ncStaticCamera_setToNode(s32 camera_node_index){ UNK_TYPE(s32) sp1C; - sp1C = func_802B9E70(camera_node_index); - ncCameraNodeType2_getPosition(sp1C, ncStaticCameraPosition); - ncCameraNodeType2_getRotation(sp1C, ncStaticCameraRotation); + sp1C = ncCameraNodeList_getCameraNodeType2(camera_node_index); + cameraNodeType2_getPosition(sp1C, ncStaticCameraPosition); + cameraNodeType2_getPitchYawRoll(sp1C, ncStaticCameraRotation); } void ncStaticCamera_setToNode(s32 camera_node_index){ diff --git a/src/core2/particle.c b/src/core2/particle.c index e0d3e72f..262ceb36 100644 --- a/src/core2/particle.c +++ b/src/core2/particle.c @@ -1,10 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" -#include #include "core2/particle.h" -extern s32 spriteGetFrameCount(BKSprite *); +extern s32 sprite_getFrameCount(BKSprite *); extern void func_80344720(s32 SpriteGfx, s32 frame, s32, f32[3], f32[3], f32[3], Gfx **, Mtx **); extern void func_80344424(s32 SpriteGfx, s32 frame, s32, f32[3], f32[3], f32, Gfx **, Mtx **); @@ -626,9 +626,9 @@ void particleEmitter_update(ParticleEmitter *this){ if(this->sprite_1C){ particle->frame += particle->framerate*tick; - if(!((s32)particle->frame < spriteGetFrameCount(this->sprite_1C))){ + if(!((s32)particle->frame < sprite_getFrameCount(this->sprite_1C))){ if(this->draw_mode & PART_EMIT_NO_LOOP){ - particle->frame = spriteGetFrameCount(this->sprite_1C) - 1; + particle->frame = sprite_getFrameCount(this->sprite_1C) - 1; }else{ particle->frame = 0.0f; } diff --git a/src/core2/snackerctl.c b/src/core2/snackerctl.c index 5a43b190..0e79be65 100644 --- a/src/core2/snackerctl.c +++ b/src/core2/snackerctl.c @@ -11,7 +11,6 @@ #define SNACKER_BB_DIALOG_0 VER_SELECT(0xe26, 0xa68, 0, 0) #define SNACKER_BB_DIALOG_1 VER_SELECT(0xe33, 0xa75, 0, 0) -s32 ml_vec3f_point_within_horizontal_distance(f32 *, f32, f32, f32); void ncFirstPersonCamera_getZoomedInRotation(f32 *); extern u8 D_8037DCCA; diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index aad84102..2d6daa27 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -1,10 +1,10 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "actor.h" #include "prop.h" #include "functions.h" - #include "ch/snacker.h" void spawnQueue_unlock(void); @@ -396,7 +396,7 @@ void spawnQueue_reset(void){ break; } - if(func_80255D04() == 0 || loaded_asm_file == 0 ){ + if(ucode_stub3() == 0 || loaded_asm_file == 0 ){ func_8030578C(); } func_80305990(1); @@ -417,7 +417,7 @@ void spawnQueue_free(void){ void spawnQueue_func_802C39D4(void){ func_803268B4(); if(!levelSpecificFlags_validateCRC2()){ - write_file_blocks(0, 0, 0x80749530, EEPROM_MAXBLOCKS); + eeprom_writeBlocks(0, 0, 0x80749530, EEPROM_MAXBLOCKS); } } diff --git a/src/cutscenes/code_0.c b/src/cutscenes/code_0.c index 1b78d781..18a8916b 100644 --- a/src/cutscenes/code_0.c +++ b/src/cutscenes/code_0.c @@ -260,7 +260,7 @@ void func_8038702C(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(8U); - particleEmitter_setSprite(pCtrl, 0x712); + particleEmitter_setSprite(pCtrl, ASSET_712_SPRITE_SPARKLE_GREEN); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); func_8034A174((struct5Bs *)sp44->marker->unk44, 5, sp34); particleEmitter_setPosition(pCtrl, sp34); @@ -281,7 +281,7 @@ void func_80387170(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(8); - particleEmitter_setSprite(pCtrl, 0x712); + particleEmitter_setSprite(pCtrl, ASSET_712_SPRITE_SPARKLE_GREEN); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); func_8034A174((struct5Bs *)sp44->marker->unk44, 6, sp34); particleEmitter_setPosition(pCtrl, sp34); @@ -306,7 +306,7 @@ void func_803872B4(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(4); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0x82); func_8034A174((struct5Bs *)sp44->marker->unk44, 7, sp34); @@ -329,7 +329,7 @@ void func_80387364(s32 arg0) { sp34 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setRGB(pCtrl, D_8038D4A0); particleEmitter_setAlpha(pCtrl, 0x82); @@ -348,7 +348,7 @@ void func_80387424(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(8); - particleEmitter_setSprite(pCtrl, 0x713); + particleEmitter_setSprite(pCtrl, ASSET_713_SPRITE_SPARKLE_YELLOW); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0x64); func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); @@ -386,7 +386,7 @@ void func_80387680(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(11); - particleEmitter_setSprite(pCtrl, 0x70B); + particleEmitter_setSprite(pCtrl, ASSET_70B_SPRITE_BUBBLE_2); func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); particleEmitter_setPosition(pCtrl, sp34); particleEmitter_setAngularVelocityRange(pCtrl, -600.0f, -600.0f, -600.0f, 600.0f, 600.0f, 600.0f); @@ -409,7 +409,7 @@ void func_803877A0(s32 arg0) { sp34 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x475); + particleEmitter_setSprite(pCtrl, ASSET_475_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setRGB(pCtrl, D_8038D584); particleEmitter_setAlpha(pCtrl, 0xFF); @@ -480,7 +480,7 @@ void func_80387B58(s32 arg0) { sp44 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x702); + particleEmitter_setSprite(pCtrl, ASSET_702_SPRITE_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0x3C); particleEmitter_setAngularVelocityRange(pCtrl, -60.0f, -60.0f, -60.0f, 60.0f, 60.0f, 60.0f); @@ -509,7 +509,7 @@ void func_80387C64(s32 arg0) { func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); if (ml_isZero_vec3f(sp34) == 0) { pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setRGB(pCtrl, D_8038D6A0); particleEmitter_setAlpha(pCtrl, 0x64); @@ -536,7 +536,7 @@ void func_80387D88(s32 arg0) { func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); if (ml_isZero_vec3f(sp34) == 0) { pCtrl = partEmitMgr_newEmitter(25); - particleEmitter_setSprite(pCtrl, 0x713); + particleEmitter_setSprite(pCtrl, ASSET_713_SPRITE_SPARKLE_YELLOW); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0xFF); particleEmitter_setAngularVelocityRange(pCtrl, -60.0f, -60.0f, -60.0f, 60.0f, 60.0f, 60.0f); @@ -563,7 +563,7 @@ void func_80387E9C(s32 arg0) { func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); if (ml_isZero_vec3f(sp34) == 0) { pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0xC8); particleEmitter_setRGB(pCtrl, D_8038D76C); @@ -591,7 +591,7 @@ void func_80387FC0(s32 arg0) { func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); if (ml_isZero_vec3f(sp34) == 0) { pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0x64); particleEmitter_setAngularVelocityRange(pCtrl, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); @@ -616,7 +616,7 @@ void func_803880C8(s32 arg0) { sp34 = marker_getActor(reinterpret_cast(ActorMarker *,arg0)); pCtrl = partEmitMgr_newEmitter(1); - particleEmitter_setSprite(pCtrl, 0x47C); + particleEmitter_setSprite(pCtrl, ASSET_47C_UNKNOWN); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setRGB(pCtrl, D_8038D838); particleEmitter_setAlpha(pCtrl, 0x82); @@ -644,7 +644,7 @@ void func_803881CC(s32 arg0) { func_8034A174((struct5Bs *) sp44->marker->unk44, 5, sp34); if (ml_isZero_vec3f(sp34) == 0) { pCtrl = partEmitMgr_newEmitter(2); - particleEmitter_setSprite(pCtrl, 0x70D); + particleEmitter_setSprite(pCtrl, ASSET_70D_SPRITE_SMOKE_1); particleEmitter_setStartingFrameRange(pCtrl, 1, 6); particleEmitter_setAlpha(pCtrl, 0x50); particleEmitter_setAngularVelocityRange(pCtrl, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f, 0.0f); diff --git a/src/done/bk_boot_1050.c b/src/done/bk_boot_1050.c index 206bcfa6..a48701c0 100644 --- a/src/done/bk_boot_1050.c +++ b/src/done/bk_boot_1050.c @@ -1,7 +1,4 @@ #include -#include "functions.h" -#include "variables.h" - #include "rarezip.h" #define ENTRY_STACK_LEN 0x2000 diff --git a/src/done/inflate.c b/src/done/inflate.c index 12594afd..896d96e6 100644 --- a/src/done/inflate.c +++ b/src/done/inflate.c @@ -1,7 +1,4 @@ #include -#include "functions.h" -#include "variables.h" - #include "rarezip.h" u8 border[] = { /* Order of the bit length code lengths */ diff --git a/src/done/rarezip.c b/src/done/rarezip.c index 74516606..a044602f 100644 --- a/src/done/rarezip.c +++ b/src/done/rarezip.c @@ -1,7 +1,4 @@ #include -#include "functions.h" -#include "variables.h" - #include "rarezip.h" struct huft *D_80007270; diff --git a/src/fight/chbossjinjo.c b/src/fight/chbossjinjo.c index 82075fc8..9a1881de 100644 --- a/src/fight/chbossjinjo.c +++ b/src/fight/chbossjinjo.c @@ -1,8 +1,8 @@ #include +#include "core1/core1.h" #include "functions.h" #include "variables.h" #include "fight.h" -#include #include "core2/particle.h" extern void func_80324CFC(f32, enum comusic_e, s32); diff --git a/src/fight/chbossjinjobase.c b/src/fight/chbossjinjobase.c index d29096b1..2fa53ad9 100644 --- a/src/fight/chbossjinjobase.c +++ b/src/fight/chbossjinjobase.c @@ -22,7 +22,7 @@ void chbossjinjobase_spawnStoneJinjo(ActorMarker *marker) { } void chBossJinjoBase_createSmokeParticles(f32 position[3], s32 count) { - ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count); + ParticleEmitter *pCtrl = partEmitMgr_newEmitter(count); particleEmitter_setSprite(pCtrl, ASSET_70E_SPRITE_SMOKE_2); particleEmitter_setRGB(pCtrl, chBossJinjoBase_SmokeColor); particleEmitter_setStartingFrameRange(pCtrl, 0, 7); @@ -61,11 +61,11 @@ void chBossJinjoBase_free(Actor *this) { ActorLocal_BossJinjoBase *local = (ActorLocal_BossJinjoBase *) &this->local; if ((u8)this->unk44_31 != 0) { - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } if (local->sfxsourceIdx != 0) { - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); local->sfxsourceIdx = 0; } } @@ -124,9 +124,9 @@ void chBossJinjoBase_update(Actor *this) { func_8030E2C4(local->sfxsourceIdx); } - position_delta[0] = (rumbling & 1) ? 3.0f : -3.0f; + position_delta[0] = (rumbling & 1) ? 3.0f : -3.0f; position_delta[1] = y_delta; - position_delta[2] = (rumbling & 2) ? 3.0f : -3.0f; + position_delta[2] = (rumbling & 2) ? 3.0f : -3.0f; this->position_x = this->unk1C[0]; this->position_z = this->unk1C[2]; @@ -142,9 +142,9 @@ void chBossJinjoBase_update(Actor *this) { } else { subaddie_set_state(this, CHBOSSJINJOBASE_STATE_2_DEFAULT); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); local->sfxsourceIdx = 0; TUPLE_COPY(this->position, this->unk1C); TUPLE_COPY(actor_stonejinjo->position, this->unk1C); diff --git a/src/fight/chfinalboss.c b/src/fight/chfinalboss.c index 293fc577..d3e76b8f 100644 --- a/src/fight/chfinalboss.c +++ b/src/fight/chfinalboss.c @@ -3,7 +3,6 @@ #include "variables.h" #include "fight.h" -extern f32 func_8025715C(f32, f32); extern void func_8028F4B8(f32[3], f32, f32); extern void func_80320ED8(ActorMarker *, f32, s32); s32 func_803297C8(Actor*, f32*); @@ -13,7 +12,6 @@ extern void func_803298D8(); extern void func_80324CFC(f32, enum comusic_e, s32); extern void sfxsource_setSampleRate(u8, s32); extern void func_80328FF0(Actor *arg0, f32 arg1); -extern f32 func_80257204(f32, f32, f32, f32); extern void func_8028F85C(f32[3]); extern void player_setIdealRotation(f32[3]); extern f32 func_8033229C(ActorMarker *); @@ -447,7 +445,7 @@ void chfinalboss_func_80387110(ActorMarker *marker, f32 arg1[3], f32 arg2, s32 a } } -void chfinalboss_func_803872F8(Actor *arg0) { +void chfinalboss_func_803872F8(Actor *arg0) { f32 vec[3]; func_8034A174(arg0->marker->unk44, 0xA, vec); @@ -500,7 +498,7 @@ bool chfinalboss_func_80387470(Actor *this, f32 arg1[3], f32 v_max, f32 arg3, f3 diff[2] = arg1[2] - this->position[2]; if (arg5 != 0.00f) { - if (ml_distance_vec3f(this->position, arg1) < arg5) { + if (ml_vec3f_distance(this->position, arg1) < arg5) { ml_vec3f_set_length(diff, arg3 * 4.00f); } else { ml_vec3f_set_length(diff, arg3 * 1.00f); @@ -529,7 +527,7 @@ bool chfinalboss_func_80387470(Actor *this, f32 arg1[3], f32 v_max, f32 arg3, f3 this->yaw += (arg4 * temp.pos_x * dt); - if (ml_distance_vec3f(this->position, arg1) < arg6) { + if (ml_vec3f_distance(this->position, arg1) < arg6) { return TRUE; } return FALSE; @@ -696,7 +694,7 @@ void chfinalboss_func_80387D4C(Actor *actor) { sp20[1] = -2.0 * (100.0f - local->unk1C); sp20[2] = actor->velocity[2] * local->unk14; - ml_vec3f_normalize(sp20, actor); + ml_vec3f_normalize(sp20); sp20[0] = sp20[0] * actor->actor_specific_1_f; sp20[1] = sp20[1] * actor->actor_specific_1_f; sp20[2] = sp20[2] * actor->actor_specific_1_f; @@ -915,7 +913,7 @@ void chfinalboss_phase1_update(ActorMarker *marker) { case 3: chfinalboss_func_80386600(this->marker, 0); chfinalboss_spawnBroomstickGlowParticles(this); - sp50 = ml_map_f(ml_distance_vec3f(this->position, this->unk1C), 300.0f, 1000.0f, 100.0f, 1000.0f); + sp50 = ml_map_f(ml_vec3f_distance(this->position, this->unk1C), 300.0f, 1000.0f, 100.0f, 1000.0f); chfinalboss_func_80387ACC(this, 60.0f * sp54); if (chfinalboss_func_80387470(this, this->unk1C, sp50, 1800.0f, 200.0f, 500.0f, 300.0f)) { chfinalboss_phase1_setState(this, 4); @@ -1044,7 +1042,7 @@ void chfinalboss_phase1_update(ActorMarker *marker) { chfinalboss_func_8038871C(this, 460.0f, 400.0f * sp54); chfinalboss_func_803873DC(this, 600.0f, 2000.0f); if (actor_animationIsAt(this, 0.9999f)) { - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0U; chfinalboss_setPhase(this->marker, FINALBOSS_PHASE_2_AIR); } @@ -1117,7 +1115,7 @@ void chfinalboss_phase2_update(ActorMarker *marker) { case 14: chfinalboss_spawnBroomstickGlowParticles(this); chfinalboss_func_80387ACC(this, 30.0f * sp4C); - if (chfinalboss_func_80387470(this, this->unk1C, ml_map_f(ml_distance_vec3f(this->position, this->unk1C), 70.0f, 1000.0f, 100.0f, D_80391758[sp48]), D_80391758[sp48] * 2, 160.0f, 500.0f, 70.0f)) { + if (chfinalboss_func_80387470(this, this->unk1C, ml_map_f(ml_vec3f_distance(this->position, this->unk1C), 70.0f, 1000.0f, 100.0f, D_80391758[sp48]), D_80391758[sp48] * 2, 160.0f, 500.0f, 70.0f)) { local->unkA = 1; chfinalboss_phase2_setState(this, 0xF); } @@ -1657,7 +1655,7 @@ void chfinalboss_phase4_update(ActorMarker *marker) { timed_exitStaticCamera(0.0f); func_80324E38(0.0f, 0); chfinalboss_setPhase(this->marker, FINALBOSS_PHASE_5_JINJONATOR); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0U; } break; @@ -1874,7 +1872,7 @@ void chfinalboss_phase5_update(ActorMarker *marker) { } if (actor_animationIsAt(this, 0.9999f)) { chfinalboss_phase5_setState(this, 0x27); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } break; @@ -1888,7 +1886,7 @@ void chfinalboss_phase5_update(ActorMarker *marker) { v0 = this->unk44_31; if (v0 != 0) { func_8030E394(v0); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } } @@ -1956,7 +1954,7 @@ 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_TEXT_UNKNOWN, 0x2A, sp24->position, sp24->marker, chfinalboss_phase0_endTextCallback, NULL); + gcdialog_showText(ASSET_10E7_DIALOG_UNKNOWN, 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); @@ -1982,7 +1980,7 @@ bool chfinalboss_func_8038B834(ActorMarker *marker, ActorMarker *other_marker) { marker->id = 0x25E; } break; - + case FINALBOSS_PHASE_2_AIR: if (local->unkA == 0) { marker->id = 0x260; @@ -2069,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_TEXT_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL)) { + if (gcdialog_showText(randi2(0, 5) + ASSET_10ED_DIALOG_FINALBOSS_PHASE_1_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL)) { local->player_hit_in_phase1++; } } @@ -2078,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_TEXT_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL); + gcdialog_showText(randi2(0, 5) + ASSET_111D_DIALOG_FINALBOSS_PHASE_2_HIT_PLAYER_OPTION_1, 0, NULL, NULL, NULL, NULL); } } } diff --git a/src/fight/chjinjonator.c b/src/fight/chjinjonator.c index 733844a5..b0e77010 100644 --- a/src/fight/chjinjonator.c +++ b/src/fight/chjinjonator.c @@ -189,7 +189,7 @@ void chjinjonator_update(Actor *this){ subaddie_set_state_with_direction(this, JINJONATOR_STATE_3_MOVE_UPWARD, 0.001f, 1); actor_playAnimationOnce(this); func_8030E394(this->unk44_31); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; local->velocity_move_up = (320.0f - this->position_y) * 0.5; func_80324CFC(0.0f, COMUSIC_8C_JINJONATOR_POWERUP, 32000); @@ -255,7 +255,7 @@ void chjinjonator_update(Actor *this){ 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); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } func_80324D2C(0.0f, COMUSIC_8C_JINJONATOR_POWERUP); diff --git a/src/fight/chjinjonatorbase.c b/src/fight/chjinjonatorbase.c index 0a7e9f68..161bd8a9 100644 --- a/src/fight/chjinjonatorbase.c +++ b/src/fight/chjinjonatorbase.c @@ -170,7 +170,7 @@ void chjinjonatorbase_update(Actor *this){ FUNC_8030E624(SFX_7F_HEAVYDOOR_SLAM, 0.8f, 32000); func_8030E394(this->unk44_31); - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; this->position_x = this->unk1C[0]; diff --git a/src/fight/chspellbarrier.c b/src/fight/chspellbarrier.c index ad12941b..db28742d 100644 --- a/src/fight/chspellbarrier.c +++ b/src/fight/chspellbarrier.c @@ -42,12 +42,12 @@ void chspellbarrier_free(Actor *this) { ActorLocal_SpellBarrier *local = (ActorLocal_SpellBarrier *) &this->local; if ((u8) this->unk44_31) { - func_8030DA44(this->unk44_31); + sfxsource_freeSfxsourceByIndex(this->unk44_31); this->unk44_31 = 0; } if (local->sfxsourceIdx != 0) { - func_8030DA44(local->sfxsourceIdx); + sfxsource_freeSfxsourceByIndex(local->sfxsourceIdx); local->sfxsourceIdx = 0; } } diff --git a/src/fight/chspellfireball.c b/src/fight/chspellfireball.c index 3b4bcc8e..741a6e40 100644 --- a/src/fight/chspellfireball.c +++ b/src/fight/chspellfireball.c @@ -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_TEXT_FINALBOSS_PHASE_1_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase1 && gcdialog_showText(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_TEXT_FINALBOSS_PHASE_2_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase2 && gcdialog_showText(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_TEXT_FINALBOSS_PHASE_3_OPTION_1, 0, 0, 0, 0, 0)) + if (!sFightPlayerHitBySpellInPhase3 && gcdialog_showText(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_TEXT_FINALBOSS_PHASE_4_OPTION_1, 0, 0, 0, 0, 0)) + gcdialog_showText(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_TEXT_FINALBOSS_PHASE_5_OPTION_1, 0, 0, 0, 0, 0)) + gcdialog_showText(randi2(0, 5) + ASSET_1154_DIALOG_FINALBOSS_PHASE_5_OPTION_1, 0, 0, 0, 0, 0)) { sFightPlayerHitBySpellInPhase5 = TRUE; } diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index 799a34e9..8172d25c 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 ml_vec3f_horizontal_distance_zero_likely(f32[3], f32[3]); - typedef struct { s32 unk0; } ActorLocal_lair_5640; @@ -44,11 +42,11 @@ void func_8038BADC(ActorMarker *marker, enum asset_e text_id, s32 arg2) { if (text_id == ((ActorLocal_lair_5640 *)&this->local)->unk0 + 2) { if (!fileProgressFlag_get(this->unkF4_8 - 1 + FILEPROG_E9_HEALED_BY_BRENTILDA_1)) { if (item_getCount(ITEM_14_HEALTH) < item_getCount(ITEM_15_HEALTH_TOTAL)) { - gcdialog_showText(ASSET_10A2_TEXT_UNKNOWN, 0xF, this->position, this->marker, func_8038BADC, lair_func_8038BA88); + gcdialog_showText(ASSET_10A2_DIALOG_UNKNOWN, 0xF, this->position, this->marker, func_8038BADC, lair_func_8038BA88); return; } } - gcdialog_showText(ASSET_D38_TEXT_BOTTLES_ALL_MOVES_LEARNED, 0xC, this->position, this->marker, func_8038BADC, NULL); + gcdialog_showText(ASSET_D38_DIALOG_BOTTLES_ALL_MOVES_LEARNED, 0xC, this->position, this->marker, func_8038BADC, NULL); return; } subaddie_set_state(this, 1); diff --git a/src/lair/ch/cauldron.c b/src/lair/ch/cauldron.c index 86e292a2..c5928e71 100644 --- a/src/lair/ch/cauldron.c +++ b/src/lair/ch/cauldron.c @@ -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_TEXT_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_F7A_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); fileProgressFlag_set(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET, 1); } } @@ -278,7 +278,7 @@ void chWarpCauldron_update(Actor *this) { phi_a0 = (fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this)) != 0) ? SFX_107_CAULDRON_ACTIVATION_1 : SFX_108_CAULDRON_ACTIVATION_2; sfxsource_play(phi_a0, 32000); if (!fileProgressFlag_get(FILEPROG_F5_COMPLETED_A_WARP_CAULDRON_SET) && !fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))) { - gcdialog_showText(ASSET_F79_TEXT_UNKNOWN, 4, NULL, NULL, NULL, NULL); + gcdialog_showText(ASSET_F79_DIALOG_UNKNOWN, 4, NULL, NULL, NULL, NULL); } if (fileProgressFlag_get(chWarpCauldron_getPairedFileProgressFlagIndex(this))){ switch(this->unkF4_8){ @@ -385,7 +385,7 @@ void chWarpCauldron_update(Actor *this) { case 6: //L8038B64C if (func_8038A690(this) && !fileProgressFlag_get(FILEPROG_F3_MET_DINGPOT)) { - gcdialog_showText(ASSET_FAD_TEXT_UNKNOWN, 0xA, this->position, NULL, __chWarpCauldron_dingpotDialogCallback, NULL); + gcdialog_showText(ASSET_FAD_DIALOG_UNKNOWN, 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 0ecb63f1..9655fb19 100644 --- a/src/lair/code_0.c +++ b/src/lair/code_0.c @@ -683,7 +683,7 @@ void func_80387730(Actor *this) { } if (!fileProgressFlag_get(this->unkF4_8 + FILEPROG_39_CCW_OPEN) && ability_isUnlocked(ABILITY_13_1ST_NOTEDOOR)) { player_getPosition(spAC); - if ((ml_distance_vec3f(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) { + if ((ml_vec3f_distance(spAC, this->position) < 500.0f) && (func_803114C4() != 0xF64)) { func_802FACA4(0xC); } if (itemscore_noteScores_getTotal() >= D_8039347C[this->unkF4_8 - 1]) { @@ -699,7 +699,7 @@ void func_80387730(Actor *this) { phi_f20 = 290.0f; } sp9C[1] = this->position[1]; - if ((ml_distance_vec3f(spAC, sp9C) < phi_f20) || (this->alpha_124_19 != 0xFF)) { + if ((ml_vec3f_distance(spAC, sp9C) < phi_f20) || (this->alpha_124_19 != 0xFF)) { if (this->alpha_124_19 == 0xFF) { func_80324CFC(0.0f, COMUSIC_43_ENTER_LEVEL_GLITTER, 32700); func_80324D2C(2.4f, COMUSIC_43_ENTER_LEVEL_GLITTER); @@ -740,7 +740,7 @@ void func_80387730(Actor *this) { } } } - } else if ((this->unkF4_8 >= 2) && (ml_distance_vec3f(spAC, this->position) < 290.0f)) { + } else if ((this->unkF4_8 >= 2) && (ml_vec3f_distance(spAC, this->position) < 290.0f)) { volatileFlag_setAndTriggerDialog_0(VOLATILE_FLAG_B0_NOT_ENOUGH_NOTES); } } diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index dc6141d9..eb6e9fbc 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -67,8 +67,6 @@ extern s32 ability_getAllLearned(void); // get unlocked moves bitfield extern s32 item_getCount(s32); // item count get extern void item_adjustByDiffWithoutHud(s32, s32); // item count set -extern void func_80250530(s32, u16, f32); - extern void func_8025A55C(s32, s32, s32); extern void func_80324CFC(f32, s16, s16); @@ -536,7 +534,7 @@ void lair_func_8038CC9C(void) return; func_8030E394(D_8037DCB8->UNK_18); - func_8030DA44(D_8037DCB8->UNK_18); + sfxsource_freeSfxsourceByIndex(D_8037DCB8->UNK_18); D_8037DCB8->UNK_18 = 0; } diff --git a/src/lair/code_86F0.c b/src/lair/code_86F0.c index 4b566399..092eb54d 100644 --- a/src/lair/code_86F0.c +++ b/src/lair/code_86F0.c @@ -2,7 +2,6 @@ #include "functions.h" #include "variables.h" -extern f32 ml_distanceSquared_vec3f(f32[3], f32[3]); extern void func_8028F3D8(f32[3], f32, void(*)(ActorMarker *), ActorMarker *); extern void func_80324CFC(f32, enum comusic_e, s32); extern void rand_seed(s32); @@ -203,7 +202,7 @@ void func_8038EFD8(Actor *this) { sp24[1] = this->position[1]; sp24[2] = this->position[2]; sp24[1] += 50.0f; - func_8028F3D8(sp24, ml_distance_vec3f(sp30, sp24) / 150.0, func_8038EF58, this->marker); + 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){ diff --git a/src/lair/code_9C40.c b/src/lair/code_9C40.c index 93261678..ab6a0e04 100644 --- a/src/lair/code_9C40.c +++ b/src/lair/code_9C40.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -extern bool ml_vec3f_within_distance(f32[3], f32[3], f32); - void func_803902B8(Actor *this); Actor *func_80390030(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); diff --git a/src/lair/code_A810.c b/src/lair/code_A810.c index abdccb3d..5ecc9600 100644 --- a/src/lair/code_A810.c +++ b/src/lair/code_A810.c @@ -111,7 +111,7 @@ void func_80390E28(Actor *this) { } this->unk10_12 = 0; for(i = 0; (i < D_80395460) && (this->unk10_12 < 4); i++){ - temp_f0 = ml_distance_vec3f(this->position, D_80395370[i]); + temp_f0 = ml_vec3f_distance(this->position, D_80395370[i]); if ((temp_f0 > 400.0f) && (temp_f0 < 1200.0f)) { local->unk0[this->unk10_12][0] = D_80395370[i][0]; local->unk0[this->unk10_12][1] = D_80395370[i][1]; diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index f60fbbab..5780c41e 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -55,7 +55,7 @@ s32 D_80394BD4[3] = {0xff, 0x80, 0x80}; void func_80391160(f32 pos[3], u32 count) { ParticleEmitter *p = partEmitMgr_newEmitter(count); - particleEmitter_setSprite(p, 0x70E); + particleEmitter_setSprite(p, ASSET_70E_SPRITE_SMOKE_2); particleEmitter_setRGB(p, D_80394AD4); particleEmitter_setAlpha(p, 0xEB); particleEmitter_setStartingFrameRange(p, 0, 7); @@ -99,7 +99,7 @@ void func_8039137C(f32 pos[3], u32 count, enum asset_e sprite) void func_8039144C(f32 pos[3], u32 count) { ParticleEmitter *p = partEmitMgr_newEmitter(count); - particleEmitter_setSprite(p, 0x713); + particleEmitter_setSprite(p, ASSET_713_SPRITE_SPARKLE_YELLOW); particleEmitter_setPosition(p, pos); particleEmitter_setSpawnPositionRange(p, -40, -40, -40, 40, 40, 40); particleEmitter_setDrawMode(p, 4); @@ -115,7 +115,7 @@ void func_8039144C(f32 pos[3], u32 count) void func_803915A4(f32 pos[3], s32 count, f32 scale) { ParticleEmitter *p = partEmitMgr_newEmitter(count); - particleEmitter_setSprite(p, 0x4A0); + particleEmitter_setSprite(p, ASSET_4A0_SPRITE_EXPLOSION); particleEmitter_setFade(p, 0.1f, 0.2f); particleEmitter_setDrawMode(p, PART_EMIT_NO_LOOP); particleEmitter_setStartingFrameRange(p, 2, 8); diff --git a/src/lair/code_C6C0.c b/src/lair/code_C6C0.c index f70aac98..16284c20 100644 --- a/src/lair/code_C6C0.c +++ b/src/lair/code_C6C0.c @@ -45,7 +45,7 @@ void func_80392B6C(Actor *this) { } } if (mapSpecificFlags_get(7) != 0) { - sp28 = ml_distance_vec3f(this->position, this->unk1C) / 350.0; + sp28 = ml_vec3f_distance(this->position, this->unk1C) / 350.0; comusic_playTrack(COMUSIC_A9_TOOTY); mapSpecificFlags_set(7, 0); mapSpecificFlags_set(9, 1);