XenevaOS
Loading...
Searching...
No Matches
XenevaOS
Process
Doomgeneric
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
//
111
typedef
enum
112
{
113
// Call P_SpecialThing when touched.
114
MF_SPECIAL
= 1,
115
// Blocks.
116
MF_SOLID
= 2,
117
// Can be hit.
118
MF_SHOOTABLE
= 4,
119
// Don't use the sector links (invisible but touchable).
120
MF_NOSECTOR
= 8,
121
// Don't use the blocklinks (inert but displayable)
122
MF_NOBLOCKMAP
= 16,
123
124
// Not to be activated by sound, deaf monster.
125
MF_AMBUSH
= 32,
126
// Will try to attack right back.
127
MF_JUSTHIT
= 64,
128
// Will take at least one step before attacking.
129
MF_JUSTATTACKED
= 128,
130
// On level spawning (initial position),
131
// hang from ceiling instead of stand on floor.
132
MF_SPAWNCEILING
= 256,
133
// Don't apply gravity (every tic),
134
// that is, object will float, keeping current height
135
// or changing it actively.
136
MF_NOGRAVITY
= 512,
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
197
}
mobjflag_t
;
198
199
200
// Map Object definition.
201
typedef
struct
mobj_s
202
{
203
// List: thinker links.
204
thinker_t
thinker
;
205
206
// Info for drawing: position.
207
fixed_t
x
;
208
fixed_t
y
;
209
fixed_t
z
;
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
225
struct
subsector_s
*
subsector
;
226
227
// The closest interval over all contacted Sectors.
228
fixed_t
floorz
;
229
fixed_t
ceilingz
;
230
231
// For movement checking.
232
fixed_t
radius
;
233
fixed_t
height
;
234
235
// Momentums, used to update position.
236
fixed_t
momx
;
237
fixed_t
momy
;
238
fixed_t
momz
;
239
240
// If == validcount, already checked.
241
int
validcount
;
242
243
mobjtype_t
type
;
244
mobjinfo_t
*
info
;
// &mobjinfo[mobj->type]
245
246
int
tics
;
// state tic counter
247
state_t
*
state
;
248
int
flags
;
249
int
health
;
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.
261
int
reactiontime
;
262
263
// If >0, the target will be chased
264
// no matter what (even if shot)
265
int
threshold
;
266
267
// Additional info record for player avatars only.
268
// Only valid if type == MT_PLAYER
269
struct
player_s
*
player
;
270
271
// Player number last looked for.
272
int
lastlook
;
273
274
// For nightmare respawn.
275
mapthing_t
spawnpoint
;
276
277
// Thing being chased/attacked for tracers.
278
struct
mobj_s
*
tracer
;
279
280
}
mobj_t
;
281
282
283
284
#endif
d_think.h
doomdata.h
info.h
spritenum_t
spritenum_t
Definition
info.h:28
mobjtype_t
mobjtype_t
Definition
info.h:1159
m_fixed.h
fixed_t
int fixed_t
Definition
m_fixed.h:32
mobj_t
struct mobj_s mobj_t
mobjflag_t
mobjflag_t
Definition
p_mobj.h:112
MF_TRANSLATION
@ MF_TRANSLATION
Definition
p_mobj.h:193
MF_NOGRAVITY
@ MF_NOGRAVITY
Definition
p_mobj.h:136
MF_PICKUP
@ MF_PICKUP
Definition
p_mobj.h:142
MF_SKULLFLY
@ MF_SKULLFLY
Definition
p_mobj.h:183
MF_SHADOW
@ MF_SHADOW
Definition
p_mobj.h:161
MF_NOBLOCKMAP
@ MF_NOBLOCKMAP
Definition
p_mobj.h:122
MF_NOSECTOR
@ MF_NOSECTOR
Definition
p_mobj.h:120
MF_COUNTITEM
@ MF_COUNTITEM
Definition
p_mobj.h:179
MF_NOBLOOD
@ MF_NOBLOOD
Definition
p_mobj.h:164
MF_JUSTHIT
@ MF_JUSTHIT
Definition
p_mobj.h:127
MF_TRANSSHIFT
@ MF_TRANSSHIFT
Definition
p_mobj.h:195
MF_CORPSE
@ MF_CORPSE
Definition
p_mobj.h:167
MF_TELEPORT
@ MF_TELEPORT
Definition
p_mobj.h:152
MF_SHOOTABLE
@ MF_SHOOTABLE
Definition
p_mobj.h:118
MF_COUNTKILL
@ MF_COUNTKILL
Definition
p_mobj.h:175
MF_SOLID
@ MF_SOLID
Definition
p_mobj.h:116
MF_DROPPED
@ MF_DROPPED
Definition
p_mobj.h:158
MF_NOTDMATCH
@ MF_NOTDMATCH
Definition
p_mobj.h:187
MF_AMBUSH
@ MF_AMBUSH
Definition
p_mobj.h:125
MF_SPAWNCEILING
@ MF_SPAWNCEILING
Definition
p_mobj.h:132
MF_SLIDE
@ MF_SLIDE
Definition
p_mobj.h:146
MF_JUSTATTACKED
@ MF_JUSTATTACKED
Definition
p_mobj.h:129
MF_MISSILE
@ MF_MISSILE
Definition
p_mobj.h:155
MF_INFLOAT
@ MF_INFLOAT
Definition
p_mobj.h:170
MF_DROPOFF
@ MF_DROPOFF
Definition
p_mobj.h:140
MF_FLOAT
@ MF_FLOAT
Definition
p_mobj.h:149
MF_NOCLIP
@ MF_NOCLIP
Definition
p_mobj.h:144
MF_SPECIAL
@ MF_SPECIAL
Definition
p_mobj.h:114
mobj_s
Definition
p_mobj.h:202
mobj_s::reactiontime
int reactiontime
Definition
p_mobj.h:261
mobj_s::y
fixed_t y
Definition
p_mobj.h:208
mobj_s::momy
fixed_t momy
Definition
p_mobj.h:237
mobj_s::tics
int tics
Definition
p_mobj.h:246
mobj_s::thinker
thinker_t thinker
Definition
p_mobj.h:204
mobj_s::ceilingz
fixed_t ceilingz
Definition
p_mobj.h:229
mobj_s::snext
struct mobj_s * snext
Definition
p_mobj.h:212
mobj_s::frame
int frame
Definition
p_mobj.h:218
mobj_s::spawnpoint
mapthing_t spawnpoint
Definition
p_mobj.h:275
mobj_s::height
fixed_t height
Definition
p_mobj.h:233
mobj_s::tracer
struct mobj_s * tracer
Definition
p_mobj.h:278
mobj_s::floorz
fixed_t floorz
Definition
p_mobj.h:228
mobj_s::health
int health
Definition
p_mobj.h:249
mobj_s::state
state_t * state
Definition
p_mobj.h:247
mobj_s::movecount
int movecount
Definition
p_mobj.h:253
mobj_s::momx
fixed_t momx
Definition
p_mobj.h:236
mobj_s::threshold
int threshold
Definition
p_mobj.h:265
mobj_s::subsector
struct subsector_s * subsector
Definition
p_mobj.h:225
mobj_s::momz
fixed_t momz
Definition
p_mobj.h:238
mobj_s::x
fixed_t x
Definition
p_mobj.h:207
mobj_s::movedir
int movedir
Definition
p_mobj.h:252
mobj_s::lastlook
int lastlook
Definition
p_mobj.h:272
mobj_s::z
fixed_t z
Definition
p_mobj.h:209
mobj_s::sprite
spritenum_t sprite
Definition
p_mobj.h:217
mobj_s::player
struct player_s * player
Definition
p_mobj.h:269
mobj_s::bnext
struct mobj_s * bnext
Definition
p_mobj.h:222
mobj_s::info
mobjinfo_t * info
Definition
p_mobj.h:244
mobj_s::type
mobjtype_t type
Definition
p_mobj.h:243
mobj_s::radius
fixed_t radius
Definition
p_mobj.h:232
mobj_s::angle
angle_t angle
Definition
p_mobj.h:216
mobj_s::bprev
struct mobj_s * bprev
Definition
p_mobj.h:223
mobj_s::target
struct mobj_s * target
Definition
p_mobj.h:257
mobj_s::flags
int flags
Definition
p_mobj.h:248
mobj_s::validcount
int validcount
Definition
p_mobj.h:241
mobj_s::sprev
struct mobj_s * sprev
Definition
p_mobj.h:213
mobjinfo_t
Definition
info.h:1302
player_s
Definition
d_player.h:79
state_t
Definition
info.h:1145
subsector_s
Definition
r_defs.h:224
thinker_s
Definition
d_think.h:59
tables.h
angle_t
unsigned angle_t
Definition
tables.h:81
Generated by
1.9.8