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

Document eventChkInf usage of freed carpenters flags (#1210)

* Document `eventChkInf` usage of freed carpenters flags

* +`()`
This commit is contained in:
Dragorn421 2022-05-20 19:54:47 +02:00 committed by GitHub
parent 0e51a51fb1
commit d7bbe43ba7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
9 changed files with 36 additions and 53 deletions

View file

@ -338,19 +338,18 @@ typedef enum {
#define EVENTCHKINF_8F 0x8F #define EVENTCHKINF_8F 0x8F
// 0x90-0x93 // 0x90-0x93
#define EVENTCHKINF_90_91_92_93_INDEX 9 // carpenters freed from the gerudo
#define EVENTCHKINF_90_SHIFT 0 #define EVENTCHKINF_CARPENTERS_FREE_INDEX 9
#define EVENTCHKINF_91_SHIFT 1 #define EVENTCHKINF_CARPENTERS_FREE_SHIFT(n) (0 + (n))
#define EVENTCHKINF_92_SHIFT 2 #define EVENTCHKINF_CARPENTERS_FREE_MASK(n) (1 << EVENTCHKINF_CARPENTERS_FREE_SHIFT(n))
#define EVENTCHKINF_93_SHIFT 3 #define EVENTCHKINF_CARPENTERS_FREE(n) ((EVENTCHKINF_CARPENTERS_FREE_INDEX << 4) | EVENTCHKINF_CARPENTERS_FREE_SHIFT(n))
#define EVENTCHKINF_90_MASK (1 << EVENTCHKINF_90_SHIFT) #define EVENTCHKINF_CARPENTERS_FREE_MASK_ALL (\
#define EVENTCHKINF_91_MASK (1 << EVENTCHKINF_91_SHIFT) EVENTCHKINF_CARPENTERS_FREE_MASK(0) \
#define EVENTCHKINF_92_MASK (1 << EVENTCHKINF_92_SHIFT) | EVENTCHKINF_CARPENTERS_FREE_MASK(1) \
#define EVENTCHKINF_93_MASK (1 << EVENTCHKINF_93_SHIFT) | EVENTCHKINF_CARPENTERS_FREE_MASK(2) \
#define EVENTCHKINF_90 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_90_SHIFT) | EVENTCHKINF_CARPENTERS_FREE_MASK(3) )
#define EVENTCHKINF_91 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_91_SHIFT) #define GET_EVENTCHKINF_CARPENTERS_FREE_ALL() \
#define EVENTCHKINF_92 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_92_SHIFT) CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX], EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)
#define EVENTCHKINF_93 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_93_SHIFT)
#define EVENTCHKINF_94 0x94 #define EVENTCHKINF_94 0x94
#define EVENTCHKINF_95 0x95 #define EVENTCHKINF_95 0x95

View file

@ -118,16 +118,11 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
extendedMapIndex = 0x15; extendedMapIndex = 0x15;
} }
} else if (globalCtx->sceneNum == SCENE_SPOT09) { } else if (globalCtx->sceneNum == SCENE_SPOT09) {
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && if ((LINK_AGE_IN_YEARS == YEARS_ADULT) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
!CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK |
EVENTCHKINF_93_MASK)) {
extendedMapIndex = 0x16; extendedMapIndex = 0x16;
} }
} else if (globalCtx->sceneNum == SCENE_SPOT12) { } else if (globalCtx->sceneNum == SCENE_SPOT12) {
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK |
EVENTCHKINF_93_MASK)) {
extendedMapIndex = 0x17; extendedMapIndex = 0x17;
} }
} }

View file

