Browse Source

Fix server build. Fix spawn point search.

dmc
Night Owl 7 years ago
parent
commit
e168886df9
  1. 61
      dlls/3wave/threewave_gamerules.cpp
  2. 4
      dlls/gamerules.cpp
  3. 78
      dlls/player.cpp

61
dlls/3wave/threewave_gamerules.cpp

@ -48,11 +48,10 @@ extern int gmsgRuneStatus;
extern int gmsgFlagCarrier; extern int gmsgFlagCarrier;
extern int gmsgScoreInfo; extern int gmsgScoreInfo;
extern unsigned short g_usHook; unsigned short g_usHook;
extern unsigned short g_usCable; unsigned short g_usCable;
extern unsigned short g_usCarried; unsigned short g_usCarried;
extern unsigned short g_usFlagSpawn; unsigned short g_usFlagSpawn;
static char team_names[MAX_TEAMS][MAX_TEAMNAME_LENGTH]; static char team_names[MAX_TEAMS][MAX_TEAMNAME_LENGTH];
static int team_scores[MAX_TEAMS]; static int team_scores[MAX_TEAMS];
@ -112,7 +111,7 @@ static CThreeWaveGameMgrHelper g_GameMgrHelper;
extern DLL_GLOBAL BOOL g_fGameOver; extern DLL_GLOBAL BOOL g_fGameOver;
char* GetTeamName( int team ) const char* GetTeamName( int team )
{ {
if ( team < 0 || team > NUM_TEAMS ) if ( team < 0 || team > NUM_TEAMS )
team = 0; team = 0;
@ -122,9 +121,10 @@ char* GetTeamName( int team )
CThreeWave :: CThreeWave() CThreeWave :: CThreeWave()
{ {
#ifndef NO_VOICEGAMEMGR
// CHalfLifeMultiplay already initialized it - just override its helper callback. // CHalfLifeMultiplay already initialized it - just override its helper callback.
m_VoiceGameMgr.SetHelper(&g_GameMgrHelper); m_VoiceGameMgr.SetHelper(&g_GameMgrHelper);
#endif
m_DisableDeathMessages = FALSE; m_DisableDeathMessages = FALSE;
m_DisableDeathPenalty = FALSE; m_DisableDeathPenalty = FALSE;
@ -173,8 +173,9 @@ extern cvar_t timeleft, fragsleft;
void CThreeWave :: Think ( void ) void CThreeWave :: Think ( void )
{ {
#ifndef NO_VOICEGAMEMGR
m_VoiceGameMgr.Update(gpGlobals->frametime); m_VoiceGameMgr.Update(gpGlobals->frametime);
#endif
///// Check game rules ///// ///// Check game rules /////
static int last_frags; static int last_frags;
static int last_time; static int last_time;
@ -335,9 +336,10 @@ void DropRune ( CBasePlayer *pPlayer );
//========================================================= //=========================================================
BOOL CThreeWave :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd ) BOOL CThreeWave :: ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
{ {
#ifndef NO_VOICEGAMEMGR
if( m_VoiceGameMgr.ClientCommand( pPlayer, pcmd ) ) if( m_VoiceGameMgr.ClientCommand( pPlayer, pcmd ) )
return TRUE; return TRUE;
#endif
if ( FStrEq( pcmd, "menuselect" ) ) if ( FStrEq( pcmd, "menuselect" ) )
{ {
if ( CMD_ARGC() < 2 ) if ( CMD_ARGC() < 2 )
@ -1657,8 +1659,8 @@ void CItemFlag::Spawn ( void )
UTIL_SetOrigin( pev, pev->origin ); UTIL_SetOrigin( pev, pev->origin );
UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16)); UTIL_SetSize(pev, Vector(-16, -16, 0), Vector(16, 16, 16));
SetThink( FlagThink ); SetThink( &CItemFlag::FlagThink );
SetTouch( FlagTouch ); SetTouch( &CItemFlag::FlagTouch );
pev->nextthink = gpGlobals->time + 0.3; pev->nextthink = gpGlobals->time + 0.3;
@ -2014,11 +2016,10 @@ void CItemFlag::Materialize( void )
Dropped = FALSE; Dropped = FALSE;
SetTouch( FlagTouch ); SetTouch( &CItemFlag::FlagTouch );
SetThink( FlagThink ); SetThink( &CItemFlag::FlagThink );
} }
void CItemFlag::ResetFlag( int iTeam ) void CItemFlag::ResetFlag( int iTeam )
{ {
CBaseEntity *pFlag1 = NULL; CBaseEntity *pFlag1 = NULL;
@ -2135,7 +2136,7 @@ void CCarriedFlag ::Spawn( )
m_iOwnerOldVel = 0; m_iOwnerOldVel = 0;
SetThink( FlagThink ); SetThink( &CCarriedFlag::FlagThink );
pev->nextthink = gpGlobals->time + 0.1; pev->nextthink = gpGlobals->time + 0.1;
} }
@ -2470,7 +2471,7 @@ void CResistRune::MakeTouchable ( void )
pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( RuneRespawn ); SetThink ( &CResistRune::RuneRespawn );
} }
void CResistRune::Spawn ( void ) void CResistRune::Spawn ( void )
@ -2511,10 +2512,10 @@ void CResistRune::Spawn ( void )
pev->owner = NULL; pev->owner = NULL;
SetTouch( RuneTouch ); SetTouch( &CResistRune::RuneTouch );
pev->nextthink = gpGlobals->time + 1; pev->nextthink = gpGlobals->time + 1;
SetThink ( MakeTouchable ); SetThink ( &CResistRune::MakeTouchable );
} }
@ -2527,7 +2528,7 @@ void CStrengthRune::MakeTouchable ( void )
pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( RuneRespawn ); SetThink ( &CStrengthRune::RuneRespawn );
} }
void CStrengthRune::RuneTouch ( CBaseEntity *pOther ) void CStrengthRune::RuneTouch ( CBaseEntity *pOther )
@ -2634,10 +2635,10 @@ void CStrengthRune::Spawn ( void )
pev->owner = NULL; pev->owner = NULL;
SetTouch( RuneTouch ); SetTouch( &CStrengthRune::RuneTouch );
pev->nextthink = gpGlobals->time + 1; pev->nextthink = gpGlobals->time + 1;
SetThink ( MakeTouchable ); SetThink ( &CStrengthRune::MakeTouchable );
} }
@ -2649,7 +2650,7 @@ void CHasteRune::MakeTouchable ( void )
pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( RuneRespawn ); SetThink ( &CHasteRune::RuneRespawn );
} }
@ -2759,12 +2760,12 @@ void CHasteRune::Spawn ( void )
pev->owner = NULL; pev->owner = NULL;
SetTouch( RuneTouch ); SetTouch( &CHasteRune::RuneTouch );
pev->nextthink = gpGlobals->time + 1; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 1; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( MakeTouchable ); SetThink ( &CHasteRune::MakeTouchable );
} }
@ -2777,7 +2778,7 @@ void CRegenRune::MakeTouchable ( void )
pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 120; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( RuneRespawn ); SetThink ( &CRegenRune::RuneRespawn );
} }
void CRegenRune::RuneTouch ( CBaseEntity *pOther ) void CRegenRune::RuneTouch ( CBaseEntity *pOther )
@ -2885,12 +2886,12 @@ void CRegenRune::Spawn ( void )
pev->owner = NULL; pev->owner = NULL;
SetTouch( RuneTouch ); SetTouch( &CRegenRune::RuneTouch );
pev->nextthink = gpGlobals->time + 1; // if no one touches it in two minutes, pev->nextthink = gpGlobals->time + 1; // if no one touches it in two minutes,
// respawn it somewhere else, so inaccessible // respawn it somewhere else, so inaccessible
// ones will come 'back' // ones will come 'back'
SetThink ( MakeTouchable ); SetThink ( &CRegenRune::MakeTouchable );
} }
@ -3042,7 +3043,7 @@ void CGrapple::GrappleTouch ( CBaseEntity *pOther )
STOP_SOUND( ((CBasePlayer *)pOwner)->edict(), CHAN_WEAPON, "weapons/grfire.wav" ); STOP_SOUND( ((CBasePlayer *)pOwner)->edict(), CHAN_WEAPON, "weapons/grfire.wav" );
pev->enemy = pOther->edict();// remember this guy! pev->enemy = pOther->edict();// remember this guy!
SetThink ( Grapple_Track ); SetThink ( &CGrapple::Grapple_Track );
pev->nextthink = gpGlobals->time; pev->nextthink = gpGlobals->time;
m_flNextIdleTime = gpGlobals->time + 0.1; m_flNextIdleTime = gpGlobals->time + 0.1;
pev->solid = SOLID_NOT; pev->solid = SOLID_NOT;
@ -3223,8 +3224,8 @@ void CGrapple::Spawn ( void )
SET_MODEL ( ENT(pev),"models/hook.mdl"); SET_MODEL ( ENT(pev),"models/hook.mdl");
SetTouch ( GrappleTouch ); SetTouch ( &CGrapple::GrappleTouch );
SetThink ( OnAirThink ); SetThink ( &CGrapple::OnAirThink );
pev->nextthink = gpGlobals->time + 0.1; pev->nextthink = gpGlobals->time + 0.1;
} }

