Htmovflag: Difference between revisions

From EDukeWiki
Jump to navigation Jump to search
New page: htmovflag has a nonzero value if the sprite is using a move command and it bumps into something (htmovflag is set to the return value of the movesprite function). If the moving sprite is ...
 
No edit summary
 
(4 intermediate revisions by 3 users not shown)
Line 1: Line 1:
htmovflag has a nonzero value if the sprite is using a move command and it bumps into something (htmovflag is set to the return value of the movesprite function). If the moving sprite is bumping into another sprite, then the ID of that other sprite will be equal to htmovflag + 16384.
'''htmovflag''' has a nonzero value if the sprite is using a move command and it bumps into something (htmovflag is set to the return value of the [[movesprite]] function).  
 
Depending if the moving sprite bumped into another sprite, wall, floor or ceiling, a different value will be added to the collided object's index:<br>
(Compare with [[getzrange]].)
 
* 16384 + sectnum, if a ceiling or floor was hit first
* 32768 + wallnum, if a wall was hit first
* 49152 + spritenum, if a sprite was hit first
 
Thus, to determine what was hit, one should check the value in this order:
* == 0 -- nothing hit.
* >= 49152 -- sprite hit.
* >= 32768 -- wall hit.
* >= 16384 -- ceiling/floor hit.
and then subtract the corresponding constant to get a sector, wall or sprite index. Note how the the values do not overlap for different objects becuase of the s/w/s limits.
 
[[Category:Sprite structure members]]

Latest revision as of 03:30, 20 May 2013

htmovflag has a nonzero value if the sprite is using a move command and it bumps into something (htmovflag is set to the return value of the movesprite function).

Depending if the moving sprite bumped into another sprite, wall, floor or ceiling, a different value will be added to the collided object's index:
(Compare with getzrange.)

  • 16384 + sectnum, if a ceiling or floor was hit first
  • 32768 + wallnum, if a wall was hit first
  • 49152 + spritenum, if a sprite was hit first

Thus, to determine what was hit, one should check the value in this order:

  • == 0 -- nothing hit.
  • >= 49152 -- sprite hit.
  • >= 32768 -- wall hit.
  • >= 16384 -- ceiling/floor hit.

and then subtract the corresponding constant to get a sector, wall or sprite index. Note how the the values do not overlap for different objects becuase of the s/w/s limits.