2010-11-20 10:37:14 +00:00
|
|
|
/* (c) Magnus Auvinen. See licence.txt in the root of the distribution for more information. */
|
|
|
|
/* If you are missing that file, acquire a complete release at teeworlds.com. */
|
2010-05-29 07:25:38 +00:00
|
|
|
#ifndef GAME_SERVER_PLAYER_H
|
|
|
|
#define GAME_SERVER_PLAYER_H
|
|
|
|
|
|
|
|
// this include should perhaps be removed
|
|
|
|
#include "entities/character.h"
|
|
|
|
#include "gamecontext.h"
|
|
|
|
|
|
|
|
// player object
|
|
|
|
class CPlayer
|
|
|
|
{
|
|
|
|
MACRO_ALLOC_POOL_ID()
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
public:
|
2011-02-12 10:40:36 +00:00
|
|
|
CPlayer(CGameContext *pGameServer, int ClientID, int Team);
|
2010-05-29 07:25:38 +00:00
|
|
|
~CPlayer();
|
|
|
|
|
|
|
|
void Init(int CID);
|
|
|
|
|
|
|
|
void TryRespawn();
|
|
|
|
void Respawn();
|
|
|
|
void SetTeam(int Team);
|
|
|
|
int GetTeam() const { return m_Team; };
|
|
|
|
int GetCID() const { return m_ClientID; };
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void Tick();
|
2011-03-10 09:08:14 +00:00
|
|
|
void PostTick();
|
2010-05-29 07:25:38 +00:00
|
|
|
void Snap(int SnappingClient);
|
|
|
|
|
|
|
|
void OnDirectInput(CNetObj_PlayerInput *NewInput);
|
|
|
|
void OnPredictedInput(CNetObj_PlayerInput *NewInput);
|
2011-02-14 18:41:32 +00:00
|
|
|
void OnDisconnect(const char *pReason);
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
void KillCharacter(int Weapon = WEAPON_GAME);
|
|
|
|
CCharacter *GetCharacter();
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//---------------------------------------------------------
|
|
|
|
// this is used for snapping so we know how we can clip the view for the player
|
|
|
|
vec2 m_ViewPos;
|
2011-03-01 17:31:20 +00:00
|
|
|
|
|
|
|
// states if the client is chatting, accessing a menu etc.
|
|
|
|
int m_PlayerFlags;
|
|
|
|
|
|
|
|
// used for snapping to just update latency if the scoreboard is active
|
|
|
|
int m_aActLatency[MAX_CLIENTS];
|
2011-03-10 09:08:14 +00:00
|
|
|
|
|
|
|
// used for spectator mode
|
|
|
|
int m_SpectatorID;
|
2011-03-15 08:58:57 +00:00
|
|
|
|
|
|
|
bool m_IsReady;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
int m_Vote;
|
|
|
|
int m_VotePos;
|
|
|
|
//
|
2011-03-10 09:08:14 +00:00
|
|
|
int m_LastVoteCall;
|
|
|
|
int m_LastVoteTry;
|
|
|
|
int m_LastChat;
|
|
|
|
int m_LastSetTeam;
|
|
|
|
int m_LastSetSpectatorMode;
|
|
|
|
int m_LastChangeInfo;
|
|
|
|
int m_LastEmote;
|
|
|
|
int m_LastKill;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
// TODO: clean this up
|
2011-04-13 18:37:12 +00:00
|
|
|
struct
|
2010-05-29 07:25:38 +00:00
|
|
|
{
|
|
|
|
char m_SkinName[64];
|
|
|
|
int m_UseCustomColor;
|
|
|
|
int m_ColorBody;
|
|
|
|
int m_ColorFeet;
|
|
|
|
} m_TeeInfos;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
int m_RespawnTick;
|
|
|
|
int m_DieTick;
|
|
|
|
int m_Score;
|
2010-05-31 20:35:47 +00:00
|
|
|
int m_ScoreStartTick;
|
2010-05-29 07:25:38 +00:00
|
|
|
bool m_ForceBalanced;
|
2010-10-09 17:14:42 +00:00
|
|
|
int m_LastActionTick;
|
|
|
|
struct
|
|
|
|
{
|
|
|
|
int m_TargetX;
|
|
|
|
int m_TargetY;
|
|
|
|
} m_LatestActivity;
|
2011-03-10 09:08:14 +00:00
|
|
|
|
2011-04-13 18:37:12 +00:00
|
|
|
// network latency calculations
|
2011-03-10 09:08:14 +00:00
|
|
|
struct
|
|
|
|
{
|
|
|
|
int m_Accum;
|
|
|
|
int m_AccumMin;
|
|
|
|
int m_AccumMax;
|
|
|
|
int m_Avg;
|
|
|
|
int m_Min;
|
2011-04-13 18:37:12 +00:00
|
|
|
int m_Max;
|
2011-03-10 09:08:14 +00:00
|
|
|
} m_Latency;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
private:
|
|
|
|
CCharacter *Character;
|
|
|
|
CGameContext *m_pGameServer;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
CGameContext *GameServer() const { return m_pGameServer; }
|
|
|
|
IServer *Server() const;
|
2011-04-13 18:37:12 +00:00
|
|
|
|
2010-05-29 07:25:38 +00:00
|
|
|
//
|
|
|
|
bool m_Spawning;
|
|
|
|
int m_ClientID;
|
|
|
|
int m_Team;
|
|
|
|
};
|
|
|
|
|
|
|
|
#endif
|