PLAYER.H 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277
  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. #ifndef _PLAYER_H
  162. #define _PLAYER_H
  163. #include "inferno.h"
  164. #include "fix.h"
  165. #include "vecmat.h"
  166. #include "weapon.h"
  167. #define MAX_PLAYERS 8
  168. #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
  169. // Initial player stat values
  170. #define MAX_ENERGY i2f(100) //100% energy to start
  171. #define MAX_SHIELDS i2f(100) //100% shields to start
  172. #define INITIAL_LIVES 3 //start off with 3 lives
  173. // Values for special flags
  174. #define PLAYER_FLAGS_INVULNERABLE 1 // Player is invincible
  175. #define PLAYER_FLAGS_BLUE_KEY 2 // Player has blue key
  176. #define PLAYER_FLAGS_RED_KEY 4 // Player has red key
  177. #define PLAYER_FLAGS_GOLD_KEY 8 // Player has gold key
  178. #define PLAYER_FLAGS_IMMATERIAL 16 // Player is immaterial
  179. #define PLAYER_FLAGS_MAP_ENEMIES 32 // Player can see enemies on map
  180. #define PLAYER_FLAGS_MAP_ALL 64 // Player can see unvisited areas on map
  181. #define PLAYER_FLAGS_RADAR_ENEMIES 128 // Player can see enemies on radar
  182. #define PLAYER_FLAGS_RADAR_POWERUPS 256 // Player can see powerups
  183. #define PLAYER_FLAGS_MAP_ALL_CHEAT 512 // Player can see unvisited areas on map normally
  184. #define PLAYER_FLAGS_QUAD_LASERS 1024 // Player shoots 4 at once
  185. #define PLAYER_FLAGS_CLOAKED 2048 // Player is cloaked for awhile
  186. #define PLAYER_FLAGS_AFTERBURNER 4096 // Player's afterburner is engaged
  187. #define AFTERBURNER_MAX_TIME (F1_0*5) // Max time afterburner can be on.
  188. #define CALLSIGN_LEN 8 //so can use as filename (was: 12)
  189. // Amount of time player is cloaked.
  190. #define CLOAK_TIME_MAX (F1_0*30)
  191. #define INVULNERABLE_TIME_MAX (F1_0*30)
  192. #define PLAYER_STRUCT_VERSION 16 //increment this every time player struct changes
  193. //When this structure changes, increment the constant SAVE_FILE_VERSION
  194. //in playsave.c
  195. typedef struct player {
  196. // Who am I data
  197. char callsign[CALLSIGN_LEN+1]; // The callsign of this player, for net purposes.
  198. ubyte net_address[6]; // The network address of the player.
  199. byte connected; // Is the player connected or not?
  200. int objnum; // What object number this player is. (made an int by mk because it's very often referenced)
  201. int n_packets_got; // How many packets we got from them
  202. int n_packets_sent; // How many packets we sent to them
  203. // -- make sure you're 4 byte aligned now!
  204. // Game data
  205. uint flags; // Powerup flags, see below...
  206. fix energy; // Amount of energy remaining.
  207. fix shields; // shields remaining (protection)
  208. ubyte lives; // Lives remaining, 0 = game over.
  209. byte level; // Current level player is playing. (must be signed for secret levels)
  210. ubyte laser_level; // Current level of the laser.
  211. byte starting_level; // What level the player started on.
  212. short killer_objnum; // Who killed me.... (-1 if no one)
  213. ubyte primary_weapon_flags; // bit set indicates the player has this weapon.
  214. ubyte secondary_weapon_flags; // bit set indicates the player has this weapon.
  215. ushort primary_ammo[MAX_PRIMARY_WEAPONS]; // How much ammo of each type.
  216. ushort secondary_ammo[MAX_SECONDARY_WEAPONS]; // How much ammo of each type.
  217. // -- make sure you're 4 byte aligned now
  218. // Statistics...
  219. int last_score; // Score at beginning of current level.
  220. int score; // Current score.
  221. fix time_level; // Level time played
  222. fix time_total; // Game time played (high word = seconds)
  223. fix cloak_time; // Time cloaked
  224. fix invulnerable_time; // Time invulnerable
  225. short net_killed_total; // Number of times killed total
  226. short net_kills_total; // Number of net kills total
  227. short num_kills_level; // Number of kills this level
  228. short num_kills_total; // Number of kills total
  229. short num_robots_level; // Number of initial robots this level
  230. short num_robots_total; // Number of robots total
  231. ushort hostages_rescued_total; // Total number of hostages rescued.
  232. ushort hostages_total; // Total number of hostages.
  233. ubyte hostages_on_board; // Number of hostages on ship.
  234. ubyte hostages_level; // Number of hostages on this level.
  235. fix homing_object_dist; // Distance of nearest homing object.
  236. byte hours_level; // Hours played (since time_total can only go up to 9 hours)
  237. byte hours_total; // Hours played (since time_total can only go up to 9 hours)
  238. } player;
  239. #define N_PLAYER_GUNS 8
  240. typedef struct player_ship {
  241. int model_num;
  242. int expl_vclip_num;
  243. fix mass,drag;
  244. fix max_thrust,reverse_thrust,brakes; //low_thrust
  245. fix wiggle;
  246. fix max_rotthrust;
  247. vms_vector gun_points[N_PLAYER_GUNS];
  248. } player_ship;
  249. extern int N_players; // Number of players ( >1 means a net game, eh?)
  250. extern int Player_num; // The player number who is on the console.
  251. extern player Players[MAX_PLAYERS]; // Misc player info
  252. extern player_ship *Player_ship;
  253. #endif
  254.