4
dlls/gamerules.cpp

@ -30,7 +30,7 @@ extern Vector g_vecTeleMins[MAX_TELES];
extern Vector g_vecTeleMaxs[MAX_TELES]; extern Vector g_vecTeleMaxs[MAX_TELES];
extern int g_iTeleNum; extern int g_iTeleNum;
extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ); extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer, bool bCheckDM );
DLL_GLOBAL CGameRules *g_pGameRules = NULL; DLL_GLOBAL CGameRules *g_pGameRules = NULL;
extern DLL_GLOBAL BOOL g_fGameOver; extern DLL_GLOBAL BOOL g_fGameOver;
@ -66,7 +66,7 @@ BOOL CGameRules::CanHaveAmmo( CBasePlayer *pPlayer, const char *pszAmmoName, int
//========================================================= //=========================================================
edict_t *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer ) edict_t *CGameRules::GetPlayerSpawnSpot( CBasePlayer *pPlayer )
{ {
edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer ); edict_t *pentSpawnSpot = EntSelectSpawnPoint( pPlayer, TRUE );
pPlayer->pev->origin = VARS( pentSpawnSpot )->origin + Vector( 0, 0, 1 ); pPlayer->pev->origin = VARS( pentSpawnSpot )->origin + Vector( 0, 0, 1 );
pPlayer->pev->v_angle = g_vecZero; pPlayer->pev->v_angle = g_vecZero;

78
dlls/player.cpp

@ -61,7 +61,7 @@ BOOL gInitHUD = TRUE;
extern void CopyToBodyQue( entvars_t *pev); extern void CopyToBodyQue( entvars_t *pev);
extern void respawn( entvars_t *pev, BOOL fCopyCorpse ); extern void respawn( entvars_t *pev, BOOL fCopyCorpse );
extern Vector VecBModelOrigin( entvars_t *pevBModel ); extern Vector VecBModelOrigin( entvars_t *pevBModel );
extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ); extern edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer, bool bCheckDM );
// the world node graph // the world node graph
extern CGraph WorldGraph; extern CGraph WorldGraph;
@ -204,6 +204,12 @@ int gmsgAllowSpec = 0;
int gmsgSpectator = 0; int gmsgSpectator = 0;
//-- Martin Webrant //-- Martin Webrant
// ThreeWave
int gmsgFlagStatus = 0;
int gmsgFlagCarrier = 0;
int gmsgRuneStatus = 0;
int gmsgCTFMsgs = 0;
void LinkUserMessages( void ) void LinkUserMessages( void )
{ {
// Already taken care of? // Already taken care of?
@ -252,6 +258,10 @@ void LinkUserMessages( void )
gmsgStatusText = REG_USER_MSG( "StatusText", -1 ); gmsgStatusText = REG_USER_MSG( "StatusText", -1 );
gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 ); gmsgStatusValue = REG_USER_MSG( "StatusValue", 3 );
gmsgCTFMsgs = REG_USER_MSG( "Bonus", -1 );
gmsgFlagStatus = REG_USER_MSG( "FlagStat", 5 );
gmsgRuneStatus = REG_USER_MSG( "RuneStat", 1 );
gmsgFlagCarrier = REG_USER_MSG( "FlagCarrier", 2 );
//++ BulliT //++ BulliT
gmsgAllowSpec = REG_USER_MSG( "AllowSpec", 1 ); //Allow spectator button message. gmsgAllowSpec = REG_USER_MSG( "AllowSpec", 1 ); //Allow spectator button message.
gmsgSpectator = REG_USER_MSG( "Spectator", 2 ); //Spectator message. gmsgSpectator = REG_USER_MSG( "Spectator", 2 ); //Spectator message.
@ -2396,15 +2406,16 @@ Returns the entity to spawn at
USES AND SETS GLOBAL g_pLastSpawn USES AND SETS GLOBAL g_pLastSpawn
============ ============
*/ */
edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer ) edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer, bool bCheckDM )
{ {
CBaseEntity *pSpot; CBaseEntity *pSpot;
edict_t *player; edict_t *player;
const char *pszName;
player = pPlayer->edict(); player = pPlayer->edict();
// choose a info_player_deathmatch point // choose a info_player_deathmatch point
if( g_pGameRules->IsCoOp() ) /*if( g_pGameRules->IsCoOp() )
{ {
pSpot = UTIL_FindEntityByClassname( g_pLastSpawn, "info_player_coop" ); pSpot = UTIL_FindEntityByClassname( g_pLastSpawn, "info_player_coop" );
if( !FNullEnt( pSpot ) ) if( !FNullEnt( pSpot ) )
@ -2413,14 +2424,41 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
if( !FNullEnt(pSpot) ) if( !FNullEnt(pSpot) )
goto ReturnSpot; goto ReturnSpot;
} }
else if( g_pGameRules->IsDeathmatch() ) else if( g_pGameRules->IsDeathmatch() )*/
{ {
pSpot = g_pLastSpawn; pSpot = g_pLastSpawn;
// Randomize the start spot // Randomize the start spot
for( int i = RANDOM_LONG( 1, 5 ); i > 0; i-- ) for( int i = RANDOM_LONG( 1, 5 ); i > 0; i-- )
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ); {
if( !bCheckDM )
{
if( player->v.team == 1 )
pszName = "info_player_team1";
else if( player->v.team == 2 )
pszName = "info_player_team2";
else
pszName = "info_player_deathmatch";
}
else
pszName = "info_player_deathmatch";
pSpot = UTIL_FindEntityByClassname( pSpot, pszName );
}
if( FNullEnt( pSpot ) ) // skip over the null point if( FNullEnt( pSpot ) ) // skip over the null point
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ); {
if( !bCheckDM )
{
if( player->v.team == 1 )
pszName = "info_player_team1";
else if( player->v.team == 2 )
pszName = "info_player_team2";
else
pszName = "info_player_deathmatch";
}
else
pszName = "info_player_deathmatch";
pSpot = UTIL_FindEntityByClassname( pSpot, pszName );
}
CBaseEntity *pFirstSpot = pSpot; CBaseEntity *pFirstSpot = pSpot;
@ -2433,7 +2471,18 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
{ {
if( pSpot->pev->origin == Vector( 0, 0, 0 ) ) if( pSpot->pev->origin == Vector( 0, 0, 0 ) )
{ {
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ); if( !bCheckDM )
{
if( player->v.team == 1 )
pszName = "info_player_team1";
else if( player->v.team == 2 )
pszName = "info_player_team2";
else
pszName = "info_player_deathmatch";
}
else
pszName = "info_player_deathmatch";
pSpot = UTIL_FindEntityByClassname( pSpot, pszName );
continue; continue;
} }
@ -2442,7 +2491,18 @@ edict_t *EntSelectSpawnPoint( CBaseEntity *pPlayer )
} }
} }
// increment pSpot // increment pSpot
pSpot = UTIL_FindEntityByClassname( pSpot, "info_player_deathmatch" ); if( !bCheckDM )
{
if( player->v.team == 1 )
pszName = "info_player_team1";
else if( player->v.team == 2 )
pszName = "info_player_team2";
else
pszName = "info_player_deathmatch";
}
else
pszName = "info_player_deathmatch";
pSpot = UTIL_FindEntityByClassname( pSpot, pszName );
} while( pSpot != pFirstSpot ); // loop if we're not back to the start } while( pSpot != pFirstSpot ); // loop if we're not back to the start
// 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
@ -2682,7 +2742,7 @@ int CBasePlayer::Restore( CRestore &restore )
ALERT( at_console, "No Landmark:%s\n", pSaveData->szLandmarkName ); ALERT( at_console, "No Landmark:%s\n", pSaveData->szLandmarkName );
// default to normal spawn // default to normal spawn
edict_t *pentSpawnSpot = EntSelectSpawnPoint( this ); edict_t *pentSpawnSpot = EntSelectSpawnPoint( this, TRUE );
pev->origin = VARS( pentSpawnSpot )->origin + Vector( 0, 0, 1 ); pev->origin = VARS( pentSpawnSpot )->origin + Vector( 0, 0, 1 );
pev->angles = VARS( pentSpawnSpot )->angles; pev->angles = VARS( pentSpawnSpot )->angles;
} }

Loading…
Cancel
Save