mirror of
https://github.com/fortressforever/fortressforever-2013.git
synced 2024-11-29 07:32:39 +00:00
removed hl2dm spawn crap, tweaked default spawn code a little.
it grabs random info_ff_teamspawn, and if cant find any tries a info_player_start as last ditch no revolutionary changes here
This commit is contained in:
parent
0622f03f59
commit
88e40d9bc9
4 changed files with 54 additions and 72 deletions
|
@ -34,8 +34,6 @@
|
||||||
int g_iLastCitizenModel = 0;
|
int g_iLastCitizenModel = 0;
|
||||||
int g_iLastCombineModel = 0;
|
int g_iLastCombineModel = 0;
|
||||||
|
|
||||||
CBaseEntity *g_pLastCombineSpawn = NULL;
|
|
||||||
CBaseEntity *g_pLastRebelSpawn = NULL;
|
|
||||||
extern CBaseEntity *g_pLastSpawn;
|
extern CBaseEntity *g_pLastSpawn;
|
||||||
|
|
||||||
#define FF_COMMAND_MAX_RATE 0.3
|
#define FF_COMMAND_MAX_RATE 0.3
|
||||||
|
@ -47,6 +45,9 @@ LINK_ENTITY_TO_CLASS( player, CFF_SV_Player );
|
||||||
LINK_ENTITY_TO_CLASS( info_player_combine, CPointEntity );
|
LINK_ENTITY_TO_CLASS( info_player_combine, CPointEntity );
|
||||||
LINK_ENTITY_TO_CLASS( info_player_rebel, CPointEntity );
|
LINK_ENTITY_TO_CLASS( info_player_rebel, CPointEntity );
|
||||||
|
|
||||||
|
// lets dance
|
||||||
|
LINK_ENTITY_TO_CLASS( info_ff_teamspawn, CPointEntity );
|
||||||
|
|
||||||
IMPLEMENT_SERVERCLASS_ST(CFF_SV_Player, DT_FF_Player)
|
IMPLEMENT_SERVERCLASS_ST(CFF_SV_Player, DT_FF_Player)
|
||||||
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 0), 11, SPROP_CHANGES_OFTEN ),
|
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 0), 11, SPROP_CHANGES_OFTEN ),
|
||||||
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 1), 11, SPROP_CHANGES_OFTEN ),
|
SendPropAngle( SENDINFO_VECTORELEM(m_angEyeAngles, 1), 11, SPROP_CHANGES_OFTEN ),
|
||||||
|
@ -1320,27 +1321,10 @@ CBaseEntity* CFF_SV_Player::EntSelectSpawnPoint( void )
|
||||||
CBaseEntity *pSpot = NULL;
|
CBaseEntity *pSpot = NULL;
|
||||||
CBaseEntity *pLastSpawnPoint = g_pLastSpawn;
|
CBaseEntity *pLastSpawnPoint = g_pLastSpawn;
|
||||||
edict_t *player = edict();
|
edict_t *player = edict();
|
||||||
const char *pSpawnpointName = "info_player_deathmatch";
|
|
||||||
|
|
||||||
if ( FFRules()->IsTeamplay() == true )
|
// this is safe cuz there is always at least one
|
||||||
{
|
// team in FF and the rest is handled by lua, right?
|
||||||
if ( GetTeamNumber() == TEAM_COMBINE )
|
const char *pSpawnpointName = "info_ff_teamspawn";
|
||||||
{
|
|
||||||
pSpawnpointName = "info_player_combine";
|
|
||||||
pLastSpawnPoint = g_pLastCombineSpawn;
|
|
||||||
}
|
|
||||||
else if ( GetTeamNumber() == TEAM_REBELS )
|
|
||||||
{
|
|
||||||
pSpawnpointName = "info_player_rebel";
|
|
||||||
pLastSpawnPoint = g_pLastRebelSpawn;
|
|
||||||
}
|
|
||||||
|
|
||||||
if ( gEntList.FindEntityByClassname( NULL, pSpawnpointName ) == NULL )
|
|
||||||
{
|
|
||||||
pSpawnpointName = "info_player_deathmatch";
|
|
||||||
pLastSpawnPoint = g_pLastSpawn;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
pSpot = pLastSpawnPoint;
|
pSpot = pLastSpawnPoint;
|
||||||
// Randomize the start spot
|
// Randomize the start spot
|
||||||
|
@ -1349,31 +1333,25 @@ CBaseEntity* CFF_SV_Player::EntSelectSpawnPoint( void )
|
||||||
if ( !pSpot ) // skip over the null point
|
if ( !pSpot ) // skip over the null point
|
||||||
pSpot = gEntList.FindEntityByClassname( pSpot, pSpawnpointName );
|
pSpot = gEntList.FindEntityByClassname( pSpot, pSpawnpointName );
|
||||||
|
|
||||||
|
bool validSpawnFound = false;
|
||||||
|
|
||||||
CBaseEntity *pFirstSpot = pSpot;
|
CBaseEntity *pFirstSpot = pSpot;
|
||||||
|
|
||||||
|
// FF dexter note: this valve code had wacky goto and stuff, simplified
|
||||||
do
|
do
|
||||||
{
|
{
|
||||||
if ( pSpot )
|
if ( pSpot && g_pGameRules->IsSpawnPointValid( pSpot, this ) )
|
||||||
{
|
{
|
||||||
// check if pSpot is valid
|
validSpawnFound = true;
|
||||||
if ( g_pGameRules->IsSpawnPointValid( pSpot, this ) )
|
break;
|
||||||
{
|
|
||||||
if ( pSpot->GetLocalOrigin() == vec3_origin )
|
|
||||||
{
|
|
||||||
pSpot = gEntList.FindEntityByClassname( pSpot, pSpawnpointName );
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
// if so, go to pSpot
|
|
||||||
goto ReturnSpot;
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
// increment pSpot
|
|
||||||
pSpot = gEntList.FindEntityByClassname( pSpot, pSpawnpointName );
|
pSpot = gEntList.FindEntityByClassname( pSpot, pSpawnpointName );
|
||||||
} while ( pSpot != pFirstSpot ); // loop if we're not back to the start
|
|
||||||
|
} while ( pSpot != pFirstSpot );
|
||||||
|
|
||||||
// we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
|
// we haven't found a place to spawn yet, so kill any guy at the first spawn point and spawn there
|
||||||
if ( pSpot )
|
if ( pSpot && !validSpawnFound )
|
||||||
{
|
{
|
||||||
CBaseEntity *ent = NULL;
|
CBaseEntity *ent = NULL;
|
||||||
for ( CEntitySphereQuery sphere( pSpot->GetAbsOrigin(), 128 ); (ent = sphere.GetCurrentEntity()) != NULL; sphere.NextEntity() )
|
for ( CEntitySphereQuery sphere( pSpot->GetAbsOrigin(), 128 ); (ent = sphere.GetCurrentEntity()) != NULL; sphere.NextEntity() )
|
||||||
|
@ -1382,33 +1360,13 @@ CBaseEntity* CFF_SV_Player::EntSelectSpawnPoint( void )
|
||||||
if ( ent->IsPlayer() && !(ent->edict() == player) )
|
if ( ent->IsPlayer() && !(ent->edict() == player) )
|
||||||
ent->TakeDamage( CTakeDamageInfo( GetContainingEntity(INDEXENT(0)), GetContainingEntity(INDEXENT(0)), 300, DMG_GENERIC ) );
|
ent->TakeDamage( CTakeDamageInfo( GetContainingEntity(INDEXENT(0)), GetContainingEntity(INDEXENT(0)), 300, DMG_GENERIC ) );
|
||||||
}
|
}
|
||||||
goto ReturnSpot;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
if ( !pSpot )
|
// note: as a last ditch effort try a default spawn ent
|
||||||
{
|
if ( !pSpot )
|
||||||
pSpot = gEntList.FindEntityByClassname( pSpot, "info_player_start" );
|
pSpot = gEntList.FindEntityByClassname( pSpot, "info_player_start" );
|
||||||
|
|
||||||
if ( pSpot )
|
|
||||||
goto ReturnSpot;
|
|
||||||
}
|
|
||||||
|
|
||||||
ReturnSpot:
|
|
||||||
|
|
||||||
if ( FFRules()->IsTeamplay() == true )
|
|
||||||
{
|
|
||||||
if ( GetTeamNumber() == TEAM_COMBINE )
|
|
||||||
{
|
|
||||||
g_pLastCombineSpawn = pSpot;
|
|
||||||
}
|
|
||||||
else if ( GetTeamNumber() == TEAM_REBELS )
|
|
||||||
{
|
|
||||||
g_pLastRebelSpawn = pSpot;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
g_pLastSpawn = pSpot;
|
g_pLastSpawn = pSpot;
|
||||||
|
|
||||||
m_flSlamProtectTime = gpGlobals->curtime + 0.5;
|
m_flSlamProtectTime = gpGlobals->curtime + 0.5;
|
||||||
|
|
||||||
return pSpot;
|
return pSpot;
|
||||||
|
@ -1631,4 +1589,4 @@ bool CFF_SV_Player::CanHearAndReadChatFrom( CBasePlayer *pPlayer )
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
|
@ -47,9 +47,6 @@ ConVar sv_report_client_settings("sv_report_client_settings", "0", FCVAR_GAMEDLL
|
||||||
|
|
||||||
extern ConVar mp_chattime;
|
extern ConVar mp_chattime;
|
||||||
|
|
||||||
extern CBaseEntity *g_pLastCombineSpawn;
|
|
||||||
extern CBaseEntity *g_pLastRebelSpawn;
|
|
||||||
|
|
||||||
#define WEAPON_MAX_DISTANCE_FROM_SPAWN 64
|
#define WEAPON_MAX_DISTANCE_FROM_SPAWN 64
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
@ -116,9 +113,8 @@ static const char *s_PreserveEnts[] =
|
||||||
"info_node",
|
"info_node",
|
||||||
"info_target",
|
"info_target",
|
||||||
"info_node_hint",
|
"info_node_hint",
|
||||||
"info_player_deathmatch",
|
// FF note, only info_ff_teamspawn is checked for spawnpoints, no fallback anymore
|
||||||
"info_player_combine",
|
"info_ff_teamspawn",
|
||||||
"info_player_rebel",
|
|
||||||
"info_map_parameters",
|
"info_map_parameters",
|
||||||
"keyframe_rope",
|
"keyframe_rope",
|
||||||
"move_rope",
|
"move_rope",
|
||||||
|
@ -241,9 +237,6 @@ void CFF_SH_Rules::CreateStandardEntities( void )
|
||||||
|
|
||||||
BaseClass::CreateStandardEntities();
|
BaseClass::CreateStandardEntities();
|
||||||
|
|
||||||
g_pLastCombineSpawn = NULL;
|
|
||||||
g_pLastRebelSpawn = NULL;
|
|
||||||
|
|
||||||
#ifdef DBGFLAG_ASSERT
|
#ifdef DBGFLAG_ASSERT
|
||||||
CBaseEntity *pEnt =
|
CBaseEntity *pEnt =
|
||||||
#endif
|
#endif
|
||||||
|
@ -1281,4 +1274,35 @@ const char *CFF_SH_Rules::GetChatFormat( bool bTeamOnly, CBasePlayer *pPlayer )
|
||||||
return pszFormat;
|
return pszFormat;
|
||||||
}
|
}
|
||||||
|
|
||||||
#endif
|
bool CFF_SH_Rules::IsSpawnPointValid( CBaseEntity *pSpot, CBasePlayer *pPlayer )
|
||||||
|
{
|
||||||
|
if ( !pSpot || pSpot->GetLocalOrigin() == vec3_origin )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// check base class (is there any dudes on the point ? )
|
||||||
|
if ( !BaseClass::IsSpawnPointValid( pSpot, pPlayer ) )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// might want to challenge this, not sure its really needed to check we're getting a FF player here
|
||||||
|
CFF_SV_Player *pFFPlayer = ToFFPlayer ( pPlayer );
|
||||||
|
if ( !pFFPlayer )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
// FF TODO: run lua predicate against spot
|
||||||
|
/*
|
||||||
|
CFFLuaSC hAllowed;
|
||||||
|
hAllowed.Push( pFFPlayer );
|
||||||
|
if( _scriptman.RunPredicates_LUA( pSpot, &hAllowed, "validspawn" ) )
|
||||||
|
{
|
||||||
|
// Spot is a valid place for us to spawn
|
||||||
|
if( hAllowed.GetBool() )
|
||||||
|
{
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
*/
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
#endif // client
|
||||||
|
|
|
@ -136,6 +136,7 @@ public:
|
||||||
void ManageObjectRelocation( void );
|
void ManageObjectRelocation( void );
|
||||||
void CheckChatForReadySignal( CFF_SH_Player *pPlayer, const char *chatmsg );
|
void CheckChatForReadySignal( CFF_SH_Player *pPlayer, const char *chatmsg );
|
||||||
const char *GetChatFormat( bool bTeamOnly, CBasePlayer *pPlayer );
|
const char *GetChatFormat( bool bTeamOnly, CBasePlayer *pPlayer );
|
||||||
|
bool IsSpawnPointValid( CBaseEntity *pSpot, CBasePlayer *pPlayer );
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
virtual void ClientDisconnected( edict_t *pClient );
|
virtual void ClientDisconnected( edict_t *pClient );
|
||||||
|
|
|
@ -12,7 +12,6 @@
|
||||||
#define FF_PUSHAWAY_THINK_INTERVAL (1.0f / 20.0f)
|
#define FF_PUSHAWAY_THINK_INTERVAL (1.0f / 20.0f)
|
||||||
#include "studio.h"
|
#include "studio.h"
|
||||||
|
|
||||||
|
|
||||||
enum
|
enum
|
||||||
{
|
{
|
||||||
PLAYER_SOUNDS_CITIZEN = 0,
|
PLAYER_SOUNDS_CITIZEN = 0,
|
||||||
|
|
Loading…
Reference in a new issue