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
+28
View File
@@ -296,6 +296,7 @@ s32 func_800AAA9C(View* view) {
s32 height;
Vp* vp;
Mtx* projection;
Mtx* projectionFlipped;
Mtx* viewing;
GraphicsContext* gfxCtx = view->gfxCtx;
@@ -313,8 +314,11 @@ s32 func_800AAA9C(View* view) {
gSPViewport(POLY_KAL_DISP++, vp);
projection = Graph_Alloc(gfxCtx, sizeof(Mtx));
projectionFlipped = Graph_Alloc(gfxCtx, sizeof(Mtx));
LOG_CHECK_NULL_POINTER("projection", projection);
LOG_CHECK_NULL_POINTER("projectionFlipped", projectionFlipped);
view->projectionPtr = projection;
view->projectionFlippedPtr = projectionFlipped;
width = view->viewport.rightX - view->viewport.leftX;
height = view->viewport.bottomY - view->viewport.topY;
@@ -427,6 +431,15 @@ s32 func_800AAA9C(View* view) {
}
osSyncPrintf("\n");
}
if (CVarGetInteger("gMirroredWorld", 0)) {
MtxF flipF;
SkinMatrix_Clear(&flipF);
flipF.xx = -1.0;
MtxF projectionF;
Matrix_MtxToMtxF(projection, &projectionF);
SkinMatrix_MtxFMtxFMult(&projectionF, &flipF, &projectionF);
Matrix_MtxFToMtx(&projectionF, projectionFlipped);
}
view->projection = *projection;
@@ -511,6 +524,7 @@ s32 func_800AB0A8(View* view) {
s32 func_800AB2C4(View* view) {
Vp* vp;
Mtx* projection;
Mtx* projectionFlipped;
GraphicsContext* gfxCtx;
gfxCtx = view->gfxCtx;
@@ -528,12 +542,26 @@ s32 func_800AB2C4(View* view) {
gSPViewport(OVERLAY_DISP++, vp);
projection = Graph_Alloc(gfxCtx, sizeof(Mtx));
projectionFlipped = Graph_Alloc(gfxCtx, sizeof(Mtx));
LOG_CHECK_NULL_POINTER("projection", projection);
LOG_CHECK_NULL_POINTER("projectionFlipped", projectionFlipped);
view->projectionPtr = projection;
view->projectionFlippedPtr = projectionFlipped;
guOrtho(projection, -(f32)gScreenWidth * 0.5f, (f32)gScreenWidth * 0.5f, -(f32)gScreenHeight * 0.5f,
(f32)gScreenHeight * 0.5f, -30, view->zFar, view->scale);
// This is for z-targeting
if (CVarGetInteger("gMirroredWorld", 0)) {
MtxF flipF;
SkinMatrix_Clear(&flipF);
flipF.xx = -1.0;
MtxF projectionF;
Matrix_MtxToMtxF(projection, &projectionF);
SkinMatrix_MtxFMtxFMult(&projectionF, &flipF, &projectionF);
Matrix_MtxFToMtx(&projectionF, projectionFlipped);
}
view->projection = *projection;
gSPMatrix(OVERLAY_DISP++, projection, G_MTX_NOPUSH | G_MTX_LOAD | G_MTX_PROJECTION);