mirror of
https://github.com/alliedmodders/hl2sdk.git
synced 2024-12-23 01:59:43 +08:00
93 lines
2.7 KiB
C++
93 lines
2.7 KiB
C++
//========= Copyright © 1996-2005, Valve Corporation, All rights reserved. ============//
|
|
//
|
|
// Purpose:
|
|
//
|
|
// $Workfile: $
|
|
// $Date: $
|
|
//
|
|
//-----------------------------------------------------------------------------
|
|
// $Log: $
|
|
//
|
|
// $NoKeywords: $
|
|
//=============================================================================//
|
|
|
|
#ifndef TEAMPLAY_GAMERULES_H
|
|
#define TEAMPLAY_GAMERULES_H
|
|
#pragma once
|
|
|
|
#include "gamerules.h"
|
|
#include "multiplay_gamerules.h"
|
|
|
|
#ifdef CLIENT_DLL
|
|
|
|
#define CTeamplayRules C_TeamplayRules
|
|
|
|
#else
|
|
|
|
#include "takedamageinfo.h"
|
|
|
|
#endif
|
|
|
|
|
|
//
|
|
// teamplay_gamerules.h
|
|
//
|
|
|
|
|
|
#define MAX_TEAMNAME_LENGTH 16
|
|
#define MAX_TEAMS 32
|
|
|
|
#define TEAMPLAY_TEAMLISTLENGTH MAX_TEAMS*MAX_TEAMNAME_LENGTH
|
|
|
|
|
|
class CTeamplayRules : public CMultiplayRules
|
|
{
|
|
public:
|
|
DECLARE_CLASS( CTeamplayRules, CMultiplayRules );
|
|
|
|
#ifdef CLIENT_DLL
|
|
|
|
#else
|
|
|
|
CTeamplayRules();
|
|
virtual ~CTeamplayRules() {};
|
|
|
|
virtual void Precache( void );
|
|
|
|
virtual bool ClientCommand( const char *pcmd, CBaseEntity *pEdict );
|
|
virtual void ClientSettingsChanged( CBasePlayer *pPlayer );
|
|
virtual bool IsTeamplay( void );
|
|
virtual bool FPlayerCanTakeDamage( CBasePlayer *pPlayer, CBaseEntity *pAttacker );
|
|
virtual int PlayerRelationship( CBaseEntity *pPlayer, CBaseEntity *pTarget );
|
|
virtual bool PlayerCanHearChat( CBasePlayer *pListener, CBasePlayer *pSpeaker );
|
|
virtual const char *GetTeamID( CBaseEntity *pEntity );
|
|
virtual bool ShouldAutoAim( CBasePlayer *pPlayer, edict_t *target );
|
|
virtual int IPointsForKill( CBasePlayer *pAttacker, CBasePlayer *pKilled );
|
|
virtual void InitHUD( CBasePlayer *pl );
|
|
virtual void DeathNotice( CBasePlayer *pVictim, const CTakeDamageInfo &info );
|
|
virtual const char *GetGameDescription( void ) { return "Teamplay"; } // this is the game name that gets seen in the server browser
|
|
virtual void PlayerKilled( CBasePlayer *pVictim, const CTakeDamageInfo &info );
|
|
virtual void Think ( void );
|
|
virtual int GetTeamIndex( const char *pTeamName );
|
|
virtual const char *GetIndexedTeamName( int teamIndex );
|
|
virtual bool IsValidTeam( const char *pTeamName );
|
|
virtual const char *SetDefaultPlayerTeam( CBasePlayer *pPlayer );
|
|
virtual void ChangePlayerTeam( CBasePlayer *pPlayer, const char *pTeamName, bool bKill, bool bGib );
|
|
virtual void ClientDisconnected( edict_t *pClient );
|
|
|
|
protected:
|
|
bool m_DisableDeathMessages;
|
|
|
|
private:
|
|
void RecountTeams( void );
|
|
const char *TeamWithFewestPlayers( void );
|
|
|
|
bool m_DisableDeathPenalty;
|
|
bool m_teamLimit; // This means the server set only some teams as valid
|
|
char m_szTeamList[TEAMPLAY_TEAMLISTLENGTH];
|
|
|
|
#endif
|
|
};
|
|
|
|
#endif // TEAMPLAY_GAMERULES_H
|