about summary refs log tree commit diff
path: root/src/game/server/player.h
diff options
context:
space:
mode:
authorMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
committerMagnus Auvinen <magnus.auvinen@gmail.com>2010-05-29 07:25:38 +0000
commit72c06a258940696093f255fb1061beb58e1cdd0b (patch)
tree36b9a7712eec2d4f07837eab9c38ef1c5af85319 /src/game/server/player.h
parente56feb597bc743677633432f77513b02907fd169 (diff)
downloadzcatch-72c06a258940696093f255fb1061beb58e1cdd0b.tar.gz
zcatch-72c06a258940696093f255fb1061beb58e1cdd0b.zip
copied refactor to trunk
Diffstat (limited to 'src/game/server/player.h')
-rw-r--r--src/game/server/player.h89
1 files changed, 89 insertions, 0 deletions
diff --git a/src/game/server/player.h b/src/game/server/player.h
new file mode 100644
index 00000000..1b631d45
--- /dev/null
+++ b/src/game/server/player.h
@@ -0,0 +1,89 @@
+#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()
+	
+public:
+	CPlayer(CGameContext *pGameServer, int CID, int Team);
+	~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; };
+	
+	void Tick();
+	void Snap(int SnappingClient);
+
+	void OnDirectInput(CNetObj_PlayerInput *NewInput);
+	void OnPredictedInput(CNetObj_PlayerInput *NewInput);
+	void OnDisconnect();
+	
+	void KillCharacter(int Weapon = WEAPON_GAME);
+	CCharacter *GetCharacter();
+	
+	//---------------------------------------------------------
+	// this is used for snapping so we know how we can clip the view for the player
+	vec2 m_ViewPos;
+	
+	//
+	int m_Vote;
+	int m_VotePos;
+	//
+	int m_Last_VoteCall;
+	int m_Last_VoteTry;
+	int m_Last_Chat;
+	int m_Last_SetTeam;
+	int m_Last_ChangeInfo;
+	int m_Last_Emote;
+	int m_Last_Kill;
+	
+	// TODO: clean this up
+	struct 
+	{
+		char m_SkinName[64];
+		int m_UseCustomColor;
+		int m_ColorBody;
+		int m_ColorFeet;
+	} m_TeeInfos;
+	
+	int m_RespawnTick;
+	int m_DieTick;
+	int m_Score;
+	bool m_ForceBalanced;
+	
+private:
+	CCharacter *Character;
+	CGameContext *m_pGameServer;
+	
+	CGameContext *GameServer() const { return m_pGameServer; }
+	IServer *Server() const;
+	
+	//
+	bool m_Spawning;
+	int m_ClientID;
+	int m_Team;
+
+	// network latency calculations	
+	struct
+	{
+		int m_Accum;
+		int m_AccumMin;
+		int m_AccumMax;
+		int m_Avg;
+		int m_Min;
+		int m_Max;	
+	} m_Latency;
+};
+
+#endif