Mobj

From DoomWiki.org

Revision as of 15:56, 15 November 2023 by Nockson (talk | contribs) (Flags: +Hexen flags)

(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)

A mobj, short for map object, is a type of thinker that roughly corresponds to things: players, monsters, items, obstacles and decorations, map spots such as teleport destinations or boss shooter destinations, and so on, are all map objects. Mobjs are also frequently called actors. Code comments present them as such:

//  MapObj data. Map Objects or mobjs are actors, entities,
//  thinker, take-your-pick... anything that moves, acts, or
//  suffers state changes of more or less violent nature.

In the source code, mobjs are represented by the mobjtype_t enum and the mobj_t and mobjinfo_t structures. The order in which the mobj types are declared in the info.h and info.c files corresponds to their DeHackEd number, and most DeHackEd changes consist in altering the values of the mobjinfos' properties. The mobjinfo corresponds to the "class" of a mobj (for example, imp) whereas the mobj corresponds to a particular "instance" of the class (for example, the imp that waits in the exit room of E1M1). The mobjinfo_t structure determines how many hit points a mobj starts with, which states it uses, what its flags are, what sounds it makes, what is its reaction time, its movement speed, and so on. The mobj_t structure stores its current position and momentum, which sector it is in, what is its current state, its current target, where it should respawn in Nightmare! mode, and so on.

Flags[edit]

Doom games[edit]

The original Doom source code defined the following mobj flags (as enum mobjflag_t in file p_mobj.h).[1]

Symbolic constant Bit(s) [2] Value (decimal) Value (hex) Source code comment [3]
MF_SPECIAL 0 1 0x1 Call P_SpecialThing when touched.
MF_SOLID 1 2 0x2 Blocks.
MF_SHOOTABLE 2 4 0x4 Can be hit.
MF_NOSECTOR 3 8 0x8 Don't use the sector links (invisible but touchable).
MF_NOBLOCKMAP 4 16 0x10 Don't use the blocklinks (inert but displayable)
MF_AMBUSH 5 32 0x20 Not to be activated by sound, deaf monster.
MF_JUSTHIT 6 64 0x40 Will try to attack right back.
MF_JUSTATTACKED 7 128 0x80 Will take at least one step before attacking.
MF_SPAWNCEILING 8 256 0x100 On level spawning (initial position), hang from ceiling instead of stand on floor.
MF_NOGRAVITY 9 512 0x200 Don't apply gravity (every tic), that is, object will float, keeping current height or changing it actively.
MF_DROPOFF 10 1024 0x400 This allows jumps from high places.
MF_PICKUP 11 2048 0x800 For players, will pick up items.
MF_NOCLIP 12 4096 0x1000 Player cheat. ???
MF_SLIDE 13 8192 0x2000 Player: keep info about sliding along walls.
MF_FLOAT 14 16384 0x4000 Allow moves to any height, no gravity. For active floaters, e.g. cacodemons, pain elementals.
MF_TELEPORT 15 32768 0x8000 Don't cross lines or ??? look at heights on teleport.
MF_MISSILE 16 65536 0x10000 Don't hit same species, explode on block. Player missiles as well as fireballs of various kinds.
MF_DROPPED 17 131072 0x20000 Dropped by a demon, not level spawned. E.g. ammo clips dropped by dying former humans.
MF_SHADOW 18 262144 0x40000 Use fuzzy draw (shadow demons or spectres), temporary player invisibility powerup.
MF_NOBLOOD 19 524288 0x80000 Flag: don't bleed when shot (use puff), barrels and shootable furniture shall not bleed.
MF_CORPSE 20 1048576 0x100000 Don't stop moving halfway off a step, that is, have dead bodies slide down all the way.
MF_INFLOAT 21 2097152 0x200000 Floating to a height for a move, ??? don't auto float to target's height.
MF_COUNTKILL 22 4194304 0x400000 On kill, count this enemy object towards intermission kill total. Happy gathering.
MF_COUNTITEM 23 8388608 0x800000 On picking up, count this item object towards intermission item total.
MF_SKULLFLY 24 16777216 0x1000000 Special handling: skull in flight. Neither a cacodemon nor a missile.
MF_NOTDMATCH 25 33554432 0x2000000 Don't spawn this object in death match mode (e.g. key cards).
MF_TRANSLATION 26, 27 201326592 0xC000000 Player sprites in multiplayer modes are modified using an internal color lookup table for re-indexing. If 0x4 0x8 or 0xc, use a translation table for player colormaps
MF_TRANSSHIFT 1, 3, 4 26 0x1A Hmm ???.

