1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-05-10 11:03:46 +00:00

suggestions and more macros

This commit is contained in:
mzxrules 2024-12-13 22:37:59 -05:00
parent 72540732ef
commit 06e3474eb5
18 changed files with 117 additions and 85 deletions

View file

@ -462,12 +462,12 @@ typedef enum LinkAge {
/*
* SaveContext.eventChkInf
* eventChkInf is an array of 16 bit flags. These typically track main quest events.
* eventChkInf is an array of 16 bit values, where each bit is a flag. These flags typically track main quest events.
* Generally, a flag will be assigned a unique id, ranging from 0x00-0xDE. Flag state can be individually accessed
* or modified by passing the flag id into GET_EVENTCHKINF, SET_EVENTCHKINF, and CLEAR_EVENTCHKINF
*
* In some instances where a set of flags share a common accociation, the eventChkInf variable will be accessed directly.
* When this is the case, an EVENTCHKINF_*_INDEX constant is defined for accessing a specific eventChkInf variable.
* In some instances where a set of flags share a common association, the eventChkInf variable will be accessed directly.
* When this is the case, an EVENTCHKINF_INDEX_* constant is defined for accessing a specific eventChkInf variable.
*/
#define GET_EVENTCHKINF(flag) (gSaveContext.save.info.eventChkInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
@ -477,8 +477,9 @@ typedef enum LinkAge {
#define GET_EVENTCHKINF_VAR(flag) (gSaveContext.save.info.eventChkInf[(flag) >> 4])
#define GET_EVENTCHKINF_MASK(flag) (1 << ((flag) & 0xF))
#define EVENTCHKINF_00_UNUSED 0x00
#define EVENTCHKINF_01_UNUSED 0x01
// EVENTCHKINF 0x00-0x0F
#define EVENTCHKINF_00_UNUSED 0x00 // flag is set in the debug save, but has no functionality
#define EVENTCHKINF_01_UNUSED 0x01 // flag is set in the debug save, but has no functionality
#define EVENTCHKINF_02 0x02
#define EVENTCHKINF_03 0x03
#define EVENTCHKINF_04 0x04
@ -523,8 +524,7 @@ typedef enum LinkAge {
#define EVENTCHKINF_3C 0x3C
// EVENTCHKINF 0x40
#define EVENTCHKINF_40_INDEX (EVENTCHKINF_40 >> 4)
#define EVENTCHKINF_40_MASK GET_EVENTCHKINF_MASK(EVENTCHKINF_40)
#define EVENTCHKINF_INDEX_40 (EVENTCHKINF_40 >> 4)
#define EVENTCHKINF_40 0x40
#define EVENTCHKINF_41 0x41
@ -580,7 +580,7 @@ typedef enum LinkAge {
// EVENTCHKINF 0x90-0x93
// carpenters freed from the gerudo
#define EVENTCHKINF_CARPENTERS_FREED_INDEX (EVENTCHKINF_CARPENTER_0_FREED >> 4)
#define EVENTCHKINF_INDEX_CARPENTERS_FREED (EVENTCHKINF_CARPENTER_0_FREED >> 4)
#define EVENTCHKINF_CARPENTER_0_FREED 0x90
#define EVENTCHKINF_CARPENTER_1_FREED 0x91
#define EVENTCHKINF_CARPENTER_2_FREED 0x92
@ -593,25 +593,25 @@ typedef enum LinkAge {
| GET_EVENTCHKINF_MASK(EVENTCHKINF_CARPENTER_3_FREED))
#define GET_EVENTCHKINF_CARPENTERS_FREE_ALL() \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREED_INDEX], \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREED], \
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)
#define GET_EVENTCHKINF_CARPENTERS_FREE_ALL2() \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREED_INDEX] & \
CHECK_FLAG_ALL(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREED] & \
(EVENTCHKINF_CARPENTERS_FREE_MASK_ALL | 0xF0), \
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL)
#define ENDAIKU_CARPENTER_FREE_MASK(carpenterType) (1 << ((EVENTCHKINF_CARPENTER_0_FREED & 0xF) + (carpenterType)))
#define ENDAIKU_IS_CARPENTER_FREE(carpenterType) \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREED_INDEX] & \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREED] & \
ENDAIKU_CARPENTER_FREE_MASK(carpenterType)
#define ENDAIKU_SET_CARPENTER_FREE(carpenterType) \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREED_INDEX] |= \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREED] |= \
ENDAIKU_CARPENTER_FREE_MASK((carpenterType))
#define GET_EVENTCHKINF_CARPENTERS_FREE_FLAGS() \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_CARPENTERS_FREED_INDEX] & \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_CARPENTERS_FREED] & \
EVENTCHKINF_CARPENTERS_FREE_MASK_ALL
#define EVENTCHKINF_94 0x94
@ -657,7 +657,7 @@ typedef enum LinkAge {
#define EVENTCHKINF_C9 0xC9
// EVENTCHKINF 0xD0-0xD6
#define EVENTCHKINF_SONGS_FOR_FROGS_INDEX (EVENTCHKINF_SONGS_FOR_FROGS_CHOIR >> 4)
#define EVENTCHKINF_INDEX_SONGS_FOR_FROGS (EVENTCHKINF_SONGS_FOR_FROGS_CHOIR >> 4)
#define EVENTCHKINF_SONGS_FOR_FROGS_CHOIR 0xD0
#define EVENTCHKINF_SONGS_FOR_FROGS_ZL 0xD1
#define EVENTCHKINF_SONGS_FOR_FROGS_EPONA 0xD2
@ -667,7 +667,7 @@ typedef enum LinkAge {
#define EVENTCHKINF_SONGS_FOR_FROGS_STORMS 0xD6
// EVENTCHKINF 0xDA-0xDE
#define EVENTCHKINF_SKULLTULA_REWARD_INDEX (EVENTCHKINF_SKULLTULA_REWARD_10 >> 4)
#define EVENTCHKINF_INDEX_SKULLTULA_REWARD (EVENTCHKINF_SKULLTULA_REWARD_10 >> 4)
#define EVENTCHKINF_SKULLTULA_REWARD_10 0xDA
#define EVENTCHKINF_SKULLTULA_REWARD_20 0xDB
#define EVENTCHKINF_SKULLTULA_REWARD_30 0xDC
@ -683,8 +683,8 @@ typedef enum LinkAge {
* Generally, a flag will be assigned a unique id, ranging from 0x00-0x3F. Flag state can be individually accessed
* or modified by passing the flag id into GET_ITEMGETINF or SET_ITEMGETINF
*
* In some instances where a set of flags share a common accociation, the itemGetInf variable will be accessed directly.
* When this is the case, an ITEMGETINF_*_INDEX constant is defined for accessing a specific itemGetInf variable.
* In some instances where a set of flags share a common association, the itemGetInf variable will be accessed directly.
* When this is the case, an ITEMGETINF_INDEX_* constant is defined for accessing a specific itemGetInf variable.
*/
#define GET_ITEMGETINF(flag) (gSaveContext.save.info.itemGetInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
@ -715,7 +715,7 @@ typedef enum LinkAge {
#define ITEMGETINF_17 0x17
// ITEMGETINF 0x18-0x1A
#define ITEMGETINF_GREAT_FAIRY_ITEM_INDEX (ITEMGETINF_FARORES_WIND >> 4)
#define ITEMGETINF_INDEX_GREAT_FAIRY_ITEM (ITEMGETINF_FARORES_WIND >> 4)
#define ITEMGETINF_FARORES_WIND 0x18
#define ITEMGETINF_DINS_FIRE 0x19
#define ITEMGETINF_NAYRUS_LOVE 0x1A
@ -748,8 +748,8 @@ typedef enum LinkAge {
* Generally, a flag will be assigned a unique id, ranging from 0x00-0x1D0. Flag state can be individually accessed
* or modified by passing the flag id into GET_INFTABLE, SET_INFTABLE, or CLEAR_INFTABLE
*
* In some instances where a set of flags share a common accociation, the infTable variable will be accessed directly.
* When this is the case, an INFTABLE_*_INDEX constant is defined for accessing a specific infTable variable.
* In some instances where a set of flags share a common association, the infTable variable will be accessed directly.
* When this is the case, an INFTABLE_INDEX_* constant is defined for accessing a specific infTable variable.
*/
#define GET_INFTABLE(flag) (gSaveContext.save.info.infTable[(flag) >> 4] & (1 << ((flag) & 0xF)))
@ -886,7 +886,7 @@ typedef enum LinkAge {
#define INFTABLE_198 0x198
// INFTABLE 0x199-0x19F
#define INFTABLE_KAKARIKO_CUCCO_INDEX (INFTABLE_199 >> 4)
#define INFTABLE_INDEX_KAKARIKO_CUCCO (INFTABLE_199 >> 4)
#define INFTABLE_199 0x199
#define INFTABLE_19A 0x19A
#define INFTABLE_19B 0x19B
@ -896,14 +896,14 @@ typedef enum LinkAge {
#define INFTABLE_19F 0x19F
#define INFTABLE_RESET_KAKARIKO_CUCCOS() \
gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX] &= \
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] &= \
(u16) ~(GET_INFTABLE_MASK(INFTABLE_199) | GET_INFTABLE_MASK(INFTABLE_19A) | GET_INFTABLE_MASK(INFTABLE_19B) | \
GET_INFTABLE_MASK(INFTABLE_19C) | GET_INFTABLE_MASK(INFTABLE_19D) | GET_INFTABLE_MASK(INFTABLE_19E) | \
GET_INFTABLE_MASK(INFTABLE_19F));
// INFTABLE 0x1A0-0x1AF
#define INFTABLE_OVERWORLD_ENTRANCE_ICON_INDEX (INFTABLE_1A0 >> 4)
#define INFTABLE_INDEX_OVERWORLD_ENTRANCE_ICON (INFTABLE_1A0 >> 4)
#define INFTABLE_1A0 0x1A0
#define INFTABLE_1A1 0x1A1
#define INFTABLE_1A2 0x1A2
@ -913,7 +913,7 @@ typedef enum LinkAge {
#define INFTABLE_1A6 0x1A6
#define INFTABLE_1A7 0x1A7
#define INFTABLE_1A8 0x1A8
#define INFTABLE_1A9 0x1A9 // different
#define INFTABLE_1A9 0x1A9
#define INFTABLE_1AB 0x1AB
#define INFTABLE_1AD 0x1AD
@ -921,10 +921,19 @@ typedef enum LinkAge {
#define MINIMAP_GET_INFTABLE(flag) \
gSaveContext.save.info.infTable[(flag) >> 4] & gBitFlags[((flag) & 0xF)]
#define MINIMAP_GET_INFTABLE_SHIFT(flag) ((flag) - INFTABLE_1A0)
#define MINIMAP_GET_INFTABLE_FROM_OW_ENTRANCE_FLAG(shift) \
(gSaveContext.save.info.infTable[INFTABLE_INDEX_OVERWORLD_ENTRANCE_ICON] & \
gBitFlags[(shift)])
#define MINIMAP_SET_INFTABLE_FROM_OW_ENTRANCE_FLAG(shift) \
(gSaveContext.save.info.infTable[INFTABLE_INDEX_OVERWORLD_ENTRANCE_ICON] |= \
gBitFlags[(shift)])
#define MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(flag) ((flag) - INFTABLE_1A0)
// 0x1D0-0x1DF
#define INFTABLE_1DX_INDEX (0x1D0 >> 4)
#define INFTABLE_INDEX_1DX (0x1D0 >> 4)
#define INFTABLE_1D0 0x1D0
/*
@ -934,19 +943,26 @@ typedef enum LinkAge {
* Generally, a flag will be assigned a unique id, ranging from 0x00-0x30. Flag state can be individually accessed
* or modified by passing the flag id into GET_EVENTINF, SET_EVENTINF, or CLEAR_EVENTINF
*
* In some instances where a set of flags share a common accociation, the eventInf variable will be accessed directly.
* When this is the case, an EVENTINF_*_INDEX constant is defined for accessing a specific eventInf variable.
* In some instances where a set of flags share a common association, the eventInf variable will be accessed directly.
* When this is the case, an EVENTINF_INDEX_* constant is defined for accessing a specific eventInf variable.
*/
#define GET_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
#define SET_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] |= (1 << ((flag) & 0xF)))
#define CLEAR_EVENTINF(flag) (gSaveContext.eventInf[(flag) >> 4] &= ~(1 << ((flag) & 0xF)))
#define RESET_EVENTINF() \
gSaveContext.eventInf[0] = 0; \
gSaveContext.eventInf[1] = 0; \
gSaveContext.eventInf[2] = 0; \
gSaveContext.eventInf[3] = 0;
#define RESET_EVENTINF2() \
gSaveContext.eventInf[0] = gSaveContext.eventInf[1] = gSaveContext.eventInf[2] = gSaveContext.eventInf[3] = 0;
#define GET_EVENTINF_MASK(flag) (1 << ((flag) & 0xF))
// EVENTINF 0x00-0x0F
// Ingo Race, Lon Lon Ranch minigames, and Horseback Archery minigame flags
#define EVENTINF_INGORACE_INDEX (0x00 >> 4)
#define EVENTINF_INDEX_INGORACE (0x00 >> 4)
// EVENTINF 0x00-0x03 reserved for IngoRaceState
#define EVENTINF_INGORACE_STATE_MASK \
(GET_EVENTINF_MASK(0x00) | GET_EVENTINF_MASK(0x01) | GET_EVENTINF_MASK(0x02) | GET_EVENTINF_MASK(0x03))
@ -975,26 +991,29 @@ typedef enum IngoRaceState {
#define EVENTINF_INGORACE_0F 0x0F // unused?
// "InRaceSeq"
#define GET_EVENTINF_INGORACE_STATE() (gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] & EVENTINF_INGORACE_STATE_MASK)
#define GET_EVENTINF_INGORACE_STATE() (gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] & EVENTINF_INGORACE_STATE_MASK)
#define SET_EVENTINF_INGORACE_STATE(v) \
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] = \
(gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] & ~EVENTINF_INGORACE_STATE_MASK) | (v)
gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] = \
(gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] & ~EVENTINF_INGORACE_STATE_MASK) | (v)
#define SET_EVENTINF_INGORACE_FLAG(flag) \
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] = \
(gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] & 0xFFFF) | (1 << ((flag) & 0xF))
gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] = \
(gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] & 0xFFFF) | (1 << ((flag) & 0xF))
#define WRITE_EVENTINF_INGORACE_FLAG(flag, v) \
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] = \
(gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] & ~(1 << ((flag)&0xF))) | ((v) << ((flag) & 0xF))
gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] = \
(gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] & ~(1 << ((flag)&0xF))) | ((v) << ((flag) & 0xF))
#define RESET_EVENTINF_INGORACE() \
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] &= \
gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] &= \
(u16) ~(EVENTINF_INGORACE_STATE_MASK | GET_EVENTINF_MASK(EVENTINF_INGORACE_HORSETYPE) | \
GET_EVENTINF_MASK(EVENTINF_INGORACE_LOST_ONCE) | GET_EVENTINF_MASK(EVENTINF_INGORACE_SECOND_RACE) | \
GET_EVENTINF_MASK(EVENTINF_INGORACE_0F))
#define RESET_EVENTINF_INGORACE2() \
gSaveContext.eventInf[EVENTINF_INDEX_INGORACE] = 0;
#define GET_EVENTINF_INGORACE_HORSETYPE() \
(GET_EVENTINF(EVENTINF_INGORACE_HORSETYPE) >> (EVENTINF_INGORACE_HORSETYPE & 0xF))
#define WRITE_EVENTINF_INGORACE_HORSETYPE(v) WRITE_EVENTINF_INGORACE_FLAG(EVENTINF_INGORACE_HORSETYPE, v)
@ -1005,7 +1024,7 @@ typedef enum IngoRaceState {
#define EVENTINF_MARATHON_ACTIVE 0x10
// EVENTINF 0x20-0x24
#define EVENTINF_HAGGLING_TOWNSFOLK_INDEX (EVENTINF_20 >> 4)
#define EVENTINF_INDEX_HAGGLING_TOWNSFOLK (EVENTINF_20 >> 4)
#define EVENTINF_20 0x20
#define EVENTINF_21 0x21
#define EVENTINF_22 0x22
@ -1017,10 +1036,10 @@ typedef enum IngoRaceState {
GET_EVENTINF_MASK(EVENTINF_23) | GET_EVENTINF_MASK(EVENTINF_24))
#define ENMU_GET_TALK_FLAGS() \
gSaveContext.eventInf[EVENTINF_HAGGLING_TOWNSFOLK_INDEX] & EVENTINF_HAGGLING_TOWNSFOLK_MASK
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] & EVENTINF_HAGGLING_TOWNSFOLK_MASK
#define ENMU_RESET_TALK_FLAGS() \
gSaveContext.eventInf[EVENTINF_HAGGLING_TOWNSFOLK_INDEX] &= ~(EVENTINF_HAGGLING_TOWNSFOLK_MASK);
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] &= ~(EVENTINF_HAGGLING_TOWNSFOLK_MASK);
#define EVENTINF_30 0x30

