1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-08-21 06:21:16 +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

@ -57,13 +57,17 @@ void EnMu_SetupAction(EnMu* this, EnMuActionFunc actionFunc) {
void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) {
u8 textIdOffset[] = { 0x42, 0x43, 0x3F, 0x41, 0x3E };
u8 bitmask[] = { 0x01, 0x02, 0x04, 0x08, 0x10 };
u8 bitmask[] = {
EVENTINF_20_MASK, EVENTINF_21_MASK, EVENTINF_22_MASK, EVENTINF_23_MASK, EVENTINF_24_MASK,
};
u8 textFlags;
s32 randomIndex;
s32 i;
textFlags = gSaveContext.eventInf[2] & 0x1F;
gSaveContext.eventInf[2] &= ~0x1F;
textFlags = gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] &
(EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK);
gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] &=
~(EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK);
randomIndex = (globalCtx->state.frames + (s32)(Rand_ZeroOne() * 5.0f)) % 5;
for (i = 0; i < 5; i++) {
@ -90,8 +94,8 @@ void EnMu_Interact(EnMu* this, GlobalContext* globalCtx) {
textFlags |= bitmask[randomIndex];
this->defFaceReaction = textIdOffset[randomIndex] | 0x7000;
textFlags &= 0xFF;
gSaveContext.eventInf[2] |= textFlags;
textFlags &= EVENTINF_20_MASK | EVENTINF_21_MASK | EVENTINF_22_MASK | EVENTINF_23_MASK | EVENTINF_24_MASK | 0xE0;
gSaveContext.eventInf[EVENTINF_20_21_22_23_24_INDEX] |= textFlags;
}
u16 EnMu_GetFaceReaction(GlobalContext* globalCtx, Actor* thisx) {