mirror of
https://github.com/HackerN64/HackerOoT.git
synced 2026-01-21 10:37:37 -08:00
Fix occlusion planes affecting overlays (pause screen and A button) (#140)
* Fixed occlusion planes culling pause screen and A button * lint * Moved post 3D after goto overlay
This commit is contained in:
@@ -14,7 +14,15 @@ typedef enum F3DEX3OccMode {
|
||||
typedef enum OcclusionPlanePhase {
|
||||
OCCLUSION_PLANE_PHASE_START,
|
||||
OCCLUSION_PLANE_PHASE_POST_SKY,
|
||||
OCCLUSION_PLANE_PHASE_POST_3D,
|
||||
OCCLUSION_PLANE_PHASE_COUNT
|
||||
} OcclusionPlanePhase;
|
||||
|
||||
typedef enum OcclusionPlaneStoredCmdType {
|
||||
OCCLUSION_PLANE_STORED_CMD_SKY_OPA,
|
||||
OCCLUSION_PLANE_STORED_CMD_3D_OPA,
|
||||
OCCLUSION_PLANE_STORED_CMD_3D_XLU,
|
||||
OCCLUSION_PLANE_STORED_CMD_COUNT
|
||||
} OcclusionPlaneStoredCmdType;
|
||||
|
||||
#endif // OCCLUSIONPLANES_H
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
|
||||
#if ENABLE_F3DEX3
|
||||
|
||||
static Gfx* planeCommands[OCCLUSION_PLANE_PHASE_COUNT];
|
||||
static Gfx* planeCommands[OCCLUSION_PLANE_STORED_CMD_COUNT];
|
||||
|
||||
static s32 OcclusionPlane_Choose(PlayState* play, Vec3f* selCandidate) {
|
||||
Vec3f* camPos = &play->view.eye;
|
||||
@@ -599,14 +599,31 @@ void OcclusionPlane_Draw_Phase(PlayState* play, OcclusionPlanePhase phase) {
|
||||
|
||||
GraphicsContext* gfxCtx = play->state.gfxCtx;
|
||||
OPEN_DISPS(gfxCtx, "occlusionplanes.c", __LINE__);
|
||||
planeCommands[phase] = POLY_OPA_DISP;
|
||||
gSPOcclusionPlane(POLY_OPA_DISP++, &sNoOcclusionPlane);
|
||||
CLOSE_DISPS(gfxCtx, "occlusionplanes.c", __LINE__);
|
||||
|
||||
if (phase == OCCLUSION_PLANE_PHASE_START) {
|
||||
// Post sky might not happen in debug
|
||||
planeCommands[OCCLUSION_PLANE_PHASE_POST_SKY] = NULL;
|
||||
switch (phase) {
|
||||
case OCCLUSION_PLANE_PHASE_START:
|
||||
planeCommands[OCCLUSION_PLANE_STORED_CMD_SKY_OPA] = POLY_OPA_DISP;
|
||||
gSPOcclusionPlane(POLY_OPA_DISP++, &sNoOcclusionPlane);
|
||||
|
||||
// Later phases might not happen if debug registers are set up certain way
|
||||
planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_OPA] = NULL;
|
||||
planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_XLU] = NULL;
|
||||
break;
|
||||
case OCCLUSION_PLANE_PHASE_POST_SKY:
|
||||
planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_OPA] = POLY_OPA_DISP;
|
||||
gSPOcclusionPlane(POLY_OPA_DISP++, &sNoOcclusionPlane);
|
||||
planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_XLU] = POLY_XLU_DISP;
|
||||
gSPOcclusionPlane(POLY_XLU_DISP++, &sNoOcclusionPlane);
|
||||
break;
|
||||
case OCCLUSION_PLANE_PHASE_POST_3D:
|
||||
// Need to turn it off in OPA to draw the pause screen
|
||||
gSPOcclusionPlane(POLY_OPA_DISP++, &sNoOcclusionPlane);
|
||||
// Need to turn it off at the end of XLU (for OVL) for the HUD
|
||||
gSPOcclusionPlane(POLY_XLU_DISP++, &sNoOcclusionPlane);
|
||||
break;
|
||||
}
|
||||
|
||||
CLOSE_DISPS(gfxCtx, "occlusionplanes.c", __LINE__);
|
||||
}
|
||||
|
||||
void OcclusionPlane_Draw_PostCamUpdate(PlayState* play) {
|
||||
@@ -638,10 +655,11 @@ void OcclusionPlane_Draw_PostCamUpdate(PlayState* play) {
|
||||
skyPlane->o.ky = 0;
|
||||
skyPlane->o.kz = 0;
|
||||
skyPlane->o.kc = 0x7FFF;
|
||||
((u32*)(planeCommands[OCCLUSION_PLANE_PHASE_START]))[1] = (u32)skyPlane;
|
||||
((u32*)(planeCommands[OCCLUSION_PLANE_STORED_CMD_SKY_OPA]))[1] = (u32)skyPlane;
|
||||
}
|
||||
if (planeCommands[OCCLUSION_PLANE_PHASE_POST_SKY] != NULL) {
|
||||
((u32*)(planeCommands[OCCLUSION_PLANE_PHASE_POST_SKY]))[1] = (u32)mainPlane;
|
||||
if (planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_OPA] != NULL) {
|
||||
((u32*)(planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_OPA]))[1] = (u32)mainPlane;
|
||||
((u32*)(planeCommands[OCCLUSION_PLANE_STORED_CMD_3D_XLU]))[1] = (u32)mainPlane;
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
@@ -1508,6 +1508,10 @@ void Play_Draw(PlayState* this) {
|
||||
}
|
||||
|
||||
Play_Draw_DrawOverlayElements:
|
||||
#if ENABLE_F3DEX3
|
||||
OcclusionPlane_Draw_Phase(this, OCCLUSION_PLANE_PHASE_POST_3D);
|
||||
#endif
|
||||
|
||||
if (!IS_DEBUG || (R_HREG_MODE != HREG_MODE_PLAY) || R_PLAY_DRAW_OVERLAY_ELEMENTS) {
|
||||
Play_DrawOverlayElements(this);
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user