From 525c1bc62309b17513d6ea22b3f9d0ffbfc0d2ee Mon Sep 17 00:00:00 2001 From: Garrett Cox Date: Sat, 15 Aug 2026 08:02:20 -0500 Subject: Toggle for screen distortion (#1880) --- mm/src/code/z_quake.c | 22 +++++++++++++--------- 1 file changed, 13 insertions(+), 9 deletions(-) (limited to 'mm/src/code') diff --git a/mm/src/code/z_quake.c b/mm/src/code/z_quake.c index 3b09d08e8..64d8773c7 100644 --- a/mm/src/code/z_quake.c +++ b/mm/src/code/z_quake.c @@ -3,6 +3,8 @@ #include "z64quake.h" #include "z64view.h" +#include "2s2h/GameInteractor/GameInteractor.h" + typedef struct { /* 0x00 */ s16 index; /* 0x02 */ s16 duration; @@ -878,15 +880,17 @@ void Distortion_Update(void) { depthPhase += CAM_DEG_TO_BINANG(depthPhaseStep); screenPlanePhase += CAM_DEG_TO_BINANG(screenPlanePhaseStep); - View_SetDistortionOrientation(&sDistortionRequest.play->view, - Math_CosS(depthPhase) * (DEG_TO_RAD(rotX) * xyScaleFactor), - Math_SinS(depthPhase) * (DEG_TO_RAD(rotY) * xyScaleFactor), - Math_SinS(screenPlanePhase) * (DEG_TO_RAD(rotZ) * zScaleFactor)); - View_SetDistortionScale(&sDistortionRequest.play->view, - (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, - (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, - (Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f); - View_SetDistortionSpeed(&sDistortionRequest.play->view, speed * speedScaleFactor); + if (GameInteractor_Should(VB_APPLY_SCREEN_DISTORTION, true, sDistortionRequest.type)) { + View_SetDistortionOrientation(&sDistortionRequest.play->view, + Math_CosS(depthPhase) * (DEG_TO_RAD(rotX) * xyScaleFactor), + Math_SinS(depthPhase) * (DEG_TO_RAD(rotY) * xyScaleFactor), + Math_SinS(screenPlanePhase) * (DEG_TO_RAD(rotZ) * zScaleFactor)); + View_SetDistortionScale(&sDistortionRequest.play->view, + (Math_SinS(screenPlanePhase) * (xScale * xyScaleFactor)) + 1.0f, + (Math_CosS(screenPlanePhase) * (yScale * xyScaleFactor)) + 1.0f, + (Math_CosS(depthPhase) * (zScale * zScaleFactor)) + 1.0f); + View_SetDistortionSpeed(&sDistortionRequest.play->view, speed * speedScaleFactor); + } sDistortionRequest.state = DISTORTION_ACTIVE; -- cgit v1.2.3