#ifndef __TF_GLOBALS_H__
#define __TF_GLOBALS_H__

extern int gmsgScoreInfo;

enum
{
	TF_TEAM_NONE						= 0,
	TF_TEAM_BLUE,
	TF_TEAM_RED,
	TF_TEAM_YELLOW,
	TF_TEAM_GREEN,
	TF_TEAM_MAXTEAMS,
};

enum
{
	TF_AMMO_NONE,
	TF_AMMO_SHELLS,
	TF_AMMO_NAILS,
	TF_AMMO_ROCKETS,
	TF_AMMO_CELLS,
	TF_AMMO_MEDKIT,
	TF_AMMO_DETPACK,
	TF_AMMO_GREN1,
	TF_AMMO_GREN2,
	TF_AMMO_LAST,
};

static const int	TF_ACTIVATION_IF_AP_FAILS_CRITERIA		= 64;

static const int	TF_EFFECT_AP							= 1;
static const int	TF_EFFECT_AP_TEAM						= 2;
static const int	TF_EFFECT_AP_NONTEAM					= 4;
static const int	TF_EFFECT_NONAP							= 8;
static const int	TF_EFFECT_WALLS_OBSTRUCT				= 16;
static const int	TF_EFFECT_SAME_ENVIRO					= 32;
static const int	TF_EFFECT_CHECK_APA_INDIVIDUALLY		= 64;

static const int	TF_RESULT_FORCE_RESPAWN_NO_DIE			= 32;

static const int	TF_TEAM_BIT_NONE						= 0;
static const int	TF_TEAM_BIT_BLUE						= 1;
static const int	TF_TEAM_BIT_RED							= 2;
static const int	TF_TEAM_BIT_YELLOW						= 4;
static const int	TF_TEAM_BIT_GREEN						= 8;

static const int	g_iTFTeamBits[ TF_TEAM_MAXTEAMS ] =
{
	TF_TEAM_BIT_NONE,
	TF_TEAM_BIT_BLUE,
	TF_TEAM_BIT_RED,
	TF_TEAM_BIT_YELLOW,
	TF_TEAM_BIT_GREEN,
};

enum
{
	TF_CLASS_NONE						= 0,
	TF_CLASS_SCOUT,
	TF_CLASS_SNIPER,
	TF_CLASS_SOLDIER,
	TF_CLASS_DEMOMAN,
	TF_CLASS_MEDIC,
	TF_CLASS_HWGUY,
	TF_CLASS_PYRO,
	TF_CLASS_SPY,
	TF_CLASS_ENGY,
	TF_CLASS_CIVILIAN,
	TF_CLASS_RANDOM,
	TF_CLASS_LASTCLASS,
};

static const int	TF_CLASS_BIT_NONE						= 0;
static const int	TF_CLASS_BIT_SCOUT						= 1;
static const int	TF_CLASS_BIT_SNIPER						= 2;
static const int	TF_CLASS_BIT_SOLDIER					= 4;
static const int	TF_CLASS_BIT_DEMOMAN					= 8;
static const int	TF_CLASS_BIT_MEDIC						= 16;
static const int	TF_CLASS_BIT_HWGUY						= 32;
static const int	TF_CLASS_BIT_PYRO						= 64;
static const int	TF_CLASS_BIT_RANDOM						= 128;
static const int	TF_CLASS_BIT_SPY						= 256;
static const int	TF_CLASS_BIT_ENGINEER					= 512;
static const int	TF_CLASS_BIT_CIVILIAN					= -1;

static const int	g_iTFClassBits[ TF_CLASS_LASTCLASS ] =
{
	TF_CLASS_BIT_NONE,
	TF_CLASS_BIT_SCOUT,
	TF_CLASS_BIT_SNIPER,
	TF_CLASS_BIT_SOLDIER,
	TF_CLASS_BIT_DEMOMAN,
	TF_CLASS_BIT_MEDIC,
	TF_CLASS_BIT_HWGUY,
	TF_CLASS_BIT_PYRO,
	TF_CLASS_BIT_SPY,
	TF_CLASS_BIT_ENGINEER,
	TF_CLASS_BIT_CIVILIAN,
	TF_CLASS_BIT_RANDOM,
};

enum
{
	TF_ARMOR_NONE						= 0,
	TF_ARMOR_KEVLAR,
	TF_ARMOR_WOODEN,
	TF_ARMOR_BLAST,
	TF_ARMOR_SHOCK,
	TF_ARMOR_CERAMIC,
	TF_ARMOR_LASTARMOR,
};

