1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-25 09:45:02 +00:00

implement Open/Close using macros

This commit is contained in:
mzxrules 2024-10-01 14:05:02 -04:00
parent 7db957042f
commit 4c40183da4
12 changed files with 106 additions and 121 deletions

View file

@ -2,9 +2,33 @@
#define GFXALLOC_H #define GFXALLOC_H
#include "ultra64.h" #include "ultra64.h"
#include "gfx.h"
Gfx* Gfx_Open(Gfx* gfx); Gfx* Gfx_Open(Gfx* gfxDisp);
Gfx* Gfx_Close(Gfx* gfx, Gfx* dst); Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfxAllocDisp);
void* Gfx_Alloc(Gfx** gfxP, u32 size); void* Gfx_Alloc(Gfx** gfxP, u32 size);
/**
* 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)
/**
* Closes the graphics display list created by GFX_ALLOC_OPEN.
*
* @param gfxAllocDisp is the graphics display list pointer that was created with GFX_ALLOC_OPEN
* @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
#endif #endif

View file

@ -68,8 +68,8 @@ void FlagSet_Update(PlayState* play) {
GraphicsContext* gfxCtx = play->state.gfxCtx; GraphicsContext* gfxCtx = play->state.gfxCtx;
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
OPEN_DISPS(gfxCtx, "../flg_set.c", 131); OPEN_DISPS(gfxCtx, "../flg_set.c", 131);
@ -77,11 +77,10 @@ void FlagSet_Update(PlayState* play) {
GfxPrint printer; GfxPrint printer;
s32 pad; s32 pad;
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp);
GfxPrint_Init(&printer); GfxPrint_Init(&printer);
GfxPrint_Open(&printer, tempGfxDisp); GfxPrint_Open(&printer, gfxAllocDisp);
GfxPrint_SetColor(&printer, 250, 50, 50, 255); GfxPrint_SetColor(&printer, 250, 50, 50, 255);
GfxPrint_SetPos(&printer, 4, 13); GfxPrint_SetPos(&printer, 4, 13);
GfxPrint_Printf(&printer, entries[entryIdx].name); GfxPrint_Printf(&printer, entries[entryIdx].name);
@ -166,12 +165,10 @@ void FlagSet_Update(PlayState* play) {
timer--; timer--;
} }
tempGfxDisp = GfxPrint_Close(&printer); gfxAllocDisp = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer); GfxPrint_Destroy(&printer);
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
} }
if (CHECK_BTN_ALL(input->press.button, BTN_L)) { if (CHECK_BTN_ALL(input->press.button, BTN_L)) {

View file

@ -164,22 +164,21 @@ void GameState_DrawInputDisplay(u16 input, Gfx** gfxP) {
#endif #endif
void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) { void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
OPEN_DISPS(gfxCtx, "../game.c", 746); OPEN_DISPS(gfxCtx, "../game.c", 746);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp);
if (R_ENABLE_FB_FILTER == 1) { if (R_ENABLE_FB_FILTER == 1) {
GameState_SetFBFilter(&tempGfxDisp); GameState_SetFBFilter(&gfxAllocDisp);
} }
#if OOT_DEBUG #if OOT_DEBUG
sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button; sLastButtonPressed = gameState->input[0].press.button | gameState->input[0].cur.button;
if (R_DISABLE_INPUT_DISPLAY == 0) { if (R_DISABLE_INPUT_DISPLAY == 0) {
GameState_DrawInputDisplay(sLastButtonPressed, &tempGfxDisp); GameState_DrawInputDisplay(sLastButtonPressed, &gfxAllocDisp);
} }
if (R_ENABLE_AUDIO_DBG & 1) { if (R_ENABLE_AUDIO_DBG & 1) {
@ -187,9 +186,9 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
GfxPrint printer; GfxPrint printer;
GfxPrint_Init(&printer); GfxPrint_Init(&printer);
GfxPrint_Open(&printer, tempGfxDisp); GfxPrint_Open(&printer, gfxAllocDisp);
AudioDebug_Draw(&printer); AudioDebug_Draw(&printer);
tempGfxDisp = GfxPrint_Close(&printer); gfxAllocDisp = GfxPrint_Close(&printer);
GfxPrint_Destroy(&printer); GfxPrint_Destroy(&printer);
} }
#endif #endif
@ -206,9 +205,7 @@ void GameState_Draw(GameState* gameState, GraphicsContext* gfxCtx) {
R_ENABLE_ARENA_DBG = 0; R_ENABLE_ARENA_DBG = 0;
} }
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(gfxCtx, "../game.c", 800); CLOSE_DISPS(gfxCtx, "../game.c", 800);
@ -237,23 +234,20 @@ void GameState_SetFrameBuffer(GraphicsContext* gfxCtx) {
} }
void func_800C49F4(GraphicsContext* gfxCtx) { void func_800C49F4(GraphicsContext* gfxCtx) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
OPEN_DISPS(gfxCtx, "../game.c", 846); OPEN_DISPS(gfxCtx, "../game.c", 846);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp);
#if PLATFORM_N64 #if PLATFORM_N64
if (D_80121212 != 0) { if (D_80121212 != 0) {
func_801C6EA0(&tempGfxDisp); func_801C6EA0(&gfxAllocDisp);
} }
#endif #endif
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(gfxCtx, "../game.c", 865); CLOSE_DISPS(gfxCtx, "../game.c", 865);
} }

View file

@ -1,12 +1,14 @@
#include "global.h" #include "ultra64.h"
#include "gfxalloc.h"
/** /**
* Creates a new temporary graphics display list pointer, using the memory reserved by gfxDisp * Creates a new temporary graphics display list pointer, using the memory reserved by gfxDisp
* *
* @param gfxDisp is the display list yielding memory. It cannot be written to until Gfx_Close is called. * @param gfxDisp is the display list yielding memory. It cannot be written to until Gfx_Close is called.
* @returns a new graphics display list pointer. * @return a new graphics display list pointer.
* *
* @note This is used to give WORK_DISP more memory to write instructions without increasing the WORK_DISP buffer size. * @note This is used to take memory allocated to a larger display buffer and use it for a smaller display buffer.
* For example, space in POLY_OPA_DISP can be reserved for WORK_DISP and OVERLAY_DISP task data.
*/ */
Gfx* Gfx_Open(Gfx* gfxDisp) { Gfx* Gfx_Open(Gfx* gfxDisp) {
// reserve space for a gSPBranchList command when Gfx_Close is called // reserve space for a gSPBranchList command when Gfx_Close is called
@ -18,11 +20,13 @@ Gfx* Gfx_Open(Gfx* gfxDisp) {
* *
* @param gfxDisp is the display list yielding memory. * @param gfxDisp is the display list yielding memory.
* @param gfx is the graphics display list pointer that was created with Gfx_Open * @param gfx is the graphics display list pointer that was created with Gfx_Open
* @returns gfxDisp's new position * @return gfxDisp's new position.
*
* @note gfxDisp must be updated after the call with the return value of this function to complete the operation.
*/ */
Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfx) { Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfxAllocDisp) {
gSPBranchList(gfxDisp, gfx); gSPBranchList(gfxDisp, gfxAllocDisp);
return gfx; return gfxAllocDisp;
} }
/** /**
@ -30,17 +34,16 @@ Gfx* Gfx_Close(Gfx* gfxDisp, Gfx* gfx) {
* *
* @param gfxP is a pointer to a graphics display list pointer * @param gfxP is a pointer to a graphics display list pointer
* @param size is the number of bytes to reserve * @param size is the number of bytes to reserve
* @returns start pointer to the allocated memory * @return the start pointer to the allocated memory
*/ */
void* Gfx_Alloc(Gfx** gfxP, u32 size) { void* Gfx_Alloc(Gfx** gfxP, u32 size) {
u8* ptr; u8* ptr;
Gfx* dst; Gfx* dst;
size = ALIGN8(size); size = ALIGN8(size);
ptr = (u8*)(*gfxP + 1); ptr = (u8*)(*gfxP + 1);
dst = (Gfx*)(ptr + size); dst = (Gfx*)(ptr + size);
gSPBranchList(*gfxP, dst); gSPBranchList(*gfxP, dst);
*gfxP = dst; *gfxP = dst;

View file

@ -281,17 +281,16 @@ void Regs_DrawEditor(GfxPrint* printer) {
* Draws the Reg Editor and Debug Camera text on screen * Draws the Reg Editor and Debug Camera text on screen
*/ */
void Debug_DrawText(GraphicsContext* gfxCtx) { void Debug_DrawText(GraphicsContext* gfxCtx) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
GfxPrint printer; GfxPrint printer;
s32 pad; s32 pad;
OPEN_DISPS(gfxCtx, "../z_debug.c", 628); OPEN_DISPS(gfxCtx, "../z_debug.c", 628);
GfxPrint_Init(&printer); GfxPrint_Init(&printer);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); GfxPrint_Open(&printer, gfxAllocDisp);
GfxPrint_Open(&printer, tempGfxDisp);
if ((OREG(0) == 1) || (OREG(0) == 8)) { if ((OREG(0) == 1) || (OREG(0) == 8)) {
DebugCamera_DrawScreenText(&printer); DebugCamera_DrawScreenText(&printer);
@ -305,10 +304,8 @@ void Debug_DrawText(GraphicsContext* gfxCtx) {
sDebugCamTextEntryCount = 0; sDebugCamTextEntryCount = 0;
tempGfxDisp = GfxPrint_Close(&printer); gfxAllocDisp = GfxPrint_Close(&printer);
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(gfxCtx, "../z_debug.c", 664); CLOSE_DISPS(gfxCtx, "../z_debug.c", 664);

View file

@ -2217,18 +2217,14 @@ void CutsceneHandler_RunScript(PlayState* play, CutsceneContext* csCtx) {
if (gSaveContext.save.cutsceneIndex >= 0xFFF0) { if (gSaveContext.save.cutsceneIndex >= 0xFFF0) {
#if OOT_DEBUG #if OOT_DEBUG
if (BREG(0) != 0) { if (BREG(0) != 0) {
Gfx* displayList; Gfx* gfxAllocDisp;
Gfx* prevDisplayList; Gfx* tempGfx;
OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101); OPEN_DISPS(play->state.gfxCtx, "../z_demo.c", 4101);
prevDisplayList = POLY_OPA_DISP; GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
displayList = Gfx_Open(POLY_OPA_DISP); Cutscene_DrawDebugInfo(play, &gfxAllocDisp, csCtx);
gSPDisplayList(OVERLAY_DISP++, displayList); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Cutscene_DrawDebugInfo(play, &displayList, csCtx);
gSPEndDisplayList(displayList++);
Gfx_Close(prevDisplayList, displayList);
POLY_OPA_DISP = displayList;
CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108); CLOSE_DISPS(play->state.gfxCtx, "../z_demo.c", 4108);
} }

View file

@ -981,18 +981,14 @@ void Environment_Update(PlayState* play, EnvironmentContext* envCtx, LightContex
#if OOT_DEBUG #if OOT_DEBUG
if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) { if (R_ENABLE_ARENA_DBG != 0 || CREG(2) != 0) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682); OPEN_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1682);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); Environment_PrintDebugInfo(play, &gfxAllocDisp);
Environment_PrintDebugInfo(play, &tempGfxDisp); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
gSPEndDisplayList(tempGfxDisp++);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690); CLOSE_DISPS(play->state.gfxCtx, "../z_kankyo.c", 1690);
} }

View file

@ -3973,8 +3973,8 @@ void Message_DrawDebugText(PlayState* play, Gfx** p) {
#endif #endif
void Message_Draw(PlayState* play) { void Message_Draw(PlayState* play) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
#if OOT_VERSION < GC_US #if OOT_VERSION < GC_US
s32 pad; s32 pad;
#endif #endif
@ -3988,21 +3988,15 @@ void Message_Draw(PlayState* play) {
watchVar = gSaveContext.save.info.scarecrowLongSongSet; watchVar = gSaveContext.save.info.scarecrowLongSongSet;
Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx); Message_DrawDebugVariableChanged(&watchVar, play->state.gfxCtx);
if (BREG(0) != 0 && play->msgCtx.textId != 0) { if (BREG(0) != 0 && play->msgCtx.textId != 0) {
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); Message_DrawDebugText(play, &gfxAllocDisp);
Message_DrawDebugText(play, &tempGfxDisp); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
gSPEndDisplayList(tempGfxDisp++);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
} }
#endif #endif
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); Message_DrawMain(play, &gfxAllocDisp);
Message_DrawMain(play, &tempGfxDisp); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
gSPEndDisplayList(tempGfxDisp++);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3582); CLOSE_DISPS(play->state.gfxCtx, "../z_message_PAL.c", 3582);
} }

