mirror of
https://github.com/ZDoom/raze-gles.git
synced 2024-11-11 07:11:39 +00:00
Polymer: factor out wall y panning coefficient calculation.
Non-pow2 wall/mask drawing in classic introduced cases where walls are drawn "incorrectly" because they were constructed with the old behavior in mind. Polymer appears to "correct" for it partially, but doesn't cover all cases. Specifically, now we have: - E1L1 first inside secret room (5000, 50000): Polymer draws like Duke 1.5, classic now draws with an offset. - E3L2 near the vault (-20000, 25000): both classic and Polymer draw with offsets compared to Duke 1.5, but they're different! This means that more research is needed into what makes these two cases diverge, even though both have the same root cause. !!! Also, mappers should abstain from using non-power-of two textures on walls until this issue is resolved in a satisfactory fashion !!! git-svn-id: https://svn.eduke32.com/eduke32@2811 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
parent
6ed9241f0a
commit
dfdcce090b
1 changed files with 18 additions and 35 deletions
|
@ -2721,6 +2721,20 @@ static int32_t polymer_initwall(int16_t wallnum)
|
|||
return (1);
|
||||
}
|
||||
|
||||
static float calc_ypancoef(char curypanning, int16_t curpicnum)
|
||||
{
|
||||
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);
|
||||
|
||||
ypancoef *= (float)curypanning / (256.0f * (float)tilesizy[curpicnum]);
|
||||
|
||||
return ypancoef;
|
||||
}
|
||||
|
||||
static void polymer_updatewall(int16_t wallnum)
|
||||
{
|
||||
int16_t nwallnum, nnwallnum, curpicnum, wallpicnum, walloverpicnum, nwallpicnum;
|
||||
|
@ -2861,15 +2875,7 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
}
|
||||
|
||||
if (wal->ypanning)
|
||||
{
|
||||
ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
|
||||
if (ypancoef < tilesizy[curpicnum])
|
||||
ypancoef *= 2;
|
||||
curypanning = wal->ypanning;
|
||||
if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef))
|
||||
curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef);
|
||||
ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum]));
|
||||
}
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -2934,14 +2940,7 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
yref = nsec->floorz;
|
||||
|
||||
if (curypanning)
|
||||
{
|
||||
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);
|
||||
ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum]));
|
||||
}
|
||||
ypancoef = calc_ypancoef(curypanning, curpicnum);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -3021,15 +3020,7 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
yref = nsec->ceilingz;
|
||||
|
||||
if (wal->ypanning)
|
||||
{
|
||||
ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
|
||||
if (ypancoef < tilesizy[curpicnum])
|
||||
ypancoef *= 2;
|
||||
curypanning = wal->ypanning;
|
||||
if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef))
|
||||
curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef);
|
||||
ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum]));
|
||||
}
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
@ -3074,15 +3065,7 @@ static void polymer_updatewall(int16_t wallnum)
|
|||
curpicnum = walloverpicnum;
|
||||
|
||||
if (wal->ypanning)
|
||||
{
|
||||
ypancoef = (float)(pow2long[picsiz[curpicnum] >> 4]);
|
||||
if (ypancoef < tilesizy[curpicnum])
|
||||
ypancoef *= 2;
|
||||
curypanning = wal->ypanning;
|
||||
if (curypanning > 256 - (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef))
|
||||
curypanning -= (ypancoef - tilesizy[curpicnum]) * (256.0f / ypancoef);
|
||||
ypancoef *= (float)(curypanning) / (256.0f * (float)(tilesizy[curpicnum]));
|
||||
}
|
||||
ypancoef = calc_ypancoef(wal->ypanning, curpicnum);
|
||||
else
|
||||
ypancoef = 0;
|
||||
|
||||
|
|
Loading…
Reference in a new issue