From b73b9cb732df19ce456eeee474cdabbb74203050 Mon Sep 17 00:00:00 2001 From: helixhorned Date: Mon, 12 Dec 2011 23:18:53 +0000 Subject: [PATCH] a.m32: new state 'print_parallel_midpts' git-svn-id: https://svn.eduke32.com/eduke32@2179 1a8010ca-5511-0410-912e-c29ae57300e0 --- polymer/eduke32/samples/a.m32 | 44 ++++++++++++++++++++++++++++++++++ polymer/eduke32/source/astub.c | 4 ++-- 2 files changed, 46 insertions(+), 2 deletions(-) diff --git a/polymer/eduke32/samples/a.m32 b/polymer/eduke32/samples/a.m32 index 7889cfff1..d5f564253 100644 --- a/polymer/eduke32/samples/a.m32 +++ b/polymer/eduke32/samples/a.m32 @@ -745,6 +745,50 @@ onevent EVENT_INSERTSPRITE2D } endevent +defstate print_parallel_midpts // print the midpoints of parallel wall-lines + var p0 p1 p2 s1dx s1dy s2dx s2dy tmp nw + + quote "----------------" + for p1 allwalls + { + lastwall p1 p0 // get the 'inverse point2' + set p2 wall[p1].point2 // ... and the forward one + + set tmp 0 + + // both white: OK (may be false positive due to TROR) + ifl wall[p0].nextwall 0 ifl wall[p1].nextwall 0 set tmp 1 + + // both red and no wall originating from midpoint on the other side: OK + ifge wall[p0].nextwall 0 ifge wall[p1].nextwall 0 + { + set nw wall[p1].nextwall + ifl p1 nw, ife wall[p0].nextwall wall[nw].point2, set tmp 1 + } + + ife tmp 1 + { + set s1dx wall[p1].x, sub s1dx wall[p0].x + set s1dy wall[p1].y, sub s1dy wall[p0].y + + set s2dx wall[p2].x, sub s2dx wall[p1].x + set s2dy wall[p2].y, sub s2dy wall[p1].y + + // now have segment dx/dy's + + mul s1dx -s2dy + mul s1dy s2dx + set tmp s1dx, add tmp s1dy // tmp = (s1dx, s1dy) . (-s2dy, s2dx) + + ife tmp 0 + { + qsprintf TQUOTE "%d" p1 + quote TQUOTE + } + } + } +ends + //////////////////// SPRITE DUPLICATORS //////////////////// diff --git a/polymer/eduke32/source/astub.c b/polymer/eduke32/source/astub.c index 7cf43fd45..9c0f7c97f 100644 --- a/polymer/eduke32/source/astub.c +++ b/polymer/eduke32/source/astub.c @@ -8279,8 +8279,8 @@ static void Keys2d(void) j = getnumber16("Wall: ", 0, numwalls-1, 0+8); if (j < 0) break; - pos.x = wall[j].x + (wall[wall[j].point2].x-wall[j].x)/2; - pos.y = wall[j].y + (wall[wall[j].point2].y-wall[j].y)/2; + pos.x = wall[j].x + (wall[wall[j].point2].x-wall[j].x)/4; + pos.y = wall[j].y + (wall[wall[j].point2].y-wall[j].y)/4; pos.z = getflorzofslope(sectorofwall(j), pos.x, pos.y); printmessage16("Current pos now on wall %d's midpoint", j); }