1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2025-07-14 11:54:39 +00:00

Introduce OPEN_DISPS/CLOSE_DISPS macros (#360)

This commit is contained in:
Roman971 2020-08-30 01:00:17 +02:00 committed by GitHub
parent 1f1b5e39f5
commit 2a2fdf7f3e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
134 changed files with 3133 additions and 3775 deletions

View file

@ -45,9 +45,7 @@
#define CHECK_QUEST_ITEM(item) (gBitFlags[item] & gSaveContext.questItems)
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
(curState)->init = newInit; \
(curState)->size = sizeof(newStruct);
#define CHECK_PAD(state, combo) (~(state.in.button | ~(combo)) == 0)
#define LOG(exp, value, format, file, line) \
do { \
@ -61,7 +59,37 @@
#define LOG_NUM(exp, value, file, line) LOG(exp, value, "%d", file, line)
#define LOG_HEX(exp, value, file, line) LOG(exp, value, "%x", file, line)
/*
#define SET_NEXT_GAMESTATE(curState, newInit, newStruct) \
(curState)->init = newInit; \
(curState)->size = sizeof(newStruct)
#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
#define OPEN_DISPS_INNER(gfxCtx, file, line) \
oGfxCtx = gfxCtx; \
Graph_OpenDisps(dispRefs, gfxCtx, file, line)
#define OPEN_DISPS(gfxCtx, file, line) \
{ \
GraphicsContext* oGfxCtx; \
Gfx* dispRefs[4]; \
OPEN_DISPS_INNER(gfxCtx, file, line)
#define CLOSE_DISPS(gfxCtx, file, line) \
Graph_CloseDisps(dispRefs, gfxCtx, file, line); \
} \
(void)0
/**
* `x` vertex x
* `y` vertex y
* `z` vertex z
@ -76,16 +104,4 @@
#define VTX_T(x,y,z,s,t,cr,cg,cb,a) { { x, y, z }, 0, { s, t }, { cr, cg, cb, a } }
#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); \
}
#define CHECK_PAD(state, combo) (~(state.in.button | ~(combo)) == 0)
#endif

View file

@ -2634,7 +2634,7 @@ _DW({ \
* Macros to turn texture on/off
*/
# define gSPTexture(pkt, s, t, level, tile, on) \
{ \
_DW({ \
Gfx *_g = (Gfx *)(pkt); \
\
_g->words.w0 = (_SHIFTL(G_TEXTURE,24,8) | \
@ -2642,7 +2642,7 @@ _DW({ \
_SHIFTL((level),11,3) | _SHIFTL((tile),8,3) | \
_SHIFTL((on),1,7)); \
_g->words.w1 = (_SHIFTL((s),16,16) | _SHIFTL((t),0,16)); \
}
})
# define gsSPTexture(s, t, level, tile, on) \
{ \
(_SHIFTL(G_TEXTURE,24,8) | _SHIFTL(BOWTIE_VAL,16,8) | \

View file

@ -1208,7 +1208,8 @@ typedef struct GlobalContext {
/* 0x000B0 */ void* sceneSegment;
/* 0x000B4 */ char unk_B4[0x4];
/* 0x000B8 */ View view;
/* 0x001E0 */ Camera cameras[4];
/* 0x001E0 */ Camera mainCamera;
/* 0x001E0 */ Camera subCameras[3];
/* 0x00790 */ Camera* cameraPtrs[4];
/* 0x007A0 */ s16 activeCamera;
/* 0x007A2 */ s16 nextCamera;