1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-22 23:11:20 +00:00

Defines for SaveContext flags (eventChkInf, itemGetInf, infTable, eventInf) (#1094)

* script-assisted `itemGetInf` flags

* comment near non-trivial `itemGetInf` usage

* Run formatter

* Try something with the itemgetinf flags that can't use the packed value

* Add defines for `eventChkInf` (direct access)

* Add defines for `eventChkInf` (access through `Flags_GetEventChkInf`)

* Add defines for `eventChkInf` (access through `Flags_SetEventChkInf`)

* Add defines for `infTable` (direct access)

* Add defines for `infTable` (used by `Flags_GetInfTable`)

* Add defines for `infTable` (used by `Flags_SetInfTable`)

* Add defines for `eventInf`

* parenthesis cleanup near `GET_EVENTCHKINF` usage

* parenthesis cleanup near `GET_ITEMGETINF` usage

* parenthesis cleanup near `GET_INFTABLE` usage

* fixup one `eventInf` usage

* parenthesis cleanup near `GET_EVENTINF` usage

* parenthesis cleanup near `Flags_GetEventChkInf` usage

* slight `z64save.h` formatting improvement

* Improve itemGetInf flags in z_bg_dy_yoseizo

* Questionable improvement in z_en_ge2

* Questionable improvement in z_en_daiku

* Questionable improvement in z_en_mu

* Run formatter

* Parentheses around `gSaveContext` macros arguments

* Move individual flags define to the end of z64save.h, and improve comments separating the groups
This commit is contained in:
Dragorn421 2022-04-29 20:19:48 +02:00 committed by GitHub
parent 16790bc253
commit 6336df5fcd
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
146 changed files with 1931 additions and 1315 deletions

View file

@ -762,12 +762,11 @@ void func_80AEC2C0(EnRu1* this, GlobalContext* globalCtx) {
void func_80AEC320(EnRu1* this, GlobalContext* globalCtx) {
s8 actorRoom;
if (!(gSaveContext.infTable[20] & 2)) {
if (!GET_INFTABLE(INFTABLE_141)) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
this->action = 7;
EnRu1_SetMouthIndex(this, 1);
} else if ((gSaveContext.infTable[20] & 0x80) && !(gSaveContext.infTable[20] & 1) &&
!(gSaveContext.infTable[20] & 0x20)) {
} else if (GET_INFTABLE(INFTABLE_147) && !GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145)) {
if (!func_80AEB020(this, globalCtx)) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
actorRoom = this->actor.room;
@ -921,7 +920,7 @@ void func_80AECA18(EnRu1* this) {
void func_80AECA44(EnRu1* this, GlobalContext* globalCtx) {
if (func_80AEAFA0(globalCtx, 5, 3)) {
gSaveContext.infTable[20] |= 2;
SET_INFTABLE(INFTABLE_141);
this->action = 14;
}
}
@ -1172,8 +1171,8 @@ void func_80AED414(EnRu1* this, GlobalContext* globalCtx) {
void func_80AED44C(EnRu1* this, GlobalContext* globalCtx) {
s8 actorRoom;
if ((gSaveContext.infTable[20] & 2) && !(gSaveContext.infTable[20] & 0x20) && !(gSaveContext.infTable[20] & 1) &&
!(gSaveContext.infTable[20] & 0x80)) {
if (GET_INFTABLE(INFTABLE_141) && !GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_140) &&
!GET_INFTABLE(INFTABLE_147)) {
if (!func_80AEB020(this, globalCtx)) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
actorRoom = this->actor.room;
@ -1246,10 +1245,10 @@ void func_80AED6DC(EnRu1* this, GlobalContext* globalCtx) {
void func_80AED6F8(GlobalContext* globalCtx) {
s8 curRoomNum;
if ((!(gSaveContext.infTable[20] & 0x80))) {
if (!GET_INFTABLE(INFTABLE_147)) {
curRoomNum = globalCtx->roomCtx.curRoom.num;
if (curRoomNum == 2) {
gSaveContext.infTable[20] |= 0x80;
SET_INFTABLE(INFTABLE_147);
}
}
}
@ -1497,10 +1496,10 @@ void func_80AEE050(EnRu1* this) {
s32 func_80AEE264(EnRu1* this, GlobalContext* globalCtx) {
if (!Actor_ProcessTalkRequest(&this->actor, globalCtx)) {
this->actor.flags |= ACTOR_FLAG_0 | ACTOR_FLAG_3;
if ((gSaveContext.infTable[20] & 8)) {
if (GET_INFTABLE(INFTABLE_143)) {
this->actor.textId = 0x404E;
func_8002F2F4(&this->actor, globalCtx);
} else if (gSaveContext.infTable[20] & 4) {
} else if (GET_INFTABLE(INFTABLE_142)) {
this->actor.textId = 0x404D;
func_8002F2F4(&this->actor, globalCtx);
} else {
@ -1521,12 +1520,12 @@ void func_80AEE2F8(EnRu1* this, GlobalContext* globalCtx) {
dynaPolyActor = DynaPoly_GetActor(&globalCtx->colCtx, floorBgId);
if ((dynaPolyActor != NULL) && (dynaPolyActor->actor.id == ACTOR_BG_BDAN_SWITCH)) {
if (((dynaPolyActor->actor.params >> 8) & 0x3F) == 0x38) {
gSaveContext.infTable[20] |= 1;
SET_INFTABLE(INFTABLE_140);
return;
}
}
}
gSaveContext.infTable[20] &= ~0x1;
CLEAR_INFTABLE(INFTABLE_140);
}
s32 func_80AEE394(EnRu1* this, GlobalContext* globalCtx) {
@ -1591,7 +1590,7 @@ void func_80AEE628(EnRu1* this, GlobalContext* globalCtx) {
if (EnRu1_IsCsStateIdle(globalCtx)) {
Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0,
Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, -8.0f);
gSaveContext.infTable[20] |= 0x10;
SET_INFTABLE(INFTABLE_144);
this->action = 31;
}
this->roomNum3 = curRoomNum;
@ -1601,7 +1600,7 @@ s32 func_80AEE6D0(EnRu1* this, GlobalContext* globalCtx) {
s32 pad;
s8 curRoomNum = globalCtx->roomCtx.curRoom.num;
if (!(gSaveContext.infTable[20] & 0x10) && (func_80AEB124(globalCtx) != 0)) {
if (!GET_INFTABLE(INFTABLE_144) && (func_80AEB124(globalCtx) != 0)) {
if (!Player_InCsMode(globalCtx)) {
Animation_Change(&this->skelAnime, &gRutoChildSeesSapphireAnim, 1.0f, 0,
Animation_GetLastFrame(&gRutoChildSquirmAnim), ANIMMODE_LOOP, -8.0f);
@ -1813,7 +1812,7 @@ void func_80AEF080(EnRu1* this) {
s32 func_80AEF0BC(EnRu1* this, GlobalContext* globalCtx) {
s32 frameCount;
if (gSaveContext.infTable[20] & 4) {
if (GET_INFTABLE(INFTABLE_142)) {
frameCount = Animation_GetLastFrame(&gRutoChildSitAnim);
Animation_Change(&this->skelAnime, &gRutoChildSitAnim, 1.0f, 0, frameCount, ANIMMODE_ONCE, -8.0f);
globalCtx->msgCtx.msgMode = MSGMODE_PAUSED;
@ -1833,7 +1832,7 @@ void func_80AEF170(EnRu1* this, GlobalContext* globalCtx, s32 cond) {
void func_80AEF188(EnRu1* this, GlobalContext* globalCtx) {
if (func_80AEB174(globalCtx) && !func_80AEF0BC(this, globalCtx)) {
Message_CloseTextbox(globalCtx);
gSaveContext.infTable[20] |= 4;
SET_INFTABLE(INFTABLE_142);
this->action = 24;
}
}
@ -1843,7 +1842,7 @@ void func_80AEF1F0(EnRu1* this, GlobalContext* globalCtx, UNK_TYPE arg2) {
Animation_Change(&this->skelAnime, &gRutoChildSittingAnim, 1.0f, 0.0f,
Animation_GetLastFrame(&gRutoChildSittingAnim), ANIMMODE_LOOP, 0.0f);
Message_CloseTextbox(globalCtx);
gSaveContext.infTable[20] |= 8;
SET_INFTABLE(INFTABLE_143);
func_80AED6DC(this, globalCtx);
func_8002F580(&this->actor, globalCtx);
this->action = 27;
@ -2005,7 +2004,7 @@ void func_80AEF890(EnRu1* this, GlobalContext* globalCtx) {
if ((gSaveContext.sceneSetupIndex < 4) && (EnRu1_IsCsStateIdle(globalCtx))) {
curRoomNum = globalCtx->roomCtx.curRoom.num;
gSaveContext.infTable[20] |= 0x20;
SET_INFTABLE(INFTABLE_145);
Flags_SetSwitch(globalCtx, func_80AEADE0(this));
func_80AEB0EC(this, 1);
this->action = 42;
@ -2096,7 +2095,7 @@ void func_80AEFC24(EnRu1* this, GlobalContext* globalCtx) {
}
void func_80AEFC54(EnRu1* this, GlobalContext* globalCtx) {
if ((gSaveContext.infTable[20] & 0x20) && !(gSaveContext.infTable[20] & 0x40)) {
if (GET_INFTABLE(INFTABLE_145) && !GET_INFTABLE(INFTABLE_146)) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
this->action = 41;
this->unk_28C = EnRu1_FindSwitch(globalCtx);
@ -2117,7 +2116,7 @@ void func_80AEFCE8(EnRu1* this, GlobalContext* globalCtx) {
}
void func_80AEFD38(EnRu1* this, GlobalContext* globalCtx) {
if ((gSaveContext.eventChkInf[3] & 0x80) && LINK_IS_CHILD) {
if (GET_EVENTCHKINF(EVENTCHKINF_37) && LINK_IS_CHILD) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
this->actor.flags &= ~ACTOR_FLAG_4;
this->action = 44;
@ -2180,7 +2179,7 @@ void func_80AEFF40(EnRu1* this, GlobalContext* globalCtx) {
void func_80AEFF94(EnRu1* this, GlobalContext* globalCtx) {
s8 actorRoom;
if ((gSaveContext.infTable[20] & 2) && (gSaveContext.infTable[20] & 1) && !(gSaveContext.infTable[20] & 0x20) &&
if (GET_INFTABLE(INFTABLE_141) && GET_INFTABLE(INFTABLE_140) && !GET_INFTABLE(INFTABLE_145) &&
(!(func_80AEB020(this, globalCtx)))) {
func_80AEB264(this, &gRutoChildWait2Anim, 0, 0, 0);
actorRoom = this->actor.room;