Clipmove: Difference between revisions
Helixhorned (talk | contribs) More explicitly state requirements on written-to gamevars. |
No edit summary |
||
(2 intermediate revisions by 2 users not shown) | |||
Line 1: | Line 1: | ||
'''clipmove''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask><br> | '''clipmove''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask><br /> | ||
'''clipmovenoslide''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask> | '''clipmovenoslide''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask> | ||
Calculates the movement of any object, starting from position (<x>, <y>, <z>) and sector <sectnum>, in any direction at velocity (<xvect>, <yvect>), keeping the object will a distance <walldist> from walls, <flordist> from floors, and <ceildist> from ceilings. | Calculates the movement of any object, starting from position (<x>, <y>, <z>) and sector <sectnum>, in any direction at velocity (<xvect>, <yvect>), keeping the object will a distance <walldist> from walls, <flordist> from floors, and <ceildist> from ceilings. The components of the velocity vector, <xvect> and <yvect>, are expected to be scaled by 14 bits, i.e. a value of 16384 corresponds to a Build x/y unit. However, <walldist> is given in Build units directly. | ||
<clipmask> is a mask that tells whether the object should be clipped to or not. The lower 16 bits are bitwise ANDed with wall[].[[cstat(wall)|cstat]] and the higher 16 bits are bitwise ANDed with sprite[].[[cstat]]. | <clipmask> is a mask that tells whether the object should be clipped to or not. The lower 16 bits are bitwise ANDed with wall[].[[cstat (wall)|cstat]] and the higher 16 bits are bitwise ANDed with sprite[].[[cstat (sprite)|cstat]]. | ||
<''return''>, <''x''>, <''y''>, and <''sectnum''> must be writeable [[gamevar]]s, and may be modified as the result of the calculation. | <''return''>, <''x''>, <''y''>, and <''sectnum''> must be writeable [[gamevar]]s, and may be modified as the result of the calculation. |
Latest revision as of 09:49, 22 February 2020
clipmove <return> <x> <y> <z> <sectnum> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask>
clipmovenoslide <return> <x> <y> <z> <sectnum> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask>
Calculates the movement of any object, starting from position (<x>, <y>, <z>) and sector <sectnum>, in any direction at velocity (<xvect>, <yvect>), keeping the object will a distance <walldist> from walls, <flordist> from floors, and <ceildist> from ceilings. The components of the velocity vector, <xvect> and <yvect>, are expected to be scaled by 14 bits, i.e. a value of 16384 corresponds to a Build x/y unit. However, <walldist> is given in Build units directly.
<clipmask> is a mask that tells whether the object should be clipped to or not. The lower 16 bits are bitwise ANDed with wall[].cstat and the higher 16 bits are bitwise ANDed with sprite[].cstat.
<return>, <x>, <y>, and <sectnum> must be writeable gamevars, and may be modified as the result of the calculation.
<return> value:
0 (touched nothing) 32768+wallnum (wall first touched) 49152+spritenum (sprite first touched)