Merge branch 'document/code_91E10' into 'master'

document: code_91E10

See merge request banjo.decomp/banjo-kazooie!95
This commit is contained in:
Banjo Kazooie
2024-10-14 21:32:31 +00:00
18 changed files with 590 additions and 367 deletions

View File

@@ -4529,6 +4529,210 @@ enum asset_e
ASSET_1157_TEXT_FINALBOSS_PHASE_5_OPTION_4, ASSET_1157_TEXT_FINALBOSS_PHASE_5_OPTION_4,
ASSET_1158_TEXT_FINALBOSS_PHASE_5_OPTION_5, ASSET_1158_TEXT_FINALBOSS_PHASE_5_OPTION_5,
ASSET_1213_FF_QUIZ_QUESTION = 0x1213,
ASSET_1214_FF_QUIZ_QUESTION,
ASSET_1215_FF_QUIZ_QUESTION,
ASSET_1216_FF_QUIZ_QUESTION,
ASSET_1217_FF_QUIZ_QUESTION,
ASSET_1218_FF_QUIZ_QUESTION,
ASSET_1219_FF_QUIZ_QUESTION,
ASSET_121A_FF_QUIZ_QUESTION,
ASSET_121B_FF_QUIZ_QUESTION,
ASSET_121C_FF_QUIZ_QUESTION,
ASSET_121D_FF_QUIZ_QUESTION,
ASSET_121E_FF_QUIZ_QUESTION,
ASSET_121F_FF_QUIZ_QUESTION,
ASSET_1220_FF_QUIZ_QUESTION,
ASSET_1221_FF_QUIZ_QUESTION,
ASSET_1222_FF_QUIZ_QUESTION,
ASSET_1223_FF_QUIZ_QUESTION,
ASSET_1224_FF_QUIZ_QUESTION,
ASSET_1225_FF_QUIZ_QUESTION,
ASSET_1226_FF_QUIZ_QUESTION,
ASSET_1227_FF_QUIZ_QUESTION,
ASSET_1228_FF_QUIZ_QUESTION,
ASSET_1229_FF_QUIZ_QUESTION,
ASSET_122A_FF_QUIZ_QUESTION,
ASSET_122B_FF_QUIZ_QUESTION,
ASSET_122C_FF_QUIZ_QUESTION,
ASSET_122D_FF_QUIZ_QUESTION,
ASSET_122E_FF_QUIZ_QUESTION,
ASSET_122F_FF_QUIZ_QUESTION,
ASSET_1230_FF_QUIZ_QUESTION,
ASSET_1231_FF_QUIZ_QUESTION,
ASSET_1232_FF_QUIZ_QUESTION,
ASSET_1233_FF_QUIZ_QUESTION,
ASSET_1234_FF_QUIZ_QUESTION,
ASSET_1235_FF_QUIZ_QUESTION,
ASSET_1236_FF_QUIZ_QUESTION,
ASSET_1237_FF_QUIZ_QUESTION,
ASSET_1238_FF_QUIZ_QUESTION,
ASSET_1239_FF_QUIZ_QUESTION,
ASSET_123A_FF_QUIZ_QUESTION,
ASSET_123B_FF_QUIZ_QUESTION,
ASSET_123C_FF_QUIZ_QUESTION,
ASSET_123D_FF_QUIZ_QUESTION,
ASSET_123E_FF_QUIZ_QUESTION,
ASSET_123F_FF_QUIZ_QUESTION,
ASSET_1240_FF_QUIZ_QUESTION,
ASSET_1241_FF_QUIZ_QUESTION,
ASSET_1242_FF_QUIZ_QUESTION,
ASSET_1243_FF_QUIZ_QUESTION,
ASSET_1244_FF_QUIZ_QUESTION,
ASSET_1245_FF_QUIZ_QUESTION,
ASSET_1246_FF_QUIZ_QUESTION,
ASSET_1247_FF_QUIZ_QUESTION,
ASSET_1248_FF_QUIZ_QUESTION,
ASSET_1249_FF_QUIZ_QUESTION,
ASSET_124A_FF_QUIZ_QUESTION,
ASSET_124B_FF_QUIZ_QUESTION,
ASSET_124C_FF_QUIZ_QUESTION,
ASSET_124D_FF_QUIZ_QUESTION,
ASSET_124E_FF_QUIZ_QUESTION,
ASSET_124F_FF_QUIZ_QUESTION,
ASSET_1250_FF_QUIZ_QUESTION,
ASSET_1251_FF_QUIZ_QUESTION,
ASSET_1252_FF_QUIZ_QUESTION,
ASSET_1253_FF_QUIZ_QUESTION,
ASSET_1254_FF_QUIZ_QUESTION,
ASSET_1255_FF_QUIZ_QUESTION,
ASSET_1256_FF_QUIZ_QUESTION,
ASSET_1257_FF_QUIZ_QUESTION,
ASSET_1258_FF_QUIZ_QUESTION,
ASSET_1259_FF_QUIZ_QUESTION,
ASSET_125A_FF_QUIZ_QUESTION,
ASSET_125B_FF_QUIZ_QUESTION,
ASSET_125C_FF_QUIZ_QUESTION,
ASSET_125D_FF_QUIZ_QUESTION,
ASSET_125E_FF_QUIZ_QUESTION,
ASSET_125F_FF_QUIZ_QUESTION,
ASSET_1260_FF_QUIZ_QUESTION,
ASSET_1261_FF_QUIZ_QUESTION,
ASSET_1262_FF_QUIZ_QUESTION,
ASSET_1263_FF_QUIZ_QUESTION,
ASSET_1264_FF_QUIZ_QUESTION,
ASSET_1265_FF_QUIZ_QUESTION,
ASSET_1266_FF_QUIZ_QUESTION,
ASSET_1267_FF_QUIZ_QUESTION,
ASSET_1268_FF_QUIZ_QUESTION,
ASSET_1269_FF_QUIZ_QUESTION,
ASSET_126A_FF_QUIZ_QUESTION,
ASSET_126B_FF_QUIZ_QUESTION,
ASSET_126C_FF_QUIZ_QUESTION,
ASSET_126D_FF_QUIZ_QUESTION,
ASSET_126E_FF_QUIZ_QUESTION,
ASSET_126F_FF_QUIZ_QUESTION,
ASSET_1270_FF_QUIZ_QUESTION,
ASSET_1271_FF_QUIZ_QUESTION,
ASSET_1272_FF_QUIZ_QUESTION,
ASSET_1273_FF_QUIZ_QUESTION,
ASSET_1274_FF_QUIZ_QUESTION,
ASSET_1275_FF_QUIZ_QUESTION,
ASSET_1276_FF_QUIZ_QUESTION,
ASSET_12DB_FF_PICTURE_QUESTION = 0x12DB,
ASSET_12DC_FF_PICTURE_QUESTION,
ASSET_12DD_FF_PICTURE_QUESTION,
ASSET_12DE_FF_PICTURE_QUESTION,
ASSET_12DF_FF_PICTURE_QUESTION,
ASSET_12E0_FF_PICTURE_QUESTION,
ASSET_12E1_FF_PICTURE_QUESTION,
ASSET_12E2_FF_PICTURE_QUESTION,
ASSET_12E3_FF_PICTURE_QUESTION,
ASSET_12E4_FF_PICTURE_QUESTION,
ASSET_12E5_FF_PICTURE_QUESTION,
ASSET_12E6_FF_PICTURE_QUESTION,
ASSET_12E7_FF_PICTURE_QUESTION,
ASSET_12E8_FF_PICTURE_QUESTION,
ASSET_12E9_FF_PICTURE_QUESTION,
ASSET_12EA_FF_PICTURE_QUESTION,
ASSET_12EB_FF_PICTURE_QUESTION,
ASSET_12EC_FF_PICTURE_QUESTION,
ASSET_12ED_FF_PICTURE_QUESTION,
ASSET_13A3_FF_SOUND_QUESTION = 0x13A3,
ASSET_13A4_FF_SOUND_QUESTION,
ASSET_13A5_FF_SOUND_QUESTION,
ASSET_13A6_FF_SOUND_QUESTION,
ASSET_13A7_FF_SOUND_QUESTION,
ASSET_13A8_FF_SOUND_QUESTION,
ASSET_13A9_FF_SOUND_QUESTION,
ASSET_13AA_FF_SOUND_QUESTION,
ASSET_13AB_FF_SOUND_QUESTION,
ASSET_13AC_FF_SOUND_QUESTION,
ASSET_13AD_FF_SOUND_QUESTION,
ASSET_13AE_FF_SOUND_QUESTION,
ASSET_13AF_FF_SOUND_QUESTION,
ASSET_13B0_FF_SOUND_QUESTION,
ASSET_13B1_FF_SOUND_QUESTION,
ASSET_13B2_FF_SOUND_QUESTION,
ASSET_13B3_FF_SOUND_QUESTION,
ASSET_13B4_FF_SOUND_QUESTION,
ASSET_13B5_FF_SOUND_QUESTION,
ASSET_13B6_FF_SOUND_QUESTION,
ASSET_13B7_FF_SOUND_QUESTION,
ASSET_13B8_FF_SOUND_QUESTION,
ASSET_13B9_FF_SOUND_QUESTION,
ASSET_13BA_FF_SOUND_QUESTION,
ASSET_13BB_FF_SOUND_QUESTION,
ASSET_13BC_FF_SOUND_QUESTION,
ASSET_13BD_FF_SOUND_QUESTION,
ASSET_13BE_FF_SOUND_QUESTION,
ASSET_13BF_FF_SOUND_QUESTION,
ASSET_13C0_FF_SOUND_QUESTION,
ASSET_13C1_FF_SOUND_QUESTION,
ASSET_13C2_FF_SOUND_QUESTION,
ASSET_13C3_FF_SOUND_QUESTION,
ASSET_13C4_FF_SOUND_QUESTION,
ASSET_13C5_FF_SOUND_QUESTION,
ASSET_13C6_FF_SOUND_QUESTION,
ASSET_13C7_FF_SOUND_QUESTION,
ASSET_13C8_FF_SOUND_QUESTION,
ASSET_13C9_FF_SOUND_QUESTION,
ASSET_13CA_FF_SOUND_QUESTION,
ASSET_13CB_FF_SOUND_QUESTION,
ASSET_13CC_FF_SOUND_QUESTION,
ASSET_13CD_FF_SOUND_QUESTION,
ASSET_13CE_FF_SOUND_QUESTION,
ASSET_13CF_FF_SOUND_QUESTION,
ASSET_13D0_FF_SOUND_QUESTION,
ASSET_13D1_FF_SOUND_QUESTION,
ASSET_13D2_FF_SOUND_QUESTION,
ASSET_13D3_FF_SOUND_QUESTION,
ASSET_13D4_FF_SOUND_QUESTION,
ASSET_13D5_FF_SOUND_QUESTION,
ASSET_1407_FF_GRUNTY_QUESTION = 0x1407,
ASSET_1408_FF_GRUNTY_QUESTION,
ASSET_1409_FF_GRUNTY_QUESTION,
ASSET_140A_FF_GRUNTY_QUESTION,
ASSET_140B_FF_GRUNTY_QUESTION,
ASSET_140C_FF_GRUNTY_QUESTION,
ASSET_140D_FF_GRUNTY_QUESTION,
ASSET_140E_FF_GRUNTY_QUESTION,
ASSET_140F_FF_GRUNTY_QUESTION,
ASSET_1410_FF_GRUNTY_QUESTION,
ASSET_1411_FF_GRUNTY_QUESTION,
ASSET_1412_FF_GRUNTY_QUESTION,
ASSET_1413_FF_GRUNTY_QUESTION,
ASSET_1414_FF_GRUNTY_QUESTION,
ASSET_1415_FF_GRUNTY_QUESTION,
ASSET_1416_FF_GRUNTY_QUESTION,
ASSET_1417_FF_GRUNTY_QUESTION,
ASSET_1418_FF_GRUNTY_QUESTION,
ASSET_1419_FF_GRUNTY_QUESTION,
ASSET_141A_FF_GRUNTY_QUESTION,
ASSET_141B_FF_GRUNTY_QUESTION,
ASSET_141C_FF_GRUNTY_QUESTION,
ASSET_141D_FF_GRUNTY_QUESTION,
ASSET_141E_FF_GRUNTY_QUESTION,
ASSET_141F_FF_GRUNTY_QUESTION,
ASSET_1420_FF_GRUNTY_QUESTION,
ASSET_1421_FF_GRUNTY_QUESTION,
ASSET_1422_FF_GRUNTY_QUESTION,
ASSET_1423_FF_GRUNTY_QUESTION,
ASSET_1424_FF_GRUNTY_QUESTION,
ASSET_146B_MODEL_TTC_TREASURE_TROVE_COVE_OPA = 0x146B, ASSET_146B_MODEL_TTC_TREASURE_TROVE_COVE_OPA = 0x146B,
ASSET_146C_MODEL_TTC_TREASURE_TROVE_COVE_XLU, ASSET_146C_MODEL_TTC_TREASURE_TROVE_COVE_XLU,
ASSET_146D_MODEL_TTC_NIPPERS_SHELL_OPA, ASSET_146D_MODEL_TTC_NIPPERS_SHELL_OPA,

