1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 19:13:42 +00:00

Restructure event flags in z64save.h (2/?): Carpenters (#2385)

* Clean up EVENTCHKINF for Carpenters

* hardcode EVENTCHKINF_INDEX_CARPENTERS_RESCUED
This commit is contained in:
mzxrules 2024-12-27 18:48:56 -05:00 committed by GitHub
parent ccfb3594ac
commit ba6a83533a
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
10 changed files with 101 additions and 77 deletions

View file

@ -572,18 +572,38 @@ typedef enum LinkAge {
#define EVENTCHKINF_PAID_BACK_BUNNY_HOOD 0x8F #define EVENTCHKINF_PAID_BACK_BUNNY_HOOD 0x8F
// EVENTCHKINF 0x90-0x93 // EVENTCHKINF 0x90-0x93
// carpenters freed from the gerudo // Carpenters rescued from Gerudo Fortress
#define EVENTCHKINF_INDEX_CARPENTERS_FREE 9 #define EVENTCHKINF_INDEX_CARPENTERS_RESCUED 0x9
#define EVENTCHKINF_CARPENTERS_FREE_SHIFT(n) (0 + (n)) #define EVENTCHKINF_CARPENTER_0_RESCUED 0x90
#define EVENTCHKINF_CARPENTERS_FREE_MASK(n) (1 << EVENTCHKINF_CARPENTERS_FREE_SHIFT(n)) #define EVENTCHKINF_CARPENTER_1_RESCUED 0x91
#define EVENTCHKINF_CARPENTERS_FREE(n) ((EVENTCHKINF_INDEX_CARPENTERS_FREE << 4) | EVENTCHKINF_CARPENTERS_FREE_SHIFT(n)) #define EVENTCHKINF_CARPENTER_2_RESCUED 0x92
#define EVENTCHKINF_CARPENTERS_FREE_MASK_ALL (\ #define EVENTCHKINF_CARPENTER_3_RESCUED 0x93
EVENTCHKINF_CARPENTERS_FREE_MASK(0) \
| EVENTCHKINF_CARPENTERS_FREE_MASK(1) \ #define EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK \
| EVENTCHKINF_CARPENTERS_FREE_MASK(2) \ (EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_0_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_1_RESCUED) | \
| EVENTCHKINF_CARPENTERS_FREE_MASK(3) ) EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_2_RESCUED) | EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_3_RESCUED))
#define GET_EVENTCHKINF_CARPENTERS_FREE_ALL() \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREE], EVENTCHKINF_CARPENTERS_FREE_MASK_ALL) #define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED() \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED], \
EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)
#define GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2() \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & \
(EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK | 0xF0), \
EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK)
#define ENDAIKU_CARPENTER_RESCUED_MASK(carpenterType) (1 << (carpenterType))
#define ENDAIKU_IS_CARPENTER_RESCUED(carpenterType) \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & \
ENDAIKU_CARPENTER_RESCUED_MASK(carpenterType)
#define ENDAIKU_SET_CARPENTER_RESCUED(carpenterType) \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] |= \
ENDAIKU_CARPENTER_RESCUED_MASK((carpenterType))
#define GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS() \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_RESCUED] & EVENTCHKINF_CARPENTERS_ALL_RESCUED_MASK
#define EVENTCHKINF_94 0x94 #define EVENTCHKINF_94 0x94
#define EVENTCHKINF_95 0x95 #define EVENTCHKINF_95 0x95

View file

@ -122,11 +122,11 @@ void Map_InitData(PlayState* play, s16 room) {
extendedMapIndex = 0x15; extendedMapIndex = 0x15;
} }
} else if (play->sceneId == SCENE_GERUDO_VALLEY) { } else if (play->sceneId == SCENE_GERUDO_VALLEY) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
extendedMapIndex = 0x16; extendedMapIndex = 0x16;
} }
} else if (play->sceneId == SCENE_GERUDOS_FORTRESS) { } else if (play->sceneId == SCENE_GERUDOS_FORTRESS) {
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
extendedMapIndex = 0x17; extendedMapIndex = 0x17;
} }
} }

View file

