From 71c3441b1e3bd8739efee2cdddb587e89d907f7d Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 31 Aug 2020 19:22:21 +0200 Subject: [PATCH] - transitioned cloudclock. This timer runs at 60 Hz in the render code, so it needs to take smoothratio into account. --- source/games/duke/src/funct.h | 2 +- source/games/duke/src/sectors.cpp | 8 +++++--- 2 files changed, 6 insertions(+), 4 deletions(-) diff --git a/source/games/duke/src/funct.h b/source/games/duke/src/funct.h index 4cd6c2884..07ddd95ef 100644 --- a/source/games/duke/src/funct.h +++ b/source/games/duke/src/funct.h @@ -23,7 +23,7 @@ void resetlanepics(void); void moveplayers(); void doanimations(); void movefx(); -void moveclouds(void); +void moveclouds(double smoothratio); void RANDOMSCRAP(spritetype* s, int i); void ms(short i); diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 9df3f8346..801ceeee7 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1140,11 +1140,13 @@ void allignwarpelevators(void) // //--------------------------------------------------------------------------- -void moveclouds(void) +void moveclouds(double smoothratio) { - if (gameclock > cloudclock || gameclock < (cloudclock - 7)) + // The math here is very messy... :( + int myclock = smoothratio < 32768? ud.levelclock-2 : ud.levelclock; + if (myclock > cloudclock || myclock < (cloudclock - 7)) { - cloudclock = gameclock + 6; + cloudclock = myclock + 6; // cloudx/y were an array, but all entries were always having the same value so a single pair is enough. cloudx += (sintable[(ps[screenpeek].getang() + 512) & 2047] >> 9);