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