View File

@@ -428,7 +428,7 @@ void func_802C4C14(Actor *this){
if(sp74[0] == 1){ if(sp74[0] == 1){
if(gameFile_isNotEmpty(sp84)){ if(gameFile_isNotEmpty(sp84)){
func_8031877C(chGameSelectTopZoombox); func_8031877C(chGameSelectTopZoombox);
func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[func_8031B5B0()]); func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[code94620_func_8031B5B0()]);
D_8037DD2C = 1; D_8037DD2C = 1;
subaddie_set_state(this, 5); subaddie_set_state(this, 5);
} }
@@ -551,7 +551,7 @@ void func_802C4C14(Actor *this){
} }
void func_802C5740(Actor * this){ void func_802C5740(Actor * this){
int i = func_8031B5B0(); int i = code94620_func_8031B5B0();
D_8037DCE0.unk0 = (&D_80365DF4)[i]; D_8037DCE0.unk0 = (&D_80365DF4)[i];
D_8037DCE0.unk4 = (&D_80365DF8)[i]; D_8037DCE0.unk4 = (&D_80365DF8)[i];
@@ -560,7 +560,7 @@ void func_802C5740(Actor * this){
if(chGameSelectBottomZoombox == NULL){ if(chGameSelectBottomZoombox == NULL){
chGameSelectBottomZoombox = gczoombox_new(0xA0, ZOOMBOX_SPRITE_C_BANJO_2, 2, 0, NULL); chGameSelectBottomZoombox = gczoombox_new(0xA0, ZOOMBOX_SPRITE_C_BANJO_2, 2, 0, NULL);
gczoombox_open(chGameSelectBottomZoombox); gczoombox_open(chGameSelectBottomZoombox);
func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0); gczoombox_func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0);
}//L802C57FC }//L802C57FC
if(chGameSelectTopZoombox == NULL){ if(chGameSelectTopZoombox == NULL){

View File

@@ -12,7 +12,7 @@ extern void func_802F9D38(s32);
extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32); extern void func_802EE6CC(f32[3], f32[3], s32[4], s32, f32, f32, s32, s32, s32);
extern void ml_vec3f_assign(f32[3], f32, f32, f32); extern void ml_vec3f_assign(f32[3], f32, f32, f32);
extern void func_802EE2E8(Actor *arg0, s32 arg1, s32 cnt, s32 arg3, f32 arg4, f32 arg5, f32 arg6); extern void func_802EE2E8(Actor *arg0, s32 arg1, s32 cnt, s32 arg3, f32 arg4, f32 arg5, f32 arg6);
extern void func_80319EA4(void); extern void gcquiz_func_80319EA4(void);
extern void fileProgressFlag_set(enum file_progress_e, bool); extern void fileProgressFlag_set(enum file_progress_e, bool);
void func_802D3D54(Actor *this); void func_802D3D54(Actor *this);
@@ -814,7 +814,7 @@ void func_802D5178(s32 arg0, enum file_progress_e arg1, s32 arg2, enum map_e arg
void func_802D520C(Gfx **gfx, Mtx **mtx, Vtx **vtx){ void func_802D520C(Gfx **gfx, Mtx **mtx, Vtx **vtx){
if(volatileFlag_get(VOLATILE_FLAG_1) && map_get() != MAP_8E_GL_FURNACE_FUN){ if(volatileFlag_get(VOLATILE_FLAG_1) && map_get() != MAP_8E_GL_FURNACE_FUN){
func_80319214(gfx, mtx, vtx); gcquiz_draw(gfx, mtx, vtx);
} }
} }
@@ -1008,7 +1008,7 @@ void func_802D5628(void){
case 0x15:// L802D5AB4 case 0x15:// L802D5AB4
case 0x2d:// L802D5AB4 case 0x2d:// L802D5AB4
if(D_80367684 && D_80367684 == map_get()){ if(D_80367684 && D_80367684 == map_get()){
func_80319EA4(); gcquiz_func_80319EA4();
if(0.0f < D_8037DE08){ if(0.0f < D_8037DE08){
D_8037DE08 -= time_getDelta(); D_8037DE08 -= time_getDelta();
} }

View File

@@ -624,7 +624,7 @@ s32 getGameMode(void){
return D_8037E8E0.game_mode; return D_8037E8E0.game_mode;
} }
int func_802E4A08(void){ bool func_802E4A08(void){
return (D_8037E8E0.game_mode == GAME_MODE_6_FILE_PLAYBACK) return (D_8037E8E0.game_mode == GAME_MODE_6_FILE_PLAYBACK)
|| (D_8037E8E0.game_mode == GAME_MODE_5_UNKNOWN) || (D_8037E8E0.game_mode == GAME_MODE_5_UNKNOWN)
|| (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO) || (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO)

View File

@@ -386,7 +386,7 @@ void func_802F5060(s32 textureId){
tmp_a2 = func_802546E4(D_80380AB8[1]); tmp_a2 = func_802546E4(D_80380AB8[1]);
if(tmp_a2 & 0xF) if(tmp_a2 & 0xF)
tmp_a2 += 0x10 - (tmp_a2 & 0xF); tmp_a2 += 0x10 - (tmp_a2 & 0xF);
if(!func_8033BDAC(SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK, D_80380AB8[1],tmp_a2)){ if(!code_B3A80_func_8033BDAC(SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK, D_80380AB8[1],tmp_a2)){
assetcache_release(D_80380AB8[1]); assetcache_release(D_80380AB8[1]);
D_80380AB8[1] = assetcache_get(SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK); D_80380AB8[1] = assetcache_get(SPRITE_BOLD_FONT_NUMBERS_ALPHAMASK);
} }
@@ -394,7 +394,7 @@ void func_802F5060(s32 textureId){
tmp_a2 = func_802546E4(D_80380AB8[3]); tmp_a2 = func_802546E4(D_80380AB8[3]);
if(tmp_a2 & 0xF) if(tmp_a2 & 0xF)
tmp_a2 += 0x10 - (tmp_a2 & 0xF); tmp_a2 += 0x10 - (tmp_a2 & 0xF);
if(!func_8033BDAC(SPRITE_BOLD_FONT_LETTERS_ALPHAMASK, D_80380AB8[3],tmp_a2)){ if(!code_B3A80_func_8033BDAC(SPRITE_BOLD_FONT_LETTERS_ALPHAMASK, D_80380AB8[3],tmp_a2)){
assetcache_release(D_80380AB8[3]); assetcache_release(D_80380AB8[3]);
D_80380AB8[3] = assetcache_get(SPRITE_BOLD_FONT_LETTERS_ALPHAMASK); D_80380AB8[3] = assetcache_get(SPRITE_BOLD_FONT_LETTERS_ALPHAMASK);
} }

View File

@@ -7,57 +7,71 @@
extern void item_set(enum item_e, s32); extern void item_set(enum item_e, s32);
extern void func_8025A55C(s32, s32, s32); extern void func_8025A55C(s32, s32, s32);
enum gcquiz_state {
GCQUIZ_STATE_0_INITIAL, //803197F0
GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX, //80319910
GCQUIZ_STATE_2_SHOW_PORTRAITS_FOR_QUESTION, //8031994C
GCQUIZ_STATE_3_UNKNOWN, //80319B78
GCQUIZ_STATE_4_UNKNOWN, //80319B78
GCQUIZ_STATE_5_UNKNOWN, //80319B78
GCQUIZ_STATE_6_SELECT_QUIZ_ANSWER, //80319B84
GCQUIZ_STATE_7_CHECK_GIVEN_ANSWER, //80319C0C
GCQUIZ_STATE_8_UNKNOWN, //80319CFC
GCQUIZ_STATE_9_UNKNOWN, //80319D6C
GCQUIZ_STATE_A_UNKNOWN //80319D80
};
typedef struct { typedef struct {
u8 cmd; u8 cmd;
u8 string_size; u8 string_size;
//u8 str[]; } StringBin_Unused;
}StringBin;
typedef struct { typedef struct {
u8 unk0; u8 unk0;
u8 unk1; u8 unk1;
}QuizQuestionBin_Struct_1; } QuizQuestionBin_Unused;
typedef struct { typedef struct {
u8 unk0; u8 unk0;
u8 unk1; u8 unk1;
u8 unk2; u8 unk2;
}QuizQuestionBin; } QuizQuestionBin;
typedef struct{ typedef struct{
s32 unk0[4][4]; s32 answer_options[4][4]; // first dimension = zoombox index, second dimension = value (0-3), third dimension = answer
}Struct_Core2_91E10_1; } QuizQuestionStruct;
typedef struct { typedef struct {
s8 unk0; //question_type s8 question_type; // enum ff_question_type_e
s8 unk1; //question_indx s8 question_index;
s8 unk2; s8 unk2; // always -1?
u8 unk3; u8 quiz_question_time; // is either 0 or 10 (from __code5ED0_getQuizQuestionTime)
s32 unk4; s32 unk4; // always 0
void (*unk8)(s32, s32); void (*unk8)(s32, s8); // gets called with unk4 and unk11
QuizQuestionBin *unkC; //asset_bin QuizQuestionBin *unkC; //asset_bin
u8 unk10; //state u8 state;
s8 unk11; s8 unk11;
s8 unk12; s8 selected_answer_index;
u8 unk13; //selected_box_indx u8 answer_cursor_index;
u8 unk14; u8 unk14; // relevant for state = 9, from 0 to 4?
u8 unk15; //cursor_cooldown u8 answer_cursor_cooldown;
u8 unk16; u8 unk16; // some value for zoombox (gczoombox_func_803184C8)
u8 unk17; u8 unk17; // some value for zoombox (gczoombox_func_803184C8)
u8 unk18[4]; u8 answer_str_counts[4];
s8 unk1C[4]; s8 answer_values[4];
s8 unk20[4]; //portrait_id s8 portait_ids[4];
GcZoombox *unk24[4]; //zoombox GcZoombox *zoomboxes[4];
Struct_Core2_91E10_1 unk34; QuizQuestionStruct quiz_question;
}Struct_Core2_91E10; } Struct_Core2_91E10;
void func_803197AC(s32 arg0); static void __gcquiz_advanceStateTo(enum gcquiz_state state);
void func_80319E20(s32 arg0, s32 arg1); static void __gcquiz_func_80319E20(s32 portrait_id, s32 state);
void func_8031A3E4(void); static void __gcquiz_closeZoomboxes(void);
u8 D_8036D940[] = { #define SELECTABLE_PORTAIT_COUNT 0x2C
0,
static u8 sPortraits[SELECTABLE_PORTAIT_COUNT+1] = {
NULL,
ZOOMBOX_SPRITE_11_CHIMPY, ZOOMBOX_SPRITE_11_CHIMPY,
ZOOMBOX_SPRITE_12_CONGA, ZOOMBOX_SPRITE_12_CONGA,
ZOOMBOX_SPRITE_13_BLUBBER, ZOOMBOX_SPRITE_13_BLUBBER,
@@ -105,57 +119,59 @@ u8 D_8036D940[] = {
}; };
/* .bss */ /* .bss */
Struct_Core2_91E10 *D_803830E0; Struct_Core2_91E10 *sD_803830E0;
/* .code */ /* .code */
void func_80318DA0(s8 *ptr, u8 min_indx, u8 max_indx, s32 min_value, s32 max_value){ static void __gcquiz_uniquelyRandomizeValuesInPointer(s8 *ptr, u8 min_index, u8 max_index, s32 min_value, s32 max_value){
s32 i; s32 i;
s32 j; s32 j;
s32 unique; bool is_unique;
for(i = min_indx; i <= max_indx; i++){ for (i = min_index; i <= max_index; i++){
/* assign unique random value*/ /* assign is_unique random value*/
do{ do {
/*assign random value */ /*assign random value */
ptr[i] = randi2(min_value, max_value + 1); ptr[i] = randi2(min_value, max_value + 1);
unique = TRUE; is_unique = TRUE;
/* test uniqueness */ /* test uniqueness */
for(j = min_indx; j < i; j++){ for(j = min_index; j < i; j++){
if (ptr[i] == ptr[j]) { if (ptr[i] == ptr[j]) {
unique = FALSE; is_unique = FALSE;
break; break;
} }
} }
}while(unique == FALSE); } while(is_unique == FALSE);
} }
} }
void func_80318E90(void) { static void __gcquiz_randomizePortaitIds(void) {
D_803830E0->unk20[0] = 0; sD_803830E0->portait_ids[0] = 0;
func_80318DA0(D_803830E0->unk20, 1, 3, 1, 0x2C); __gcquiz_uniquelyRandomizeValuesInPointer(sD_803830E0->portait_ids, 1, 3, 1, SELECTABLE_PORTAIT_COUNT);
} }
//__gcquiz_get_type_start_id static enum asset_e __gcquiz_get_type_start_id(enum ff_question_type_e question_type) {
enum asset_e func_80318ED8(enum ff_question_type_e question_type){ switch(question_type) {
switch(question_type){ case FFQT_1_PICTURE: return ASSET_12DB_FF_PICTURE_QUESTION;
case FFQT_1_PICTURE: return 0x12DB; case FFQT_2_SOUND: return ASSET_13A3_FF_SOUND_QUESTION;
case FFQT_2_SOUND: return 0x13A3; case FFQT_3_GRUNTY: return ASSET_1407_FF_GRUNTY_QUESTION;
case FFQT_3_GRUNTY: return 0x1407;
} }
return 0x1213;
return ASSET_1213_FF_QUIZ_QUESTION;
} }
//__gcquiz_get_type_end_id static enum asset_e __gcquiz_get_type_end_id(enum ff_question_type_e question_type){
enum asset_e func_80318F1C(enum ff_question_type_e question_type){ switch(question_type) {
switch(question_type){ case FFQT_1_PICTURE: return ASSET_12ED_FF_PICTURE_QUESTION + 1;
case FFQT_1_PICTURE: return 0x12EE; case FFQT_2_SOUND: return ASSET_13D5_FF_SOUND_QUESTION + 1;
case FFQT_2_SOUND: return 0x13D6; case FFQT_3_GRUNTY: return ASSET_1424_FF_GRUNTY_QUESTION + 1;
case FFQT_3_GRUNTY: return 0x1425;
} }
return 0x1277;
return ASSET_1276_FF_QUIZ_QUESTION + 1;
} }
s32 func_80318F60(enum ff_question_type_e question_type, s32 q_indx, s32 arg2) {
// get correct question index?
static s32 __gcquiz_func_80318F60(enum ff_question_type_e question_type, s32 q_index, s32 arg2) {
s32 phi_v1; s32 phi_v1;
s32 phi_a0; s32 phi_a0;
@@ -163,7 +179,7 @@ s32 func_80318F60(enum ff_question_type_e question_type, s32 q_indx, s32 arg2) {
phi_v1 = arg2; phi_v1 = arg2;
} else { } else {
if (question_type == FFQT_3_GRUNTY) { if (question_type == FFQT_3_GRUNTY) {
phi_a0 = volatileFlag_getN((q_indx * 2) + VOLATILE_FLAG_26_FF_GRUNTY_QUESTIONS, 2); phi_a0 = volatileFlag_getN((q_index * 2) + VOLATILE_FLAG_26_FF_GRUNTY_QUESTIONS, 2);
} else { } else {
phi_a0 = 0; phi_a0 = 0;
} }
@@ -172,285 +188,287 @@ s32 func_80318F60(enum ff_question_type_e question_type, s32 q_indx, s32 arg2) {
return phi_v1; return phi_v1;
} }
bool func_80318FB4(enum ff_question_type_e question_type){ static bool __gcquiz_isSoundQuestion(enum ff_question_type_e question_type){
return question_type == FFQT_2_SOUND; return question_type == FFQT_2_SOUND;
} }
s32 func_80318FC0(s32 arg0){ static s32 __gcquiz_getZoomboxY(s32 arg0){
switch(arg0){ switch(arg0) {
case 1: return 40; case 1: return 40;
case 2: return 80; case 2: return 80;
case 3: return 120; case 3: return 120;
} }
return 0; return 0;
} }
s32 func_80319004(s32 arg0){ static s32 __gcquiz_func_80319004(s32 arg0){
return arg0 == 0 ? 3 : 2; return arg0 == 0 ? 3 : 2;
} }
s32 func_8031901C(s32 arg0){ static s32 __gcquiz_return0(s32 arg0){
return 0; return 0;
} }
bool func_80319028(s32 arg0){ static bool __gcquiz_isZero(s32 arg0){
return arg0 != 0 ? FALSE : TRUE; return arg0 != 0 ? FALSE : TRUE;
} }
//__gcquiz_animation_duration static f32 __gcquiz_animation_duration(s32 arg0){
f32 func_80319040(s32 arg0){
return 0.4f; return 0.4f;
} }
void func_80319050(void) { void gcquiz_init() {
s32 i; s32 i;
D_803830E0 = malloc(0x74); sD_803830E0 = malloc(sizeof(Struct_Core2_91E10));
D_803830E0->unkC = malloc(0x400); sD_803830E0->unkC = malloc(0x400);
D_803830E0->unk16 = 0x14U; sD_803830E0->unk16 = 0x14U;
D_803830E0->unk17 = 0x1E; sD_803830E0->unk17 = 0x1E;
D_803830E0->unk20[0] = 0; sD_803830E0->portait_ids[0] = 0;
D_803830E0->unk24[0] = gczoombox_new(func_80318FC0(0), 0, func_80319004(0), func_8031901C(0), func_80319E20); sD_803830E0->zoomboxes[0] = gczoombox_new(__gcquiz_getZoomboxY(0), 0, __gcquiz_func_80319004(0), __gcquiz_return0(0), __gcquiz_func_80319E20);
func_803184C8(D_803830E0->unk24[0], (f32)D_803830E0->unk16, 5, 2, func_80319040(0), func_80319028(0), 0); gczoombox_func_803184C8(sD_803830E0->zoomboxes[0], (f32)sD_803830E0->unk16, 5, 2, __gcquiz_animation_duration(0), __gcquiz_isZero(0), 0);
for(i = 1; i < 4; i++){ for(i = 1; i < 4; i++){
D_803830E0->unk20[i] = 0; sD_803830E0->portait_ids[i] = 0;
D_803830E0->unk24[i] = NULL; sD_803830E0->zoomboxes[i] = NULL;
} }
func_803197AC(0); __gcquiz_advanceStateTo(GCQUIZ_STATE_0_INITIAL);
} }
void func_80319190(void) { void gcquiz_free() {
s32 i; s32 i;
if (D_803830E0 != NULL) { if (sD_803830E0 != NULL) {
free(D_803830E0->unkC); free(sD_803830E0->unkC);
D_803830E0->unkC = NULL; sD_803830E0->unkC = NULL;
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
gczoombox_free(D_803830E0->unk24[i]); gczoombox_free(sD_803830E0->zoomboxes[i]);
D_803830E0->unk24[i] = NULL; sD_803830E0->zoomboxes[i] = NULL;
} }
free(D_803830E0); free(sD_803830E0);
D_803830E0 = NULL; sD_803830E0 = NULL;
} }
} }
void func_80319214(Gfx **gfx, Mtx **mtx, Vtx **vtx) { void gcquiz_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) {
s32 i; s32 i;
if (D_803830E0 != NULL) { if (sD_803830E0 != NULL) {
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
gczoombox_draw(D_803830E0->unk24[i], gfx, mtx, vtx); gczoombox_draw(sD_803830E0->zoomboxes[i], gfx, mtx, vtx);
} }
} }
} }
bool func_803192A4(enum ff_question_type_e q_type, s32 q_indx, s32 arg2) { // randomize quiz question?
//#define NEXT(iter) (*(((char *)(iter))++)) static bool __gcquiz_func_803192A4(enum ff_question_type_e q_type, s32 q_index, s32 arg2) {
//#define SKIP(iter,n) (((char *)(iter)) += (n))
char *char_iter; char *char_iter;
s32 temp_s0; enum asset_e quiz_question_index;
s32 temp_s2; s32 temp_s2;
s32 str_cnt; s32 str_cnt;
s32 phi_v1; s32 phi_v1;
s32 sp60; s32 zoombox_text_index;
s32 phi_a1; s32 phi_a1;
s32 sp58; s32 quiz_question_bin_unk0;
s32 sp54; s32 quiz_question_bin_unk1;
s32 sp50; s32 quiz_question_bin_unk2;
s32 sp4C; s32 first_answer_cmd;
s32 sp48; s32 second_answer_cmd;
s32 sp44; s32 third_answer_cmd;
s32 temp_v0_3; s32 cmd;
s32 str_size; s32 option_text;
temp_s0 = func_80318ED8(q_type) + q_indx; quiz_question_index = __gcquiz_get_type_start_id(q_type) + q_index;
if (func_8031A3BC()) { if (gcquiz_isNotInInitialState()) {
return 0; return FALSE;
} }
if (func_8033BDAC(temp_s0, D_803830E0->unkC, 0x400) == 0) {
free(D_803830E0->unkC); // not in asset cache?
D_803830E0->unkC = (QuizQuestionBin *) assetcache_get(temp_s0); if (code_B3A80_func_8033BDAC(quiz_question_index, sD_803830E0->unkC, 0x400) == 0) {
free(sD_803830E0->unkC);
sD_803830E0->unkC = (QuizQuestionBin *) assetcache_get(quiz_question_index);
} }
char_iter = D_803830E0->unkC;
sp58 = *(char_iter++); // NEXT char_iter = sD_803830E0->unkC;
sp54 = *(char_iter++); // NEXT quiz_question_bin_unk0 = *(char_iter++); // NEXT
sp50 = *(char_iter++); // NEXT quiz_question_bin_unk1 = *(char_iter++); // NEXT
sp4C = ((sp54 >= 2) ? func_80318F60(q_type, q_indx, arg2) : 0) + 1; quiz_question_bin_unk2 = *(char_iter++); // NEXT
if (((sp50 == 0) || (func_80318FB4(q_type) != 0)) != 0) { first_answer_cmd = ((quiz_question_bin_unk1 >= 2) ? __gcquiz_func_80318F60(q_type, q_index, arg2) : 0) + 1;
// is sound question or quiz_question_bin_unk2 == 0
if (((quiz_question_bin_unk2 == 0) || (__gcquiz_isSoundQuestion(q_type) != FALSE)) != FALSE) {
do { do {
sp48 = randi2(0, sp54 + sp50) + 1; second_answer_cmd = randi2(0, quiz_question_bin_unk1 + quiz_question_bin_unk2) + 1;
} while (sp48 == sp4C); } while (second_answer_cmd == first_answer_cmd);
do { do {
sp44 = randi2(0, sp54 + sp50) + 1; third_answer_cmd = randi2(0, quiz_question_bin_unk1 + quiz_question_bin_unk2) + 1;
} while (sp44 == sp4C || sp44 == sp48); } while (third_answer_cmd == first_answer_cmd || third_answer_cmd == second_answer_cmd);
} else { } else {
sp48 = randi2(0, sp50) + sp54 + 1; second_answer_cmd = randi2(0, quiz_question_bin_unk2) + quiz_question_bin_unk1 + 1;
do { do {
sp44 = randi2(0, sp50) + sp54 + 1; third_answer_cmd = randi2(0, quiz_question_bin_unk2) + quiz_question_bin_unk1 + 1;
} while (sp44 == sp48); } while (third_answer_cmd == second_answer_cmd);
} }
char_iter += 2*func_8031B5B0(); // SKIP char_iter += 2*code94620_func_8031B5B0(); // SKIP
phi_v1 = *(char_iter++); // NEXT phi_v1 = *(char_iter++); // NEXT
phi_v1 += (*(char_iter++) << 8); phi_v1 += (*(char_iter++) << 8);
char_iter = (s32)D_803830E0->unkC + phi_v1; char_iter = (s32)sD_803830E0->unkC + phi_v1;
str_cnt = *(char_iter++); // NEXT str_cnt = *(char_iter++); // NEXT char_iter = 5
for(phi_a1 = 0; phi_a1 < 4; phi_a1++){ for(phi_a1 = 0; phi_a1 < 4; phi_a1++){
D_803830E0->unk18[phi_a1] = 0; sD_803830E0->answer_str_counts[phi_a1] = 0;
} }
for(phi_a1 = 0; phi_a1 < str_cnt; phi_a1++){ for(phi_a1 = 0; phi_a1 < str_cnt; phi_a1++){
temp_v0_3 = *(char_iter++); // NEXT // cmd = 0x80 - 0x83
str_size = *(char_iter++); // NEXT cmd = *(char_iter++); // NEXT char_iter = 6
temp_v0_3 -= 0x80; option_text = *(char_iter++); // NEXT char_iter = 7
cmd -= 0x80;
if ((cmd == 0) || (cmd == first_answer_cmd) || (cmd == second_answer_cmd) || (cmd == third_answer_cmd)) {
if ((temp_v0_3 == 0) || (temp_v0_3 == sp4C) || (temp_v0_3 == sp48) || (temp_v0_3 == sp44)) { if (cmd == 0) { // grunty
if (temp_v0_3 == 0) { zoombox_text_index = 0;
sp60 = 0; } else if (cmd == first_answer_cmd) { // first answer
} else if (temp_v0_3 == sp4C) { zoombox_text_index = 1;
sp60 = 1; } else if (cmd == second_answer_cmd) { // second answer
} else if (temp_v0_3 == sp48) { zoombox_text_index = 2;
sp60 = 2; } else if (cmd == third_answer_cmd) { // third answer
} else if (temp_v0_3 == sp44) { zoombox_text_index = 3;
sp60 = 3;
} else{ } else{
sp60 = sp60; zoombox_text_index = zoombox_text_index;
} }
D_803830E0->unk34.unk0[sp60][D_803830E0->unk18[sp60]++] = char_iter; sD_803830E0->quiz_question.answer_options[zoombox_text_index][sD_803830E0->answer_str_counts[zoombox_text_index]++] = char_iter;
} }
char_iter += str_size; // SKIP char_iter += option_text; // SKIP
} }
//#undef NEXT
//#undef SKIP
return TRUE; return TRUE;
} }
void __gcquiz_openZoomboxAndMaximizeWithStringsAt(s32 zoombox_index) {
void func_803196D0(s32 arg0) { gczoombox_open(sD_803830E0->zoomboxes[zoombox_index]);
gczoombox_open(D_803830E0->unk24[arg0]); gczoombox_maximize(sD_803830E0->zoomboxes[zoombox_index]);
gczoombox_maximize(D_803830E0->unk24[arg0]); gczoombox_setStrings(
gczoombox_setStrings(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); sD_803830E0->zoomboxes[zoombox_index],
sD_803830E0->answer_str_counts[sD_803830E0->answer_values[zoombox_index]],
sD_803830E0->quiz_question.answer_options[sD_803830E0->answer_values[zoombox_index]]
);
} }
//__gcquiz_set_box_highlight void __gcquiz_set_box_highlight(s32 index, bool arg1){
void func_80319758(s32 indx, bool arg1){ gczoombox_highlight(sD_803830E0->zoomboxes[index], arg1);
gczoombox_highlight(D_803830E0->unk24[indx], arg1); gczoombox_func_80318C48(sD_803830E0->zoomboxes[index], arg1);
func_80318C48(D_803830E0->unk24[indx], arg1);
} }
void func_803197AC(s32 arg0){ static void __gcquiz_advanceStateTo(enum gcquiz_state state){
s32 i; s32 i;
s32 j; s32 j;
switch(arg0){ switch(state){
case 0: //803197F0 case GCQUIZ_STATE_0_INITIAL:
D_803830E0->unk0 = 0; sD_803830E0->question_type = 0;
D_803830E0->unk1 = 0; sD_803830E0->question_index = 0;
D_803830E0->unk3 = 0; sD_803830E0->quiz_question_time = 0;
D_803830E0->unk8 = 0; sD_803830E0->unk8 = NULL;
D_803830E0->unk12 = -1; sD_803830E0->selected_answer_index = -1;
D_803830E0->unk14 = 0; sD_803830E0->unk14 = 0;
D_803830E0->unk11 = -2; sD_803830E0->unk11 = -2;
func_803184C8(D_803830E0->unk24[0], (f32) D_803830E0->unk16, 5, 2, func_80319040(0), func_80319028(0), 0); gczoombox_func_803184C8(sD_803830E0->zoomboxes[0], (f32) sD_803830E0->unk16, 5, 2, __gcquiz_animation_duration(0), __gcquiz_isZero(0), 0);
func_80318774(D_803830E0->unk24[0]); gczoombox_setUnk13ATo0(sD_803830E0->zoomboxes[0]);
gczoombox_highlight(D_803830E0->unk24[0], 1); gczoombox_highlight(sD_803830E0->zoomboxes[0], TRUE);
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
D_803830E0->unk1C[i] = -1; sD_803830E0->answer_values[i] = -1;
for(j = 0; j < 4; j++){ for(j = 0; j < 4; j++){
D_803830E0->unk34.unk0[i][j] = 0; sD_803830E0->quiz_question.answer_options[i][j] = NULL;
} }
} }
break; break;
case 1: //80319910 case GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX:
gczoombox_open(D_803830E0->unk24[0]); gczoombox_open(sD_803830E0->zoomboxes[0]);
gczoombox_maximize(D_803830E0->unk24[0]); gczoombox_maximize(sD_803830E0->zoomboxes[0]);
gczoombox_setStrings(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); gczoombox_setStrings(sD_803830E0->zoomboxes[0], sD_803830E0->answer_str_counts[0], sD_803830E0->quiz_question.answer_options[0]);
break; break;
case 2: //8031994C case GCQUIZ_STATE_2_SHOW_PORTRAITS_FOR_QUESTION:
if (D_803830E0->unk0 != -1) { if (sD_803830E0->question_type != -1) {
func_80318E90(); __gcquiz_randomizePortaitIds();
for(i = 1; i < 4; i++){ for(i = 1; i < 4; i++){
D_803830E0->unk24[i] = gczoombox_new(func_80318FC0(i), D_8036D940[D_803830E0->unk20[i]], func_80319004(i), func_8031901C(i), func_80319E20); sD_803830E0->zoomboxes[i] = gczoombox_new(__gcquiz_getZoomboxY(i), sPortraits[sD_803830E0->portait_ids[i]], __gcquiz_func_80319004(i), __gcquiz_return0(i), __gcquiz_func_80319E20);
func_803184C8(D_803830E0->unk24[i], (f32)D_803830E0->unk17, 5, 2, func_80319040(i), func_80319028(i), 0); gczoombox_func_803184C8(sD_803830E0->zoomboxes[i], (f32)sD_803830E0->unk17, 5, 2, __gcquiz_animation_duration(i), __gcquiz_isZero(i), 0);
} }
} else { } else {
for(i = 1; i < 4; i++){ for(i = 1; i < 4; i++){
D_803830E0->unk24[i] = gczoombox_new(func_80318FC0(i), D_803830E0->unk20[i], 1, func_8031901C(i), func_80319E20); sD_803830E0->zoomboxes[i] = gczoombox_new(__gcquiz_getZoomboxY(i), sD_803830E0->portait_ids[i], 1, __gcquiz_return0(i), __gcquiz_func_80319E20);
func_803184C8(D_803830E0->unk24[i], (f32)D_803830E0->unk17, 5, 2, func_80319040(i), func_80319028(i), 0); gczoombox_func_803184C8(sD_803830E0->zoomboxes[i], (f32)sD_803830E0->unk17, 5, 2, __gcquiz_animation_duration(i), __gcquiz_isZero(i), 0);
} }
} }
timedFunc_set_1(0.0f, func_803197AC, 3); timedFunc_set_1(0.0f, __gcquiz_advanceStateTo, GCQUIZ_STATE_3_UNKNOWN);
timedFunc_set_1(0.0f, func_803196D0, 1); timedFunc_set_1(0.0f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 1);
timedFunc_set_1(0.2f, func_803196D0, 2); timedFunc_set_1(0.2f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 2);
timedFunc_set_1(0.4f, func_803196D0, 3); timedFunc_set_1(0.4f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 3);
break; break;
case 3: //80319B78 case GCQUIZ_STATE_3_UNKNOWN:
case 4: //80319B78 case GCQUIZ_STATE_4_UNKNOWN:
case 5: //80319B78 case GCQUIZ_STATE_5_UNKNOWN:
if(1){}
break; break;
case 6: //80319B84 case GCQUIZ_STATE_6_SELECT_QUIZ_ANSWER:
item_set(ITEM_0_HOURGLASS_TIMER, D_803830E0->unk3 * 60 - 1); item_set(ITEM_0_HOURGLASS_TIMER, sD_803830E0->quiz_question_time * 60 - 1);
item_set(ITEM_6_HOURGLASS, TRUE); item_set(ITEM_6_HOURGLASS, TRUE);
D_803830E0->unk15 = 0; sD_803830E0->answer_cursor_cooldown = 0;
D_803830E0->unk13 = 1U; sD_803830E0->answer_cursor_index = 1U;
for (i = 1; i < 4; i++) { for (i = 1; i < 4; i++) {
func_80319758(i, BOOL(i == D_803830E0->unk13)); __gcquiz_set_box_highlight(i, BOOL(i == sD_803830E0->answer_cursor_index));
} }
break; break;
case 7: //80319C0C case GCQUIZ_STATE_7_CHECK_GIVEN_ANSWER:
if (D_803830E0->unk0 != -1) { if (sD_803830E0->question_type != -1) {
D_803830E0->unk11 = (D_803830E0->unk12 == -1) ? -1 sD_803830E0->unk11 = (sD_803830E0->selected_answer_index == -1) ? -1
: (D_803830E0->unk1C[D_803830E0->unk12] == 1) ? 1 : (sD_803830E0->answer_values[sD_803830E0->selected_answer_index] == 1) ? 1
: 0; : 0;
} else { } else {
D_803830E0->unk11 = (s8) D_803830E0->unk12; sD_803830E0->unk11 = (s8) sD_803830E0->selected_answer_index;
} }
if (D_803830E0->unk12 != -1) { if (sD_803830E0->selected_answer_index != -1) {
for(i = 1; i < 4; i++){ for(i = 1; i < 4; i++){
if (i != D_803830E0->unk12) { if (i != sD_803830E0->selected_answer_index) {
gczoombox_minimize(D_803830E0->unk24[i]); gczoombox_minimize(sD_803830E0->zoomboxes[i]);
gczoombox_close(D_803830E0->unk24[i]); gczoombox_close(sD_803830E0->zoomboxes[i]);
} else { } else {
func_80318C48(D_803830E0->unk24[i], 0); gczoombox_func_80318C48(sD_803830E0->zoomboxes[i], FALSE);
} }
} }
} }
timedFunc_set_1(1.0f, func_803197AC, 8); timedFunc_set_1(1.0f, __gcquiz_advanceStateTo, GCQUIZ_STATE_8_UNKNOWN);
item_set(ITEM_6_HOURGLASS, FALSE); item_set(ITEM_6_HOURGLASS, FALSE);
break; break;
case 8: //80319CFC case GCQUIZ_STATE_8_UNKNOWN:
if (D_803830E0->unk0 != -1) { if (sD_803830E0->question_type != -1) {
comusic_playTrack((D_803830E0->unk11 == 1)? COMUSIC_2B_DING_B : COMUSIC_2C_BUZZER); comusic_playTrack((sD_803830E0->unk11 == 1)? COMUSIC_2B_DING_B : COMUSIC_2C_BUZZER);
} else { } else {
comusic_playTrack(COMUSIC_2B_DING_B); comusic_playTrack(COMUSIC_2B_DING_B);
} }
timedFunc_set_1(1.0f, func_803197AC, 9); timedFunc_set_1(1.0f, __gcquiz_advanceStateTo, GCQUIZ_STATE_9_UNKNOWN);
break; break;
case 9: //80319D6C case GCQUIZ_STATE_9_UNKNOWN:
func_8031A3E4(); __gcquiz_closeZoomboxes();
break; break;
case 10: //80319D80 case GCQUIZ_STATE_A_UNKNOWN:
if (D_803830E0->unk8 != NULL) { if (sD_803830E0->unk8 != NULL) {
D_803830E0->unk8(D_803830E0->unk4, D_803830E0->unk11); sD_803830E0->unk8(sD_803830E0->unk4, sD_803830E0->unk11);
} }
for(i = 1; i < 4; i++){ for(i = 1; i < 4; i++){
gczoombox_free(D_803830E0->unk24[i]); gczoombox_free(sD_803830E0->zoomboxes[i]);
D_803830E0->unk24[i] = NULL; sD_803830E0->zoomboxes[i] = NULL;
} }
func_8025A55C(-1, 500, 10); func_8025A55C(-1, 500, 10);
break; break;
@@ -458,109 +476,112 @@ void func_803197AC(s32 arg0){
default: default:
break; break;
} }
D_803830E0->unk10 = arg0; sD_803830E0->state = state;
} }
void func_80319E20(s32 arg0, s32 arg1) { void __gcquiz_func_80319E20(s32 portrait_id, s32 zoombox_state) {
if (arg1 == 3) { if (zoombox_state == 3) {
if (arg0 == D_803830E0->unk20[0]) { if (portrait_id == sD_803830E0->portait_ids[0]) {
if (D_803830E0->unk8 != NULL) { if (sD_803830E0->unk8 != NULL) {
D_803830E0->unk8(D_803830E0->unk4, D_803830E0->unk11); sD_803830E0->unk8(sD_803830E0->unk4, sD_803830E0->unk11);
} }
} else { } else {
func_803197AC(D_803830E0->unk10 + 1); __gcquiz_advanceStateTo(sD_803830E0->state + 1);
} }
} else if (arg1 == 5) { } else if (zoombox_state == 5) {
D_803830E0->unk14++; sD_803830E0->unk14++;
} }
} }
void func_80319EA4(void) { // handle selection in zoombox?
s32 sp58[6]; void gcquiz_func_80319EA4(void) {
f32 sp4C[3]; s32 face_button_states[6];
f32 joystick_states[3];
s32 phi_s0; s32 phi_s0;
f32 sp44; f32 sp44;
if(getGameMode() != GAME_MODE_3_NORMAL && func_802E4A08() == 0) if(getGameMode() != GAME_MODE_3_NORMAL && func_802E4A08() == FALSE)
return; return;
if(D_803830E0 == NULL) if(sD_803830E0 == NULL)
return; return;
controller_copyFaceButtons(0, sp58); controller_copyFaceButtons(0, face_button_states);
controller_getJoystick(0, sp4C); controller_getJoystick(0, joystick_states);
for(phi_s0 = 0; phi_s0 < 4; phi_s0++){ for(phi_s0 = 0; phi_s0 < 4; phi_s0++){
gczoombox_update(D_803830E0->unk24[phi_s0]); gczoombox_update(sD_803830E0->zoomboxes[phi_s0]);
} }
switch (D_803830E0->unk10) { switch (sD_803830E0->state) {
case 1: case GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX:
if (func_8028EFC8() && (sp58[FACE_BUTTON(BUTTON_B)] == 1)) { if (func_8028EFC8() && (face_button_states[FACE_BUTTON(BUTTON_B)] == 1)) {
sp44 = func_80319040(0); sp44 = __gcquiz_animation_duration(0);
func_803184C8(D_803830E0->unk24[0], 100.0f, 2, 4, sp44, func_80319028(0), 0); gczoombox_func_803184C8(sD_803830E0->zoomboxes[0], 100.0f, 2, 4, sp44, __gcquiz_isZero(0), 0);
return; return;
} }
break; break;
case 6: case GCQUIZ_STATE_6_SELECT_QUIZ_ANSWER:
if (D_803830E0->unk15 > 0) { if (sD_803830E0->answer_cursor_cooldown > 0) {
D_803830E0->unk15--; sD_803830E0->answer_cursor_cooldown--;
} else { } else {
if (sp4C[1] > 0.75) { if (joystick_states[1] > 0.75) {
if (D_803830E0->unk13 >= 2) { if (sD_803830E0->answer_cursor_index >= 2) {
func_80319758(D_803830E0->unk13, 0); __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, FALSE);
D_803830E0->unk13--; sD_803830E0->answer_cursor_index--;
func_80319758(D_803830E0->unk13, 1); __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, TRUE);
func_803160A8(D_803830E0->unk24[D_803830E0->unk13]); gczoombox_func_803160A8(sD_803830E0->zoomboxes[sD_803830E0->answer_cursor_index]);
D_803830E0->unk15 = 4U; sD_803830E0->answer_cursor_cooldown = 4U;
} }
} else if (sp4C[1] < -0.75) { } else if (joystick_states[1] < -0.75) {
if (D_803830E0->unk13 < 3) { if (sD_803830E0->answer_cursor_index < 3) {
func_80319758(D_803830E0->unk13, 0); __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, FALSE);
D_803830E0->unk13++; sD_803830E0->answer_cursor_index++;
func_80319758(D_803830E0->unk13, 1); __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, TRUE);
func_803160A8(D_803830E0->unk24[D_803830E0->unk13]); gczoombox_func_803160A8(sD_803830E0->zoomboxes[sD_803830E0->answer_cursor_index]);
D_803830E0->unk15 = 4U; sD_803830E0->answer_cursor_cooldown = 4U;
} }
} }
} }
if ((sp58[FACE_BUTTON(BUTTON_A)] == 1) || (item_empty(ITEM_0_HOURGLASS_TIMER))) { if ((face_button_states[FACE_BUTTON(BUTTON_A)] == 1) || (item_empty(ITEM_0_HOURGLASS_TIMER))) {
D_803830E0->unk12 = (u8) D_803830E0->unk13; sD_803830E0->selected_answer_index = (u8) sD_803830E0->answer_cursor_index;
} }
if ((s8) D_803830E0->unk12 != -1) { if ((s8) sD_803830E0->selected_answer_index != -1) {
func_803197AC(7); __gcquiz_advanceStateTo(GCQUIZ_STATE_7_CHECK_GIVEN_ANSWER);
return; return;
} }
break; break;
case 9: case GCQUIZ_STATE_9_UNKNOWN:
if (D_803830E0->unk14 == 4) { if (sD_803830E0->unk14 == 4) {
func_803197AC(0xA); __gcquiz_advanceStateTo(GCQUIZ_STATE_A_UNKNOWN);
return; return;
} }
break; break;
case 10: case GCQUIZ_STATE_A_UNKNOWN:
func_803197AC(0); __gcquiz_advanceStateTo(GCQUIZ_STATE_0_INITIAL);
break; break;
} }
} }
bool func_8031A154(enum ff_question_type_e q_type, s32 q_indx, s32 arg2, s32 arg3, s32 arg4, void (*arg5)(s32, s32)) { bool gcquiz_func_8031A154(enum ff_question_type_e q_type, s32 q_index, s32 arg2, s32 arg3, s32 arg4, void (*arg5)(s32, s8)) {
if (func_803192A4(q_type, q_indx, arg2) != 0) { if (__gcquiz_func_803192A4(q_type, q_index, arg2) != FALSE) {
D_803830E0->unk0 = q_type; sD_803830E0->question_type = q_type;
D_803830E0->unk1 = q_indx; sD_803830E0->question_index = q_index;
D_803830E0->unk2 = arg2; sD_803830E0->unk2 = arg2;
D_803830E0->unk3 = arg3; sD_803830E0->quiz_question_time = arg3;
D_803830E0->unk4 = arg4; sD_803830E0->unk4 = arg4;
D_803830E0->unk8 = arg5; sD_803830E0->unk8 = arg5;
item_set(ITEM_6_HOURGLASS, FALSE); item_set(ITEM_6_HOURGLASS, FALSE);
func_80318DA0(D_803830E0->unk1C, 1, 3, 1, 3); __gcquiz_uniquelyRandomizeValuesInPointer(sD_803830E0->answer_values, 1, 3, 1, 3);
func_8025A55C(6000, 500, 10); func_8025A55C(6000, 500, 10);
func_803197AC(1); __gcquiz_advanceStateTo(GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX);
return TRUE; return TRUE;
} }
return FALSE; return FALSE;
} }
bool func_8031A22C(u8 *arg0, s8 *arg1, Struct_Core2_91E10_1 *arg2, s32 arg3, void (*arg4)(s32, s32)) { // unused but making this static differs checksum
bool __gcquiz_unused(u8 *arg0, s8 *arg1, QuizQuestionStruct *arg2, s32 arg3, void (*arg4)(s32, s8)) {
s32 temp_v0; s32 temp_v0;
s8 *temp_a2; s8 *temp_a2;
s8 *temp_s0; s8 *temp_s0;
@@ -574,81 +595,81 @@ bool func_8031A22C(u8 *arg0, s8 *arg1, Struct_Core2_91E10_1 *arg2, s32 arg3, voi
s32 j; s32 j;
s8 *phi_s0; s8 *phi_s0;
if (func_8031A3BC()) { if (gcquiz_isNotInInitialState()) {
return 0; return FALSE;
} }
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
D_803830E0->unk20[i] = arg0[i]; sD_803830E0->portait_ids[i] = arg0[i];
D_803830E0->unk18[i] = arg1[i]; sD_803830E0->answer_str_counts[i] = arg1[i];
for(j = 0; j < arg1[i]; j++){ for(j = 0; j < arg1[i]; j++){
D_803830E0->unk34.unk0[i][j] = arg2->unk0[i][j]; sD_803830E0->quiz_question.answer_options[i][j] = arg2->answer_options[i][j];
} }
D_803830E0->unk1C[i] = i; sD_803830E0->answer_values[i] = i;
} }
if (D_803830E0->unk20[0] != 0) { if (sD_803830E0->portait_ids[0] != NULL) {
gczoombox_loadSprite(D_803830E0->unk24[0], D_803830E0->unk20[0]); gczoombox_loadSprite(sD_803830E0->zoomboxes[0], sD_803830E0->portait_ids[0]);
} }
D_803830E0->unk0 = -1; sD_803830E0->question_type = -1;
D_803830E0->unk1 = -1; sD_803830E0->question_index = -1;
D_803830E0->unk2 = -1; sD_803830E0->unk2 = -1;
D_803830E0->unk3 = (s8) arg3; sD_803830E0->quiz_question_time = (s8) arg3;
D_803830E0->unk4 = 0; sD_803830E0->unk4 = 0;
D_803830E0->unk8 = arg4; sD_803830E0->unk8 = arg4;
func_8025A55C(6000, 500, 10); func_8025A55C(6000, 500, 10);
func_803197AC(1); __gcquiz_advanceStateTo(GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX);
return TRUE; return TRUE;
} }
void func_8031A388(u8 arg0, u8 arg1) { // unused but making this static differs checksum
if (D_803830E0 != NULL) { void __gcquiz_unused2(u8 arg0, u8 arg1) {
D_803830E0->unk16 = arg0; if (sD_803830E0 != NULL) {
D_803830E0->unk17 = arg1; sD_803830E0->unk16 = arg0;
sD_803830E0->unk17 = arg1;
} }
} }
bool func_8031A3BC(void){ bool gcquiz_isNotInInitialState(){
return (D_803830E0 != NULL)? D_803830E0->unk10 != 0: FALSE; return (sD_803830E0 != NULL) ? sD_803830E0->state != GCQUIZ_STATE_0_INITIAL: FALSE;
} }
//gcquiz_close static void __gcquiz_closeZoomboxes(){
void func_8031A3E4(void){
s32 i; s32 i;
if(D_803830E0 != NULL){ if(sD_803830E0 != NULL){
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
gczoombox_minimize(D_803830E0->unk24[i]); gczoombox_minimize(sD_803830E0->zoomboxes[i]);
gczoombox_close(D_803830E0->unk24[i]); gczoombox_close(sD_803830E0->zoomboxes[i]);
} }
} }
} }
s32 func_8031A454(void){ // unused but making this static differs checksum
s32 gcquiz_unused3(){
return 4; return 4;
} }
//__gcquiz_get_type_count s32 gcquiz_getLastIndexOfQuestionType(enum ff_question_type_e question_type) {
s32 func_8031A45C(enum ff_question_type_e question_type){ return __gcquiz_get_type_end_id(question_type) - __gcquiz_get_type_start_id(question_type);
return func_80318F1C(question_type) - func_80318ED8(question_type);
} }
void func_8031A48C(void) { void gcquiz_func_8031A48C(void) {
if ((D_803830E0 != NULL) && (D_803830E0->unk10 == 1)) { if ((sD_803830E0 != NULL) && (sD_803830E0->state == GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX)) {
func_803197AC(2); __gcquiz_advanceStateTo(GCQUIZ_STATE_2_SHOW_PORTRAITS_FOR_QUESTION);
} }
} }
//gcquiz_defrag void gcquiz_defrag() {
void func_8031A4CC(void) {
s32 i; s32 i;
if (D_803830E0 != NULL) { if (sD_803830E0 != NULL) {
for(i = 0; i < 4; i++){ for(i = 0; i < 4; i++){
gczoombox_defrag(D_803830E0->unk24[i]); gczoombox_defrag(sD_803830E0->zoomboxes[i]);
D_803830E0->unk24[i] = (GcZoombox *)defrag(D_803830E0->unk24[i]); sD_803830E0->zoomboxes[i] = (GcZoombox *)defrag(sD_803830E0->zoomboxes[i]);
} }
if (func_8031A3BC() == 0) { if (gcquiz_isNotInInitialState() == FALSE) {
D_803830E0->unkC = (QuizQuestionBin *)defrag(D_803830E0->unkC); sD_803830E0->unkC = (QuizQuestionBin *)defrag(sD_803830E0->unkC);
} }
D_803830E0 = (Struct_Core2_91E10 *)defrag(D_803830E0); sD_803830E0 = (Struct_Core2_91E10 *)defrag(sD_803830E0);
} }
} }