static const int	TF_ARMOR_BIT_NONE						= 0;
static const int	TF_ARMOR_BIT_KEVLAR						= 1;
static const int	TF_ARMOR_BIT_WOODEN						= 2;
static const int	TF_ARMOR_BIT_BLAST						= 4;
static const int	TF_ARMOR_BIT_SHOCK						= 8;
static const int	TF_ARMOR_BIT_CERAMIC					= 16;

static const int	g_iTFArmorBits[ TF_ARMOR_LASTARMOR ] =
{
	TF_ARMOR_BIT_NONE,
	TF_ARMOR_BIT_KEVLAR,
	TF_ARMOR_BIT_WOODEN,
	TF_ARMOR_BIT_BLAST,
	TF_ARMOR_BIT_SHOCK,
	TF_ARMOR_BIT_CERAMIC,
};

enum
{
	// broadcasts
	TF_MSG_BROADCAST						= 0,
	TF_MSG_BROADCAST_AP,
	TF_MSG_BROADCAST_AP_TEAM,
	TF_MSG_BROADCAST_AP_NONTEAM,
	TF_MSG_BROADCAST_OWNER,
	TF_MSG_BROADCAST_NONOWNER,

	TF_MSG_SOUND,

	// on events
	TF_MSG_DROP_AP,
	TF_MSG_DROP_AP_TEAM,
	TF_MSG_DROP_AP_NONTEAM,
	TF_MSG_DROP_OWNER,
	TF_MSG_DROP_NONOWNER,
	
	TF_MSG_RETURN_AP,
	TF_MSG_RETURN_AP_TEAM,
	TF_MSG_RETURN_AP_NONTEAM,
	TF_MSG_RETURN_OWNER,
	TF_MSG_RETURN_NONOWNER,

	TF_MSG_CAPTURE_AP,
	TF_MSG_CAPTURE_AP_TEAM,
	TF_MSG_CAPTURE_AP_NON_TEAM,
	TF_MSG_CAPTURE_OWNER,
	TF_MSG_CAPTURE_NONOWNER,

	TF_MSG_DEATH,

	// speach
	TF_MSG_SPEAK,
	TF_MSG_SPEAK_AP,
	TF_MSG_SPEAK_AP_TEAM,
	TF_MSG_SPEAK_AP_NONTEAM,
	TF_MSG_SPEAK_OWNER,
	TF_MSG_SPEAK_NONOWNER,

	// status messages
	TF_MSG_STATUS_HOME_OWNER,
	TF_MSG_STATUS_HOME_NONOWNER,
	TF_MSG_STATUS_CARRIED_OWNER,
	TF_MSG_STATUS_CARRIED_NONOWNER,
	TF_MSG_STATUS_DROPPED_OWNER,
	TF_MSG_STATUS_DROPPED_NONOWNER,

	TF_MSG_ENDROUND_TIME,
	TF_MSG_ENDROUND_OWNER,
	TF_MSG_ENDROUND_NONOWNER,
	TF_MSG_ENDROUND_TEAM1,
	TF_MSG_ENDROUND_TEAM2,
	TF_MSG_ENDROUND_TEAM3,
	TF_MSG_ENDROUND_TEAM4,

	TF_MSG_LASTMSG,
};

enum
{
	TF_GOALSTATE_INACTIVE				= 0,
	TF_GOALSTATE_ACTIVE,
	TF_GOALSTATE_REMOVED,
};

enum
{
	TF_ENT_BASIC						= 100,
	TF_ENT_INFO_DETECT,
	TF_ENT_INFO_GOAL,
	TF_ENT_INFO_TIMER,
	TF_ENT_INFO_TEAMCHECK,
	TF_ENT_INFO_TEAMSET,
	TF_ENT_INFO_TEAMSPAWN,
	TF_ENT_ITEM_GOAL,
};

enum
{
	TF_GOAL_NONE						= 0,
	TF_GOAL_ACTIVATE,
	TF_GOAL_INACTIVATE,
	TF_GOAL_REMOVE,
	TF_GOAL_RESTORE,
	TF_GOAL_GRAB,
	TF_GOAL_DROP,
	TF_GOAL_RETURN,
};

class TFEntity;

TFEntity * UTIL_FindEntityByTFId( TFEntity * pStart, int iId );
TFEntity * UTIL_FindEntityByTFGroup( TFEntity * pStart, int iGroup );
BOOL TFStrEq( int total, const char * szText, ... );

#endif // __TF_GLOBALS_H__