mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-25 03:00:46 +00:00
engine/Polymer: factor out setting {cos,sin}*globalang into set_globalang().
git-svn-id: https://svn.eduke32.com/eduke32@3471 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
157aa207e4
commit
05c920cf92
3 changed files with 16 additions and 32 deletions
|
@ -8500,6 +8500,15 @@ void initspritelists(void)
|
|||
}
|
||||
|
||||
|
||||
void set_globalang(int16_t ang)
|
||||
{
|
||||
globalang = ang&2047;
|
||||
cosglobalang = sintable[(globalang+512)&2047];
|
||||
singlobalang = sintable[globalang&2047];
|
||||
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
|
||||
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
|
||||
}
|
||||
|
||||
//
|
||||
// drawrooms
|
||||
//
|
||||
|
@ -8515,7 +8524,7 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
indrawroomsandmasks = 1;
|
||||
|
||||
globalposx = daposx; globalposy = daposy; globalposz = daposz;
|
||||
globalang = (daang&2047);
|
||||
set_globalang(daang);
|
||||
|
||||
global100horiz = dahoriz;
|
||||
|
||||
|
@ -8557,11 +8566,6 @@ int32_t drawrooms(int32_t daposx, int32_t daposy, int32_t daposz,
|
|||
globalcursectnum = dacursectnum;
|
||||
totalclocklock = totalclock;
|
||||
|
||||
cosglobalang = sintable[(globalang+512)&2047];
|
||||
singlobalang = sintable[globalang&2047];
|
||||
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
|
||||
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
|
||||
|
||||
if ((xyaspect != oxyaspect) || (xdimen != oxdimen) || (viewingrange != oviewingrange))
|
||||
dosetaspect();
|
||||
|
||||
|
|
|
@ -87,6 +87,8 @@ void calc_and_apply_fog_factor(int32_t shade, int32_t vis, int32_t pal, float fa
|
|||
int32_t wallfront(int32_t l1, int32_t l2);
|
||||
int32_t animateoffs(int16_t tilenum, int16_t fakevar);
|
||||
|
||||
void set_globalang(int16_t ang);
|
||||
|
||||
#define DO_TILE_ANIM(Picnum, Fakevar) do { \
|
||||
if (picanm[Picnum].sf&PICANM_ANIMTYPE_MASK) Picnum += animateoffs(Picnum, Fakevar); \
|
||||
} while (0)
|
||||
|
|
|
@ -1087,11 +1087,7 @@ void polymer_drawrooms(int32_t daposx, int32_t daposy, int32_t da
|
|||
|
||||
// build globals used by rotatesprite
|
||||
viewangle = daang;
|
||||
globalang = (daang&2047);
|
||||
cosglobalang = sintable[(globalang+512)&2047];
|
||||
singlobalang = sintable[globalang&2047];
|
||||
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
|
||||
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
|
||||
set_globalang(daang);
|
||||
|
||||
// polymost globals used by polymost_dorotatesprite
|
||||
gcosang = ((double)cosglobalang)/262144.0;
|
||||
|
@ -1953,11 +1949,7 @@ static void polymer_displayrooms(int16_t dacursectnum)
|
|||
|
||||
if (depth)
|
||||
{
|
||||
// drawmasks needs these
|
||||
cosglobalang = sintable[(viewangle+512)&2047];
|
||||
singlobalang = sintable[viewangle&2047];
|
||||
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
|
||||
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
|
||||
set_globalang(viewangle);
|
||||
|
||||
if (mirrors[depth - 1].plane)
|
||||
display_mirror = 1;
|
||||
|
@ -5554,8 +5546,6 @@ static inline void polymer_culllight(int16_t lighti)
|
|||
static void polymer_prepareshadows(void)
|
||||
{
|
||||
int16_t oviewangle, oglobalang;
|
||||
int32_t ocosglobalang, osinglobalang;
|
||||
int32_t ocosviewingrangeglobalang, osinviewingrangeglobalang;
|
||||
int32_t i, j, k;
|
||||
int32_t gx, gy, gz;
|
||||
int32_t oldoverridematerial;
|
||||
|
@ -5567,10 +5557,6 @@ static void polymer_prepareshadows(void)
|
|||
// build globals used by drawmasks
|
||||
oviewangle = viewangle;
|
||||
oglobalang = globalang;
|
||||
ocosglobalang = cosglobalang;
|
||||
osinglobalang = singlobalang;
|
||||
ocosviewingrangeglobalang = cosviewingrangeglobalang;
|
||||
osinviewingrangeglobalang = sinviewingrangeglobalang;
|
||||
|
||||
i = j = k = 0;
|
||||
|
||||
|
@ -5607,11 +5593,7 @@ static void polymer_prepareshadows(void)
|
|||
|
||||
// build globals used by rotatesprite
|
||||
viewangle = prlights[i].angle;
|
||||
globalang = (prlights[i].angle&2047);
|
||||
cosglobalang = sintable[(globalang+512)&2047];
|
||||
singlobalang = sintable[globalang&2047];
|
||||
cosviewingrangeglobalang = mulscale16(cosglobalang,viewingrange);
|
||||
sinviewingrangeglobalang = mulscale16(singlobalang,viewingrange);
|
||||
set_globalang(prlights[i].angle);
|
||||
|
||||
oldoverridematerial = overridematerial;
|
||||
// smooth model shadows
|
||||
|
@ -5646,11 +5628,7 @@ static void polymer_prepareshadows(void)
|
|||
globalposz = gz;
|
||||
|
||||
viewangle = oviewangle;
|
||||
globalang = oglobalang;
|
||||
cosglobalang = ocosglobalang;
|
||||
singlobalang = osinglobalang;
|
||||
cosviewingrangeglobalang = ocosviewingrangeglobalang;
|
||||
sinviewingrangeglobalang = osinviewingrangeglobalang;
|
||||
set_globalang(oglobalang);
|
||||
}
|
||||
|
||||
// RENDER TARGETS
|
||||
|
|
Loading…
Reference in a new issue