Heretic[edit]

In the Heretic source code, the flags are defined in the doomdef.h file. All flags from Doom are retained. An additional, second set of flags was also added. These flags are shown in the table below.

Symbolic constant Bit(s) Value (decimal) Value (hex) Source code comment
MF2_LOGRAV 0 1 0x00000001 alternative gravity setting
MF2_WINDTHRUST 1 2 0x00000002 gets pushed around by the wind specials
MF2_FLOORBOUNCE 2 4 0x00000004 bounces off the floor
MF2_THRUGHOST 3 8 0x00000008 missile will pass through ghosts
MF2_FLY 4 16 0x00000010 fly mode is active
MF2_FOOTCLIP 5 32 0x00000020 if feet are allowed to be clipped
MF2_SPAWNFLOAT 6 64 0x00000040 spawn random float z
MF2_NOTELEPORT 7 128 0x00000080 does not teleport
MF2_RIP 8 256 0x00000100 missile rips through solid targets
MF2_PUSHABLE 9 512 0x00000200 can be pushed by other moving mobjs
MF2_SLIDE 10 1024 0x00000400 slides against walls
MF2_ONMOBJ 11 2048 0x00000800 mobj is resting on top of another mobj
MF2_PASSMOBJ 12 4096 0x00001000 Enable z block checking. If on, this flag will allow the mobj to pass over/under other mobjs.
MF2_CANNOTPUSH 13 8192 0x00002000 cannot push other pushable mobjs
MF2_FEETARECLIPPED 14 16384 0x00004000 a mobj's feet are now being cut
MF2_BOSS 15 32768 0x00008000 mobj is a major boss
MF2_FIREDAMAGE 16 65536 0x00010000 does fire damage
MF2_NODMGTHRUST 17 131072 0x00020000 does not thrust target when damaging
MF2_TELESTOMP 18 262144 0x00040000 mobj can stomp another
MF2_FLOATBOB 19 524288 0x00080000 use float bobbing z movement
MF2_DONTDRAW 20 1048576 0x00100000 don't generate a vissprite

Hexen[edit]

In the Hexen source code, the flags are defined in the h2def.h file. All Doom and Heretic flags are retained, but some have been changed or replaced. New flags have also been added. The table below shows only the changed and new flags.

Symbolic constant Bit(s) Value (decimal) Value (hex) Source code comment Status
MF_ALTSHADOW 17 131072 0x20000 alternate fuzzy draw Replaces MF_DROPPED
MF_ICECORPSE 23 8388608 0x800000 a frozen corpse (for blasting) Replaces MF_COUNTITEM
MF_TRANSLATION 26, 27, 28 469762048 0x00000000 use a translation table (>>MF_TRANSHIFT) Redefined
MF2_BLASTED 3 8 0x00000008 missile will pass through ghosts Replaces MF2_THRUGHOST
MF2_FLOORCLIP 5 32 0x00000020 if feet are allowed to be clipped Replaces MF2_FOOTCLIP
MF2_DROPPED 14 16384 0x00004000 dropped by a demon Replaces MF2_FEETARECLIPPED
MF2_IMPACT 21 2097152 0x00200000 an MF_MISSILE mobj can activate SPAC_IMPACT New
MF2_PUSHWALL 22 4194304 0x00400000 mobj can push walls New
MF2_MCROSS 23 8388608 0x00800000 can activate monster cross lines New
MF2_PCROSS 24 16777216 0x01000000 can activate projectile cross lines New
MF2_CANTLEAVEFLOORPIC 25 33554432 0x02000000 stay within a certain floor type New
MF2_NONSHOOTABLE 26 67108864 0x04000000 mobj is totally non-shootable, but still considered solid New
MF2_INVULNERABLE 27 134217728 0x08000000 mobj is invulnerable New
MF2_DORMANT 28 268435456 0x10000000 thing is dormant New
MF2_ICEDAMAGE 29 536870912 0x20000000 does ice damage New
MF2_SEEKERMISSILE 30 1073741824 0x40000000 is a seeker (for reflection) New
MF2_REFLECTIVE 31 2147483648 0x80000000 reflects missiles New

References and notes[edit]

  1. File p_mobj.h, dated 1997 December 22, 8966 bytes, MD5 98518af2f9fc2cb5d5d7bde8901e5bb6
  2. Bits are conventionally numbered from zero. The first bit is bit 0, the second bit is bit 1, and so on.
  3. Question marks and other indications of uncertainty are as given in the original code.

External links[edit]