1 #ifndef __EFFECTS_H
2 #define __EFFECTS_H
3 
4 /*
5 EFFECTS.H
6 
7 	Copyright (C) 1991-2001 and beyond by Bungie Studios, Inc.
8 	and the "Aleph One" developers.
9 
10 	This program is free software; you can redistribute it and/or modify
11 	it under the terms of the GNU General Public License as published by
12 	the Free Software Foundation; either version 3 of the License, or
13 	(at your option) any later version.
14 
15 	This program is distributed in the hope that it will be useful,
16 	but WITHOUT ANY WARRANTY; without even the implied warranty of
17 	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
18 	GNU General Public License for more details.
19 
20 	This license is contained in the file "COPYING",
21 	which is included with this source code; it is available online at
22 	http://www.gnu.org/licenses/gpl.html
23 
24 Saturday, June 18, 1994 10:44:10 PM
25 
26 Feb 3, 2000 (Loren Petrich):
27 	Added Jjaro-texture effects
28 	Added VacBob effects
29 
30 Feb 6, 2000 (Loren Petrich):
31 	Added access to size of effect-definition structure
32 
33 Feb 10, 2000 (Loren Petrich):
34 	Added dynamic-limits setting of MAXIMUM_EFECTS_PER_MAP
35 
36 Jul 1, 2000 (Loren Petrich):
37 	Made effects accessor an inline function
38 
39 Aug 30, 2000 (Loren Petrich):
40 	Added stuff for unpacking and packing
41 */
42 
43 // LP addition:
44 #include "dynamic_limits.h"
45 
46 #include "world.h"
47 #include <vector>
48 
49 /* ---------- effect structure */
50 
51 enum /* effect types */
52 {
53 	_effect_rocket_explosion,
54 	_effect_rocket_contrail,
55 	_effect_grenade_explosion,
56 	_effect_grenade_contrail,
57 	_effect_bullet_ricochet,
58 	_effect_alien_weapon_ricochet,
59 	_effect_flamethrower_burst,
60 	_effect_fighter_blood_splash,
61 	_effect_player_blood_splash,
62 	_effect_civilian_blood_splash,
63 	_effect_assimilated_civilian_blood_splash,
64 	_effect_enforcer_blood_splash,
65 	_effect_compiler_bolt_minor_detonation,
66 	_effect_compiler_bolt_major_detonation,
67 	_effect_compiler_bolt_major_contrail,
68 	_effect_fighter_projectile_detonation,
69 	_effect_fighter_melee_detonation,
70 	_effect_hunter_projectile_detonation,
71 	_effect_hunter_spark,
72 	_effect_minor_fusion_detonation,
73 	_effect_major_fusion_detonation,
74 	_effect_major_fusion_contrail,
75 	_effect_fist_detonation,
76 	_effect_minor_defender_detonation,
77 	_effect_major_defender_detonation,
78 	_effect_defender_spark,
79 	_effect_trooper_blood_splash,
80 	_effect_water_lamp_breaking,
81 	_effect_lava_lamp_breaking,
82 	_effect_sewage_lamp_breaking,
83 	_effect_alien_lamp_breaking,
84 	_effect_metallic_clang,
85 	_effect_teleport_object_in,
86 	_effect_teleport_object_out,
87 	_effect_small_water_splash,
88 	_effect_medium_water_splash,
89 	_effect_large_water_splash,
90 	_effect_large_water_emergence,
91 	_effect_small_lava_splash,
92 	_effect_medium_lava_splash,
93 	_effect_large_lava_splash,
94 	_effect_large_lava_emergence,
95 	_effect_small_sewage_splash,
96 	_effect_medium_sewage_splash,
97 	_effect_large_sewage_splash,
98 	_effect_large_sewage_emergence,
99 	_effect_small_goo_splash,
100 	_effect_medium_goo_splash,
101 	_effect_large_goo_splash,
102 	_effect_large_goo_emergence,
103 	_effect_minor_hummer_projectile_detonation,
104 	_effect_major_hummer_projectile_detonation,
105 	_effect_durandal_hummer_projectile_detonation,
106 	_effect_hummer_spark,
107 	_effect_cyborg_projectile_detonation,
108 	_effect_cyborg_blood_splash,
109 	_effect_minor_fusion_dispersal,
110 	_effect_major_fusion_dispersal,
111 	_effect_overloaded_fusion_dispersal,
112 	_effect_sewage_yeti_blood_splash,
113 	_effect_sewage_yeti_projectile_detonation,
114 	_effect_water_yeti_blood_splash,
115 	_effect_lava_yeti_blood_splash,
116 	_effect_lava_yeti_projectile_detonation,
117 	_effect_yeti_melee_detonation,
118 	_effect_juggernaut_spark,
119 	_effect_juggernaut_missile_contrail,
120 	// LP addition: Jjaro stuff
121 	_effect_small_jjaro_splash,
122 	_effect_medium_jjaro_splash,
123 	_effect_large_jjaro_splash,
124 	_effect_large_jjaro_emergence,
125 	_effect_civilian_fusion_blood_splash,
126 	_effect_assimilated_civilian_fusion_blood_splash,
127 	NUMBER_OF_EFFECT_TYPES
128 };
129 
130 // LP change: made this settable from the resource fork
131 #define MAXIMUM_EFFECTS_PER_MAP (get_dynamic_limit(_dynamic_limit_effects))
132 
133 /* uses SLOT_IS_USED(), SLOT_IS_FREE(), MARK_SLOT_AS_FREE(), MARK_SLOT_AS_USED() macros (0x8000 bit) */
134 
135 struct effect_data /* 16 bytes LP: really 32 bytes */
136 {
137 	short type;
138 	short object_index;
139 
140 	uint16 flags; /* [slot_used.1] [unused.15] */
141 
142 	short data; /* used for special effects (effects) */
143 	short delay; /* the effect is invisible and inactive for this many ticks */
144 
145 	short unused[11];
146 };
147 const int SIZEOF_effect_data = 32;
148 
149 const int SIZEOF_effect_definition = 14;
150 
151 /* ---------- globals */
152 
153 // Turned the list of active effects into a variable array
154 
155 extern std::vector<effect_data> EffectList;
156 #define effects (EffectList.data())
157 
158 // extern struct effect_data *effects;
159 
160 /* ---------- prototypes/EFFECTS.C */
161 
162 short new_effect(world_point3d *origin, short polygon_index, short type, angle facing);
163 void update_effects(void); /* assumes �t==1 tick */
164 
165 void remove_all_nonpersistent_effects(void);
166 void remove_effect(short effect_index);
167 
168 void mark_effect_collections(short type, bool loading);
169 
170 void teleport_object_in(short object_index);
171 void teleport_object_out(short object_index);
172 
173 effect_data *get_effect_data(
174 	const short effect_index);
175 
176 // LP: to pack and unpack this data;
177 // these do not make the definitions visible to the outside world
178 
179 uint8 *unpack_effect_data(uint8 *Stream, effect_data *Objects, size_t Count);
180 uint8 *pack_effect_data(uint8 *Stream, effect_data *Objects, size_t Count);
181 uint8 *unpack_effect_definition(uint8 *Stream, size_t Count);
182 uint8 *pack_effect_definition(uint8 *Stream, size_t Count);
183 uint8* unpack_m1_effect_definition(uint8* Stream, size_t Count);
184 void init_effect_definitions();
185 
186 #endif
187 
188