Clipmove: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
Jwaffe (talk | contribs)
Added page; basically just a copy/paste of buildinf.txt, not perfect but hopefully better than nothing -jwaffe
 
This wiki is about CON scripting, not the source code.
Line 1: Line 1:
'''from BUILDINF.txt:
'''clipmove''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask>
'''
'''clipmovenoslide''' <''return''> <''x''> <''y''> <z> <''sectnum''> <xvect> <yvect> <walldist> <flordist> <ceildist> <clipmask>
clipmove(long *x, long *y, long *z, short *sectnum, long xvect, long yvect,
long walldist, long ceildist, long flordist, unsigned long cliptype)


Moves any object (x, y, z) in any direction at any velocity and will make sure the object will stay a certain distance from walls (walldist)
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.


Pass the pointers of the starting position (x, y, z)Then pass the starting position's sector number as a pointer also.
<clipmask> is a mask that tells whether the object should be clipped to or notThe lower 16 bits are bitwise ANDed with wall[].[[cstat(wall)|cstat]] and the higher 16 bits are bitwise ANDed with sprite[].[[cstat]].
Also these values will be modified accordingly. Pass the direction and velocity by using a vector (xvect, yvect).


xvect = velocity * cos(angle)
If <return>, <x>, <y>, and <sectnum> are [[gamevar]]s, they will be modified with the result of the calculation.
yvect = velocity * sin(angle)


Walldist tells how close the object can get to a wall. I use 128L as my default. If you increase walldist all of a sudden
<return> value:
for a certain object, the object might leak through a wall, so don't do that!
   
  0 (touched nothing)
32768+wallnum (wall first touched)
49152+spritenum (sprite first touched)


Cliptype is a mask that tells whether the object should be clipped to or not.  The lower 16 bits are anded with wall[].cstat and the higher 16 bits are anded with sprite[].cstat.
[[Category:EDuke32 specific commands]]
 
Clipmove return values:
  0 (touched nothing)
  32768+wallnum (wall first touched)
  49152+spritenum (sprite first touched)

Revision as of 21:47, 30 March 2014

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.

<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.

If <return>, <x>, <y>, and <sectnum> are gamevars, they will be modified with the result of the calculation.

<return> value:

0 (touched nothing)
32768+wallnum (wall first touched)
49152+spritenum (sprite first touched)