mirror of
https://github.com/izzy2lost/2ship2harkinian-Android.git
synced 2026-06-19 01:20:08 -07:00
ovl_En_GirlA OK and documented (#182)
* EnGirlA Matches * Convert func to boolean * Cleanup * missed a little cleanup * Update with new MACRO * revert z_en_item00.c macro, and add one more macro * Documented * Format macros.h * Fix VTX format * rename isBought to isOutOfStock * PR suggestions * Document a bug * PR comments
This commit is contained in:
+2
-2
@@ -2145,7 +2145,7 @@ void Interface_ChangeAlpha(u16 param_1);
|
||||
// void func_80112C0C(void);
|
||||
u32 Item_Give(GlobalContext* globalCtx, u8 param_2);
|
||||
// void func_801143CC(void);
|
||||
// void func_80114978(void);
|
||||
UNK_TYPE func_80114978(UNK_TYPE arg0);
|
||||
// void func_801149A0(void);
|
||||
// void func_80114A9C(void);
|
||||
// void func_80114B84(void);
|
||||
@@ -2164,7 +2164,7 @@ void func_80115844(GlobalContext* globalCtx, s16 param_2);
|
||||
void func_80115908(GlobalContext* globalCtx, u8 param_2);
|
||||
void func_801159c0(s16 param_1);
|
||||
void func_801159EC(s16 arg0);
|
||||
// void func_80115A14(void);
|
||||
void func_80115A14(s32 arg0, s16 arg1);
|
||||
// void Parameter_AddMagic(void);
|
||||
// void func_80115D5C(void);
|
||||
// void func_80115DB4(void);
|
||||
|
||||
+48
-31
@@ -9,18 +9,19 @@
|
||||
|
||||
#define HW_REG(reg, type) *(volatile type*)((reg) | 0xa0000000)
|
||||
|
||||
// TODO: After uintptr_t cast change should have an AVOID_UB target that just toggles the KSEG0 bit in the address rather than add/sub 0x80000000
|
||||
// TODO: After uintptr_t cast change should have an AVOID_UB target that just toggles the KSEG0 bit in the address
|
||||
// rather than add/sub 0x80000000
|
||||
#define PHYSICAL_TO_VIRTUAL(addr) ((uintptr_t)(addr) + 0x80000000)
|
||||
#define PHYSICAL_TO_VIRTUAL2(addr) ((uintptr_t)(addr) - 0x80000000)
|
||||
#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr) - 0x80000000)
|
||||
#define PHYSICAL_TO_VIRTUAL2(addr) ((uintptr_t)(addr)-0x80000000)
|
||||
#define VIRTUAL_TO_PHYSICAL(addr) (uintptr_t)((u8*)(addr)-0x80000000)
|
||||
#define SEGMENTED_TO_VIRTUAL(addr) (void*)(PHYSICAL_TO_VIRTUAL(gSegments[SEGMENT_NUMBER(addr)]) + SEGMENT_OFFSET(addr))
|
||||
|
||||
// Currently most often called ctxt in MM, TODO: Refactor names when its used
|
||||
#define ACTIVE_CAM globalCtx->cameraPtrs[globalCtx->activeCamera]
|
||||
|
||||
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
|
||||
(curState)->nextGameStateInit = (GameStateFunc)newInit; \
|
||||
(curState)->nextGameStateSize = sizeof(newStruct);
|
||||
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
|
||||
(curState)->nextGameStateInit = (GameStateFunc)newInit; \
|
||||
(curState)->nextGameStateSize = sizeof(newStruct);
|
||||
|
||||
#define PLAYER ((ActorPlayer*)globalCtx->actorCtx.actorList[ACTORCAT_PLAYER].first)
|
||||
|
||||
@@ -31,28 +32,43 @@
|
||||
|
||||
#define CURRENT_DAY (gSaveContext.day % 5)
|
||||
|
||||
#define SQ(x) ((x)*(x))
|
||||
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
|
||||
#define SLOT(item) gItemSlots[item]
|
||||
#define AMMO(item) gSaveContext.inventory.ammo[SLOT(item)]
|
||||
#define INV_CONTENT(item) gSaveContext.inventory.items[SLOT(item)]
|
||||
|
||||
#define ALL_EQUIP_VALUE_VOID(equip) \
|
||||
((((void)0, gSaveContext.inventory.equipment) & gEquipMasks[equip]) >> gEquipShifts[equip])
|
||||
#define CUR_EQUIP_VALUE_VOID(equip) \
|
||||
((((void)0, gSaveContext.equips.equipment) & gEquipMasks[equip]) >> gEquipShifts[equip])
|
||||
#define CUR_UPG_VALUE_VOID(upg) \
|
||||
((((void)0, gSaveContext.inventory.upgrades) & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
|
||||
|
||||
#define ALL_EQUIP_VALUE(equip) ((gSaveContext.inventory.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
||||
#define CUR_EQUIP_VALUE(equip) ((gSaveContext.equips.equipment & gEquipMasks[equip]) >> gEquipShifts[equip])
|
||||
#define CUR_UPG_VALUE(upg) ((gSaveContext.inventory.upgrades & gUpgradeMasks[upg]) >> gUpgradeShifts[upg])
|
||||
|
||||
#define CAPACITY(upg, value) gUpgradeCapacities[upg][value]
|
||||
#define CUR_CAPACITY(upg) CAPACITY(upg, CUR_UPG_VALUE(upg) - 4)
|
||||
|
||||
#define CHECK_BTN_ALL(state, combo) (~((state) | ~(combo)) == 0)
|
||||
#define CHECK_BTN_ANY(state, combo) (((state) & (combo)) != 0)
|
||||
|
||||
extern GraphicsContext* __gfxCtx;
|
||||
|
||||
#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
|
||||
#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
|
||||
|
||||
// __gfxCtx shouldn't be used directly.
|
||||
// Use the DISP macros defined above when writing to display buffers.
|
||||
#define OPEN_DISPS(gfxCtx) \
|
||||
{ \
|
||||
GraphicsContext* __gfxCtx = gfxCtx; \
|
||||
s32 __dispPad; \
|
||||
s32 __dispPad;
|
||||
|
||||
#define CLOSE_DISPS(gfxCtx) \
|
||||
} \
|
||||
#define CLOSE_DISPS(gfxCtx) \
|
||||
} \
|
||||
(void)0
|
||||
|
||||
/**
|
||||
@@ -66,30 +82,31 @@ extern GraphicsContext* __gfxCtx;
|
||||
* `cbnz` blue component of color vertex, or z component of normal vertex
|
||||
* `a` alpha
|
||||
*/
|
||||
#define VTX(x,y,z,s,t,crnx,cgny,cbnz,a) { { { x, y, z }, 0, { s, t }, { crnx, cgny, cbnz, a } } }
|
||||
#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 } }
|
||||
#define VTX_T(x, y, z, s, t, cr, cg, cb, a) \
|
||||
{ { x, y, z }, 0, { s, t }, { cr, cg, cb, a }, }
|
||||
|
||||
#define GRAPH_ALLOC(gfxCtx, size) \
|
||||
((void *) ((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - (size))))
|
||||
#define GRAPH_ALLOC(gfxCtx, size) ((void*)((gfxCtx)->polyOpa.d = (Gfx*)((u8*)(gfxCtx)->polyOpa.d - (size))))
|
||||
|
||||
#define ALIGN8(val) (((val) + 7) & ~7)
|
||||
#define ALIGN16(val) (((val) + 0xF) & ~0xF)
|
||||
|
||||
#define SQ(x) ((x)*(x))
|
||||
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
#define ABS_ALT(x) ((x) < 0 ? -(x) : (x))
|
||||
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
|
||||
#define SQ(x) ((x) * (x))
|
||||
#define ABS(x) ((x) >= 0 ? (x) : -(x))
|
||||
#define ABS_ALT(x) ((x) < 0 ? -(x) : (x))
|
||||
#define DECR(x) ((x) == 0 ? 0 : ((x) -= 1))
|
||||
|
||||
#define CLAMP(x, min, max) ((x) < (min) ? (min) : (x) > (max) ? (max) : (x))
|
||||
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
||||
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
|
||||
#define CLAMP_MAX(x, max) ((x) > (max) ? (max) : (x))
|
||||
#define CLAMP_MIN(x, min) ((x) < (min) ? (min) : (x))
|
||||
|
||||
#define SWAP(type, a, b) \
|
||||
{ \
|
||||
type _temp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = _temp; \
|
||||
}
|
||||
#define SWAP(type, a, b) \
|
||||
{ \
|
||||
type _temp = (a); \
|
||||
(a) = (b); \
|
||||
(b) = _temp; \
|
||||
}
|
||||
|
||||
#endif // _MACROS_H_
|
||||
|
||||
+99
-21
@@ -7,44 +7,122 @@
|
||||
// TODO fill out these enums
|
||||
|
||||
typedef enum {
|
||||
/* 0x1 */ EQUIP_SHIELD = 0x1
|
||||
} EquipmentType;
|
||||
|
||||
typedef enum {
|
||||
/* 0x0 */ UPG_QUIVER,
|
||||
/* 0x1 */ UPG_BOMB_BAG,
|
||||
/* 0x4 */ UPG_WALLET = 0x4,
|
||||
/* 0x6 */ UPG_STICK = 0x6,
|
||||
/* 0x7 */ UPG_NUTS
|
||||
} UpgradeType;
|
||||
|
||||
typedef enum {
|
||||
/* 0x01 */ ITEM_BOW = 0x01,
|
||||
/* 0x06 */ ITEM_BOMB = 0x06,
|
||||
/* 0x07 */ ITEM_BOMBCHU,
|
||||
/* 0x08 */ ITEM_STICK,
|
||||
/* 0x09 */ ITEM_NUT,
|
||||
/* 0x10 */ ITEM_SWORD_GREAT_FAIRY = 0x10,
|
||||
/* 0x12 */ ITEM_BOTTLE = 0x12,
|
||||
/* 0x13 */ ITEM_POTION_RED,
|
||||
/* 0x14 */ ITEM_POTION_GREEN,
|
||||
/* 0x15 */ ITEM_POTION_BLUE,
|
||||
/* 0x16 */ ITEM_FAIRY,
|
||||
/* 0x38 */ ITEM_MASK_ALL_NIGHT = 0x38,
|
||||
/* 0x3B */ ITEM_MASK_GARO = 0x3B,
|
||||
/* 0x4D */ ITEM_SWORD_KOKIRI = 0x4D,
|
||||
/* 0x4E */ ITEM_SWORD_RAZOR,
|
||||
/* 0x4F */ ITEM_SWORD_GILDED,
|
||||
/* 0x51 */ ITEM_SHIELD_HERO = 0x51,
|
||||
/* 0x52 */ ITEM_SHIELD_MIRROR,
|
||||
/* 0x56 */ ITEM_BOMB_BAG_20 = 0x56,
|
||||
/* 0x57 */ ITEM_BOMB_BAG_30,
|
||||
/* 0x58 */ ITEM_BOMB_BAG_40,
|
||||
/* 0x78 */ ITEM_KEY_SMALL = 0x78,
|
||||
/* 0x79 */ ITEM_MAGIC_SMALL = 0x79,
|
||||
/* 0x7A */ ITEM_MAGIC_LARGE = 0x7A,
|
||||
/* 0x79 */ ITEM_MAGIC_SMALL,
|
||||
/* 0x7A */ ITEM_MAGIC_LARGE,
|
||||
/* 0x83 */ ITEM_HEART = 0x83,
|
||||
/* 0x84 */ ITEM_RUPEE_GREEN = 0x84,
|
||||
/* 0x85 */ ITEM_RUPEE_BLUE = 0x85,
|
||||
/* 0x86 */ ITEM_RUPEE_10 = 0x86,
|
||||
/* 0x87 */ ITEM_RUPEE_RED = 0x87,
|
||||
/* 0x88 */ ITEM_RUPEE_PURPLE = 0x88,
|
||||
/* 0x89 */ ITEM_RUPEE_100 = 0x89,
|
||||
/* 0x8A */ ITEM_RUPEE_ORANGE = 0x8A,
|
||||
/* 0x8F */ ITEM_BOMBS_5 = 0x8F,
|
||||
/* 0x90 */ ITEM_BOMBS_10 = 0x90,
|
||||
/* 0x91 */ ITEM_BOMBS_20 = 0x91,
|
||||
/* 0x92 */ ITEM_BOMBS_30 = 0x92,
|
||||
/* 0x93 */ ITEM_ARROWS_10 = 0x93,
|
||||
/* 0x94 */ ITEM_ARROWS_30 = 0x94,
|
||||
/* 0x95 */ ITEM_ARROWS_40 = 0x95,
|
||||
/* 0x96 */ ITEM_ARROWS_50 = 0x96
|
||||
/* 0x84 */ ITEM_RUPEE_GREEN,
|
||||
/* 0x85 */ ITEM_RUPEE_BLUE,
|
||||
/* 0x86 */ ITEM_RUPEE_10,
|
||||
/* 0x87 */ ITEM_RUPEE_RED,
|
||||
/* 0x88 */ ITEM_RUPEE_PURPLE,
|
||||
/* 0x89 */ ITEM_RUPEE_100,
|
||||
/* 0x8A */ ITEM_RUPEE_ORANGE,
|
||||
/* 0x8D */ ITEM_NUTS_5 = 0x8D,
|
||||
/* 0x8E */ ITEM_NUTS_10,
|
||||
/* 0x8F */ ITEM_BOMBS_5,
|
||||
/* 0x90 */ ITEM_BOMBS_10,
|
||||
/* 0x91 */ ITEM_BOMBS_20,
|
||||
/* 0x92 */ ITEM_BOMBS_30,
|
||||
/* 0x93 */ ITEM_ARROWS_10,
|
||||
/* 0x94 */ ITEM_ARROWS_30,
|
||||
/* 0x95 */ ITEM_ARROWS_40,
|
||||
/* 0x96 */ ITEM_ARROWS_50,
|
||||
/* 0x98 */ ITEM_BOMBCHUS_10 = 0x98,
|
||||
/* 0xFF */ ITEM_NONE = 0xFF
|
||||
} ItemID;
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ GI_NONE,
|
||||
/* 0x0C */ GI_HEART_PIECE = 0x0C,
|
||||
/* 0x0D */ GI_HEART_CONTAINER = 0x0D,
|
||||
/* 0x0D */ GI_HEART_CONTAINER,
|
||||
/* 0x16 */ GI_BOMBS_10 = 0x16,
|
||||
/* 0x19 */ GI_STICKS_1 = 0x19,
|
||||
/* 0x1A */ GI_BOMBCHUS_10,
|
||||
/* 0x1B */ GI_BOMB_BAG_20,
|
||||
/* 0x1C */ GI_BOMB_BAG_30,
|
||||
/* 0x1D */ GI_BOMB_BAG_40,
|
||||
/* 0x1E */ GI_ARROWS_SMALL,
|
||||
/* 0x1F */ GI_ARROWS_MEDIUM,
|
||||
/* 0x20 */ GI_ARROWS_LARGE,
|
||||
/* 0x28 */ GI_NUTS_1 = 0x28,
|
||||
/* 0x2A */ GI_NUTS_10 = 0x2A,
|
||||
/* 0x32 */ GI_SHIELD_HERO = 0x32,
|
||||
/* 0x33 */ GI_SHIELD_MIRROR,
|
||||
/* 0x3C */ GI_KEY_SMALL = 0x3C,
|
||||
/* 0x3E */ GI_MAP = 0x3E,
|
||||
/* 0x3F */ GI_COMPASS = 0x3F
|
||||
/* 0x3F */ GI_COMPASS,
|
||||
/* 0x5B */ GI_POTION_RED = 0x5B,
|
||||
/* 0x5C */ GI_POTION_GREEN,
|
||||
/* 0x5D */ GI_POTION_BLUE,
|
||||
/* 0x5E */ GI_FAIRY,
|
||||
/* 0x7E */ GI_MASK_ALL_NIGHT = 0x7E,
|
||||
/* 0x9B */ GI_SWORD_GREAT_FAIRY = 0x9B,
|
||||
/* 0x9C */ GI_SWORD_KOKIRI,
|
||||
/* 0x9D */ GI_SWORD_RAZOR,
|
||||
/* 0x9E */ GI_SWORD_GILDED,
|
||||
/* 0x9F */ GI_SHIELD_HERO_2, // Code that treats this as hero's shield is unused, so take with a grain of salt
|
||||
/* 0xA9 */ GI_BOTTLE = 0xA9
|
||||
} GetItemID;
|
||||
|
||||
typedef enum {
|
||||
/* 0x00 */ GID_BOTTLE,
|
||||
/* 0x0A */ GID_COMPASS = 0x0A,
|
||||
/* 0x1B */ GID_DUNGEON_MAP = 0x1B,
|
||||
/* 0x27 */ GID_SHIELD_HERO = 0x27
|
||||
/* 0x10 */ GID_MASK_ALL_NIGHT = 0x10,
|
||||
/* 0x11 */ GID_NUTS,
|
||||
/* 0x17 */ GID_BOMB_BAG_20 = 0x17,
|
||||
/* 0x18 */ GID_BOMB_BAG_30,
|
||||
/* 0x19 */ GID_BOMB_BAG_40,
|
||||
/* 0x1A */ GID_STICK = 0x1A,
|
||||
/* 0x1B */ GID_DUNGEON_MAP,
|
||||
/* 0x1E */ GID_BOMB = 0x1E,
|
||||
/* 0x23 */ GID_ARROWS_SMALL = 0x23,
|
||||
/* 0x24 */ GID_ARROWS_MEDIUM,
|
||||
/* 0x25 */ GID_ARROWS_LARGE,
|
||||
/* 0x26 */ GID_BOMBCHU,
|
||||
/* 0x27 */ GID_SHIELD_HERO,
|
||||
/* 0x30 */ GID_POTION_GREEN = 0x30,
|
||||
/* 0x31 */ GID_POTION_RED,
|
||||
/* 0x32 */ GID_POTION_BLUE,
|
||||
/* 0x33 */ GID_SHIELD_MIRROR,
|
||||
/* 0x3B */ GID_FAIRY = 0x3B,
|
||||
/* 0x55 */ GID_SWORD_KOKIRI = 0x55,
|
||||
/* 0x66 */ GID_SWORD_RAZOR = 0x66,
|
||||
/* 0x67 */ GID_SWORD_GILDED,
|
||||
/* 0x68 */ GID_SWORD_GREAT_FAIRY
|
||||
} GetItemDrawID;
|
||||
|
||||
#endif
|
||||
|
||||
Reference in New Issue
Block a user