| 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 |
#ifdef DXX_BUILD_DESCENT |
| 39 |
#if DXX_BUILD_DESCENT == 2 |
| 40 |
#define PLAYER_MAX_AMMO(powerup_flags,BASE) ((powerup_flags & PLAYER_FLAGS_AMMO_RACK) ? BASE * 2 : BASE) |
| 41 |
|
| 42 |
#define AFTERBURNER_MAX_TIME (F1_0*5) // Max time afterburner can be on. |
| 43 |
#endif |
| 44 |
#endif |
| 45 |
#define CALLSIGN_LEN 8 // so can use as filename (was: 12) |
| 46 |
|
| 47 |
// Amount of time player is cloaked. |
| 48 |
#define CLOAK_TIME_MAX (F1_0*30) |
| 49 |
#define INVULNERABLE_TIME_MAX (F1_0*30) |
| 50 |
|
| 51 |
#ifdef DXX_BUILD_DESCENT |
| 52 |
#if DXX_BUILD_DESCENT == 1 |
| 53 |
#define PLAYER_STRUCT_VERSION 16 //increment this every time player struct changes |
| 54 |
#define PLAYER_MAX_AMMO(powerup_flags,BASE) (static_cast<void>(powerup_flags), BASE) |
| 55 |
#elif DXX_BUILD_DESCENT == 2 |
| 56 |
#define PLAYER_STRUCT_VERSION 17 // increment this every time player struct changes |
| 57 |
#endif |
| 58 |
#endif |
| 59 |
#include "dxxsconf.h" |
| 60 |
#include "dsx-ns.h" |
| 61 |
#include <array> |
| 62 |
struct callsign_t; |
| 63 |
|
| 64 |
#define N_PLAYER_SHIP_TEXTURES 32 |
| 65 |
|
| 66 |
namespace dcx { |
| 67 |
|
| 68 |
enum class player_connection_status : uint8_t; |
| 69 |
enum class player_gun_number : uint8_t; |
| 70 |
|
| 71 |
struct player_ship; |
| 72 |
|
| 73 |
struct player; |
| 74 |
using playernum_t = uint32_t; |
| 75 |
constexpr unsigned MAX_PLAYERS = 8; |
| 76 |
template <typename T> |
| 77 |
using per_player_array = std::array<T, MAX_PLAYERS>; |
| 78 |
using playernum_array_t = per_player_array<playernum_t>; |
| 79 |
#if DXX_USE_MULTIPLAYER |
| 80 |
enum class team_number : uint8_t; |
| 81 |
template <typename T> |
| 82 |
using per_team_array = enumerated_array<T, 2, team_number>; |
| 83 |
#endif |
| 84 |
|
| 85 |
extern unsigned N_players; // Number of players ( >1 means a net game, eh?) |
| 86 |
extern playernum_t Player_num; // The player number who is on the console. |
| 87 |
} |
| 88 |
|
| 89 |
#ifdef DXX_BUILD_DESCENT |
| 90 |
DXX_VALPTRIDX_DECLARE_SUBTYPE(dcx::, player, playernum_t, MAX_PLAYERS); |
| 91 |
namespace dsx { |
| 92 |
struct player_rw; |
| 93 |
struct player_info; |
| 94 |
void player_rw_swap(player_rw *p, physfsx_endian swap); |
| 95 |
int allowed_to_fire_missile(const player_info &); |
| 96 |
#if DXX_BUILD_DESCENT == 2 |
| 97 |
fix get_omega_energy_consumption(fix delta_charge); |
| 98 |
void omega_charge_frame(player_info &); |
| 99 |
#endif |
| 100 |
} |
| 101 |
#endif |