- fixed sky panning in Duke.

This needs to take the composite texture into account because panning in Build is based on tile size, not map dimension.
It was also redone to use floating point to get rid of the horrible precision of the scrolling effect.
This commit is contained in:
Christoph Oelckers 2020-12-06 20:49:32 +01:00
parent 88bed95400
commit 1a2b93f402
4 changed files with 10 additions and 9 deletions

View file

@ -1273,6 +1273,7 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
int32_t dapyscale, dapskybits, dapyoffs, daptileyscale;
int16_t const * dapskyoff = getpsky(globalpicnum, &dapyscale, &dapskybits, &dapyoffs, &daptileyscale);
globalskytex = skytile? nullptr : GetSkyTexture(globalpicnum, dapskybits, dapskyoff);
int realskybits = dapskybits;
if (globalskytex) dapskybits = 0;
ghoriz = (qglobalhoriz*(1.f/65536.f)-float(ydimen>>1))*dapyscale*(1.f/65536.f)+float(ydimen>>1)+ghorizcorrect;
@ -1302,7 +1303,7 @@ static void polymost_flatskyrender(vec2f_t const* const dpxy, int32_t const n, i
}
int const npot = (1<<(widthBits(globalpicnum))) != tileWidth(globalpicnum);
int const xPanning = (hw_parallaxskypanning?global_cf_xpanning:0);
float const xPanning = (hw_parallaxskypanning ? global_cf_xpanning / (1 << (realskybits-dapskybits)) : 0);
int picnumbak = globalpicnum;
ti = globalpicnum;

View file

@ -107,8 +107,8 @@ int animategoal[MAXANIMATES];
int animatevel[MAXANIMATES];
int numclouds; // cloudy skies
int16_t clouds[256];
int16_t cloudx;
int16_t cloudy;
float cloudx;
float cloudy;
int cloudclock;
int numcyclers; // sector lighting effects
int16_t cyclers[MAXCYCLERS][6];

View file

@ -94,8 +94,8 @@ extern int animategoal[MAXANIMATES];
extern int animatevel[MAXANIMATES];
extern int16_t clouds[256];
extern int16_t cloudx;
extern int16_t cloudy;
extern float cloudx;
extern float cloudy;
extern int cloudclock;
extern DDukeActor *spriteq[1024];

View file

@ -1257,12 +1257,12 @@ void moveclouds(double smoothratio)
cloudclock = myclock + 6;
// cloudx/y were an array, but all entries were always having the same value so a single pair is enough.
cloudx += ps[screenpeek].angle.ang.bcos(-9);
cloudy += ps[screenpeek].angle.ang.bsin(-9);
cloudx += ps[screenpeek].angle.ang.fcos() * 0.5f;
cloudy += ps[screenpeek].angle.ang.fsin() * 0.5f;
for (int i = 0; i < numclouds; i++)
{
sector[clouds[i]].setceilingxpan(cloudx / 64.f);
sector[clouds[i]].setceilingypan(cloudy / 64.f);
sector[clouds[i]].setceilingxpan(cloudx);
sector[clouds[i]].setceilingypan(cloudy);
}
}
}