Starshatter_Open
Open source Starshatter engine
 All Classes Files Functions Variables Typedefs Enumerations Enumerator Friends Macros
ShipDesign.h
Go to the documentation of this file.
1 /* Project Starshatter 4.6
2  Destroyer Studios LLC
3  Copyright © 1997-2006. All Rights Reserved.
4 
5  SUBSYSTEM: Stars.exe
6  FILE: ShipDesign.h
7  AUTHOR: John DiCamillo
8 
9 
10  OVERVIEW
11  ========
12  Starship Design parameters class
13 */
14 
15 #ifndef ShipDesign_h
16 #define ShipDesign_h
17 
18 #include "Types.h"
19 #include "Bitmap.h"
20 #include "Geometry.h"
21 #include "term.h"
22 #include "List.h"
23 
24 // +----------------------------------------------------------------------+
25 
26 class ShipDesign;
27 class Model;
28 class Skin;
29 class PowerSource;
30 class Weapon;
31 class HardPoint;
32 class Computer;
33 class Drive;
34 class QuantumDrive;
35 class Farcaster;
36 class Thruster;
37 class Sensor;
38 class NavLight;
39 class NavSystem;
40 class Shield;
41 class FlightDeck;
42 class LandingGear;
43 class System;
44 class Sound;
45 
46 // +====================================================================+
47 
48 class ShipLoad
49 {
50 public:
51  static const char* TYPENAME() { return "ShipLoad"; }
52 
53  ShipLoad();
54 
55  char name[64];
56  int load[16];
57  double mass;
58 };
59 
61 {
62 public:
63  static const char* TYPENAME() { return "ShipSquadron"; }
64 
65  ShipSquadron();
66 
67  char name[64];
69  int count;
70  int avail;
71 };
72 
74 {
75 public:
76  static const char* TYPENAME() { return "ShipExplosion"; }
77 
78  ShipExplosion() { ZeroMemory(this, sizeof(ShipExplosion)); }
79 
80  int type;
81  float time;
83  bool final;
84 };
85 
87 {
88 public:
89  static const char* TYPENAME() { return "ShipDebris"; }
90 
91  ShipDebris() { ZeroMemory(this, sizeof(ShipDebris)); }
92 
94  int count;
95  int life;
97  float mass;
98  float speed;
99  float drag;
102 };
103 
104 // +====================================================================+
105 // Used to share common information about ships of a single type.
106 // ShipDesign objects are loaded from a text file and stored in a
107 // static list (catalog) member for use by the Ship.
108 
110 {
111 public:
112  static const char* TYPENAME() { return "ShipDesign"; }
113 
114  enum CONSTANTS {
117  };
118 
119  ShipDesign();
120  ShipDesign(const char* name, const char* path, const char* filename, bool secret=false);
121  ~ShipDesign();
122 
123  // public interface:
124  static void Initialize();
125  static void Close();
126  static bool CheckName(const char* name);
127  static ShipDesign* Get(const char* design_name, const char* design_path=0);
128  static ShipDesign* FindModDesign(const char* design_name, const char* design_path=0);
129  static void ClearModCatalog();
130  static int GetDesignList(int type, List<Text>& designs); // never destroy the design list!
131 
132  static int ClassForName(const char* name);
133  static const char* ClassName(int type);
134 
135  static int LoadCatalog(const char* path, const char* file, bool mod=false);
136  static void LoadSkins(const char* path, const char* archive=0);
137  static void PreloadCatalog(int index=-1);
138  static int StandardCatalogSize();
139 
140  int operator == (const ShipDesign& s) const { return !strncmp(name, s.name, 31); }
141 
142  // Parser:
143  void ParseShip(TermDef* def);
144 
145  void ParsePower(TermStruct* val);
146  void ParseDrive(TermStruct* val);
147  void ParseQuantumDrive(TermStruct* val);
148  void ParseFarcaster(TermStruct* val);
149  void ParseThruster(TermStruct* val);
150  void ParseNavlight(TermStruct* val);
151  void ParseFlightDeck(TermStruct* val);
152  void ParseLandingGear(TermStruct* val);
153  void ParseWeapon(TermStruct* val);
154  void ParseHardPoint(TermStruct* val);
155  void ParseSensor(TermStruct* val);
156  void ParseNavsys(TermStruct* val);
157  void ParseComputer(TermStruct* val);
158  void ParseShield(TermStruct* val);
159  void ParseDeathSpiral(TermStruct* val);
160  void ParseExplosion(TermStruct* val, int index);
161  void ParseDebris(TermStruct* val, int index);
162  void ParseLoadout(TermStruct* val);
163  void ParseMap(TermStruct* val);
164  void ParseSquadron(TermStruct* val);
165  Skin* ParseSkin(TermStruct* val);
166  void ParseSkinMtl(TermStruct* val, Skin* skin);
167 
168  // general information:
169  const char* DisplayName() const;
170 
171  char filename[64];
172  char path_name[64];
173  char name[64];
174  char display_name[64];
175  char abrv[16];
176  int type;
177  float scale;
179  bool valid;
180  bool secret; // don't display in editor
181  Text description; // background info for tactical reference
182 
183  // LOD representation:
187  float feature_size[4];
189 
190  // player selectable skins:
192  const Skin* FindSkin(const char* skin_name) const;
193 
194  // virtual cockpit:
197 
198  // performance:
199  float vlimit;
200  float agility;
201  float air_factor;
202  float roll_rate;
203  float pitch_rate;
204  float yaw_rate;
205  float trans_x;
206  float trans_y;
207  float trans_z;
208  float turn_bank;
212 
213  float prep_time;
214 
215  // physical data:
217  float arcade_drag;
219 
220  // aero data:
221  float CL, CD, stall;
222 
223  // weapons:
224  int primary;
226 
227  // drives:
229 
230  // visibility:
231  float pcs; // passive sensor cross section
232  float acs; // active sensor cross section
233  float detet; // maximum detection range
234  float e_factor[3]; // pcs scaling by emcon setting
235 
236  // ai settings:
237  float avoid_time;
242 
243  // death spriral sequence:
248 
266 
268  float scuttle;
274 
277 
280 
284 
287 };
288 
289 // +--------------------------------------------------------------------+
290 
291 #endif ShipDesign_h
292