@ -63,7 +63,7 @@ s32 func_808B1AE0(BgSpot09Obj* this, PlayState* play) {
return this->dyna.actor.params == 0; return this->dyna.actor.params == 0;
} }
carpentersRescued = GET_EVENTCHKINF_CARPENTERS_FREE_ALL(); carpentersRescued = GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED();
if (LINK_AGE_IN_YEARS == YEARS_ADULT) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
switch (this->dyna.actor.params) { switch (this->dyna.actor.params) {
@ -138,8 +138,7 @@ void BgSpot09Obj_Init(Actor* thisx, PlayState* play) {
BgSpot09Obj* this = (BgSpot09Obj*)thisx; BgSpot09Obj* this = (BgSpot09Obj*)thisx;
PRINTF("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params, PRINTF("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params,
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREE] & GET_EVENTCHKINF_CARPENTERS_RESCUED_FLAGS());
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL);
this->dyna.actor.params &= 0xFF; this->dyna.actor.params &= 0xFF;
if ((this->dyna.actor.params < 0) || (this->dyna.actor.params >= 5)) { if ((this->dyna.actor.params < 0) || (this->dyna.actor.params >= 5)) {
PRINTF("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot09_obj.c", PRINTF("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", "../z_bg_spot09_obj.c",

View file

@ -4,6 +4,8 @@
#define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED) #define FLAGS (ACTOR_FLAG_ATTENTION_ENABLED | ACTOR_FLAG_FRIENDLY | ACTOR_FLAG_UPDATE_CULLING_DISABLED)
#define ENDAIKU_GET_TYPE(thisx) PARAMS_GET_U((thisx)->params, 0, 2)
typedef struct EnDaikuEscapeSubCamParam { typedef struct EnDaikuEscapeSubCamParam {
Vec3f eyePosDeltaLocal; Vec3f eyePosDeltaLocal;
s32 maxFramesActive; s32 maxFramesActive;
@ -150,21 +152,21 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
EnDaiku* this = (EnDaiku*)thisx; EnDaiku* this = (EnDaiku*)thisx;
s32 pad; s32 pad;
s32 noKill = true; s32 noKill = true;
s32 isFree = false; s32 isRescued = false;
if (PARAMS_GET_U(this->actor.params, 0, 2) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) { if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_0_RESCUED)) {
isFree = true; isRescued = true;
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) { } else if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_1_RESCUED)) {
isFree = true; isRescued = true;
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) { } else if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_2_RESCUED)) {
isFree = true; isRescued = true;
} else if (PARAMS_GET_U(this->actor.params, 0, 2) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) { } else if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_3_RESCUED)) {
isFree = true; isRescued = true;
} }
if (isFree == true && play->sceneId == SCENE_THIEVES_HIDEOUT) { if (isRescued == true && play->sceneId == SCENE_THIEVES_HIDEOUT) {
noKill = false; noKill = false;
} else if (!isFree && play->sceneId == SCENE_CARPENTERS_TENT) { } else if (!isRescued && play->sceneId == SCENE_CARPENTERS_TENT) {
noKill = false; noKill = false;
} }
@ -200,7 +202,7 @@ void EnDaiku_Init(Actor* thisx, PlayState* play) {
this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2; this->stateFlags |= ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2;
this->actionFunc = EnDaiku_Jailed; this->actionFunc = EnDaiku_Jailed;
} else { } else {
if (PARAMS_GET_U(this->actor.params, 0, 2) == 1 || PARAMS_GET_U(this->actor.params, 0, 2) == 3) { if (ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE1 || ENDAIKU_GET_TYPE(&this->actor) == ENDAIKU_TYPE3) {
EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex); EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_SIT, &this->currentAnimIndex);
this->stateFlags |= ENDAIKU_STATEFLAG_1; this->stateFlags |= ENDAIKU_STATEFLAG_1;
} else { } else {
@ -254,7 +256,7 @@ s32 EnDaiku_UpdateTalking(EnDaiku* this, PlayState* play) {
void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) { void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
s32 carpenterType; s32 carpenterType;
s32 freedCount; s32 rescuedCount;
s16 sp2E; s16 sp2E;
s16 sp2C; s16 sp2C;
@ -268,15 +270,14 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
Actor_OfferTalk(&this->actor, play, 100.0f) == 1) { Actor_OfferTalk(&this->actor, play, 100.0f) == 1) {
if (play->sceneId == SCENE_THIEVES_HIDEOUT) { if (play->sceneId == SCENE_THIEVES_HIDEOUT) {
if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) { if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) {
freedCount = 0; rescuedCount = 0;
for (carpenterType = 0; carpenterType < 4; carpenterType++) { for (carpenterType = 0; carpenterType < 4; carpenterType++) {
if (gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREE] & if (ENDAIKU_IS_CARPENTER_RESCUED(carpenterType)) {
EVENTCHKINF_CARPENTERS_FREE_MASK(carpenterType)) { rescuedCount++;
freedCount++;
} }
} }
switch (freedCount) { switch (rescuedCount) {
case 0: case 0:
this->actor.textId = 0x605B; this->actor.textId = 0x605B;
break; break;
@ -295,15 +296,15 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
this->actor.textId = 0x6007; this->actor.textId = 0x6007;
} }
} else if (play->sceneId == SCENE_CARPENTERS_TENT) { } else if (play->sceneId == SCENE_CARPENTERS_TENT) {
switch (PARAMS_GET_U(this->actor.params, 0, 2)) { switch (ENDAIKU_GET_TYPE(&this->actor)) {
case 0: case ENDAIKU_TYPE0:
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
this->actor.textId = 0x6060; this->actor.textId = 0x6060;
} else { } else {
this->actor.textId = 0x605F; this->actor.textId = 0x605F;
} }
break; break;
case 1: case ENDAIKU_TYPE1:
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
this->actor.textId = 0x6063; this->actor.textId = 0x6063;
} else { } else {
@ -314,7 +315,7 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
} }
} }
break; break;
case 2: case ENDAIKU_TYPE2:
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
this->actor.textId = 0x6066; this->actor.textId = 0x6066;
} else { } else {
@ -325,7 +326,7 @@ void EnDaiku_UpdateText(EnDaiku* this, PlayState* play) {
} }
} }
break; break;
case 3: case ENDAIKU_TYPE3:
if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) { if (CHECK_QUEST_ITEM(QUEST_MEDALLION_SPIRIT)) {
this->actor.textId = 0x6068; this->actor.textId = 0x6068;
} else { } else {
@ -385,7 +386,7 @@ void EnDaiku_WaitFreedom(EnDaiku* this, PlayState* play) {
} }
/** /**
* The carpenter is free, initializes his running away animation * The carpenter is rescued, initializes his running away animation
*/ */
void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) { void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) {
Path* path; Path* path;
@ -399,11 +400,10 @@ void EnDaiku_InitEscape(EnDaiku* this, PlayState* play) {
EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex); EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex);
this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2); this->stateFlags &= ~(ENDAIKU_STATEFLAG_1 | ENDAIKU_STATEFLAG_2);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREE] |= ENDAIKU_SET_CARPENTER_RESCUED(ENDAIKU_GET_TYPE(&this->actor));
EVENTCHKINF_CARPENTERS_FREE_MASK(PARAMS_GET_U(this->actor.params, 0, 2));
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive; this->escapeSubCamTimer = sEscapeSubCamParams[ENDAIKU_GET_TYPE(&this->actor)].maxFramesActive;
EnDaiku_InitSubCamera(this, play); EnDaiku_InitSubCamera(this, play);
exitLoop = false; exitLoop = false;
@ -444,11 +444,11 @@ void EnDaiku_InitSubCamera(EnDaiku* this, PlayState* play) {
Vec3f eyePosDeltaWorld; Vec3f eyePosDeltaWorld;
this->subCamActive = true; this->subCamActive = true;
this->escapeSubCamTimer = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].maxFramesActive; this->escapeSubCamTimer = sEscapeSubCamParams[ENDAIKU_GET_TYPE(&this->actor)].maxFramesActive;
eyePosDeltaLocal.x = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.x; eyePosDeltaLocal.x = sEscapeSubCamParams[ENDAIKU_GET_TYPE(&this->actor)].eyePosDeltaLocal.x;
eyePosDeltaLocal.y = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.y; eyePosDeltaLocal.y = sEscapeSubCamParams[ENDAIKU_GET_TYPE(&this->actor)].eyePosDeltaLocal.y;
eyePosDeltaLocal.z = sEscapeSubCamParams[PARAMS_GET_U(this->actor.params, 0, 2)].eyePosDeltaLocal.z; eyePosDeltaLocal.z = sEscapeSubCamParams[ENDAIKU_GET_TYPE(&this->actor)].eyePosDeltaLocal.z;
Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->actor.world.rot.y), MTXMODE_NEW);
Matrix_MultVec3f(&eyePosDeltaLocal, &eyePosDeltaWorld); Matrix_MultVec3f(&eyePosDeltaLocal, &eyePosDeltaWorld);
@ -493,7 +493,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, PlayState* play) {
Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE); Play_ChangeCameraStatus(play, CAM_ID_MAIN, CAM_STAT_ACTIVE);
this->subCamActive = false; this->subCamActive = false;
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
Actor* gerudoGuard; Actor* gerudoGuard;
Vec3f vec; Vec3f vec;
@ -594,13 +594,13 @@ void EnDaiku_Draw(Actor* thisx, PlayState* play) {
Gfx_SetupDL_25Opa(play->state.gfxCtx); Gfx_SetupDL_25Opa(play->state.gfxCtx);
if (PARAMS_GET_U(thisx->params, 0, 2) == 0) { if (ENDAIKU_GET_TYPE(thisx) == ENDAIKU_TYPE0) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255); gDPSetEnvColor(POLY_OPA_DISP++, 170, 10, 70, 255);
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 1) { } else if (ENDAIKU_GET_TYPE(thisx) == ENDAIKU_TYPE1) {
gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255); gDPSetEnvColor(POLY_OPA_DISP++, 170, 200, 255, 255);
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 2) { } else if (ENDAIKU_GET_TYPE(thisx) == ENDAIKU_TYPE2) {
gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255); gDPSetEnvColor(POLY_OPA_DISP++, 0, 230, 70, 255);
} else if (PARAMS_GET_U(thisx->params, 0, 2) == 3) { } else if (ENDAIKU_GET_TYPE(thisx) == ENDAIKU_TYPE3) {
gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255); gDPSetEnvColor(POLY_OPA_DISP++, 200, 0, 150, 255);
} }
@ -637,7 +637,7 @@ void EnDaiku_PostLimbDraw(PlayState* play, s32 limb, Gfx** dList, Vec3s* rot, vo
if (limb == 15) { // head if (limb == 15) { // head
Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos); Matrix_MultVec3f(&targetPosHeadLocal, &this->actor.focus.pos);
gSPDisplayList(POLY_OPA_DISP++, hairDLists[PARAMS_GET_U(this->actor.params, 0, 2)]); gSPDisplayList(POLY_OPA_DISP++, hairDLists[ENDAIKU_GET_TYPE(&this->actor)]);
} }
CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1330); CLOSE_DISPS(play->state.gfxCtx, "../z_en_daiku.c", 1330);

