mirror of
https://github.com/zeldaret/oot.git
synced 2024-12-27 07:07:09 +00:00
Document eventChkInf
usage of freed carpenters flags (#1210)
* Document `eventChkInf` usage of freed carpenters flags * +`()`
This commit is contained in:
parent
0e51a51fb1
commit
d7bbe43ba7
9 changed files with 36 additions and 53 deletions
|
@ -338,19 +338,18 @@ typedef enum {
|
|||
#define EVENTCHKINF_8F 0x8F
|
||||
|
||||
// 0x90-0x93
|
||||
#define EVENTCHKINF_90_91_92_93_INDEX 9
|
||||
#define EVENTCHKINF_90_SHIFT 0
|
||||
#define EVENTCHKINF_91_SHIFT 1
|
||||
#define EVENTCHKINF_92_SHIFT 2
|
||||
#define EVENTCHKINF_93_SHIFT 3
|
||||
#define EVENTCHKINF_90_MASK (1 << EVENTCHKINF_90_SHIFT)
|
||||
#define EVENTCHKINF_91_MASK (1 << EVENTCHKINF_91_SHIFT)
|
||||
#define EVENTCHKINF_92_MASK (1 << EVENTCHKINF_92_SHIFT)
|
||||
#define EVENTCHKINF_93_MASK (1 << EVENTCHKINF_93_SHIFT)
|
||||
#define EVENTCHKINF_90 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_90_SHIFT)
|
||||
#define EVENTCHKINF_91 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_91_SHIFT)
|
||||
#define EVENTCHKINF_92 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_92_SHIFT)
|
||||
#define EVENTCHKINF_93 ((EVENTCHKINF_90_91_92_93_INDEX << 4) | EVENTCHKINF_93_SHIFT)
|
||||
// carpenters freed from the gerudo
|
||||
#define EVENTCHKINF_CARPENTERS_FREE_INDEX 9
|
||||
#define EVENTCHKINF_CARPENTERS_FREE_SHIFT(n) (0 + (n))
|
||||
#define EVENTCHKINF_CARPENTERS_FREE_MASK(n) (1 << EVENTCHKINF_CARPENTERS_FREE_SHIFT(n))
|
||||
#define EVENTCHKINF_CARPENTERS_FREE(n) ((EVENTCHKINF_CARPENTERS_FREE_INDEX << 4) | EVENTCHKINF_CARPENTERS_FREE_SHIFT(n))
|
||||
#define EVENTCHKINF_CARPENTERS_FREE_MASK_ALL (\
|
||||
EVENTCHKINF_CARPENTERS_FREE_MASK(0) \
|
||||
| EVENTCHKINF_CARPENTERS_FREE_MASK(1) \
|
||||
| EVENTCHKINF_CARPENTERS_FREE_MASK(2) \
|
||||
| EVENTCHKINF_CARPENTERS_FREE_MASK(3) )
|
||||
#define GET_EVENTCHKINF_CARPENTERS_FREE_ALL() \
|
||||
CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX], EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)
|
||||
|
||||
#define EVENTCHKINF_94 0x94
|
||||
#define EVENTCHKINF_95 0x95
|
||||
|
|
|
@ -118,16 +118,11 @@ void Map_InitData(GlobalContext* globalCtx, s16 room) {
|
|||
extendedMapIndex = 0x15;
|
||||
}
|
||||
} else if (globalCtx->sceneNum == SCENE_SPOT09) {
|
||||
if ((LINK_AGE_IN_YEARS == YEARS_ADULT) &&
|
||||
!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) && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
extendedMapIndex = 0x16;
|
||||
}
|
||||
} else if (globalCtx->sceneNum == SCENE_SPOT12) {
|
||||
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK |
|
||||
EVENTCHKINF_93_MASK)) {
|
||||
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
extendedMapIndex = 0x17;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -63,9 +63,7 @@ s32 func_808B1AE0(BgSpot09Obj* this, GlobalContext* globalCtx) {
|
|||
return this->dyna.actor.params == 0;
|
||||
}
|
||||
|
||||
carpentersRescued =
|
||||
CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK);
|
||||
carpentersRescued = GET_EVENTCHKINF_CARPENTERS_FREE_ALL();
|
||||
|
||||
if (LINK_AGE_IN_YEARS == YEARS_ADULT) {
|
||||
switch (this->dyna.actor.params) {
|
||||
|
@ -140,8 +138,7 @@ void BgSpot09Obj_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
BgSpot09Obj* this = (BgSpot09Obj*)thisx;
|
||||
|
||||
osSyncPrintf("Spot09 Object [arg_data : 0x%04x](大工救出フラグ 0x%x)\n", this->dyna.actor.params,
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] &
|
||||
(EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK));
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] & EVENTCHKINF_CARPENTERS_FREE_MASK_ALL);
|
||||
this->dyna.actor.params &= 0xFF;
|
||||
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",
|
||||
|
|
|
@ -152,13 +152,13 @@ void EnDaiku_Init(Actor* thisx, GlobalContext* globalCtx) {
|
|||
s32 noKill = true;
|
||||
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;
|
||||
} 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;
|
||||
} 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;
|
||||
} 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;
|
||||
}
|
||||
|
||||
|
@ -271,8 +271,8 @@ void EnDaiku_UpdateText(EnDaiku* this, GlobalContext* globalCtx) {
|
|||
if (this->stateFlags & ENDAIKU_STATEFLAG_GERUDODEFEATED) {
|
||||
freedCount = 0;
|
||||
for (carpenterType = 0; carpenterType < 4; carpenterType++) {
|
||||
if (gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] &
|
||||
(1 << (carpenterType + EVENTCHKINF_90_SHIFT))) {
|
||||
if (gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] &
|
||||
EVENTCHKINF_CARPENTERS_FREE_MASK(carpenterType)) {
|
||||
freedCount++;
|
||||
}
|
||||
}
|
||||
|
@ -400,7 +400,8 @@ void EnDaiku_InitEscape(EnDaiku* this, GlobalContext* globalCtx) {
|
|||
EnDaiku_ChangeAnim(this, ENDAIKU_ANIM_RUN, &this->currentAnimIndex);
|
||||
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->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);
|
||||
this->subCamActive = false;
|
||||
|
||||
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
Matrix_RotateY(BINANG_TO_RAD(this->initRot.y), MTXMODE_NEW);
|
||||
Matrix_MultVec3f(&D_809E4148, &vec);
|
||||
gerudoGuard =
|
||||
|
|
|
@ -209,13 +209,11 @@ void EnGe1_SetAnimationIdle(EnGe1* this) {
|
|||
}
|
||||
|
||||
s32 EnGe1_CheckCarpentersFreed(void) {
|
||||
u16 carpenterFlags = gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX];
|
||||
|
||||
if (!((carpenterFlags & EVENTCHKINF_90_MASK) && (carpenterFlags & EVENTCHKINF_91_MASK) &&
|
||||
(carpenterFlags & EVENTCHKINF_92_MASK) && (carpenterFlags & EVENTCHKINF_93_MASK))) {
|
||||
return 0;
|
||||
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)))) {
|
||||
return false;
|
||||
}
|
||||
return 1;
|
||||
return true;
|
||||
}
|
||||
|
||||
/**
|
||||
|
|
|
@ -223,10 +223,9 @@ s32 Ge2_DetectPlayerInUpdate(GlobalContext* globalCtx, EnGe2* this, Vec3f* pos,
|
|||
}
|
||||
|
||||
s32 EnGe2_CheckCarpentersFreed(void) {
|
||||
if (CHECK_FLAG_ALL(
|
||||
gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX] &
|
||||
(EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK | 0xF0),
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_CARPENTERS_FREE_INDEX] &
|
||||
(EVENTCHKINF_CARPENTERS_FREE_MASK_ALL | 0xF0),
|
||||
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)) {
|
||||
return 1;
|
||||
}
|
||||
return 0;
|
||||
|
|
|
@ -461,8 +461,7 @@ s32 EnHorse_BgCheckBridgeJumpPoint(EnHorse* this, GlobalContext* globalCtx) {
|
|||
if (this->actor.speedXZ < 12.8f) {
|
||||
return false;
|
||||
}
|
||||
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
return false;
|
||||
}
|
||||
|
||||
|
@ -3578,9 +3577,7 @@ void EnHorse_Update(Actor* thisx, GlobalContext* globalCtx2) {
|
|||
this->stateFlags &= ~ENHORSE_FLAG_24;
|
||||
}
|
||||
|
||||
if (globalCtx->sceneNum == SCENE_SPOT09 &&
|
||||
!CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (globalCtx->sceneNum == SCENE_SPOT09 && !GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
EnHorse_CheckBridgeJumps(this, globalCtx);
|
||||
}
|
||||
|
||||
|
|
|
@ -100,8 +100,7 @@ void EnMm2_ChangeAnim(EnMm2* this, s32 index, s32* currentIndex) {
|
|||
}
|
||||
|
||||
void func_80AAEF70(EnMm2* this, GlobalContext* globalCtx) {
|
||||
if (!CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (!GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
this->actor.textId = 0x6086;
|
||||
} else if (GET_INFTABLE(INFTABLE_17F)) {
|
||||
if (GET_EVENTINF(EVENTINF_10)) {
|
||||
|
|
|
@ -259,8 +259,7 @@ s32 func_80B206A0(EnToryo* this, GlobalContext* globalCtx) {
|
|||
|
||||
if (textId == 0) {
|
||||
if (this->stateFlags & 1) {
|
||||
if (CHECK_FLAG_ALL(gSaveContext.eventChkInf[EVENTCHKINF_90_91_92_93_INDEX],
|
||||
EVENTCHKINF_90_MASK | EVENTCHKINF_91_MASK | EVENTCHKINF_92_MASK | EVENTCHKINF_93_MASK)) {
|
||||
if (GET_EVENTCHKINF_CARPENTERS_FREE_ALL()) {
|
||||
ret = 0x606C;
|
||||
} else if (GET_INFTABLE(INFTABLE_170)) {
|
||||
ret = 0x606B;
|
||||
|
|
Loading…
Reference in a new issue