View File

@@ -10,10 +10,9 @@ struct {
u8 unk0; u8 unk0;
char *ptr; char *ptr;
s32 index; s32 index;
} } s_dialogBin;
s_dialogBin;
s32 func_8031B5B0(void) { s32 code94620_func_8031B5B0(void) {
return s_dialogBin.unk0; return s_dialogBin.unk0;
} }
@@ -55,7 +54,7 @@ char *dialogBin_get(enum asset_e text_id) {
//get text_bin from asset cache //get text_bin from asset cache
s_dialogBin.ptr = assetcache_get(text_id); s_dialogBin.ptr = assetcache_get(text_id);
sp1C = s_dialogBin.ptr + 1; sp1C = s_dialogBin.ptr + 1;
sp1C += func_8031B5B0()*2; sp1C += code94620_func_8031B5B0()*2;
var_a0 = *(sp1C++); var_a0 = *(sp1C++);
var_a0 += *(sp1C++)<< 8; var_a0 += *(sp1C++)<< 8;
if(sp1C); if(sp1C);

View File

@@ -477,7 +477,7 @@ void func_8033BD8C(void* arg0){
func_8033B0D0(arg0); func_8033B0D0(arg0);
} }
s32 func_8033BDAC(enum asset_e id, void *dst, s32 size) { s32 code_B3A80_func_8033BDAC(enum asset_e id, void *dst, s32 size) {
s32 comp_size; s32 comp_size;
s32 var_s0; s32 var_s0;
s32 sp34; s32 sp34;

View File

@@ -8,7 +8,7 @@ extern struct FF_StorageStruct *D_8037DCB8;
void func_80350E00(void){ void func_80350E00(void){
quizQuestionAskedBitfield_defrag(); quizQuestionAskedBitfield_defrag();
func_8031A4CC(); gcquiz_defrag();
if(D_8037DCB8 == NULL) if(D_8037DCB8 == NULL)
return; return;

View File

@@ -725,7 +725,7 @@ void func_80310A5C(s32 next_state, s32 arg1, s32 arg2, s32 arg3, s32 arg4){
f32 tmpf; f32 tmpf;
for(i = 0, tmpf = 0.4f; i< 2; i++){ for(i = 0, tmpf = 0.4f; i< 2; i++){
if(g_Dialog.zoombox[i]){ if(g_Dialog.zoombox[i]){
func_803184C8(g_Dialog.zoombox[i], arg2, next_state, arg1, tmpf, arg3, arg4); gczoombox_func_803184C8(g_Dialog.zoombox[i], arg2, next_state, arg1, tmpf, arg3, arg4);
} }
} }
} }

View File

@@ -243,7 +243,7 @@ void gcpausemenu_zoomboxes_initMainMenu(void) {
s32 i; s32 i;
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
D_80383010.zoombox[i] = gczoombox_new(D_8036C4E0[i].y, D_8036C4E0[i].portrait, 2, 0, gcpausemenu_zoombox_callback); D_80383010.zoombox[i] = gczoombox_new(D_8036C4E0[i].y, D_8036C4E0[i].portrait, 2, 0, gcpausemenu_zoombox_callback);
func_803184C8(D_80383010.zoombox[i], 60.0f, 5, 2, 0.3f, 0, 0); gczoombox_func_803184C8(D_80383010.zoombox[i], 60.0f, 5, 2, 0.3f, 0, 0);
func_80318640(D_80383010.zoombox[i], 0x1C, 0.75f, 0.9f, 0); func_80318640(D_80383010.zoombox[i], 0x1C, 0.75f, 0.9f, 0);
func_80318760(D_80383010.zoombox[i], 8000); func_80318760(D_80383010.zoombox[i], 8000);
} }
@@ -254,7 +254,7 @@ void gcpausemenu_zoomboxes_initTotalsMenu(void) {
for (i = 0; i < 4; i++) { for (i = 0; i < 4; i++) {
D_80383010.zoombox[i] = gczoombox_new(D_8036C520[i].y, D_8036C520[i].portrait, (i == 3) ? 1 : 2, 0, gcpausemenu_zoombox_callback); D_80383010.zoombox[i] = gczoombox_new(D_8036C520[i].y, D_8036C520[i].portrait, (i == 3) ? 1 : 2, 0, gcpausemenu_zoombox_callback);
func_803184C8(D_80383010.zoombox[i], 40.0f, 5, 2, 0.3f, 0, 0); gczoombox_func_803184C8(D_80383010.zoombox[i], 40.0f, 5, 2, 0.3f, 0, 0);
func_80318640(D_80383010.zoombox[i], 0x46, 0.9f, 0.7f, 1); func_80318640(D_80383010.zoombox[i], 0x46, 0.9f, 0.7f, 1);
func_80318760(D_80383010.zoombox[i], 8000); func_80318760(D_80383010.zoombox[i], 8000);
} }
@@ -1006,7 +1006,7 @@ s32 gcPauseMenu_update(void) {
}//L80313664 }//L80313664
else { else {
if (D_80383010.selection == PAUSE_SELECTION_2_VIEW_TOTALS && !D_80383010.unk3_6) { if (D_80383010.selection == PAUSE_SELECTION_2_VIEW_TOTALS && !D_80383010.unk3_6) {
func_803160A8(D_80383010.zoombox[D_80383010.selection]); gczoombox_func_803160A8(D_80383010.zoombox[D_80383010.selection]);
D_80383010.unk3_6 = 1; D_80383010.unk3_6 = 1;
} }
@@ -1018,7 +1018,7 @@ s32 gcPauseMenu_update(void) {
D_80383010.selection--; D_80383010.selection--;
} }
gczoombox_highlight(D_80383010.zoombox[D_80383010.selection], TRUE); gczoombox_highlight(D_80383010.zoombox[D_80383010.selection], TRUE);
func_803160A8(D_80383010.zoombox[D_80383010.selection]); gczoombox_func_803160A8(D_80383010.zoombox[D_80383010.selection]);
D_80383010.unk3_6 = 0; D_80383010.unk3_6 = 0;
D_80383010.unk7 = 6; D_80383010.unk7 = 6;
} }
@@ -1031,7 +1031,7 @@ s32 gcPauseMenu_update(void) {
D_80383010.selection++; D_80383010.selection++;
} }
gczoombox_highlight(D_80383010.zoombox[D_80383010.selection], 1); gczoombox_highlight(D_80383010.zoombox[D_80383010.selection], 1);
func_803160A8(D_80383010.zoombox[D_80383010.selection]); gczoombox_func_803160A8(D_80383010.zoombox[D_80383010.selection]);
D_80383010.unk3_6 = 0; D_80383010.unk3_6 = 0;
D_80383010.unk7 = 6; D_80383010.unk7 = 6;
} }
@@ -1039,7 +1039,7 @@ s32 gcPauseMenu_update(void) {
} }
if (D_80383010.selection == 2 && !D_80383010.unk3_6 && D_80383010.unk7 == 3) { if (D_80383010.selection == 2 && !D_80383010.unk3_6 && D_80383010.unk7 == 3) {
func_803160A8(D_80383010.zoombox[D_80383010.selection]); gczoombox_func_803160A8(D_80383010.zoombox[D_80383010.selection]);
D_80383010.unk3_6 = 1; D_80383010.unk3_6 = 1;
} }
break; break;

