1 // Emacs style mode select -*- C++ -*-
2 //-----------------------------------------------------------------------------
6 // Copyright (C) 1993-1996 by id Software, Inc.
8 // This source is available for distribution and/or modification
9 // only under the terms of the DOOM Source Code License as
10 // published by id Software. All rights reserved.
12 // The source is distributed in the hope that it will be useful,
13 // but WITHOUT ANY WARRANTY; without even the implied warranty of
14 // FITNESS FOR A PARTICULAR PURPOSE. See the DOOM Source Code License
18 // Map Objects, MObj, definition and handling.
20 //-----------------------------------------------------------------------------
30 // We need the thinker_t stuff.
33 // We need the WAD data structure for Map things,
34 // from the THINGS lump.
37 // States are tied to finite states are
38 // tied to animation frames.
39 // Needs precompiled tables/data structures.
53 // mobj_ts are used to tell the refresh where to draw an image,
54 // tell the world simulation when objects are contacted,
55 // and tell the sound driver how to position a sound.
57 // The refresh uses the next and prev links to follow
58 // lists of things in sectors as they are being drawn.
59 // The sprite, frame, and angle elements determine which patch_t
60 // is used to draw the sprite if it is visible.
61 // The sprite and frame values are allmost allways set
62 // from state_t structures.
63 // The statescr.exe utility generates the states.h and states.c
64 // files that contain the sprite/frame numbers from the
65 // statescr.txt source file.
66 // The xyz origin point represents a point at the bottom middle
67 // of the sprite (between the feet of a biped).
68 // This is the default origin position for patch_ts grabbed
70 // A walking creature will have its z equal to the floor
73 // The sound code uses the x,y, and subsector fields
74 // to do stereo positioning of any sound effited by the mobj_t.
76 // The play simulation uses the blocklinks, x,y,z, radius, height
77 // to determine when mobj_ts are touching each other,
78 // touching lines in the map, or hit by trace lines (gunshots,
79 // lines of sight, etc).
80 // The mobj_t->flags element has various bit flags
81 // used by the simulation.
83 // Every mobj_t is linked into a single sector
84 // based on its origin coordinates.
85 // The subsector_t is found with R_PointInSubsector(x,y),
86 // and the sector_t can be found with subsector->sector.
87 // The sector links are only used by the rendering code,
88 // the play simulation does not care about them at all.
90 // Any mobj_t that needs to be acted upon by something else
91 // in the play world (block movement, be shot, etc) will also
92 // need to be linked into the blockmap.
93 // If the thing has the MF_NOBLOCK flag set, it will not use
94 // the block links. It can still interact with other things,
95 // but only as the instigator (missiles will run into other
96 // things, but nothing can run into a missile).
97 // Each block in the grid is 128*128 units, and knows about
98 // every line_t that it contains a piece of, and every
99 // interactable mobj_t that has its origin contained.
101 // A valid mobj_t is a mobj_t that has the proper subsector_t
102 // filled in for its xy coordinates and is linked into the
103 // sector from which the subsector was made, or has the
104 // MF_NOSECTOR flag set (the subsector_t needs to be valid
105 // even if MF_NOSECTOR is set), and is linked into a blockmap
106 // block or has the MF_NOBLOCKMAP flag set.
107 // Links should only be modified by the P_[Un]SetThingPosition()
109 // Do not change the MF_NO? flags while a thing is valid.
119 // Call P_SpecialThing when touched.
125 // Don't use the sector links (invisible but touchable).
127 // Don't use the blocklinks (inert but displayable)
130 // Not to be activated by sound, deaf monster.
132 // Will try to attack right back.
134 // Will take at least one step before attacking.
135 MF_JUSTATTACKED
= 128,
136 // On level spawning (initial position),
137 // hang from ceiling instead of stand on floor.
138 MF_SPAWNCEILING
= 256,
139 // Don't apply gravity (every tic),
140 // that is, object will float, keeping current height
141 // or changing it actively.
145 // This allows jumps from high places.
147 // For players, will pick up items.
151 // Player: keep info about sliding along walls.
153 // Allow moves to any height, no gravity.
154 // For active floaters, e.g. cacodemons, pain elementals.
157 // ??? or look at heights on teleport.
158 MF_TELEPORT
= 0x8000,
159 // Don't hit same species, explode on block.
160 // Player missiles as well as fireballs of various kinds.
161 MF_MISSILE
= 0x10000,
162 // Dropped by a demon, not level spawned.
163 // E.g. ammo clips dropped by dying former humans.
164 MF_DROPPED
= 0x20000,
165 // Use fuzzy draw (shadow demons or spectres),
166 // temporary player invisibility powerup.
168 // Flag: don't bleed when shot (use puff),
169 // barrels and shootable furniture shall not bleed.
170 MF_NOBLOOD
= 0x80000,
171 // Don't stop moving halfway off a step,
172 // that is, have dead bodies slide down all the way.
173 MF_CORPSE
= 0x100000,
174 // Floating to a height for a move, ???
175 // don't auto float to target's height.
176 MF_INFLOAT
= 0x200000,
178 // On kill, count this enemy object
179 // towards intermission kill total.
181 MF_COUNTKILL
= 0x400000,
183 // On picking up, count this item object
184 // towards intermission item total.
185 MF_COUNTITEM
= 0x800000,
187 // Special handling: skull in flight.
188 // Neither a cacodemon nor a missile.
189 MF_SKULLFLY
= 0x1000000,
191 // Don't spawn this object
192 // in death match mode (e.g. key cards).
193 MF_NOTDMATCH
= 0x2000000,
195 // Player sprites in multiplayer modes are modified
196 // using an internal color lookup table for re-indexing.
197 // If 0x4 0x8 or 0xc,
198 // use a translation table for player colormaps
199 MF_TRANSLATION
= 0xc000000,
206 // Map Object definition.
207 typedef struct mobj_s
209 // List: thinker links.
212 // Info for drawing: position.
217 // More list: links in sector (if needed)
218 struct mobj_s
* snext
;
219 struct mobj_s
* sprev
;
221 //More drawing info: to determine current sprite.
222 angle_t angle
; // orientation
223 spritenum_t sprite
; // used to find patch_t and flip value
224 int frame
; // might be ORed with FF_FULLBRIGHT
226 // Interaction info, by BLOCKMAP.
227 // Links in blocks (if needed).
228 struct mobj_s
* bnext
;
229 struct mobj_s
* bprev
;
231 struct subsector_s
* subsector
;
233 // The closest interval over all contacted Sectors.
237 // For movement checking.
241 // Momentums, used to update position.
246 // If == validcount, already checked.
250 mobjinfo_t
* info
; // &mobjinfo[mobj->type]
252 int tics
; // state tic counter
257 // Movement direction, movement generation (zig-zagging).
259 int movecount
; // when 0, select a new dir
261 // Thing being chased/attacked (or NULL),
262 // also the originator for missiles.
263 struct mobj_s
* target
;
265 // Reaction time: if non 0, don't attack yet.
266 // Used by player to freeze a bit after teleporting.
269 // If >0, the target will be chased
270 // no matter what (even if shot)
273 // Additional info record for player avatars only.
274 // Only valid if type == MT_PLAYER
275 struct player_s
* player
;
277 // Player number last looked for.
280 // For nightmare respawn.
281 mapthing_t spawnpoint
;
283 // Thing being chased/attacked for tracers.
284 struct mobj_s
* tracer
;
289 #pragma options align=power
294 //-----------------------------------------------------------------------------
297 // Revision 1.2 2000/07/10 12:51:59 bernie
298 // removed one more non-GCC #pragma
300 // Revision 1.1 2000/02/29 18:21:06 stegerg
301 // Doom port based on ADoomPPC. Read README.AROS!
304 //-----------------------------------------------------------------------------