diff --git a/source/build/include/buildtypes.h b/source/build/include/buildtypes.h index c0083e426..da0ca8a5a 100644 --- a/source/build/include/buildtypes.h +++ b/source/build/include/buildtypes.h @@ -46,6 +46,10 @@ struct sectortype int ceilingypan() const { return int(ceilingypan_); } int floorxpan() const { return int(floorxpan_); } int floorypan() const { return int(floorypan_); } + void setfloorxpan(float val) { floorxpan_ = fmod(val + 512, 256); } // +512 is for handling negative offsets + void setfloorypan(float val) { floorypan_ = fmod(val + 512, 256); } // +512 is for handling negative offsets + void setceilingxpan(float val) { ceilingxpan_ = fmod(val + 512, 256); } // +512 is for handling negative offsets + void setceilingypan(float val) { ceilingypan_ = fmod(val + 512, 256); } // +512 is for handling negative offsets void addfloorxpan(float add) { floorxpan_ = fmod(floorxpan_ + add + 512, 256); } // +512 is for handling negative offsets void addfloorypan(float add) { floorypan_ = fmod(floorypan_ + add + 512, 256); } // +512 is for handling negative offsets void addceilingxpan(float add) { ceilingxpan_ = fmod(ceilingxpan_ + add + 512, 256); } // +512 is for handling negative offsets diff --git a/source/games/duke/src/sectors.cpp b/source/games/duke/src/sectors.cpp index 2963fa2f2..d38bc9d70 100644 --- a/source/games/duke/src/sectors.cpp +++ b/source/games/duke/src/sectors.cpp @@ -1261,8 +1261,8 @@ void moveclouds(double smoothratio) cloudy += ps[screenpeek].angle.ang.bsin(-9); for (int i = 0; i < numclouds; i++) { - sector[clouds[i]].addceilingxpan(cloudx / 64.f); - sector[clouds[i]].addceilingypan(cloudy / 64.f); + sector[clouds[i]].setceilingxpan(cloudx / 64.f); + sector[clouds[i]].setceilingypan(cloudy / 64.f); } } }