1 /* $Id: player.h,v 1.4 2003-10-04 03:14:47 btb Exp $ */
3 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
4 SOFTWARE CORPORATION ("PARALLAX"). PARALLAX, IN DISTRIBUTING THE CODE TO
5 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
6 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
7 IN USING, DISPLAYING, AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
8 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
9 FREE PURPOSES. IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
10 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES. THE END-USER UNDERSTANDS
11 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
12 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION. ALL RIGHTS RESERVED.
17 * Structure information for the player
20 * Revision 1.1 1995/05/16 16:01:11 allender
23 * Revision 2.0 1995/02/27 11:30:25 john
24 * New version 2.0, which has no anonymous unions, builds with
25 * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
27 * Revision 1.41 1994/12/20 17:56:43 yuan
28 * Multiplayer object capability.
30 * Revision 1.40 1994/12/02 15:04:42 matt
31 * Fixed bogus weapon constants and arrays
33 * Revision 1.39 1994/11/25 22:47:08 matt
34 * Made saved game descriptions longer
36 * Revision 1.38 1994/11/21 17:29:38 matt
37 * Cleaned up sequencing & game saving for secret levels
39 * Revision 1.37 1994/11/17 12:57:13 rob
40 * Changed net_kills_level to net_killed_total.
42 * Revision 1.36 1994/11/14 17:20:33 rob
43 * Bumped player file version.
45 * Revision 1.35 1994/11/04 19:55:06 rob
46 * Changed a previously unused pad character to represent whether or not
47 * the player is connected to a net game (used to be objnum=-1 but we
48 * want to keep the objnum info in case of re-joins)
50 * Revision 1.34 1994/10/22 14:13:54 mike
51 * Add homing_object_dist field to player struct.
53 * Revision 1.33 1994/10/22 00:08:45 matt
54 * Fixed up problems with bonus & game sequencing
55 * Player doesn't get credit for hostages unless he gets them out alive
57 * Revision 1.32 1994/10/21 20:43:03 mike
58 * Add hostages_on_board to player struct.
60 * Revision 1.31 1994/10/19 20:00:00 john
61 * Added bonus points at the end of level based on skill level.
63 * Revision 1.30 1994/10/19 15:14:24 john
64 * Took % hits out of player structure, made %kills work properly.
66 * Revision 1.29 1994/10/19 12:12:27 john
67 * Added hour variable.
69 * Revision 1.28 1994/10/17 17:24:48 john
70 * Added starting_level to player struct.
72 * Revision 1.27 1994/10/13 15:42:02 mike
75 * Revision 1.26 1994/10/10 17:00:23 mike
76 * Lower number of players from 10 to 8.
78 * Revision 1.25 1994/10/09 14:53:26 matt
79 * Made player cockpit state & window size save/restore with saved games & automap
81 * Revision 1.24 1994/10/08 20:24:10 matt
82 * Added difficulty level to player structure for game load/save
84 * Revision 1.23 1994/10/05 17:39:53 rob
85 * Changed killer_objnum to a short (was char)
87 * Revision 1.22 1994/10/03 22:59:07 matt
88 * Limit callsign to 8 chars long, so we can use it as filename
90 * Revision 1.21 1994/09/23 10:14:30 mike
91 * Rename PLAYER_FLAGS_INVINCIBLE to PLAYER_FLAGS_INVULNERABLE.
92 * Add INVULNERABLE_TIME_MAX = 30 seconds.
94 * Revision 1.20 1994/09/21 20:44:22 matt
95 * Player explosion fireball now specified in bitmaps.tbl
97 * Revision 1.19 1994/09/21 12:27:37 mike
98 * Move CLOAK_TIME_MAX here from game.c
100 * Revision 1.18 1994/09/16 13:10:16 mike
101 * Add afterburner and cloak stuff.
103 * Revision 1.17 1994/09/11 20:30:26 matt
104 * Cleaned up thrust vars, changing a few names
106 * Revision 1.16 1994/09/09 14:22:45 matt
107 * Added extra gun for player
109 * Revision 1.15 1994/09/07 13:30:11 john
110 * Added code to tell how many packets were lost.
112 * Revision 1.14 1994/09/02 11:56:33 mike
113 * Alignment on the player struct.
115 * Revision 1.13 1994/08/25 18:12:05 matt
116 * Made player's weapons and flares fire from the positions on the 3d model.
117 * Also added support for quad lasers.
119 * Revision 1.12 1994/08/22 15:49:40 mike
120 * change spelling on num_missles -> num_missiles.
122 * Revision 1.11 1994/08/18 10:47:32 john
123 * Cleaned up game sequencing and player death stuff
124 * in preparation for making the player explode into
127 * Revision 1.10 1994/08/17 16:50:05 john
128 * Added damaging fireballs, missiles.
130 * Revision 1.9 1994/08/15 00:24:10 john
131 * First version of netgame with players killing
132 * each other. still buggy...
134 * Revision 1.8 1994/08/12 22:41:26 john
135 * Took away Player_stats; add Players array.
137 * Revision 1.7 1994/08/09 17:53:25 adam
138 * *** empty log message ***
140 * Revision 1.6 1994/07/13 00:15:05 matt
141 * Moved all (or nearly all) of the values that affect player movement to
144 * Revision 1.5 1994/07/08 21:44:17 matt
145 * Made laser powerups saturate correctly
147 * Revision 1.4 1994/07/07 14:59:02 john
148 * Made radar powerups.
151 * Revision 1.3 1994/07/02 13:49:39 matt
152 * Cleaned up includes
154 * Revision 1.2 1994/07/02 13:10:03 matt
155 * Moved player stats struct from gameseq.h to player.h
157 * Revision 1.1 1994/07/02 11:00:43 matt
171 #define MAX_PLAYERS 8
172 #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
174 // Initial player stat values
175 #define INITIAL_ENERGY i2f(100) // 100% energy to start
176 #define INITIAL_SHIELDS i2f(100) // 100% shields to start
178 #define MAX_ENERGY i2f(200) // go up to 200
179 #define MAX_SHIELDS i2f(200)
181 #define INITIAL_LIVES 3 // start off with 3 lives
183 // Values for special flags
184 #define PLAYER_FLAGS_INVULNERABLE 1 // Player is invincible
185 #define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key
186 #define PLAYER_FLAGS_RED_KEY 4 // Player has red key
187 #define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key
188 #define PLAYER_FLAGS_FLAG 16 // Player has his team's flag
189 #define PLAYER_FLAGS_UNUSED 32 //
190 #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map
191 #define PLAYER_FLAGS_AMMO_RACK 128 // Player has ammo rack
192 #define PLAYER_FLAGS_CONVERTER 256 // Player has energy->shield converter
193 #define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally
194 #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once
195 #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile
196 #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged
197 #define PLAYER_FLAGS_HEADLIGHT 8192 // Player has headlight boost
198 #define PLAYER_FLAGS_HEADLIGHT_ON 16384 // is headlight on or off?
200 #define AFTERBURNER_MAX_TIME (F1_0*5) // Max time afterburner can be on.
201 #define CALLSIGN_LEN 8 // so can use as filename (was: 12)
203 // Amount of time player is cloaked.
204 #define CLOAK_TIME_MAX (F1_0*30)
205 #define INVULNERABLE_TIME_MAX (F1_0*30)
207 #define PLAYER_STRUCT_VERSION 17 // increment this every time player struct changes
213 // When this structure changes, increment the constant
214 // SAVE_FILE_VERSION in playsave.c
215 typedef struct player {
217 char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
218 ubyte net_address[6]; // The network address of the player.
219 sbyte connected; // Is the player connected or not?
220 int objnum; // What object number this player is. (made an int by mk because it's very often referenced)
221 int n_packets_got; // How many packets we got from them
222 int n_packets_sent; // How many packets we sent to them
224 // -- make sure you're 4 byte aligned now!
227 uint flags; // Powerup flags, see below...
228 fix energy; // Amount of energy remaining.
229 fix shields; // shields remaining (protection)
230 ubyte lives; // Lives remaining, 0 = game over.
231 sbyte level; // Current level player is playing. (must be signed for secret levels)
232 ubyte laser_level; // Current level of the laser.
233 sbyte starting_level; // What level the player started on.
234 short killer_objnum; // Who killed me.... (-1 if no one)
235 ushort primary_weapon_flags; // bit set indicates the player has this weapon.
236 ushort secondary_weapon_flags; // bit set indicates the player has this weapon.
237 ushort primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type.
238 ushort secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type.
240 ushort pad; // Pad because increased weapon_flags from byte to short -YW 3/22/95
242 // -- make sure you're 4 byte aligned now
245 int last_score; // Score at beginning of current level.
246 int score; // Current score.
247 fix time_level; // Level time played
248 fix time_total; // Game time played (high word = seconds)
250 fix cloak_time; // Time cloaked
251 fix invulnerable_time; // Time invulnerable
253 short KillGoalCount; // Num of players killed this level
254 short net_killed_total; // Number of times killed total
255 short net_kills_total; // Number of net kills total
256 short num_kills_level; // Number of kills this level
257 short num_kills_total; // Number of kills total
258 short num_robots_level; // Number of initial robots this level
259 short num_robots_total; // Number of robots total
260 ushort hostages_rescued_total; // Total number of hostages rescued.
261 ushort hostages_total; // Total number of hostages.
262 ubyte hostages_on_board; // Number of hostages on ship.
263 ubyte hostages_level; // Number of hostages on this level.
264 fix homing_object_dist; // Distance of nearest homing object.
265 sbyte hours_level; // Hours played (since time_total can only go up to 9 hours)
266 sbyte hours_total; // Hours played (since time_total can only go up to 9 hours)
269 #define N_PLAYER_GUNS 8
271 typedef struct player_ship {
275 fix max_thrust,reverse_thrust,brakes; //low_thrust
278 vms_vector gun_points[N_PLAYER_GUNS];
281 extern int N_players; // Number of players ( >1 means a net game, eh?)
282 extern int Player_num; // The player number who is on the console.
284 extern player Players[MAX_PLAYERS+4]; // Misc player info
285 extern player_ship *Player_ship;
288 //version 16 structure
290 #define MAX_PRIMARY_WEAPONS16 5
291 #define MAX_SECONDARY_WEAPONS16 5
293 typedef struct player16 {
295 char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
296 ubyte net_address[6]; // The network address of the player.
297 sbyte connected; // Is the player connected or not?
298 int objnum; // What object number this player is. (made an int by mk because it's very often referenced)
299 int n_packets_got; // How many packets we got from them
300 int n_packets_sent; // How many packets we sent to them
302 // -- make sure you're 4 byte aligned now!
305 uint flags; // Powerup flags, see below...
306 fix energy; // Amount of energy remaining.
307 fix shields; // shields remaining (protection)
308 ubyte lives; // Lives remaining, 0 = game over.
309 sbyte level; // Current level player is playing. (must be signed for secret levels)
310 ubyte laser_level; // Current level of the laser.
311 sbyte starting_level; // What level the player started on.
312 short killer_objnum; // Who killed me.... (-1 if no one)
313 ubyte primary_weapon_flags; // bit set indicates the player has this weapon.
314 ubyte secondary_weapon_flags; // bit set indicates the player has this weapon.
315 ushort primary_ammo[MAX_PRIMARY_WEAPONS16]; // How much ammo of each type.
316 ushort secondary_ammo[MAX_SECONDARY_WEAPONS16];// How much ammo of each type.
318 // -- make sure you're 4 byte aligned now
321 int last_score; // Score at beginning of current level.
322 int score; // Current score.
323 fix time_level; // Level time played
324 fix time_total; // Game time played (high word = seconds)
326 fix cloak_time; // Time cloaked
327 fix invulnerable_time; // Time invulnerable
329 short net_killed_total; // Number of times killed total
330 short net_kills_total; // Number of net kills total
331 short num_kills_level; // Number of kills this level
332 short num_kills_total; // Number of kills total
333 short num_robots_level; // Number of initial robots this level
334 short num_robots_total; // Number of robots total
335 ushort hostages_rescued_total; // Total number of hostages rescued.
336 ushort hostages_total; // Total number of hostages.
337 ubyte hostages_on_board; // Number of hostages on ship.
338 ubyte hostages_level; // Number of hostages on this level.
339 fix homing_object_dist; // Distance of nearest homing object.
340 sbyte hours_level; // Hours played (since time_total can only go up to 9 hours)
341 sbyte hours_total; // Hours played (since time_total can only go up to 9 hours)
345 * reads a player_ship structure from a CFILE
347 void player_ship_read(player_ship *ps, CFILE *fp);