*** This script assigns random texture panning to selected sectors.

// Parameter list begins
mov r96 1 // Randomize floorxpanning
mov r97 1 // Randomize floorypanning
mov r98 0 // Randomize ceilingxpanning
mov r99 0 // Randomize ceilingypanning
// Parameter list ends
~~~ Default parameters:
~~~ mov r96 1 // Randomize floorxpanning
~~~ mov r97 1 // Randomize floorypanning
~~~ mov r98 0 // Randomize ceilingxpanning
~~~ mov r99 0 // Randomize ceilingypanning
if r96 != 0
  mov r00 -1
  for each selected sector r00
    rnd r01 // Get random value
    and r01 2147483647 // Only positive values
    div r01 8388608 // Take 8 major bits to provide random behavior
    setsector r00 floorxpanning r01
  continue
endif
if r97 != 0
  mov r00 -1
  for each selected sector r00
    rnd r01 // Get random value
    and r01 2147483647 // Only positive values
    div r01 8388608 // Take 8 major bits to provide random behavior
    setsector r00 floorypanning r01
  continue
endif
if r98 != 0
  mov r00 -1
  for each selected sector r00
    rnd r01 // Get random value
    and r01 2147483647 // Only positive values
    div r01 8388608 // Take 8 major bits to provide random behavior
    setsector r00 ceilingxpanning r01
  continue
endif
if r99 != 0
  mov r00 -1
  for each selected sector r00
    rnd r01 // Get random value
    and r01 2147483647 // Only positive values
    div r01 8388608 // Take 8 major bits to provide random behavior
    setsector r00 ceilingypanning r01
  continue
endif