| 1 |
|
| 2 |
|
| 3 |
|
| 4 |
|
| 5 |
|
| 6 |
|
| 7 |
|
| 8 |
|
| 9 |
|
| 10 |
|
| 11 |
|
| 12 |
|
| 13 |
|
| 14 |
|
| 15 |
|
| 16 |
|
| 17 |
|
| 18 |
|
| 19 |
|
| 20 |
|
| 21 |
|
| 22 |
|
| 23 |
|
| 24 |
|
| 25 |
|
| 26 |
|
| 27 |
|
| 28 |
#pragma once |
| 29 |
|
| 30 |
#include "character.h" |
| 31 |
#include "weapon_usage.h" |
| 32 |
|
| 33 |
#define MAX_GUNS 3 |
| 34 |
#define MELEE_SLOT 2 |
| 35 |
#define GRENADE_SLOT 3 |
| 36 |
#define MAX_GRENADES 1 |
| 37 |
#define MAX_WEAPONS (MAX_GUNS + MAX_GRENADES) |
| 38 |
|
| 39 |
|
| 40 |
|
| 41 |
typedef struct |
| 42 |
{ |
| 43 |
int ActorUID; |
| 44 |
bool IsLocal; |
| 45 |
|
| 46 |
bool Ready; |
| 47 |
Character Char; |
| 48 |
char name[20]; |
| 49 |
const WeaponClass *guns[MAX_WEAPONS]; |
| 50 |
CArray ammo; |
| 51 |
int Lives; |
| 52 |
int HP; |
| 53 |
|
| 54 |
NPlayerStats Stats; |
| 55 |
NPlayerStats Totals; |
| 56 |
WeaponUsages WeaponUsages; |
| 57 |
|
| 58 |
|
| 59 |
int hp; |
| 60 |
int survived; |
| 61 |
int missions; |
| 62 |
int lastMission; |
| 63 |
|
| 64 |
input_device_e inputDevice; |
| 65 |
int deviceIndex; |
| 66 |
int UID; |
| 67 |
} PlayerData; |
| 68 |
|
| 69 |
extern CArray gPlayerDatas; |
| 70 |
|
| 71 |
#define MAX_LOCAL_PLAYERS 4 |
| 72 |
|
| 73 |
void PlayerDataInit(CArray *p); |
| 74 |
void PlayerDataAddOrUpdate(const NPlayerData pd); |
| 75 |
void PlayerRemove(const int uid); |
| 76 |
NPlayerData PlayerDataDefault(const int idx); |
| 77 |
NPlayerData PlayerDataMissionReset(const PlayerData *p); |
| 78 |
void PlayerDataTerminate(CArray *p); |
| 79 |
|
| 80 |
PlayerData *PlayerDataGetByUID(const int uid); |
| 81 |
int FindLocalPlayerIndex(const int uid); |
| 82 |
|
| 83 |
typedef enum |
| 84 |
{ |
| 85 |
PLAYER_ANY, |
| 86 |
PLAYER_ALIVE, |
| 87 |
PLAYER_ALIVE_OR_DYING |
| 88 |
} PlayerAliveOptions; |
| 89 |
int GetNumPlayers( |
| 90 |
const PlayerAliveOptions alive, const bool human, const bool local); |
| 91 |
bool AreAllPlayersDeadAndNoLives(void); |
| 92 |
const PlayerData *GetFirstPlayer( |
| 93 |
const bool alive, const bool human, const bool local); |
| 94 |
bool IsPlayerAlive(const PlayerData *player); |
| 95 |
bool IsPlayerHuman(const PlayerData *player); |
| 96 |
bool IsPlayerHumanAndAlive(const PlayerData *player); |
| 97 |
bool IsPlayerAliveOrDying(const PlayerData *player); |
| 98 |
bool IsPlayerScreen(const PlayerData *p); |
| 99 |
struct vec2 PlayersGetMidpoint(void); |
| 100 |
void PlayersGetBoundingRectangle(struct vec2 *min, struct vec2 *max); |
| 101 |
int PlayersNumUseAmmo(const int ammoId); |
| 102 |
bool PlayerIsLocal(const int uid); |
| 103 |
|
| 104 |
void PlayerScore(PlayerData *p, const int points); |
| 105 |
|
| 106 |
bool PlayerTrySetInputDevice( |
| 107 |
PlayerData *p, const input_device_e d, const int idx); |
| 108 |
|
| 109 |
|
| 110 |
bool PlayerTrySetUnusedInputDevice( |
| 111 |
PlayerData *p, const input_device_e d, const int idx); |
| 112 |
|
| 113 |
int PlayerGetNumWeapons(const PlayerData *p); |
| 114 |
bool PlayerHasGrenadeButton(const PlayerData *p); |
| 115 |
bool PlayerHasWeapon(const PlayerData *p, const WeaponClass *wc); |
| 116 |
bool PlayerHasWeaponUpgrade(const PlayerData *p, const WeaponClass *wc); |
| 117 |
void PlayerAddWeapon(PlayerData *p, const WeaponClass *wc); |
| 118 |
void PlayerAddWeaponToSlot( |
| 119 |
PlayerData *p, const WeaponClass *wc, const int slot); |
| 120 |
void PlayerRemoveWeapon(PlayerData *p, const int slot); |
| 121 |
void PlayerAddMinimalWeapons(PlayerData *p); |
| 122 |
bool PlayerUsesAmmo(const PlayerData *p, const int ammoId); |
| 123 |
bool PlayerUsesAnyAmmo(const PlayerData *p); |
| 124 |
int PlayerGetAmmoAmount(const PlayerData *p, const int ammoId); |
| 125 |
void PlayerAddAmmo( |
| 126 |
PlayerData *p, const int ammoId, const int amount, const bool isFree); |
| 127 |
void PlayerSetHP(PlayerData *p, const int hp); |
| 128 |
void PlayerSetLives(PlayerData *p, const int lives); |
| 129 |
|
| 130 |
int CharacterGetStartingHealth(const Character *c, const PlayerData *p); |