James, on 29 October 2012 - 01:15 AM, said:
state scanwalls
getsector[NUMSECTORS1].wallptr FIRSTWALL // get the firstwall of the sector
getsector[NUMSECTORS1].wallnum NUMWALLS1 // get the number of walls in the sector
setvar MX 0
setvar MY 0
setvarvar WALLPOINT FIRSTWALL
setvar COUNTWALLS 0
whilevarvarn COUNTWALLS NUMWALLS1
{
getwall[WALLPOINT].x WALLX1
getwall[WALLPOINT].y WALLY1
divvarvar WALLX1 NUMWALLS1 // divide it first because the numbers might overflow
divvarvar WALLY1 NUMWALLS1
addvarvar MX WALLX1 // add it all up
addvarvar MY WALLY1
getwall[WALLPOINT].point2 WALLPOINT // next wall
addvar COUNTWALLS 1
// this will kill EVENT_GAME until code execution is finished
break
}
ends
This is a hack I released as part of the "materials" code (which scanned sectors/walls and allowed you to mess with certain textures or spawn things). Except for odd shaped sectors that should be pretty close.

Help
Duke4.net
DNF #1
Duke 3D #1