View file

@ -1159,11 +1159,10 @@ void Play_Draw(PlayState* this) {
gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx); gSPSegment(POLY_OPA_DISP++, 0x01, this->billboardMtx);
if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) { if (!OOT_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_COVER_ELEMENTS) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp);
if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) || if ((this->transitionMode == TRANS_MODE_INSTANCE_RUNNING) ||
(this->transitionMode == TRANS_MODE_INSTANCE_WAIT) || (this->transitionCtx.transitionType >= 56)) { (this->transitionMode == TRANS_MODE_INSTANCE_WAIT) || (this->transitionCtx.transitionType >= 56)) {
@ -1174,11 +1173,11 @@ void Play_Draw(PlayState* this) {
SET_FULLSCREEN_VIEWPORT(&view); SET_FULLSCREEN_VIEWPORT(&view);
View_ApplyTo(&view, VIEW_ALL, &tempGfxDisp); View_ApplyTo(&view, VIEW_ALL, &gfxAllocDisp);
this->transitionCtx.draw(&this->transitionCtx.instanceData, &tempGfxDisp); this->transitionCtx.draw(&this->transitionCtx.instanceData, &gfxAllocDisp);
} }
TransitionFade_Draw(&this->transitionFadeFlash, &tempGfxDisp); TransitionFade_Draw(&this->transitionFadeFlash, &gfxAllocDisp);
#if PLATFORM_N64 #if PLATFORM_N64
if (gVisMonoColor.a != 0) if (gVisMonoColor.a != 0)
@ -1187,12 +1186,10 @@ void Play_Draw(PlayState* this) {
#endif #endif
{ {
gPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba; gPlayVisMono.vis.primColor.rgba = gVisMonoColor.rgba;
VisMono_Draw(&gPlayVisMono, &tempGfxDisp); VisMono_Draw(&gPlayVisMono, &gfxAllocDisp);
} }
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
} }
if (gTransitionTileState == TRANS_TILE_READY) { if (gTransitionTileState == TRANS_TILE_READY) {

View file

@ -803,19 +803,14 @@ void EnMag_DrawInner(Actor* thisx, PlayState* play, Gfx** gfxP) {
void EnMag_Draw(Actor* thisx, PlayState* play) { void EnMag_Draw(Actor* thisx, PlayState* play) {
s32 pad; s32 pad;
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
OPEN_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1151); OPEN_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1151);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); EnMag_DrawInner(thisx, play, &gfxAllocDisp);
GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
EnMag_DrawInner(thisx, play, &tempGfxDisp);
gSPEndDisplayList(tempGfxDisp++);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
CLOSE_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1161); CLOSE_DISPS(play->state.gfxCtx, "../z_en_mag.c", 1161);
} }

