1 //----------------------------------------------------------------------------
2 //  EDGE Data Definition File Code (Main)
3 //----------------------------------------------------------------------------
4 //
5 //  Copyright (c) 1999-2008  The EDGE Team.
6 //
7 //  This program is free software; you can redistribute it and/or
8 //  modify it under the terms of the GNU General Public License
9 //  as published by the Free Software Foundation; either version 2
10 //  of the License, or (at your option) any later version.
11 //
12 //  This program is distributed in the hope that it will be useful,
13 //  but WITHOUT ANY WARRANTY; without even the implied warranty of
14 //  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
15 //  GNU General Public License for more details.
16 //
17 //----------------------------------------------------------------------------
18 
19 #ifndef __DDF_MOBJ_H__
20 #define __DDF_MOBJ_H__
21 
22 #include "epi/utility.h"
23 
24 #include "types.h"
25 #include "states.h"
26 
27 
28 // special 'number' value which signifies that the mobjtype_c
29 // forms part of an ATTACKS.DDF entry.
30 #define ATTACK__MOBJ  -7777
31 
32 
33 #define DLIT_COMPAT_RAD(x)  (10.0f * sqrt(x))
34 #define DLIT_COMPAT_ITY   0.8f
35 
36 
37 //
38 // Misc. mobj flags
39 //
40 typedef enum
41 {
42 	// Call P_TouchSpecialThing when touched.
43 	MF_SPECIAL = (1 << 0),
44 
45 	// Blocks.
46 	MF_SOLID = (1 << 1),
47 
48 	// Can be hit.
49 	MF_SHOOTABLE = (1 << 2),
50 
51 	// Don't use the sector links (invisible but touchable).
52 	MF_NOSECTOR = (1 << 3),
53 
54 	// Don't use the blocklinks (inert but displayable)
55 	MF_NOBLOCKMAP = (1 << 4),
56 
57 	// Not to be activated by sound, deaf monster.
58 	MF_AMBUSH = (1 << 5),
59 
60 	// Will try to attack right back.
61 	MF_JUSTHIT = (1 << 6),
62 
63 	// Will take at least one step before attacking.
64 	MF_JUSTATTACKED = (1 << 7),
65 
66 	// On level spawning (initial position),
67 	// hang from ceiling instead of stand on floor.
68 	MF_SPAWNCEILING = (1 << 8),
69 
70 	// Don't apply gravity (every tic), that is, object will float,
71 	// keeping current height or changing it actively.
72 	MF_NOGRAVITY = (1 << 9),
73 
74 	// Movement flags. This allows jumps from high places.
75 	MF_DROPOFF = (1 << 10),
76 
77 	// For players, will pick up items.
78 	MF_PICKUP = (1 << 11),
79 
80 	// Object is not checked when moving, no clipping is used.
81 	MF_NOCLIP = (1 << 12),
82 
83 	// Player: keep info about sliding along walls.
84 	MF_SLIDE = (1 << 13),
85 
86 	// Allow moves to any height, no gravity.
87 	// For active floaters, e.g. cacodemons, pain elementals.
88 	MF_FLOAT = (1 << 14),
89 
90 	// Instantly cross lines, whatever the height differences may be
91 	// (e.g. go from the bottom of a cliff to the top).
92 	// Note: nothing to do with teleporters.
93 	MF_TELEPORT = (1 << 15),
94 
95 	// Don't hit same species, explode on block.
96 	// Player missiles as well as fireballs of various kinds.
97 	MF_MISSILE = (1 << 16),
98 
99 	// Dropped by a demon, not level spawned.
100 	// E.g. ammo clips dropped by dying former humans.
101 	MF_DROPPED = (1 << 17),
102 
103 	// Use fuzzy draw (shadow demons or spectres),
104 	// temporary player invisibility powerup.
105 	MF_FUZZY = (1 << 18),
106 
107 	// Flag: don't bleed when shot (use puff),
108 	// barrels and shootable furniture shall not bleed.
109 	MF_NOBLOOD = (1 << 19),
110 
111 	// Don't stop moving halfway off a step,
112 	// that is, have dead bodies slide down all the way.
113 	MF_CORPSE = (1 << 20),
114 
115 	// Floating to a height for a move, ???
116 	// don't auto float to target's height.
117 	MF_INFLOAT = (1 << 21),
118 
119 	// On kill, count this enemy object
120 	// towards intermission kill total.
121 	// Happy gathering.
122 	MF_COUNTKILL = (1 << 22),
123 
124 	// On picking up, count this item object
125 	// towards intermission item total.
126 	MF_COUNTITEM = (1 << 23),
127 
128 	// Special handling: skull in flight.
129 	// Neither a cacodemon nor a missile.
130 	MF_SKULLFLY = (1 << 24),
131 
132 	// Don't spawn this object
133 	// in death match mode (e.g. key cards).
134 	MF_NOTDMATCH = (1 << 25),
135 
136 	// Monster grows (in)visible at certain times.
137 	MF_STEALTH = (1 << 26),
138 
139 	// NO LONGER USED (1 << 27), // was: JUSTPICKEDUP
140 
141 	// Object reacts to being touched (often violently :->)
142 	MF_TOUCHY = (1 << 28),
143 }
144 mobjflag_t;
145 
146 typedef enum
147 {
148 	// -AJA- 2004/07/22: ignore certain types of damage
149 	// (previously was the EF_BOSSMAN flag).
150 	EF_EXPLODEIMMUNE = (1 << 0),
151 
152 	// Used when varying visibility levels
153 	EF_LESSVIS = (1 << 1),
154 
155 	// This thing does not respawn
156 	EF_NORESPAWN = (1 << 2),
157 
158 	// double the chance of object using range attack
159 	EF_NOGRAVKILL = (1 << 3),
160 
161 	// This thing is not loyal to its own type, fights its own
162 	EF_DISLOYALTYPE = (1 << 4),
163 
164 	// This thing can be hurt by another thing with same attack
165 	EF_OWNATTACKHURTS = (1 << 5),
166 
167 	// Used for tracing (homing) projectiles, its the first time
168 	// this projectile has been checked for tracing if set.
169 	EF_FIRSTCHECK = (1 << 6),
170 
171 	// NO LONGER USED (1 << 7),  // was: NOTRACE
172 
173 	// double the chance of object using range attack
174 	EF_TRIGGERHAPPY = (1 << 8),
175 
176 	// not targeted by other monsters for damaging them
177 	EF_NEVERTARGET = (1 << 9),
178 
179 	// Normally most monsters will follow a target which caused them
180 	// damage for a length of time, even if another object inflicted
181 	// pain upon them; with this enabled, they will not hold the grudge
182 	// and switch targets to the other object that has caused them the
183 	// more recent pain.
184 	EF_NOGRUDGE = (1 << 10),
185 
186 	// NO LONGER USED (1 << 11),  // was: DUMMYMOBJ
187 
188 	// Archvile cannot resurrect this monster
189 	EF_NORESURRECT = (1 << 12),
190 
191 	// Object bounces
192 	EF_BOUNCE = (1 << 13),
193 
194 	// Thing walks along the edge near large dropoffs.
195 	EF_EDGEWALKER = (1 << 14),
196 
197 	// Monster falls with gravity when walks over cliff.
198 	EF_GRAVFALL =  (1 << 15),
199 
200 	// Thing can be climbed on-top-of or over.
201 	EF_CLIMBABLE = (1 << 16),
202 
203 	// Thing won't penetrate WATER extra floors.
204 	EF_WATERWALKER = (1 << 17),
205 
206 	// Thing is a monster.
207 	EF_MONSTER = (1 << 18),
208 
209 	// Thing can cross blocking lines.
210 	EF_CROSSLINES = (1 << 19),
211 
212 	// Thing is never affected by friction
213 	EF_NOFRICTION = (1 << 20),
214 
215 	// Thing is optional, won't exist when -noextra is used.
216 	EF_EXTRA = (1 << 21),
217 
218 	// Just bounced, won't enter bounce states until BOUNCE_REARM.
219 	EF_JUSTBOUNCED = (1 << 22),
220 
221 	// Thing can be "used" (like linedefs) with the spacebar.  Thing
222 	// will then enter its TOUCH_STATES (when they exist).
223 	EF_USABLE = (1 << 23),
224 
225 	// Thing will block bullets and missiles.  -AJA- 2000/09/29
226 	EF_BLOCKSHOTS = (1 << 24),
227 
228 	// Player is currently crouching.  -AJA- 2000/10/19
229 	EF_CROUCHING = (1 << 25),
230 
231 	// Missile can tunnel through enemies.  -AJA- 2000/10/23
232 	EF_TUNNEL = (1 << 26),
233 
234 	// NO LONGER USED (1 << 27),  // was: DLIGHT
235 
236 	// Thing has been gibbed.
237 	EF_GIBBED = (1 << 28),
238 
239 	// -AJA- 2004/07/22: play the monster sounds at full volume
240 	// (separated out from the BOSSMAN flag).
241 	EF_ALWAYSLOUD = (1 << 29),
242 }
243 mobjextendedflag_t;
244 
245 #define EF_SIMPLEARMOUR  EF_TRIGGERHAPPY
246 
247 typedef enum
248 {
249 	// -AJA- 2004/08/25: always pick up this item
250 	HF_FORCEPICKUP = (1 << 0),
251 
252 	// -AJA- 2004/09/02: immune from friendly fire
253 	HF_SIDEIMMUNE = (1 << 1),
254 
255 	// -AJA- 2005/05/15: friendly fire passes through you
256 	HF_SIDEGHOST = (1 << 2),
257 
258 	// -AJA- 2004/09/02: don't retaliate if hurt by friendly fire
259 	HF_ULTRALOYAL = (1 << 3),
260 
261 	// -AJA- 2005/05/14: don't update the Z buffer (particles).
262 	HF_NOZBUFFER = (1 << 4),
263 
264 	// -AJA- 2005/05/15: the sprite hovers up and down
265 	HF_HOVER = (1 << 5),
266 
267 	// -AJA- 2006/08/17: object can be pushed (wind/current/point)
268 	HF_PUSHABLE = (1 << 6),
269 
270 	// -AJA- 2006/08/17: used by MT_PUSH and MT_PULL objects
271 	HF_POINT_FORCE = (1 << 7),
272 
273 	// -AJA- 2006/10/19: scenery items don't block missiles
274 	HF_PASSMISSILE = (1 << 8),
275 
276 	// -AJA- 2007/11/03: invulnerable flag
277 	HF_INVULNERABLE = (1 << 9),
278 
279 	// -AJA- 2007/11/06: gain health when causing damage
280 	HF_VAMPIRE = (1 << 10),
281 
282 	// -AJA- 2008/01/11: compatibility for quadratic dlights
283 	HF_QUADRATIC_COMPAT = (1 << 11),
284 
285 	// -AJA- 2009/10/15: HUB system: remember old avatars
286 	HF_OLD_AVATAR = (1 << 12),
287 
288 	// -AJA- 2009/10/22: never autoaim at this monster/thing
289 	HF_NO_AUTOAIM = (1 << 13),
290 
291 	// -AJA- 2010/06/13: used for RTS command of same name
292 	HF_WAIT_UNTIL_DEAD = (1 << 14),
293 
294 	// -AJA- 2010/12/23: force models to tilt by viewangle
295 	HF_TILT = (1 << 15),
296 }
297 mobjhyperflag_t;
298 
299 
300 #define NUM_FX_SLOT  30
301 
302 
303 // ------------------------------------------------------------------
304 // ------------------------BENEFIT TYPES-----------------------------
305 // ------------------------------------------------------------------
306 
307 typedef enum
308 {
309 	BENEFIT_None = 0,
310 	BENEFIT_Ammo,
311 	BENEFIT_AmmoLimit,
312 	BENEFIT_Weapon,
313 	BENEFIT_Key,
314 	BENEFIT_Health,
315 	BENEFIT_Armour,
316 	BENEFIT_Powerup
317 }
318 benefit_type_e;
319 
320 // Ammunition types defined.
321 typedef enum
322 {
323 	AM_DontCare = -2,  // Only used for P_SelectNewWeapon()
324 	AM_NoAmmo   = -1,  // Unlimited for chainsaw / fist.
325 
326 	AM_Bullet = 0, // Pistol / chaingun ammo.
327 	AM_Shell,      // Shotgun / double barreled shotgun.
328 	AM_Rocket,     // Missile launcher.
329 	AM_Cell,       // Plasma rifle, BFG.
330 
331 	// New ammo types
332 	AM_Pellet,
333 	AM_Nail,
334 	AM_Grenade,
335 	AM_Gas,
336 
337 	AM_9,  AM_10, AM_11, AM_12,
338 	AM_13, AM_14, AM_15, AM_16,
339 
340 	NUMAMMO  // Total count (16)
341 }
342 ammotype_e;
343 
344 typedef enum
345 {
346 	// weak armour, saves 33% of damage
347 	ARMOUR_Green = 0,
348 
349     // better armour, saves 50% of damage
350 	ARMOUR_Blue,
351 
352 	// -AJA- 2007/08/22: another one, saves 66% of damage  (not in Doom)
353 	ARMOUR_Purple,
354 
355 	// good armour, saves 75% of damage  (not in Doom)
356 	ARMOUR_Yellow,
357 
358 	// the best armour, saves 90% of damage  (not in Doom)
359 	ARMOUR_Red,
360 
361 	NUMARMOUR
362 }
363 armour_type_e;
364 
365 #define ARMOUR_Total  (NUMARMOUR+0)  // -AJA- used for conditions
366 
367 typedef short armour_set_t;  // one bit per armour
368 
369 // Power up artifacts.
370 //
371 // -MH- 1998/06/17  Jet Pack Added
372 // -ACB- 1998/07/15 NightVision Added
373 
374 typedef enum
375 {
376 	PW_Invulnerable = 0,
377 	PW_Berserk,
378 	PW_PartInvis,
379 	PW_AcidSuit,
380 	PW_AllMap,
381 	PW_Infrared,
382 
383 	// extra powerups (not in Doom)
384 	PW_Jetpack,     // -MH- 1998/06/18  jetpack "fuel" counter
385 	PW_NightVision,
386 	PW_Scuba,
387 
388 	PW_Unused9,
389 	PW_Unused10,
390 	PW_Unused11,
391 
392 	PW_Unused12,
393 	PW_Unused13,
394 	PW_Unused14,
395 	PW_Unused15,
396 
397 	// -AJA- Note: Savegame code relies on NUMPOWERS == 16.
398 	NUMPOWERS
399 }
400 power_type_e;
401 
402 typedef struct benefit_s
403 {
404 	// next in linked list
405 	struct benefit_s *next;
406 
407     // type of benefit (ammo, ammo-limit, weapon, key, health, armour,
408     // or powerup).
409 	benefit_type_e type;
410 
411 	// sub-type (specific type of ammo, weapon, key or powerup).  For
412 	// armour this is the class, for health it is unused.
413 	union
414 	{
415 		int type;
416 		weapondef_c *weap;
417 	}
418 	sub;
419 
420     // amount of benefit (e.g. quantity of ammo or health).  For weapons
421     // and keys, this is a boolean value: 1 to give, 0 to ignore.  For
422     // powerups, it is number of seconds the powerup lasts.
423 	float amount;
424 
425 	// for health, armour and powerups, don't make the new value go
426 	// higher than this (if it is already higher, prefer not to pickup
427 	// the object).
428 	float limit;
429 }
430 benefit_t;
431 
432 typedef enum
433 {
434 	PUFX_None = 0,
435 	PUFX_PowerupEffect,
436 	PUFX_ScreenEffect,
437 	PUFX_SwitchWeapon,
438 	PUFX_KeepPowerup
439 }
440 pickup_effect_type_e;
441 
442 class pickup_effect_c
443 {
444 public:
445 	pickup_effect_c(pickup_effect_type_e _type, int _sub, int _slot, float _time);
446 	pickup_effect_c(pickup_effect_type_e _type, weapondef_c *_weap, int _slot, float _time);
~pickup_effect_c()447 	~pickup_effect_c() { }
448 
449 	// next in linked list
450 	pickup_effect_c *next;
451 
452 	// type and optional sub-type
453 	pickup_effect_type_e type;
454 
455 	union
456 	{
457 		int type;
458 		weapondef_c *weap;
459 	}
460 	sub;
461 
462 	// which slot to use
463 	int slot;
464 
465     // how long for the effect to last (in seconds).
466 	float time;
467 };
468 
469 // -ACB- 2003/05/15: Made enum external to structure, caused different issues with gcc and VC.NET compile
470 typedef enum
471 {
472 	// dummy condition, used if parsing failed
473 	COND_NONE = 0,
474 
475     // object must have health
476 	COND_Health,
477 
478 	// player must have armour (subtype is ARMOUR_* value)
479 	COND_Armour,
480 
481 	// player must have a key (subtype is KF_* value).
482 	COND_Key,
483 
484 	// player must have a weapon (subtype is slot number).
485 	COND_Weapon,
486 
487 	// player must have a powerup (subtype is PW_* value).
488 	COND_Powerup,
489 
490 	// player must have ammo (subtype is AM_* value)
491 	COND_Ammo,
492 
493 	// player must be jumping
494 	COND_Jumping,
495 
496 	// player must be crouching
497 	COND_Crouching,
498 
499 	// object must be swimming (i.e. in water)
500 	COND_Swimming,
501 
502 	// player must be attacking (holding fire down)
503 	COND_Attacking,
504 
505 	// player must be rampaging (holding fire a long time)
506 	COND_Rampaging,
507 
508 	// player must be using (holding space down)
509 	COND_Using,
510 
511 	// player must be pressing an Action key
512 	COND_Action1,
513 	COND_Action2,
514 
515 	// player must be walking
516 	COND_Walking
517 }
518 condition_check_type_e;
519 
520 typedef struct condition_check_s
521 {
522 	// next in linked list (order is unimportant)
523 	struct condition_check_s *next;
524 
525 	// negate the condition
526 	bool negate;
527 
528 	// condition typing. -ACB- 2003/05/15: Made an integer to hold condition_check_type_e enumeration
529 	int cond_type;
530 
531 	// sub-type (specific type of ammo, weapon, key, powerup).  Not used
532 	// for health, jumping, crouching, etc.
533 	union
534 	{
535 		int type;
536 		weapondef_c *weap;
537 	}
538 	sub;
539 
540 	// required amount of health, armour or ammo,   Not used for
541 	// weapon, key, powerup, jumping, crouching, etc.
542 	float amount;
543 }
544 condition_check_t;
545 
546 // ------------------------------------------------------------------
547 // --------------------MOVING OBJECT INFORMATION---------------------
548 // ------------------------------------------------------------------
549 
550 //
551 // -ACB- 2003/05/15: Moved this outside of damage_c. GCC and VC.NET have
552 // different- and conflicting - issues with structs in structs
553 //
554 // override labels for various states, if the object being damaged
555 // has such a state then it is used instead of the normal ones
556 // (PAIN, DEATH, OVERKILL).  Defaults to NULL.
557 //
558 
559 class label_offset_c
560 {
561 public:
562 	label_offset_c();
563 	label_offset_c(label_offset_c &rhs);
564 	~label_offset_c();
565 
566 private:
567 	void Copy(label_offset_c &src);
568 
569 public:
570 	void Default();
571 	label_offset_c& operator=(label_offset_c &rhs);
572 
573 	epi::strent_c label;
574 	int offset;
575 };
576 
577 class damage_c
578 {
579 public:
580 	damage_c();
581 	damage_c(damage_c &rhs);
582 	~damage_c();
583 
584 	enum default_e
585 	{
586 		DEFAULT_Attack,
587 		DEFAULT_Mobj,
588 		DEFAULT_MobjChoke,
589 		DEFAULT_Sector,
590 		DEFAULT_Numtypes
591 	};
592 
593 private:
594 	void Copy(damage_c &src);
595 
596 public:
597 	void Default(default_e def);
598 	damage_c& operator= (damage_c &rhs);
599 
600 	// nominal damage amount (required)
601 	float nominal;
602 
603 	// used for DAMAGE.MAX: when this is > 0, the damage is random
604 	// between nominal and linear_max, where each value has equal
605 	// probability.
606 	float linear_max;
607 
608 	// used for DAMAGE.ERROR: when this is > 0, the damage is the
609 	// nominal value +/- this error amount, with a bell-shaped
610 	// distribution (values near the nominal are much more likely than
611 	// values at the outer extreme).
612 	float error;
613 
614 	// delay (in terms of tics) between damage application, e.g. 34
615 	// would be once every second.  Only used for slime/crush damage.
616 	int delay;
617 
618 	// death message, names an entry in LANGUAGES.LDF
619 	epi::strent_c obituary;
620 
621 	// override labels for various states, if the object being damaged
622 	// has such a state then it is used instead of the normal ones
623 	// (PAIN, DEATH, OVERKILL).  Defaults to NULL.
624 	label_offset_c pain, death, overkill;
625 
626 	// this flag says that the damage is unaffected by the player's
627 	// armour -- and vice versa.
628 	bool no_armour;
629 };
630 
631 typedef enum
632 {
633 	GLOW_None    = 0,
634 	GLOW_Floor   = 1,
635 	GLOW_Ceiling = 2,
636 	GLOW_Wall    = 3,
637 }
638 glow_sector_type_e;
639 
640 typedef enum
641 {
642 	SPYA_BottomUp = 0,
643 	SPYA_Middle   = 1,
644 	SPYA_TopDown  = 2,
645 }
646 sprite_y_alignment_e;
647 
648 // a bitset is a set of named bits, from `A' to `Z'.
649 typedef int bitset_t;
650 
651 #define BITSET_EMPTY  0
652 #define BITSET_FULL   0x7FFFFFFF
653 #define BITSET_MAKE(ch)  (1 << ((ch) - 'A'))
654 
655 // dynamic light info
656 
657 typedef enum
658 {
659 	// dynamic lighting disabled
660 	DLITE_None,
661 
662 	// light texture is modulated with wall texture
663 	DLITE_Modulate,
664 
665 	// light texture is simply added to wall
666 	DLITE_Add,
667 
668 	// backwards compatibility cruft
669 	DLITE_Compat_LIN,
670 	DLITE_Compat_QUAD,
671 }
672 dlight_type_e;
673 
674 class dlight_info_c
675 {
676 public:
677 	dlight_info_c();
678 	dlight_info_c(dlight_info_c &rhs);
~dlight_info_c()679 	~dlight_info_c() {};
680 
681 private:
682 	void Copy(dlight_info_c &src);
683 
684 public:
685 	void Default(void);
686 	dlight_info_c& operator=(dlight_info_c &rhs);
687 
688 	dlight_type_e type;
689 	epi::strent_c shape;  // IMAGES.DDF reference
690 	float radius;
691 	rgbcol_t colour;
692 	percent_t height;
693 	bool leaky;
694 
695 	void *cache_data;
696 };
697 
698 class weakness_info_c
699 {
700 public:
701 	weakness_info_c();
702 	weakness_info_c(weakness_info_c &rhs);
~weakness_info_c()703 	~weakness_info_c() {};
704 
705 private:
706 	void Copy(weakness_info_c &src);
707 
708 public:
709 	void Default(void);
710 	weakness_info_c& operator=(weakness_info_c &rhs);
711 
712 	percent_t height[2];
713 	angle_t angle[2];
714 	bitset_t classes;
715 	float multiply;
716 	percent_t painchance;
717 };
718 
719 
720 // mobjdef class
721 class mobjtype_c
722 {
723 public:
724 	// DDF Id
725 	epi::strent_c name;
726 
727 	int number;
728 
729 	// range of states used
730 	state_group_t state_grp;
731 
732 	int spawn_state;
733 	int idle_state;
734 	int chase_state;
735 	int pain_state;
736 	int missile_state;
737 	int melee_state;
738 	int death_state;
739 	int overkill_state;
740 	int raise_state;
741 	int res_state;
742 	int meander_state;
743 	int bounce_state;
744 	int touch_state;
745 	int gib_state;
746 	int reload_state;
747 
748 	int reactiontime;
749 	percent_t painchance;
750 	float spawnhealth;
751 	float speed;
752 	float float_speed;
753 	float radius;
754 	float height;
755 	float step_size;
756 	float mass;
757 
758 	int flags;
759 	int extendedflags;
760 	int hyperflags;
761 
762 	damage_c explode_damage;
763 	float explode_radius;  // normally zero (radius == damage)
764 
765 	// linked list of losing benefits, or NULL
766 	benefit_t *lose_benefits;
767 
768 	// linked list of pickup benefits, or NULL
769 	benefit_t *pickup_benefits;
770 
771 	// linked list of pickup effects, or NULL
772 	pickup_effect_c *pickup_effects;
773 
774 	// pickup message, a reference to languages.ldf
775 	char *pickup_message;
776 
777 	// linked list of initial benefits for players, or NULL if none
778 	benefit_t *initial_benefits;
779 
780 	int castorder;
781 	epi::strent_c cast_title;
782 	int respawntime;
783 	percent_t translucency;
784 	percent_t minatkchance;
785 	const colourmap_c *palremap;
786 
787 	int jump_delay;
788 	float jumpheight;
789 	float crouchheight;
790 	percent_t viewheight;
791 	percent_t shotheight;
792 	float maxfall;
793 	float fast;
794 	float scale;
795 	float aspect;
796 	float bounce_speed;
797 	float bounce_up;
798 	float sight_slope;
799 	angle_t sight_angle;
800 	float ride_friction;
801 	percent_t shadow_trans;
802 
803 	struct sfx_s *seesound;
804 	struct sfx_s *attacksound;
805 	struct sfx_s *painsound;
806 	struct sfx_s *deathsound;
807 	struct sfx_s *overkill_sound;
808 	struct sfx_s *activesound;
809 	struct sfx_s *walksound;
810 	struct sfx_s *jump_sound;
811 	struct sfx_s *noway_sound;
812 	struct sfx_s *oof_sound;
813 	struct sfx_s *gasp_sound;
814 
815 	int fuse;
816 	int reload_shots;
817 
818 	// armour control: armour_protect is how much damage the armour
819 	// saves when the bullet/fireball hits you (1% to 100%).  Zero
820 	// disables the association (between color and mobjtype_c).
821 	// The 'erosion' is how much of the saved damage eats up the
822 	// armour held: 100% is normal, at 0% you never lose it.
823 	percent_t armour_protect;
824 	percent_t armour_deplete;
825 	bitset_t armour_class;
826 
827 	bitset_t side;
828 	int playernum;
829 	int yalign;     // -AJA- 2007/08/08: sprite Y alignment in bbox
830 
831 	int model_skin; // -AJA- 2007/10/16: MD2 model support
832 	float model_scale;
833 	float model_aspect;
834 	float model_bias;
835 
836 	// breathing support: lung_capacity is how many tics we can last
837 	// underwater.  gasp_start is how long underwater before we gasp
838 	// when leaving it.  Damage and choking interval is in choke_damage.
839 	int lung_capacity;
840 	int gasp_start;
841 	damage_c choke_damage;
842 
843 	// controls how much the player bobs when walking.
844 	percent_t bobbing;
845 
846 	// what attack classes we are immune/resistant to (usually none).
847 	bitset_t immunity;
848 	bitset_t resistance;
849 	bitset_t ghost;  // pass through us
850 
851 	float     resist_multiply;
852 	percent_t resist_painchance;
853 
854 	const atkdef_c *closecombat;
855 	const atkdef_c *rangeattack;
856 	const atkdef_c *spareattack;
857 
858 	dlight_info_c dlight[2];
859 	int glow_type;
860 
861 	// -AJA- 2007/08/21: weakness support (head-shots etc)
862 	weakness_info_c weak;
863 
864 	// item to drop (or NULL).  The mobjdef pointer is only valid after
865 	// DDF_MobjCleanUp() has been called.
866 	const mobjtype_c *dropitem;
867 	epi::strent_c dropitem_ref;
868 
869 	// blood object (or NULL).  The mobjdef pointer is only valid after
870 	// DDF_MobjCleanUp() has been called.
871 	const mobjtype_c *blood;
872 	epi::strent_c blood_ref;
873 
874 	// respawn effect object (or NULL).  The mobjdef pointer is only
875 	// valid after DDF_MobjCleanUp() has been called.
876 	const mobjtype_c *respawneffect;
877 	epi::strent_c respawneffect_ref;
878 
879 	// spot type for the `SHOOT_TO_SPOT' attack (or NULL).  The mobjdef
880 	// pointer is only valid after DDF_MobjCleanUp() has been called.
881 	const mobjtype_c *spitspot;
882 	epi::strent_c spitspot_ref;
883 
884 public:
885 	mobjtype_c();
886 	~mobjtype_c();
887 
888 public:
889 	void Default();
890 	void CopyDetail(mobjtype_c &src);
891 
892 	void DLightCompatibility(void);
893 
894 private:
895 	// disable copy construct and assignment operator
mobjtype_c(mobjtype_c & rhs)896 	explicit mobjtype_c(mobjtype_c &rhs) { }
897 	mobjtype_c& operator= (mobjtype_c &rhs) { return *this; }
898 };
899 
900 
901 // Our mobjdef container
902 #define LOOKUP_CACHESIZE 211
903 
904 class mobjtype_container_c : public epi::array_c
905 {
906 public:
907 	mobjtype_container_c();
908 	~mobjtype_container_c();
909 
910 private:
911 	void CleanupObject(void *obj);
912 
913 	mobjtype_c* lookup_cache[LOOKUP_CACHESIZE];
914 
915 public:
916 	// List Management
GetSize()917 	int GetSize() {	return array_entries; }
Insert(mobjtype_c * m)918 	int Insert(mobjtype_c *m) { return InsertObject((void*)&m); }
919 	mobjtype_c* operator[](int idx) { return *(mobjtype_c**)FetchObject(idx); }
920 	bool MoveToEnd(int idx);
921 
922 	// Search Functions
923 	int FindFirst(const char *name, int startpos = -1);
924 	int FindLast(const char *name, int startpos = -1);
925 	const mobjtype_c *Lookup(const char *refname);
926 	const mobjtype_c *Lookup(int id);
927 
928 	// FIXME!!! Move to a more appropriate location
929 	const mobjtype_c *LookupCastMember(int castpos);
930 	const mobjtype_c *LookupPlayer(int playernum);
931 };
932 
933 
934 // -------EXTERNALISATIONS-------
935 
936 extern mobjtype_container_c mobjtypes;
937 
938 void DDF_MobjGetBenefit(const char *info, void *storage);
939 
940 bool DDF_ReadThings(void *data, int size);
941 
942 #endif /*__DDF_MOBJ_H__*/
943 
944 //--- editor settings ---
945 // vi:ts=4:sw=4:noexpandtab
946