Mirrored world enhancement (#1569)

* Mirrored world PoC

* invert culling for health meter and A button action

* A few more fixes

* Fix for item equip animations

* Fix for pause triforce

* Mirror scenes with static backgrounds

* mirror minimap for mirror world

* mirror dungeon maps and icons on the pause menu

* mirror overworld map and icons on the pause menu

* mirror debug world movement

* mirror shops cursor and movement

* use flip flag

* Reverse crouch stab x axis for mirror mode

* use invert culling command and clean up culling logic

* Move mirror mode handler to mods and support random modes

* Small cvar tweaks

* mirror billboard score numbers and fix gyro horse mirrored inputs

---------

Co-authored-by: Adam Bird <archez39@me.com>
This commit is contained in:
Garrett Cox
2023-06-13 07:46:15 -05:00
committed by GitHub
parent 90d45d4397
commit 7a41bd3878
22 changed files with 363 additions and 84 deletions

View File

@@ -1473,6 +1473,17 @@ void Play_Draw(PlayState* play) {
func_800AA460(&play->view, play->view.fovy, play->view.zNear, play->lightCtx.fogFar);
func_800AAA50(&play->view, 15);
// Flip the projections and invert culling for the OPA and XLU display buffers
// These manage the world and effects
if (CVarGetInteger("gMirroredWorld", 0)) {
gSPSetExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING);
gSPSetExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING);
gSPMatrix(POLY_OPA_DISP++, play->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(POLY_XLU_DISP++, play->view.projectionFlippedPtr, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);
gSPMatrix(POLY_OPA_DISP++, play->view.viewingPtr, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
gSPMatrix(POLY_XLU_DISP++, play->view.viewingPtr, G_MTX_NOPUSH | G_MTX_MUL | G_MTX_PROJECTION);
}
// The billboard matrix temporarily stores the viewing matrix
Matrix_MtxToMtxF(&play->view.viewing, &play->billboardMtxF);
Matrix_MtxToMtxF(&play->view.projection, &play->viewProjectionMtxF);
@@ -1694,6 +1705,12 @@ void Play_Draw(PlayState* play) {
}
}
}
// Reset the inverted culling
if (CVarGetInteger("gMirroredWorld", 0)) {
gSPClearExtraGeometryMode(POLY_OPA_DISP++, G_EX_INVERT_CULLING);
gSPClearExtraGeometryMode(POLY_XLU_DISP++, G_EX_INVERT_CULLING);
}
}
if (play->view.unk_124 != 0) {