2021-09-15 23:24:19 +00:00
|
|
|
#ifndef MACROS_H
|
|
|
|
#define MACROS_H
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-06-03 16:51:23 +00:00
|
|
|
#ifndef AVOID_UB
|
|
|
|
#define BAD_RETURN(type) type
|
|
|
|
#else
|
|
|
|
#define BAD_RETURN(type) void
|
|
|
|
#endif
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
#define ARRAY_COUNT(arr) (s32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
#define ARRAY_COUNTU(arr) (u32)(sizeof(arr) / sizeof(arr[0]))
|
|
|
|
|
2022-10-02 15:38:09 +00:00
|
|
|
#define PHYSICAL_TO_VIRTUAL(addr) (void*)((uintptr_t)(addr) + 0x80000000)
|
|
|
|
#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000)
|
2020-09-01 01:06:44 +00:00
|
|
|
#define SEGMENTED_TO_VIRTUAL(addr) PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)] + SEGMENT_OFFSET(addr))
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
#define SQ(x) ((x)*(x))
|
|
|
|
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
2021-01-19 19:27:57 +00:00
|
|
|
#define DECR(x) ((x) == 0 ? 0 : --(x))
|
2020-04-16 21:36:12 +00:00
|
|
|
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
|
2020-04-30 18:41:09 +00:00
|
|
|
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
|
|
|
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
|
2020-04-16 21:36:12 +00:00
|
|
|
|
2024-02-02 18:29:58 +00:00
|
|
|
#define SWAP(type, a, b) \
|
|
|
|
{ \
|
|
|
|
type _temp = (a); \
|
|
|
|
(a) = (b); \
|
|
|
|
(b) = _temp; \
|
|
|
|
} \
|
|
|
|
(void)0
|
|
|
|
|
2021-11-30 23:40:42 +00:00
|
|
|
#define RGBA8(r, g, b, a) ((((r) & 0xFF) << 24) | (((g) & 0xFF) << 16) | (((b) & 0xFF) << 8) | (((a) & 0xFF) << 0))
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
#define GET_PLAYER(play) ((Player*)(play)->actorCtx.actorLists[ACTORCAT_PLAYER].head)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2022-05-21 18:23:43 +00:00
|
|
|
#define GET_ACTIVE_CAM(play) ((play)->cameraPtrs[(play)->activeCamId])
|
2020-05-09 20:58:02 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define LINK_IS_ADULT (gSaveContext.save.linkAge == LINK_AGE_ADULT)
|
|
|
|
#define LINK_IS_CHILD (gSaveContext.save.linkAge == LINK_AGE_CHILD)
|
2021-08-21 23:12:57 +00:00
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
#define YEARS_CHILD 5
|
|
|
|
#define YEARS_ADULT 17
|
2021-08-21 23:12:57 +00:00
|
|
|
#define LINK_AGE_IN_YEARS (!LINK_IS_ADULT ? YEARS_CHILD : YEARS_ADULT)
|
|
|
|
|
2022-05-20 18:40:13 +00:00
|
|
|
#define CLOCK_TIME(hr, min) ((s32)(((hr) * 60 + (min)) * (f32)0x10000 / (24 * 60) + 0.5f))
|
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define IS_DAY (gSaveContext.save.nightFlag == 0)
|
|
|
|
#define IS_NIGHT (gSaveContext.save.nightFlag == 1)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
|
|
|
#define SLOT(item) gItemSlots[item]
|
2023-08-13 19:24:26 +00:00
|
|
|
#define INV_CONTENT(item) gSaveContext.save.info.inventory.items[SLOT(item)]
|
|
|
|
#define AMMO(item) gSaveContext.save.info.inventory.ammo[SLOT(item)]
|
2022-11-16 18:23:27 +00:00
|
|
|
#define BEANS_BOUGHT AMMO(ITEM_MAGIC_BEAN + 1)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define ALL_EQUIP_VALUE(equip) ((s32)(gSaveContext.save.info.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
|
|
|
#define CUR_EQUIP_VALUE(equip) ((s32)(gSaveContext.save.info.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
2022-04-30 16:18:56 +00:00
|
|
|
#define OWNED_EQUIP_FLAG(equip, value) (gBitFlags[value] << gEquipShifts[equip])
|
|
|
|
#define OWNED_EQUIP_FLAG_ALT(equip, value) ((1 << (value)) << gEquipShifts[equip])
|
2023-08-13 19:24:26 +00:00
|
|
|
#define CHECK_OWNED_EQUIP(equip, value) (OWNED_EQUIP_FLAG(equip, value) & gSaveContext.save.info.inventory.equipment)
|
|
|
|
#define CHECK_OWNED_EQUIP_ALT(equip, value) (gBitFlags[(value) + (equip) * 4] & gSaveContext.save.info.inventory.equipment)
|
2022-04-30 16:18:56 +00:00
|
|
|
|
|
|
|
#define SWORD_EQUIP_TO_PLAYER(swordEquip) (swordEquip)
|
|
|
|
#define SHIELD_EQUIP_TO_PLAYER(shieldEquip) (shieldEquip)
|
|
|
|
#define TUNIC_EQUIP_TO_PLAYER(tunicEquip) ((tunicEquip) - 1)
|
|
|
|
#define BOOTS_EQUIP_TO_PLAYER(bootsEquip) ((bootsEquip) - 1)
|
2020-03-17 04:31:30 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define CUR_UPG_VALUE(upg) ((s32)(gSaveContext.save.info.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
|
2020-03-17 04:31:30 +00:00
|
|
|
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]
|
|
|
|
#define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg))
|
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define CHECK_QUEST_ITEM(item) (gBitFlags[item] & gSaveContext.save.info.inventory.questItems)
|
|
|
|
#define CHECK_DUNGEON_ITEM(item, dungeonIndex) (gSaveContext.save.info.inventory.dungeonItems[dungeonIndex] & gBitFlags[item])
|
2020-04-16 21:36:12 +00:00
|
|
|
|
2021-05-02 23:15:16 +00:00
|
|
|
#define GET_GS_FLAGS(index) \
|
2023-08-13 19:24:26 +00:00
|
|
|
((gSaveContext.save.info.gsFlags[(index) >> 2] & gGsFlagsMasks[(index) & 3]) >> gGsFlagsShifts[(index) & 3])
|
2021-05-02 23:15:16 +00:00
|
|
|
#define SET_GS_FLAGS(index, value) \
|
2023-08-13 19:24:26 +00:00
|
|
|
(gSaveContext.save.info.gsFlags[(index) >> 2] |= (value) << gGsFlagsShifts[(index) & 3])
|
2021-05-02 23:15:16 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define HIGH_SCORE(score) (gSaveContext.save.info.highScores[score])
|
2021-01-05 19:57:18 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define GET_EVENTCHKINF(flag) (gSaveContext.save.info.eventChkInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
|
|
|
|
#define SET_EVENTCHKINF(flag) (gSaveContext.save.info.eventChkInf[(flag) >> 4] |= (1 << ((flag) & 0xF)))
|
|
|
|
#define CLEAR_EVENTCHKINF(flag) (gSaveContext.save.info.eventChkInf[(flag) >> 4] &= ~(1 << ((flag) & 0xF)))
|
2022-04-29 18:19:48 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define GET_ITEMGETINF(flag) (gSaveContext.save.info.itemGetInf[(flag) >> 4] & (1 << ((flag) & 0xF)))
|
|
|
|
#define SET_ITEMGETINF(flag) (gSaveContext.save.info.itemGetInf[(flag) >> 4] |= (1 << ((flag) & 0xF)))
|
2022-04-29 18:19:48 +00:00
|
|
|
|
2023-08-13 19:24:26 +00:00
|
|
|
#define GET_INFTABLE(flag) (gSaveContext.save.info.infTable[(flag) >> 4] & (1 << ((flag) & 0xF)))
|
|
|
|
#define SET_INFTABLE(flag) (gSaveContext.save.info.infTable[(flag) >> 4] |= (1 << ((flag) & 0xF)))
|
|
|
|
#define CLEAR_INFTABLE(flag) (gSaveContext.save.info.infTable[(flag) >> 4] &= ~(1 << ((flag) & 0xF)))
|
2022-04-29 18:19:48 +00:00
|
|
|
|
|
|
|
#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)))
|
|
|
|
|
2022-11-16 18:23:27 +00:00
|
|
|
#define B_BTN_ITEM ((gSaveContext.buttonStatus[0] == ITEM_NONE) \
|
|
|
|
? ITEM_NONE \
|
2023-08-13 19:24:26 +00:00
|
|
|
: (gSaveContext.save.info.equips.buttonItems[0] == ITEM_GIANTS_KNIFE) \
|
2022-11-16 18:23:27 +00:00
|
|
|
? ITEM_SWORD_BIGGORON \
|
2023-08-13 19:24:26 +00:00
|
|
|
: gSaveContext.save.info.equips.buttonItems[0])
|
2020-09-19 01:45:39 +00:00
|
|
|
|
2021-11-30 23:40:42 +00:00
|
|
|
#define C_BTN_ITEM(button) ((gSaveContext.buttonStatus[(button) + 1] != BTN_DISABLED) \
|
2023-08-13 19:24:26 +00:00
|
|
|
? gSaveContext.save.info.equips.buttonItems[(button) + 1] \
|
2020-09-19 01:45:39 +00:00
|
|
|
: ITEM_NONE)
|
|
|
|
|
2020-10-03 15:22:44 +00:00
|
|
|
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
|
|
|
|
#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)
|
|
|
|
|
2021-12-06 00:11:38 +00:00
|
|
|
#define CHECK_FLAG_ALL(flags, mask) (((flags) & (mask)) == (mask))
|
|
|
|
|
2024-01-12 15:38:13 +00:00
|
|
|
// IDO doesn't support variadic macros, but it merely throws a warning for the
|
|
|
|
// number of arguments not matching the definition (warning 609) instead of
|
|
|
|
// throwing an error. We suppress this warning and rely on GCC to catch macro
|
|
|
|
// argument errors instead.
|
2024-02-01 01:09:16 +00:00
|
|
|
// Note some tools define __sgi but preprocess with a modern cpp implementation,
|
|
|
|
// ensure that these do not use the IDO workaround to avoid errors.
|
2024-02-20 12:38:58 +00:00
|
|
|
#define IDO_PRINTF_WORKAROUND (__sgi && !__GNUC__ && !M2CTX)
|
2024-02-01 01:09:16 +00:00
|
|
|
|
|
|
|
#if OOT_DEBUG
|
|
|
|
#define PRINTF osSyncPrintf
|
|
|
|
#elif IDO_PRINTF_WORKAROUND
|
2024-01-12 15:38:13 +00:00
|
|
|
#define PRINTF(args) (void)0
|
2024-01-18 13:47:22 +00:00
|
|
|
#else
|
|
|
|
#define PRINTF(format, ...) (void)0
|
2024-01-12 15:38:13 +00:00
|
|
|
#endif
|
|
|
|
|
2024-01-30 18:54:38 +00:00
|
|
|
#if OOT_DEBUG
|
2020-06-14 03:29:59 +00:00
|
|
|
#define LOG(exp, value, format, file, line) \
|
|
|
|
do { \
|
|
|
|
LogUtils_LogThreadId(file, line); \
|
|
|
|
osSyncPrintf(exp " = " format "\n", value); \
|
|
|
|
} while (0)
|
2024-01-09 12:59:03 +00:00
|
|
|
#else
|
2024-02-02 17:25:44 +00:00
|
|
|
#define LOG(exp, value, format, file, line) (void)(value)
|
2024-01-09 12:59:03 +00:00
|
|
|
#endif
|
2020-04-04 17:28:53 +00:00
|
|
|
|
2020-04-05 10:32:08 +00:00
|
|
|
#define LOG_STRING(string, file, line) LOG(#string, string, "%s", file, line)
|
2020-04-16 21:36:12 +00:00
|
|
|
#define LOG_ADDRESS(exp, value, file, line) LOG(exp, value, "%08x", file, line)
|
2020-04-04 17:28:53 +00:00
|
|
|
#define LOG_TIME(exp, value, file, line) LOG(exp, value, "%lld", file, line)
|
2020-04-05 10:32:08 +00:00
|
|
|
#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line)
|
2020-06-14 03:29:59 +00:00
|
|
|
#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line)
|
2022-11-13 23:07:27 +00:00
|
|
|
#define LOG_HEX32(exp, value, file, line) LOG(exp, value, "%08x", file, line)
|
2020-12-29 18:11:11 +00:00
|
|
|
#define LOG_FLOAT(exp, value, file, line) LOG(exp, value, "%f", file, line)
|
2020-04-04 17:28:53 +00:00
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
|
2021-02-15 17:29:06 +00:00
|
|
|
do { \
|
2024-02-01 22:00:27 +00:00
|
|
|
GameState* state = curState; \
|
|
|
|
\
|
|
|
|
(state)->init = newInit; \
|
|
|
|
(state)->size = sizeof(newStruct); \
|
2021-02-15 17:29:06 +00:00
|
|
|
} while (0)
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
|
|
#define SET_FULLSCREEN_VIEWPORT(view) \
|
|
|
|
{ \
|
|
|
|
Viewport viewport; \
|
|
|
|
viewport.bottomY = SCREEN_HEIGHT; \
|
|
|
|
viewport.rightX = SCREEN_WIDTH; \
|
|
|
|
viewport.topY = 0; \
|
|
|
|
viewport.leftX = 0; \
|
|
|
|
View_SetViewport(view, &viewport); \
|
|
|
|
} \
|
|
|
|
(void)0
|
|
|
|
|
2022-11-30 17:46:12 +00:00
|
|
|
struct GraphicsContext;
|
|
|
|
|
|
|
|
extern struct GraphicsContext* __gfxCtx;
|
2020-08-30 16:51:46 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
#define WORK_DISP __gfxCtx->work.p
|
|
|
|
#define POLY_OPA_DISP __gfxCtx->polyOpa.p
|
|
|
|
#define POLY_XLU_DISP __gfxCtx->polyXlu.p
|
|
|
|
#define OVERLAY_DISP __gfxCtx->overlay.p
|
|
|
|
|
2024-01-30 18:54:38 +00:00
|
|
|
#if OOT_DEBUG
|
2024-01-09 12:59:03 +00:00
|
|
|
|
2020-10-29 21:31:09 +00:00
|
|
|
// __gfxCtx shouldn't be used directly.
|
|
|
|
// Use the DISP macros defined above when writing to display buffers.
|
2020-08-30 16:51:46 +00:00
|
|
|
#define OPEN_DISPS(gfxCtx, file, line) \
|
|
|
|
{ \
|
2020-10-29 21:31:09 +00:00
|
|
|
GraphicsContext* __gfxCtx; \
|
2020-08-30 16:51:46 +00:00
|
|
|
Gfx* dispRefs[4]; \
|
2020-10-29 21:31:09 +00:00
|
|
|
__gfxCtx = gfxCtx; \
|
2021-02-14 00:49:40 +00:00
|
|
|
(void)__gfxCtx; \
|
2020-08-30 16:51:46 +00:00
|
|
|
Graph_OpenDisps(dispRefs, gfxCtx, file, line)
|
2020-08-29 23:00:17 +00:00
|
|
|
|
|
|
|
#define CLOSE_DISPS(gfxCtx, file, line) \
|
|
|
|
Graph_CloseDisps(dispRefs, gfxCtx, file, line); \
|
|
|
|
} \
|
|
|
|
(void)0
|
|
|
|
|
2024-01-09 12:59:03 +00:00
|
|
|
#define GRAPH_ALLOC(gfxCtx, size) Graph_Alloc(gfxCtx, size)
|
|
|
|
#define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx, file, line)
|
|
|
|
#define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx, file, line)
|
|
|
|
#define MATRIX_CHECK_FLOATS(mtx, file, line) Matrix_CheckFloats(mtx, file, line)
|
|
|
|
#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSyncDebug(ram, vrom, size, file, line)
|
|
|
|
#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsyncDebug(req, ram, vrom, size, unk5, queue, msg, file, line)
|
|
|
|
#define GAME_STATE_ALLOC(gameState, size, file, line) GameState_Alloc(gameState, size, file, line)
|
2024-02-03 15:59:25 +00:00
|
|
|
#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_MallocDebug(size, file, line)
|
|
|
|
#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocRDebug(size, file, line)
|
|
|
|
#define DEBUG_ARENA_FREE(size, file, line) DebugArena_FreeDebug(size, file, line)
|
2024-01-09 12:59:03 +00:00
|
|
|
#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_MallocDebug(size, file, line)
|
|
|
|
#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocRDebug(size, file, line)
|
|
|
|
#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_FreeDebug(size, file, line)
|
|
|
|
#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_MallocDebug(size, file, line)
|
|
|
|
#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocRDebug(size, file, line)
|
|
|
|
#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_FreeDebug(size, file, line)
|
2024-01-16 14:59:02 +00:00
|
|
|
#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) LogUtils_CheckNullPointer(exp, ptr, file, line)
|
|
|
|
#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) LogUtils_CheckValidPointer(exp, ptr, file, line)
|
2024-01-29 20:27:29 +00:00
|
|
|
#define HUNGUP_AND_CRASH(file, line) Fault_AddHungupAndCrash(file, line)
|
|
|
|
#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_MallocDebug(alloc, size, file, line)
|
2024-01-09 12:59:03 +00:00
|
|
|
|
|
|
|
#else
|
|
|
|
|
|
|
|
#define OPEN_DISPS(gfxCtx, file, line) \
|
|
|
|
{ \
|
|
|
|
GraphicsContext* __gfxCtx = gfxCtx; \
|
|
|
|
s32 __dispPad
|
|
|
|
|
|
|
|
#define CLOSE_DISPS(gfxCtx, file, line) \
|
|
|
|
(void)0; \
|
|
|
|
} \
|
|
|
|
(void)0
|
|
|
|
|
|
|
|
#define GRAPH_ALLOC(gfxCtx, size) ((void*)((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - ALIGN16(size))))
|
|
|
|
#define MATRIX_TO_MTX(gfxCtx, file, line) Matrix_ToMtx(gfxCtx)
|
|
|
|
#define MATRIX_NEW(gfxCtx, file, line) Matrix_NewMtx(gfxCtx)
|
|
|
|
#define MATRIX_CHECK_FLOATS(mtx, file, line) (mtx)
|
|
|
|
#define DMA_REQUEST_SYNC(ram, vrom, size, file, line) DmaMgr_RequestSync(ram, vrom, size)
|
|
|
|
#define DMA_REQUEST_ASYNC(req, ram, vrom, size, unk5, queue, msg, file, line) DmaMgr_RequestAsync(req, ram, vrom, size, unk5, queue, msg)
|
|
|
|
#define GAME_STATE_ALLOC(gameState, size, file, line) THA_AllocTailAlign16(&(gameState)->tha, size)
|
2024-02-03 15:59:25 +00:00
|
|
|
#define DEBUG_ARENA_MALLOC(size, file, line) DebugArena_Malloc(size)
|
|
|
|
#define DEBUG_ARENA_MALLOC_R(size, file, line) DebugArena_MallocR(size)
|
|
|
|
#define DEBUG_ARENA_FREE(size, file, line) DebugArena_Free(size)
|
2024-01-09 12:59:03 +00:00
|
|
|
#define SYSTEM_ARENA_MALLOC(size, file, line) SystemArena_Malloc(size)
|
|
|
|
#define SYSTEM_ARENA_MALLOC_R(size, file, line) SystemArena_MallocR(size)
|
|
|
|
#define SYSTEM_ARENA_FREE(size, file, line) SystemArena_Free(size)
|
|
|
|
#define ZELDA_ARENA_MALLOC(size, file, line) ZeldaArena_Malloc(size)
|
|
|
|
#define ZELDA_ARENA_MALLOC_R(size, file, line) ZeldaArena_MallocR(size)
|
|
|
|
#define ZELDA_ARENA_FREE(size, file, line) ZeldaArena_Free(size)
|
2024-01-16 14:59:02 +00:00
|
|
|
#define LOG_UTILS_CHECK_NULL_POINTER(exp, ptr, file, line) (void)0
|
|
|
|
#define LOG_UTILS_CHECK_VALID_POINTER(exp, ptr, file, line) (void)0
|
2024-01-29 20:27:29 +00:00
|
|
|
#define HUNGUP_AND_CRASH(file, line) LogUtils_HungupThread(file, line)
|
|
|
|
#define GAME_ALLOC_MALLOC(alloc, size, file, line) GameAlloc_Malloc(alloc, size)
|
2024-01-09 12:59:03 +00:00
|
|
|
|
|
|
|
#endif /* OOT_DEBUG */
|
|
|
|
|
2020-08-29 23:00:17 +00:00
|
|
|
/**
|
2020-04-30 18:41:09 +00:00
|
|
|
* `x` vertex x
|
|
|
|
* `y` vertex y
|
|
|
|
* `z` vertex z
|
|
|
|
* `s` texture s coordinate
|
|
|
|
* `t` texture t coordinate
|
|
|
|
* `crnx` red component of color vertex, or x component of normal vertex
|
|
|
|
* `cgny` green component of color vertex, or y component of normal vertex
|
|
|
|
* `cbnz` blue component of color vertex, or z component of normal vertex
|
|
|
|
* `a` alpha
|
2020-06-14 03:29:59 +00:00
|
|
|
*/
|
2020-05-18 18:24:00 +00:00
|
|
|
#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } }
|
|
|
|
|
|
|
|
#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } }
|
2020-04-30 18:41:09 +00:00
|
|
|
|
2021-05-02 23:15:16 +00:00
|
|
|
#define gDPSetTileCustom(pkt, fmt, siz, width, height, pal, cms, cmt, masks, maskt, shifts, shiftt) \
|
|
|
|
do { \
|
|
|
|
gDPPipeSync(pkt); \
|
|
|
|
gDPTileSync(pkt); \
|
|
|
|
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_LOADTILE, 0, cmt, maskt, shiftt, cms, \
|
|
|
|
masks, shifts); \
|
|
|
|
gDPTileSync(pkt); \
|
|
|
|
gDPSetTile(pkt, fmt, siz, (((width)*siz##_TILE_BYTES) + 7) >> 3, 0, G_TX_RENDERTILE, pal, cmt, maskt, shiftt, \
|
|
|
|
cms, masks, shifts); \
|
|
|
|
gDPSetTileSize(pkt, G_TX_RENDERTILE, 0, 0, ((width)-1) << G_TEXTURE_IMAGE_FRAC, \
|
|
|
|
((height)-1) << G_TEXTURE_IMAGE_FRAC); \
|
|
|
|
} while (0)
|
|
|
|
|
2020-03-17 04:31:30 +00:00
|
|
|
#endif
|