From 7a23c39b9e4132640b32b15bb7c43f22a7188bab Mon Sep 17 00:00:00 2001 From: LittlePlanetCD Date: Thu, 21 Mar 2024 23:05:22 -0500 Subject: [PATCH] revise parallax fix to match original engine fr --- RSDKv3/Drawing.cpp | 4 +++- RSDKv3/Scene.cpp | 11 ++--------- RSDKv3/Scene.hpp | 1 - 3 files changed, 5 insertions(+), 11 deletions(-) diff --git a/RSDKv3/Drawing.cpp b/RSDKv3/Drawing.cpp index 90ff7adf..f088a730 100644 --- a/RSDKv3/Drawing.cpp +++ b/RSDKv3/Drawing.cpp @@ -2108,6 +2108,7 @@ void DrawHLineScrollLayer(int layerID) int fullLayerwidth = layerwidth << 7; for (int i = 0; i < hParallax.entryCount; ++i) { hParallax.linePos[i] = xScrollOffset * hParallax.parallaxFactor[i] >> 8; + hParallax.scrollPos[i] += hParallax.scrollSpeed[i]; if (hParallax.scrollPos[i] > fullLayerwidth << 16) hParallax.scrollPos[i] -= fullLayerwidth << 16; if (hParallax.scrollPos[i] < 0) @@ -2648,6 +2649,7 @@ void DrawHLineScrollLayer(int layerID) layerWidth = layerWidth << 7; for (int i = 0; i < hParallax.entryCount; i++) { hParallax.linePos[i] = hParallax.parallaxFactor[i] * xScrollOffset >> 8; + hParallax.scrollPos[i] = hParallax.scrollPos[i] + hParallax.scrollSpeed[i]; if (hParallax.scrollPos[i] > layerWidth << 16) { hParallax.scrollPos[i] = hParallax.scrollPos[i] - (layerWidth << 16); } @@ -3458,7 +3460,7 @@ void DrawVLineScrollLayer(int layerID) int fullLayerheight = layerheight << 7; for (int i = 0; i < vParallax.entryCount; ++i) { vParallax.linePos[i] = yScrollOffset * vParallax.parallaxFactor[i] >> 8; - + vParallax.scrollPos[i] += vParallax.scrollSpeed[i]; vParallax.scrollPos[i] += vParallax.scrollPos[i] << 16; if (vParallax.scrollPos[i] > fullLayerheight << 16) vParallax.scrollPos[i] -= fullLayerheight << 16; diff --git a/RSDKv3/Scene.cpp b/RSDKv3/Scene.cpp index 77676abc..9435e1a4 100644 --- a/RSDKv3/Scene.cpp +++ b/RSDKv3/Scene.cpp @@ -268,7 +268,6 @@ void ProcessStage(void) // Update ProcessObjects(); - ProcessParallaxAutoScroll(); if (cameraTarget > -1) { if (cameraEnabled == 1) { @@ -339,12 +338,6 @@ void ProcessStage(void) Engine.frameCount++; } -void ProcessParallaxAutoScroll() -{ - for (int i = 0; i < hParallax.entryCount; ++i) hParallax.scrollPos[i] += hParallax.scrollSpeed[i]; - for (int i = 0; i < vParallax.entryCount; ++i) vParallax.scrollPos[i] += vParallax.scrollSpeed[i]; -} - void LoadStageFiles(void) { StopAllSfx(); @@ -755,7 +748,7 @@ void LoadStageBackground() FileRead(&fileBuffer, 1); hParallax.parallaxFactor[i] = fileBuffer << 8; FileRead(&fileBuffer, 1); - hParallax.parallaxFactor[i] |= fileBuffer; + hParallax.parallaxFactor[i] += fileBuffer; FileRead(&fileBuffer, 1); hParallax.scrollSpeed[i] = fileBuffer << 10; @@ -770,7 +763,7 @@ void LoadStageBackground() FileRead(&fileBuffer, 1); vParallax.parallaxFactor[i] = fileBuffer << 8; FileRead(&fileBuffer, 1); - vParallax.parallaxFactor[i] |= fileBuffer; + vParallax.parallaxFactor[i] += fileBuffer; FileRead(&fileBuffer, 1); vParallax.scrollSpeed[i] = fileBuffer << 10; diff --git a/RSDKv3/Scene.hpp b/RSDKv3/Scene.hpp index ecb35bb9..ca675d32 100644 --- a/RSDKv3/Scene.hpp +++ b/RSDKv3/Scene.hpp @@ -201,7 +201,6 @@ extern bool drawStageGFXHQ; void InitFirstStage(); void ProcessStage(); -void ProcessParallaxAutoScroll(); void ResetBackgroundSettings(); inline void ResetCurrentStageFolder() { strcpy(currentStageFolder, ""); }