Create an enum for the various `face_reaction` reaction sets (#1299)

* Create an enum for the various `face_reaction` reaction sets

* Respond to reviews

* Add blank line
This commit is contained in:
Tom Overton 2023-06-20 00:50:15 -07:00 committed by GitHub
parent a5cc630cef
commit bea420f8a1
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
8 changed files with 38 additions and 26 deletions

View File

@ -802,8 +802,6 @@ void GetItem_Draw(PlayState* play, s16 drawId);
u16 QuestHint_GetTatlTextId(PlayState* play);
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet);
void func_800F4A10(PlayState* play);
void KaleidoSetup_Update(PlayState* play);
void KaleidoSetup_Init(PlayState* play);

View File

@ -8,10 +8,24 @@
struct Actor;
struct MessageTableEntry;
struct OcarinaStaff;
struct PlayState;
extern u16 sBombersNotebookEventMessages[BOMBERS_NOTEBOOK_EVENT_MAX];
extern u16 gBombersNotebookWeekEventFlags[BOMBERS_NOTEBOOK_EVENT_MAX];
typedef enum FaceReactionSet {
/* 0x11 */ FACE_REACTION_SET_JIM = 0x11,
/* 0x12 */ FACE_REACTION_SET_BOMBERS,
/* 0x15 */ FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD = 0x15,
/* 0x2D */ FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL = 0x2D,
/* 0x2F */ FACE_REACTION_SET_CURIOSITY_SHOP_MAN = 0x2F,
/* 0x30 */ FACE_REACTION_SET_TOWN_SHOOTING_GALLERY_MAN,
/* 0x31 */ FACE_REACTION_SET_SWAMP_SHOOTING_GALLERY_MAN,
/* 0x36 */ FACE_REACTION_SET_PART_TIMER = 0x36
} FaceReactionSet;
u16 Text_GetFaceReaction(struct PlayState* play, FaceReactionSet reactionSet);
typedef enum TextState {
/* 0 */ TEXT_STATE_NONE,
/* 1 */ TEXT_STATE_1,

View File

@ -43,15 +43,15 @@ static u16 sReactionTextIds[][PLAYER_MASK_GIANT - 1] = {
/* 0x10 */ { 0 },
/* 0x11 */ { 0x0000, 0x236B, 0x0000, 0x0000, 0x236C, 0x0000,
0x0000, 0x236D, 0x0000, 0x0000, 0x0000, 0x0000,
0x0000, 0x0000, 0x0000, 0x236E, 0x0000, 0x0000, 0x0000 },
0x0000, 0x0000, 0x0000, 0x236E, 0x0000, 0x0000, 0x0000 }, // FACE_REACTION_SET_JIM
/* 0x12 */ { 0x2348, 0x2349, 0x234A, 0x0000, 0x234B, 0x2348,
0x234C, 0x2348, 0x234D, 0x234E, 0x2348, 0x2348,
0x2348, 0x2348, 0x2348, 0x234F, 0x2348, 0x2348, 0x2350 },
0x2348, 0x2348, 0x2348, 0x234F, 0x2348, 0x2348, 0x2350 }, // FACE_REACTION_SET_BOMBERS
/* 0x13 */ { 0 },
/* 0x14 */ { 0 },
/* 0x15 */ { 0x2351, 0x2352, 0x2353, 0x2354, 0x2355, 0x2356,
0x2357, 0x2356, 0x2358, 0x2359, 0x2356, 0x235A,
0x2353, 0x235A, 0x235A, 0x235B, 0x2354, 0x2351, 0x235C },
0x2353, 0x235A, 0x235A, 0x235B, 0x2354, 0x2351, 0x235C }, // FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD
/* 0x16 */ { 0 },
/* 0x17 */ { 0 },
/* 0x18 */ { 0 },
@ -77,24 +77,24 @@ static u16 sReactionTextIds[][PLAYER_MASK_GIANT - 1] = {
/* 0x2C */ { 0 },
/* 0x2D */ { 0x233B, 0x233C, 0x233D, 0x233E, 0x233F, 0x233B,
0x2340, 0x2341, 0x2342, 0x2343, 0x2344, 0x2345,
0x2346, 0x233B, 0x2345, 0x2347, 0x233D, 0x233B, 0x233D },
0x2346, 0x233B, 0x2345, 0x2347, 0x233D, 0x233B, 0x233D }, // FACE_REACTION_SET_TREASURE_CHEST_SHOP_GAL
/* 0x2E */ { 0 },
/* 0x2F */ { 0x2328, 0x2329, 0x232A, 0x232B, 0x2328, 0x2328,
0x232C, 0x2328, 0x232D, 0x232E, 0x2328, 0x2328,
0x2328, 0x232F, 0x2330, 0x2331, 0x2332, 0x2333, 0x2328 },
0x2328, 0x232F, 0x2330, 0x2331, 0x2332, 0x2333, 0x2328 }, // FACE_REACTION_SET_CURIOSITY_SHOP_MAN
/* 0x30 */ { 0x236F, 0x2370, 0x236F, 0x0000, 0x236F, 0x236F,
0x236F, 0x236F, 0x0000, 0x236F, 0x236F, 0x236F,
0x236F, 0x236F, 0x2371, 0x2372, 0x236F, 0x236F, 0x236F },
0x236F, 0x236F, 0x2371, 0x2372, 0x236F, 0x236F, 0x236F }, // FACE_REACTION_SET_TOWN_SHOOTING_GALLERY_MAN
/* 0x31 */ { 0x2373, 0x2374, 0x2373, 0x0000, 0x2373, 0x2373,
0x2373, 0x2373, 0x0000, 0x2375, 0x2376, 0x2373,
0x2373, 0x2373, 0x2377, 0x2378, 0x2373, 0x2373, 0x2373 },
0x2373, 0x2373, 0x2377, 0x2378, 0x2373, 0x2373, 0x2373 }, // FACE_REACTION_SET_SWAMP_SHOOTING_GALLERY_MAN
/* 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 },
0x0000, 0x0000, 0x2338, 0x2339, 0x0000, 0x233A, 0x0000 }, // FACE_REACTION_SET_PART_TIMER
/* 0x37 */ { 0 },
/* 0x38 */ { 0 },
/* 0x39 */ { 0 },
@ -178,7 +178,7 @@ static u16 sReactionTextIds[][PLAYER_MASK_GIANT - 1] = {
};
// clang-format on
u16 Text_GetFaceReaction(PlayState* play, u32 reactionSet) {
u16 Text_GetFaceReaction(PlayState* play, FaceReactionSet reactionSet) {
if ((Player_GetMask(play) > PLAYER_MASK_NONE) && (Player_GetMask(play) < PLAYER_MASK_GIANT)) {
return sReactionTextIds[reactionSet][Player_GetMask(play) - 1];
}

View File

@ -295,11 +295,11 @@ void func_80C03AF4(EnBombers* this, PlayState* play) {
break;
}
if (!Text_GetFaceReaction(play, 0x12)) {
if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS) == 0) {
func_80C039A8(this, play);
} else {
this->unk_2A6 = TEXT_STATE_5;
this->actor.textId = Text_GetFaceReaction(play, 0x12);
this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS);
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {

View File

@ -160,8 +160,8 @@ void func_80C04BA0(EnBombers2* this, PlayState* play) {
}
this->actor.textId = sTextIds[this->textIdIndex];
if (Text_GetFaceReaction(play, 0x15) != 0) {
this->actor.textId = Text_GetFaceReaction(play, 0x15);
if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD) != 0) {
this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD);
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@ -240,7 +240,7 @@ void func_80C04D8C(EnBombers2* this, PlayState* play) {
return;
}
}
if (Text_GetFaceReaction(play, 0x15) != 0) {
if (Text_GetFaceReaction(play, FACE_REACTION_SET_BOMBERS_HIDEOUT_GUARD) != 0) {
this->unk_28E = 0;
Message_CloseTextbox(play);
func_80C04B40(this);

View File

@ -379,8 +379,8 @@ void func_80BFEB64(EnBomjima* this, PlayState* play) {
}
}
if (Text_GetFaceReaction(play, 0x11) != 0) {
this->actor.textId = Text_GetFaceReaction(play, 0x11);
if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) {
this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM);
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@ -498,8 +498,8 @@ void func_80BFF174(EnBomjima* this, PlayState* play) {
this->cutsceneEnded = true;
}
if (Text_GetFaceReaction(play, 0x11) != 0) {
this->actor.textId = Text_GetFaceReaction(play, 0x11);
if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) {
this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM);
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
@ -881,8 +881,8 @@ void func_80C00168(EnBomjima* this, PlayState* play) {
func_80BFE32C(this, play, 0);
func_80BFE67C(this, play);
if (Text_GetFaceReaction(play, 0x11) != 0) {
this->actor.textId = Text_GetFaceReaction(play, 0x11);
if (Text_GetFaceReaction(play, FACE_REACTION_SET_JIM) != 0) {
this->actor.textId = Text_GetFaceReaction(play, FACE_REACTION_SET_JIM);
}
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {

View File

@ -1402,7 +1402,7 @@ void EnOssan_PartTimer_Init(EnOssan* this, PlayState* play) {
u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) {
Player* player = GET_PLAYER(play);
u16 textId = Text_GetFaceReaction(play, 0x2F);
u16 textId = Text_GetFaceReaction(play, FACE_REACTION_SET_CURIOSITY_SHOP_MAN);
if (textId != 0) {
this->animIndex = FSN_ANIM_HANDS_ON_COUNTER_START;
@ -1440,7 +1440,7 @@ u16 EnOssan_CuriosityShopMan_GetWelcome(EnOssan* this, PlayState* play) {
u16 EnOssan_PartTimer_GetWelcome(EnOssan* this, PlayState* play) {
Player* player = GET_PLAYER(play);
u16 textId = Text_GetFaceReaction(play, 0x36);
u16 textId = Text_GetFaceReaction(play, FACE_REACTION_SET_PART_TIMER);
if (textId != 0) {
this->flags |= END_INTERACTION;

View File

@ -266,7 +266,7 @@ void EnSyatekiMan_Swamp_Idle(EnSyatekiMan* this, PlayState* play) {
u16 faceReactionTextId;
Actor_ChangeAnimationByInfo(&this->skelAnime, sAnimationInfo, EN_SYATEKI_MAN_ANIM_SWAMP_HEAD_SCRATCH_END);
faceReactionTextId = Text_GetFaceReaction(play, 0x31);
faceReactionTextId = Text_GetFaceReaction(play, FACE_REACTION_SET_SWAMP_SHOOTING_GALLERY_MAN);
if (faceReactionTextId != 0) {
Message_StartTextbox(play, faceReactionTextId, &this->actor);
this->prevTextId = faceReactionTextId;
@ -592,7 +592,7 @@ void EnSyatekiMan_Town_StartIntroTextbox(EnSyatekiMan* this, PlayState* play) {
void EnSyatekiMan_Town_Idle(EnSyatekiMan* this, PlayState* play) {
if (Actor_ProcessTalkRequest(&this->actor, &play->state)) {
u16 faceReactionTextId = Text_GetFaceReaction(play, 0x30);
u16 faceReactionTextId = Text_GetFaceReaction(play, FACE_REACTION_SET_TOWN_SHOOTING_GALLERY_MAN);
if (faceReactionTextId != 0) {
Message_StartTextbox(play, faceReactionTextId, &this->actor);