View File

@@ -766,7 +766,7 @@ void func_80315C90(GcZoombox *this, s32 arg1) {
} }
} }
void func_803160A8(GcZoombox *this) { void gczoombox_func_803160A8(GcZoombox *this) {
f32 temp_f14; f32 temp_f14;
f32 phi_f14; f32 phi_f14;
s32 phi_a0; s32 phi_a0;
@@ -1451,7 +1451,7 @@ GcZoombox *gczoombox_new(s32 y, GcZoomboxSprite portrait_id, s32 arg2, s32 arg3,
animctrl_setIndex(this->anim_ctrl, ASSET_138_ANIM_ZOOMBOX); animctrl_setIndex(this->anim_ctrl, ASSET_138_ANIM_ZOOMBOX);
animctrl_start(this->anim_ctrl, "gczoombox.c", 0x6fd); animctrl_start(this->anim_ctrl, "gczoombox.c", 0x6fd);
func_803184C8(this, 15.0f, 5, 2, 0.4f, 0, 0); //func_803184C8(this, 15.0f, 5, 2, D_80378940, 0, 0); gczoombox_func_803184C8(this, 15.0f, 5, 2, 0.4f, 0, 0); //gczoombox_func_803184C8(this, 15.0f, 5, 2, D_80378940, 0, 0);
this->unk176 = D_8036C6C0[portrait_id].unk2; this->unk176 = D_8036C6C0[portrait_id].unk2;
this->unk177 = D_8036C6C0[portrait_id].unk3; this->unk177 = D_8036C6C0[portrait_id].unk3;
this->unk100 = 0; this->unk100 = 0;
@@ -1558,14 +1558,14 @@ void func_803184B8(GcZoombox *this){
this->unk13A &= (u8)~(0x20); this->unk13A &= (u8)~(0x20);
} }
void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6) { void gczoombox_func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 animation_duration, bool arg5, bool arg6) {
if (this != NULL) { if (this != NULL) {
this->unk182 = arg2; this->unk182 = arg2;
this->unk184 = arg3; this->unk184 = arg3;
this->unk190 = 1.0 / arg1; this->unk190 = 1.0 / arg1;
if (this->anim_ctrl != NULL) { if (this->anim_ctrl != NULL) {
animctrl_setDuration(this->anim_ctrl, arg4); animctrl_setDuration(this->anim_ctrl, animation_duration);
} }
this->unk1A4_12 = BOOL(arg5); this->unk1A4_12 = BOOL(arg5);
this->unk1A4_10 = BOOL(arg6); this->unk1A4_10 = BOOL(arg6);
@@ -1583,8 +1583,8 @@ bool func_8031857C(GcZoombox *this, u8 *str){
return FALSE; return FALSE;
} }
void gczoombox_highlight(GcZoombox *this, bool arg1){ void gczoombox_highlight(GcZoombox *this, bool should_highlight){
if(arg1) if(should_highlight)
this->highlighted = 1; this->highlighted = 1;
else else
this->highlighted = 0; this->highlighted = 0;
@@ -1632,7 +1632,7 @@ void func_80318760(GcZoombox *this, s32 arg1){
this->unk12E = arg1; this->unk12E = arg1;
} }
void func_80318774(GcZoombox *this){ void gczoombox_setUnk13ATo0(GcZoombox *this){
this->unk13A = 0; this->unk13A = 0;
} }
@@ -1765,10 +1765,10 @@ void gczoombox_defrag(GcZoombox *this) {
} }
} }
void func_80318C48(GcZoombox *this, s32 arg1) { void gczoombox_func_80318C48(GcZoombox *this, bool arg1) {
if (this != NULL) { if (this != NULL) {
if (this->unk1A4_30) { if (this->unk1A4_30) {
if (arg1 != 0) { if (arg1 != FALSE) {
if (this->unk0[0] == 0xFD) { if (this->unk0[0] == 0xFD) {
this->unk0[1] = 0x68; this->unk0[1] = 0x68;
} else { } else {
@@ -1783,7 +1783,7 @@ void func_80318C48(GcZoombox *this, s32 arg1) {
} }
} }
if (this->unk1A4_29) { if (this->unk1A4_29) {
if (arg1 != 0) { if (arg1 != FALSE) {
if (this->unk30[0] == 0xFD) { if (this->unk30[0] == 0xFD) {
this->unk30[1] = 0x68; this->unk30[1] = 0x68;
return; return;

View File

@@ -207,7 +207,7 @@ typedef struct {
void gczoombox_free(GcZoombox *this); void gczoombox_free(GcZoombox *this);
void func_803160A8(GcZoombox *this); void gczoombox_func_803160A8(GcZoombox *this);
void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx); void func_803163A8(GcZoombox *this, Gfx **gfx, Mtx **mtx);
void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BKSpriteDisplayData *arg5, f32 arg6); void func_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BKSpriteDisplayData *arg5, f32 arg6);
void func_80316764(GcZoombox *this, s32 arg1); void func_80316764(GcZoombox *this, s32 arg1);
@@ -231,7 +231,7 @@ void func_80318488(GcZoombox *this);
void func_80318498(GcZoombox *this); void func_80318498(GcZoombox *this);
void gczoombox_resolve_minimize(GcZoombox *this); void gczoombox_resolve_minimize(GcZoombox *this);
void func_803184B8(GcZoombox *this); void func_803184B8(GcZoombox *this);
void func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6); void gczoombox_func_803184C8(GcZoombox *this, f32 arg1, s32 arg2, s32 arg3, f32 arg4, bool arg5, bool arg6);
bool func_8031857C(GcZoombox *this, u8 *str); bool func_8031857C(GcZoombox *this, u8 *str);
void gczoombox_highlight(GcZoombox *this, bool arg1); void gczoombox_highlight(GcZoombox *this, bool arg1);
bool gczoombox_is_highlighted(GcZoombox *this); bool gczoombox_is_highlighted(GcZoombox *this);
@@ -239,7 +239,7 @@ void func_80318614(GcZoombox *this, int arg1);
void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4); void func_80318640(GcZoombox *this, s32 arg1, f32 arg2, f32 arg3, s32 arg4);
void func_80318734(GcZoombox *this, f32 arg1); void func_80318734(GcZoombox *this, f32 arg1);
void func_80318760(GcZoombox *this, s32 arg1); void func_80318760(GcZoombox *this, s32 arg1);
void func_80318774(GcZoombox *this); void gczoombox_setUnk13ATo0(GcZoombox *this);
bool func_8031877C(GcZoombox *this); bool func_8031877C(GcZoombox *this);
bool func_803188B4(GcZoombox *this); bool func_803188B4(GcZoombox *this);
bool func_80318964(GcZoombox *this); bool func_80318964(GcZoombox *this);
@@ -247,6 +247,6 @@ bool gczoombox_loadSprite(GcZoombox *this, GcZoomboxSprite arg1);
void func_80318B7C(GcZoombox *this, s32 arg1); void func_80318B7C(GcZoombox *this, s32 arg1);
bool func_80318BEC(GcZoombox *this); bool func_80318BEC(GcZoombox *this);
void gczoombox_defrag(GcZoombox *this); void gczoombox_defrag(GcZoombox *this);
void func_80318C48(GcZoombox *this, s32 arg1); void gczoombox_func_80318C48(GcZoombox *this, bool arg1);
#endif // __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__ #endif // __BANJO_KAZOOIE_CORE2_GC_ZOOMBOX_H__

View File

@@ -71,7 +71,7 @@ void gzquiz_initGruntyQuestions(void) {
if (fileProgressFlag_get(FILEPROG_5C_FF_PATTERN_SET) && !volatileFlag_get(VOLATILE_FLAG_62_FF_GRUNTY_QUESTIONS_INITIALIZED)) { if (fileProgressFlag_get(FILEPROG_5C_FF_PATTERN_SET) && !volatileFlag_get(VOLATILE_FLAG_62_FF_GRUNTY_QUESTIONS_INITIALIZED)) {
rand_seed(fileProgressFlag_getN(FILEPROG_D3_FF_PATTERN, 8)); rand_seed(fileProgressFlag_getN(FILEPROG_D3_FF_PATTERN, 8));
for(i = 0; i < func_8031A45C(FFQT_3_GRUNTY); i++){ for(i = 0; i < gcquiz_getLastIndexOfQuestionType(FFQT_3_GRUNTY); i++){
question_id = VOLATILE_FLAG_26_FF_GRUNTY_QUESTIONS + 2 * i; question_id = VOLATILE_FLAG_26_FF_GRUNTY_QUESTIONS + 2 * i;
pattern = randi2(0, 3); pattern = randi2(0, 3);

View File

@@ -548,7 +548,7 @@ void func_8038CCEC(void)
free(D_8037DCB8); free(D_8037DCB8);
D_8037DCB8 = NULL; D_8037DCB8 = NULL;
func_80319190(); gcquiz_free();
quizQuestionAskedBitfield_free(); quizQuestionAskedBitfield_free();
func_802C5994(); func_802C5994();
} }
@@ -590,7 +590,7 @@ void func_8038CE28(void)
{ {
s32 i; s32 i;
func_80319050(); gcquiz_init();
D_8037DCB8 = malloc(sizeof(struct FF_StorageStruct)); D_8037DCB8 = malloc(sizeof(struct FF_StorageStruct));
quizQuestionAskedBitfield_init(); quizQuestionAskedBitfield_init();
@@ -681,9 +681,8 @@ void lair_func_8038CF18(void)
} }
} }
s32 func_8038D0AC(s32 questionType, s32 a1) static s32 __code5ED0_getQuizQuestionTime(s32 questionType, s32 a1)
{ {
// :morphone: tf
return 10; return 10;
} }
@@ -912,7 +911,7 @@ void func_8038D670(enum FF_Action next_state) {
func_8028F918(2); func_8028F918(2);
if (D_8037DCB8->ffQuestionType != FFQT_4_MINIGAME) { if (D_8037DCB8->ffQuestionType != FFQT_4_MINIGAME) {
func_8038CE00(); func_8038CE00();
func_8031A154(D_8037DCB8->ffQuestionType, D_8037DCB8->unkD, D_8037DCB8->unkE, func_8038D0AC(D_8037DCB8->ffQuestionType, D_8037DCB8->unkC), 0, &func_8038D3F0); gcquiz_func_8031A154(D_8037DCB8->ffQuestionType, D_8037DCB8->unkD, D_8037DCB8->unkE, __code5ED0_getQuizQuestionTime(D_8037DCB8->ffQuestionType, D_8037DCB8->unkC), 0, &func_8038D3F0);
} else { } else {
func_8038D4BC(); func_8038D4BC();
} }
@@ -943,7 +942,7 @@ void func_8038D670(enum FF_Action next_state) {
break; break;
}//L8038D91C }//L8038D91C
} }
func_8031A48C(); gcquiz_func_8031A48C();
break; break;
case FFA_6_TRIGGER_QUESTION_POST_EFFECTS: //L8038D940 case FFA_6_TRIGGER_QUESTION_POST_EFFECTS: //L8038D940
@@ -1157,7 +1156,7 @@ void lair_func_8038E0B0(void) {
&& (D_8037DCB8 != NULL) && (D_8037DCB8 != NULL)
&& (D_8037DCB8->unk0 != NULL) && (D_8037DCB8->unk0 != NULL)
){ ){
func_80319EA4(); gcquiz_func_80319EA4();
func_8038C9D0(); func_8038C9D0();
controller_copyFaceButtons(0, sp48); controller_copyFaceButtons(0, sp48);
func_8024E60C(0, sp3C); func_8024E60C(0, sp3C);
@@ -1328,7 +1327,7 @@ void lair_func_8038E768(Gfx **dl, Mtx **m, Vtx **v)
if (map_get() != MAP_8E_GL_FURNACE_FUN) if (map_get() != MAP_8E_GL_FURNACE_FUN)
return; return;
func_80319214(dl, m, v); gcquiz_draw(dl, m, v);
gczoombox_draw(D_8037DCB8->unk20, dl, m, v); gczoombox_draw(D_8037DCB8->unk20, dl, m, v);
} }

View File

@@ -131,7 +131,7 @@ void func_80390E28(Actor *this) {
switch (this->state) { switch (this->state) {
case 0: case 0:
if( !func_8031A3BC() && (sp38 < 2) && (randf() < 0.1) && !mapSpecificFlags_get(0xA) && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) { if( gcquiz_isNotInInitialState() == FALSE && (sp38 < 2) && (randf() < 0.1) && !mapSpecificFlags_get(0xA) && !volatileFlag_get(VOLATILE_FLAG_1F_IN_CHARACTER_PARADE)) {
sp38++; sp38++;
mapSpecificFlags_setN(0, sp38, 2); mapSpecificFlags_setN(0, sp38, 2);
func_80390D3C(this, (randf() < 0.5) ? 2 :1); func_80390D3C(this, (randf() < 0.5) ? 2 :1);

View File

@@ -240,7 +240,7 @@ void func_80391B04(Actor *this) {
func_8038E9A4(local->unk10, this->position); func_8038E9A4(local->unk10, this->position);
switch (this->state) { /* irregular */ switch (this->state) { /* irregular */
case 1: case 1:
if (func_8031A3BC() || mapSpecificFlags_get(0xA)) { if (gcquiz_isNotInInitialState() || mapSpecificFlags_get(0xA)) {
func_80391810(this, 4); func_80391810(this, 4);
break; break;
} }

View File

@@ -86,7 +86,7 @@ void func_80392700(Actor *this) {
this->marker->unk2C_2 = TRUE; this->marker->unk2C_2 = TRUE;
} }
} }
this->unk58_0 = !func_8031A3BC(); this->unk58_0 = !gcquiz_isNotInInitialState();
} }