View file

@ -98,8 +98,8 @@ void KaleidoScope_DrawDebugEditor(PlayState* play) {
static s32 heldDBtnTimer = 0; static s32 heldDBtnTimer = 0;
PauseContext* pauseCtx = &play->pauseCtx; PauseContext* pauseCtx = &play->pauseCtx;
Input* input = &play->state.input[0]; Input* input = &play->state.input[0];
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
s16 spD8[4]; s16 spD8[4];
s16 slot; s16 slot;
s16 i; s16 i;
@ -123,14 +123,9 @@ void KaleidoScope_DrawDebugEditor(PlayState* play) {
gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0, gDPSetCombineLERP(POLY_OPA_DISP++, 0, 0, 0, PRIMITIVE, TEXEL0, 0, PRIMITIVE, 0, 0, 0, 0, PRIMITIVE, TEXEL0, 0,
PRIMITIVE, 0); PRIMITIVE, 0);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, OVERLAY_DISP);
gSPDisplayList(OVERLAY_DISP++, tempGfxDisp); KaleidoScope_DrawDebugEditorText(&gfxAllocDisp);
GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
KaleidoScope_DrawDebugEditorText(&tempGfxDisp);
gSPEndDisplayList(tempGfxDisp++);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
gDPPipeSync(POLY_OPA_DISP++); gDPPipeSync(POLY_OPA_DISP++);
gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 0, 0, 255); gDPSetPrimColor(POLY_OPA_DISP++, 0, 0, 255, 0, 0, 255);

