*** This script truncates positions and angles of selected sprites.

// Parameter list begins
mov r99 15 // Amount to truncate coords (must be power of 2 minus 1)
mov r97 511 // Amount to truncate angles (must be power of 2 minus 1)
mov r95 255 // Amount to truncate z-coords (must be power of 2 minus 1)
// Parameter list ends
~~~ Default parameters:
~~~ mov r99 15 // Amount to quantize coords (must be power of 2 minus 1)
~~~ mov r97 511 // Amount to quantize angles (must be power of 2 minus 1)
~~~ mov r95 255 // Amount to truncate z-coords (must be power of 2 minus 1)

mov r98 r99
inc r98
div r98 2
not r99 r99
mov r96 r97
inc r96
div r96 2
not r97 r97
mov r94 r95
inc r94
div r94 2
not r95 r95

for each selected sprite r00
  getsprite r00 x r01
  add r01 r98
  and r01 r99
  setsprite r00 x r01
  getsprite r00 y r01
  add r01 r98
  and r01 r99
  setsprite r00 y r01
  getsprite r00 z r01
  add r01 r94
  and r01 r95
  setsprite r00 z r01
  getsprite r00 ang r01
  add r01 r96
  and r01 r97
  setsprite r00 ang r01
  updatespritesectnum r00
continue