Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
WeaponDesign.h
Go to the documentation of this file.
1 /* Project Starshatter 4.5
2  Destroyer Studios LLC
3  Copyright © 1997-2004. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: WeaponDesign.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Weapon (gun or missile launcher) Design parameters class
13 */
14 
15 #ifndef WeaponDesign_h
16 #define WeaponDesign_h
17 
18 #include "Types.h"
19 #include "Geometry.h"
20 #include "Color.h"
21 #include "List.h"
22 #include "Text.h"
23 
24 // +--------------------------------------------------------------------+
25 
26 class Bitmap;
27 class Model;
28 class Sound;
29 
30 // +--------------------------------------------------------------------+
31 
33 {
34 public:
35  static const char* TYPENAME() { return "WeaponDesign"; }
36 
37  enum CONSTANTS {
39  DMG_EMP =1,
42  };
43 
44  WeaponDesign();
45  ~WeaponDesign();
46  int operator == (const WeaponDesign& rhs) const { return (type == rhs.type) ||
47  (name == rhs.name); }
48 
49  static void Initialize(const char* filename);
50  static void Close();
51 
52  static WeaponDesign* Get(int type);
53  static WeaponDesign* Find(const char* name);
54  static WeaponDesign* FindModDesign(const char* name);
55  static void ClearModCatalog();
56  static int GetDesignList(List<Text>& designs);
57 
58  // identification:
59  int type; // unique id
62  Text description; // background info for tactical reference
63  bool secret; // don't display in the tactical reference
64 
65  bool drone; // visible to sensors?
66  bool primary; // laser or missile?
67  bool beam; // if laser, beam or bolt?
68  bool self_aiming; // turret or fixed?
69  bool syncro; // fire all barrels?
70  bool flak; // splash damage
71  int guided; // straight, pure pursuit, lead pursuit
72  int value; // AI importance of system
73  int decoy_type; // Ship Classifcation of decoy signature
74  bool probe; // is sensor probe?
75  DWORD target_type; // bitmask of acceptable target classes
76 
77  // for turrets:
78  Vec3 muzzle_pts[MAX_STORES]; // default turret muzzle points
79  int nbarrels; // number of barrels on the turret
80 
81  // for missile hard points:
82  bool visible_stores; // are external stores visible?
83  Vec3 attachments[MAX_STORES]; // attachment points on the rail
84  int nstores; // number of stores on this hard point
85  Vec3 eject; // eject velocity from rail in 3D
86 
87  // auto-aiming arc
88  float firing_cone; // maximum deflection in any orientation
89  float aim_az_max; // maximum deflection in azimuth
90  float aim_az_min; // minimum deflection in azimuth
91  float aim_az_rest; // azimuth of turret at rest
92  float aim_el_max; // maximum deflection in elevation
93  float aim_el_min; // minimum deflection in elevation
94  float aim_el_rest; // elevation of turret at rest
95  float slew_rate; // max rate of turret slew in rad/sec
96  int turret_axis; // 0=az 1=el 2=not supported
97 
98  // functional parameters:
99  float capacity; // full charge (joules)
100  float recharge_rate; // watts
101  float refire_delay; // seconds - mechanical limit
102  float salvo_delay; // seconds - ai refire time
103  int ammo;
104  int ripple_count; // number of rounds per salvo
105 
106  // carrying costs per shot:
107  float charge; // energy cost of full charge
108  float min_charge; // minimum energy needed to fire
109  float carry_mass;
111 
112  // shot parameters:
113  int damage_type; // 0: normal, 1: EMP, 2: power drain
114  float damage; // if beam, damage per second;
115  // else, damage per shot.
116  float penetration; // ability to pierce shields, 1 is default
117  float speed;
118  float life;
119  float mass;
120  float drag;
121  float thrust;
122  float roll_rate;
123  float pitch_rate;
124  float yaw_rate;
125  float roll_drag;
126  float pitch_drag;
127  float yaw_drag;
128  float integrity; // hit points for drones = 100
129  float lethal_radius; // detonation range for missiles
130 
131  float det_range; // detonation range for cluster weapons
132  Text det_child; // type of submunition
133  int det_count; // number of submunitions
134  float det_spread; // spread of submunition deployment
135 
136  // HUD parameters:
137  float min_range;
138  float max_range;
139  float max_track;
140 
141  // shot representation:
142  int graphic_type; // sprite or blob?
143  float width; // blob width
144  float length; // blob length
145  float scale; // sprite scale
146  float explosion_scale; // scale factor for damage to this drone
147  float light; // light emitted by shot
148  Color light_color; // color of light emitted by shot
149  float flash_scale; // size of muzzle flash sprite
150  float flare_scale; // size of drive flare sprite
151 
152  float spread_az; // spread range in radians
153  float spread_el; // spread range in radians
154 
166 
177 
179  float trail_width;
181 
182 private:
183  static void LoadDesign(const char* path, const char* filename, bool mod=false);
184 };
185 
186 #endif WeaponDesign_h
187