mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-12-24 10:40:46 +00:00
Polymer: bring the ypanning correction for non-pow2 walls closer to Pmost's, pt1
This makes the corrections conditional on where they appear in (under-, over-, white or mask wall). git-svn-id: https://svn.eduke32.com/eduke32@2821 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6bafc7d176
commit
fe1a5fe2a6
2 changed files with 17 additions and 7 deletions
|
@ -2721,14 +2721,16 @@ static int32_t polymer_initwall(int16_t wallnum)
|
|||
return (1);
|
||||
}
|
||||
|
||||
static float calc_ypancoef(char curypanning, int16_t curpicnum)
|
||||
static float calc_ypancoef(char curypanning, int16_t curpicnum, int32_t dopancor)
|
||||
{
|
||||
float ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
|
||||
|
||||
if (ypancoef < tilesizy[curpicnum])
|
||||
ypancoef *= 2;
|
||||
if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef))
|
||||
curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef);
|
||||
|
||||
if (dopancor)
|
||||
if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef))
|
||||
curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef);
|
||||
|
||||
ypancoef *= (float)curypanning / (256.0f * (float)tilesizy[curpicnum]);
|
||||
|
||||
|
@ -2875,7 +2877,8 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
}
|
||||
|
||||
if (wal->ypanning)
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
// white
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum, !(wal->cstat & 4));
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -2940,7 +2943,8 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
yref = nsec->floorz;
|
||||
|
||||
if (curypanning)
|
||||
ypancoef = calc_ypancoef(curypanning, curpicnum);
|
||||
// under
|
||||
ypancoef = calc_ypancoef(curypanning, curpicnum, !(wall[nwallnum].cstat & 4));
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -3020,7 +3024,8 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
yref = nsec->ceilingz;
|
||||
|
||||
if (wal->ypanning)
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
// over
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum, wal->cstat & 4);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -3065,7 +3070,8 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
curpicnum = walloverpicnum;
|
||||
|
||||
if (wal->ypanning)
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
// mask
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum, 0);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
|
|
@ -4082,6 +4082,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
|
||||
if (!(wal->cstat&4)) i = sector[nextsectnum].ceilingz; else i = sec->ceilingz;
|
||||
|
||||
// over
|
||||
calc_ypanning(i, ryp0, ryp1, x0, x1, wal->ypanning, wal->yrepeat, wal->cstat&4);
|
||||
|
||||
if (wal->cstat&8) //xflip
|
||||
|
@ -4118,6 +4119,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
|
||||
if (!(nwal->cstat&4)) i = sector[nextsectnum].floorz; else i = sec->ceilingz;
|
||||
|
||||
// under
|
||||
calc_ypanning(i, ryp0, ryp1, x0, x1, nwal->ypanning, wal->yrepeat, !(nwal->cstat&4));
|
||||
|
||||
if (wal->cstat&8) //xflip
|
||||
|
@ -4150,6 +4152,7 @@ static void polymost_drawalls(int32_t bunch)
|
|||
if (nextsectnum >= 0) { if (!(wal->cstat&4)) i = nextsec->ceilingz; else i = sec->ceilingz; }
|
||||
else { if (!(wal->cstat&4)) i = sec->ceilingz; else i = sec->floorz; }
|
||||
|
||||
// white
|
||||
calc_ypanning(i, ryp0, ryp1, x0, x1, wal->ypanning, wal->yrepeat, !(wal->cstat&4));
|
||||
|
||||
if (wal->cstat&8) //xflip
|
||||
|
@ -4717,6 +4720,7 @@ void polymost_drawmaskwall(int32_t damaskwallcnt)
|
|||
|
||||
if (!(wal->cstat&4)) i = z1; else i = z2;
|
||||
|
||||
// mask
|
||||
calc_ypanning(i, ryp0, ryp1, x0, x1, wal->ypanning, wal->yrepeat, 0);
|
||||
|
||||
if (wal->cstat&8) //xflip
|
||||
|
|
Loading…
Reference in a new issue