@ -63,9 +63,7 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
return this->dyna.actor.params == 0; return this->dyna.actor.params == 0;
} }
carpentersRescued = carpentersRescued = GET_EVENTCHKINF_CARPENTERS_FREE_ALL();
CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK);
if (LINK_AGE_IN_YEARS == YEARS_ADULT) { if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
switch (this->dyna.actor.params) { switch (this->dyna.actor.params) {
@ -140,8 +138,7 @@ void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) {
BgSpot09Obj* this = (BgSpot09Obj*)thisx; BgSpot09Obj* this = (BgSpot09Obj*)thisx;
osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params, osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params,
gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] & gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] & EVENTCHKINF_CARPENTERS_FREE_MASK_ALL);
(EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK));
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)) {
osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n", osSyncPrintf("Error : Spot 09 object の arg_data が判別出来ない(%s %d)(arg_data 0x%04x)\n",

View file

@ -152,13 +152,13 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) {
s32 noKill = true; s32 noKill = true;
s32 isFree = false; s32 isFree = false;
if ((this->actor.params & 3) == 0 && GET_EVENTCHKINF(EVENTCHKINF_90)) { if ((this->actor.params & 3) == 0 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0))) {
isFree = true; isFree = true;
} else if ((this->actor.params & 3) == 1 && GET_EVENTCHKINF(EVENTCHKINF_91)) { } else if ((this->actor.params & 3) == 1 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1))) {
isFree = true; isFree = true;
} else if ((this->actor.params & 3) == 2 && GET_EVENTCHKINF(EVENTCHKINF_92)) { } else if ((this->actor.params & 3) == 2 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2))) {
isFree = true; isFree = true;
} else if ((this->actor.params & 3) == 3 && GET_EVENTCHKINF(EVENTCHKINF_93)) { } else if ((this->actor.params & 3) == 3 && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3))) {
isFree = true; isFree = true;
} }
@ -271,8 +271,8 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) {
if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) { if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) {
freedCount = 0; freedCount = 0;
for (carpenterType = 0; carpenterType < 4; carpenterType++) { for (carpenterType = 0; carpenterType < 4; carpenterType++) {
if (gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] & if (gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] &
(1 << (carpenterType + EVENTCHKINF_90_SHIFT))) { EVENTCHKINF_CARPENTERS_FREE_MASK(carpenterType)) {
freedCount++; freedCount++;
} }
} }
@ -400,7 +400,8 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) {
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.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] |= 1 << ((this->actor.params & 3) + EVENTCHKINF_90_SHIFT); gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] |=
EVENTCHKINF_CARPENTERS_FREE_MASK(this->actor.params & 3);
this->actor.gravity = -1.0f; this->actor.gravity = -1.0f;
this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive; this->escapeSubCamTimer = sEscapeSubCamParams[this->actor.params & 3].maxFramesActive;
@ -495,8 +496,7 @@ void EnDaiku_EscapeSuccess(EnDaiku* this, GlobalContext* globalCtx) {
Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE); Play_ChangeCameraStatus(globalCtx, CAM_ID_MAIN, CAM_STAT_ACTIVE);
this->subCamActive = false; this->subCamActive = false;
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW); Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW);
Matrix_MultVec3f(&D_809E4148, &vec); Matrix_MultVec3f(&D_809E4148, &vec);
gerudoGuard = gerudoGuard =

View file

@ -209,13 +209,11 @@ void EnGe1_SetAnimationIdle(EnGe1* this) {
} }
s32 EnGe1_CheckCarpentersFreed(void) { s32 EnGe1_CheckCarpentersFreed(void) {
u16 carpenterFlags = gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX]; if (!(GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(0)) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(1)) &&
GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(2)) && GET_EVENTCHKINF(EVENTCHKINF_CARPENTERS_FREE(3)))) {
if (!((carpenterFlags & EVENTCHKINF_90_MASK) && (carpenterFlags & EVENTCHKINF_91_MASK) && return false;
(carpenterFlags & EVENTCHKINF_92_MASK) && (carpenterFlags & EVENTCHKINF_93_MASK))) {
return 0;
} }
return 1; return true;
} }
/** /**

View file

@ -223,10 +223,9 @@ s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos,
} }
s32 EnGe2_CheckCarpentersFreed(void) { s32 EnGe2_CheckCarpentersFreed(void) {
if (CHECK_FLAG_ALL( if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] &
gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] & (EVENTCHKINF_CARPENTERS_FREE_MASK_ALL | 0xF0),
(EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK | 0xF0), EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
return 1; return 1;
} }
return 0; return 0;

View file

@ -461,8 +461,7 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) {
if (this->actor.speedXZ < 12.8f) { if (this->actor.speedXZ < 12.8f) {
return false; return false;
} }
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
return false; return false;
} }
@ -3578,9 +3577,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) {
this->stateFlags &= ~ENHORSE_FLAG_24; this->stateFlags &= ~ENHORSE_FLAG_24;
} }
if (globalCtx->sceneNum == SCENE_SPOT09 && if (globalCtx->sceneNum == SCENE_SPOT09 && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
!CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
EnHorse_CheckBridgeJumps(this, globalCtx); EnHorse_CheckBridgeJumps(this, globalCtx);
} }

View file

@ -100,8 +100,7 @@ void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) {
} }
void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) { void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) {
if (!CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], if (!GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
this->actor.textId = 0x6086; this->actor.textId = 0x6086;
} else if (GET_INFTABLE(INFTABLE_17F)) { } else if (GET_INFTABLE(INFTABLE_17F)) {
if (GET_EVENTINF(EVENTINF_10)) { if (GET_EVENTINF(EVENTINF_10)) {

View file

@ -259,8 +259,7 @@ s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) {
if (textId == 0) { if (textId == 0) {
if (this->stateFlags & 1) { if (this->stateFlags & 1) {
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX], if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
ret = 0x606C; ret = 0x606C;
} else if (GET_INFTABLE(INFTABLE_170)) { } else if (GET_INFTABLE(INFTABLE_170)) {
ret = 0x606B; ret = 0x606B;