a.m32: new state 'print_parallel_midpts'

git-svn-id: https://svn.eduke32.com/eduke32@2179 1a8010ca-5511-0410-912e-c29ae57300e0
This commit is contained in:
helixhorned 2011-12-12 23:18:53 +00:00
parent 84867ee620
commit b73b9cb732
2 changed files with 46 additions and 2 deletions

View file

@ -745,6 +745,50 @@ onevent EVENT_INSERTSPRITE2D
} }
endevent 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 //////////////////// //////////////////// SPRITE DUPLICATORS ////////////////////

View file

@ -8279,8 +8279,8 @@ static void Keys2d(void)
j = getnumber16("Wall: ", 0, numwalls-1, 0+8); j = getnumber16("Wall: ", 0, numwalls-1, 0+8);
if (j < 0) if (j < 0)
break; break;
pos.x = wall[j].x + (wall[wall[j].point2].x-wall[j].x)/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)/2; pos.y = wall[j].y + (wall[wall[j].point2].y-wall[j].y)/4;
pos.z = getflorzofslope(sectorofwall(j), pos.x, pos.y); pos.z = getflorzofslope(sectorofwall(j), pos.x, pos.y);
printmessage16("Current pos now on wall %d's midpoint", j); printmessage16("Current pos now on wall %d's midpoint", j);
} }