From fe1a5fe2a6da4b26634f5e06f1a5ea00eadd69f8 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 9 Jul 2012 19:00:14 +0000 Subject: [PATCH] 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 --- polymer/eduke32/build/src/polymer.c | 20 +++++++++++++------- polymer/eduke32/build/src/polymost.c | 4 ++++ 2 files changed, 17 insertions(+), 7 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index a3aef3955..3796738a1 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -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; diff --git a/polymer/eduke32/build/src/polymost.c b/polymer/eduke32/build/src/polymost.c index 2cec31dfe..fe585caa3 100644 --- a/polymer/eduke32/build/src/polymost.c +++ b/polymer/eduke32/build/src/polymost.c @@ -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