home *** CD-ROM | disk | FTP | other *** search
/ Amiga ACS 1998 #6 / amigaacscoverdisc1998-061998.iso / games / descent / source / main / player.h < prev    next >
Text File  |  1998-06-08  |  11KB  |  277 lines

  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-1998 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  12. */
  13. /*
  14.  * $Source: f:/miner/source/main/rcs/player.h $
  15.  * $Revision: 2.0 $
  16.  * $Author: john $
  17.  * $Date: 1995/02/27 11:30:25 $
  18.  * 
  19.  * Structure information for the player
  20.  * 
  21.  * $Log: player.h $
  22.  * Revision 2.0  1995/02/27  11:30:25  john
  23.  * New version 2.0, which has no anonymous unions, builds with
  24.  * Watcom 10.0, and doesn't require parsing BITMAPS.TBL.
  25.  * 
  26.  * Revision 1.41  1994/12/20  17:56:43  yuan
  27.  * Multiplayer object capability.
  28.  * 
  29.  * Revision 1.40  1994/12/02  15:04:42  matt
  30.  * Fixed bogus weapon constants and arrays
  31.  * 
  32.  * Revision 1.39  1994/11/25  22:47:08  matt
  33.  * Made saved game descriptions longer
  34.  * 
  35.  * Revision 1.38  1994/11/21  17:29:38  matt
  36.  * Cleaned up sequencing & game saving for secret levels
  37.  * 
  38.  * Revision 1.37  1994/11/17  12:57:13  rob
  39.  * Changed net_kills_level to net_killed_total.
  40.  * 
  41.  * Revision 1.36  1994/11/14  17:20:33  rob
  42.  * Bumped player file version.
  43.  * 
  44.  * Revision 1.35  1994/11/04  19:55:06  rob
  45.  * Changed a previously unused pad character to represent whether or not
  46.  * the player is connected to a net game (used to be objnum=-1 but we
  47.  * want to keep the objnum info in case of re-joins)
  48.  * 
  49.  * Revision 1.34  1994/10/22  14:13:54  mike
  50.  * Add homing_object_dist field to player struct.
  51.  * 
  52.  * Revision 1.33  1994/10/22  00:08:45  matt
  53.  * Fixed up problems with bonus & game sequencing
  54.  * Player doesn't get credit for hostages unless he gets them out alive
  55.  * 
  56.  * Revision 1.32  1994/10/21  20:43:03  mike
  57.  * Add hostages_on_board to player struct.
  58.  * 
  59.  * Revision 1.31  1994/10/19  20:00:00  john
  60.  * Added bonus points at the end of level based on skill level.
  61.  * 
  62.  * Revision 1.30  1994/10/19  15:14:24  john
  63.  * Took % hits out of player structure, made %kills work properly.
  64.  * 
  65.  * Revision 1.29  1994/10/19  12:12:27  john
  66.  * Added hour variable.
  67.  * 
  68.  * Revision 1.28  1994/10/17  17:24:48  john
  69.  * Added starting_level to player struct.
  70.  * 
  71.  * Revision 1.27  1994/10/13  15:42:02  mike
  72.  * Remove afterburner.
  73.  * 
  74.  * Revision 1.26  1994/10/10  17:00:23  mike
  75.  * Lower number of players from 10 to 8.
  76.  * 
  77.  * Revision 1.25  1994/10/09  14:53:26  matt
  78.  * Made player cockpit state & window size save/restore with saved games & automap
  79.  * 
  80.  * Revision 1.24  1994/10/08  20:24:10  matt
  81.  * Added difficulty level to player structure for game load/save
  82.  * 
  83.  * Revision 1.23  1994/10/05  17:39:53  rob
  84.  * Changed killer_objnum to a short (was char)
  85.  * 
  86.  * Revision 1.22  1994/10/03  22:59:07  matt
  87.  * Limit callsign to 8 chars long, so we can use it as filename
  88.  * 
  89.  * Revision 1.21  1994/09/23  10:14:30  mike
  90.  * Rename PLAYER_FLAGS_INVINCIBLE to PLAYER_FLAGS_INVULNERABLE.
  91.  * Add INVULNERABLE_TIME_MAX = 30 seconds.
  92.  * 
  93.  * Revision 1.20  1994/09/21  20:44:22  matt
  94.  * Player explosion fireball now specified in bitmaps.tbl
  95.  * 
  96.  * Revision 1.19  1994/09/21  12:27:37  mike
  97.  * Move CLOAK_TIME_MAX here from game.c
  98.  * 
  99.  * Revision 1.18  1994/09/16  13:10:16  mike
  100.  * Add afterburner and cloak stuff.
  101.  * 
  102.  * Revision 1.17  1994/09/11  20:30:26  matt
  103.  * Cleaned up thrust vars, changing a few names
  104.  * 
  105.  * Revision 1.16  1994/09/09  14:22:45  matt
  106.  * Added extra gun for player
  107.  * 
  108.  * Revision 1.15  1994/09/07  13:30:11  john
  109.  * Added code to tell how many packets were lost.
  110.  * 
  111.  * Revision 1.14  1994/09/02  11:56:33  mike
  112.  * Alignment on the player struct.
  113.  * 
  114.  * Revision 1.13  1994/08/25  18:12:05  matt
  115.  * Made player's weapons and flares fire from the positions on the 3d model.
  116.  * Also added support for quad lasers.
  117.  * 
  118.  * Revision 1.12  1994/08/22  15:49:40  mike
  119.  * change spelling on num_missles -> num_missiles.
  120.  * 
  121.  * Revision 1.11  1994/08/18  10:47:32  john
  122.  * Cleaned up game sequencing and player death stuff
  123.  * in preparation for making the player explode into
  124.  * pieces when dead.
  125.  * 
  126.  * Revision 1.10  1994/08/17  16:50:05  john
  127.  * Added damaging fireballs, missiles.
  128.  * 
  129.  * Revision 1.9  1994/08/15  00:24:10  john
  130.  * First version of netgame with players killing
  131.  * each other. still buggy...
  132.  * 
  133.  * Revision 1.8  1994/08/12  22:41:26  john
  134.  * Took away Player_stats; add Players array.
  135.  * 
  136.  * Revision 1.7  1994/08/09  17:53:25  adam
  137.  * *** empty log message ***
  138.  * 
  139.  * Revision 1.6  1994/07/13  00:15:05  matt
  140.  * Moved all (or nearly all) of the values that affect player movement to 
  141.  * bitmaps.tbl
  142.  * 
  143.  * Revision 1.5  1994/07/08  21:44:17  matt
  144.  * Made laser powerups saturate correctly
  145.  * 
  146.  * Revision 1.4  1994/07/07  14:59:02  john
  147.  * Made radar powerups.
  148.  * 
  149.  * 
  150.  * Revision 1.3  1994/07/02  13:49:39  matt
  151.  * Cleaned up includes
  152.  * 
  153.  * Revision 1.2  1994/07/02  13:10:03  matt
  154.  * Moved player stats struct from gameseq.h to player.h
  155.  * 
  156.  * Revision 1.1  1994/07/02  11:00:43  matt
  157.  * Initial revision
  158.  * 
  159.  * 
  160.  */
  161.  
  162.  
  163.  
  164. #ifndef _PLAYER_H
  165. #define _PLAYER_H
  166.  
  167. #include "inferno.h"
  168. #include "fix.h"
  169. #include "vecmat.h"
  170. #include "weapon.h"
  171.  
  172. #define MAX_PLAYERS 8
  173. #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
  174.  
  175. // Initial player stat values
  176. #define MAX_ENERGY                         i2f(100)    //100% energy to start
  177. #define MAX_SHIELDS                         i2f(100)    //100% shields to start
  178. #define INITIAL_LIVES                    3            //start off with 3 lives
  179.  
  180. // Values for special flags
  181. #define PLAYER_FLAGS_INVULNERABLE        1            // Player is invincible
  182. #define PLAYER_FLAGS_BLUE_KEY            2            // Player has blue key
  183. #define PLAYER_FLAGS_RED_KEY            4            // Player has red key
  184. #define PLAYER_FLAGS_GOLD_KEY            8            // Player has gold key
  185. #define PLAYER_FLAGS_IMMATERIAL        16            // Player is immaterial
  186. #define PLAYER_FLAGS_MAP_ENEMIES        32            // Player can see enemies on map
  187. #define PLAYER_FLAGS_MAP_ALL            64            // Player can see unvisited areas on map
  188. #define PLAYER_FLAGS_RADAR_ENEMIES    128        // Player can see enemies on radar
  189. #define PLAYER_FLAGS_RADAR_POWERUPS    256        // Player can see powerups
  190. #define PLAYER_FLAGS_MAP_ALL_CHEAT    512        // Player can see unvisited areas on map normally
  191. #define PLAYER_FLAGS_QUAD_LASERS        1024        // Player shoots 4 at once
  192. #define PLAYER_FLAGS_CLOAKED            2048        // Player is cloaked for awhile
  193. #define PLAYER_FLAGS_AFTERBURNER        4096        //    Player's afterburner is engaged
  194.  
  195. #define    AFTERBURNER_MAX_TIME            (F1_0*5)    //    Max time afterburner can be on.
  196. #define CALLSIGN_LEN                     8        //so can use as filename (was: 12)
  197.  
  198. //    Amount of time player is cloaked.
  199. #define    CLOAK_TIME_MAX                (F1_0*30)
  200. #define    INVULNERABLE_TIME_MAX    (F1_0*30)
  201.  
  202. #define PLAYER_STRUCT_VERSION     16        //increment this every time player struct changes
  203.  
  204. //When this structure changes, increment the constant SAVE_FILE_VERSION
  205. //in playsave.c
  206. typedef struct player {
  207.     // Who am I data
  208.     char        callsign[CALLSIGN_LEN+1];    // The callsign of this player, for net purposes.
  209.     ubyte        net_address[6];                // The network address of the player.
  210.     byte        connected;                         //    Is the player connected or not?
  211.     int        objnum;                            // What object number this player is. (made an int by mk because it's very often referenced)
  212.     int        n_packets_got;                    // How many packets we got from them
  213.     int        n_packets_sent;                // How many packets we sent to them
  214.  
  215.     //    -- make sure you're 4 byte aligned now!
  216.  
  217.     // Game data
  218.     uint        flags;                            // Powerup flags, see below...
  219.     fix        energy;                            // Amount of energy remaining.
  220.     fix        shields;                            // shields remaining (protection) 
  221.     ubyte        lives;                            // Lives remaining, 0 = game over.
  222.     byte        level;                            // Current level player is playing. (must be signed for secret levels)
  223.     ubyte        laser_level;                    //    Current level of the laser.
  224.     byte     starting_level;                // What level the player started on.
  225.     short         killer_objnum;                    // Who killed me.... (-1 if no one)
  226.     ubyte        primary_weapon_flags;                    //    bit set indicates the player has this weapon.
  227.     ubyte        secondary_weapon_flags;                    //    bit set indicates the player has this weapon.
  228.     ushort    primary_ammo[MAX_PRIMARY_WEAPONS];    // How much ammo of each type.
  229.     ushort    secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type.
  230.  
  231.     //    -- make sure you're 4 byte aligned now
  232.  
  233.     // Statistics...
  234.     int        last_score;                    // Score at beginning of current level.
  235.     int        score;                            // Current score.
  236.     fix        time_level;                        // Level time played
  237.     fix        time_total;                        // Game time played (high word = seconds)
  238.  
  239.     fix        cloak_time;                        // Time cloaked
  240.     fix        invulnerable_time;            // Time invulnerable
  241.  
  242.     short        net_killed_total;                // Number of times killed total
  243.      short        net_kills_total;                // Number of net kills total
  244.     short        num_kills_level;                // Number of kills this level
  245.      short        num_kills_total;                // Number of kills total
  246.     short        num_robots_level;             // Number of initial robots this level
  247.     short        num_robots_total;             // Number of robots total
  248.     ushort     hostages_rescued_total;        // Total number of hostages rescued.
  249.     ushort    hostages_total;                // Total number of hostages.
  250.     ubyte        hostages_on_board;            //    Number of hostages on ship.
  251.     ubyte        hostages_level;                // Number of hostages on this level.
  252.     fix        homing_object_dist;            //    Distance of nearest homing object.
  253.     byte        hours_level;                    // Hours played (since time_total can only go up to 9 hours)
  254.     byte        hours_total;                    // Hours played (since time_total can only go up to 9 hours)
  255. } player;                              
  256.  
  257. #define N_PLAYER_GUNS 8
  258.  
  259. typedef struct player_ship {
  260.     int         model_num;
  261.     int        expl_vclip_num;
  262.     fix        mass,drag;
  263.     fix        max_thrust,reverse_thrust,brakes;        //low_thrust
  264.     fix        wiggle;
  265.     fix        max_rotthrust;
  266.     vms_vector gun_points[N_PLAYER_GUNS];
  267. } player_ship;
  268.  
  269. extern int N_players;                                // Number of players ( >1 means a net game, eh?)
  270. extern int Player_num;                                // The player number who is on the console.
  271.  
  272. extern player Players[MAX_PLAYERS];                // Misc player info
  273. extern player_ship *Player_ship;
  274.  
  275. #endif
  276. 
  277.