1 /* $Id: player.h,v 1.5 2004-08-28 23:17:45 schaffner 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
30 #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
32 // Initial player stat values
33 #define INITIAL_ENERGY i2f(100) // 100% energy to start
34 #define INITIAL_SHIELDS i2f(100) // 100% shields to start
36 #define MAX_ENERGY i2f(200) // go up to 200
37 #define MAX_SHIELDS i2f(200)
39 #define INITIAL_LIVES 3 // start off with 3 lives
41 // Values for special flags
42 #define PLAYER_FLAGS_INVULNERABLE 1 // Player is invincible
43 #define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key
44 #define PLAYER_FLAGS_RED_KEY 4 // Player has red key
45 #define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key
46 #define PLAYER_FLAGS_FLAG 16 // Player has his team's flag
47 #define PLAYER_FLAGS_UNUSED 32 //
48 #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map
49 #define PLAYER_FLAGS_AMMO_RACK 128 // Player has ammo rack
50 #define PLAYER_FLAGS_CONVERTER 256 // Player has energy->shield converter
51 #define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally
52 #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once
53 #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile
54 #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged
55 #define PLAYER_FLAGS_HEADLIGHT 8192 // Player has headlight boost
56 #define PLAYER_FLAGS_HEADLIGHT_ON 16384 // is headlight on or off?
58 #define AFTERBURNER_MAX_TIME (F1_0*5) // Max time afterburner can be on.
59 #define CALLSIGN_LEN 8 // so can use as filename (was: 12)
61 // Amount of time player is cloaked.
62 #define CLOAK_TIME_MAX (F1_0*30)
63 #define INVULNERABLE_TIME_MAX (F1_0*30)
65 #define PLAYER_STRUCT_VERSION 17 // increment this every time player struct changes
71 // When this structure changes, increment the constant
72 // SAVE_FILE_VERSION in playsave.c
73 typedef struct player {
75 char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
76 ubyte net_address[6]; // The network address of the player.
77 sbyte connected; // Is the player connected or not?
78 int objnum; // What object number this player is. (made an int by mk because it's very often referenced)
79 int n_packets_got; // How many packets we got from them
80 int n_packets_sent; // How many packets we sent to them
82 // -- make sure you're 4 byte aligned now!
85 uint flags; // Powerup flags, see below...
86 fix energy; // Amount of energy remaining.
87 fix shields; // shields remaining (protection)
88 ubyte lives; // Lives remaining, 0 = game over.
89 sbyte level; // Current level player is playing. (must be signed for secret levels)
90 ubyte laser_level; // Current level of the laser.
91 sbyte starting_level; // What level the player started on.
92 short killer_objnum; // Who killed me.... (-1 if no one)
93 ushort primary_weapon_flags; // bit set indicates the player has this weapon.
94 ushort secondary_weapon_flags; // bit set indicates the player has this weapon.
95 ushort primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type.
96 ushort secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type.
98 ushort pad; // Pad because increased weapon_flags from byte to short -YW 3/22/95
100 // -- make sure you're 4 byte aligned now
103 int last_score; // Score at beginning of current level.
104 int score; // Current score.
105 fix time_level; // Level time played
106 fix time_total; // Game time played (high word = seconds)
108 fix cloak_time; // Time cloaked
109 fix invulnerable_time; // Time invulnerable
111 short KillGoalCount; // Num of players killed this level
112 short net_killed_total; // Number of times killed total
113 short net_kills_total; // Number of net kills total
114 short num_kills_level; // Number of kills this level
115 short num_kills_total; // Number of kills total
116 short num_robots_level; // Number of initial robots this level
117 short num_robots_total; // Number of robots total
118 ushort hostages_rescued_total; // Total number of hostages rescued.
119 ushort hostages_total; // Total number of hostages.
120 ubyte hostages_on_board; // Number of hostages on ship.
121 ubyte hostages_level; // Number of hostages on this level.
122 fix homing_object_dist; // Distance of nearest homing object.
123 sbyte hours_level; // Hours played (since time_total can only go up to 9 hours)
124 sbyte hours_total; // Hours played (since time_total can only go up to 9 hours)
127 #define N_PLAYER_GUNS 8
129 typedef struct player_ship {
133 fix max_thrust,reverse_thrust,brakes; //low_thrust
136 vms_vector gun_points[N_PLAYER_GUNS];
139 extern int N_players; // Number of players ( >1 means a net game, eh?)
140 extern int Player_num; // The player number who is on the console.
142 extern player Players[MAX_PLAYERS+4]; // Misc player info
143 extern player_ship *Player_ship;
146 //version 16 structure
148 #define MAX_PRIMARY_WEAPONS16 5
149 #define MAX_SECONDARY_WEAPONS16 5
151 typedef struct player16 {
153 char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
154 ubyte net_address[6]; // The network address of the player.
155 sbyte connected; // Is the player connected or not?
156 int objnum; // What object number this player is. (made an int by mk because it's very often referenced)
157 int n_packets_got; // How many packets we got from them
158 int n_packets_sent; // How many packets we sent to them
160 // -- make sure you're 4 byte aligned now!
163 uint flags; // Powerup flags, see below...
164 fix energy; // Amount of energy remaining.
165 fix shields; // shields remaining (protection)
166 ubyte lives; // Lives remaining, 0 = game over.
167 sbyte level; // Current level player is playing. (must be signed for secret levels)
168 ubyte laser_level; // Current level of the laser.
169 sbyte starting_level; // What level the player started on.
170 short killer_objnum; // Who killed me.... (-1 if no one)
171 ubyte primary_weapon_flags; // bit set indicates the player has this weapon.
172 ubyte secondary_weapon_flags; // bit set indicates the player has this weapon.
173 ushort primary_ammo[MAX_PRIMARY_WEAPONS16]; // How much ammo of each type.
174 ushort secondary_ammo[MAX_SECONDARY_WEAPONS16];// How much ammo of each type.
176 // -- make sure you're 4 byte aligned now
179 int last_score; // Score at beginning of current level.
180 int score; // Current score.
181 fix time_level; // Level time played
182 fix time_total; // Game time played (high word = seconds)
184 fix cloak_time; // Time cloaked
185 fix invulnerable_time; // Time invulnerable
187 short net_killed_total; // Number of times killed total
188 short net_kills_total; // Number of net kills total
189 short num_kills_level; // Number of kills this level
190 short num_kills_total; // Number of kills total
191 short num_robots_level; // Number of initial robots this level
192 short num_robots_total; // Number of robots total
193 ushort hostages_rescued_total; // Total number of hostages rescued.
194 ushort hostages_total; // Total number of hostages.
195 ubyte hostages_on_board; // Number of hostages on ship.
196 ubyte hostages_level; // Number of hostages on this level.
197 fix homing_object_dist; // Distance of nearest homing object.
198 sbyte hours_level; // Hours played (since time_total can only go up to 9 hours)
199 sbyte hours_total; // Hours played (since time_total can only go up to 9 hours)
203 * reads a player_ship structure from a CFILE
205 void player_ship_read(player_ship *ps, CFILE *fp);