diff --git a/include/enums.h b/include/enums.h index 7cf52801..76f2e368 100644 --- a/include/enums.h +++ b/include/enums.h @@ -4529,6 +4529,210 @@ enum asset_e ASSET_1157_TEXT_FINALBOSS_PHASE_5_OPTION_4, 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_146C_MODEL_TTC_TREASURE_TROVE_COVE_XLU, ASSET_146D_MODEL_TTC_NIPPERS_SHELL_OPA, diff --git a/src/core2/ch/gameSelect.c b/src/core2/ch/gameSelect.c index 5bcf7c16..db5a6dcb 100644 --- a/src/core2/ch/gameSelect.c +++ b/src/core2/ch/gameSelect.c @@ -428,7 +428,7 @@ void func_802C4C14(Actor *this){ if(sp74[0] == 1){ if(gameFile_isNotEmpty(sp84)){ func_8031877C(chGameSelectTopZoombox); - func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[func_8031B5B0()]); + func_803183A4(chGameSelectTopZoombox, (&D_80365DFC)[code94620_func_8031B5B0()]); D_8037DD2C = 1; subaddie_set_state(this, 5); } @@ -551,7 +551,7 @@ void func_802C4C14(Actor *this){ } void func_802C5740(Actor * this){ - int i = func_8031B5B0(); + int i = code94620_func_8031B5B0(); D_8037DCE0.unk0 = (&D_80365DF4)[i]; D_8037DCE0.unk4 = (&D_80365DF8)[i]; @@ -560,7 +560,7 @@ void func_802C5740(Actor * this){ if(chGameSelectBottomZoombox == 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); + gczoombox_func_803184C8(chGameSelectBottomZoombox, 30.0f, 5, 2, 0.4f, 0, 0); }//L802C57FC if(chGameSelectTopZoombox == NULL){ diff --git a/src/core2/code_4C020.c b/src/core2/code_4C020.c index 89f40506..6c3196c2 100644 --- a/src/core2/code_4C020.c +++ b/src/core2/code_4C020.c @@ -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 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_80319EA4(void); +extern void gcquiz_func_80319EA4(void); extern void fileProgressFlag_set(enum file_progress_e, bool); 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){ 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 0x2d:// L802D5AB4 if(D_80367684 && D_80367684 == map_get()){ - func_80319EA4(); + gcquiz_func_80319EA4(); if(0.0f < D_8037DE08){ D_8037DE08 -= time_getDelta(); } diff --git a/src/core2/code_5C870.c b/src/core2/code_5C870.c index 38424f1f..75a1e6f7 100644 --- a/src/core2/code_5C870.c +++ b/src/core2/code_5C870.c @@ -624,7 +624,7 @@ s32 getGameMode(void){ return D_8037E8E0.game_mode; } -int func_802E4A08(void){ +bool func_802E4A08(void){ return (D_8037E8E0.game_mode == GAME_MODE_6_FILE_PLAYBACK) || (D_8037E8E0.game_mode == GAME_MODE_5_UNKNOWN) || (D_8037E8E0.game_mode == GAME_MODE_7_ATTRACT_DEMO) diff --git a/src/core2/code_6DA30.c b/src/core2/code_6DA30.c index f082f95b..559805df 100644 --- a/src/core2/code_6DA30.c +++ b/src/core2/code_6DA30.c @@ -386,7 +386,7 @@ void func_802F5060(s32 textureId){ tmp_a2 = func_802546E4(D_80380AB8[1]); if(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]); 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]); if(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]); D_80380AB8[3] = assetcache_get(SPRITE_BOLD_FONT_LETTERS_ALPHAMASK); } diff --git a/src/core2/code_91E10.c b/src/core2/code_91E10.c index ed23824e..66e4bfa3 100644 --- a/src/core2/code_91E10.c +++ b/src/core2/code_91E10.c @@ -7,57 +7,71 @@ extern void item_set(enum item_e, 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 { u8 cmd; u8 string_size; - //u8 str[]; -}StringBin; +} StringBin_Unused; typedef struct { u8 unk0; u8 unk1; -}QuizQuestionBin_Struct_1; +} QuizQuestionBin_Unused; typedef struct { u8 unk0; u8 unk1; u8 unk2; -}QuizQuestionBin; +} QuizQuestionBin; typedef struct{ - s32 unk0[4][4]; -}Struct_Core2_91E10_1; + s32 answer_options[4][4]; // first dimension = zoombox index, second dimension = value (0-3), third dimension = answer +} QuizQuestionStruct; typedef struct { - s8 unk0; //question_type - s8 unk1; //question_indx - s8 unk2; - u8 unk3; - s32 unk4; - void (*unk8)(s32, s32); + s8 question_type; // enum ff_question_type_e + s8 question_index; + s8 unk2; // always -1? + u8 quiz_question_time; // is either 0 or 10 (from __code5ED0_getQuizQuestionTime) + s32 unk4; // always 0 + void (*unk8)(s32, s8); // gets called with unk4 and unk11 QuizQuestionBin *unkC; //asset_bin - u8 unk10; //state + u8 state; s8 unk11; - s8 unk12; - u8 unk13; //selected_box_indx - u8 unk14; - u8 unk15; //cursor_cooldown - u8 unk16; - u8 unk17; - u8 unk18[4]; - s8 unk1C[4]; - s8 unk20[4]; //portrait_id - GcZoombox *unk24[4]; //zoombox - Struct_Core2_91E10_1 unk34; -}Struct_Core2_91E10; + s8 selected_answer_index; + u8 answer_cursor_index; + u8 unk14; // relevant for state = 9, from 0 to 4? + u8 answer_cursor_cooldown; + u8 unk16; // some value for zoombox (gczoombox_func_803184C8) + u8 unk17; // some value for zoombox (gczoombox_func_803184C8) + u8 answer_str_counts[4]; + s8 answer_values[4]; + s8 portait_ids[4]; + GcZoombox *zoomboxes[4]; + QuizQuestionStruct quiz_question; +} Struct_Core2_91E10; -void func_803197AC(s32 arg0); -void func_80319E20(s32 arg0, s32 arg1); -void func_8031A3E4(void); +static void __gcquiz_advanceStateTo(enum gcquiz_state state); +static void __gcquiz_func_80319E20(s32 portrait_id, s32 state); +static void __gcquiz_closeZoomboxes(void); -u8 D_8036D940[] = { - 0, +#define SELECTABLE_PORTAIT_COUNT 0x2C + +static u8 sPortraits[SELECTABLE_PORTAIT_COUNT+1] = { + NULL, ZOOMBOX_SPRITE_11_CHIMPY, ZOOMBOX_SPRITE_12_CONGA, ZOOMBOX_SPRITE_13_BLUBBER, @@ -105,57 +119,59 @@ u8 D_8036D940[] = { }; /* .bss */ -Struct_Core2_91E10 *D_803830E0; +Struct_Core2_91E10 *sD_803830E0; /* .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 j; - s32 unique; + bool is_unique; - for(i = min_indx; i <= max_indx; i++){ - /* assign unique random value*/ - do{ - /*assign random value */ - ptr[i] = randi2(min_value, max_value + 1); - unique = TRUE; - /* test uniqueness */ - for(j = min_indx; j < i; j++){ - if (ptr[i] == ptr[j]) { - unique = FALSE; - break; - } + for (i = min_index; i <= max_index; i++){ + /* assign is_unique random value*/ + do { + /*assign random value */ + ptr[i] = randi2(min_value, max_value + 1); + is_unique = TRUE; + /* test uniqueness */ + for(j = min_index; j < i; j++){ + if (ptr[i] == ptr[j]) { + is_unique = FALSE; + break; } - }while(unique == FALSE); + } + } while(is_unique == FALSE); } } -void func_80318E90(void) { - D_803830E0->unk20[0] = 0; - func_80318DA0(D_803830E0->unk20, 1, 3, 1, 0x2C); +static void __gcquiz_randomizePortaitIds(void) { + sD_803830E0->portait_ids[0] = 0; + __gcquiz_uniquelyRandomizeValuesInPointer(sD_803830E0->portait_ids, 1, 3, 1, SELECTABLE_PORTAIT_COUNT); } -//__gcquiz_get_type_start_id -enum asset_e func_80318ED8(enum ff_question_type_e question_type){ - switch(question_type){ - case FFQT_1_PICTURE: return 0x12DB; - case FFQT_2_SOUND: return 0x13A3; - case FFQT_3_GRUNTY: return 0x1407; +static enum asset_e __gcquiz_get_type_start_id(enum ff_question_type_e question_type) { + switch(question_type) { + case FFQT_1_PICTURE: return ASSET_12DB_FF_PICTURE_QUESTION; + case FFQT_2_SOUND: return ASSET_13A3_FF_SOUND_QUESTION; + case FFQT_3_GRUNTY: return ASSET_1407_FF_GRUNTY_QUESTION; } - return 0x1213; + + return ASSET_1213_FF_QUIZ_QUESTION; } -//__gcquiz_get_type_end_id -enum asset_e func_80318F1C(enum ff_question_type_e question_type){ - switch(question_type){ - case FFQT_1_PICTURE: return 0x12EE; - case FFQT_2_SOUND: return 0x13D6; - case FFQT_3_GRUNTY: return 0x1425; +static enum asset_e __gcquiz_get_type_end_id(enum ff_question_type_e question_type){ + switch(question_type) { + case FFQT_1_PICTURE: return ASSET_12ED_FF_PICTURE_QUESTION + 1; + case FFQT_2_SOUND: return ASSET_13D5_FF_SOUND_QUESTION + 1; + case FFQT_3_GRUNTY: return ASSET_1424_FF_GRUNTY_QUESTION + 1; } - 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_a0; @@ -163,7 +179,7 @@ s32 func_80318F60(enum ff_question_type_e question_type, s32 q_indx, s32 arg2) { phi_v1 = arg2; } else { 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 { 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; } -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; } -s32 func_80318FC0(s32 arg0){ - switch(arg0){ +static s32 __gcquiz_getZoomboxY(s32 arg0){ + switch(arg0) { case 1: return 40; case 2: return 80; case 3: return 120; } + return 0; } -s32 func_80319004(s32 arg0){ +static s32 __gcquiz_func_80319004(s32 arg0){ return arg0 == 0 ? 3 : 2; } -s32 func_8031901C(s32 arg0){ +static s32 __gcquiz_return0(s32 arg0){ return 0; } -bool func_80319028(s32 arg0){ +static bool __gcquiz_isZero(s32 arg0){ return arg0 != 0 ? FALSE : TRUE; } -//__gcquiz_animation_duration -f32 func_80319040(s32 arg0){ +static f32 __gcquiz_animation_duration(s32 arg0){ return 0.4f; } -void func_80319050(void) { +void gcquiz_init() { s32 i; - D_803830E0 = malloc(0x74); - D_803830E0->unkC = malloc(0x400); - D_803830E0->unk16 = 0x14U; - D_803830E0->unk17 = 0x1E; - D_803830E0->unk20[0] = 0; - D_803830E0->unk24[0] = gczoombox_new(func_80318FC0(0), 0, func_80319004(0), func_8031901C(0), func_80319E20); - func_803184C8(D_803830E0->unk24[0], (f32)D_803830E0->unk16, 5, 2, func_80319040(0), func_80319028(0), 0); + sD_803830E0 = malloc(sizeof(Struct_Core2_91E10)); + sD_803830E0->unkC = malloc(0x400); + sD_803830E0->unk16 = 0x14U; + sD_803830E0->unk17 = 0x1E; + sD_803830E0->portait_ids[0] = 0; + sD_803830E0->zoomboxes[0] = gczoombox_new(__gcquiz_getZoomboxY(0), 0, __gcquiz_func_80319004(0), __gcquiz_return0(0), __gcquiz_func_80319E20); + 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++){ - D_803830E0->unk20[i] = 0; - D_803830E0->unk24[i] = NULL; + sD_803830E0->portait_ids[i] = 0; + sD_803830E0->zoomboxes[i] = NULL; } - func_803197AC(0); + __gcquiz_advanceStateTo(GCQUIZ_STATE_0_INITIAL); } -void func_80319190(void) { +void gcquiz_free() { s32 i; - if (D_803830E0 != NULL) { - free(D_803830E0->unkC); - D_803830E0->unkC = NULL; + if (sD_803830E0 != NULL) { + free(sD_803830E0->unkC); + sD_803830E0->unkC = NULL; for(i = 0; i < 4; i++){ - gczoombox_free(D_803830E0->unk24[i]); - D_803830E0->unk24[i] = NULL; + gczoombox_free(sD_803830E0->zoomboxes[i]); + sD_803830E0->zoomboxes[i] = NULL; } - free(D_803830E0); - D_803830E0 = NULL; + free(sD_803830E0); + sD_803830E0 = NULL; } } -void func_80319214(Gfx **gfx, Mtx **mtx, Vtx **vtx) { +void gcquiz_draw(Gfx **gfx, Mtx **mtx, Vtx **vtx) { s32 i; - if (D_803830E0 != NULL) { + if (sD_803830E0 != NULL) { 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) { - //#define NEXT(iter) (*(((char *)(iter))++)) - //#define SKIP(iter,n) (((char *)(iter)) += (n)) +// randomize quiz question? +static bool __gcquiz_func_803192A4(enum ff_question_type_e q_type, s32 q_index, s32 arg2) { char *char_iter; - s32 temp_s0; + enum asset_e quiz_question_index; s32 temp_s2; s32 str_cnt; s32 phi_v1; - s32 sp60; + s32 zoombox_text_index; s32 phi_a1; - s32 sp58; - s32 sp54; - s32 sp50; - s32 sp4C; - s32 sp48; - s32 sp44; - s32 temp_v0_3; - s32 str_size; + s32 quiz_question_bin_unk0; + s32 quiz_question_bin_unk1; + s32 quiz_question_bin_unk2; + s32 first_answer_cmd; + s32 second_answer_cmd; + s32 third_answer_cmd; + s32 cmd; + s32 option_text; - temp_s0 = func_80318ED8(q_type) + q_indx; - if (func_8031A3BC()) { - return 0; + quiz_question_index = __gcquiz_get_type_start_id(q_type) + q_index; + if (gcquiz_isNotInInitialState()) { + return FALSE; } - if (func_8033BDAC(temp_s0, D_803830E0->unkC, 0x400) == 0) { - free(D_803830E0->unkC); - D_803830E0->unkC = (QuizQuestionBin *) assetcache_get(temp_s0); + + // not in asset cache? + 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 - sp54 = *(char_iter++); // NEXT - sp50 = *(char_iter++); // NEXT - sp4C = ((sp54 >= 2) ? func_80318F60(q_type, q_indx, arg2) : 0) + 1; - if (((sp50 == 0) || (func_80318FB4(q_type) != 0)) != 0) { + + char_iter = sD_803830E0->unkC; + quiz_question_bin_unk0 = *(char_iter++); // NEXT + quiz_question_bin_unk1 = *(char_iter++); // NEXT + quiz_question_bin_unk2 = *(char_iter++); // NEXT + 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 { - sp48 = randi2(0, sp54 + sp50) + 1; - } while (sp48 == sp4C); + second_answer_cmd = randi2(0, quiz_question_bin_unk1 + quiz_question_bin_unk2) + 1; + } while (second_answer_cmd == first_answer_cmd); do { - sp44 = randi2(0, sp54 + sp50) + 1; - } while (sp44 == sp4C || sp44 == sp48); + third_answer_cmd = randi2(0, quiz_question_bin_unk1 + quiz_question_bin_unk2) + 1; + } while (third_answer_cmd == first_answer_cmd || third_answer_cmd == second_answer_cmd); } else { - sp48 = randi2(0, sp50) + sp54 + 1; + second_answer_cmd = randi2(0, quiz_question_bin_unk2) + quiz_question_bin_unk1 + 1; do { - sp44 = randi2(0, sp50) + sp54 + 1; - } while (sp44 == sp48); + third_answer_cmd = randi2(0, quiz_question_bin_unk2) + quiz_question_bin_unk1 + 1; + } 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++) << 8); - char_iter = (s32)D_803830E0->unkC + phi_v1; - str_cnt = *(char_iter++); // NEXT + char_iter = (s32)sD_803830E0->unkC + phi_v1; + str_cnt = *(char_iter++); // NEXT char_iter = 5 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++){ - temp_v0_3 = *(char_iter++); // NEXT - str_size = *(char_iter++); // NEXT - temp_v0_3 -= 0x80; - + // cmd = 0x80 - 0x83 + cmd = *(char_iter++); // NEXT char_iter = 6 + option_text = *(char_iter++); // NEXT char_iter = 7 + cmd -= 0x80; - if ((temp_v0_3 == 0) || (temp_v0_3 == sp4C) || (temp_v0_3 == sp48) || (temp_v0_3 == sp44)) { - if (temp_v0_3 == 0) { - sp60 = 0; - } else if (temp_v0_3 == sp4C) { - sp60 = 1; - } else if (temp_v0_3 == sp48) { - sp60 = 2; - } else if (temp_v0_3 == sp44) { - sp60 = 3; + if ((cmd == 0) || (cmd == first_answer_cmd) || (cmd == second_answer_cmd) || (cmd == third_answer_cmd)) { + if (cmd == 0) { // grunty + zoombox_text_index = 0; + } else if (cmd == first_answer_cmd) { // first answer + zoombox_text_index = 1; + } else if (cmd == second_answer_cmd) { // second answer + zoombox_text_index = 2; + } else if (cmd == third_answer_cmd) { // third answer + zoombox_text_index = 3; } 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; } - -void func_803196D0(s32 arg0) { - gczoombox_open(D_803830E0->unk24[arg0]); - gczoombox_maximize(D_803830E0->unk24[arg0]); - gczoombox_setStrings(D_803830E0->unk24[arg0], D_803830E0->unk18[D_803830E0->unk1C[arg0]], D_803830E0->unk34.unk0[D_803830E0->unk1C[arg0]]); +void __gcquiz_openZoomboxAndMaximizeWithStringsAt(s32 zoombox_index) { + gczoombox_open(sD_803830E0->zoomboxes[zoombox_index]); + gczoombox_maximize(sD_803830E0->zoomboxes[zoombox_index]); + gczoombox_setStrings( + 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 func_80319758(s32 indx, bool arg1){ - gczoombox_highlight(D_803830E0->unk24[indx], arg1); - func_80318C48(D_803830E0->unk24[indx], arg1); +void __gcquiz_set_box_highlight(s32 index, bool arg1){ + gczoombox_highlight(sD_803830E0->zoomboxes[index], arg1); + gczoombox_func_80318C48(sD_803830E0->zoomboxes[index], arg1); } -void func_803197AC(s32 arg0){ +static void __gcquiz_advanceStateTo(enum gcquiz_state state){ s32 i; s32 j; - switch(arg0){ - case 0: //803197F0 - D_803830E0->unk0 = 0; - D_803830E0->unk1 = 0; - D_803830E0->unk3 = 0; - D_803830E0->unk8 = 0; - D_803830E0->unk12 = -1; - D_803830E0->unk14 = 0; - D_803830E0->unk11 = -2; - func_803184C8(D_803830E0->unk24[0], (f32) D_803830E0->unk16, 5, 2, func_80319040(0), func_80319028(0), 0); - func_80318774(D_803830E0->unk24[0]); - gczoombox_highlight(D_803830E0->unk24[0], 1); + switch(state){ + case GCQUIZ_STATE_0_INITIAL: + sD_803830E0->question_type = 0; + sD_803830E0->question_index = 0; + sD_803830E0->quiz_question_time = 0; + sD_803830E0->unk8 = NULL; + sD_803830E0->selected_answer_index = -1; + sD_803830E0->unk14 = 0; + sD_803830E0->unk11 = -2; + gczoombox_func_803184C8(sD_803830E0->zoomboxes[0], (f32) sD_803830E0->unk16, 5, 2, __gcquiz_animation_duration(0), __gcquiz_isZero(0), 0); + gczoombox_setUnk13ATo0(sD_803830E0->zoomboxes[0]); + gczoombox_highlight(sD_803830E0->zoomboxes[0], TRUE); for(i = 0; i < 4; i++){ - D_803830E0->unk1C[i] = -1; + sD_803830E0->answer_values[i] = -1; for(j = 0; j < 4; j++){ - D_803830E0->unk34.unk0[i][j] = 0; + sD_803830E0->quiz_question.answer_options[i][j] = NULL; } } break; - case 1: //80319910 - gczoombox_open(D_803830E0->unk24[0]); - gczoombox_maximize(D_803830E0->unk24[0]); - gczoombox_setStrings(D_803830E0->unk24[0], D_803830E0->unk18[0], D_803830E0->unk34.unk0[0]); + case GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX: + gczoombox_open(sD_803830E0->zoomboxes[0]); + gczoombox_maximize(sD_803830E0->zoomboxes[0]); + gczoombox_setStrings(sD_803830E0->zoomboxes[0], sD_803830E0->answer_str_counts[0], sD_803830E0->quiz_question.answer_options[0]); break; - case 2: //8031994C - if (D_803830E0->unk0 != -1) { - func_80318E90(); + case GCQUIZ_STATE_2_SHOW_PORTRAITS_FOR_QUESTION: + if (sD_803830E0->question_type != -1) { + __gcquiz_randomizePortaitIds(); 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); - func_803184C8(D_803830E0->unk24[i], (f32)D_803830E0->unk17, 5, 2, func_80319040(i), func_80319028(i), 0); + 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); + gczoombox_func_803184C8(sD_803830E0->zoomboxes[i], (f32)sD_803830E0->unk17, 5, 2, __gcquiz_animation_duration(i), __gcquiz_isZero(i), 0); } } else { 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); - func_803184C8(D_803830E0->unk24[i], (f32)D_803830E0->unk17, 5, 2, func_80319040(i), func_80319028(i), 0); + sD_803830E0->zoomboxes[i] = gczoombox_new(__gcquiz_getZoomboxY(i), sD_803830E0->portait_ids[i], 1, __gcquiz_return0(i), __gcquiz_func_80319E20); + 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, func_803196D0, 1); - timedFunc_set_1(0.2f, func_803196D0, 2); - timedFunc_set_1(0.4f, func_803196D0, 3); + timedFunc_set_1(0.0f, __gcquiz_advanceStateTo, GCQUIZ_STATE_3_UNKNOWN); + timedFunc_set_1(0.0f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 1); + timedFunc_set_1(0.2f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 2); + timedFunc_set_1(0.4f, __gcquiz_openZoomboxAndMaximizeWithStringsAt, 3); break; - case 3: //80319B78 - case 4: //80319B78 - case 5: //80319B78 - if(1){} + case GCQUIZ_STATE_3_UNKNOWN: + case GCQUIZ_STATE_4_UNKNOWN: + case GCQUIZ_STATE_5_UNKNOWN: break; - case 6: //80319B84 - item_set(ITEM_0_HOURGLASS_TIMER, D_803830E0->unk3 * 60 - 1); + case GCQUIZ_STATE_6_SELECT_QUIZ_ANSWER: + item_set(ITEM_0_HOURGLASS_TIMER, sD_803830E0->quiz_question_time * 60 - 1); item_set(ITEM_6_HOURGLASS, TRUE); - D_803830E0->unk15 = 0; - D_803830E0->unk13 = 1U; + sD_803830E0->answer_cursor_cooldown = 0; + sD_803830E0->answer_cursor_index = 1U; 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; - case 7: //80319C0C - if (D_803830E0->unk0 != -1) { - D_803830E0->unk11 = (D_803830E0->unk12 == -1) ? -1 - : (D_803830E0->unk1C[D_803830E0->unk12] == 1) ? 1 + case GCQUIZ_STATE_7_CHECK_GIVEN_ANSWER: + if (sD_803830E0->question_type != -1) { + sD_803830E0->unk11 = (sD_803830E0->selected_answer_index == -1) ? -1 + : (sD_803830E0->answer_values[sD_803830E0->selected_answer_index] == 1) ? 1 : 0; } 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++){ - if (i != D_803830E0->unk12) { - gczoombox_minimize(D_803830E0->unk24[i]); - gczoombox_close(D_803830E0->unk24[i]); + if (i != sD_803830E0->selected_answer_index) { + gczoombox_minimize(sD_803830E0->zoomboxes[i]); + gczoombox_close(sD_803830E0->zoomboxes[i]); } 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); break; - case 8: //80319CFC - if (D_803830E0->unk0 != -1) { - comusic_playTrack((D_803830E0->unk11 == 1)? COMUSIC_2B_DING_B : COMUSIC_2C_BUZZER); + case GCQUIZ_STATE_8_UNKNOWN: + if (sD_803830E0->question_type != -1) { + comusic_playTrack((sD_803830E0->unk11 == 1)? COMUSIC_2B_DING_B : COMUSIC_2C_BUZZER); } else { 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; - case 9: //80319D6C - func_8031A3E4(); + case GCQUIZ_STATE_9_UNKNOWN: + __gcquiz_closeZoomboxes(); break; - case 10: //80319D80 - if (D_803830E0->unk8 != NULL) { - D_803830E0->unk8(D_803830E0->unk4, D_803830E0->unk11); + case GCQUIZ_STATE_A_UNKNOWN: + if (sD_803830E0->unk8 != NULL) { + sD_803830E0->unk8(sD_803830E0->unk4, sD_803830E0->unk11); } for(i = 1; i < 4; i++){ - gczoombox_free(D_803830E0->unk24[i]); - D_803830E0->unk24[i] = NULL; + gczoombox_free(sD_803830E0->zoomboxes[i]); + sD_803830E0->zoomboxes[i] = NULL; } func_8025A55C(-1, 500, 10); break; @@ -458,109 +476,112 @@ void func_803197AC(s32 arg0){ default: break; } - D_803830E0->unk10 = arg0; + sD_803830E0->state = state; } -void func_80319E20(s32 arg0, s32 arg1) { - if (arg1 == 3) { - if (arg0 == D_803830E0->unk20[0]) { - if (D_803830E0->unk8 != NULL) { - D_803830E0->unk8(D_803830E0->unk4, D_803830E0->unk11); +void __gcquiz_func_80319E20(s32 portrait_id, s32 zoombox_state) { + if (zoombox_state == 3) { + if (portrait_id == sD_803830E0->portait_ids[0]) { + if (sD_803830E0->unk8 != NULL) { + sD_803830E0->unk8(sD_803830E0->unk4, sD_803830E0->unk11); } } else { - func_803197AC(D_803830E0->unk10 + 1); + __gcquiz_advanceStateTo(sD_803830E0->state + 1); } - } else if (arg1 == 5) { - D_803830E0->unk14++; + } else if (zoombox_state == 5) { + sD_803830E0->unk14++; } } -void func_80319EA4(void) { - s32 sp58[6]; - f32 sp4C[3]; +// handle selection in zoombox? +void gcquiz_func_80319EA4(void) { + s32 face_button_states[6]; + f32 joystick_states[3]; s32 phi_s0; f32 sp44; - if(getGameMode() != GAME_MODE_3_NORMAL && func_802E4A08() == 0) + if(getGameMode() != GAME_MODE_3_NORMAL && func_802E4A08() == FALSE) return; - if(D_803830E0 == NULL) + if(sD_803830E0 == NULL) return; - controller_copyFaceButtons(0, sp58); - controller_getJoystick(0, sp4C); + controller_copyFaceButtons(0, face_button_states); + controller_getJoystick(0, joystick_states); 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) { - case 1: - if (func_8028EFC8() && (sp58[FACE_BUTTON(BUTTON_B)] == 1)) { - sp44 = func_80319040(0); - func_803184C8(D_803830E0->unk24[0], 100.0f, 2, 4, sp44, func_80319028(0), 0); + switch (sD_803830E0->state) { + case GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX: + if (func_8028EFC8() && (face_button_states[FACE_BUTTON(BUTTON_B)] == 1)) { + sp44 = __gcquiz_animation_duration(0); + gczoombox_func_803184C8(sD_803830E0->zoomboxes[0], 100.0f, 2, 4, sp44, __gcquiz_isZero(0), 0); return; } break; - case 6: - if (D_803830E0->unk15 > 0) { - D_803830E0->unk15--; + case GCQUIZ_STATE_6_SELECT_QUIZ_ANSWER: + if (sD_803830E0->answer_cursor_cooldown > 0) { + sD_803830E0->answer_cursor_cooldown--; } else { - if (sp4C[1] > 0.75) { - if (D_803830E0->unk13 >= 2) { - func_80319758(D_803830E0->unk13, 0); - D_803830E0->unk13--; - func_80319758(D_803830E0->unk13, 1); - func_803160A8(D_803830E0->unk24[D_803830E0->unk13]); - D_803830E0->unk15 = 4U; + if (joystick_states[1] > 0.75) { + if (sD_803830E0->answer_cursor_index >= 2) { + __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, FALSE); + sD_803830E0->answer_cursor_index--; + __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, TRUE); + gczoombox_func_803160A8(sD_803830E0->zoomboxes[sD_803830E0->answer_cursor_index]); + sD_803830E0->answer_cursor_cooldown = 4U; } - } else if (sp4C[1] < -0.75) { - if (D_803830E0->unk13 < 3) { - func_80319758(D_803830E0->unk13, 0); - D_803830E0->unk13++; - func_80319758(D_803830E0->unk13, 1); - func_803160A8(D_803830E0->unk24[D_803830E0->unk13]); - D_803830E0->unk15 = 4U; + } else if (joystick_states[1] < -0.75) { + if (sD_803830E0->answer_cursor_index < 3) { + __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, FALSE); + sD_803830E0->answer_cursor_index++; + __gcquiz_set_box_highlight(sD_803830E0->answer_cursor_index, TRUE); + gczoombox_func_803160A8(sD_803830E0->zoomboxes[sD_803830E0->answer_cursor_index]); + sD_803830E0->answer_cursor_cooldown = 4U; } } } - if ((sp58[FACE_BUTTON(BUTTON_A)] == 1) || (item_empty(ITEM_0_HOURGLASS_TIMER))) { - D_803830E0->unk12 = (u8) D_803830E0->unk13; + if ((face_button_states[FACE_BUTTON(BUTTON_A)] == 1) || (item_empty(ITEM_0_HOURGLASS_TIMER))) { + sD_803830E0->selected_answer_index = (u8) sD_803830E0->answer_cursor_index; } - if ((s8) D_803830E0->unk12 != -1) { - func_803197AC(7); + if ((s8) sD_803830E0->selected_answer_index != -1) { + __gcquiz_advanceStateTo(GCQUIZ_STATE_7_CHECK_GIVEN_ANSWER); return; } break; - case 9: - if (D_803830E0->unk14 == 4) { - func_803197AC(0xA); + case GCQUIZ_STATE_9_UNKNOWN: + if (sD_803830E0->unk14 == 4) { + __gcquiz_advanceStateTo(GCQUIZ_STATE_A_UNKNOWN); return; } break; - case 10: - func_803197AC(0); + case GCQUIZ_STATE_A_UNKNOWN: + __gcquiz_advanceStateTo(GCQUIZ_STATE_0_INITIAL); break; } } -bool func_8031A154(enum ff_question_type_e q_type, s32 q_indx, s32 arg2, s32 arg3, s32 arg4, void (*arg5)(s32, s32)) { - if (func_803192A4(q_type, q_indx, arg2) != 0) { - D_803830E0->unk0 = q_type; - D_803830E0->unk1 = q_indx; - D_803830E0->unk2 = arg2; - D_803830E0->unk3 = arg3; - D_803830E0->unk4 = arg4; - D_803830E0->unk8 = arg5; +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 (__gcquiz_func_803192A4(q_type, q_index, arg2) != FALSE) { + sD_803830E0->question_type = q_type; + sD_803830E0->question_index = q_index; + sD_803830E0->unk2 = arg2; + sD_803830E0->quiz_question_time = arg3; + sD_803830E0->unk4 = arg4; + sD_803830E0->unk8 = arg5; 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_803197AC(1); + __gcquiz_advanceStateTo(GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX); return TRUE; } + 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; s8 *temp_a2; s8 *temp_s0; @@ -574,81 +595,81 @@ bool func_8031A22C(u8 *arg0, s8 *arg1, Struct_Core2_91E10_1 *arg2, s32 arg3, voi s32 j; s8 *phi_s0; - if (func_8031A3BC()) { - return 0; + if (gcquiz_isNotInInitialState()) { + return FALSE; } + for(i = 0; i < 4; i++){ - D_803830E0->unk20[i] = arg0[i]; - D_803830E0->unk18[i] = arg1[i]; + sD_803830E0->portait_ids[i] = arg0[i]; + sD_803830E0->answer_str_counts[i] = arg1[i]; 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) { - gczoombox_loadSprite(D_803830E0->unk24[0], D_803830E0->unk20[0]); + if (sD_803830E0->portait_ids[0] != NULL) { + gczoombox_loadSprite(sD_803830E0->zoomboxes[0], sD_803830E0->portait_ids[0]); } - D_803830E0->unk0 = -1; - D_803830E0->unk1 = -1; - D_803830E0->unk2 = -1; - D_803830E0->unk3 = (s8) arg3; - D_803830E0->unk4 = 0; - D_803830E0->unk8 = arg4; + sD_803830E0->question_type = -1; + sD_803830E0->question_index = -1; + sD_803830E0->unk2 = -1; + sD_803830E0->quiz_question_time = (s8) arg3; + sD_803830E0->unk4 = 0; + sD_803830E0->unk8 = arg4; func_8025A55C(6000, 500, 10); - func_803197AC(1); + __gcquiz_advanceStateTo(GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX); return TRUE; } -void func_8031A388(u8 arg0, u8 arg1) { - if (D_803830E0 != NULL) { - D_803830E0->unk16 = arg0; - D_803830E0->unk17 = arg1; +// unused but making this static differs checksum +void __gcquiz_unused2(u8 arg0, u8 arg1) { + if (sD_803830E0 != NULL) { + sD_803830E0->unk16 = arg0; + sD_803830E0->unk17 = arg1; } } -bool func_8031A3BC(void){ - return (D_803830E0 != NULL)? D_803830E0->unk10 != 0: FALSE; +bool gcquiz_isNotInInitialState(){ + return (sD_803830E0 != NULL) ? sD_803830E0->state != GCQUIZ_STATE_0_INITIAL: FALSE; } -//gcquiz_close -void func_8031A3E4(void){ +static void __gcquiz_closeZoomboxes(){ s32 i; - if(D_803830E0 != NULL){ + if(sD_803830E0 != NULL){ for(i = 0; i < 4; i++){ - gczoombox_minimize(D_803830E0->unk24[i]); - gczoombox_close(D_803830E0->unk24[i]); + gczoombox_minimize(sD_803830E0->zoomboxes[i]); + gczoombox_close(sD_803830E0->zoomboxes[i]); } } } -s32 func_8031A454(void){ +// unused but making this static differs checksum +s32 gcquiz_unused3(){ return 4; } -//__gcquiz_get_type_count -s32 func_8031A45C(enum ff_question_type_e question_type){ - return func_80318F1C(question_type) - func_80318ED8(question_type); +s32 gcquiz_getLastIndexOfQuestionType(enum ff_question_type_e question_type) { + return __gcquiz_get_type_end_id(question_type) - __gcquiz_get_type_start_id(question_type); } -void func_8031A48C(void) { - if ((D_803830E0 != NULL) && (D_803830E0->unk10 == 1)) { - func_803197AC(2); +void gcquiz_func_8031A48C(void) { + if ((sD_803830E0 != NULL) && (sD_803830E0->state == GCQUIZ_STATE_1_SHOW_QUESTION_VIA_ZOOMBOX)) { + __gcquiz_advanceStateTo(GCQUIZ_STATE_2_SHOW_PORTRAITS_FOR_QUESTION); } } -//gcquiz_defrag -void func_8031A4CC(void) { +void gcquiz_defrag() { s32 i; - if (D_803830E0 != NULL) { + if (sD_803830E0 != NULL) { for(i = 0; i < 4; i++){ - gczoombox_defrag(D_803830E0->unk24[i]); - D_803830E0->unk24[i] = (GcZoombox *)defrag(D_803830E0->unk24[i]); + gczoombox_defrag(sD_803830E0->zoomboxes[i]); + sD_803830E0->zoomboxes[i] = (GcZoombox *)defrag(sD_803830E0->zoomboxes[i]); } - if (func_8031A3BC() == 0) { - D_803830E0->unkC = (QuizQuestionBin *)defrag(D_803830E0->unkC); + if (gcquiz_isNotInInitialState() == FALSE) { + sD_803830E0->unkC = (QuizQuestionBin *)defrag(sD_803830E0->unkC); } - D_803830E0 = (Struct_Core2_91E10 *)defrag(D_803830E0); + sD_803830E0 = (Struct_Core2_91E10 *)defrag(sD_803830E0); } } diff --git a/src/core2/code_94620.c b/src/core2/code_94620.c index deac9e7a..193d8b9c 100644 --- a/src/core2/code_94620.c +++ b/src/core2/code_94620.c @@ -10,10 +10,9 @@ struct { u8 unk0; char *ptr; s32 index; -} -s_dialogBin; +} s_dialogBin; -s32 func_8031B5B0(void) { +s32 code94620_func_8031B5B0(void) { return s_dialogBin.unk0; } @@ -55,7 +54,7 @@ char *dialogBin_get(enum asset_e text_id) { //get text_bin from asset cache s_dialogBin.ptr = assetcache_get(text_id); sp1C = s_dialogBin.ptr + 1; - sp1C += func_8031B5B0()*2; + sp1C += code94620_func_8031B5B0()*2; var_a0 = *(sp1C++); var_a0 += *(sp1C++)<< 8; if(sp1C); diff --git a/src/core2/code_B3A80.c b/src/core2/code_B3A80.c index 15a0537d..4457b83b 100644 --- a/src/core2/code_B3A80.c +++ b/src/core2/code_B3A80.c @@ -477,7 +477,7 @@ void func_8033BD8C(void* 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 var_s0; s32 sp34; diff --git a/src/core2/code_C9E70.c b/src/core2/code_C9E70.c index 9340fe78..b7878a20 100644 --- a/src/core2/code_C9E70.c +++ b/src/core2/code_C9E70.c @@ -8,7 +8,7 @@ extern struct FF_StorageStruct *D_8037DCB8; void func_80350E00(void){ quizQuestionAskedBitfield_defrag(); - func_8031A4CC(); + gcquiz_defrag(); if(D_8037DCB8 == NULL) return; diff --git a/src/core2/gc/dialog.c b/src/core2/gc/dialog.c index 38e1d099..07f80bf0 100644 --- a/src/core2/gc/dialog.c +++ b/src/core2/gc/dialog.c @@ -725,7 +725,7 @@ void func_80310A5C(s32 next_state, s32 arg1, s32 arg2, s32 arg3, s32 arg4){ f32 tmpf; for(i = 0, tmpf = 0.4f; i< 2; 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); } } } diff --git a/src/core2/gc/pauseMenu.c b/src/core2/gc/pauseMenu.c index 17447731..1115e5a4 100644 --- a/src/core2/gc/pauseMenu.c +++ b/src/core2/gc/pauseMenu.c @@ -243,7 +243,7 @@ void gcpausemenu_zoomboxes_initMainMenu(void) { s32 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); - 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_80318760(D_80383010.zoombox[i], 8000); } @@ -254,7 +254,7 @@ void gcpausemenu_zoomboxes_initTotalsMenu(void) { 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); - 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_80318760(D_80383010.zoombox[i], 8000); } @@ -1006,7 +1006,7 @@ s32 gcPauseMenu_update(void) { }//L80313664 else { 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; } @@ -1018,7 +1018,7 @@ s32 gcPauseMenu_update(void) { D_80383010.selection--; } 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.unk7 = 6; } @@ -1031,7 +1031,7 @@ s32 gcPauseMenu_update(void) { D_80383010.selection++; } 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.unk7 = 6; } @@ -1039,7 +1039,7 @@ s32 gcPauseMenu_update(void) { } 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; } break; diff --git a/src/core2/gc/zoombox.c b/src/core2/gc/zoombox.c index a4e79ce6..71863daa 100644 --- a/src/core2/gc/zoombox.c +++ b/src/core2/gc/zoombox.c @@ -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 phi_f14; 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_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->unk177 = D_8036C6C0[portrait_id].unk3; this->unk100 = 0; @@ -1558,14 +1558,14 @@ void func_803184B8(GcZoombox *this){ 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) { this->unk182 = arg2; this->unk184 = arg3; this->unk190 = 1.0 / arg1; 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_10 = BOOL(arg6); @@ -1583,8 +1583,8 @@ bool func_8031857C(GcZoombox *this, u8 *str){ return FALSE; } -void gczoombox_highlight(GcZoombox *this, bool arg1){ - if(arg1) +void gczoombox_highlight(GcZoombox *this, bool should_highlight){ + if(should_highlight) this->highlighted = 1; else this->highlighted = 0; @@ -1632,7 +1632,7 @@ void func_80318760(GcZoombox *this, s32 arg1){ this->unk12E = arg1; } -void func_80318774(GcZoombox *this){ +void gczoombox_setUnk13ATo0(GcZoombox *this){ 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->unk1A4_30) { - if (arg1 != 0) { + if (arg1 != FALSE) { if (this->unk0[0] == 0xFD) { this->unk0[1] = 0x68; } else { @@ -1783,7 +1783,7 @@ void func_80318C48(GcZoombox *this, s32 arg1) { } } if (this->unk1A4_29) { - if (arg1 != 0) { + if (arg1 != FALSE) { if (this->unk30[0] == 0xFD) { this->unk30[1] = 0x68; return; diff --git a/src/core2/gc/zoombox.h b/src/core2/gc/zoombox.h index 707980f4..c0d3a11c 100644 --- a/src/core2/gc/zoombox.h +++ b/src/core2/gc/zoombox.h @@ -207,7 +207,7 @@ typedef struct { 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_803164B0(GcZoombox *this, Gfx **gfx, Mtx **mtx, s32 arg3, s32 arg4, BKSpriteDisplayData *arg5, f32 arg6); void func_80316764(GcZoombox *this, s32 arg1); @@ -231,7 +231,7 @@ 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); +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); void gczoombox_highlight(GcZoombox *this, bool arg1); 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_80318734(GcZoombox *this, f32 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_803188B4(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); bool func_80318BEC(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__ diff --git a/src/lair/ch/brentilda.c b/src/lair/ch/brentilda.c index 5f1656e4..799a34e9 100644 --- a/src/lair/ch/brentilda.c +++ b/src/lair/ch/brentilda.c @@ -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)) { 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; pattern = randi2(0, 3); diff --git a/src/lair/code_5ED0.c b/src/lair/code_5ED0.c index 9ef68b7d..dc6141d9 100644 --- a/src/lair/code_5ED0.c +++ b/src/lair/code_5ED0.c @@ -548,7 +548,7 @@ void func_8038CCEC(void) free(D_8037DCB8); D_8037DCB8 = NULL; - func_80319190(); + gcquiz_free(); quizQuestionAskedBitfield_free(); func_802C5994(); } @@ -590,7 +590,7 @@ void func_8038CE28(void) { s32 i; - func_80319050(); + gcquiz_init(); D_8037DCB8 = malloc(sizeof(struct FF_StorageStruct)); 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; } @@ -912,7 +911,7 @@ void func_8038D670(enum FF_Action next_state) { func_8028F918(2); if (D_8037DCB8->ffQuestionType != FFQT_4_MINIGAME) { 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 { func_8038D4BC(); } @@ -943,7 +942,7 @@ void func_8038D670(enum FF_Action next_state) { break; }//L8038D91C } - func_8031A48C(); + gcquiz_func_8031A48C(); break; case FFA_6_TRIGGER_QUESTION_POST_EFFECTS: //L8038D940 @@ -1157,7 +1156,7 @@ void lair_func_8038E0B0(void) { && (D_8037DCB8 != NULL) && (D_8037DCB8->unk0 != NULL) ){ - func_80319EA4(); + gcquiz_func_80319EA4(); func_8038C9D0(); controller_copyFaceButtons(0, sp48); 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) return; - func_80319214(dl, m, v); + gcquiz_draw(dl, m, v); gczoombox_draw(D_8037DCB8->unk20, dl, m, v); } diff --git a/src/lair/code_A810.c b/src/lair/code_A810.c index 64bfe284..abdccb3d 100644 --- a/src/lair/code_A810.c +++ b/src/lair/code_A810.c @@ -131,7 +131,7 @@ void func_80390E28(Actor *this) { switch (this->state) { 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++; mapSpecificFlags_setN(0, sp38, 2); func_80390D3C(this, (randf() < 0.5) ? 2 :1); diff --git a/src/lair/code_AD70.c b/src/lair/code_AD70.c index 5fc77a21..f60fbbab 100644 --- a/src/lair/code_AD70.c +++ b/src/lair/code_AD70.c @@ -240,7 +240,7 @@ void func_80391B04(Actor *this) { func_8038E9A4(local->unk10, this->position); switch (this->state) { /* irregular */ case 1: - if (func_8031A3BC() || mapSpecificFlags_get(0xA)) { + if (gcquiz_isNotInInitialState() || mapSpecificFlags_get(0xA)) { func_80391810(this, 4); break; } diff --git a/src/lair/code_C1C0.c b/src/lair/code_C1C0.c index 336fcf32..43049c39 100644 --- a/src/lair/code_C1C0.c +++ b/src/lair/code_C1C0.c @@ -86,7 +86,7 @@ void func_80392700(Actor *this) { this->marker->unk2C_2 = TRUE; } } - this->unk58_0 = !func_8031A3BC(); + this->unk58_0 = !gcquiz_isNotInInitialState(); }