View file

@ -8,6 +8,13 @@ struct EnDaiku;
typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*); typedef void (*EnDaikuActionFunc)(struct EnDaiku*, PlayState*);
typedef enum EnDaikuType {
ENDAIKU_TYPE0,
ENDAIKU_TYPE1,
ENDAIKU_TYPE2,
ENDAIKU_TYPE3
} EnDaikuType;
typedef struct EnDaiku { typedef struct EnDaiku {
/* 0x0000 */ Actor actor; /* 0x0000 */ Actor actor;
/* 0x014C */ SkelAnime skelAnime; /* 0x014C */ SkelAnime skelAnime;

View file

@ -27,7 +27,7 @@ void EnGe1_Destroy(Actor* thisx, PlayState* play);
void EnGe1_Update(Actor* thisx, PlayState* play); void EnGe1_Update(Actor* thisx, PlayState* play);
void EnGe1_Draw(Actor* thisx, PlayState* play); void EnGe1_Draw(Actor* thisx, PlayState* play);
s32 EnGe1_CheckCarpentersFreed(void); s32 EnGe1_CheckAllCarpentersRescued(void);
void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play); void EnGe1_WatchForPlayerFrontOnly(EnGe1* this, PlayState* play);
void EnGe1_SetNormalText(EnGe1* this, PlayState* play); void EnGe1_SetNormalText(EnGe1* this, PlayState* play);
void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play); void EnGe1_WatchForAndSensePlayer(EnGe1* this, PlayState* play);
@ -114,7 +114,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
case GE1_TYPE_GATE_OPERATOR: case GE1_TYPE_GATE_OPERATOR:
this->hairstyle = GE1_HAIR_STRAIGHT; this->hairstyle = GE1_HAIR_STRAIGHT;
if (EnGe1_CheckCarpentersFreed()) { if (EnGe1_CheckAllCarpentersRescued()) {
this->actionFunc = EnGe1_CheckGate_GateOp; this->actionFunc = EnGe1_CheckGate_GateOp;
} else { } else {
this->actionFunc = EnGe1_WatchForPlayerFrontOnly; this->actionFunc = EnGe1_WatchForPlayerFrontOnly;
@ -124,7 +124,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
case GE1_TYPE_NORMAL: case GE1_TYPE_NORMAL:
this->hairstyle = GE1_HAIR_STRAIGHT; this->hairstyle = GE1_HAIR_STRAIGHT;
if (EnGe1_CheckCarpentersFreed()) { if (EnGe1_CheckAllCarpentersRescued()) {
this->actionFunc = EnGe1_SetNormalText; this->actionFunc = EnGe1_SetNormalText;
} else { } else {
this->actionFunc = EnGe1_WatchForAndSensePlayer; this->actionFunc = EnGe1_WatchForAndSensePlayer;
@ -154,7 +154,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
if (GET_EVENTINF(EVENTINF_HORSES_08)) { if (GET_EVENTINF(EVENTINF_HORSES_08)) {
this->actionFunc = EnGe1_TalkAfterGame_Archery; this->actionFunc = EnGe1_TalkAfterGame_Archery;
} else if (EnGe1_CheckCarpentersFreed()) { } else if (EnGe1_CheckAllCarpentersRescued()) {
this->actionFunc = EnGe1_Wait_Archery; this->actionFunc = EnGe1_Wait_Archery;
} else { } else {
this->actionFunc = EnGe1_WatchForPlayerFrontOnly; this->actionFunc = EnGe1_WatchForPlayerFrontOnly;
@ -164,7 +164,7 @@ void EnGe1_Init(Actor* thisx, PlayState* play) {
case GE1_TYPE_TRAINING_GROUNDS_GUARD: case GE1_TYPE_TRAINING_GROUNDS_GUARD:
this->hairstyle = GE1_HAIR_STRAIGHT; this->hairstyle = GE1_HAIR_STRAIGHT;
if (EnGe1_CheckCarpentersFreed()) { if (EnGe1_CheckAllCarpentersRescued()) {
this->actionFunc = EnGe1_CheckForCard_GTGGuard; this->actionFunc = EnGe1_CheckForCard_GTGGuard;
} else { } else {
this->actionFunc = EnGe1_WatchForPlayerFrontOnly; this->actionFunc = EnGe1_WatchForPlayerFrontOnly;
@ -208,9 +208,9 @@ void EnGe1_SetAnimationIdle(EnGe1* this) {
this->animFunc = EnGe1_CueUpAnimation; this->animFunc = EnGe1_CueUpAnimation;
} }
s32 EnGe1_CheckCarpentersFreed(void) { s32 EnGe1_CheckAllCarpentersRescued(void) {
if (!(GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0)) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1)) && if (!(GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_0_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_1_RESCUED) &&
GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2)) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3)))) { GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_2_RESCUED) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTER_3_RESCUED))) {
return false; return false;
} }
return true; return true;

