From 827672a775904bf409c7ade3a9422b0e7688f85c Mon Sep 17 00:00:00 2001 From: Christoph Oelckers Date: Mon, 6 Jul 2020 02:05:31 +0200 Subject: [PATCH] - moveclouds. --- source/games/duke/CMakeLists.txt | 1 - source/games/duke/src/sectors.cpp | 24 +++++++++++++++++++ source/games/duke/src/zz_screens.cpp | 23 ++---------------- source/games/duke/src/zz_sector.cpp | 36 ---------------------------- 4 files changed, 26 insertions(+), 58 deletions(-) delete mode 100644 source/games/duke/src/zz_sector.cpp diff --git a/source/games/duke/CMakeLists.txt b/source/games/duke/CMakeLists.txt index a9bbc8743..ab7d46629 100644 --- a/source/games/duke/CMakeLists.txt +++ b/source/games/duke/CMakeLists.txt @@ -51,7 +51,6 @@ set( PCH_SOURCES src/zz_premap.cpp src/zz_savegame.cpp src/zz_screens.cpp - src/zz_sector.cpp ) add_game_library2( duke ) diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index e896f2001..6ee085d12 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1099,6 +1099,30 @@ void allignwarpelevators(void) } } +//--------------------------------------------------------------------------- +// +// +// +//--------------------------------------------------------------------------- + +void moveclouds(void) +{ + if (totalclock > cloudtotalclock || totalclock < (cloudtotalclock - 7)) + { + cloudtotalclock = totalclock + 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); + cloudy += (sintable[ps[screenpeek].getang() & 2047] >> 9); + for (int i = 0; i < numclouds; i++) + { + sector[clouds[i]].ceilingxpanning = cloudx >> 6; + sector[clouds[i]].ceilingypanning = cloudy >> 6; + } + } +} + + END_DUKE_NS diff --git a/source/games/duke/src/zz_screens.cpp b/source/games/duke/src/zz_screens.cpp index 0bbf32b9e..e7c5dd7ac 100644 --- a/source/games/duke/src/zz_screens.cpp +++ b/source/games/duke/src/zz_screens.cpp @@ -117,28 +117,9 @@ static int32_t gtextsc(int32_t sc) ////////// DISPLAYREST ////////// -static inline void G_MoveClouds(void) -{ - int32_t i; - - if (totalclock <= g_cloudClock && totalclock >= (g_cloudClock-7)) - return; - - g_cloudClock = totalclock+6; - - g_cloudX += sintable[(fix16_to_int(g_player[screenpeek].ps->q16ang)+512)&2047]>>9; - g_cloudY += sintable[fix16_to_int(g_player[screenpeek].ps->q16ang)&2047]>>9; - - for (i=numclouds-1; i>=0; i--) - { - sector[clouds[i]].ceilingxpanning = g_cloudX>>6; - sector[clouds[i]].ceilingypanning = g_cloudY>>6; - } -} - - void displayweapon(int snum); +void moveclouds(); void G_DisplayRest(int32_t smoothratio) { @@ -236,7 +217,7 @@ void G_DisplayRest(int32_t smoothratio) fi.displaymasks(screenpeek); } if (!RR) - G_MoveClouds(); + moveclouds(); } if (ud.overhead_on > 0) diff --git a/source/games/duke/src/zz_sector.cpp b/source/games/duke/src/zz_sector.cpp deleted file mode 100644 index fb08ab440..000000000 --- a/source/games/duke/src/zz_sector.cpp +++ /dev/null @@ -1,36 +0,0 @@ -//------------------------------------------------------------------------- -/* -Copyright (C) 2010 EDuke32 developers and contributors - -This file is part of EDuke32. - -EDuke32 is free software; you can redistribute it and/or -modify it under the terms of the GNU General Public License version 2 -as published by the Free Software Foundation. - -This program is distributed in the hope that it will be useful, -but WITHOUT ANY WARRANTY; without even the implied warranty of -MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. - -See the GNU General Public License for more details. - -You should have received a copy of the GNU General Public License -along with this program; if not, write to the Free Software -Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. -*/ -//------------------------------------------------------------------------- -#include "ns.h" // Must come before everything else! - -#define sector_c_ - -#include "duke3d.h" - -#include "secrets.h" -#include "v_video.h" -#include "glbackend/glbackend.h" - -BEGIN_DUKE_NS - - - -END_DUKE_NS