View file

@ -299,7 +299,7 @@ u8 Inventory_DeleteEquipment(PlayState* play, s16 equipment) {
if (equipment == EQUIP_TYPE_SWORD) {
gSaveContext.save.info.equips.buttonItems[0] = ITEM_NONE;
gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] = 1;
gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] = 1;
}
Player_SetEquipmentData(play, player);

View file

@ -71,10 +71,7 @@ void GameOver_Update(PlayState* play) {
gSaveContext.save.info.playerData.naviTimer = 0;
gSaveContext.seqId = (u8)NA_BGM_DISABLED;
gSaveContext.natureAmbienceId = NATURE_ID_DISABLED;
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;
gSaveContext.eventInf[3] = 0;
RESET_EVENTINF();
gSaveContext.buttonStatus[0] = gSaveContext.buttonStatus[1] = gSaveContext.buttonStatus[2] =
gSaveContext.buttonStatus[3] = gSaveContext.buttonStatus[4] = BTN_ENABLED;
gSaveContext.forceRisingButtonAlphas = gSaveContext.nextHudVisibilityMode = gSaveContext.hudVisibilityMode =

View file

@ -240,25 +240,25 @@ static s16 sOwEntranceIconPosY[24] = {
static u16 sOwEntranceFlag[20] = {
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A8),
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A7),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A8),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A7),
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A0),
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A3),
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A5),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A0),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A3),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A5),
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A2),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A2),
0xFFFF,
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A6),
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1AB),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A6),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1AB),
0xFFFF,
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A1),
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1A4),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A1),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1A4),
0xFFFF,
0xFFFF,
MINIMAP_GET_INFTABLE_SHIFT(INFTABLE_1AD),
MINIMAP_INFTABLE_TO_OW_ENTRANCE_FLAG(INFTABLE_1AD),
};
static f32 sFloorCoordY[10][8] = {

View file

@ -496,8 +496,7 @@ void Minimap_Draw(PlayState* play) {
(LINK_AGE_IN_YEARS != YEARS_ADULT)) {
if ((gMapData->owEntranceFlag[sEntranceIconMapIndex] == 0xFFFF) ||
((gMapData->owEntranceFlag[sEntranceIconMapIndex] != 0xFFFF) &&
(gSaveContext.save.info.infTable[INFTABLE_OVERWORLD_ENTRANCE_ICON_INDEX] &
gBitFlags[gMapData->owEntranceFlag[mapIndex]]))) {
MINIMAP_GET_INFTABLE_FROM_OW_ENTRANCE_FLAG(gMapData->owEntranceFlag[mapIndex]))) {
gDPLoadTextureBlock(OVERLAY_DISP++, gMapDungeonEntranceIconTex, G_IM_FMT_RGBA, G_IM_SIZ_16b,
8, 8, 0, G_TX_NOMIRROR | G_TX_WRAP, G_TX_NOMIRROR | G_TX_WRAP,

View file

@ -2518,7 +2518,7 @@ void Message_OpenText(PlayState* play, u16 textId) {
PRINTF(VT_FGCOL(YELLOW));
PRINTF(" z_message.c \n");
PRINTF(VT_RST);
gSaveContext.eventInf[0] = gSaveContext.eventInf[1] = gSaveContext.eventInf[2] = gSaveContext.eventInf[3] = 0;
RESET_EVENTINF2();
}
if (sTextIsCredits) {

View file

@ -851,7 +851,7 @@ void func_80083108(PlayState* play) {
(gSaveContext.save.info.equips.buttonItems[0] == ITEM_BOMBCHU) ||
(gSaveContext.save.info.equips.buttonItems[0] == ITEM_NONE)) {
if ((gSaveContext.save.info.equips.buttonItems[0] != ITEM_NONE) ||
(gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] == 0)) {
(gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] == 0)) {
gSaveContext.save.info.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
sp28 = true;
@ -875,7 +875,7 @@ void func_80083108(PlayState* play) {
(gSaveContext.save.info.equips.buttonItems[0] == ITEM_BOMBCHU) ||
(gSaveContext.save.info.equips.buttonItems[0] == ITEM_NONE)) {
if ((gSaveContext.save.info.equips.buttonItems[0] != ITEM_NONE) ||
(gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] == 0)) {
(gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] == 0)) {
gSaveContext.save.info.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
sp28 = true;
@ -1345,7 +1345,7 @@ void func_80084BF4(PlayState* play, u16 flag) {
}
} else if (gSaveContext.save.info.equips.buttonItems[0] == ITEM_NONE) {
if ((gSaveContext.save.info.equips.buttonItems[0] != ITEM_NONE) ||
(gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] == 0)) {
(gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] == 0)) {
gSaveContext.save.info.equips.buttonItems[0] = gSaveContext.buttonStatus[0];
Interface_LoadItemIcon1(play, 0);
}
@ -3544,7 +3544,7 @@ void Interface_Draw(PlayState* play) {
if (INV_CONTENT(ITEM_TRADE_ADULT) == gSpoilingItems[svar1]) {
#if OOT_VERSION >= NTSC_1_1
RESET_EVENTINF_INGORACE();
PRINTF("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_INGORACE_INDEX]);
PRINTF("EVENT_INF=%x\n", gSaveContext.eventInf[EVENTINF_INDEX_INGORACE]);
#endif
play->nextEntranceIndex = spoilingItemEntrances[svar1];
INV_CONTENT(gSpoilingItemReverts[svar1]) = gSpoilingItemReverts[svar1];

View file

@ -162,7 +162,7 @@ void Sram_InitNewSave(void) {
gSaveContext.save.info.horseData.pos.z = 5497;
gSaveContext.save.info.horseData.angle = -0x6AD9;
gSaveContext.save.info.playerData.magicLevel = 0;
gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] = 1;
gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] = 1;
gSaveContext.save.info.sceneFlags[SCENE_WATER_TEMPLE].swch = 0x40000000;
}
@ -505,8 +505,8 @@ void Sram_OpenSave(SramContext* sramCtx) {
// if zelda cutscene has been watched but lullaby was not obtained, restore cutscene and take away letter
if (GET_EVENTCHKINF(EVENTCHKINF_40) && !CHECK_QUEST_ITEM(QUEST_SONG_LULLABY)) {
i = gSaveContext.save.info.eventChkInf[EVENTCHKINF_40_INDEX] & ~EVENTCHKINF_40_MASK;
gSaveContext.save.info.eventChkInf[EVENTCHKINF_40_INDEX] = i;
i = gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_40] & ~GET_EVENTCHKINF_MASK(EVENTCHKINF_40);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_40] = i;
INV_CONTENT(ITEM_ZELDAS_LETTER) = ITEM_CHICKEN;

View file

@ -696,8 +696,12 @@ static s16 sDemoEffectLightColors[] = { DEMO_EFFECT_LIGHT_GREEN, DEMO_EFFECT_LIG
static s16 sExItemTypes[] = { EXITEM_MAGIC_WIND, EXITEM_MAGIC_FIRE, EXITEM_MAGIC_DARK };
static s16 sItemGetFlags[] = { GET_ITEMGETINF_MASK(ITEMGETINF_FARORES_WIND), GET_ITEMGETINF_MASK(ITEMGETINF_DINS_FIRE),
GET_ITEMGETINF_MASK(ITEMGETINF_NAYRUS_LOVE) };
#define GREAT_FAIRY_SET_MAGIC_SPELL_OBTAINED(exItemIndex) \
gSaveContext.save.info.itemGetInf[ITEMGETINF_INDEX_GREAT_FAIRY_ITEM] |= sItemGetFlagMasks[exItemIndex];
static s16 sItemGetFlagMasks[] = { GET_ITEMGETINF_MASK(ITEMGETINF_FARORES_WIND),
GET_ITEMGETINF_MASK(ITEMGETINF_DINS_FIRE),
GET_ITEMGETINF_MASK(ITEMGETINF_NAYRUS_LOVE) };
static u8 sItemIds[] = { ITEM_FARORES_WIND, ITEM_DINS_FIRE, ITEM_NAYRUS_LOVE };
@ -809,7 +813,7 @@ void BgDyYoseizo_Give_Reward(BgDyYoseizo* this, PlayState* play) {
this->itemSpawned = true;
gSaveContext.healthAccumulator = 0x140;
Interface_ChangeHudVisibilityMode(HUD_VISIBILITY_HEARTS_MAGIC);
gSaveContext.save.info.itemGetInf[ITEMGETINF_GREAT_FAIRY_ITEM_INDEX] |= sItemGetFlags[cueIdTemp];
GREAT_FAIRY_SET_MAGIC_SPELL_OBTAINED(cueIdTemp);
Item_Give(play, sItemIds[cueIdTemp]);
}
} else {

View file

@ -106,11 +106,11 @@ static EnFrPointers sEnFrPointers = {
};
#define FROG_HAS_SONG_BEEN_PLAYED(frogSongIndex) \
(gSaveContext.save.info.eventChkInf[EVENTCHKINF_SONGS_FOR_FROGS_INDEX] & \
(gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SONGS_FOR_FROGS] & \
sFrogSongIndexToEventChkInfSongsForFrogsMask[frogSongIndex])
#define FROG_SET_SONG_PLAYED(frogSongIndex) \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_SONGS_FOR_FROGS_INDEX] |= \
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SONGS_FOR_FROGS] |= \
sFrogSongIndexToEventChkInfSongsForFrogsMask[frogSongIndex];
static u16 sFrogSongIndexToEventChkInfSongsForFrogsMask[] = {

View file

@ -489,7 +489,7 @@ void EnIn_Init(Actor* thisx, PlayState* play) {
respawnPos = respawn->pos;
// hardcoded coords for lon lon entrance
if (D_80A7B998 == 0 && respawnPos.x == 1107.0f && respawnPos.y == 0.0f && respawnPos.z == -3740.0f) {
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] = 0;
RESET_EVENTINF_INGORACE2();
D_80A7B998 = 1;
}
this->actionFunc = EnIn_WaitForObject;
@ -575,7 +575,7 @@ void EnIn_WaitForObject(EnIn* this, PlayState* play) {
case INGORACE_STATE_RACING:
EnIn_ChangeAnim(this, ENIN_ANIM_2);
this->actionFunc = func_80A7A4C8;
gSaveContext.eventInf[EVENTINF_INGORACE_INDEX] = 0;
RESET_EVENTINF_INGORACE2();
break;
case INGORACE_STATE_HORSE_RENTAL_PERIOD:
this->actor.attentionRangeType = ATTENTION_RANGE_3;

View file

@ -94,7 +94,7 @@ void EnMu_Interact(EnMu* this, PlayState* play) {
textFlags |= bitmask[randomIndex];
this->defaultTextId = textIdOffset[randomIndex] | 0x7000;
textFlags &= EVENTINF_HAGGLING_TOWNSFOLK_MASK | 0xE0;
gSaveContext.eventInf[EVENTINF_HAGGLING_TOWNSFOLK_INDEX] |= textFlags;
gSaveContext.eventInf[EVENTINF_INDEX_HAGGLING_TOWNSFOLK] |= textFlags;
}
u16 EnMu_GetTextId(PlayState* play, Actor* thisx) {

View file

@ -65,7 +65,10 @@ static Vec3f sKakarikoPosList[] = {
{ -60.0f, 0.0f, -46.0f }, { -247.0f, 80.0f, 854.0f }, { 1079.0f, 80.0f, -47.0f },
};
static s16 sKakarikoFlagList[] = {
#define KAKARIKO_CUCCO_HAS_BEEN_RETURNED(cuccoIndex) \
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] & sKakarikoFlagMaskList[(cuccoIndex)]
static s16 sKakarikoFlagMaskList[] = {
GET_INFTABLE_MASK(INFTABLE_199), GET_INFTABLE_MASK(INFTABLE_19A), GET_INFTABLE_MASK(INFTABLE_19B),
GET_INFTABLE_MASK(INFTABLE_19C), GET_INFTABLE_MASK(INFTABLE_19D), GET_INFTABLE_MASK(INFTABLE_19E),
GET_INFTABLE_MASK(INFTABLE_19F),
@ -163,7 +166,7 @@ void EnNiw_Init(Actor* thisx, PlayState* play) {
fabsf(this->actor.world.pos.z - sKakarikoPosList[i].z) < 40.0f) {
this->unk_2AA = i;
PRINTF(VT_FGCOL(YELLOW) " 通常鶏index %d\n" VT_RST, this->unk_2AA);
if (gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX] & sKakarikoFlagList[i]) {
if (KAKARIKO_CUCCO_HAS_BEEN_RETURNED(i)) {
this->actor.world.pos.x = 300.0f;
this->actor.world.pos.y = 100.0f;
this->actor.world.pos.z = 1530.0f;

View file

@ -42,6 +42,15 @@ static s16 sMissingCuccoTextIds[] = {
0x5036, 0x5070, 0x5072, 0x5037, 0x5038, 0x5039, 0x503A, 0x503B, 0x503D, 0x503C,
};
#define KAKARIKO_CUCCO_SET_RETURNED(cuccoIndex) \
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] |= D_80ABB3B4[(cuccoIndex)]
#define KAKARIKO_CUCCO_RESET_RETURNED(cuccoIndex) \
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] &= ~D_80ABB3B4[(cuccoIndex)]
#define KAKARIKO_CUCCO_HAS_BEEN_RETURNED(cuccoIndex) \
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO] & D_80ABB3B4[(cuccoIndex)]
static s16 D_80ABB3B4[] = {
GET_INFTABLE_MASK(INFTABLE_199), GET_INFTABLE_MASK(INFTABLE_19A), GET_INFTABLE_MASK(INFTABLE_19B),
GET_INFTABLE_MASK(INFTABLE_19C), GET_INFTABLE_MASK(INFTABLE_19D), GET_INFTABLE_MASK(INFTABLE_19E),
@ -211,7 +220,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) {
if ((fabsf(currentCucco->actor.world.pos.x - 330.0f) < 90.0f) &&
(fabsf(currentCucco->actor.world.pos.z - 1610.0f) < 190.0f)) {
if (this->unk_26C == 0) {
gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX] |= D_80ABB3B4[currentCucco->unk_2AA];
KAKARIKO_CUCCO_SET_RETURNED(currentCucco->unk_2AA);
if (BREG(1) != 0) {
// "GET inside the chicken fence!"
PRINTF(VT_FGCOL(GREEN) "☆ 鶏柵内GET!☆ %x\n" VT_RST, D_80ABB3B4[currentCucco->unk_2AA]);
@ -219,7 +228,7 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) {
}
this->cuccosInPen++;
} else if (this->unk_26C == 0) {
gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX] &= ~D_80ABB3B4[currentCucco->unk_2AA];
KAKARIKO_CUCCO_RESET_RETURNED(currentCucco->unk_2AA);
}
}
currentCucco = (EnNiw*)currentCucco->actor.next;
@ -275,10 +284,10 @@ void func_80ABA244(EnNiwLady* this, PlayState* play) {
this->unk_262 = TEXT_STATE_EVENT;
this->unk_26A = this->cuccosInPen;
PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 柵内BIT変更前 ☆☆ %x\n" VT_RST,
gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX]);
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO]);
INFTABLE_RESET_KAKARIKO_CUCCOS();
PRINTF(VT_FGCOL(CYAN) "☆☆☆☆☆ 柵内BIT変更後 ☆☆ %x\n" VT_RST,
gSaveContext.save.info.infTable[INFTABLE_KAKARIKO_CUCCO_INDEX]);
gSaveContext.save.info.infTable[INFTABLE_INDEX_KAKARIKO_CUCCO]);
PRINTF("\n\n");
this->actionFunc = func_80ABA654;
return;

View file

@ -159,9 +159,9 @@ void EnSth_SetupAfterObjectLoaded(EnSth* this, PlayState* play) {
16);
Animation_PlayLoop(&this->skelAnime, sAnimations[this->actor.params]);
this->eventFlag = sEventFlags[this->actor.params];
params = &this->actor.params;
if (gSaveContext.save.info.eventChkInf[EVENTCHKINF_SKULLTULA_REWARD_INDEX] & this->eventFlag) {
this->eventFlag = sEventFlags[*params];
if (gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SKULLTULA_REWARD] & this->eventFlag) {
EnSth_SetupAction(this, sRewardObtainedWaitActions[*params]);
} else {
EnSth_SetupAction(this, EnSth_RewardUnobtainedWait);
@ -261,7 +261,7 @@ void EnSth_GiveReward(EnSth* this, PlayState* play) {
if (Actor_HasParent(&this->actor, play)) {
this->actor.parent = NULL;
EnSth_SetupAction(this, EnSth_RewardObtainedTalk);
gSaveContext.save.info.eventChkInf[EVENTCHKINF_SKULLTULA_REWARD_INDEX] |= this->eventFlag;
gSaveContext.save.info.eventChkInf[EVENTCHKINF_INDEX_SKULLTULA_REWARD] |= this->eventFlag;
} else {
EnSth_GivePlayerItem(this, play);
}

View file

@ -10753,7 +10753,7 @@ void Player_Init(Actor* thisx, PlayState* play2) {
gSaveContext.respawn[RESPAWN_MODE_DOWN].data = 1;
if (play->sceneId <= SCENE_INSIDE_GANONS_CASTLE_COLLAPSE) {
gSaveContext.save.info.infTable[INFTABLE_OVERWORLD_ENTRANCE_ICON_INDEX] |= gBitFlags[play->sceneId];
MINIMAP_SET_INFTABLE_FROM_OW_ENTRANCE_FLAG(play->sceneId);
}
startMode = PLAYER_GET_START_MODE(thisx);

View file

@ -1878,6 +1878,7 @@ void FileSelect_LoadGame(GameState* thisx) {
gSaveContext.dogParams = 0;
gSaveContext.timerState = TIMER_STATE_OFF;
gSaveContext.subTimerState = SUBTIMER_STATE_OFF;
// RESET_EVENTINF()
gSaveContext.eventInf[0] = 0;
gSaveContext.eventInf[1] = 0;
gSaveContext.eventInf[2] = 0;

View file

@ -466,7 +466,7 @@ void KaleidoScope_DrawEquipment(PlayState* play) {
Inventory_ChangeEquipment(pauseCtx->cursorY[PAUSE_EQUIP], pauseCtx->cursorX[PAUSE_EQUIP]);
if (pauseCtx->cursorY[PAUSE_EQUIP] == 0) {
gSaveContext.save.info.infTable[INFTABLE_1DX_INDEX] = 0;
gSaveContext.save.info.infTable[INFTABLE_INDEX_1DX] = 0;
gSaveContext.save.info.equips.buttonItems[0] = cursorItem;
if ((pauseCtx->cursorX[PAUSE_EQUIP] == 3) && (gSaveContext.save.info.playerData.bgsFlag != 0)) {