2011-12-25 13:33:05 +00:00
|
|
|
/* (c) Shereef Marzouk. See "licence DDRace.txt" and the readme.txt in the root of the distribution for more information. */
|
2010-08-30 12:13:43 +00:00
|
|
|
#ifndef GAME_TEAMSCORE_H
|
|
|
|
#define GAME_TEAMSCORE_H
|
|
|
|
|
|
|
|
#include <engine/shared/protocol.h>
|
|
|
|
|
2011-04-20 16:47:25 +00:00
|
|
|
enum
|
|
|
|
{
|
2020-09-26 19:41:58 +00:00
|
|
|
TEAM_FLOCK = 0,
|
|
|
|
TEAM_SUPER = MAX_CLIENTS,
|
2021-11-29 16:06:04 +00:00
|
|
|
NUM_TEAMS = TEAM_SUPER + 1,
|
2020-09-26 19:41:58 +00:00
|
|
|
VANILLA_TEAM_SUPER = VANILLA_MAX_CLIENTS
|
2010-09-14 18:28:50 +00:00
|
|
|
};
|
|
|
|
|
2022-03-03 14:25:00 +00:00
|
|
|
// do not change the values of the following enum
|
2022-02-19 14:20:32 +00:00
|
|
|
enum
|
|
|
|
{
|
2022-03-03 14:25:00 +00:00
|
|
|
SV_TEAM_FORBIDDEN = 0, // teams are disabled on the map
|
|
|
|
SV_TEAM_ALLOWED = 1, // teams are enabled on the map, but optional
|
|
|
|
SV_TEAM_MANDATORY = 2, // map must be played with a team
|
|
|
|
SV_TEAM_FORCED_SOLO = 3 // map forces a random team for each individual player
|
2022-02-19 14:20:32 +00:00
|
|
|
};
|
|
|
|
|
2011-04-20 16:47:25 +00:00
|
|
|
class CTeamsCore
|
|
|
|
{
|
2010-08-30 12:13:43 +00:00
|
|
|
int m_Team[MAX_CLIENTS];
|
2011-09-02 18:04:18 +00:00
|
|
|
bool m_IsSolo[MAX_CLIENTS];
|
2020-09-26 19:41:58 +00:00
|
|
|
|
2010-08-30 12:13:43 +00:00
|
|
|
public:
|
2014-01-21 17:21:01 +00:00
|
|
|
bool m_IsDDRace16;
|
2011-12-25 13:51:04 +00:00
|
|
|
|
2020-06-24 07:23:07 +00:00
|
|
|
CTeamsCore();
|
2011-12-25 13:51:04 +00:00
|
|
|
|
2020-06-24 07:23:07 +00:00
|
|
|
bool SameTeam(int ClientID1, int ClientID2) const;
|
2010-09-21 19:09:11 +00:00
|
|
|
|
2020-06-24 07:23:07 +00:00
|
|
|
bool CanKeepHook(int ClientID1, int ClientID2) const;
|
|
|
|
bool CanCollide(int ClientID1, int ClientID2) const;
|
2011-12-25 13:51:04 +00:00
|
|
|
|
2020-06-24 07:23:07 +00:00
|
|
|
int Team(int ClientID) const;
|
2011-02-13 05:35:13 +00:00
|
|
|
void Team(int ClientID, int Team);
|
2010-09-24 07:12:26 +00:00
|
|
|
|
|
|
|
void Reset();
|
2011-12-25 13:51:04 +00:00
|
|
|
void SetSolo(int ClientID, bool Value)
|
|
|
|
{
|
2022-05-14 09:27:59 +00:00
|
|
|
dbg_assert(ClientID >= 0 && ClientID < MAX_CLIENTS, "Invalid client id");
|
2011-12-25 13:51:04 +00:00
|
|
|
m_IsSolo[ClientID] = Value;
|
|
|
|
}
|
2014-12-17 19:38:05 +00:00
|
|
|
|
2020-06-24 07:23:07 +00:00
|
|
|
bool GetSolo(int ClientID) const
|
2011-12-25 13:51:04 +00:00
|
|
|
{
|
2020-10-18 14:52:27 +00:00
|
|
|
if(ClientID < 0 || ClientID >= MAX_CLIENTS)
|
|
|
|
return false;
|
2011-12-25 13:51:04 +00:00
|
|
|
return m_IsSolo[ClientID];
|
|
|
|
}
|
2010-08-30 12:13:43 +00:00
|
|
|
};
|
|
|
|
|
2011-01-12 09:10:57 +00:00
|
|
|
#endif
|