XenevaOS
Loading...
Searching...
No Matches
p_mobj.h
Go to the documentation of this file.
1//
2// Copyright(C) 1993-1996 Id Software, Inc.
3// Copyright(C) 2005-2014 Simon Howard
4//
5// This program is free software; you can redistribute it and/or
6// modify it under the terms of the GNU General Public License
7// as published by the Free Software Foundation; either version 2
8// of the License, or (at your option) any later version.
9//
10// This program is distributed in the hope that it will be useful,
11// but WITHOUT ANY WARRANTY; without even the implied warranty of
12// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13// GNU General Public License for more details.
14//
15// DESCRIPTION:
16// Map Objects, MObj, definition and handling.
17//
18
19
20#ifndef __P_MOBJ__
21#define __P_MOBJ__
22
23// Basics.
24#include "tables.h"
25#include "m_fixed.h"
26
27// We need the thinker_t stuff.
28#include "d_think.h"
29
30// We need the WAD data structure for Map things,
31// from the THINGS lump.
32#include "doomdata.h"
33
34// States are tied to finite states are
35// tied to animation frames.
36// Needs precompiled tables/data structures.
37#include "info.h"
38
39
40
41
42
43
44//
45// NOTES: mobj_t
46//
47// mobj_ts are used to tell the refresh where to draw an image,
48// tell the world simulation when objects are contacted,
49// and tell the sound driver how to position a sound.
50//
51// The refresh uses the next and prev links to follow
52// lists of things in sectors as they are being drawn.
53// The sprite, frame, and angle elements determine which patch_t
54// is used to draw the sprite if it is visible.
55// The sprite and frame values are allmost allways set
56// from state_t structures.
57// The statescr.exe utility generates the states.h and states.c
58// files that contain the sprite/frame numbers from the
59// statescr.txt source file.
60// The xyz origin point represents a point at the bottom middle
61// of the sprite (between the feet of a biped).
62// This is the default origin position for patch_ts grabbed
63// with lumpy.exe.
64// A walking creature will have its z equal to the floor
65// it is standing on.
66//
67// The sound code uses the x,y, and subsector fields
68// to do stereo positioning of any sound effited by the mobj_t.
69//
70// The play simulation uses the blocklinks, x,y,z, radius, height
71// to determine when mobj_ts are touching each other,
72// touching lines in the map, or hit by trace lines (gunshots,
73// lines of sight, etc).
74// The mobj_t->flags element has various bit flags
75// used by the simulation.
76//
77// Every mobj_t is linked into a single sector
78// based on its origin coordinates.
79// The subsector_t is found with R_PointInSubsector(x,y),
80// and the sector_t can be found with subsector->sector.
81// The sector links are only used by the rendering code,
82// the play simulation does not care about them at all.
83//
84// Any mobj_t that needs to be acted upon by something else
85// in the play world (block movement, be shot, etc) will also
86// need to be linked into the blockmap.
87// If the thing has the MF_NOBLOCK flag set, it will not use
88// the block links. It can still interact with other things,
89// but only as the instigator (missiles will run into other
90// things, but nothing can run into a missile).
91// Each block in the grid is 128*128 units, and knows about
92// every line_t that it contains a piece of, and every
93// interactable mobj_t that has its origin contained.
94//
95// A valid mobj_t is a mobj_t that has the proper subsector_t
96// filled in for its xy coordinates and is linked into the
97// sector from which the subsector was made, or has the
98// MF_NOSECTOR flag set (the subsector_t needs to be valid
99// even if MF_NOSECTOR is set), and is linked into a blockmap
100// block or has the MF_NOBLOCKMAP flag set.
101// Links should only be modified by the P_[Un]SetThingPosition()
102// functions.
103// Do not change the MF_NO? flags while a thing is valid.
104//
105// Any questions?
106//
107
108//
109// Misc. mobj flags
110//
111typedef enum
112{
113 // Call P_SpecialThing when touched.
115 // Blocks.
117 // Can be hit.
119 // Don't use the sector links (invisible but touchable).
121 // Don't use the blocklinks (inert but displayable)
123
124 // Not to be activated by sound, deaf monster.
126 // Will try to attack right back.
128 // Will take at least one step before attacking.
130 // On level spawning (initial position),
131 // hang from ceiling instead of stand on floor.
133 // Don't apply gravity (every tic),
134 // that is, object will float, keeping current height
135 // or changing it actively.
137
138 // Movement flags.
139 // This allows jumps from high places.
140 MF_DROPOFF = 0x400,
141 // For players, will pick up items.
142 MF_PICKUP = 0x800,
143 // Player cheat. ???
144 MF_NOCLIP = 0x1000,
145 // Player: keep info about sliding along walls.
146 MF_SLIDE = 0x2000,
147 // Allow moves to any height, no gravity.
148 // For active floaters, e.g. cacodemons, pain elementals.
149 MF_FLOAT = 0x4000,
150 // Don't cross lines
151 // ??? or look at heights on teleport.
152 MF_TELEPORT = 0x8000,
153 // Don't hit same species, explode on block.
154 // Player missiles as well as fireballs of various kinds.
155 MF_MISSILE = 0x10000,
156 // Dropped by a demon, not level spawned.
157 // E.g. ammo clips dropped by dying former humans.
158 MF_DROPPED = 0x20000,
159 // Use fuzzy draw (shadow demons or spectres),
160 // temporary player invisibility powerup.
161 MF_SHADOW = 0x40000,
162 // Flag: don't bleed when shot (use puff),
163 // barrels and shootable furniture shall not bleed.
164 MF_NOBLOOD = 0x80000,
165 // Don't stop moving halfway off a step,
166 // that is, have dead bodies slide down all the way.
167 MF_CORPSE = 0x100000,
168 // Floating to a height for a move, ???
169 // don't auto float to target's height.
170 MF_INFLOAT = 0x200000,
171
172 // On kill, count this enemy object
173 // towards intermission kill total.
174 // Happy gathering.
175 MF_COUNTKILL = 0x400000,
176
177 // On picking up, count this item object
178 // towards intermission item total.
179 MF_COUNTITEM = 0x800000,
180
181 // Special handling: skull in flight.
182 // Neither a cacodemon nor a missile.
183 MF_SKULLFLY = 0x1000000,
184
185 // Don't spawn this object
186 // in death match mode (e.g. key cards).
187 MF_NOTDMATCH = 0x2000000,
188
189 // Player sprites in multiplayer modes are modified
190 // using an internal color lookup table for re-indexing.
191 // If 0x4 0x8 or 0xc,
192 // use a translation table for player colormaps
193 MF_TRANSLATION = 0xc000000,
194 // Hmm ???.
195 MF_TRANSSHIFT = 26
196
198
199
200// Map Object definition.
201typedef struct mobj_s
202{
203 // List: thinker links.
205
206 // Info for drawing: position.
210
211 // More list: links in sector (if needed)
212 struct mobj_s* snext;
213 struct mobj_s* sprev;
214
215 //More drawing info: to determine current sprite.
216 angle_t angle; // orientation
217 spritenum_t sprite; // used to find patch_t and flip value
218 int frame; // might be ORed with FF_FULLBRIGHT
219
220 // Interaction info, by BLOCKMAP.
221 // Links in blocks (if needed).
222 struct mobj_s* bnext;
223 struct mobj_s* bprev;
224
226
227 // The closest interval over all contacted Sectors.
230
231 // For movement checking.
234
235 // Momentums, used to update position.
239
240 // If == validcount, already checked.
242
244 mobjinfo_t* info; // &mobjinfo[mobj->type]
245
246 int tics; // state tic counter
248 int flags;
250
251 // Movement direction, movement generation (zig-zagging).
252 int movedir; // 0-7
253 int movecount; // when 0, select a new dir
254
255 // Thing being chased/attacked (or NULL),
256 // also the originator for missiles.
257 struct mobj_s* target;
258
259 // Reaction time: if non 0, don't attack yet.
260 // Used by player to freeze a bit after teleporting.
262
263 // If >0, the target will be chased
264 // no matter what (even if shot)
266
267 // Additional info record for player avatars only.
268 // Only valid if type == MT_PLAYER
270
271 // Player number last looked for.
273
274 // For nightmare respawn.
276
277 // Thing being chased/attacked for tracers.
278 struct mobj_s* tracer;
279
281
282
283
284#endif
spritenum_t
Definition info.h:28
mobjtype_t
Definition info.h:1159
int fixed_t
Definition m_fixed.h:32
struct mobj_s mobj_t
mobjflag_t
Definition p_mobj.h:112
@ MF_TRANSLATION
Definition p_mobj.h:193
@ MF_NOGRAVITY
Definition p_mobj.h:136
@ MF_PICKUP
Definition p_mobj.h:142
@ MF_SKULLFLY
Definition p_mobj.h:183
@ MF_SHADOW
Definition p_mobj.h:161
@ MF_NOBLOCKMAP
Definition p_mobj.h:122
@ MF_NOSECTOR
Definition p_mobj.h:120
@ MF_COUNTITEM
Definition p_mobj.h:179
@ MF_NOBLOOD
Definition p_mobj.h:164
@ MF_JUSTHIT
Definition p_mobj.h:127
@ MF_TRANSSHIFT
Definition p_mobj.h:195
@ MF_CORPSE
Definition p_mobj.h:167
@ MF_TELEPORT
Definition p_mobj.h:152
@ MF_SHOOTABLE
Definition p_mobj.h:118
@ MF_COUNTKILL
Definition p_mobj.h:175
@ MF_SOLID
Definition p_mobj.h:116
@ MF_DROPPED
Definition p_mobj.h:158
@ MF_NOTDMATCH
Definition p_mobj.h:187
@ MF_AMBUSH
Definition p_mobj.h:125
@ MF_SPAWNCEILING
Definition p_mobj.h:132
@ MF_SLIDE
Definition p_mobj.h:146
@ MF_JUSTATTACKED
Definition p_mobj.h:129
@ MF_MISSILE
Definition p_mobj.h:155
@ MF_INFLOAT
Definition p_mobj.h:170
@ MF_DROPOFF
Definition p_mobj.h:140
@ MF_FLOAT
Definition p_mobj.h:149
@ MF_NOCLIP
Definition p_mobj.h:144
@ MF_SPECIAL
Definition p_mobj.h:114
Definition p_mobj.h:202
int reactiontime
Definition p_mobj.h:261
fixed_t y
Definition p_mobj.h:208
fixed_t momy
Definition p_mobj.h:237
int tics
Definition p_mobj.h:246
thinker_t thinker
Definition p_mobj.h:204
fixed_t ceilingz
Definition p_mobj.h:229
struct mobj_s * snext
Definition p_mobj.h:212
int frame
Definition p_mobj.h:218
mapthing_t spawnpoint
Definition p_mobj.h:275
fixed_t height
Definition p_mobj.h:233
struct mobj_s * tracer
Definition p_mobj.h:278
fixed_t floorz
Definition p_mobj.h:228
int health
Definition p_mobj.h:249
state_t * state
Definition p_mobj.h:247
int movecount
Definition p_mobj.h:253
fixed_t momx
Definition p_mobj.h:236
int threshold
Definition p_mobj.h:265
struct subsector_s * subsector
Definition p_mobj.h:225
fixed_t momz
Definition p_mobj.h:238
fixed_t x
Definition p_mobj.h:207
int movedir
Definition p_mobj.h:252
int lastlook
Definition p_mobj.h:272
fixed_t z
Definition p_mobj.h:209
spritenum_t sprite
Definition p_mobj.h:217
struct player_s * player
Definition p_mobj.h:269
struct mobj_s * bnext
Definition p_mobj.h:222
mobjinfo_t * info
Definition p_mobj.h:244
mobjtype_t type
Definition p_mobj.h:243
fixed_t radius
Definition p_mobj.h:232
angle_t angle
Definition p_mobj.h:216
struct mobj_s * bprev
Definition p_mobj.h:223
struct mobj_s * target
Definition p_mobj.h:257
int flags
Definition p_mobj.h:248
int validcount
Definition p_mobj.h:241
struct mobj_s * sprev
Definition p_mobj.h:213
Definition info.h:1302
Definition d_player.h:79
Definition info.h:1145
Definition r_defs.h:224
Definition d_think.h:59
unsigned angle_t
Definition tables.h:81