diff --git a/include/z64.h b/include/z64.h index 5840279335..e95d454133 100644 --- a/include/z64.h +++ b/include/z64.h @@ -255,7 +255,7 @@ typedef struct GraphicsContext { /* 0x2E4 */ u32 viConfigFeatures; /* 0x2E8 */ char unk_2E8[0x2]; /* 0x2EA */ u8 updateViMode; - /* 0x2EB */ u8 framebufferIdx; + /* 0x2EB */ u8 framebufferIndex; /* 0x2EC */ void (*callback)(struct GraphicsContext*, u32); /* 0x2F0 */ u32 callbackParam; /* 0x2F4 */ f32 xScale; diff --git a/src/code/graph.c b/src/code/graph.c index 353405dba1..2ed5df95d2 100644 --- a/src/code/graph.c +++ b/src/code/graph.c @@ -50,7 +50,7 @@ void Graph_SetNextGfxPool(GraphicsContext* gfxCtx) { gfxCtx->workBuffer = pool->workBuffer; gfxCtx->debugBuffer = pool->debugBuffer; - gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIdx % 2); + gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIndex % 2); gSegments[0x0F] = gfxCtx->curFrameBuffer; gfxCtx->zbuffer = SysCfb_GetZBuffer(); @@ -116,7 +116,7 @@ void* Graph_FaultAddrConvFunc(void* address, void* param) { void Graph_Init(GraphicsContext* gfxCtx) { bzero(gfxCtx, sizeof(GraphicsContext)); gfxCtx->gfxPoolIdx = 0; - gfxCtx->framebufferIdx = 0; + gfxCtx->framebufferIndex = 0; gfxCtx->viMode = NULL; gfxCtx->viConfigFeatures = gViConfigFeatures; gfxCtx->xScale = gViConfigXScale; @@ -191,7 +191,7 @@ retry: if (SREG(33) & 1) { SREG(33) &= ~1; scTask->flags &= ~OS_SC_SWAPBUFFER; - gfxCtx->framebufferIdx--; + gfxCtx->framebufferIndex--; } scTask->msgQ = &gfxCtx->queue; @@ -305,7 +305,7 @@ void Graph_ExecuteAndDraw(GraphicsContext* gfxCtx, GameState* gameState) { if (!problem) { Graph_TaskSet00(gfxCtx, gameState); gfxCtx->gfxPoolIdx++; - gfxCtx->framebufferIdx++; + gfxCtx->framebufferIndex++; } { diff --git a/src/code/z_play.c b/src/code/z_play.c index 00f5beca03..7de0400b8c 100644 --- a/src/code/z_play.c +++ b/src/code/z_play.c @@ -399,7 +399,7 @@ void Play_Destroy(GameState* thisx) { if (sBombersNotebookOpen) { MsgEvent_SendNullTask(); func_80178750(); - gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIdx % 2); + gfxCtx->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx->framebufferIndex % 2); gfxCtx->zbuffer = SysCfb_GetZBuffer(); gfxCtx->viMode = D_801FBB88; gfxCtx->viConfigFeatures = gViConfigFeatures; @@ -447,10 +447,10 @@ void Play_Destroy(GameState* thisx) { func_80140EA0(D_801F6D4C); D_801F6D4C = NULL; - if (gSaveContext.save.weekEventReg[0x5C] & 0x80) { + if (gSaveContext.save.weekEventReg[92] & 0x80) { Actor_CleanupContext(&this->actorCtx, this); } - gSaveContext.save.weekEventReg[0x5C] &= (u8)~0x80; + gSaveContext.save.weekEventReg[92] &= (u8)~0x80; Interface_Destroy(this); KaleidoScopeCall_Destroy(this); @@ -1073,19 +1073,17 @@ void Play_SetupUpdate(PlayState* this) { sBombersNotebookOpen = true; sHireso.unk_00 = 0; } - } else { - if (CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_L) || - CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_B) || - CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_START) || (gIrqMgrResetStatus != 0)) { - sBombersNotebookOpen = false; - this->pauseCtx.bombersNotebookOpen = false; - sHireso.unk_00 = 0; - this->msgCtx.msgLength = 0; - this->msgCtx.msgMode = 0; - this->msgCtx.currentTextId = 0; - this->msgCtx.stateTimer = 0; - play_sound(NA_SE_SY_CANCEL); - } + } else if (CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_L) || + CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_B) || + CHECK_BTN_ALL(CONTROLLER1(&this->state)->press.button, BTN_START) || (gIrqMgrResetStatus != 0)) { + sBombersNotebookOpen = false; + this->pauseCtx.bombersNotebookOpen = false; + sHireso.unk_00 = 0; + this->msgCtx.msgLength = 0; + this->msgCtx.msgMode = 0; + this->msgCtx.currentTextId = 0; + this->msgCtx.stateTimer = 0; + play_sound(NA_SE_SY_CANCEL); } if (sBombersNotebookOpen) { Hireso_Update(this, &sHireso, this->state.input); @@ -1222,7 +1220,7 @@ void Play_Draw(PlayState* this) { gSPSegment(POLY_XLU_DISP++, 0x01, this->billboardMtx); gSPSegment(OVERLAY_DISP++, 0x01, this->billboardMtx); - if (1) { + { Gfx* sp218; Gfx* sp214 = POLY_OPA_DISP; @@ -1448,7 +1446,7 @@ void Play_SetupDraw(PlayState* this) { if (D_801FBBD4 != 1) { MsgEvent_SendNullTask(); func_80178818(); - gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIdx % 2); + gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIndex % 2); gfxCtx2->zbuffer = SysCfb_GetZBuffer(); gfxCtx2->viMode = D_801FBB88; gfxCtx2->viConfigFeatures = gViConfigFeatures; @@ -1460,7 +1458,7 @@ void Play_SetupDraw(PlayState* this) { if (D_801FBBD4 != 0) { MsgEvent_SendNullTask(); func_80178750(); - gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIdx % 2); + gfxCtx2->curFrameBuffer = SysCfb_GetFbPtr(gfxCtx2->framebufferIndex % 2); gfxCtx2->zbuffer = SysCfb_GetZBuffer(); gfxCtx2->viMode = D_801FBB88; gfxCtx2->viConfigFeatures = gViConfigFeatures;