1
0
Fork 0
mirror of https://github.com/zeldaret/oot.git synced 2024-11-10 19:20:13 +00:00

Cleanup?: Use gotos in z_play for large else blocks (#1486)

* remove else when using `goto Play_Draw_DrawOverlayElements`

* Add `goto Play_Draw_skip`, use on prerender save

* format
This commit is contained in:
Dragorn421 2023-08-13 16:35:38 +02:00 committed by GitHub
parent 63606af10d
commit b8c1440d1e
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -1118,7 +1118,8 @@ void Play_Draw(PlayState* this) {
TransitionTile_Draw(&sTransitionTile, &sp88); TransitionTile_Draw(&sTransitionTile, &sp88);
POLY_OPA_DISP = sp88; POLY_OPA_DISP = sp88;
goto Play_Draw_DrawOverlayElements; goto Play_Draw_DrawOverlayElements;
} else { }
PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, gZBuffer); PreRender_SetValues(&this->pauseBgPreRender, SCREEN_WIDTH, SCREEN_HEIGHT, gfxCtx->curFrameBuffer, gZBuffer);
if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_PROCESS) { if (R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_PROCESS) {
@ -1141,15 +1142,14 @@ void Play_Draw(PlayState* this) {
POLY_OPA_DISP = gfxP; POLY_OPA_DISP = gfxP;
goto Play_Draw_DrawOverlayElements; goto Play_Draw_DrawOverlayElements;
} else { }
s32 roomDrawFlags;
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) { if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_SKYBOX) {
if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) { if (this->skyboxId && (this->skyboxId != SKYBOX_UNSET_1D) && !this->envCtx.skyboxDisabled) {
if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) { if ((this->skyboxId == SKYBOX_NORMAL_SKY) || (this->skyboxId == SKYBOX_CUTSCENE_MAP)) {
Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx); Environment_UpdateSkybox(this->skyboxId, &this->envCtx, &this->skyboxCtx);
Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.skyboxBlend, Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, this->envCtx.skyboxBlend, this->view.eye.x,
this->view.eye.x, this->view.eye.y, this->view.eye.z); this->view.eye.y, this->view.eye.z);
} else if (this->skyboxCtx.drawType == SKYBOX_DRAW_128) { } else if (this->skyboxCtx.drawType == SKYBOX_DRAW_128) {
Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, this->view.eye.y, Skybox_Draw(&this->skyboxCtx, gfxCtx, this->skyboxId, 0, this->view.eye.x, this->view.eye.y,
this->view.eye.z); this->view.eye.z);
@ -1180,6 +1180,8 @@ void Play_Draw(PlayState* this) {
if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) { if ((R_HREG_MODE != HREG_MODE_PLAY) || (R_PLAY_DRAW_ROOM_FLAGS != 0)) {
if (VREG(94) == 0) { if (VREG(94) == 0) {
s32 roomDrawFlags;
if (R_HREG_MODE != HREG_MODE_PLAY) { if (R_HREG_MODE != HREG_MODE_PLAY) {
roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU; roomDrawFlags = ROOM_DRAW_OPA | ROOM_DRAW_XLU;
} else { } else {
@ -1232,9 +1234,9 @@ void Play_Draw(PlayState* this) {
switch (this->envCtx.fillScreen) { switch (this->envCtx.fillScreen) {
case 1: case 1:
Environment_FillScreen(gfxCtx, this->envCtx.screenFillColor[0], Environment_FillScreen(gfxCtx, this->envCtx.screenFillColor[0], this->envCtx.screenFillColor[1],
this->envCtx.screenFillColor[1], this->envCtx.screenFillColor[2], this->envCtx.screenFillColor[2], this->envCtx.screenFillColor[3],
this->envCtx.screenFillColor[3], FILL_SCREEN_OPA | FILL_SCREEN_XLU); FILL_SCREEN_OPA | FILL_SCREEN_XLU);
break; break;
default: default:
break; break;
@ -1251,8 +1253,7 @@ void Play_Draw(PlayState* this) {
DebugDisplay_DrawObjects(this); DebugDisplay_DrawObjects(this);
} }
if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || if ((R_PAUSE_BG_PRERENDER_STATE == PAUSE_BG_PRERENDER_SETUP) || (gTransitionTileState == TRANS_TILE_SETUP)) {
(gTransitionTileState == TRANS_TILE_SETUP)) {
Gfx* gfxP = OVERLAY_DISP; Gfx* gfxP = OVERLAY_DISP;
// Copy the frame buffer contents at this point in the display list to the zbuffer // Copy the frame buffer contents at this point in the display list to the zbuffer
@ -1271,15 +1272,16 @@ void Play_Draw(PlayState* this) {
OVERLAY_DISP = gfxP; OVERLAY_DISP = gfxP;
this->unk_121C7 = 2; this->unk_121C7 = 2;
R_GRAPH_TASKSET00_FLAGS |= 1; R_GRAPH_TASKSET00_FLAGS |= 1;
} else { goto Play_Draw_skip;
}
Play_Draw_DrawOverlayElements: Play_Draw_DrawOverlayElements:
if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) { if ((R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) {
Play_DrawOverlayElements(this); Play_DrawOverlayElements(this);
} }
} }
}
} Play_Draw_skip:
}
if (this->view.unk_124 != 0) { if (this->view.unk_124 != 0) {
Camera_Update(GET_ACTIVE_CAM(this)); Camera_Update(GET_ACTIVE_CAM(this));