Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/game/server/neo/neo_game_config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ void CNEOGameConfig::Spawn()
void CNEOGameConfig::InputFireTeamWin(inputdata_t& inputData)
{
int team = inputData.value.Int();
static_cast<CNEORules*>(g_pGameRules)->SetWinningTeam(team, NEO_VICTORY_MAPIO, false, true, false, false);
NEORules()->SetWinningTeam(team, NEO_VICTORY_MAPIO, false, true, false, false);
}

void CNEOGameConfig::InputFireDMPlayerWin(inputdata_t& inputData)
Expand All @@ -50,13 +50,13 @@ void CNEOGameConfig::InputFireDMPlayerWin(inputdata_t& inputData)

if (pPlayer)
{
static_cast<CNEORules*>(g_pGameRules)->SetWinningDMPlayer(static_cast<CNEO_Player*>(pPlayer));
NEORules()->SetWinningDMPlayer(static_cast<CNEO_Player*>(pPlayer));
}
}

void CNEOGameConfig::InputFireRoundTie(inputdata_t& inputData)
{
static_cast<CNEORules*>(g_pGameRules)->SetWinningTeam(1, NEO_VICTORY_STALEMATE, false, true, true, false);
NEORules()->SetWinningTeam(1, NEO_VICTORY_STALEMATE, false, true, true, false);
}

// Outputs
Expand Down
23 changes: 22 additions & 1 deletion src/game/shared/gamerules.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,10 @@

#endif

#ifdef NEO
#include "neo_player_spawnpoint.h"
#endif

// memdbgon must be the last include file in a .cpp file!!!
#include "tier0/memdbgon.h"

Expand Down Expand Up @@ -197,6 +201,10 @@ CBaseEntity *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer )
// in the base maps, and the current info_player_start preview model wouldn't make as much sense (a small camera looking box would then be better), but would be easier for mappers to get the right position
spawnPosition = spawnPosition - pPlayer->GetViewOffset() + Vector(0, 0, 65);
}
else if ( auto* pNEOSpawnSpot = dynamic_cast<CNEOSpawnPoint*>( pSpawnSpot ) )
{
pNEOSpawnSpot->m_OnPlayerSpawn.FireOutput( pPlayer, pNEOSpawnSpot );
}
pPlayer->SetLocalOrigin( spawnPosition );
#else
pPlayer->SetLocalOrigin( pSpawnSpot->GetAbsOrigin() + Vector(0,0,1) );
Expand All @@ -215,12 +223,25 @@ bool CGameRules::IsSpawnPointValid( CBaseEntity *pSpot, CBasePlayer *pPlayer )
{
CBaseEntity *ent = NULL;

#if defined NEO && defined GAME_DLL
if ( auto* pNEOSpot = dynamic_cast<CNEOSpawnPoint*>( pSpot ) )
{
if ( pNEOSpot->m_bDisabled )
{
return false;
}
}
#endif

if ( !pSpot->IsTriggered( pPlayer ) )
{
return false;
}

#ifdef NEO
for ( CEntitySphereQuery sphere( pSpot->GetAbsOrigin(), 16 ); (ent = sphere.GetCurrentEntity()) != NULL; sphere.NextEntity() )
#else
for ( CEntitySphereQuery sphere( pSpot->GetAbsOrigin(), 128 ); (ent = sphere.GetCurrentEntity()) != NULL; sphere.NextEntity() )
#endif
{
// if ent is a client, don't spawn on 'em
if ( ent->IsPlayer() && ent != pPlayer )
Expand Down
20 changes: 20 additions & 0 deletions src/game/shared/neo/neo_player_spawnpoint.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,14 @@ END_RECV_TABLE()
#endif

BEGIN_DATADESC(CNEOSpawnPoint)
#ifdef GAME_DLL
DEFINE_KEYFIELD(m_bDisabled, FIELD_BOOLEAN, "StartDisabled"),

DEFINE_INPUTFUNC(FIELD_VOID, "Enable", InputEnable),
DEFINE_INPUTFUNC(FIELD_VOID, "Disable", InputDisable),

DEFINE_OUTPUT(m_OnPlayerSpawn, "OnPlayerSpawn")
#endif
END_DATADESC()

CNEOSpawnPoint::CNEOSpawnPoint()
Expand All @@ -64,3 +72,15 @@ void CNEOSpawnPoint::Spawn()
GetAbsOrigin().x, GetAbsOrigin().y, GetAbsOrigin().z);
#endif
}

#ifdef GAME_DLL
void CNEOSpawnPoint::InputEnable(inputdata_t& inputData)
{
m_bDisabled = false;
}

void CNEOSpawnPoint::InputDisable(inputdata_t& inputData)
{
m_bDisabled = true;
}
#endif
9 changes: 9 additions & 0 deletions src/game/shared/neo/neo_player_spawnpoint.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,15 @@ class CNEOSpawnPoint : public CBaseEntity

virtual void Spawn();

#ifdef GAME_DLL
bool m_bDisabled;

void InputEnable(inputdata_t& inputdata);
void InputDisable(inputdata_t& inputdata);

COutputEvent m_OnPlayerSpawn;
#endif

protected:
int m_iOwningTeam;

Expand Down