From 9cb645df24e9943133e1d055d56cc47421301d1d Mon Sep 17 00:00:00 2001 From: Banjo Kazooie Date: Sun, 1 Sep 2024 15:12:21 -0500 Subject: [PATCH] chsnacker documentation snackerctl documentation gczoombox partial documentation several warning resolutions --- asm/core1/code_1E820.s | 57 +++++ decompressed.us.v10.yaml | 24 +-- include/enums.h | 21 +- include/file_and_line.h | 2 +- include/gc/gc.h | 1 - include/gc/gczoombox.h | 212 ------------------- include/math.h | 2 +- src/core1/code_18350.c | 2 - src/core1/code_3A70.c | 2 +- src/core1/code_660.c | 1 + src/core2/ch/gameSelect.c | 21 +- src/core2/ch/gravestone.c | 2 +- src/core2/{code_59D40.c => ch/snacker.c} | 255 ++++++++++++----------- src/core2/ch/snacker.h | 12 ++ src/core2/code_47BD0.c | 27 +-- src/core2/code_7060.c | 4 +- src/core2/code_91E10.c | 103 ++++----- src/core2/code_9E370.c | 4 +- src/core2/code_C9E70.c | 6 +- {include => src}/core2/code_C9E70.h | 4 +- src/core2/code_E910.c | 6 +- src/core2/{code_87E30.c => gc/dialog.c} | 23 +- src/core2/gc/parade.c | 8 +- src/core2/gc/pauseMenu.c | 42 ++-- src/core2/gc/zoombox.c | 202 +++++++++--------- src/core2/gc/zoombox.h | 252 ++++++++++++++++++++++ src/core2/{code_3480.c => snackerctl.c} | 71 +++---- src/core2/snackerctl.h | 14 ++ src/core2/spawnqueue.c | 8 +- src/lair/code_5ED0.c | 60 +++--- symbol_addrs.us.v10.txt | 68 ------ 31 files changed, 783 insertions(+), 733 deletions(-) create mode 100644 asm/core1/code_1E820.s delete mode 100644 include/gc/gczoombox.h rename src/core2/{code_59D40.c => ch/snacker.c} (51%) create mode 100644 src/core2/ch/snacker.h rename {include => src}/core2/code_C9E70.h (96%) rename src/core2/{code_87E30.c => gc/dialog.c} (97%) create mode 100644 src/core2/gc/zoombox.h rename src/core2/{code_3480.c => snackerctl.c} (60%) create mode 100644 src/core2/snackerctl.h diff --git a/asm/core1/code_1E820.s b/asm/core1/code_1E820.s new file mode 100644 index 00000000..0b10453e --- /dev/null +++ b/asm/core1/code_1E820.s @@ -0,0 +1,57 @@ +.include "macro.inc" + +/* assembler directives */ +.set noat /* allow manual use of $at */ +.set noreorder /* don't insert nops after branches */ +.set gp=64 /* allow use of 64-bit general purpose registers */ + +.section .text, "ax" + +glabel func_8025C240 +/* F37A70 8025C240 3C048027 */ lui $a0, %hi(D_80276E70) +/* F37A74 8025C244 DC846E70 */ ld $a0, %lo(D_80276E70)($a0) +/* F37A78 8025C248 3C018027 */ lui $at, %hi(D_80276E70) +/* F37A7C 8025C24C 000437FC */ dsll32 $a2, $a0, 31 +/* F37A80 8025C250 00042FF8 */ dsll $a1, $a0, 31 +/* F37A84 8025C254 000637FA */ dsrl $a2, $a2, 31 +/* F37A88 8025C258 0005283E */ dsrl32 $a1, $a1, 0 +/* F37A8C 8025C25C 0004233C */ dsll32 $a0, $a0, 12 +/* F37A90 8025C260 00C53025 */ or $a2, $a2, $a1 +/* F37A94 8025C264 0004203E */ dsrl32 $a0, $a0, 0 +/* F37A98 8025C268 00C43026 */ xor $a2, $a2, $a0 +/* F37A9C 8025C26C 0006253A */ dsrl $a0, $a2, 20 +/* F37AA0 8025C270 30840FFF */ andi $a0, $a0, 0xFFF +/* F37AA4 8025C274 00862026 */ xor $a0, $a0, $a2 +/* F37AA8 8025C278 0004103C */ dsll32 $v0, $a0, 0 +/* F37AAC 8025C27C FC246E70 */ sd $a0, %lo(D_80276E70)($at) +/* F37AB0 8025C280 03E00008 */ jr $ra +/* F37AB4 8025C284 0002103F */ dsra32 $v0, $v0, 0 +endlabel func_8025C240 + +glabel func_8025C288 +/* F37AB8 8025C288 64840001 */ daddiu $a0, $a0, 0x1 +/* F37ABC 8025C28C 3C018027 */ lui $at, %hi(D_80276E70) +/* F37AC0 8025C290 FC246E70 */ sd $a0, %lo(D_80276E70)($at) +/* F37AC4 8025C294 03E00008 */ jr $ra +/* F37AC8 8025C298 24040000 */ addiu $a0, $zero, 0x0 +endlabel func_8025C288 + +glabel func_8025C29C +/* F37ACC 8025C29C DC870000 */ ld $a3, 0x0($a0) +/* F37AD0 8025C2A0 000737FC */ dsll32 $a2, $a3, 31 +/* F37AD4 8025C2A4 00072FF8 */ dsll $a1, $a3, 31 +/* F37AD8 8025C2A8 000637FA */ dsrl $a2, $a2, 31 +/* F37ADC 8025C2AC 0005283E */ dsrl32 $a1, $a1, 0 +/* F37AE0 8025C2B0 00073B3C */ dsll32 $a3, $a3, 12 +/* F37AE4 8025C2B4 00C53025 */ or $a2, $a2, $a1 +/* F37AE8 8025C2B8 0007383E */ dsrl32 $a3, $a3, 0 +/* F37AEC 8025C2BC 00C73026 */ xor $a2, $a2, $a3 +/* F37AF0 8025C2C0 00063D3A */ dsrl $a3, $a2, 20 +/* F37AF4 8025C2C4 30E70FFF */ andi $a3, $a3, 0xFFF +/* F37AF8 8025C2C8 00E63826 */ xor $a3, $a3, $a2 +/* F37AFC 8025C2CC 0007103C */ dsll32 $v0, $a3, 0 +/* F37B00 8025C2D0 FC870000 */ sd $a3, 0x0($a0) +/* F37B04 8025C2D4 03E00008 */ jr $ra +/* F37B08 8025C2D8 0002103F */ dsra32 $v0, $v0, 0 +/* F37B0C 8025C2DC 00000000 */ nop +endlabel func_8025C29C diff --git a/decompressed.us.v10.yaml b/decompressed.us.v10.yaml index b522c36e..72dc9024 100644 --- a/decompressed.us.v10.yaml +++ b/decompressed.us.v10.yaml @@ -511,7 +511,7 @@ segments: - [0xF57290, c, code_1930] #DONE - [0xF57BA0, c, code_2240] #DONE - [0xF581F0, c, ba/anim] #DONE - - [0xF58DE0, c, code_3480] #DONE + - [0xF58DE0, c, snackerctl] #DONE - [0xF59330, c, code_39D0] #DONE - [0xF5A120, c, ba/marker] #DONE - [0xF5C490, c, code_6B30] #DONE @@ -706,7 +706,7 @@ segments: - [0xFAF0E0, c, code_59780] #DONE - [0xFAF340, c, code_599E0] #DONE - [0xFAF3E0, c, code_59A80] #DONE - - [0xFAF6A0, c, code_59D40] #DONE + - [0xFAF6A0, c, ch/snacker] #DONE - [0xFB0490, c, ch/snowman] #DONE - [0xFB1000, c, ch/snowball] #DONE - [0xFB16F0, c, ch/snowmanhat] #DONE @@ -775,7 +775,7 @@ segments: - [0xFDAB30, c, code_851D0] #DONE - [0xFDB110, c, code_857B0] #DONE - [0xFDB160, c, code_85800] #DONE - - [0xFDD790, c, code_87E30] + - [0xFDD790, c, gc/dialog] - [0xFE0110, c, gc/pauseMenu] #DONE - [0xFE3580, c, code_8DC20] #DONE - [0xFE3BD0, c, gc/zoombox] #DONE @@ -901,7 +901,7 @@ segments: - [0x1031F60, bin, data_DC600] #unreferenced - [0x1031F90, .data, code_1550] - [0x1031FB0, .data, ba/anim] - - [0x1031FE0, .data, code_3480] + - [0x1031FE0, .data, snackerctl] - [0x1032000, .data, ba/marker] - [0x1032060, .data, code_7060] - [0x10320A0, .data, code_90E0] @@ -1003,7 +1003,7 @@ segments: - [0x1036D80, .data, ch/bottlesbonuscursor] - [0x1036E10, .data, code_59780] - [0x1036F70, .data, code_59A80] - - [0x1036FA0, .data, code_59D40] + - [0x1036FA0, .data, ch/snacker] - [0x1037020, .data, ch/snowman] - [0x10370E0, .data, ch/snowball] - [0x1037190, .data, ch/snowmanhat] @@ -1048,7 +1048,7 @@ segments: - [0x103A710, .data, gc/sky] - [0x103AB20, .data, gc/transition] - [0x103AE20, .data, code_851D0] - - [0x103AEA0, .data, code_87E30] + - [0x103AEA0, .data, gc/dialog] - [0x103AEB0, .data, gc/pauseMenu] - [0x103B000, .data, code_8DC20] - [0x103B090, .data, gc/zoombox] @@ -1123,7 +1123,7 @@ segments: - [0x10427F0, .rodata, anim/sprite] - [0x1042800, .rodata, code_1930] - [0x1042880, .rodata, ba/anim] - - [0x1042890, .rodata, code_3480] + - [0x1042890, .rodata, snackerctl] - [0x10428A0, .rodata, code_39D0] - [0x1042940, .rodata, ba/marker] - [0x1042D70, .rodata, code_6B30] @@ -1259,7 +1259,7 @@ segments: - [0x10459A0, .rodata, ch/bottlesbonuscursor] - [0x1045A00, .rodata, code_599E0] - [0x1045A10, .rodata, code_59A80] - - [0x1045A20, .rodata, code_59D40] + - [0x1045A20, .rodata, ch/snacker] - [0x1045A70, .rodata, ch/snowman] - [0x1045AA0, .rodata, ch/snowball] - [0x1045AD0, .rodata, code_5C240] @@ -1295,7 +1295,7 @@ segments: - [0x1046E10, .rodata, gc/sky] - [0x1046E20, .rodata, gc/transition] - [0x1046E80, .rodata, code_85800] - - [0x1046EA0, .rodata, code_87E30] + - [0x1046EA0, .rodata, gc/dialog] - [0x1046F10, .rodata, gc/pauseMenu] - [0x1047250, .rodata, gc/zoombox] - [0x1047320, .rodata, code_91E10] @@ -1375,7 +1375,7 @@ segments: - [0x1048560, .bss, code_1550] - [0x1048560, .bss, code_1930] - [0x1048560, .bss, ba/anim] - - [0x1048560, .bss, code_3480] + - [0x1048560, .bss, snackerctl] - [0x1048560, .bss, code_39D0] - [0x1048560, .bss, ba/marker] - [0x1048560, .bss, code_6B30] @@ -1516,7 +1516,7 @@ segments: - [0x1048560, .bss, code_581D0] - [0x1048560, .bss, ch/bottlesbonuscursor] - [0x1048560, .bss, code_59A80] - - [0x1048560, .bss, code_59D40] + - [0x1048560, .bss, ch/snacker] - [0x1048560, .bss, ch/snowball] - [0x1048560, .bss, code_5BEB0] - [0x1048560, .bss, code_5C240] @@ -1564,7 +1564,7 @@ segments: - [0x1048560, .bss, code_851D0] - [0x1048560, .bss, code_857B0] - [0x1048560, .bss, code_85800] - - [0x1048560, .bss, code_87E30] + - [0x1048560, .bss, gc/dialog] - [0x1048560, .bss, gc/pauseMenu] - [0x1048560, .bss, code_8DC20] - [0x1048560, .bss, gc/zoombox] diff --git a/include/enums.h b/include/enums.h index 3ec51450..b6e0fbf4 100644 --- a/include/enums.h +++ b/include/enums.h @@ -1537,8 +1537,8 @@ enum actor_e ACTOR_65_WADING_BOOTS = 0x65, ACTOR_67_SNIPPET = 0x67, - - ACTOR_69_CLAM = 0x69, + ACTOR_68_SNACKER, + ACTOR_69_CLAM, ACTOR_6D_GV_BANJO_DOOR = 0x6D, @@ -2262,7 +2262,7 @@ enum asset_e /* [0x74, 0x75] empty */ ASSET_76_ANIM_JIGSAWDANCE_HOLD = 0x76, ASSET_77_ANIM_BSTIMEOUT, - //ASSET_78 // snacker_swimming + ASSET_78_ANIM_SNACKER_SWIMMING, //ASSET_79 // Mumbo Concert Playing Instrument //ASSET_7A // Banjo Concert Angry //ASSET_7B // Banjo Concert Play @@ -2440,8 +2440,8 @@ enum asset_e ASSET_14A_ANIM_BSREST_LISTEN, ASSET_153_ANIM_BURIED_TREASURE_APPEAR = 0x153, - - ASSET_155_ANIM_CRAB_FLIP_UPRIGHT = 0x155, + ASSET_154_ANIM_SNACKER_EATING, + ASSET_155_ANIM_CRAB_FLIP_UPRIGHT, ASSET_156_ANIM_MUTANT_CRAB_WALK, ASSET_157_ANIM_MUTANT_CRAB_FLIP_UPSIDEDOWN, ASSET_158_ANIM_MUTANT_CRAB_UPSIDEDOWN, @@ -2544,7 +2544,10 @@ enum asset_e ASSET_256_ANIM_TERMITE_OW, ASSET_25B_ANIM_ACORN_IDLE = 0x25B, - + + ASSET_273_ANIM_SNACKER_HURT = 0x273, + ASSET_274_ANIM_SNACKER_DIE, + ASSET_281_ANIM_WISHYWASHY_DOOOH = 0x281, ASSET_282_ANIM_BSJIG_NOTEDOOR, @@ -2778,7 +2781,7 @@ enum asset_e ASSET_3AD_FIRE_SPARKLE = 0x3AD, ASSET_3AE_MODEL_GRAVE_FLOWER_POT, // 3af (Green Plank?) - // 3b0 Snacker + ASSET_3B0_SNACKER = 0x3B0, // 3b1 Concert Mumbo // 3b2 (Two Poles?) // 3b3 Mumbo's Hut @@ -4081,8 +4084,8 @@ enum marker_e{ MARKER_11_WADING_BOOTS = 0x11, MARKER_13_SNIPPET = 0x13, - - MARKER_15_CLAM = 0x15, + MARKER_14_SNACKER, + MARKER_15_CLAM, MARKER_28_CLANKER_SAWBLADE = 0x28, diff --git a/include/file_and_line.h b/include/file_and_line.h index a67656c6..06231717 100644 --- a/include/file_and_line.h +++ b/include/file_and_line.h @@ -15,7 +15,7 @@ extern void func_8033F000(const char *, const char *, int); #else #define FILE(file_name) "file_name" #endif - #define matching_assert(EX, F, L) assert(EX) + #ifdef __ANSI_CPP__ #define matching_assert(EX, F, L) ((EX)?((void)0):func_8033F000( # EX , # F, L)) #else diff --git a/include/gc/gc.h b/include/gc/gc.h index 9a4b3879..4ea14c0e 100644 --- a/include/gc/gc.h +++ b/include/gc/gc.h @@ -3,6 +3,5 @@ #include "gc/gcbound.h" #include "gc/gctransition.h" -#include "gc/gczoombox.h" #endif diff --git a/include/gc/gczoombox.h b/include/gc/gczoombox.h deleted file mode 100644 index f8dd39ce..00000000 --- a/include/gc/gczoombox.h +++ /dev/null @@ -1,212 +0,0 @@ -#ifndef GCZOOMBOX_H -#define GCZOOMBOX_H - -#include - -#include "structs.h" - -enum talk_pic_e { - TALK_PIC_0_GRUNTILDA_1, - TALK_PIC_1_VILE_1, - TALK_PIC_2_VILE_2, - TALK_PIC_3_VILE_3, - TALK_PIC_4_BANJO_1, - TALK_PIC_5_GRUNTILDA_2, - TALK_PIC_6_JIGGY_1, - TALK_PIC_7_TOOTY_1, - TALK_PIC_8_MUSIC_NOTE_1, - TALK_PIC_9_JIGGY_2, - TALK_PIC_A_EXTRA_HEALTH_MAX, - TALK_PIC_B_CLOCK, - TALK_PIC_C_BANJO_2, - TALK_PIC_D_KAZOOIE_1, - TALK_PIC_E_KAZOOIE_2, - TALK_PIC_F_BOTTLES, - TALK_PIC_10_MUMBO_1, - TALK_PIC_11_CHIMPY, - TALK_PIC_12_CONGA, - TALK_PIC_13_BLUBBER, - TALK_PIC_14_NIPPER, - TALK_PIC_15_CLANKER, - TALK_PIC_16_SNIPPET, - TALK_PIC_17_VILE_4, - TALK_PIC_18_TIPTUP, - TALK_PIC_19_TANKTUP, - TALK_PIC_1A_FLIBBIT, - TALK_PIC_1B_TRUNKER, - TALK_PIC_1C_RUBEE, - TALK_PIC_1D_GOBI, - TALK_PIC_1E_GRABBA, - TALK_PIC_1F_TEEHEE, - TALK_PIC_20_JINJO_YELLOW, - TALK_PIC_21_JINJO_GREEN, - TALK_PIC_22_JINJO_BLUE, - TALK_PIC_23_JINJO_PINK, - TALK_PIC_24_JINJO_ORANGE, - TALK_PIC_25_MUSIC_NOTE_2, - TALK_PIC_26_MUMBO_TOKEN, - TALK_PIC_27_BLUE_EGG, - TALK_PIC_28_RED_FEATHER, - TALK_PIC_29_GOLD_FEATHER, - TALK_PIC_2A_ORANGE, - TALK_PIC_2B_GOLD_BULLION, - TALK_PIC_2C_HONEYCOMB, - TALK_PIC_2D_EXTRA_HEALTH_MAX, - TALK_PIC_2E_EXTRA_LIFE, - TALK_PIC_2F_JIGGY_3, - TALK_PIC_30_EXTRA_HONEYCOMB, - TALK_PIC_31_CATERPILLAR, - TALK_PIC_32_WADING_BOOTS, - TALK_PIC_33_PIRANHA, - TALK_PIC_34_TERMITE, - TALK_PIC_35_JUJU, - TALK_PIC_36_YUMYUM, - TALK_PIC_37_LITTLE_LOCKUP, - TALK_PIC_38_LEAKY, - TALK_PIC_39_GLOOP, - TALK_PIC_3A_TIPTUP_CHOIR_MEMBER, - TALK_PIC_3B_SNACKER, - TALK_PIC_3C_ANCIENT_ONE, - TALK_PIC_3D_SAND_EEL, - TALK_PIC_3E_SNORKEL, - TALK_PIC_3F_JINXY, - TALK_PIC_40_CROCTUS, - TALK_PIC_41_GRUNTILDA_3, - TALK_PIC_42_TOOTY_2, - TALK_PIC_43_BOGGY, - TALK_PIC_44_WOZZA, - TALK_PIC_45_MOTZHAND, - TALK_PIC_46_TUMBLAR, - TALK_PIC_47_MUMMUM, - TALK_PIC_48_XMAS_GIFT_BLUE, - TALK_PIC_49_WORM, - TALK_PIC_4A_FREEZING_WATER, - TALK_PIC_4B_TWINKLY, - TALK_PIC_4C_TWINKLY_CHOMPER, - TALK_PIC_4D_GNAWTY, - TALK_PIC_4E_BOSS_BOOM_BOX, - TALK_PIC_4F_ZUBBA, - TALK_PIC_50_NABNUT, - TALK_PIC_51_POLAR_BEAR_CUBS, - TALK_PIC_52_YOUNG_EEYRIE_1, - TALK_PIC_53_YOUNG_EEYRIE_2, - TALK_PIC_54_YOUNG_EEYRIE_3, - TALK_PIC_55_ADULT_EEYRIE, - TALK_PIC_56_WARP_CAULDRON, - TALK_PIC_57_BRENTILDA, - TALK_PIC_58_TOOTY_3, - TALK_PIC_59_BLACK_SNIPPET, - TALK_PIC_5A_LOGGO, - TALK_PIC_5B_CHEATO, - TALK_PIC_5C_XMAS_GIFT_GREEN, - TALK_PIC_5D_KLUNGO, - TALK_PIC_5E_SEXY_GRUNTY, - TALK_PIC_5F_TOOTY_4, - TALK_PIC_60_BANJO_3, - TALK_PIC_61_KAZOOIE_3, - TALK_PIC_62_TOOTY_5, - TALK_PIC_63_DINGPOT, - TALK_PIC_64_CROC_BANJO, - TALK_PIC_65_GRUNTILDA_4, - TALK_PIC_66_LOCKUP, - TALK_PIC_67_VILE_5, - TALK_PIC_68_VILE_6, - TALK_PIC_69_VILE_7 -}; - -typedef struct { - u8 unk0[0x30]; //string1 - u8 unk30[0x30]; //string2 - u8 unk60[0x30]; - u8 unk90[0x20]; - u8 unkB0[0x40]; - BKModelBin *model; - AnimCtrl *anim_ctrl; - BKSprite *unkF8; - BKSpriteDisplayData *unkFC; - BKSprite *unk100; - BKSpriteDisplayData *unk104; - u8 unk108[5]; //sfx_ids - u8 pad10D[3]; - f32 unk110[5]; //sfx_??? - s16 unk124[5]; //sfx_??? - s16 unk12E; - void (*unk130)(s32, s32); - u8 unk134; - u8 state; - u8 portrait_id; //0x136 - u8 unk137; //string_cnt - u8 unk138; //current_string - u8 unk139; - u8 unk13A; - u8 sfx_count; - char *raw_str[8]; //string_ptrs - u8 unk15C; - u8 unk15D; - u8 unk15E; - u8 pad15F[0x1]; - u8 *unk160; - s16 unk164; - s16 unk166; //top_transparency??? - s16 unk168; //rgb??? - s16 unk16A; //x_pos - s16 unk16C; //y1_pos - s16 unk16E; //y2_pos - s16 unk170; - s16 unk172; - s16 unk174; - s8 unk176; - s8 unk177; - s8 unk178; - s8 unk179; - u8 pad17A[0x2]; - f32 unk17C; - s8 unk180; - s8 unk181; - u8 unk182; - u8 unk183; - u8 unk184; - u8 unk185; - s8 unk186; - u8 unk187; - u8 frame_count; //sprite frame count - u8 unk189; - u8 unk18A; - u8 prev_sfx; //next_sfx - f32 unk18C; - f32 unk190; - f32 unk194; - f32 unk198; - f32 unk19C; - f32 unk1A0; - u32 unk1A4_31:1; - u32 unk1A4_30:1; - u32 unk1A4_29:1; - u32 unk1A4_28:1; - u32 unk1A4_27:1; - u32 unk1A4_26:1; - u32 unk1A4_25:1; - u32 unk1A4_24:1; - u32 unk1A4_23:1; - u32 unk1A4_22:1; - u32 unk1A4_21:1; - u32 unk1A4_20:1; - u32 unk1A4_19:1; - u32 unk1A4_18:1; //highlighted - u32 unk1A4_17:1; - u32 unk1A4_16:1; - u32 unk1A4_15:1; - u32 unk1A4_14:1; - u32 unk1A4_13:1; - u32 unk1A4_12:1; - u32 unk1A4_11:1; - u32 unk1A4_10:1; - u32 pad1A4_9:10; -}gczoombox_t; //size 0x1A8 - - -void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr); -void gczoombox_free(gczoombox_t* this); -gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e arg1, s32 arg2, s32 arg3, void (*arg4)(s32, s32)); - -#endif diff --git a/include/math.h b/include/math.h index ee66ae46..95e8fe93 100644 --- a/include/math.h +++ b/include/math.h @@ -3,4 +3,4 @@ #define SQ(x) ((x)*(x)) -#endif // __BANJO_KAZOOIE_MATH_H__ \ No newline at end of file +#endif // __BANJO_KAZOOIE_MATH_H__ diff --git a/src/core1/code_18350.c b/src/core1/code_18350.c index 15d2d3a7..336d2147 100644 --- a/src/core1/code_18350.c +++ b/src/core1/code_18350.c @@ -2,8 +2,6 @@ #include "functions.h" #include "variables.h" -#define BAD_DTOR (BAD_PI/180.0) - /* .data*/ u32 D_80276CB0 = 0xD22FFFD8; //WHAT IS THIS? u32 D_80276CB4 = 0xDEFEF692; //WHAT IS THIS? diff --git a/src/core1/code_3A70.c b/src/core1/code_3A70.c index de7c0f9e..ae7db6d3 100644 --- a/src/core1/code_3A70.c +++ b/src/core1/code_3A70.c @@ -18,7 +18,7 @@ Gfx D_80275880[] = { }; /* .code */ -void func_80241490(Gfx **gfx, Vtx **vtx, s32 *arg2[3], s32 arg3[3], s32 arg4[3], s32 arg5[3], s32 arg6, s32 arg7) { +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]; s32 var_a0; s32 var_v0; diff --git a/src/core1/code_660.c b/src/core1/code_660.c index 950442d9..f532f549 100644 --- a/src/core1/code_660.c +++ b/src/core1/code_660.c @@ -65,6 +65,7 @@ u32 D_8027BF2C; //crc1 u32 D_8027BF30; //crc2 u32 D_8027BF34; //hufts +static int _rarezip_inflate(u8 * src, u8 * dst, struct huft * arg2); /* .code */ s32 rarezip_get_uncompressed_size(u8 *arg0) { diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index b4ee783e..77b0b210 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -2,16 +2,17 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" #include "core2/modelRender.h" +#include "../gc/zoombox.h" +#include "../code_C9E70.h" + #ifndef ABS #define ABS(d) ((d) >= 0) ? (d) : -(d) #endif void func_8031FBF8(void); void func_8031FBA0(void); -void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); Actor *func_802C4360(ActorMarker *, Gfx **, Mtx **, Vtx **); Actor *func_802C4464(ActorMarker *, Gfx **, Mtx **, Vtx **); @@ -100,8 +101,8 @@ struct { } D_8037DCE0; s32 D_8037DCE8; s32 D_8037DCEC; -gczoombox_t *chGameSelectTopZoombox; -gczoombox_t *chGameSelectBottomZoombox; +GcZoombox *chGameSelectTopZoombox; +GcZoombox *chGameSelectBottomZoombox; f32 D_8037DCF8[2][3]; f32 D_8037DD10[2][3]; s32 D_8037DD28; @@ -241,7 +242,7 @@ void func_802C4768(s32 gamenum){ sp20[0] = D_8037DD48;\ sp20[1] = D_8037DD68; func_8031877C(chGameSelectBottomZoombox); - func_80318284(chGameSelectBottomZoombox, 2, sp20); + gczoombox_setStrings(chGameSelectBottomZoombox, 2, sp20); gczoombox_maximize(chGameSelectBottomZoombox); gczoombox_resolve_minimize(chGameSelectBottomZoombox); } @@ -397,7 +398,7 @@ void func_802C4C14(Actor *this){ } subaddie_set_state(this, 2); func_8031877C(chGameSelectTopZoombox); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; } break; @@ -523,7 +524,7 @@ void func_802C4C14(Actor *this){ D_8037DD34 += sp50; if(20.0 < D_8037DD34){ func_8031877C(chGameSelectTopZoombox); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); D_8037DD34 = 0.0f; } } @@ -557,14 +558,14 @@ void func_802C5740(Actor * this){ if(!this->initialized){ gameFile_8033CE40(); if(chGameSelectBottomZoombox == NULL){ - chGameSelectBottomZoombox = gczoombox_new(0xA0, TALK_PIC_C_BANJO_2, 2, 0, NULL); + chGameSelectBottomZoombox = gczoombox_new(0xA0, ZOOMBOX_SPRITE_C_BANJO_2, 2, 0, NULL); gczoombox_open(chGameSelectBottomZoombox); func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0); }//L802C57FC if(chGameSelectTopZoombox == NULL){ - chGameSelectTopZoombox = gczoombox_new(0xA, TALK_PIC_D_KAZOOIE_1, 2, 1, func_802C44D0); - func_80318284(chGameSelectTopZoombox, 2, &D_8037DCE0); + chGameSelectTopZoombox = gczoombox_new(0xA, ZOOMBOX_SPRITE_D_KAZOOIE_1, 2, 1, func_802C44D0); + gczoombox_setStrings(chGameSelectTopZoombox, 2, &D_8037DCE0); gczoombox_open(chGameSelectTopZoombox); gczoombox_maximize(chGameSelectTopZoombox); }//L802C5860 diff --git a/src/core2/ch/gravestone.c b/src/core2/ch/gravestone.c index 69a08929..06f79c1b 100644 --- a/src/core2/ch/gravestone.c +++ b/src/core2/ch/gravestone.c @@ -5,7 +5,7 @@ Actor *func_8035ECA0(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); void func_8035F138(Actor *this); -extern bool func_803257B4(ActorMarker *marker); +BKModelBin *func_803257B4(ActorMarker *marker); extern void actor_postdrawMethod(ActorMarker *); extern f32 func_80257204(f32, f32, f32, f32); diff --git a/src/core2/code_59D40.c b/src/core2/ch/snacker.c similarity index 51% rename from src/core2/code_59D40.c rename to src/core2/ch/snacker.c index 48fcbd18..508d7e0a 100644 --- a/src/core2/code_59D40.c +++ b/src/core2/ch/snacker.c @@ -2,46 +2,65 @@ #include "functions.h" #include "variables.h" +#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); -typedef struct { - s32 unk0; - s32 unk4; //opacity - f32 unk8; -}ActorLocal_core2_59D40; +typedef enum { + CH_SNACKER_OPA_0_APPEAR, + CH_SNACKER_OPA_1_ACTIVE, + CH_SNACKER_OPA_2_FADE +} ChSnackerOpacityState; +typedef enum { + CH_SNACKER_STATE_1 = 1, + CH_SNACKER_STATE_2, + CH_SNACKER_STATE_3, + CH_SNACKER_STATE_4, + CH_SNACKER_STATE_5_EATING, + CH_SNACKER_STATE_6, + CH_SNACKER_STATE_7, + CH_SNACKER_STATE_8_HURT, + CH_SNACKER_STATE_9_DEAD +} ChSnackerState; + +typedef struct { + s32 ctl; //ChSnackerControl + s32 opa; //opacity + f32 unk8; +}ChSnackerLocal; void chsnacker_update(Actor *this); /* .data */ -ActorAnimationInfo D_803685D0[] ={ +ActorAnimationInfo sChSnackerAnimations[] ={ {0x000, 0.0f}, - {0x078, 2.0f}, - {0x078, 1.0f}, - {0x078, 0.4f}, - {0x078, 0.4f}, - {0x154, 1.1f}, - {0x078, 0.4f}, - {0x078, 1.0f}, - {0x273, 0.53f}, - {0x274, 1.09f} + {ASSET_78_ANIM_SNACKER_SWIMMING, 2.0f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 1.0f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_154_ANIM_SNACKER_EATING, 1.1f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 0.4f}, + {ASSET_78_ANIM_SNACKER_SWIMMING, 1.0f}, + {ASSET_273_ANIM_SNACKER_HURT, 0.53f}, + {ASSET_274_ANIM_SNACKER_DIE, 1.09f} }; -ActorInfo D_80368620 = { - 0x14, 0x68, 0x3B0, - 0x1, D_803685D0, +ActorInfo gChSnacker = { + MARKER_14_SNACKER, ACTOR_68_SNACKER, ASSET_3B0_SNACKER, + 0x1, sChSnackerAnimations, chsnacker_update, func_80326224, actor_draw, 0, 0, 0.0f, 0 }; /* .bss */ -ActorMarker *D_8037E620; -f32 D_8037E624; -f32 D_8037E628; -s32 D_8037E62C; +ActorMarker *s_chSnacker_marker; +f32 s_chSnacker_spawnTimer; +f32 s_chSnacker_respawnDelay_s; +s32 s_chSnacker_inRbb; s32 D_8037E630; /* .code */ @@ -49,9 +68,9 @@ void func_802E0CD0(Actor *this){ this->unk28 = 4.0f; } -void func_802E0CE0(Actor *this) { - ActorLocal_core2_59D40 *local = (ActorLocal_core2_59D40 *)&this->local; - s32 temp_v0; +static void __chsnacker_start_dialog(Actor *this) { + ChSnackerLocal *local = (ChSnackerLocal *)&this->local; + s32 text_index; if (this->unk38_31 != 0) { this->unk38_31--; @@ -59,12 +78,12 @@ void func_802E0CE0(Actor *this) { else{ this->unk28 = 0.0f; if (level_get() == LEVEL_2_TREASURE_TROVE_COVE) { - temp_v0 = mapSpecificFlags_getN(8, 3); + text_index = mapSpecificFlags_getN(8, 3); if( !this->unk138_24 ) { - if(temp_v0 < 4) { - if(func_80311480(0xA1B + temp_v0, 0, NULL, NULL, NULL, NULL)){ - temp_v0++; - mapSpecificFlags_setN(8, temp_v0, 3); + if(text_index < 4) { + if(func_80311480(0xA1B + text_index, 0, NULL, NULL, NULL, NULL)){ + text_index++; + mapSpecificFlags_setN(8, text_index, 3); this->unk138_24 = TRUE; } } @@ -74,13 +93,13 @@ void func_802E0CE0(Actor *this) { } } -bool func_802E0DC0(f32 arg0[3]){ - f32 sp2C[3]; +bool func_802E0DC0(f32 snacker_position[3]){ + f32 player_position[3]; f32 pad0; - player_getPosition(sp2C); - return (4000000.0f < ml_distanceSquared_vec3f(sp2C, arg0)) - || ( (arg0[1] - func_80309724(arg0) < 70.0f) && (func_80309B24(arg0) - arg0[1] < 70.0f)); + player_getPosition(player_position); + return (4000000.0f < ml_distanceSquared_vec3f(player_position, snacker_position)) + || ( (snacker_position[1] - func_80309724(snacker_position) < 70.0f) && (func_80309B24(snacker_position) - snacker_position[1] < 70.0f)); } void func_802E0E88(Actor *this){ @@ -91,33 +110,33 @@ void func_802E0E88(Actor *this){ void func_802E0EC8(void){ Actor *this; - ActorLocal_core2_59D40 *local; + ChSnackerLocal *local; - this = marker_getActor(D_8037E620); - local = (ActorLocal_core2_59D40 *)&this->local; + this = marker_getActor(s_chSnacker_marker); + local = (ChSnackerLocal *)&this->local; actor_collisionOff(this); - D_8037E620->propPtr->unk8_3 = FALSE; - if(local->unk0 != 2){ + s_chSnacker_marker->propPtr->unk8_3 = FALSE; + if(local->ctl != CH_SNACKER_OPA_2_FADE){ func_8032BB88(this, -1, 750); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0, 750); func_8025AABC(COMUSIC_34_SNACKER_DANGER); - local->unk0 = 2; + local->ctl = CH_SNACKER_OPA_2_FADE; } } -void func_802E0F60(ActorMarker *marker, ActorMarker *other){ +static void __chsnacker_die(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); actor_collisionOff(this); FUNC_8030E8B4(SFX_179_GRUNTY_DAMAGE, 0.6f, 32750, this->position, 300, 3000); - subaddie_set_state_with_direction(this, 9, 0.0f, 1); + subaddie_set_state_with_direction(this, CH_SNACKER_STATE_9_DEAD, 0.0f, 1); actor_playAnimationOnce(this); } void func_802E0FC4(Actor *this){ - D_8037E620 = NULL; + s_chSnacker_marker = NULL; D_8037E630 = this->unk166; if(func_8025AD7C(COMUSIC_34_SNACKER_DANGER)){ func_8025AABC(COMUSIC_34_SNACKER_DANGER); @@ -133,7 +152,7 @@ void func_802E1010(ActorMarker *marker, ActorMarker *other){ actor_playAnimationOnce(this); } -void func_802E1050(ActorMarker *marker, ActorMarker *other){ +static void __chsnacker_ow(ActorMarker *marker, ActorMarker *other){ Actor *this; this = marker_getActor(marker); @@ -159,29 +178,29 @@ f32 func_802E10F0(f32 arg0) { } void chsnacker_update(Actor *this) { - f32 sp5C; - ActorLocal_core2_59D40 *local; - s32 sp54; + f32 dt; + ChSnackerLocal *local; + SnackerCtlState controller_state; f32 player_position[3]; f32 sp44; f32 sp40; s32 tmp; - sp5C = time_getDelta(); - local = (ActorLocal_core2_59D40 *)&this->local; + dt = time_getDelta(); + local = (ChSnackerLocal *)&this->local; if (!this->initialized) { this->initialized = TRUE; this->marker->propPtr->unk8_3 = TRUE; this->unk138_25 = TRUE; this->unk154 = 0x085E0000; - marker_setCollisionScripts(this->marker, func_802E1050, func_802E1010, func_802E0F60); + marker_setCollisionScripts(this->marker, __chsnacker_ow, func_802E1010, __chsnacker_die); } _player_getPosition(player_position); - sp54 = func_8028A94C(); + controller_state = snackerctl_get_state(); - if(func_802E0DC0(this->position) || ((sp54 != 1) && (sp54 != 2))) { - local->unk8 = MIN(3.5, local->unk8 + sp5C); + if(func_802E0DC0(this->position) || ((controller_state != SNACKER_CTL_STATE_1_RBB) && (controller_state != SNACKER_CTL_STATE_2_TTC))) { + local->unk8 = MIN(3.5, local->unk8 + dt); if (local->unk8 == 3.5) { func_802E0EC8(); } @@ -194,18 +213,18 @@ void chsnacker_update(Actor *this) { if (subaddie_maybe_set_state_position_direction(this, 2, 0.0f, 1, 0.03f) != 0) { func_802E0CD0(this); } - func_802E0CE0(this); + __chsnacker_start_dialog(this); break; case 2: //802E130C func_80328FB0(this, 3.0f); func_80328FF0(this, 3.0f); - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); if (func_80329480(this) != 0) { func_80328CEC(this, (s32) this->yaw, 0x5A, 0x96); } subaddie_maybe_set_state_position_direction(this, 1, 0.0f, 1, 0.0075f); - func_802E0CE0(this); + __chsnacker_start_dialog(this); break; case 3: //802E13AC @@ -226,11 +245,11 @@ void chsnacker_update(Actor *this) { this->unk6C = func_802E10F0(sp44); func_80328FB0(this, this->unk28 / 2); func_80328FF0(this, this->unk28 / 2); - this->unk28 = MIN(50.0, this->unk28 + sp5C); - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + this->unk28 = MIN(50.0, this->unk28 + dt); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); break; - case 5: //802E14F8 + case CH_SNACKER_STATE_5_EATING: //802E14F8 if (actor_animationIsAt(this, 0.25f)) { FUNC_8030E8B4(SFX_6D_CROC_BITE, 1.0f, 28000, this->position, 300, 3000); } @@ -241,10 +260,10 @@ void chsnacker_update(Actor *this) { subaddie_set_state_with_direction(this, 2, 0.0f, 1); actor_loopAnimation(this); } - func_8032CA80(this, (D_8037E62C) ? 15 : 9); + func_8032CA80(this, (s_chSnacker_inRbb) ? 15 : 9); break; - case 8: //802E15BC + case CH_SNACKER_STATE_8_HURT: //802E15BC if (animctrl_isStopped(this->animctrl)) { func_802E0CD0(this); subaddie_set_state_with_direction(this, 2, 0.0f, 1); @@ -252,9 +271,9 @@ void chsnacker_update(Actor *this) { } break; - case 9: //802E15FC + case CH_SNACKER_STATE_9_DEAD: //802E15FC if (animctrl_isStopped(this->animctrl)) { - D_8037E628 = 60.0f; + s_chSnacker_respawnDelay_s = 60.0f; D_8037E630 = 0x63; func_802E0EC8(); } @@ -263,111 +282,111 @@ void chsnacker_update(Actor *this) { break; }//L802E1630 - local = (ActorLocal_core2_59D40 *)&this->local; - switch(local->unk0){ - case 0: - local->unk4 = MIN(0xFF, local->unk4 + 8); - if(local->unk4 >= 0x81){ + local = (ChSnackerLocal *)&this->local; + switch(local->ctl){ + case CH_SNACKER_OPA_0_APPEAR: + local->opa = MIN(0xFF, local->opa + 8); + if(local->opa >= 0x81){ this->marker->collidable = TRUE; } - if (local->unk4 == 0xFF) { - local->unk0 = 1; + if (local->opa == 0xFF) { + local->ctl = CH_SNACKER_OPA_1_ACTIVE; } break; - case 1: + case CH_SNACKER_OPA_1_ACTIVE: break; - case 2: - local->unk4 = MAX(0, local->unk4 - 8); - if(local->unk4 < 0x80){ + case CH_SNACKER_OPA_2_FADE: + local->opa = MAX(0, local->opa - 8); + if(local->opa < 0x80){ this->marker->collidable = FALSE; } - if (local->unk4 == 0) { + if (local->opa == 0) { marker_despawn(this->marker); } break; } - actor_setOpacity(this, local->unk4); - this->depth_mode = (255.0 == local->unk4) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; + actor_setOpacity(this, local->opa); + this->depth_mode = (255.0 == local->opa) ? MODEL_RENDER_DEPTH_FULL : MODEL_RENDER_DEPTH_COMPARE; } -void func_802E1790(void){ - D_8037E624 = 0.0f; - D_8037E628 = 1.0f; - D_8037E620 = NULL; - D_8037E62C = (level_get() == LEVEL_9_RUSTY_BUCKET_BAY); +void chSnacker_initialize(void){ + s_chSnacker_spawnTimer = 0.0f; + s_chSnacker_respawnDelay_s = 1.0f; + s_chSnacker_marker = NULL; + s_chSnacker_inRbb = (level_get() == LEVEL_9_RUSTY_BUCKET_BAY); D_8037E630 = 0x63; } -void func_802E17E8(void) { +void chSnacker_spawn(void) { Actor *snacker; - f32 sp50[3]; - f32 sp4C; - ActorLocal_core2_59D40 *local; + f32 spawn_position[3]; + f32 spawn_angle_rad; + ChSnackerLocal *local; s32 pad; f32 sp38[3]; f32 sp2C[3]; f32 sp20[3]; - _player_getPosition(sp50); + _player_getPosition(spawn_position); if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) != 0) { - nodeprop_getPosition(func_80304CAC(0x3CB, sp50), sp50); + nodeprop_getPosition(func_80304CAC(0x3CB, spawn_position), spawn_position); } else{ - sp4C = randf2(0.0f, 3.28f); - sp50[0] += 1000.0 * cosf(sp4C); - sp50[2] += 1000.0 * sinf(sp4C); + spawn_angle_rad = randf2(0.0f, 3.28f); + spawn_position[0] += 1000.0 * cosf(spawn_angle_rad); + spawn_position[2] += 1000.0 * sinf(spawn_angle_rad); - sp38[0] = sp50[0]; - sp38[1] = sp50[1]; - sp38[2] = sp50[2]; + sp38[0] = spawn_position[0]; + sp38[1] = spawn_position[1]; + sp38[2] = spawn_position[2]; sp38[1] += 1000.0f; - sp2C[0] = sp50[0]; - sp2C[1] = sp50[1]; - sp2C[2] = sp50[2]; + sp2C[0] = spawn_position[0]; + sp2C[1] = spawn_position[1]; + sp2C[2] = spawn_position[2]; sp2C[1] -= 1000.0f; if (func_80309B48(sp38, sp2C, sp20, 0xF800FF0F)) { - sp50[1] = sp2C[1] - 60.0f; + spawn_position[1] = sp2C[1] - 60.0f; } else{ return; } } - snacker = func_8032813C(0x68, sp50, 0); - D_8037E620 = snacker->marker; + snacker = func_8032813C(ACTOR_68_SNACKER, spawn_position, 0); + s_chSnacker_marker = snacker->marker; - local = (ActorLocal_core2_59D40 *)&snacker->local; + local = (ChSnackerLocal *)&snacker->local; snacker->unk166 = (s8) D_8037E630; - local->unk0 = 0; - local->unk4 = 0; + local->ctl = CH_SNACKER_OPA_0_APPEAR; + local->opa = 0; local->unk8 = 0.0f; - marker_setFreeMethod(D_8037E620, func_802E0FC4); - if (func_8032CA80(snacker, D_8037E62C ? 0x10 : 0xC)) { - marker_despawn(D_8037E620); + marker_setFreeMethod(s_chSnacker_marker, func_802E0FC4); + if (func_8032CA80(snacker, s_chSnacker_inRbb ? 0x10 : 0xC)) { + marker_despawn(s_chSnacker_marker); return; } if (func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE) == 0) { func_8032BB88(snacker, 5000, 750); func_8024BD08(0); - func_8025A6EC(0x34, 0); + func_8025A6EC(COMUSIC_34_SNACKER_DANGER, 0); comusic_8025AB44(COMUSIC_34_SNACKER_DANGER, 0x7FFF, 750); func_8024BD08(1); } - D_8037E624 = 0.0f; - func_8032CA80(snacker, D_8037E62C ? 15 : 9); + s_chSnacker_spawnTimer = 0.0f; + func_8032CA80(snacker, s_chSnacker_inRbb ? 15 : 9); } -void func_802E1A04(s32 nextState) { - f32 sp1C; +void chsnacker_setControlState(SnackerCtlState control_state) { + f32 dt; - sp1C = time_getDelta(); + dt = time_getDelta(); if( getGameMode() == GAME_MODE_A_SNS_PICTURE || getGameMode() == GAME_MODE_5_UNKNOWN @@ -376,11 +395,11 @@ void func_802E1A04(s32 nextState) { return; } - if ((D_8037E620 == NULL)) { - D_8037E624 += sp1C; - if ((D_8037E628 < D_8037E624) && (nextState != 0)) { - __spawnQueue_add_0(func_802E17E8); - D_8037E628 = 1.0f; + if ((s_chSnacker_marker == NULL)) { + s_chSnacker_spawnTimer += dt; + if ((s_chSnacker_respawnDelay_s < s_chSnacker_spawnTimer) && (control_state != SNACKER_CTL_STATE_0_INACTIVE)) { + __spawnQueue_add_0(chSnacker_spawn); + s_chSnacker_respawnDelay_s = 1.0f; } } } diff --git a/src/core2/ch/snacker.h b/src/core2/ch/snacker.h new file mode 100644 index 00000000..8fb961ad --- /dev/null +++ b/src/core2/ch/snacker.h @@ -0,0 +1,12 @@ +#ifndef __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ +#define __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ + +#include "prop.h" // for ActorInfo +#include "../snackerctl.h" //for SnackerCtlState + +extern ActorInfo gChSnacker; + +void chSnacker_initialize(void); +void chsnacker_setControlState(SnackerCtlState nextState); + +#endif // __BANJO_KAZOOIE_CORE2_CH_SNACKER_H__ diff --git a/src/core2/code_47BD0.c b/src/core2/code_47BD0.c index fee020d4..ea58338c 100644 --- a/src/core2/code_47BD0.c +++ b/src/core2/code_47BD0.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "code_C9E70.h" extern void func_8030DBFC(u32, f32, f32, f32); extern bool func_80309DBC(f32[3], f32[3], f32, f32 sp54[3], s32, s32); @@ -40,7 +40,8 @@ Actor *chBeeSwarm_draw(ActorMarker *marker, Gfx **gfx, Mtx **mtx, Vtx **vtx); /* .data */ -ActorInfo D_80367310 = {MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPRITE_BEE_SWARM, +ActorInfo D_80367310 = { + MARKER_217_BEE_SWARM, ACTOR_34D_BEE_SWARM, ASSET_49E_SPRITE_BEE_SWARM, 1, NULL, chBeeSwarm_update, NULL, chBeeSwarm_draw, 0, 0, 1.0f, 0 @@ -307,8 +308,8 @@ void chBeeSwarm_update(Actor *this) { Actor *beehive; ActorLocal_core2_47BD0 *local = (ActorLocal_core2_47BD0 *)&this->local; f32 spB4[3]; - f32 spB0; - f32 spAC; + f32 distance_to_home; + f32 dt; f32 spA0[3]; f32 position[3]; f32 next_position[3]; @@ -317,13 +318,13 @@ void chBeeSwarm_update(Actor *this) { f32 temp_f0; f32 sp68[3]; - spAC = time_getDelta(); + dt = time_getDelta(); sp78 = 0; if (!this->initialized) { this->initialized = TRUE; - beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &spB0); + beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); this->unk100 = (beehive != NULL) ? beehive->marker : NULL; - if(500.0f < spB0){ + if(500.0f < distance_to_home){ this->unk100 = NULL; } sp78 = 1; @@ -359,13 +360,13 @@ void chBeeSwarm_update(Actor *this) { actor_collisionOff(this); local->unk20 = assetcache_get(ASSET_3BF_MODEL_PLAYER_SHADOW); if (sp78 == 0) { - beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &spB0); + beehive = actorArray_findClosestActorFromActorId(this->position, ACTOR_12_BEEHIVE, -1, &distance_to_home); if (beehive != NULL) { this->unk100 = beehive->marker; } else { this->unk100 = NULL; } - if (spB0 > 500.0f) { + if (distance_to_home > 500.0f) { this->unk100 = NULL; } } @@ -399,9 +400,9 @@ void chBeeSwarm_update(Actor *this) { position[0] = this->position[0]; position[1] = this->position[1]; position[2] = this->position[2]; - next_position[0] = this->position[0] + (this->velocity[0] * spAC); - next_position[1] = this->position[1] + (this->velocity[1] * spAC); - next_position[2] = this->position[2] + (this->velocity[2] * spAC); + next_position[0] = this->position[0] + (this->velocity[0] * dt); + next_position[1] = this->position[1] + (this->velocity[1] * dt); + next_position[2] = this->position[2] + (this->velocity[2] * dt); if (this->state != 7) { if (func_80309DBC(position, next_position, 75.0f, sp7C, 3, 0)) { ml_vec3f_normalize(sp7C); @@ -478,7 +479,7 @@ void chBeeSwarm_update(Actor *this) { break; case 4: spB4[1] += 50.0f; - this->unk60 += spAC; + this->unk60 += dt; if ((this->unk60 - 0.5 > 0.0) && (local->unk0 > 0) && (func_8028ECAC() != 3)) { func_8028F504(0xD); this->unk60 -= 0.5; diff --git a/src/core2/code_7060.c b/src/core2/code_7060.c index 5da4b72a..a16103c3 100644 --- a/src/core2/code_7060.c +++ b/src/core2/code_7060.c @@ -9,6 +9,8 @@ #include "core2/ba/drone.h" #include "core2/ba/physics.h" +#include "snackerctl.h" + extern bool player_isInHorizontalRadius(f32[3], f32); extern bool player_isInVerticalRange(f32[3], f32); extern void miscflag_clear(s32); @@ -817,7 +819,7 @@ void func_8028F800(s32 arg0[3]){ void func_8028F85C(f32 arg0[3]){ func_80298464(arg0); func_80293F0C(); - func_8028A8D0(); + snackerctl_update(); func_8028B71C(); func_80290B6C(); cameraMode_update(); diff --git a/src/core2/code_91E10.c b/src/core2/code_91E10.c index 2102f877..3a44f4a6 100644 --- a/src/core2/code_91E10.c +++ b/src/core2/code_91E10.c @@ -2,9 +2,10 @@ #include "functions.h" #include "variables.h" +#include "gc/zoombox.h" + extern void item_set(enum item_e, s32); extern void func_8025A55C(s32, s32, s32); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, bool, bool); typedef struct { @@ -47,7 +48,7 @@ typedef struct { u8 unk18[4]; s8 unk1C[4]; s8 unk20[4]; //portrait_id - gczoombox_t *unk24[4]; //zoombox + GcZoombox *unk24[4]; //zoombox Struct_Core2_91E10_1 unk34; }Struct_Core2_91E10; @@ -57,50 +58,50 @@ void func_8031A3E4(void); u8 D_8036D940[] = { 0, - TALK_PIC_11_CHIMPY, - TALK_PIC_12_CONGA, - TALK_PIC_13_BLUBBER, - TALK_PIC_14_NIPPER, - TALK_PIC_15_CLANKER, - TALK_PIC_16_SNIPPET, - TALK_PIC_17_VILE_4, - TALK_PIC_18_TIPTUP, - TALK_PIC_19_TANKTUP, - TALK_PIC_1A_FLIBBIT, - TALK_PIC_1B_TRUNKER, - TALK_PIC_1C_RUBEE, - TALK_PIC_1D_GOBI, - TALK_PIC_1E_GRABBA, - TALK_PIC_1F_TEEHEE, - TALK_PIC_3B_SNACKER, - TALK_PIC_3C_ANCIENT_ONE, - TALK_PIC_43_BOGGY, - TALK_PIC_44_WOZZA, - TALK_PIC_5B_CHEATO, - TALK_PIC_64_CROC_BANJO, - TALK_PIC_35_JUJU, - TALK_PIC_34_TERMITE, - TALK_PIC_38_LEAKY, - TALK_PIC_37_LITTLE_LOCKUP, - TALK_PIC_59_BLACK_SNIPPET, - TALK_PIC_39_GLOOP, - TALK_PIC_40_CROCTUS, - TALK_PIC_33_PIRANHA, - TALK_PIC_4B_TWINKLY, - TALK_PIC_4C_TWINKLY_CHOMPER, - TALK_PIC_3F_JINXY, - TALK_PIC_45_MOTZHAND, - TALK_PIC_5A_LOGGO, - TALK_PIC_3E_SNORKEL, - TALK_PIC_4E_BOSS_BOOM_BOX, - TALK_PIC_50_NABNUT, - TALK_PIC_55_ADULT_EEYRIE, - TALK_PIC_4D_GNAWTY, - TALK_PIC_4F_ZUBBA, - TALK_PIC_36_YUMYUM, - TALK_PIC_3D_SAND_EEL, - TALK_PIC_3A_TIPTUP_CHOIR_MEMBER, - TALK_PIC_67_VILE_5, + ZOOMBOX_SPRITE_11_CHIMPY, + ZOOMBOX_SPRITE_12_CONGA, + ZOOMBOX_SPRITE_13_BLUBBER, + ZOOMBOX_SPRITE_14_NIPPER, + ZOOMBOX_SPRITE_15_CLANKER, + ZOOMBOX_SPRITE_16_SNIPPET, + ZOOMBOX_SPRITE_17_VILE_4, + ZOOMBOX_SPRITE_18_TIPTUP, + ZOOMBOX_SPRITE_19_TANKTUP, + ZOOMBOX_SPRITE_1A_FLIBBIT, + ZOOMBOX_SPRITE_1B_TRUNKER, + ZOOMBOX_SPRITE_1C_RUBEE, + ZOOMBOX_SPRITE_1D_GOBI, + ZOOMBOX_SPRITE_1E_GRABBA, + ZOOMBOX_SPRITE_1F_TEEHEE, + ZOOMBOX_SPRITE_3B_SNACKER, + ZOOMBOX_SPRITE_3C_ANCIENT_ONE, + ZOOMBOX_SPRITE_43_BOGGY, + ZOOMBOX_SPRITE_44_WOZZA, + ZOOMBOX_SPRITE_5B_CHEATO, + ZOOMBOX_SPRITE_64_CROC_BANJO, + ZOOMBOX_SPRITE_35_JUJU, + ZOOMBOX_SPRITE_34_TERMITE, + ZOOMBOX_SPRITE_38_LEAKY, + ZOOMBOX_SPRITE_37_LITTLE_LOCKUP, + ZOOMBOX_SPRITE_59_BLACK_SNIPPET, + ZOOMBOX_SPRITE_39_GLOOP, + ZOOMBOX_SPRITE_40_CROCTUS, + ZOOMBOX_SPRITE_33_PIRANHA, + ZOOMBOX_SPRITE_4B_TWINKLY, + ZOOMBOX_SPRITE_4C_TWINKLY_CHOMPER, + ZOOMBOX_SPRITE_3F_JINXY, + ZOOMBOX_SPRITE_45_MOTZHAND, + ZOOMBOX_SPRITE_5A_LOGGO, + ZOOMBOX_SPRITE_3E_SNORKEL, + ZOOMBOX_SPRITE_4E_BOSS_BOOM_BOX, + ZOOMBOX_SPRITE_50_NABNUT, + ZOOMBOX_SPRITE_55_ADULT_EEYRIE, + ZOOMBOX_SPRITE_4D_GNAWTY, + ZOOMBOX_SPRITE_4F_ZUBBA, + ZOOMBOX_SPRITE_36_YUMYUM, + ZOOMBOX_SPRITE_3D_SAND_EEL, + ZOOMBOX_SPRITE_3A_TIPTUP_CHOIR_MEMBER, + ZOOMBOX_SPRITE_67_VILE_5, }; /* .bss */ @@ -332,7 +333,7 @@ bool func_803192A4(enum ff_question_type_e q_type, s32 q_indx, s32 arg2) { void func_803196D0(s32 arg0) { gczoombox_open(D_803830E0->unk24[arg0]); gczoombox_maximize(D_803830E0->unk24[arg0]); - func_80318284(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); + gczoombox_setStrings(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); } //__gcquiz_set_box_highlight @@ -368,7 +369,7 @@ void func_803197AC(s32 arg0){ case 1: //80319910 gczoombox_open(D_803830E0->unk24[0]); gczoombox_maximize(D_803830E0->unk24[0]); - func_80318284(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); + gczoombox_setStrings(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); break; case 2: //8031994C @@ -583,7 +584,7 @@ bool func_8031A22C(u8 *arg0, s8 *arg1, Struct_Core2_91E10_1 *arg2, s32 arg3, voi D_803830E0->unk1C[i] = i; } if (D_803830E0->unk20[0] != 0) { - func_803189C4(D_803830E0->unk24[0], D_803830E0->unk20[0]); + gczoombox_loadSprite(D_803830E0->unk24[0], D_803830E0->unk20[0]); } D_803830E0->unk0 = -1; D_803830E0->unk1 = -1; @@ -639,8 +640,8 @@ void func_8031A4CC(void) { if (D_803830E0 != NULL) { for(i = 0; i < 4; i++){ - func_80318C0C(D_803830E0->unk24[i]); - D_803830E0->unk24[i] = (gczoombox_t *)defrag(D_803830E0->unk24[i]); + gczoombox_defrag(D_803830E0->unk24[i]); + D_803830E0->unk24[i] = (GcZoombox *)defrag(D_803830E0->unk24[i]); } if (func_8031A3BC() == 0) { diff --git a/src/core2/code_9E370.c b/src/core2/code_9E370.c index d6a3fc0a..4bbeee08 100644 --- a/src/core2/code_9E370.c +++ b/src/core2/code_9E370.c @@ -195,7 +195,7 @@ void func_803257A4(ActorMarker *marker){ marker->unk14_21 = TRUE; } -bool func_803257B4(ActorMarker *marker) { +BKModelBin *func_803257B4(ActorMarker *marker) { Actor *actor; BKModelBin *model_bin; BKVertexList *vtx_list; @@ -209,7 +209,7 @@ bool func_803257B4(ActorMarker *marker) { assetcache_release(model_bin); } func_8033A4A0(marker->modelId, actor->unk174, actor->unk178); - return FALSE; + return NULL; } diff --git a/src/core2/code_C9E70.c b/src/core2/code_C9E70.c index 1522c47b..9340fe78 100644 --- a/src/core2/code_C9E70.c +++ b/src/core2/code_C9E70.c @@ -2,7 +2,7 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "code_C9E70.h" extern struct FF_StorageStruct *D_8037DCB8; @@ -13,8 +13,8 @@ void func_80350E00(void){ return; if(D_8037DCB8->unk20){ - func_80318C0C(D_8037DCB8->unk20); - D_8037DCB8->unk20 = (gczoombox_t *)defrag(D_8037DCB8->unk20); + gczoombox_defrag(D_8037DCB8->unk20); + D_8037DCB8->unk20 = (GcZoombox *)defrag(D_8037DCB8->unk20); } D_8037DCB8->unk48 = (struct FF_StorageStruct_48 *)defrag(D_8037DCB8->unk48); D_8037DCB8 = (struct FF_StorageStruct *) defrag(D_8037DCB8); diff --git a/include/core2/code_C9E70.h b/src/core2/code_C9E70.h similarity index 96% rename from include/core2/code_C9E70.h rename to src/core2/code_C9E70.h index bd6793e1..14269b9c 100644 --- a/include/core2/code_C9E70.h +++ b/src/core2/code_C9E70.h @@ -4,6 +4,8 @@ #include #include "structs.h" +#include "gc/zoombox.h" + typedef struct { s16 unk0[4]; u8 unk8; //FF_TileType @@ -68,7 +70,7 @@ struct FF_StorageStruct { // holds moves involved with the FFM glitch /* 1C */ u32 unlockedMoves; - /* 20 */ gczoombox_t *unk20; + /* 20 */ GcZoombox *unk20; /* 24 */ f32 playerPosition[3]; /* 30 */ f32 playerRotation[3]; diff --git a/src/core2/code_E910.c b/src/core2/code_E910.c index 7fb7d534..ca026660 100644 --- a/src/core2/code_E910.c +++ b/src/core2/code_E910.c @@ -5,7 +5,7 @@ #include "bs_funcs.h" #include "core2/statetimer.h" #include "core2/ba/physics.h" - +#include "snackerctl.h" u8 D_80363820 = 0; bsMap D_80363824[] ={ @@ -187,7 +187,7 @@ void func_80295914(void){ D_8037C3B0 = NULL; update_void_return_Location(); func_802983F0(); - snacker_reset(); + snackerctl_reset(); func_80291910(); badrone_init(); bafalldamage_init(); @@ -305,7 +305,7 @@ void func_80295C14(void){ func_8029842C(); baMarker_update(); bacarry_update(); - func_8028A8D0(); + snackerctl_update(); func_8028B71C(); func_8029D968(); func_80297CF8(); diff --git a/src/core2/code_87E30.c b/src/core2/gc/dialog.c similarity index 97% rename from src/core2/code_87E30.c rename to src/core2/gc/dialog.c index 739569a6..fe5881a6 100644 --- a/src/core2/code_87E30.c +++ b/src/core2/gc/dialog.c @@ -2,15 +2,10 @@ #include "functions.h" #include "variables.h" +#include "zoombox.h" extern void func_803114D0(void ); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); extern int func_803114B0(void); -extern void gczoombox_open(gczoombox_t *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); -extern void gczoombox_update(gczoombox_t *); -extern bool func_803188B4(gczoombox_t *); extern char *dialogBin_get(enum asset_e text_id); s8 D_8036C4D0[] = {1, 0x1E, 0x14, 0xF, 0xB, 8, 6, 4, 3, 2, -1, -1}; @@ -25,7 +20,7 @@ struct { s8 string_cmd[2]; //current_cmd u8 string_index[2]; //current_string_index struct15s unk11A[2]; - gczoombox_t *zoombox[2]; + GcZoombox *zoombox[2]; s16 unk124[2]; union{ struct { @@ -316,7 +311,7 @@ void gcdialog_setState(s32 next_state){ } -void func_8030F754(enum talk_pic_e portrait_id, s32 arg1){ +void func_8030F754(GcZoomboxSprite portrait_id, s32 arg1){ s32 temp_a0; s32 temp_v0; @@ -456,7 +451,7 @@ void gcdialog_update(void) { for(spA8 = g_Dialog.string_index[g_Dialog.u8.active_zoombox]; CMD2(spA8)->cmd < -4; spA8++); if (CMD2(spA8)->cmd >= 0) { - func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); + gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], CMD2(spA8)->cmd + 0xC); } if (g_Dialog.string_index[g_Dialog.u8.active_zoombox]) { gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); @@ -484,7 +479,7 @@ void gcdialog_update(void) { break; default: - if (!func_80316ED4(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { + if (!gczoombox_strlen(CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox])->str)) { g_Dialog.string_index[g_Dialog.u8.active_zoombox]++; } else { if (CMD(g_Dialog.string_index[g_Dialog.u8.active_zoombox] + 1)->cmd == -8) { @@ -546,7 +541,7 @@ void gcdialog_update(void) { } } - if (func_803189C4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { + if (gczoombox_loadSprite(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.string_cmd[g_Dialog.u8.active_zoombox] + 12)) { gczoombox_minimize(g_Dialog.zoombox[g_Dialog.u8.active_zoombox]); g_Dialog.unk128_6 = TRUE; } @@ -561,7 +556,7 @@ void gcdialog_update(void) { sp4C[spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox]] = CMD(spA8)->str; } - func_80318284(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); + gczoombox_setStrings(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], spA8 - g_Dialog.string_index[g_Dialog.u8.active_zoombox], sp4C); g_Dialog.string_index[g_Dialog.u8.active_zoombox] = spA8; } else { func_803183A4(g_Dialog.zoombox[g_Dialog.u8.active_zoombox], g_Dialog.output); @@ -1012,12 +1007,12 @@ void gcdialog_defrag(void){ s32 i; for(i = 0; i< 2; i++){ - func_80318C0C(g_Dialog.zoombox[i]); + gczoombox_defrag(g_Dialog.zoombox[i]); if(g_Dialog.string_list[i]){ g_Dialog.string_list[i] = (struct13s *)defrag(g_Dialog.string_list[i]); } if(g_Dialog.zoombox[i] != NULL){ - g_Dialog.zoombox[i] = (gczoombox_t *)defrag(g_Dialog.zoombox[i]); + g_Dialog.zoombox[i] = (GcZoombox *)defrag(g_Dialog.zoombox[i]); } } } diff --git a/src/core2/gc/parade.c b/src/core2/gc/parade.c index b3fccaf3..7200e258 100644 --- a/src/core2/gc/parade.c +++ b/src/core2/gc/parade.c @@ -2,7 +2,9 @@ #include "functions.h" #include "variables.h" -extern void func_8028A8D0(void); +#include "../snackerctl.h" + + extern void func_8028F918(s32); extern void func_80311714(int); extern void func_803204E4(s32, s32); @@ -285,7 +287,7 @@ void gcparade_update(void) { return; } if (func_803203FC(UNKFLAGS1_1F_IN_CHARACTER_PARADE) != 0) { - func_8028A8D0(); + snackerctl_update(); switch (D_803830F0.state) { case PARADE_STATE_3_WARP: if (D_803830F0.unk5 == 0) { @@ -315,7 +317,7 @@ void gcparade_update(void) { break; case PARADE_STATE_5_WAIT_ON_NAME: //name on screen (wait) gcparade_print(D_803830F0.indx); - return; + break; case PARADE_STATE_6_NAME_DISAPPEAR:// name scroll up off screen gcparade_print(D_803830F0.indx); D_803830F0.scroll_frame--; diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 3f732f71..5c5445bf 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -2,6 +2,8 @@ #include "functions.h" #include "variables.h" +#include "zoombox.h" + #ifndef MIN #define MIN(s,t) (((s) < t)?(s):(t)) #endif @@ -20,10 +22,6 @@ typedef struct struct_1A_s{ u8 unkF; }struct1As; -extern void func_803160A8(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_maximize(gczoombox_t *); extern void func_802C5994(void); extern void func_802E412C(s32, s32); void func_803204E4(s32, s32); @@ -32,18 +30,14 @@ void mlMtxApply(Mtx*); void func_80310D2C(void); s32 level_get(void); -void gczoombox_update(gczoombox_t *); void func_8024E6E0(s32, void *); void func_8024E60C(s32, void *); void func_8024E71C(s32, void *); s32 getGameMode(void); -void gczoombox_highlight(gczoombox_t *, int); void func_802DC5B8(void); void func_802DC560(s32, s32); s32 func_8024E67C(s32 controller_index); -bool func_803188B4(gczoombox_t*); -bool func_803183A4(gczoombox_t*, char *); bool fileProgressFlag_get(enum file_progress_e); enum map_e map_get(void); bool func_802FD2D4(void); @@ -54,10 +48,6 @@ extern void func_802DC528(s32,s32); extern void func_802F5060(enum asset_e); extern void func_802F5188(void); extern void func_802FACA4(enum item_e); -extern void func_803184C8(gczoombox_t *, f32, s32, s32, f32, s32, s32); -extern void func_80318640(gczoombox_t *, s32, f32, f32, s32); -extern void func_80318734(gczoombox_t *, f32); -extern void func_80318964(gczoombox_t *); extern void func_8033BD20(void *); enum gcpausemenu_state_e { @@ -69,17 +59,17 @@ enum gcpausemenu_state_e { /* .data */ struct1As D_8036C4E0[4] = { - {0.0f, 0.0f, "RETURN TO GAME", 55, TALK_PIC_4_BANJO_1, 0}, - {0.3f, 0.0f, "EXIT TO WITCH'S LAIR", -100, TALK_PIC_4_BANJO_1, 0}, - {0.1f, 0.0f, "VIEW TOTALS", 90, TALK_PIC_6_JIGGY_1, 0}, - {0.2f, 0.0f, "SAVE AND QUIT", 125, TALK_PIC_7_TOOTY_1, 0}, + {0.0f, 0.0f, "RETURN TO GAME", 55, ZOOMBOX_SPRITE_4_BANJO_1, 0}, + {0.3f, 0.0f, "EXIT TO WITCH'S LAIR", -100, ZOOMBOX_SPRITE_4_BANJO_1, 0}, + {0.1f, 0.0f, "VIEW TOTALS", 90, ZOOMBOX_SPRITE_6_JIGGY_1, 0}, + {0.2f, 0.0f, "SAVE AND QUIT", 125, ZOOMBOX_SPRITE_7_TOOTY_1, 0}, }; struct1As D_8036C520[4] = { - {0.0f, 0.0f, "cc999 / 999cc", 30, TALK_PIC_8_MUSIC_NOTE_1, 0}, - {0.1f, 0.0f, "cc999 / 999cc", 66, TALK_PIC_9_JIGGY_2, 0}, - {0.2f, 0.0f, "cc999 / 999cc", 102, TALK_PIC_A_EXTRA_HEALTH_MAX, 0}, - {0.3f, 0.0f, "cc999 : 999cc", 138, TALK_PIC_B_CLOCK, 0}, + {0.0f, 0.0f, "cc999 / 999cc", 30, ZOOMBOX_SPRITE_8_MUSIC_NOTE_1, 0}, + {0.1f, 0.0f, "cc999 / 999cc", 66, ZOOMBOX_SPRITE_9_JIGGY_2, 0}, + {0.2f, 0.0f, "cc999 / 999cc", 102, ZOOMBOX_SPRITE_A_EXTRA_HEALTH_MAX, 0}, + {0.3f, 0.0f, "cc999 : 999cc", 138, ZOOMBOX_SPRITE_B_CLOCK, 0}, }; struct1Bs D_8036C560[] = { @@ -153,7 +143,7 @@ struct{ s8 joystick_frame; u8 joystick_frame_count; f32 unkC; - gczoombox_t *zoombox[4]; + GcZoombox *zoombox[4]; f32 unk20; BKSprite * joystick_sprite; f32 unk28; @@ -190,8 +180,8 @@ void gcpausemenu_defrag(void){ s32 i; for(i =0; i< 4; i++){ if(D_80383010.zoombox[i]){ - func_80318C0C(D_80383010.zoombox[i]); - D_80383010.zoombox[i] = (gczoombox_t *)defrag(D_80383010.zoombox[i]); + gczoombox_defrag(D_80383010.zoombox[i]); + D_80383010.zoombox[i] = (GcZoombox *)defrag(D_80383010.zoombox[i]); } } } @@ -561,7 +551,7 @@ void gcPauseMenu_setState(enum gcpausemenu_state_e next_state){ else{ gczoombox_highlight(D_80383010.zoombox[i], 1); } - if(func_80318604(D_80383010.zoombox[i])){ + if(gczoombox_is_highlighted(D_80383010.zoombox[i])){ gczoombox_maximize(D_80383010.zoombox[i]); func_803183A4( D_80383010.zoombox[i], D_8036C520[i].str); } @@ -741,7 +731,7 @@ s32 gcpausemenu_80312D78(struct1As *arg0, s32 arg1) { gczoombox_open(D_80383010.zoombox[var_s2]); gczoombox_maximize(D_80383010.zoombox[var_s2]); } - if (!func_80318604(D_80383010.zoombox[var_s2])) { + if (!gczoombox_is_highlighted(D_80383010.zoombox[var_s2])) { func_80318498(D_80383010.zoombox[var_s2]); func_8031843C(D_80383010.zoombox[var_s2]); } @@ -887,7 +877,7 @@ s32 gcPauseMenu_update(void){ func_8024E6E0(0, sp50); func_80310D2C(); for(i = 0; i < 4; i++){ - gczoombox_update(D_80383010.zoombox[i]);//gczoombox_update; + gczoombox_update(D_80383010.zoombox[i]); } diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index 7aa7cc33..1c96903e 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -1,7 +1,7 @@ #include #include "functions.h" #include "variables.h" -#include "gc/gczoombox.h" +#include "zoombox.h" extern f32 func_8024DE1C(f32, f32, f32[3], f32[3]); void func_80252330(f32, f32, f32); @@ -429,18 +429,8 @@ void func_8030DA44(u8); void func_80338338(s32, s32, s32); void func_803382FC(u8); -s32 func_80316ED4(u8*); -void func_8031843C(gczoombox_t *this); -void func_80318478(gczoombox_t *this); -void func_80318488(gczoombox_t *this); -void func_80318498(gczoombox_t *this); -void gczoombox_resolve_minimize(gczoombox_t *this); -void func_803184C8(gczoombox_t *, f32, s32, s32, f32, bool, bool); -void func_80318760(gczoombox_t *this, s32 arg1); - - /* .code */ -void func_80315200(gczoombox_t *this){ +void func_80315200(GcZoombox *this){ s32 s1 = 0; if(-1.0f == this->unk110[0]){ if(func_8025AD7C(this->unk108[0])){ @@ -459,14 +449,14 @@ void func_80315200(gczoombox_t *this){ } } -void func_803152C4(gczoombox_t *this){ +void func_803152C4(GcZoombox *this){ if(this->unk100 != NULL){ func_8033BD20(&this->unk100); this->unk100 = NULL; } } -void func_80315300(gczoombox_t *this){ +void func_80315300(GcZoombox *this){ if(this->model != NULL){ func_8033BD20(&this->model); this->model = NULL; @@ -482,7 +472,7 @@ void func_80315300(gczoombox_t *this){ func_803152C4(this); } -void gczoombox_free(gczoombox_t *this){ +void gczoombox_free(GcZoombox *this){ if(this){ func_80315200(this); func_80315300(this); @@ -505,7 +495,7 @@ void _gczoombox_memClear(u8 *arg0, s32 size){ } } -void func_80315484(gczoombox_t *this){ +void func_80315484(GcZoombox *this){ if( this->unk1A4_31 && !this->unk1A4_26){ this->unk16C = 0.5 * ((this->unk1A4_19) ? 0xf : 0xc) * this->unk198 + this->unk166; } @@ -515,7 +505,7 @@ void func_80315484(gczoombox_t *this){ } } -void func_80315524(gczoombox_t *this){ +void func_80315524(GcZoombox *this){ if(this->unk1A4_26 || this->unk1A4_31){ this->state = 3; this->unk181 = this->unk182; @@ -527,7 +517,7 @@ void func_80315524(gczoombox_t *this){ this->unk1A4_23 = 0; } -void func_8031556C(gczoombox_t *this){ +void func_8031556C(GcZoombox *this){ this->state = 5; animctrl_setPlaybackType(this->anim_ctrl, ANIMCTRL_ONCE); animctrl_setDirection(this->anim_ctrl, 1); @@ -536,7 +526,7 @@ void func_8031556C(gczoombox_t *this){ func_80318498(this); } -void func_803155C8(gczoombox_t *this){ +void func_803155C8(GcZoombox *this){ int i; this->state = 6; @@ -597,13 +587,13 @@ static int __get_str_print_len(u8 *arg0, s32 len){ static s32 _gczoombox_findLineBreak(char *string, s32 line_length){ s32 i; - for(i = func_80316ED4(string); (line_length < (__get_str_print_len(string, i)) || (' ' != string[i] )); i--); + for(i = gczoombox_strlen(string); (line_length < (__get_str_print_len(string, i)) || (' ' != string[i] )); i--); return i; } -void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ +void func_8031594C(GcZoombox * this, u8 *str, s32 arg2, s32 arg3){ s32 s0; - gczoombox_t *s4; + GcZoombox *s4; s32 s5; s32 s3; s32 s2; @@ -613,7 +603,7 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ s0 = arg2; s4 = this; s1 = 0; - f22 = (this->portrait_id == TALK_PIC_5F_TOOTY_4) ? 0.4 : 0.8; + f22 = (this->portrait_id == ZOOMBOX_SPRITE_5F_TOOTY_4) ? 0.4 : 0.8; if(getGameMode() == GAME_MODE_9_BANJO_AND_KAZOOIE){ sfx_rand_sync_to_rand(); @@ -673,27 +663,27 @@ void func_8031594C(gczoombox_t * this, u8 *str, s32 arg2, s32 arg3){ } } -u8 func_80315BC0(gczoombox_t *this, enum sfx_e sfx_id, s32 arg2){ +u8 func_80315BC0(GcZoombox *this, enum sfx_e sfx_id, s32 arg2){ u8 sp1F = func_8030ED2C(sfx_id, arg2) & 0xff; func_8030DD90(sp1F, 0); - if(this->portrait_id == TALK_PIC_66_LOCKUP){ + if(this->portrait_id == ZOOMBOX_SPRITE_66_LOCKUP){ func_8030DCCC(sp1F, 0x40); } return sp1F; } -void func_80315C1C(gczoombox_t *this){ +void func_80315C1C(GcZoombox *this){ int i; func_80315200(this); func_80315300(this); - for(i = 0 ; i < 8; i++){ + for(i = 0 ; i < ZOOMBOX_MAX_STRING_COUNT; i++){ this->raw_str[i] = NULL; } this->state = 0; - this->unk137 = this->unk1A4_20 = 0; + this->str_cnt = this->unk1A4_20 = 0; } -void func_80315C90(gczoombox_t *this, s32 arg1) { +void func_80315C90(GcZoombox *this, s32 arg1) { s32 phi_s1; s32 current_sfx; f32 phi_f12; @@ -707,7 +697,7 @@ void func_80315C90(gczoombox_t *this, s32 arg1) { current_sfx = 0U; if (this != NULL && this->sfx_count != 0 && this->unk1A4_11) { - if (this->portrait_id == TALK_PIC_15_CLANKER) { + if (this->portrait_id == ZOOMBOX_SPRITE_15_CLANKER) { for(phi_s1 = 0; phi_s1 < 5; phi_s1++){ if(func_8030E3FC(this->unk108[phi_s1])) return; @@ -772,7 +762,7 @@ void func_80315C90(gczoombox_t *this, s32 arg1) { } } -void func_803160A8(gczoombox_t *this) { +void func_803160A8(GcZoombox *this) { f32 temp_f14; f32 phi_f14; s32 phi_a0; @@ -804,7 +794,7 @@ void func_803160A8(gczoombox_t *this) { } } -void func_803162B4(gczoombox_t *this){ +void func_803162B4(GcZoombox *this){ func_802F7B90(this->unk168, this->unk168, this->unk168); if(this->unk1A4_30){ if(this->unk1A4_17){ @@ -826,7 +816,7 @@ void func_803162B4(gczoombox_t *this){ func_802F7B90(0xff, 0xff, 0xff); } -void func_803163A8(gczoombox_t *this, Gfx **gfx, Mtx **mtx) { +void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx) { f32 sp5C[3]; f32 sp50[3]; f32 sp44[3]; @@ -848,11 +838,11 @@ void func_803163A8(gczoombox_t *this, Gfx **gfx, Mtx **mtx) { modelRender_draw(gfx, mtx, sp50, sp5C, this->unk198 * sp34, sp38, this->model); } -void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { +void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6) { f32 sp2C[3]; f32 temp_f12; - if (this->portrait_id == TALK_PIC_46_TUMBLAR) { + if (this->portrait_id == ZOOMBOX_SPRITE_46_TUMBLAR) { arg6 = 0.75f; } func_80338338(0xFF, 0xFF, 0xFF); @@ -880,7 +870,7 @@ void func_803164B0(gczoombox_t *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, func_8024C904(gfx, mtx); } -void func_80316764(gczoombox_t *this, s32 arg1) { +void func_80316764(GcZoombox *this, s32 arg1) { s32 sp38[6]; f32 phi_f0; s32 sp2C[2]; @@ -986,7 +976,7 @@ void func_80316764(gczoombox_t *this, s32 arg1) { } -void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ +void gczoombox_draw(GcZoombox *this, Gfx **gdl, Mtx ** mptr, void *vptr){ if(!this) return; @@ -1015,13 +1005,13 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ func_803164B0(this, gdl, mptr, this->unk178, this->unk179, this->unk104, this->unk17C); }//L80316D40 - if( !this->unk1A4_18 && !(this->unk168 < 0x81) + if( !this->highlighted && !(this->unk168 < 0x81) ){ this->unk168 -= 0xC; this->unk168 = !(this->unk168 < 0x81) ? this->unk168 : 0x80; } - if(this->unk1A4_18 && this->unk168 < 0xff){ + if(this->highlighted && this->unk168 < 0xff){ this->unk168 += 0xC; this->unk168 = MIN(this->unk168, 0xff); } @@ -1033,7 +1023,7 @@ void gczoombox_draw(gczoombox_t *this, Gfx **gdl, Mtx ** mptr, void *vptr){ } -void func_80316E08(gczoombox_t *this) { +void func_80316E08(GcZoombox *this) { this->state = 8; func_80318478(this); if (this->unk1A4_24) { @@ -1044,12 +1034,12 @@ void func_80316E08(gczoombox_t *this) { } } -void func_80316E60(gczoombox_t *this){ +void func_80316E60(GcZoombox *this){ this->state = 9; func_80318488(this); } -void func_80316E84(gczoombox_t *this, s32 arg1){ +void func_80316E84(GcZoombox *this, s32 arg1){ if(this->unk134 != arg1){ if(this->unk130 != NULL){ this->unk130(this->portrait_id, arg1); @@ -1058,12 +1048,11 @@ void func_80316E84(gczoombox_t *this, s32 arg1){ } } -//gczoombox_strLen -s32 func_80316ED4(u8 *arg0){ +s32 gczoombox_strlen(u8 *arg0){ return strlen(arg0); } -void gczoombox_update(gczoombox_t *this){ +void gczoombox_update(GcZoombox *this){ s32 sp58[6]; s32 sp4C[3]; s32 sp48; @@ -1090,11 +1079,11 @@ void gczoombox_update(gczoombox_t *this){ this->unk160 += this->unk15C + 1; } else{ - this->unk160 = this->raw_str[this->unk138]; + this->unk160 = this->raw_str[this->current_str_index]; this->unk1A4_19 = func_8031B604(this->unk160); this->unk166 = ((this->unk1A4_19) ? 0x11 : 0x14) * this->unk198 + this->unk164; } - this->unk15C = func_80316ED4(this->unk160); + this->unk15C = gczoombox_strlen(this->unk160); if(this->unk15C >= 24){ this->unk15C = _gczoombox_findLineBreak(this->unk160, 24); this->unk15D = 1; @@ -1105,10 +1094,10 @@ void gczoombox_update(gczoombox_t *this){ func_803153A8(this->unk160, this->unk60, 0, this->unk15C); this->unk60[this->unk15C] = 0; if(!this->unk15D){ - this->unk138++; + this->current_str_index++; } - if(this->unk15D || this->unk138 < this->unk137){ + if(this->unk15D || this->current_str_index < this->str_cnt){ this->unk1A4_25 = 0; this->unk1A4_31 = 0; } @@ -1347,8 +1336,7 @@ void gczoombox_update(gczoombox_t *this){ } } -//_gczoombox_loadSprite -void func_80317C90(gczoombox_t *this, s32 portrait_id){ +void __gczoombox_load_sprite(GcZoombox *this, GcZoomboxSprite portrait_id){ this->unkF8 = func_8033B6C4(D_8036C6C0[portrait_id].spite_id, &this->unkFC); this->frame_count = this->unkF8->frameCnt; func_803382E4(-1); @@ -1356,8 +1344,7 @@ void func_80317C90(gczoombox_t *this, s32 portrait_id){ func_80338308(func_802510A0(this->unkF8), func_802510A8(this->unkF8)); } -//_gczoombox_loadsfx -void func_80317D10(gczoombox_t *this, enum talk_pic_e portrait_id){ +void __gczoombox_load_sfx(GcZoombox *this, GcZoomboxSprite portrait_id){ s32 i; this->sfx_count = 0; @@ -1387,19 +1374,19 @@ void func_80317D10(gczoombox_t *this, enum talk_pic_e portrait_id){ } } -gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)){ - gczoombox_t *this; +GcZoombox *gczoombox_new(s32 arg0, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)){ + GcZoombox *this; s32 i; s32 temp_v1; - this = (gczoombox_t *)malloc(sizeof(gczoombox_t)); + this = (GcZoombox *)malloc(sizeof(GcZoombox)); this->unk130 = arg4; this->state = 0xB; this->portrait_id = portrait_id; - this->unk134 = this->unk137 = this->unk138 = 0; + this->unk134 = this->str_cnt = this->current_str_index = 0; this->unk139 = arg2; this->unk13A = 0x20; - for(i = 0; i < 8; i++){ + for(i = 0; i < ZOOMBOX_MAX_STRING_COUNT; i++){ this->raw_str[i] = NULL; } this->unk15E = 0; @@ -1451,10 +1438,10 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 this->unk1A4_14 =\ this->unk1A4_13 = 0; - this->unk1A4_11 = this->unk1A4_18 = 1; + this->unk1A4_11 = this->highlighted = 1; this->model = assetcache_get(0x89d); - func_80317C90(this, portrait_id); + __gczoombox_load_sprite(this, portrait_id); this->anim_ctrl = animctrl_new(0); animctrl_reset(this->anim_ctrl); animctrl_setIndex(this->anim_ctrl, ASSET_138_ANIM_ZOOMBOX); @@ -1468,7 +1455,7 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 this->unk17C = 1.0f; this->unk178 = this->unk179 = 0; - func_80317D10(this, portrait_id); + __gczoombox_load_sfx(this, portrait_id); func_80318760(this, 18000); _gczoombox_memClear( this->unk0, 0x30); _gczoombox_memClear( this->unk30, 0x30); @@ -1478,19 +1465,25 @@ gczoombox_t *gczoombox_new(s32 arg0, enum talk_pic_e portrait_id, s32 arg2, s32 return this; } -bool func_80318284(gczoombox_t *this, s32 str_cnt, char **str_ptrs) { +/** + * @brief Manually sets the strings gczoombox displays. Assumed that + * `str_cnt <= ZOOMBOX_MAX_STRING_COUNT`. Returns 1 on success, 0 on + * failure + */ +bool gczoombox_setStrings(GcZoombox *this, s32 str_cnt, char **str_ptrs) { + // assert!(str_cnt <= ZOOMBOX_MAX_STRING_COUNT) s32 phi_v0; if ((this->unk13A & 4) || (str_ptrs == NULL) || (str_cnt == 0)) { return FALSE; } - this->unk138 = 0; - this->unk137 = str_cnt; + this->current_str_index = 0; + this->str_cnt = str_cnt; for(phi_v0 = 0; phi_v0 < str_cnt; phi_v0++){ this->raw_str[phi_v0] = str_ptrs[phi_v0]; } - for(phi_v0 = str_cnt; phi_v0 < 8; phi_v0++){ + for(phi_v0 = str_cnt; phi_v0 < ZOOMBOX_MAX_STRING_COUNT; phi_v0++){ this->raw_str[phi_v0] = NULL; } @@ -1498,70 +1491,70 @@ bool func_80318284(gczoombox_t *this, s32 str_cnt, char **str_ptrs) { return 1; } -bool func_803183A4(gczoombox_t *this, char *arg1) { +bool func_803183A4(GcZoombox *this, char *arg1) { char *sp1C; if ((this->unk13A & 4) || (arg1 == NULL)) { return FALSE; } sp1C = arg1; - return func_80318284(this, 1, &sp1C); + return gczoombox_setStrings(this, 1, &sp1C); } -void gczoombox_open(gczoombox_t *this){ +void gczoombox_open(GcZoombox *this){ this->unk13A |= 0x1; } -void gczoombox_close(gczoombox_t *this){ +void gczoombox_close(GcZoombox *this){ this->unk13A |= 0x10; } -void gczoombox_maximize(gczoombox_t *this){ +void gczoombox_maximize(GcZoombox *this){ this->unk13A |= 0x2; } -void gczoombox_minimize(gczoombox_t *this){ +void gczoombox_minimize(GcZoombox *this){ this->unk13A |= 0x8; } -void func_8031842C(gczoombox_t *this){ +void func_8031842C(GcZoombox *this){ this->unk13A |= 0x20; } -void func_8031843C(gczoombox_t *this){ +void func_8031843C(GcZoombox *this){ void *temp_v1; void *phi_v1; s32 phi_v0; - for(phi_v0 = 0; phi_v0 < 8; phi_v0++){ + for(phi_v0 = 0; phi_v0 < ZOOMBOX_MAX_STRING_COUNT; phi_v0++){ this->raw_str[phi_v0] = NULL; }; - this->unk137 = 0; + this->str_cnt = 0; this->unk13A &= (u8)~(0x4); } -void func_80318478(gczoombox_t *this){ +void func_80318478(GcZoombox *this){ this->unk13A &= (u8)~(0x1); } -void func_80318488(gczoombox_t *this){ +void func_80318488(GcZoombox *this){ this->unk13A &= (u8)~(0x10); } -void func_80318498(gczoombox_t *this){ +void func_80318498(GcZoombox *this){ this->unk13A &= (u8)~(0x2); } -void gczoombox_resolve_minimize(gczoombox_t *this){ +void gczoombox_resolve_minimize(GcZoombox *this){ this->unk13A &= (u8)~(0x8); } -void func_803184B8(gczoombox_t *this){ +void func_803184B8(GcZoombox *this){ this->unk13A &= (u8)~(0x20); } -void func_803184C8(gczoombox_t *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6) { +void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6) { if (this != NULL) { this->unk182 = arg2; @@ -1575,7 +1568,7 @@ void func_803184C8(gczoombox_t *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bo } } -bool func_8031857C(gczoombox_t *this, u8 *str){ +bool func_8031857C(GcZoombox *this, u8 *str){ if(func_803183A4(this, str)){ gczoombox_open(this); gczoombox_maximize(this); @@ -1586,26 +1579,25 @@ bool func_8031857C(gczoombox_t *this, u8 *str){ return FALSE; } -void gczoombox_highlight(gczoombox_t *this, bool arg1){ +void gczoombox_highlight(GcZoombox *this, bool arg1){ if(arg1) - this->unk1A4_18 = 1; + this->highlighted = 1; else - this->unk1A4_18 = 0; + this->highlighted = 0; } -//gczoombox_isHiglighted -bool func_80318604(gczoombox_t *this){ - return this->unk1A4_18; +bool gczoombox_is_highlighted(GcZoombox *this){ + return this->highlighted; } -void func_80318614(gczoombox_t *this, int arg1){ +void func_80318614(GcZoombox *this, int arg1){ if(arg1) this->unk1A4_11 = 1; else this->unk1A4_11 = 0; } -void func_80318640(gczoombox_t *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { +void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { s32 phi_v0; if (this != NULL) { @@ -1626,21 +1618,21 @@ void func_80318640(gczoombox_t *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4) { } -void func_80318734(gczoombox_t *this, f32 arg1){ +void func_80318734(GcZoombox *this, f32 arg1){ if(this) this->unk1A0 = 1.0/arg1; } -void func_80318760(gczoombox_t *this, s32 arg1){ +void func_80318760(GcZoombox *this, s32 arg1){ if(this) this->unk12E = arg1; } -void func_80318774(gczoombox_t *this){ +void func_80318774(GcZoombox *this){ this->unk13A = 0; } -bool func_8031877C(gczoombox_t *this){ +bool func_8031877C(GcZoombox *this){ if( this == NULL || this->state == 0 || this->state == 0xb || this->state == 0x9 || this->state == 0x6 || this->state == 0x7 ){ @@ -1663,7 +1655,7 @@ bool func_8031877C(gczoombox_t *this){ return TRUE; } -bool func_803188B4(gczoombox_t *this) { +bool func_803188B4(GcZoombox *this) { if ((this == NULL) || (this->state == 0) || (this->state == 7) || (this->state == 9)) { return FALSE; @@ -1683,7 +1675,7 @@ bool func_803188B4(gczoombox_t *this) { } -bool func_80318964(gczoombox_t *this) { +bool func_80318964(GcZoombox *this) { if (this == NULL || this->state == 0 || this->state == 7 || this->state == 9) { return FALSE; } @@ -1693,7 +1685,7 @@ bool func_80318964(gczoombox_t *this) { return TRUE; } -bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ +bool gczoombox_loadSprite(GcZoombox *this, GcZoomboxSprite arg1){ if( this == NULL || arg1 == this->portrait_id || ( this->state != 6 @@ -1710,11 +1702,11 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ this->unkF8 = NULL; } func_803152C4(this); - func_80317C90(this, arg1); + __gczoombox_load_sprite(this, arg1); this->unk176 = D_8036C6C0[arg1].unk2; this->unk177 = D_8036C6C0[arg1].unk3; func_80315200(this); - func_80317D10(this, arg1); + __gczoombox_load_sfx(this, arg1); this->portrait_id = arg1; } else{//L80318AAC @@ -1730,11 +1722,11 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ } this->unk178 = this->unk176; this->unk179 = this->unk177; - func_80317C90(this, arg1); + __gczoombox_load_sprite(this, arg1); this->unk176 = D_8036C6C0[arg1].unk2; this->unk177 = D_8036C6C0[arg1].unk3; func_80315200(this); - func_80317D10(this, arg1); + __gczoombox_load_sfx(this, arg1); this->unk1A4_14 = 1; this->portrait_id = arg1; this->unk1A4_13 = 1; @@ -1743,7 +1735,7 @@ bool func_803189C4(gczoombox_t *this, enum talk_pic_e arg1){ return TRUE; } -void func_80318B7C(gczoombox_t *this, s32 arg1) { +void func_80318B7C(GcZoombox *this, s32 arg1) { s32 phi_v0; if (this != NULL) { @@ -1755,11 +1747,11 @@ void func_80318B7C(gczoombox_t *this, s32 arg1) { } } -bool func_80318BEC(gczoombox_t *this){ +bool func_80318BEC(GcZoombox *this){ return this != NULL && !this->state; } -void func_80318C0C(gczoombox_t *this) { +void gczoombox_defrag(GcZoombox *this) { AnimCtrl *temp_a0; if (this != NULL) { @@ -1769,7 +1761,7 @@ void func_80318C0C(gczoombox_t *this) { } } -void func_80318C48(gczoombox_t *this, s32 arg1) { +void func_80318C48(GcZoombox *this, s32 arg1) { if (this != NULL) { if (this->unk1A4_30) { if (arg1 != 0) { diff --git a/src/core2/gc/zoombox.h b/src/core2/gc/zoombox.h new file mode 100644 index 00000000..0a1d21a3 --- /dev/null +++ b/src/core2/gc/zoombox.h @@ -0,0 +1,252 @@ +#ifndef __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ +#define __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ + +#include +#include "structs.h" + +#define ZOOMBOX_MAX_STRING_COUNT 8 + +typedef enum talk_pic_e { + ZOOMBOX_SPRITE_0_GRUNTILDA_1, + ZOOMBOX_SPRITE_1_VILE_1, + ZOOMBOX_SPRITE_2_VILE_2, + ZOOMBOX_SPRITE_3_VILE_3, + ZOOMBOX_SPRITE_4_BANJO_1, + ZOOMBOX_SPRITE_5_GRUNTILDA_2, + ZOOMBOX_SPRITE_6_JIGGY_1, + ZOOMBOX_SPRITE_7_TOOTY_1, + ZOOMBOX_SPRITE_8_MUSIC_NOTE_1, + ZOOMBOX_SPRITE_9_JIGGY_2, + ZOOMBOX_SPRITE_A_EXTRA_HEALTH_MAX, + ZOOMBOX_SPRITE_B_CLOCK, + ZOOMBOX_SPRITE_C_BANJO_2, + ZOOMBOX_SPRITE_D_KAZOOIE_1, + ZOOMBOX_SPRITE_E_KAZOOIE_2, + ZOOMBOX_SPRITE_F_BOTTLES, + ZOOMBOX_SPRITE_10_MUMBO_1, + ZOOMBOX_SPRITE_11_CHIMPY, + ZOOMBOX_SPRITE_12_CONGA, + ZOOMBOX_SPRITE_13_BLUBBER, + ZOOMBOX_SPRITE_14_NIPPER, + ZOOMBOX_SPRITE_15_CLANKER, + ZOOMBOX_SPRITE_16_SNIPPET, + ZOOMBOX_SPRITE_17_VILE_4, + ZOOMBOX_SPRITE_18_TIPTUP, + ZOOMBOX_SPRITE_19_TANKTUP, + ZOOMBOX_SPRITE_1A_FLIBBIT, + ZOOMBOX_SPRITE_1B_TRUNKER, + ZOOMBOX_SPRITE_1C_RUBEE, + ZOOMBOX_SPRITE_1D_GOBI, + ZOOMBOX_SPRITE_1E_GRABBA, + ZOOMBOX_SPRITE_1F_TEEHEE, + ZOOMBOX_SPRITE_20_JINJO_YELLOW, + ZOOMBOX_SPRITE_21_JINJO_GREEN, + ZOOMBOX_SPRITE_22_JINJO_BLUE, + ZOOMBOX_SPRITE_23_JINJO_PINK, + ZOOMBOX_SPRITE_24_JINJO_ORANGE, + ZOOMBOX_SPRITE_25_MUSIC_NOTE_2, + ZOOMBOX_SPRITE_26_MUMBO_TOKEN, + ZOOMBOX_SPRITE_27_BLUE_EGG, + ZOOMBOX_SPRITE_28_RED_FEATHER, + ZOOMBOX_SPRITE_29_GOLD_FEATHER, + ZOOMBOX_SPRITE_2A_ORANGE, + ZOOMBOX_SPRITE_2B_GOLD_BULLION, + ZOOMBOX_SPRITE_2C_HONEYCOMB, + ZOOMBOX_SPRITE_2D_EXTRA_HEALTH_MAX, + ZOOMBOX_SPRITE_2E_EXTRA_LIFE, + ZOOMBOX_SPRITE_2F_JIGGY_3, + ZOOMBOX_SPRITE_30_EXTRA_HONEYCOMB, + ZOOMBOX_SPRITE_31_CATERPILLAR, + ZOOMBOX_SPRITE_32_WADING_BOOTS, + ZOOMBOX_SPRITE_33_PIRANHA, + ZOOMBOX_SPRITE_34_TERMITE, + ZOOMBOX_SPRITE_35_JUJU, + ZOOMBOX_SPRITE_36_YUMYUM, + ZOOMBOX_SPRITE_37_LITTLE_LOCKUP, + ZOOMBOX_SPRITE_38_LEAKY, + ZOOMBOX_SPRITE_39_GLOOP, + ZOOMBOX_SPRITE_3A_TIPTUP_CHOIR_MEMBER, + ZOOMBOX_SPRITE_3B_SNACKER, + ZOOMBOX_SPRITE_3C_ANCIENT_ONE, + ZOOMBOX_SPRITE_3D_SAND_EEL, + ZOOMBOX_SPRITE_3E_SNORKEL, + ZOOMBOX_SPRITE_3F_JINXY, + ZOOMBOX_SPRITE_40_CROCTUS, + ZOOMBOX_SPRITE_41_GRUNTILDA_3, + ZOOMBOX_SPRITE_42_TOOTY_2, + ZOOMBOX_SPRITE_43_BOGGY, + ZOOMBOX_SPRITE_44_WOZZA, + ZOOMBOX_SPRITE_45_MOTZHAND, + ZOOMBOX_SPRITE_46_TUMBLAR, + ZOOMBOX_SPRITE_47_MUMMUM, + ZOOMBOX_SPRITE_48_XMAS_GIFT_BLUE, + ZOOMBOX_SPRITE_49_WORM, + ZOOMBOX_SPRITE_4A_FREEZING_WATER, + ZOOMBOX_SPRITE_4B_TWINKLY, + ZOOMBOX_SPRITE_4C_TWINKLY_CHOMPER, + ZOOMBOX_SPRITE_4D_GNAWTY, + ZOOMBOX_SPRITE_4E_BOSS_BOOM_BOX, + ZOOMBOX_SPRITE_4F_ZUBBA, + ZOOMBOX_SPRITE_50_NABNUT, + ZOOMBOX_SPRITE_51_POLAR_BEAR_CUBS, + ZOOMBOX_SPRITE_52_YOUNG_EEYRIE_1, + ZOOMBOX_SPRITE_53_YOUNG_EEYRIE_2, + ZOOMBOX_SPRITE_54_YOUNG_EEYRIE_3, + ZOOMBOX_SPRITE_55_ADULT_EEYRIE, + ZOOMBOX_SPRITE_56_WARP_CAULDRON, + ZOOMBOX_SPRITE_57_BRENTILDA, + ZOOMBOX_SPRITE_58_TOOTY_3, + ZOOMBOX_SPRITE_59_BLACK_SNIPPET, + ZOOMBOX_SPRITE_5A_LOGGO, + ZOOMBOX_SPRITE_5B_CHEATO, + ZOOMBOX_SPRITE_5C_XMAS_GIFT_GREEN, + ZOOMBOX_SPRITE_5D_KLUNGO, + ZOOMBOX_SPRITE_5E_SEXY_GRUNTY, + ZOOMBOX_SPRITE_5F_TOOTY_4, + ZOOMBOX_SPRITE_60_BANJO_3, + ZOOMBOX_SPRITE_61_KAZOOIE_3, + ZOOMBOX_SPRITE_62_TOOTY_5, + ZOOMBOX_SPRITE_63_DINGPOT, + ZOOMBOX_SPRITE_64_CROC_BANJO, + ZOOMBOX_SPRITE_65_GRUNTILDA_4, + ZOOMBOX_SPRITE_66_LOCKUP, + ZOOMBOX_SPRITE_67_VILE_5, + ZOOMBOX_SPRITE_68_VILE_6, + ZOOMBOX_SPRITE_69_VILE_7 +}GcZoomboxSprite; + +typedef struct { + u8 unk0[0x30]; //string1 + u8 unk30[0x30]; //string2 + u8 unk60[0x30]; + u8 unk90[0x20]; + u8 unkB0[0x40]; + BKModelBin *model; + AnimCtrl *anim_ctrl; + BKSprite *unkF8; + BKSpriteDisplayData *unkFC; + BKSprite *unk100; + BKSpriteDisplayData *unk104; + u8 unk108[5]; //sfx_ids + u8 pad10D[3]; + f32 unk110[5]; //sfx_??? + s16 unk124[5]; //sfx_??? + s16 unk12E; + void (*unk130)(s32, s32); + u8 unk134; + u8 state; + u8 portrait_id; //0x136 + u8 str_cnt; //string_cnt + u8 current_str_index; //current_string + u8 unk139; + u8 unk13A; + u8 sfx_count; + char *raw_str[ZOOMBOX_MAX_STRING_COUNT]; //string_ptrs + u8 unk15C; + u8 unk15D; + u8 unk15E; + u8 pad15F[0x1]; + u8 *unk160; + s16 unk164; + s16 unk166; //top_transparency??? + s16 unk168; //rgb??? + s16 unk16A; //x_pos + s16 unk16C; //y1_pos + s16 unk16E; //y2_pos + s16 unk170; + s16 unk172; + s16 unk174; + s8 unk176; + s8 unk177; + s8 unk178; + s8 unk179; + u8 pad17A[0x2]; + f32 unk17C; + s8 unk180; + s8 unk181; + u8 unk182; + u8 unk183; + u8 unk184; + u8 unk185; + s8 unk186; + u8 unk187; + u8 frame_count; //sprite frame count + u8 unk189; + u8 unk18A; + u8 prev_sfx; //next_sfx + f32 unk18C; + f32 unk190; + f32 unk194; + f32 unk198; + f32 unk19C; + f32 unk1A0; + u32 unk1A4_31:1; + u32 unk1A4_30:1; + u32 unk1A4_29:1; + u32 unk1A4_28:1; + u32 unk1A4_27:1; + u32 unk1A4_26:1; + u32 unk1A4_25:1; + u32 unk1A4_24:1; + u32 unk1A4_23:1; + u32 unk1A4_22:1; + u32 unk1A4_21:1; + u32 unk1A4_20:1; + u32 unk1A4_19:1; + u32 highlighted:1; + u32 unk1A4_17:1; + u32 unk1A4_16:1; + u32 unk1A4_15:1; + u32 unk1A4_14:1; + u32 unk1A4_13:1; + u32 unk1A4_12:1; + u32 unk1A4_11:1; + u32 unk1A4_10:1; + u32 pad1A4_9:10; +}GcZoombox; //size 0x1A8 + + +void gczoombox_free(GcZoombox *this); +void func_803160A8(GcZoombox *this); +void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx); +void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, s32 arg5, f32 arg6); +void func_80316764(GcZoombox *this, s32 arg1); +void gczoombox_draw(GcZoombox *this, Gfx **gdl, Mtx ** mptr, void *vptr); +void func_80316E08(GcZoombox *this); +void func_80316E60(GcZoombox *this); +void func_80316E84(GcZoombox *this, s32 arg1); +s32 gczoombox_strlen(u8 *arg0); +void gczoombox_update(GcZoombox *this); +GcZoombox *gczoombox_new(s32 arg0, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3, void (*arg4)(s32, s32)); +bool gczoombox_setStrings(GcZoombox *this, s32 str_cnt, char **str_ptrs); +bool func_803183A4(GcZoombox *this, char *arg1); +void gczoombox_open(GcZoombox *this); +void gczoombox_close(GcZoombox *this); +void gczoombox_maximize(GcZoombox *this); +void gczoombox_minimize(GcZoombox *this); +void func_8031842C(GcZoombox *this); +void func_8031843C(GcZoombox *this); +void func_80318478(GcZoombox *this); +void func_80318488(GcZoombox *this); +void func_80318498(GcZoombox *this); +void gczoombox_resolve_minimize(GcZoombox *this); +void func_803184B8(GcZoombox *this); +void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6); +bool func_8031857C(GcZoombox *this, u8 *str); +void gczoombox_highlight(GcZoombox *this, bool arg1); +bool gczoombox_is_highlighted(GcZoombox *this); +void func_80318614(GcZoombox *this, int arg1); +void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4); +void func_80318734(GcZoombox *this, f32 arg1); +void func_80318760(GcZoombox *this, s32 arg1); +void func_80318774(GcZoombox *this); +bool func_8031877C(GcZoombox *this); +bool func_803188B4(GcZoombox *this); +bool func_80318964(GcZoombox *this); +bool gczoombox_loadSprite(GcZoombox *this, GcZoomboxSprite arg1); +void func_80318B7C(GcZoombox *this, s32 arg1); +bool func_80318BEC(GcZoombox *this); +void gczoombox_defrag(GcZoombox *this); +void func_80318C48(GcZoombox *this, s32 arg1); + +#endif // __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ diff --git a/src/core2/code_3480.c b/src/core2/snackerctl.c similarity index 60% rename from src/core2/code_3480.c rename to src/core2/snackerctl.c index b054919a..d49abd44 100644 --- a/src/core2/code_3480.c +++ b/src/core2/snackerctl.c @@ -1,7 +1,11 @@ +#include "snackerctl.h" + #include #include "functions.h" #include "variables.h" +#include "ch/snacker.h" + s32 func_80259254(f32 *, f32, f32, f32); void ncFirstPersonCamera_getZoomedInRotation(f32 *); @@ -14,64 +18,59 @@ f32 D_80363610[3] = {350.0f, 200.0f, -100.0f}; f32 D_8036361C[2] = {29.25f, 269.5f}; /* .bss */ -s32 D_8037BF50; +SnackerCtlState s_snackerctl_state; /* .code */ -//snacker_clearState -void snacker_reset(void){ - D_8037BF50 = 0; +void snackerctl_reset(void){ + s_snackerctl_state = SNACKER_CTL_STATE_0_INACTIVE; } -//__playerWithinHorizontalDistance -s32 func_8028A41C(f32 x, f32 z, f32 dist){ +static s32 __snackerctl_player_within_distance(f32 x, f32 z, f32 dist){ f32 player_position[3]; _player_getPosition(player_position); return func_80259254(player_position, x, z, dist); } -//_snacker_ttc_update -s32 func_8028A45C(void){ - s32 nextState = 0; +static SnackerCtlState __snackerctl_update_ttc(void){ + SnackerCtlState nextState = 0; f32 player_position[3]; _player_getPosition(player_position); if(func_8028B470() || func_803203FC(UNKFLAGS1_C1_IN_FINAL_CHARACTER_PARADE)){ //(swimming || ???) if(player_position[1] < 600.0f - && !func_8028A41C(2478.0f, 4586.0f, 1750.0f) //within 1750 of sandcastle center - && !func_8028A41C(-400.0, 2315.0f, 2000.0f) //within 2000 of blubber's ship center + && !__snackerctl_player_within_distance(2478.0f, 4586.0f, 1750.0f) //within 1750 of sandcastle center + && !__snackerctl_player_within_distance(-400.0, 2315.0f, 2000.0f) //within 2000 of blubber's ship center ){ - nextState = 2; + nextState = SNACKER_CTL_STATE_2_TTC; } } - func_802E1A04(nextState); + chsnacker_setControlState(nextState); return nextState; } -//_snacker_rbb_update -s32 func_8028A504(void){ - s32 nextState = 0; +static SnackerCtlState __snackerctl_update_rbb(void){ + SnackerCtlState nextState = 0; f32 sp18[3]; if(func_8028B470()){ func_8028E964(sp18); if(func_80309D58(sp18, 0)) - nextState = 1; + nextState = SNACKER_CTL_STATE_1_RBB; } - func_802E1A04(nextState); + chsnacker_setControlState(nextState); return nextState; } -void func_8028A558(s32 arg0, s32 arg1, s32 arg2){ +static void func_8028A558(ActorMarker *arg0, enum asset_e arg1, s32 arg2){ func_8028F918(0); } -void func_8028A584(s32 arg0, s32 arg1, s32 arg2){ +static void func_8028A584(ActorMarker *arg0, enum asset_e arg1, s32 arg2){ func_803219F4(3); func_8034B9BC(chBottlesBonus_getPuzzleIndex()); } -//snacker_update_bottlesBonusPuzzle -s32 func_8028A5C0(void){ +static SnackerCtlState _snackerctl_update_bottles_bonus(void){ s32 tmp; f32 sp30[3]; @@ -79,22 +78,22 @@ s32 func_8028A5C0(void){ return 0; if(func_8034BB48() && chBottlesBonus_getPuzzleIndex() != 7){ - func_80311480(0xe26 + (chBottlesBonus_getPuzzleIndex() << 1), 6, &D_80363610, 0, 0, 0); + func_80311480(0xe26 + (chBottlesBonus_getPuzzleIndex() << 1), 6, D_80363610, NULL, NULL, NULL); } if(!func_8028F25C() && func_80321960() == 3) func_803219F4(1); if(miscflag_isTrue(0x17) && !func_8028F25C()){ - if(func_8028A41C(183.0f, -100.0f, 75.0f)){ + if(__snackerctl_player_within_distance(183.0f, -100.0f, 75.0f)){ if(chBottlesBonus_getPuzzleIndex() == 6){ if(!D_8037DCCC){ func_8028F94C(4, &D_80363610); - func_80311480(0xe33, 0x6, &D_80363610, 0, func_8028A584, NULL); + func_80311480(0xe33, 0x6, D_80363610, NULL, func_8028A584, NULL); } }//L8028A70C else if(chBottlesBonus_getPuzzleIndex() == 7){ func_8028F94C(4, &D_80363610); - func_80311480(0xe35, 0x6, &D_80363610, 0, func_8028A558, NULL); + func_80311480(0xe35, 0x6, D_80363610, NULL, func_8028A558, NULL); D_8037DCCC = 1; }//L8028A764 else if(jiggyscore_isCollected(0x10)){ @@ -104,7 +103,7 @@ s32 func_8028A5C0(void){ ){ if(!D_8037DCCA){ func_8028F94C(4, &D_80363610); - func_80311480(0xe21, 6, &D_80363610, 0, func_8028A584, NULL); + func_80311480(0xe21, 6, D_80363610, 0, func_8028A584, NULL); D_8037DCCA = 1; }else{ func_8028A584(0,0,0); @@ -114,31 +113,29 @@ s32 func_8028A5C0(void){ else{ if(!D_8037DCCB){ func_8028F94C(4, &D_80363610); - func_80311480(0xe20, 6, &D_80363610, 0, func_8028A558, NULL); + func_80311480(0xe20, 6, D_80363610, 0, func_8028A558, NULL); D_8037DCCB = 1; } } } } - return 0; + return SNACKER_CTL_STATE_0_INACTIVE; } -//snacker_updateState -void func_8028A8D0(void){ +void snackerctl_update(void){ switch(map_get()){ case MAP_7_TTC_TREASURE_TROVE_COVE: - D_8037BF50 = func_8028A45C(); + s_snackerctl_state = __snackerctl_update_ttc(); break; case MAP_31_RBB_RUSTY_BUCKET_BAY: - D_8037BF50 = func_8028A504(); + s_snackerctl_state = __snackerctl_update_rbb(); break; case MAP_8C_SM_BANJOS_HOUSE: - D_8037BF50 = func_8028A5C0(); + s_snackerctl_state = _snackerctl_update_bottles_bonus(); break; } } -//snacker_getState -s32 func_8028A94C(void){ - return D_8037BF50; +SnackerCtlState snackerctl_get_state(void){ + return s_snackerctl_state; } diff --git a/src/core2/snackerctl.h b/src/core2/snackerctl.h new file mode 100644 index 00000000..7c6d2061 --- /dev/null +++ b/src/core2/snackerctl.h @@ -0,0 +1,14 @@ +#ifndef __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ +#define __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ + +typedef enum { + SNACKER_CTL_STATE_0_INACTIVE, + SNACKER_CTL_STATE_1_RBB, + SNACKER_CTL_STATE_2_TTC +} SnackerCtlState; + +void snackerctl_reset(void); +void snackerctl_update(void); +SnackerCtlState snackerctl_get_state(void); + +#endif // __BANJO_KAZOOIE_CORE2_SNACKER_CTL_H__ diff --git a/src/core2/spawnqueue.c b/src/core2/spawnqueue.c index 853ef798..2fbf2198 100644 --- a/src/core2/spawnqueue.c +++ b/src/core2/spawnqueue.c @@ -5,8 +5,7 @@ #include "prop.h" - -void func_802E1790(void); +#include "ch/snacker.h" void spawnQueue_unlock(void); void spawnQueue_lock(void); @@ -121,7 +120,6 @@ extern ActorInfo D_80368528; extern ActorInfo D_8036854C; extern ActorInfo D_80368570; extern ActorInfo D_803685A0; //mumbotoken -extern ActorInfo D_80368620; //snacker extern ActorInfo chSnowman; //sirslush extern ActorInfo chSnowball; //snowball extern ActorInfo chSnowmanHat; //sir_slush_hat @@ -191,7 +189,7 @@ void spawnQueue_reset(void){ spawnQueue_lock(); spawnQueueLength = 0; chmumbo_func_802D1724(); - func_802E1790(); + chSnacker_initialize(); switch(loaded_asm_file){ case OVERLAY_2_WHALE: CC_func_803870E0(); @@ -263,7 +261,7 @@ void spawnQueue_reset(void){ spawnableActorList_add(&D_80367E20, actor_new, 0x44); //chmolehill spawnableActorList_add(&D_80373DC0, actor_new, 0x80000); spawnableActorList_add(&D_80367E70, actor_new, 0x0); - spawnableActorList_add(&D_80368620, actor_new, 0x10004); //snacker + spawnableActorList_add(&gChSnacker, actor_new, 0x10004); //snacker spawnableActorList_add(&D_80366EF0, actor_new, 0x20004); //large_shadow spawnableActorList_add(&D_80367B20, actor_new, 0x80); //chclimbbase spawnableActorList_add(&D_80367BA4, actor_new, 0x40); //gold_bullion diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index 05834d40..c63592d2 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -2,7 +2,8 @@ #include "functions.h" #include "variables.h" -#include "core2/code_C9E70.h" +#include "../core2/gc/zoombox.h" +#include "../core2/code_C9E70.h" #include "core2/nc/camera.h" @@ -67,18 +68,11 @@ extern s32 ability_getAllLearned(void); // get unlocked moves bitfield extern s32 item_getCount(s32); // item count get extern void func_803463F4(s32, s32); // item count set -extern void func_80318614(gczoombox_t *, s32); -extern bool func_803183A4(gczoombox_t *, u8 *); -extern void gczoombox_minimize(gczoombox_t *); -extern void gczoombox_close(gczoombox_t *); - extern void func_80250530(s32, u16, f32); extern void func_8025A55C(s32, s32, s32); extern void func_80324CFC(f32, s16, s16); -extern void gczoombox_open(gczoombox_t *); -extern void gczoombox_maximize(gczoombox_t *); extern void *mapModel_getModel(s32); extern void player_setTransformation(s32); // set transformation @@ -208,31 +202,31 @@ struct { {1, COMUSIC_9_NOTE_COLLECTED, 32000, 3.0f}, {1, COMUSIC_14_GOLD_FEATHER_COLLECTED, 0x7FFF, 3.0f}, {1, COMUSIC_17_EMPTY_HONEYCOMB_COLLECTED, 0x7FFF, 3.0f}, - {2, TALK_PIC_1D_GOBI, 0, 0.0f}, - {2, TALK_PIC_15_CLANKER, 0, 0.0f}, - {2, TALK_PIC_1B_TRUNKER, 0, 0.0f}, - {2, TALK_PIC_17_VILE_4, 0, 0.0f}, - {2, TALK_PIC_13_BLUBBER, 0, 0.0f}, - {2, TALK_PIC_10_MUMBO_1, 0, 0.0f}, - {2, TALK_PIC_12_CONGA, 0, 0.0f}, - {2, TALK_PIC_F_BOTTLES, 0, 0.0f}, - {2, TALK_PIC_11_CHIMPY, 0, 0.0f}, - {2, TALK_PIC_18_TIPTUP, 0, 0.0f}, - {2, TALK_PIC_1C_RUBEE, 0, 0.0f}, - {2, TALK_PIC_1F_TEEHEE, 0, 0.0f}, - {2, TALK_PIC_3E_SNORKEL, 0, 0.0f}, - {2, TALK_PIC_41_GRUNTILDA_3, 0, 0.0f}, - {2, TALK_PIC_43_BOGGY, 0, 0.0f}, - {2, TALK_PIC_44_WOZZA, 0, 0.0f}, - {2, TALK_PIC_50_NABNUT, 0, 0.0f}, - {2, TALK_PIC_51_POLAR_BEAR_CUBS, 0, 0.0f}, - {2, TALK_PIC_55_ADULT_EEYRIE, 0, 0.0f}, - {2, TALK_PIC_57_BRENTILDA, 0, 0.0f}, - {2, TALK_PIC_58_TOOTY_3, 0, 0.0f}, - {2, TALK_PIC_5A_LOGGO, 0, 0.0f}, - {2, TALK_PIC_14_NIPPER, 0, 0.0f}, - {2, TALK_PIC_19_TANKTUP, 0, 0.0f}, - {2, TALK_PIC_20_JINJO_YELLOW, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1D_GOBI, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_15_CLANKER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1B_TRUNKER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_17_VILE_4, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_13_BLUBBER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_10_MUMBO_1, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_12_CONGA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_F_BOTTLES, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_11_CHIMPY, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_18_TIPTUP, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1C_RUBEE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_1F_TEEHEE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_3E_SNORKEL, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_41_GRUNTILDA_3, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_43_BOGGY, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_44_WOZZA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_50_NABNUT, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_51_POLAR_BEAR_CUBS, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_55_ADULT_EEYRIE, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_57_BRENTILDA, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_58_TOOTY_3, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_5A_LOGGO, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_14_NIPPER, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_19_TANKTUP, 0, 0.0f}, + {2, ZOOMBOX_SPRITE_20_JINJO_YELLOW, 0, 0.0f}, {1, COMUSIC_57_TURBO_TRAINERS, 32000, 10.0f}, {1, COMUSIC_58_WADING_BOOTS, 32000, 10.0f}, {1, COMUSIC_25_USING_GOLD_FEATHERS, 32000, 10.0f}, diff --git a/symbol_addrs.us.v10.txt b/symbol_addrs.us.v10.txt index 6144285e..00442389 100644 --- a/symbol_addrs.us.v10.txt +++ b/symbol_addrs.us.v10.txt @@ -15,24 +15,7 @@ __osProbeTLB = 0x80003BD0; __osDisableInt = 0x80003FC0; __osRestoreInt = 0x80003FE0; bk_boot_BSS_START = 0x80005270; -mainLoop = 0x8023DD0C; -func_802405F0 = 0x802405F0; -rumbleManager_80250C08 = 0x80250C08; -memcpy = 0x80254608; -malloc = 0x80254CA8; -free = 0x802550F0; -realloc = 0x80255358; -write_file_blocks = 0x80255B30; -ml_vec3f_normalize = 0x80256450; -ml_vec3f_set_length_copy = 0x802565E0; -ml_isNonzero_vec3f = 0x80258368; -mlAbsF = 0x80258964; -ml_vec3f_copy = 0x80258BA4; -ml_vec3f_diff_copy = 0x80258BC0; -ml_vec3f_add = 0x80258C48; -ml_vec3f_scale_copy = 0x80258CB0; ___osGetSR = 0x8025AFE0; -sns_write_payload_over_heap = 0x8025B700; bzero = 0x80263B40; osWriteBackDCacheAll = 0x80263BE0; osVirtualToPhysical = 0x802646A0; @@ -42,7 +25,6 @@ osWritebackDCache = 0x80264AF0; osInvalDCache = 0x80264B70; osDestroyThread = 0x80264DB0; osSetThreadPri = 0x80265000; -gu_sqrtf = 0x80265350; osSetIntMask = 0x802654D0; osInvalICache = 0x802684C0; __osSetSR = 0x8026A210; @@ -60,8 +42,6 @@ __osProbeTLB = 0x8026B420; bcopy = 0x8026C110; __osSetCompare = 0x8026CA70; osGetCount = 0x8026CE00; -framebuffer_width = 0x80276588; -framebuffer_height = 0x8027658C; __osShutdown = 0x8027712C; __OSGlobalIntMask = 0x80277130; __osRunQueue = 0x80277378; @@ -69,53 +49,5 @@ __osRunningThread = 0x80277380; __osFaultedThread = 0x80277384; __osRcpImTable = 0x80278C60; __libm_qnan_f = 0x80278DB0; -D_8027BEEC = 0x8027BEEC; -__osEventStateTab = 0x80284660; -__osThreadSave = 0x80285DE0; -leoDiskStack = 0x80285F90;//technically should have a OS_LEO_STACKSIZE or something... -baMarker_8028D694 = 0x8028D694; -player_getPosition = 0x8028E9A4; -_player_getPosition = 0x802984D4; -bs_checkInterrupt = 0x8029A81C; -spawnQueue_func_802C3A18 = 0x802C3A18; -spawnQueue_flush = 0x802C3A38; -spawnQueue_unlock = 0x802C3BDC; -spawnQueue_lock = 0x802C3BE8; -mapSpecificFlags_getAll = 0x802CAE8C; -mapSpecificFlags_setAll = 0x802CAE98; -mapSpecificFlags_validateCRC1 = 0x802CB00C; -mapSavestate_save = 0x802E2F2C; -mapSavestate_apply = 0x802E30AC; -getGameMode = 0x802E49FC; -vtxList_getVertices = 0x802EC450; -cube_atIndices = 0x80303384; -gctransition_done = 0x8030BD98; -gcdialog_setState = 0x8030F488; -gcdialog_update = 0x8030F990; -gczoombox_update = 0x80316EF4; -gczoombox_close = 0x803183FC; -gczoombox_maximize = 0x8031840C; -gczoombox_minimize = 0x8031841C; -fileProgressFlag_get = 0x8031FF1C; -level_get = 0x80321900; -levelSpecificFlags_validateCRC1 = 0x8032204C; -marker_despawn = 0x803282F4; -actor_copy = 0x80329C40; -actors_appendToSavestate = 0x80329CBC; -model_getVtxList = 0x8033A148; -strIToA = 0x8033D884; -strlen = 0x8033DA80; -time_getDelta = 0x8033DD9C; -item_inc = 0x80345F24; -item_empty = 0x80345F74; -itemscore_noteScores_get = 0x80346F34; -demo_readInput = 0x80349EE4; -randf = 0x8034A390; -suBaddieActorArray = 0x8036E560; -D_80374CF0 = 0x80374CF0; -D_8037901C = 0x8037901C; -D_8037DCB0 = 0x8037DCB0; __propellorTimer = 0x803912CC; -D_A00001D8 = 0xA00001D8; -D_A0000238 = 0xA0000238;