View file

@ -39,7 +39,7 @@ void EnGe2_Destroy(Actor* thisx, PlayState* play);
void EnGe2_Update(Actor* thisx, PlayState* play); void EnGe2_Update(Actor* thisx, PlayState* play);
void EnGe2_Draw(Actor* thisx, PlayState* play); void EnGe2_Draw(Actor* thisx, PlayState* play);
s32 EnGe2_CheckCarpentersFreed(void); s32 EnGe2_CheckAllCarpentersRescued(void);
void EnGe2_CaptureClose(EnGe2* this, PlayState* play); void EnGe2_CaptureClose(EnGe2* this, PlayState* play);
void EnGe2_CaptureCharge(EnGe2* this, PlayState* play); void EnGe2_CaptureCharge(EnGe2* this, PlayState* play);
void EnGe2_CaptureTurn(EnGe2* this, PlayState* play); void EnGe2_CaptureTurn(EnGe2* this, PlayState* play);
@ -137,14 +137,14 @@ void EnGe2_Init(Actor* thisx, PlayState* play) {
switch (PARAMS_GET_S(thisx->params, 0, 8)) { switch (PARAMS_GET_S(thisx->params, 0, 8)) {
case GE2_TYPE_PATROLLING: case GE2_TYPE_PATROLLING:
EnGe2_ChangeAction(this, GE2_ACTION_WALK); EnGe2_ChangeAction(this, GE2_ACTION_WALK);
if (EnGe2_CheckCarpentersFreed()) { if (EnGe2_CheckAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly; this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.attentionRangeType = ATTENTION_RANGE_6;
} }
break; break;
case GE2_TYPE_STATIONARY: case GE2_TYPE_STATIONARY:
EnGe2_ChangeAction(this, GE2_ACTION_STAND); EnGe2_ChangeAction(this, GE2_ACTION_STAND);
if (EnGe2_CheckCarpentersFreed()) { if (EnGe2_CheckAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly; this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.attentionRangeType = ATTENTION_RANGE_6;
} }
@ -224,13 +224,11 @@ s32 Ge2_DetectPlayerInUpdate(PlayState* play, EnGe2* this, Vec3f* pos, s16 yRot,
return 1; return 1;
} }
s32 EnGe2_CheckCarpentersFreed(void) { s32 EnGe2_CheckAllCarpentersRescued(void) {
if (CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREE] & if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED2()) {
(EVENTCHKINF_CARPENTERS_FREE_MASK_ALL | 0xF0), return true;
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)) {
return 1;
} }
return 0; return false;
} }
// Actions // Actions
@ -594,7 +592,7 @@ void EnGe2_Update(Actor* thisx, PlayState* play) {
} }
EnGe2_MoveAndBlink(this, play); EnGe2_MoveAndBlink(this, play);
if (EnGe2_CheckCarpentersFreed() && !(this->stateFlags & GE2_STATE_KO)) { if (EnGe2_CheckAllCarpentersRescued() && !(this->stateFlags & GE2_STATE_KO)) {
this->actor.update = EnGe2_UpdateFriendly; this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.attentionRangeType = ATTENTION_RANGE_6;
} }
@ -620,7 +618,7 @@ void EnGe2_UpdateStunned(Actor* thisx, PlayState* play2) {
} }
CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base); CollisionCheck_SetAC(play, &play->colChkCtx, &this->collider.base);
if (EnGe2_CheckCarpentersFreed()) { if (EnGe2_CheckAllCarpentersRescued()) {
this->actor.update = EnGe2_UpdateFriendly; this->actor.update = EnGe2_UpdateFriendly;
this->actor.attentionRangeType = ATTENTION_RANGE_6; this->actor.attentionRangeType = ATTENTION_RANGE_6;
this->actor.colorFilterTimer = 0; this->actor.colorFilterTimer = 0;

View file

@ -457,7 +457,7 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, PlayState* play) {
if (this->actor.speed < 12.8f) { if (this->actor.speed < 12.8f) {
return false; return false;
} }
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
return false; return false;
} }
@ -3595,7 +3595,7 @@ void EnHorse_Update(Actor* thisx, PlayState* play2) {
this->stateFlags &= ~ENHORSE_FLAG_24; this->stateFlags &= ~ENHORSE_FLAG_24;
} }
if (play->sceneId == SCENE_GERUDO_VALLEY && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (play->sceneId == SCENE_GERUDO_VALLEY && !GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
EnHorse_CheckBridgeJumps(this, play); EnHorse_CheckBridgeJumps(this, play);
} }

View file

@ -100,7 +100,7 @@ void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) {
} }
void func_80AAEF70(EnMm2* this, PlayState* play) { void func_80AAEF70(EnMm2* this, PlayState* play) {
if (!GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (!GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
this->actor.textId = 0x6086; this->actor.textId = 0x6086;
} else if (GET_INFTABLE(INFTABLE_17F)) { } else if (GET_INFTABLE(INFTABLE_17F)) {
if (GET_EVENTINF(EVENTINF_MARATHON_ACTIVE)) { if (GET_EVENTINF(EVENTINF_MARATHON_ACTIVE)) {

View file

@ -258,7 +258,7 @@ s32 EnToryo_GetTextId(EnToryo* this, PlayState* play) {
if (textId == 0) { if (textId == 0) {
if (this->stateFlags & 1) { if (this->stateFlags & 1) {
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) { if (GET_EVENTCHKINF_CARPENTERS_ALL_RESCUED()) {
ret = 0x606C; ret = 0x606C;
} else if (GET_INFTABLE(INFTABLE_170)) { } else if (GET_INFTABLE(INFTABLE_170)) {
ret = 0x606B; ret = 0x606B;