View file

@ -907,24 +907,21 @@ static PreRender sPlayerPreRender;
static void* sPreRenderCvg; static void* sPreRenderCvg;
void KaleidoScope_SetupPlayerPreRender(PlayState* play) { void KaleidoScope_SetupPlayerPreRender(PlayState* play) {
Gfx* tempGfxDisp; Gfx* gfxAllocDisp;
Gfx* lockedGfxDisp; Gfx* tempGfx;
void* fbuf; void* fbuf;
fbuf = play->state.gfxCtx->curFrameBuffer; fbuf = play->state.gfxCtx->curFrameBuffer;
OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 496); OPEN_DISPS(play->state.gfxCtx, "../z_kaleido_scope_PAL.c", 496);
tempGfxDisp = Gfx_Open(lockedGfxDisp = POLY_OPA_DISP); GFX_ALLOC_OPEN(gfxAllocDisp, tempGfx, WORK_DISP);
gSPDisplayList(WORK_DISP++, tempGfxDisp);
PreRender_SetValues(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, fbuf, NULL); PreRender_SetValues(&sPlayerPreRender, PAUSE_EQUIP_PLAYER_WIDTH, PAUSE_EQUIP_PLAYER_HEIGHT, fbuf, NULL);
PreRender_SaveFramebuffer(&sPlayerPreRender, &tempGfxDisp); PreRender_SaveFramebuffer(&sPlayerPreRender, &gfxAllocDisp);
PreRender_DrawCoverage(&sPlayerPreRender, &tempGfxDisp); PreRender_DrawCoverage(&sPlayerPreRender, &gfxAllocDisp);
gSPEndDisplayList(tempGfxDisp++); GFX_ALLOC_CLOSE(gfxAllocDisp, tempGfx);
Gfx_Close(lockedGfxDisp, tempGfxDisp);
POLY_OPA_DISP = tempGfxDisp;
R_GRAPH_TASKSET00_FLAGS |= 1; R_GRAPH_TASKSET00_FLAGS |= 1;