diff --git a/include/functions.h b/include/functions.h index 831aa96e1a..eafca7bed3 100644 --- a/include/functions.h +++ b/include/functions.h @@ -1766,10 +1766,15 @@ void func_800F0568(GlobalContext* globalCtx, Vec3f* position, s32 param_3, u16 s // void func_800F0A20(void); // void func_800F0A94(void); // void func_800F0BB4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5); -// void func_800F0CE4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, -// UNK_TYPE4 param_6); void func_800F0DD4(void); void func_800F0E94(void); void func_800F0EEC(void); void -// func_800F0F28(void); void func_800F0FF0(void); void func_800F10AC(void); void func_800F112C(void); -u16 func_800F1250(GlobalContext* globalCtx, UNK_TYPE arg1); +// void func_800F0CE4(UNK_TYPE1 param_1, UNK_TYPE1 param_2, UNK_TYPE1 param_3, UNK_TYPE1 param_4, UNK_TYPE2 param_5, UNK_TYPE4 param_6); +// void func_800F0DD4(void); +// void func_800F0E94(void); +// void func_800F0EEC(void); +// void func_800F0F28(void); +// void func_800F0FF0(void); +// void func_800F10AC(void); +// void func_800F112C(void); +u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet); void func_800F12D0(GlobalContext* globalCtx); void func_800F1304(GlobalContext* globalCtx, s16 param_2); void func_800F1374(s32 param_1, s16 param_2); @@ -2355,7 +2360,7 @@ void func_80123DA4(Player* player); // void func_80123F2C(void); // void func_80123F48(void); // void func_80124020(void); -u32 Player_GetMask(GlobalContext* globalCtx); +u8 Player_GetMask(GlobalContext* globalCtx); void Player_RemoveMask(GlobalContext* globalCtx); // void func_8012405C(void); // void func_80124088(void); diff --git a/spec b/spec index b959f40dd2..62b81a7da1 100644 --- a/spec +++ b/spec @@ -497,13 +497,13 @@ beginseg include "build/src/code/code_800F0390.o" include "build/src/code/z_elf_message.o" include "build/src/code/code_800F07C0.o" + include "build/data/code/code_801BC2A0.data.o" include "build/src/code/z_face_reaction.o" include "build/src/code/code_800F12D0.o" include "build/src/code/z_eventmgr.o" include "build/data/code/z_eventmgr.bss.o" include "build/src/code/code_800F23E0.o" include "build/src/code/z_fcurve_data_skelanime.o" - include "build/data/code/code_801BC2A0.data.o" include "build/data/code/code_801BD830.data.o" include "build/src/code/z_fireobj.o" include "build/data/code/z_fireobj.data.o" diff --git a/src/code/z_face_reaction.c b/src/code/z_face_reaction.c index 43f9b3ecc7..b8955e1a9a 100644 --- a/src/code/z_face_reaction.c +++ b/src/code/z_face_reaction.c @@ -1,3 +1,186 @@ #include "global.h" -#pragma GLOBAL_ASM("asm/non_matchings/code/z_face_reaction/func_800F1250.s") +/** + * Indices of the columns of this array: + * - index 0x00: PLAYER_MASK_MASK_OF_TRUTH + * - index 0x01: PLAYER_MASK_KAFEIS_MASK + * - index 0x02: PLAYER_MASK_ALL_NIGHT_MASK + * - index 0x03: PLAYER_MASK_BUNNY_HOOD + * - index 0x04: PLAYER_MASK_KEATON_MASK + * - index 0x05: PLAYER_MASK_GAROS_MASK + * - index 0x06: PLAYER_MASK_ROMANIS_MASK + * - index 0x07: PLAYER_MASK_CIRCUS_LEADERS_MASK + * - index 0x08: PLAYER_MASK_POSTMANS_HAT + * - index 0x09: PLAYER_MASK_COUPLES_MASK + * - index 0x0A: PLAYER_MASK_GREAT_FAIRYS_MASK + * - index 0x0B: PLAYER_MASK_GIBDO_MASK + * - index 0x0C: PLAYER_MASK_DON_GEROS_MASK + * - index 0x0D: PLAYER_MASK_KAMAROS_MASK + * - index 0x0E: PLAYER_MASK_CAPTAINS_HAT + * - index 0x0F: PLAYER_MASK_STONE_MASK + * - index 0x10: PLAYER_MASK_BREMEN_MASK + * - index 0x11: PLAYER_MASK_BLAST_MASK + * - index 0x12: PLAYER_MASK_MASK_OF_SCENTS + */ +// clang-format off +static u16 sReactionTextIds[][PLAYER_MASK_GIANTS_MASK - 1] = { + /* 0x00 */ { 0 }, + /* 0x01 */ { 0 }, + /* 0x02 */ { 0 }, + /* 0x03 */ { 0 }, + /* 0x04 */ { 0 }, + /* 0x05 */ { 0 }, + /* 0x06 */ { 0 }, + /* 0x07 */ { 0 }, + /* 0x08 */ { 0 }, + /* 0x09 */ { 0 }, + /* 0x0A */ { 0 }, + /* 0x0B */ { 0 }, + /* 0x0C */ { 0 }, + /* 0x0D */ { 0 }, + /* 0x0E */ { 0 }, + /* 0x0F */ { 0 }, + /* 0x10 */ { 0 }, + /* 0x11 */ { 0x0000, 0x236B, 0x0000, 0x0000, 0x236C, 0x0000, + 0x0000, 0x236D, 0x0000, 0x0000, 0x0000, 0x0000, + 0x0000, 0x0000, 0x0000, 0x236E, 0x0000, 0x0000, 0x0000 }, + /* 0x12 */ { 0x2348, 0x2349, 0x234A, 0x0000, 0x234B, 0x2348, + 0x234C, 0x2348, 0x234D, 0x234E, 0x2348, 0x2348, + 0x2348, 0x2348, 0x2348, 0x234F, 0x2348, 0x2348, 0x2350 }, + /* 0x13 */ { 0 }, + /* 0x14 */ { 0 }, + /* 0x15 */ { 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356, + 0x2357, 0x2356, 0x2358, 0x2359, 0x2356, 0x235A, + 0x2353, 0x235A, 0x235A, 0x235B, 0x2354, 0x2351, 0x235C }, + /* 0x16 */ { 0 }, + /* 0x17 */ { 0 }, + /* 0x18 */ { 0 }, + /* 0x19 */ { 0 }, + /* 0x1A */ { 0 }, + /* 0x1B */ { 0 }, + /* 0x1C */ { 0 }, + /* 0x1D */ { 0 }, + /* 0x1E */ { 0 }, + /* 0x1F */ { 0 }, + /* 0x20 */ { 0 }, + /* 0x21 */ { 0 }, + /* 0x22 */ { 0 }, + /* 0x23 */ { 0 }, + /* 0x24 */ { 0 }, + /* 0x25 */ { 0 }, + /* 0x26 */ { 0 }, + /* 0x27 */ { 0 }, + /* 0x28 */ { 0 }, + /* 0x29 */ { 0 }, + /* 0x2A */ { 0 }, + /* 0x2B */ { 0 }, + /* 0x2C */ { 0 }, + /* 0x2D */ { 0x233B, 0x233C, 0x233D, 0x233E, 0x233F, 0x233B, + 0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345, + 0x2346, 0x233B, 0x2345, 0x2347, 0x233D, 0x233B, 0x233D }, + /* 0x2E */ { 0 }, + /* 0x2F */ { 0x2328, 0x2329, 0x232A, 0x232B, 0x2328, 0x2328, + 0x232C, 0x2328, 0x232D, 0x232E, 0x2328, 0x2328, + 0x2328, 0x232F, 0x2330, 0x2331, 0x2332, 0x2333, 0x2328 }, + /* 0x30 */ { 0x236F, 0x2370, 0x236F, 0x0000, 0x236F, 0x236F, + 0x236F, 0x236F, 0x0000, 0x236F, 0x236F, 0x236F, + 0x236F, 0x236F, 0x2371, 0x2372, 0x236F, 0x236F, 0x236F }, + /* 0x31 */ { 0x2373, 0x2374, 0x2373, 0x0000, 0x2373, 0x2373, + 0x2373, 0x2373, 0x0000, 0x2375, 0x2376, 0x2373, + 0x2373, 0x2373, 0x2377, 0x2378, 0x2373, 0x2373, 0x2373 }, + /* 0x32 */ { 0 }, + /* 0x33 */ { 0 }, + /* 0x34 */ { 0 }, + /* 0x35 */ { 0 }, + /* 0x36 */ { 0x0000, 0x2334, 0x0000, 0x0000, 0x0000, 0x0000, + 0x2335, 0x0000, 0x2336, 0x2337, 0x0000, 0x0000, + 0x0000, 0x0000, 0x2338, 0x2339, 0x0000, 0x233A, 0x0000 }, + /* 0x37 */ { 0 }, + /* 0x38 */ { 0 }, + /* 0x39 */ { 0 }, + /* 0x3A */ { 0 }, + /* 0x3B */ { 0 }, + /* 0x3C */ { 0 }, + /* 0x3D */ { 0 }, + /* 0x3E */ { 0 }, + /* 0x3F */ { 0 }, + /* 0x40 */ { 0 }, + /* 0x41 */ { 0 }, + /* 0x42 */ { 0 }, + /* 0x43 */ { 0 }, + /* 0x44 */ { 0 }, + /* 0x45 */ { 0 }, + /* 0x46 */ { 0 }, + /* 0x47 */ { 0 }, + /* 0x48 */ { 0 }, + /* 0x49 */ { 0 }, + /* 0x4A */ { 0 }, + /* 0x4B */ { 0 }, + /* 0x4C */ { 0 }, + /* 0x4D */ { 0 }, + /* 0x4E */ { 0 }, + /* 0x4F */ { 0 }, + /* 0x50 */ { 0 }, + /* 0x51 */ { 0 }, + /* 0x52 */ { 0 }, + /* 0x53 */ { 0 }, + /* 0x54 */ { 0 }, + /* 0x55 */ { 0 }, + /* 0x56 */ { 0 }, + /* 0x57 */ { 0 }, + /* 0x58 */ { 0 }, + /* 0x59 */ { 0 }, + /* 0x5A */ { 0 }, + /* 0x5B */ { 0 }, + /* 0x5C */ { 0 }, + /* 0x5D */ { 0 }, + /* 0x5E */ { 0 }, + /* 0x5F */ { 0 }, + /* 0x60 */ { 0 }, + /* 0x61 */ { 0 }, + /* 0x62 */ { 0 }, + /* 0x63 */ { 0 }, + /* 0x64 */ { 0 }, + /* 0x65 */ { 0 }, + /* 0x66 */ { 0 }, + /* 0x67 */ { 0 }, + /* 0x68 */ { 0 }, + /* 0x69 */ { 0 }, + /* 0x6A */ { 0 }, + /* 0x6B */ { 0 }, + /* 0x6C */ { 0 }, + /* 0x6D */ { 0 }, + /* 0x6E */ { 0 }, + /* 0x6F */ { 0 }, + /* 0x70 */ { 0 }, + /* 0x71 */ { 0 }, + /* 0x72 */ { 0 }, + /* 0x73 */ { 0 }, + /* 0x74 */ { 0 }, + /* 0x75 */ { 0 }, + /* 0x76 */ { 0 }, + /* 0x77 */ { 0 }, + /* 0x78 */ { 0 }, + /* 0x79 */ { 0 }, + /* 0x7A */ { 0 }, + /* 0x7B */ { 0 }, + /* 0x7C */ { 0 }, + /* 0x7D */ { 0 }, + /* 0x7E */ { 0 }, + /* 0x7F */ { 0 }, + /* 0x80 */ { 0 }, + /* 0x81 */ { 0 }, + /* 0x82 */ { 0 }, + /* 0x83 */ { 0 }, + /* 0x84 */ { 0 }, + /* 0x85 */ { 0 }, + /* 0x86 */ { 0 }, +}; +// clang-format on + +u16 Text_GetFaceReaction(GlobalContext* globalCtx, u32 reactionSet) { + if ((Player_GetMask(globalCtx) > PLAYER_MASK_NONE) && (Player_GetMask(globalCtx) < PLAYER_MASK_GIANTS_MASK)) { + return sReactionTextIds[reactionSet][Player_GetMask(globalCtx) - 1]; + } + return 0; +} diff --git a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c index 87c4aec8de..9dc8c0bd36 100644 --- a/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c +++ b/src/overlays/actors/ovl_En_Ossan/z_en_ossan.c @@ -22,12 +22,12 @@ void EnOssan_DrawPartTimeWorker(Actor* thisx, GlobalContext* globalCtx); void EnOssan_InitCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx); void EnOssan_InitPartTimeWorker(EnOssan* this, GlobalContext* globalCtx); -s32 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx); +u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx); void EnOssan_InitShop(EnOssan* this, GlobalContext* globalCtx); void EnOssan_Idle(EnOssan* this, GlobalContext* globalCtx); void EnOssan_BeginInteraction(EnOssan* this, GlobalContext* globalCtx); void EnOssan_Hello(EnOssan* this, GlobalContext* globalCtx); -s32 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx); +u16 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx); void EnOssan_SetHaveMet(EnOssan* this); void EnOssan_StartShopping(GlobalContext* globalCtx, EnOssan* this); void EnOssan_FaceShopkeeper(EnOssan* this, GlobalContext* globalCtx); @@ -1340,14 +1340,14 @@ void EnOssan_InitPartTimeWorker(EnOssan* this, GlobalContext* globalCtx) { this->actor.draw = EnOssan_DrawPartTimeWorker; } -s32 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) { +u16 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) { Player* player = PLAYER; - u16 ret = func_800F1250(globalCtx, 0x2F); + u16 textId = Text_GetFaceReaction(globalCtx, 0x2F); - if (ret != 0) { + if (textId != 0) { this->animationIdx = 4; this->flags |= END_INTERACTION; - return ret; + return textId; } switch (player->transformation) { case PLAYER_FORM_DEKU: @@ -1373,13 +1373,13 @@ s32 EnOssan_GetWelcomeCuriosityShopMan(EnOssan* this, GlobalContext* globalCtx) return sWelcomeHumanTextIds[ENOSSAN_CURIOSITY_SHOP_MAN]; } -s32 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx) { +u16 EnOssan_GetWelcomePartTimeWorker(EnOssan* this, GlobalContext* globalCtx) { Player* player = PLAYER; - u16 ret = func_800F1250(globalCtx, 0x36); + u16 textId = Text_GetFaceReaction(globalCtx, 0x36); - if (ret != 0) { + if (textId != 0) { this->flags |= END_INTERACTION; - return ret; + return textId; } switch (player->transformation) { case PLAYER_FORM_DEKU: diff --git a/tools/disasm/files.txt b/tools/disasm/files.txt index 7cb7a60559..079d12a476 100644 --- a/tools/disasm/files.txt +++ b/tools/disasm/files.txt @@ -511,6 +511,7 @@ 0x801BB170 : "z_draw", 0x801BC240 : "z_eff_footmark", 0x801BC2A0 : "", + 0x801BC420 : "z_face_reaction", 0x801BD830 : "", 0x801BD8d0 : "z_fireobj", 0x801BD910 : "", diff --git a/tools/disasm/functions.txt b/tools/disasm/functions.txt index 6378b880c8..9db86da92a 100644 --- a/tools/disasm/functions.txt +++ b/tools/disasm/functions.txt @@ -1631,7 +1631,7 @@ 0x800F0FF0:("func_800F0FF0",), 0x800F10AC:("func_800F10AC",), 0x800F112C:("func_800F112C",), - 0x800F1250:("func_800F1250",), + 0x800F1250:("Text_GetFaceReaction",), 0x800F12D0:("func_800F12D0",), 0x800F1304:("func_800F1304",), 0x800F1374:("func_800F1374",), diff --git a/tools/disasm/variables.txt b/tools/disasm/variables.txt index 0b2b19e6df..09ef0230cf 100644 --- a/tools/disasm/variables.txt +++ b/tools/disasm/variables.txt @@ -929,7 +929,7 @@ 0x801BC3F0:("D_801BC3F0","UNK_TYPE1","",0x1), 0x801BC400:("D_801BC400","UNK_TYPE1","",0x1), 0x801BC410:("D_801BC410","UNK_TYPE1","",0x1), - 0x801BC41E:("D_801BC41E","UNK_TYPE1","",0x1), + 0x801BC420:("sReactionTextIds","u16","[]",0x140A), 0x801BD830:("actorCutscenesGlobalCutscenes","ActorCutscene","[8]",0x80), 0x801BD8B0:("actorCutsceneCurrent","s16","",0x2), 0x801BD8B2:("actorCutsceneCurrentLength","s16","",0x2), diff --git a/tools/sizes/code_functions.csv b/tools/sizes/code_functions.csv index 5c37aeb47b..b059698bf7 100644 --- a/tools/sizes/code_functions.csv +++ b/tools/sizes/code_functions.csv @@ -1145,7 +1145,7 @@ asm/non_matchings/code/code_800F07C0/func_800F0F28.s,func_800F0F28,0x800F0F28,0x asm/non_matchings/code/code_800F07C0/func_800F0FF0.s,func_800F0FF0,0x800F0FF0,0x2F asm/non_matchings/code/code_800F07C0/func_800F10AC.s,func_800F10AC,0x800F10AC,0x20 asm/non_matchings/code/code_800F07C0/func_800F112C.s,func_800F112C,0x800F112C,0x49 -asm/non_matchings/code/z_face_reaction/func_800F1250.s,func_800F1250,0x800F1250,0x20 +asm/non_matchings/code/z_face_reaction/Text_GetFaceReaction.s,Text_GetFaceReaction,0x800F1250,0x20 asm/non_matchings/code/code_800F12D0/func_800F12D0.s,func_800F12D0,0x800F12D0,0xD asm/non_matchings/code/code_800F12D0/func_800F1304.s,func_800F1304,0x800F1304,0x1C asm/non_matchings/code/code_800F12D0/func_800F1374.s,func_800F1374,0x800F1374,0x1D