Ensure the cached float cast variables introduced in r4656 are updated any time the integer versions are.

This fixes the infinite loop when viewing an HUD model at a point when displayrooms is not running, such as the main menu upon initial game load.

git-svn-id: https://svn.eduke32.com/eduke32@5876 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
hendricks266 2016-10-03 02:43:42 +00:00
parent f5363194ff
commit b768c35175
2 changed files with 22 additions and 6 deletions

View file

@ -7845,6 +7845,10 @@ void set_globalang(int16_t ang)
globalang = ang&2047;
cosglobalang = sintable[(globalang+512)&2047];
singlobalang = sintable[globalang&2047];
#ifdef USE_OPENGL
fcosglobalang = (float) cosglobalang;
fsinglobalang = (float) singlobalang;
#endif
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
}
@ -9785,11 +9789,12 @@ int32_t setgamemode(char davidoption, int32_t daxdim, int32_t daydim, int32_t da
else if (dabpp == 8 && j > 8) rendmode = REND_CLASSIC;
#endif
xdim = daxdim; ydim = daydim;
xdim = daxdim;
ydim = daydim;
#ifdef USE_OPENGL
fxdim = (float) xdim;
fydim = (float) ydim;
fxdim = (float) daxdim;
fydim = (float) daydim;
#endif
initsmost();
@ -11979,6 +11984,9 @@ void setaspect(int32_t daxrange, int32_t daaspect)
{
viewingrange = daxrange;
viewingrangerecip = divscale32(1,daxrange);
#ifdef USE_OPENGL
fviewingrange = (float) daxrange;
#endif
yxaspect = daaspect;
xyaspect = divscale32(1,yxaspect);
@ -12620,6 +12628,11 @@ void qsetmodeany(int32_t daxdim, int32_t daydim)
xdim = xres;
ydim = yres;
#ifdef USE_OPENGL
fxdim = (float) xres;
fydim = (float) yres;
#endif
initsmost();
ydim16 = yres - STATUS2DSIZ2;

View file

@ -3887,6 +3887,8 @@ void polymost_drawrooms()
bglColorMask(1,0,0,1);
globalposx += singlobalang>>10;
globalposy -= cosglobalang>>10;
fglobalposx = (float) globalposx;
fglobalposy = (float) globalposy;
}
else
{
@ -3894,19 +3896,18 @@ void polymost_drawrooms()
bglColorMask(0,1,1,1);
globalposx -= singlobalang>>10;
globalposy += cosglobalang>>10;
fglobalposx = (float) globalposx;
fglobalposy = (float) globalposy;
}
}
#endif
//Polymost supports true look up/down :) Here, we convert horizon to angle.
//gchang&gshang are cos&sin of this angle (respectively)
fviewingrange = (float) viewingrange;
gyxscale = ((float)xdimenscale)*(1.0f/131072.f);
gxyaspect = ((float)xyaspect*fviewingrange)*(5.f/(65536.f*262144.f));
gviewxrange = fviewingrange * fxdimen * (1.f/(32768.f*1024.f));
fcosglobalang = (float) cosglobalang;
gcosang = fcosglobalang*(1.0f/262144.f);
fsinglobalang = (float) singlobalang;
gsinang = fsinglobalang*(1.0f/262144.f);
gcosang2 = gcosang * (fviewingrange * (1.0f/65536.f));
gsinang2 = gsinang * (fviewingrange * (1.0f/65536.f));
@ -4979,6 +4980,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
int const ogpal = globalpal; globalpal = (int32_t) ((uint8_t) dapalnum);
float const ogxyaspect = gxyaspect; gxyaspect = 1.f;
int const oldviewingrange = viewingrange; viewingrange = 65536;
float const oldfviewingrange = fviewingrange; fviewingrange = 65536.f;
vec1 = hud->add;
@ -5164,6 +5166,7 @@ void polymost_dorotatespritemodel(int32_t sx, int32_t sy, int32_t z, int16_t a,
if (!nofog) bglEnable(GL_FOG);
viewingrange = oldviewingrange;
fviewingrange = oldfviewingrange;
gxyaspect = ogxyaspect;
globalshade = ogshade;
globalpal = ogpal;