]> icculus.org git repositories - btb/d2x.git/blob - main/player.h
remove rcs tags
[btb/d2x.git] / main / player.h
1 /*
2 THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
3 SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
4 END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
5 ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
6 IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
7 SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
8 FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
9 CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
10 AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
11 COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
12 */
13
14 /*
15  *
16  * Structure information for the player
17  *
18  */
19
20 #ifndef _PLAYER_H
21 #define _PLAYER_H
22
23 #include "inferno.h"
24 #include "fix.h"
25 #include "vecmat.h"
26 #include "weapon.h"
27
28 #define MAX_PLAYERS 8
29 #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
30
31 // Initial player stat values
32 #define INITIAL_ENERGY  i2f(100)    // 100% energy to start
33 #define INITIAL_SHIELDS i2f(100)    // 100% shields to start
34
35 #define MAX_ENERGY      i2f(200)    // go up to 200
36 #define MAX_SHIELDS     i2f(200)
37
38 #define INITIAL_LIVES               3   // start off with 3 lives
39
40 // Values for special flags
41 #define PLAYER_FLAGS_INVULNERABLE   1       // Player is invincible
42 #define PLAYER_FLAGS_BLUE_KEY       2       // Player has blue key
43 #define PLAYER_FLAGS_RED_KEY        4       // Player has red key
44 #define PLAYER_FLAGS_GOLD_KEY       8       // Player has gold key
45 #define PLAYER_FLAGS_FLAG           16      // Player has his team's flag
46 #define PLAYER_FLAGS_UNUSED         32      //
47 #define PLAYER_FLAGS_MAP_ALL        64      // Player can see unvisited areas on map
48 #define PLAYER_FLAGS_AMMO_RACK      128     // Player has ammo rack
49 #define PLAYER_FLAGS_CONVERTER      256     // Player has energy->shield converter
50 #define PLAYER_FLAGS_MAP_ALL_CHEAT  512     // Player can see unvisited areas on map normally
51 #define PLAYER_FLAGS_QUAD_LASERS    1024    // Player shoots 4 at once
52 #define PLAYER_FLAGS_CLOAKED        2048    // Player is cloaked for awhile
53 #define PLAYER_FLAGS_AFTERBURNER    4096    // Player's afterburner is engaged
54 #define PLAYER_FLAGS_HEADLIGHT      8192    // Player has headlight boost
55 #define PLAYER_FLAGS_HEADLIGHT_ON   16384   // is headlight on or off?
56
57 #define AFTERBURNER_MAX_TIME    (F1_0*5)    // Max time afterburner can be on.
58 #define CALLSIGN_LEN                8       // so can use as filename (was: 12)
59
60 // Amount of time player is cloaked.
61 #define CLOAK_TIME_MAX          (F1_0*30)
62 #define INVULNERABLE_TIME_MAX   (F1_0*30)
63
64 #define PLAYER_STRUCT_VERSION   17  // increment this every time player struct changes
65
66 // defines for teams
67 #define TEAM_BLUE   0
68 #define TEAM_RED    1
69
70 // When this structure changes, increment the constant
71 // SAVE_FILE_VERSION in playsave.c
72 typedef struct player {
73         // Who am I data
74         char    callsign[CALLSIGN_LEN+1];   // The callsign of this player, for net purposes.
75         ubyte   net_address[6];         // The network address of the player.
76         sbyte   connected;              // Is the player connected or not?
77         int     objnum;                 // What object number this player is. (made an int by mk because it's very often referenced)
78         int     n_packets_got;          // How many packets we got from them
79         int     n_packets_sent;         // How many packets we sent to them
80
81         //  -- make sure you're 4 byte aligned now!
82
83         // Game data
84         uint    flags;                  // Powerup flags, see below...
85         fix     energy;                 // Amount of energy remaining.
86         fix     shields;                // shields remaining (protection)
87         ubyte   lives;                  // Lives remaining, 0 = game over.
88         sbyte   level;                  // Current level player is playing. (must be signed for secret levels)
89         ubyte   laser_level;            // Current level of the laser.
90         sbyte   starting_level;         // What level the player started on.
91         short   killer_objnum;          // Who killed me.... (-1 if no one)
92         ushort  primary_weapon_flags;   // bit set indicates the player has this weapon.
93         ushort  secondary_weapon_flags; // bit set indicates the player has this weapon.
94         ushort  primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type.
95         ushort  secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type.
96
97         ushort  pad; // Pad because increased weapon_flags from byte to short -YW 3/22/95
98
99         //  -- make sure you're 4 byte aligned now
100
101         // Statistics...
102         int     last_score;             // Score at beginning of current level.
103         int     score;                  // Current score.
104         fix     time_level;             // Level time played
105         fix     time_total;             // Game time played (high word = seconds)
106
107         fix     cloak_time;             // Time cloaked
108         fix     invulnerable_time;      // Time invulnerable
109
110         short   KillGoalCount;          // Num of players killed this level
111         short   net_killed_total;       // Number of times killed total
112         short   net_kills_total;        // Number of net kills total
113         short   num_kills_level;        // Number of kills this level
114         short   num_kills_total;        // Number of kills total
115         short   num_robots_level;       // Number of initial robots this level
116         short   num_robots_total;       // Number of robots total
117         ushort  hostages_rescued_total; // Total number of hostages rescued.
118         ushort  hostages_total;         // Total number of hostages.
119         ubyte   hostages_on_board;      // Number of hostages on ship.
120         ubyte   hostages_level;         // Number of hostages on this level.
121         fix     homing_object_dist;     // Distance of nearest homing object.
122         sbyte   hours_level;            // Hours played (since time_total can only go up to 9 hours)
123         sbyte   hours_total;            // Hours played (since time_total can only go up to 9 hours)
124 } __pack__ player;
125
126 #define N_PLAYER_GUNS 8
127
128 typedef struct player_ship {
129         int     model_num;
130         int     expl_vclip_num;
131         fix     mass,drag;
132         fix     max_thrust,reverse_thrust,brakes;       //low_thrust
133         fix     wiggle;
134         fix     max_rotthrust;
135         vms_vector gun_points[N_PLAYER_GUNS];
136 } player_ship;
137
138 extern int N_players;   // Number of players ( >1 means a net game, eh?)
139 extern int Player_num;  // The player number who is on the console.
140
141 extern player Players[MAX_PLAYERS+4];   // Misc player info
142 extern player_ship *Player_ship;
143
144
145 //version 16 structure
146
147 #define MAX_PRIMARY_WEAPONS16   5
148 #define MAX_SECONDARY_WEAPONS16 5
149
150 typedef struct player16 {
151         // Who am I data
152         char    callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
153         ubyte   net_address[6];         // The network address of the player.
154         sbyte   connected;              // Is the player connected or not?
155         int     objnum;                 // What object number this player is. (made an int by mk because it's very often referenced)
156         int     n_packets_got;          // How many packets we got from them
157         int     n_packets_sent;         // How many packets we sent to them
158
159         //  -- make sure you're 4 byte aligned now!
160
161         // Game data
162         uint    flags;                  // Powerup flags, see below...
163         fix     energy;                 // Amount of energy remaining.
164         fix     shields;                // shields remaining (protection)
165         ubyte   lives;                  // Lives remaining, 0 = game over.
166         sbyte   level;                  // Current level player is playing. (must be signed for secret levels)
167         ubyte   laser_level;            // Current level of the laser.
168         sbyte   starting_level;         // What level the player started on.
169         short   killer_objnum;          // Who killed me.... (-1 if no one)
170         ubyte   primary_weapon_flags;   // bit set indicates the player has this weapon.
171         ubyte   secondary_weapon_flags; // bit set indicates the player has this weapon.
172         ushort  primary_ammo[MAX_PRIMARY_WEAPONS16];    // How much ammo of each type.
173         ushort  secondary_ammo[MAX_SECONDARY_WEAPONS16];// How much ammo of each type.
174
175         //  -- make sure you're 4 byte aligned now
176
177         // Statistics...
178         int     last_score;             // Score at beginning of current level.
179         int     score;                  // Current score.
180         fix     time_level;             // Level time played
181         fix     time_total;             // Game time played (high word = seconds)
182
183         fix     cloak_time;             // Time cloaked
184         fix     invulnerable_time;      // Time invulnerable
185
186         short   net_killed_total;       // Number of times killed total
187         short   net_kills_total;        // Number of net kills total
188         short   num_kills_level;        // Number of kills this level
189         short   num_kills_total;        // Number of kills total
190         short   num_robots_level;       // Number of initial robots this level
191         short   num_robots_total;       // Number of robots total
192         ushort  hostages_rescued_total; // Total number of hostages rescued.
193         ushort  hostages_total;         // Total number of hostages.
194         ubyte   hostages_on_board;      // Number of hostages on ship.
195         ubyte   hostages_level;         // Number of hostages on this level.
196         fix     homing_object_dist;     // Distance of nearest homing object.
197         sbyte   hours_level;            // Hours played (since time_total can only go up to 9 hours)
198         sbyte   hours_total;            // Hours played (since time_total can only go up to 9 hours)
199 } __pack__ player16;
200
201 /*
202  * reads a player_ship structure from a CFILE
203  */
204 void player_ship_read(player_ship *ps, CFILE *fp);
205
206 #endif