1 /*
2 
3 Copyright (C) 2015-2018 Night Dive Studios, LLC.
4 
5 This program is free software: you can redistribute it and/or modify
6 it under the terms of the GNU General Public License as published by
7 the Free Software Foundation, either version 3 of the License, or
8 (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 You should have received a copy of the GNU General Public License
16 along with this program.  If not, see <http://www.gnu.org/licenses/>.
17 
18 */
19 #ifndef __OBJWPN_H
20 #define __OBJWPN_H
21 
22 /*
23  * $Source: r:/prj/cit/src/inc/RCS/objwpn.h $
24  * $Revision: 1.33 $
25  * $Author: minman $
26  * $Date: 1994/07/26 00:50:45 $
27  *
28  *
29  */
30 
31 // Includes
32 #include "objclass.h"
33 
34 // Instance Data
35 typedef struct {
36     //   COMMON_OBJSPEC_FIELDS;
37     union {
38         ObjID id;
39         ObjSpecID headused;
40     };
41     union {
42         ObjSpecID next;
43         ObjSpecID headfree;
44     };
45     ObjSpecID prev;
46     ubyte ammo_type;
47     ubyte ammo_count;
48 } ObjGun;
49 
50 typedef struct {
51     //   COMMON_OBJSPEC_FIELDS;
52     union {
53         ObjID id;
54         ObjSpecID headused;
55     };
56     union {
57         ObjSpecID next;
58         ObjSpecID headfree;
59     };
60     ObjSpecID prev;
61 } ObjAmmo;
62 
63 typedef struct {
64     //   COMMON_OBJSPEC_FIELDS;
65     union {
66         ObjID id;
67         ObjSpecID headused;
68     };
69     union {
70         ObjSpecID next;
71         ObjSpecID headfree;
72     };
73     ObjSpecID prev;
74     ObjID owner;
75     int bullet_triple;
76     int duration;
77     //   char     power;
78     ObjLoc p1, p2, p3;
79 } ObjPhysics;
80 
81 typedef struct {
82     //   COMMON_OBJSPEC_FIELDS;
83     union {
84         ObjID id;
85         ObjSpecID headused;
86     };
87     union {
88         ObjSpecID next;
89         ObjSpecID headfree;
90     };
91     ObjSpecID prev;
92     ubyte unique_id;
93     ubyte walls_hit;
94     short flags;
95     short timestamp;
96 } ObjGrenade;
97 
98 // Class typedefs
99 
100 #define COMBAT_DATA_FIELDS \
101     short damage_modifier; \
102     ubyte offense_value;   \
103     int damage_type;       \
104     ubyte penetration
105 
106 typedef struct _GunProp {
107     ubyte fire_rate;
108     ubyte useable_ammo_type;
109 } GunProp;
110 
111 typedef struct _AmmoProp {
112     COMBAT_DATA_FIELDS;
113     ubyte cartridge_size;
114     ubyte bullet_mass;
115     short bullet_speed;
116     ubyte range;
117     ubyte recoil_force;
118 } AmmoProp;
119 
120 typedef struct _PhysicsProp {
121     ubyte flags;
122 } PhysicsProp;
123 
124 typedef struct _GrenadeProp {
125     COMBAT_DATA_FIELDS;
126     ubyte touchiness;
127     ubyte radius;
128     ubyte radius_change;
129     ubyte damage_change;
130     ubyte attack_mass;
131     short flags; // Does it spew shrapnel? Can timer be set? Can it stick to wall?
132 } GrenadeProp;
133 
134 // Subclass typedefs
135 
136 #define EMPTY_STRUCTS
137 
138 typedef struct _PistolGunProp {
139 #ifdef EMPTY_STRUCTS
140     ubyte dummy;
141 #endif
142 } PistolGunProp;
143 
144 typedef struct _AutoGunProp {
145 #ifdef EMPTY_STRUCTS
146     ubyte dummy;
147 #endif
148 } AutoGunProp;
149 
150 typedef struct _SpecialGunProp {
151     COMBAT_DATA_FIELDS;
152     ubyte speed;
153     int proj_triple;
154     ubyte attack_mass;
155     short attack_speed;
156 } SpecialGunProp;
157 
158 typedef struct _HandtohandGunProp {
159     COMBAT_DATA_FIELDS;
160     ubyte energy_use;
161     ubyte attack_mass;
162     ubyte attack_range;
163     short attack_speed;
164 } HandtohandGunProp;
165 
166 typedef struct _BeamGunProp {
167     COMBAT_DATA_FIELDS;
168     ubyte max_charge;
169     ubyte attack_mass;
170     ubyte attack_range;
171     short attack_speed;
172 } BeamGunProp;
173 
174 typedef struct _BeamprojGunProp {
175     COMBAT_DATA_FIELDS;
176     ubyte max_charge;
177     ubyte attack_mass;
178     short attack_speed;
179     ubyte speed;
180     int proj_triple;
181     ubyte flags;
182 } BeamprojGunProp;
183 
184 typedef struct _PistolAmmoProp {
185 #ifdef EMPTY_STRUCTS
186     ubyte dummy;
187 #endif
188 } PistolAmmoProp;
189 
190 typedef struct _NeedleAmmoProp {
191 #ifdef EMPTY_STRUCTS
192     ubyte dummy;
193 #endif
194 } NeedleAmmoProp;
195 
196 typedef struct _MagnumAmmoProp {
197 #ifdef EMPTY_STRUCTS
198     ubyte dummy;
199 #endif
200 } MagnumAmmoProp;
201 
202 typedef struct _RifleAmmoProp {
203 #ifdef EMPTY_STRUCTS
204     ubyte dummy;
205 #endif
206 } RifleAmmoProp;
207 
208 typedef struct _FlechetteAmmoProp {
209 #ifdef EMPTY_STRUCTS
210     ubyte dummy;
211 #endif
212 } FlechetteAmmoProp;
213 
214 typedef struct _AutoAmmoProp {
215 #ifdef EMPTY_STRUCTS
216     ubyte dummy;
217 #endif
218 } AutoAmmoProp;
219 
220 typedef struct _ProjAmmoProp {
221 #ifdef EMPTY_STRUCTS
222     ubyte dummy;
223 #endif
224 } ProjAmmoProp;
225 
226 typedef struct _TracerPhysicsProp {
227     short xcoords[4];
228     short ycoords[4];
229     ubyte zcoords[4];
230 } TracerPhysicsProp;
231 
232 #define NUM_SLOW_VCOLORS 6
233 typedef struct _SlowPhysicsProp {
234     uchar vcolors[NUM_SLOW_VCOLORS];
235 } SlowPhysicsProp;
236 
237 typedef struct _CameraPhysicsProp {
238 #ifdef EMPTY_STRUCTS
239     ubyte dummy;
240 #endif
241 } CameraPhysicsProp;
242 
243 typedef struct _DirectGrenadeProp {
244 #ifdef EMPTY_STRUCTS
245     ubyte dummy;
246 #endif
247 } DirectGrenadeProp;
248 
249 typedef struct _TimedGrenadeProp {
250     ubyte min_time_set;
251     ubyte max_time_set;
252     ubyte timing_deviation;
253 } TimedGrenadeProp;
254 
255 // Gun
256 #define NUM_PISTOL_GUN     5
257 #define NUM_AUTO_GUN       2
258 #define NUM_SPECIAL_GUN    2
259 #define NUM_HANDTOHAND_GUN 2
260 #define NUM_BEAM_GUN       3
261 #define NUM_BEAMPROJ_GUN   2
262 
263 // Ammo
264 #define NUM_PISTOL_AMMO    2
265 #define NUM_NEEDLE_AMMO    2
266 #define NUM_MAGNUM_AMMO    3
267 #define NUM_RIFLE_AMMO     2
268 #define NUM_FLECHETTE_AMMO 2
269 #define NUM_AUTO_AMMO      2
270 #define NUM_PROJ_AMMO      2
271 
272 // Physics
273 #define NUM_TRACER_PHYSICS 6
274 #define NUM_SLOW_PHYSICS  16
275 #define NUM_CAMERA_PHYSICS 2
276 
277 // Grenade
278 #define NUM_DIRECT_GRENADE 5
279 #define NUM_TIMED_GRENADE  3
280 
281 #define NUM_GUN (NUM_PISTOL_GUN + NUM_AUTO_GUN + NUM_SPECIAL_GUN + NUM_HANDTOHAND_GUN + NUM_BEAM_GUN + NUM_BEAMPROJ_GUN)
282 
283 #define NUM_AMMO                                                                                                 \
284     (NUM_PISTOL_AMMO + NUM_NEEDLE_AMMO + NUM_MAGNUM_AMMO + NUM_RIFLE_AMMO + NUM_FLECHETTE_AMMO + NUM_AUTO_AMMO + \
285      NUM_PROJ_AMMO)
286 
287 #define NUM_PHYSICS (NUM_TRACER_PHYSICS + NUM_SLOW_PHYSICS + NUM_CAMERA_PHYSICS)
288 
289 #define NUM_GRENADE (NUM_DIRECT_GRENADE + NUM_TIMED_GRENADE)
290 
291 // Gun
292 #define GUN_SUBCLASS_PISTOL     0
293 #define GUN_SUBCLASS_AUTO       1
294 #define GUN_SUBCLASS_SPECIAL    2
295 #define GUN_SUBCLASS_HANDTOHAND 3
296 #define GUN_SUBCLASS_BEAM       4
297 #define GUN_SUBCLASS_BEAMPROJ   5
298 
299 // Ammo
300 #define AMMO_SUBCLASS_PISTOL    0
301 #define AMMO_SUBCLASS_NEEDLE    1
302 #define AMMO_SUBCLASS_MAGNUM    2
303 #define AMMO_SUBCLASS_RIFLE     3
304 #define AMMO_SUBCLASS_FLECHETTE 4
305 #define AMMO_SUBCLASS_AUTO      5
306 #define AMMO_SUBCLASS_PROJ      6
307 
308 // Physics
309 #define PHYSICS_SUBCLASS_TRACER 0
310 #define PHYSICS_SUBCLASS_SLOW   1
311 #define PHYSICS_SUBCLASS_CAMERA 2
312 
313 // Grenade
314 #define GRENADE_SUBCLASS_DIRECT 0
315 #define GRENADE_SUBCLASS_TIMED  1
316 
317 #ifdef STRANGE_EFFICIOMATRON_WAY
318 #define GunBase         (&PropsArray)
319 #define GunProps        ((GunProp *)GunBase)
320 #define PistolBase      (GunBase + (sizeof(GunProp) * NUM_GUN))
321 #define PistolProps     ((PistolGunProp *)PistolBase)
322 #define AutoBase        (PistolBase + (sizeof(PistolGunProp * NUM_PISTOL_GUN)))
323 #define AutoProps       ((AutoGunProp *)AutoBase)
324 #define SpecialBase     (AutoBase + (sizeof(AutoGunProp * NUM_AUTO_GUN)))
325 #define SpecialProps    ((SpecialGunProp *)SpecialBase)
326 #define HandtohandBase  (SpecialBase + (sizeof(SpecialGunProp * NUM_SPECIAL_GUN)))
327 #define HandtohandProps ((HandtohandGunProp *)HandtohandBase)
328 #define BeamBase        (HandtohandBase + (sizeof(HandtohandGunProp * NUM_HANDTOHAND_GUN)))
329 #define BeamProps       ((BeamGunProp *)BeamBase)
330 #define BeamprojBase    (BeamBase + (sizeof(BeamGunProp * NUM_BEAM_GUN)))
331 #define BeamprojProps   ((BeamprojGunProp *)BeamprojBase)
332 
333 #define AmmoBase        (BeamprojBase + sizeof(BeamprojGunProp * NUM_BEAMPROJ_GUN))
334 #define AmmoProps       ((AmmoProp *)
335 #endif
336 
337 #ifdef __OBJSIM_SRC
338 GunProp GunProps[NUM_GUN];
339 PistolGunProp PistolGunProps[NUM_PISTOL_GUN];
340 AutoGunProp AutoGunProps[NUM_AUTO_GUN];
341 SpecialGunProp SpecialGunProps[NUM_SPECIAL_GUN];
342 HandtohandGunProp HandtohandGunProps[NUM_HANDTOHAND_GUN];
343 BeamGunProp BeamGunProps[NUM_BEAM_GUN];
344 BeamprojGunProp BeamprojGunProps[NUM_BEAMPROJ_GUN];
345 
346 AmmoProp AmmoProps[NUM_AMMO];
347 PistolAmmoProp PistolAmmoProps[NUM_PISTOL_AMMO];
348 NeedleAmmoProp NeedleAmmoProps[NUM_NEEDLE_AMMO];
349 MagnumAmmoProp MagnumAmmoProps[NUM_MAGNUM_AMMO];
350 RifleAmmoProp RifleAmmoProps[NUM_RIFLE_AMMO];
351 FlechetteAmmoProp FlechetteAmmoProps[NUM_FLECHETTE_AMMO];
352 AutoAmmoProp AutoAmmoProps[NUM_AUTO_AMMO];
353 ProjAmmoProp ProjAmmoProps[NUM_PROJ_AMMO];
354 
355 PhysicsProp PhysicsProps[NUM_PHYSICS];
356 TracerPhysicsProp TracerPhysicsProps[NUM_TRACER_PHYSICS];
357 SlowPhysicsProp SlowPhysicsProps[NUM_SLOW_PHYSICS];
358 CameraPhysicsProp CameraPhysicsProps[NUM_CAMERA_PHYSICS];
359 GrenadeProp GrenadeProps[NUM_GRENADE];
360 DirectGrenadeProp DirectGrenadeProps[NUM_DIRECT_GRENADE];
361 TimedGrenadeProp TimedGrenadeProps[NUM_TIMED_GRENADE];
362 #else
363 extern GunProp GunProps[NUM_GUN];
364 extern PistolGunProp PistolGunProps[NUM_PISTOL_GUN];
365 extern AutoGunProp AutoGunProps[NUM_AUTO_GUN];
366 extern SpecialGunProp SpecialGunProps[NUM_SPECIAL_GUN];
367 extern HandtohandGunProp HandtohandGunProps[NUM_HANDTOHAND_GUN];
368 extern BeamGunProp BeamGunProps[NUM_BEAM_GUN];
369 extern BeamprojGunProp BeamprojGunProps[NUM_BEAMPROJ_GUN];
370 extern AmmoProp AmmoProps[NUM_AMMO];
371 extern PistolAmmoProp PistolAmmoProps[NUM_PISTOL_AMMO];
372 extern NeedleAmmoProp NeedleAmmoProps[NUM_NEEDLE_AMMO];
373 extern MagnumAmmoProp MagnumAmmoProps[NUM_MAGNUM_AMMO];
374 extern RifleAmmoProp RifleAmmoProps[NUM_RIFLE_AMMO];
375 extern FlechetteAmmoProp FlechetteAmmoProps[NUM_FLECHETTE_AMMO];
376 extern AutoAmmoProp AutoAmmoProps[NUM_AUTO_AMMO];
377 extern ProjAmmoProp ProjAmmoProps[NUM_PROJ_AMMO];
378 extern PhysicsProp PhysicsProps[NUM_PHYSICS];
379 extern TracerPhysicsProp TracerPhysicsProps[NUM_TRACER_PHYSICS];
380 extern SlowPhysicsProp SlowPhysicsProps[NUM_SLOW_PHYSICS];
381 extern CameraPhysicsProp CameraPhysicsProps[NUM_CAMERA_PHYSICS];
382 extern GrenadeProp GrenadeProps[NUM_GRENADE];
383 extern DirectGrenadeProp DirectGrenadeProps[NUM_DIRECT_GRENADE];
384 extern TimedGrenadeProp TimedGrenadeProps[NUM_TIMED_GRENADE];
385 #endif
386 
387 #ifdef __OBJSIM_SRC
388 ObjGun objGuns[NUM_OBJECTS_GUN];
389 ObjAmmo objAmmos[NUM_OBJECTS_AMMO];
390 ObjPhysics objPhysicss[NUM_OBJECTS_PHYSICS];
391 ObjGrenade objGrenades[NUM_OBJECTS_GRENADE];
392 ObjGun default_gun;
393 ObjAmmo default_ammo;
394 ObjPhysics default_physics;
395 ObjGrenade default_grenade;
396 #else
397 extern ObjGun objGuns[NUM_OBJECTS_GUN];
398 extern ObjAmmo objAmmos[NUM_OBJECTS_AMMO];
399 extern ObjPhysics objPhysicss[NUM_OBJECTS_PHYSICS];
400 extern ObjGrenade objGrenades[NUM_OBJECTS_GRENADE];
401 extern ObjGun default_gun;
402 extern ObjAmmo default_ammo;
403 extern ObjPhysics default_physics;
404 extern ObjGrenade default_grenade;
405 #endif
406 
407 #endif // __OBJWPN_H
408