mirror of
https://github.com/zeldaret/oot3d.git
synced 2026-09-26 13:33:22 -04:00
a87ddae432
* pull known Actor functions GLOBAL_ASMs into their cpp files * attempt to pull unidentified actor functions GLOBAL_ASMs into their corresponding source files by scanning the call-graph
51 lines
2.1 KiB
C++
51 lines
2.1 KiB
C++
#ifndef _MACROS_H_
|
|
#define _MACROS_H_
|
|
|
|
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
|
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
#define SQ(x) ((x)*(x))
|
|
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
|
#define DECR(x) ((x) == 0 ? 0 : --(x))
|
|
|
|
#define LINK_IS_ADULT (gSaveContext.linkAge == 0)
|
|
#define LINK_IS_CHILD (gSaveContext.linkAge == 1)
|
|
#define YEARS_CHILD 5
|
|
#define YEARS_ADULT 17
|
|
#define LINK_AGE_IN_YEARS (!LINK_IS_ADULT ? YEARS_CHILD : YEARS_ADULT)
|
|
|
|
#define IS_DAY (gSaveContext.nightFlag == 0)
|
|
#define IS_NIGHT (gSaveContext.nightFlag == 1)
|
|
|
|
#define SLOT(item) gItemSlots[item]
|
|
#define INV_CONTENT(item) gSaveContext.inventory.items[SLOT(item)]
|
|
#define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)]
|
|
#define BEANS_BOUGHT AMMO(ITEM_BEAN + 1)
|
|
|
|
#define ALL_EQUIP_VALUE(equip) ((s32)(gSaveContext.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
|
#define CUR_EQUIP_VALUE(equip) ((s32)(gSaveContext.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
|
#define CHECK_OWNED_EQUIP(equip, value) ((gBitFlags[value] << gEquipShifts[equip]) & gSaveContext.inventory.equipment)
|
|
|
|
#define CUR_UPG_VALUE(upg) ((s32)(gSaveContext.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
|
|
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]
|
|
#define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg))
|
|
|
|
#define CHECK_QUEST_ITEM(item) (gSaveContext.inventory.questItems & gBitFlags[item])
|
|
#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.inventory.dungeonItems[dungeonIndex] & gBitFlags[item])
|
|
|
|
#define GET_GS_FLAGS(index) \
|
|
((gSaveContext.gsFlags[(index) >> 2] & gGsFlagsMask[(index) & 3]) >> gGsFlagsShift[(index) & 3])
|
|
#define SET_GS_FLAGS(index, value) \
|
|
(gSaveContext.gsFlags[(index) >> 2] |= (value) << gGsFlagsShift[(index) & 3])
|
|
|
|
#define HIGH_SCORE(score) (gSaveContext.highScores[score])
|
|
|
|
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
|
|
|
|
#define ADJUST_F32_FOR_FRAMERATE(f) ((2.0f * f) / 3.0f)
|
|
#define ADJUST_S32_FOR_FRAMERATE(s) ((3 * s) / 2)
|
|
|
|
#define ADJUST_FRAMECOUNT(x) ((s32)((f32)(3 * x) / SREG(30) + 0.5f))
|
|
|
|
#endif
|