From e48c4c2c87f54dea12f374a51003d89f751138ea Mon Sep 17 00:00:00 2001 From: plagman Date: Sun, 19 Apr 2009 18:00:51 +0000 Subject: [PATCH] Really fix concave relative slopes. git-svn-id: https://svn.eduke32.com/eduke32@1335 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/build/src/polymer.c | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/polymer/eduke32/build/src/polymer.c b/polymer/eduke32/build/src/polymer.c index eee0f5feb..6435029f3 100644 --- a/polymer/eduke32/build/src/polymer.c +++ b/polymer/eduke32/build/src/polymer.c @@ -1651,13 +1651,8 @@ static int32_t polymer_updatesector(int16_t sectnum) // relative texturing if (curstat & 64) { - // absolute distance for walls "behind" the first wall (concave sectors) xpancoef = wal->x - wall[sec->wallptr].x; - if (xpancoef < 0) - xpancoef = -xpancoef; ypancoef = wall[sec->wallptr].y - wal->y; - if (ypancoef < 0) - ypancoef = -ypancoef; tex = xpancoef * secangsin + ypancoef * secangcos; tey = xpancoef * secangcos - ypancoef * secangsin; @@ -1669,7 +1664,11 @@ static int32_t polymer_updatesector(int16_t sectnum) if ((curstat & (2+64)) == (2+64)) { heidiff = curbuffer[(i*5)+1] - curbuffer[1]; - tey = sqrt((tey * tey) + (heidiff * heidiff)); + // don't forget the sign, tey could be negative with concave sectors + if (tey >= 0) + tey = sqrt((tey * tey) + (heidiff * heidiff)); + else + tey = -sqrt((tey * tey) + (heidiff * heidiff)); } if (curstat & 4)