Tharo's suggestion

This commit is contained in:
mzxrules 2025-12-21 04:17:43 -05:00
parent f1fa6e6d65
commit 0b2e4ebc58
1 changed files with 10 additions and 7 deletions

View File

@ -9,16 +9,18 @@ Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfxAllocDisp);
void* Gfx_Alloc(Gfx** gfxP, u32 size);
/**
* Creates a new temporary graphics display list pointer, using the memory reserved by POLY_OPA_DISP
* Creates a new temporary graphics display list pointer, using the memory reserved by POLY_OPA_DISP.
* POLY_OPA_DISP cannot be written to until GFX_ALLOC_CLOSE is called.
*
* @param gfxAllocDisp is the new temporary graphics display list pointer.
* @param tempGfx is an intermediate Gfx* variable that should not be touched.
* @param disp is the top level display list that is being given more memory.
*/
#define GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, disp) \
gfxAllocDisp = Gfx_Open(tempGfx = POLY_OPA_DISP); \
gSPDisplayList(disp++, gfxAllocDisp)
#define GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, disp) \
{ \
(gfxAllocDisp) = Gfx_Open((tempGfx) = POLY_OPA_DISP); \
gSPDisplayList((disp)++, (gfxAllocDisp)); \
(void)0
/**
* Closes the graphics display list created by GFX_ALLOC_OPEN.
@ -27,8 +29,9 @@ void* Gfx_Alloc(Gfx** gfxP, u32 size);
* @param tempGfx is the same Gfx* variable that was passed into GFX_ALLOC_OPEN
*/
#define GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx) \
gSPEndDisplayList(gfxAllocDisp++); \
Gfx_Close(tempGfx, gfxAllocDisp); \
POLY_OPA_DISP = gfxAllocDisp
gSPEndDisplayList((gfxAllocDisp)++); \
Gfx_Close((tempGfx), (gfxAllocDisp)); \
POLY_OPA_DISP = (gfxAllocDisp); \
}(void)0
#endif