Difference between revisions of "Statnum"

From EDukeWiki
Jump to navigation Jump to search
 
Line 1: Line 1:
'''statnum''' is used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.
'''statnum''' is used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.


The '''statnum'''s also serve to cache the sprites in shorter lists. It's optimal to use [[for|loops]] of the sprites using a statnum instead of all sprites.
The statnums also serve to cache the sprites in shorter lists. It's optimal to use [[for|loops]] of the sprites using a statnum instead of all sprites.


In older version of Eduke32, it was necessary to use [[changespritestat]] to change '''statnum'''. This is no longer necessary.
In older version of Eduke32, it was necessary to use [[changespritestat]] to change '''statnum'''. This is no longer necessary.

Latest revision as of 09:47, 22 February 2020

statnum is used by the game internally to see whether something is an actor, player, projectile, etc, and then process it appropriately.

The statnums also serve to cache the sprites in shorter lists. It's optimal to use loops of the sprites using a statnum instead of all sprites.

In older version of Eduke32, it was necessary to use changespritestat to change statnum. This is no longer necessary.

Unassigned status numbers may be reserved for future EDuke32 features, so it's suggested to define custom statnums starting from 101.

Values

The following values are used with statnum.

Exposed Value Label Description
Yes 0 STAT_DEFAULT Sprites that are not defined by the CON code as actors, and are not projectiles, etc, have a statnum of 0. (i.e. the floor texture sprites used to make up a sprite bridge)
Yes 1 STAT_ACTOR Actors. Sprites with a statnum of 1 will execute the actor code that applies to their tile number in the CON scripts.
Yes 2 STAT_ZOMBIEACTOR Sleepers. Sprites taking a break from code execution (e.g. a Pig Cop that has been left alone for long enough will revert to statnum 2, only waking up and going back to statnum 1 upon seeing the player again)
Yes 3 STAT_EFFECTOR
Yes 4 STAT_PROJECTILE Projectiles. This includes hardcoded projectiles like RPG, FREEZEBLAST, and SHRINKSPARK, as well as custom projectiles. It does not include hitscan projectiles (bullets), since those are not sprites that exist in the game world. (SHOTSPARK1, the sprite spawned by bullets, is not itself a projectile.)
Yes 5 STAT_MISC
Yes 6 STAT_STANDABLE On spawn, the following sprites have statnum 6: BOLT1+, SIDEBOLT1+, VIEWSCREEN, VIEWSCREEN2, CRANE, TRASH, WATERDRIP, WATERDRIPSPLASH, PLUG, WATERBUBBLEMAKER, MASTERSWITCH, DOORSHOCK, TREE1, TREE2, TIRE, CONE, BOX, FLOORFLAME, CEILINGSTEAM, OOZFILTER, CRACK1-CRACK4, FIREEXT, TOILETWATER.

A few other ones become STANDABLE on seeing the player (changing from ZOMBIEACTOR): RUBBERCAN, EXPLODINGBARREL, WOODENHORSE, HORSEONSIDE, CANWITHSOMETHING, CANWITHSOMETHING2-4, FIREBARREL, FIREVASE, NUKEBARREL, NUKEBARRELDENTED, NUKEBARRELLEAKED, TRIPBOMB.

Yes 7 STAT_LOCATOR
Yes 8 STAT_ACTIVATOR
Yes 9 STAT_TRANSPORT
Yes 10 STAT_PLAYER Player and Holoduke
Yes 11 STAT_FX RESPAWN, MUSICANDSFX
Yes 12 STAT_FALLER Decorative sprites that have a nonzero hitag to make them destructible are assigned to the FALLER statnum.
Yes 13 STAT_DUMMYPLAYER
Yes 14 STAT_LIGHT
No 99 TSPR_TEMP A tspr will have this when it is a shadow cast by an actor.
No 100 STAT_MIRROREDACTOR A tspr will have this when it is part of a mirror reflection.
Yes 1024 MAXSTATUS A sprite id with this statnum is invalid, meaning that it has been deleted or just never existed in the map. Do NOT try to destroy a sprite by setting this value on it, instead use the killit command or else try setting the sprite's xrepeat to zero.
Defines
define TSPR_TEMP                        99
define STAT_MIRROREDACTOR               100