Subversion Repositories Games.Descent

Rev

Blame | Last modification | View Log | Download | RSS feed

  1. /*
  2.  * Portions of this file are copyright Rebirth contributors and licensed as
  3.  * described in COPYING.txt.
  4.  * Portions of this file are copyright Parallax Software and licensed
  5.  * according to the Parallax license below.
  6.  * See COPYING.txt for license details.
  7.  
  8. THE COMPUTER CODE CONTAINED HEREIN IS THE SOLE PROPERTY OF PARALLAX
  9. SOFTWARE CORPORATION ("PARALLAX").  PARALLAX, IN DISTRIBUTING THE CODE TO
  10. END-USERS, AND SUBJECT TO ALL OF THE TERMS AND CONDITIONS HEREIN, GRANTS A
  11. ROYALTY-FREE, PERPETUAL LICENSE TO SUCH END-USERS FOR USE BY SUCH END-USERS
  12. IN USING, DISPLAYING,  AND CREATING DERIVATIVE WORKS THEREOF, SO LONG AS
  13. SUCH USE, DISPLAY OR CREATION IS FOR NON-COMMERCIAL, ROYALTY OR REVENUE
  14. FREE PURPOSES.  IN NO EVENT SHALL THE END-USER USE THE COMPUTER CODE
  15. CONTAINED HEREIN FOR REVENUE-BEARING PURPOSES.  THE END-USER UNDERSTANDS
  16. AND AGREES TO THE TERMS HEREIN AND ACCEPTS THE SAME BY USE OF THIS FILE.
  17. COPYRIGHT 1993-1999 PARALLAX SOFTWARE CORPORATION.  ALL RIGHTS RESERVED.
  18. */
  19.  
  20. #pragma once
  21.  
  22. #include <physfs.h>
  23. #include "fwd-object.h"
  24.  
  25. #define MAX_MULTI_PLAYERS MAX_PLAYERS+3
  26. #define MULTI_PNUM_UNDEF 0xcc
  27.  
  28. // Initial player stat values
  29. #define INITIAL_ENERGY  i2f(100)    // 100% energy to start
  30. #define INITIAL_SHIELDS i2f(100)    // 100% shields to start
  31.  
  32. #define MAX_ENERGY      i2f(200)    // go up to 200
  33. #define MAX_SHIELDS     i2f(200)
  34.  
  35. #define INITIAL_LIVES               3   // start off with 3 lives
  36.  
  37. // Values for special flags
  38. #if defined(DXX_BUILD_DESCENT_II)
  39. #define PLAYER_MAX_AMMO(powerup_flags,BASE)     ((powerup_flags & PLAYER_FLAGS_AMMO_RACK) ? BASE * 2 : BASE)
  40.  
  41. #define AFTERBURNER_MAX_TIME    (F1_0*5)    // Max time afterburner can be on.
  42. #endif
  43. #define CALLSIGN_LEN                8       // so can use as filename (was: 12)
  44.  
  45. // Amount of time player is cloaked.
  46. #define CLOAK_TIME_MAX          (F1_0*30)
  47. #define INVULNERABLE_TIME_MAX   (F1_0*30)
  48.  
  49. #if defined(DXX_BUILD_DESCENT_I)
  50. #define PLAYER_STRUCT_VERSION   16              //increment this every time player struct changes
  51. #define PLAYER_MAX_AMMO(powerup_flags,BASE)     (static_cast<void>(powerup_flags), BASE)
  52. #elif defined(DXX_BUILD_DESCENT_II)
  53. #define PLAYER_STRUCT_VERSION   17  // increment this every time player struct changes
  54.  
  55. // defines for teams
  56. #define TEAM_BLUE   0
  57. #define TEAM_RED    1
  58. #endif
  59.  
  60. #ifdef __cplusplus
  61. #include "dxxsconf.h"
  62. #include "dsx-ns.h"
  63. #include <array>
  64. struct callsign_t;
  65.  
  66. #define N_PLAYER_GUNS 8
  67. #define N_PLAYER_SHIP_TEXTURES 32
  68.  
  69. namespace dcx {
  70. struct player_ship;
  71.  
  72. struct player;
  73. using playernum_t = uint32_t;
  74. constexpr unsigned MAX_PLAYERS = 8;
  75. using playernum_array_t = std::array<playernum_t, MAX_PLAYERS>;
  76.  
  77. extern unsigned N_players;   // Number of players ( >1 means a net game, eh?)
  78. extern playernum_t Player_num;  // The player number who is on the console.
  79. }
  80.  
  81. #ifdef dsx
  82. DXX_VALPTRIDX_DECLARE_SUBTYPE(dcx::, player, playernum_t, MAX_PLAYERS);
  83. namespace dsx {
  84. struct player_rw;
  85. struct player_info;
  86. void player_rw_swap(player_rw *p, int swap);
  87. int allowed_to_fire_flare(player_info &);
  88. int allowed_to_fire_missile(const player_info &);
  89. #if defined(DXX_BUILD_DESCENT_II)
  90. fix get_omega_energy_consumption(fix delta_charge);
  91. void omega_charge_frame(player_info &);
  92. #endif
  93. }
  94. #endif
  95.  
  96. /*
  97.  * reads a player_ship structure from a PHYSFS_File
  98.  */
  99. void player_ship_read(player_ship *ps, PHYSFS_File *fp);
  100.  
  101. #endif
  102.