Browse Source

tabs, comments, code style

gravgun
mittorn 8 years ago
parent
commit
dbf9a357f2
  1. 24
      dlls/coop.cpp
  2. 29
      dlls/triggers.cpp

24
dlls/coop.cpp

@ -4,6 +4,13 @@ @@ -4,6 +4,13 @@
#include "player.h"
#include "coop_util.h"
GlobalMenu g_GlobalMenu;
struct SavedCoords g_SavedCoords, s_SavedCoords;
void UTIL_CleanSpawnPoint( Vector origin, float dist )
{
CBaseEntity *ent = NULL;
@ -129,13 +136,19 @@ char *badlist[256] = { @@ -129,13 +136,19 @@ char *badlist[256] = {
void UTIL_CoopKickPlayer(CBaseEntity *pPlayer)
{
int i;
if( !pPlayer )
return;
char *name = UTIL_CoopPlayerName( pPlayer );
SERVER_COMMAND( UTIL_VarArgs( "kick %d\n", ENTINDEX(pPlayer->pev->pContainingEntity) - 1 ) );
if( strlen( name ) < 5 )
return;
// find last slot
for( i = 0; badlist[i]; i++ );
badlist[i] = strdup( name );
}
@ -143,9 +156,11 @@ bool UTIL_CoopIsBadPlayer( CBaseEntity *plr ) @@ -143,9 +156,11 @@ bool UTIL_CoopIsBadPlayer( CBaseEntity *plr )
{
if( !plr )
return false;
for( int i = 0; badlist[i];i++ )
if( strcasestr( (char*)UTIL_CoopPlayerName( plr ), badlist[i] ) )
return true;
return false;
}
@ -223,7 +238,8 @@ void GlobalMenu::Process( CBasePlayer *pPlayer, int imenu ) @@ -223,7 +238,8 @@ void GlobalMenu::Process( CBasePlayer *pPlayer, int imenu )
UTIL_CoopKickPlayer( pPlayer );
m_iConfirm-= 5;
return;
} m_iConfirm++;
}
m_iConfirm++;
MESSAGE_BEGIN( MSG_ALL, 8, NULL ); // svc_print
WRITE_BYTE( 3 ); // PRINT_CHAT
WRITE_STRING( UTIL_VarArgs( "%s^7 confirmed map change\n", ( pPlayer->pev->netname && STRING( pPlayer->pev->netname )[0] != 0 ) ? STRING( pPlayer->pev->netname ) : "unconnected"));
@ -481,6 +497,7 @@ void UTIL_CoopProcessMenu( CBasePlayer *pPlayer, int imenu ) @@ -481,6 +497,7 @@ void UTIL_CoopProcessMenu( CBasePlayer *pPlayer, int imenu )
pPlayer->RemoveAllItems( TRUE );
UTIL_SpawnPlayer( pPlayer );
pPlayer->pev->origin = g_checkpoints[imenu-2].origin;
pPlayer->pev->angles = g_checkpoints[imenu-2].angles;
}
break;
case MENUSTATE_LOCAL_CONFIRM:
@ -610,8 +627,3 @@ CBaseEntity *UTIL_CoopGetPlayerTrain( CBaseEntity *pPlayer) @@ -610,8 +627,3 @@ CBaseEntity *UTIL_CoopGetPlayerTrain( CBaseEntity *pPlayer)
return NULL;
return train;
}
GlobalMenu g_GlobalMenu;
struct SavedCoords g_SavedCoords, s_SavedCoords;

29
dlls/triggers.cpp

@ -1529,6 +1529,8 @@ void GlobalMenu::VoteMenu( CBasePlayer *pPlayer ) @@ -1529,6 +1529,8 @@ void GlobalMenu::VoteMenu( CBasePlayer *pPlayer )
ShowGlobalMenu(UTIL_VarArgs("%s requested to force change map", UTIL_CoopPlayerName( pPlayer ) ), i, maps);
}
void UTIL_CoopValidateOffset( void )
{
if( !g_SavedCoords.validoffset)
@ -1676,7 +1678,8 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) @@ -1676,7 +1678,8 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
{
if( !count2 )
{
if( pActivator && pActivator->IsPlayer() && m_flRepeatTimer - gpGlobals->time < -1 ){
if( pActivator && pActivator->IsPlayer() && m_flRepeatTimer - gpGlobals->time < -1 )
{
CBasePlayer *pPlayer = (CBasePlayer*)pActivator;
MESSAGE_BEGIN( MSG_ALL, 8, NULL ); // svc_print
WRITE_BYTE( 3 ); // PRINT_CHAT
@ -1815,24 +1818,12 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) @@ -1815,24 +1818,12 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
ALERT( at_console, "Player isn't in the transition volume %s, aborting\n", m_szLandmarkName );
return;
}
//else
/* if !pPlayer
{
ALERT( at_console, ", aborting\n" );
return;
}*/
MESSAGE_BEGIN( MSG_ALL, 8, NULL ); // svc_print
WRITE_BYTE( 3 ); // PRINT_CHAT
WRITE_STRING( UTIL_VarArgs( "%s^7 activated changelevel\n", ( pPlayer->pev->netname && STRING( pPlayer->pev->netname )[0] != 0 ) ? STRING( pPlayer->pev->netname ) : "unconnected"));
MESSAGE_END();
// shedule remove ke^w on first info_player_start
/*edict_t *playerstart = FIND_ENTITY_BY_CLASSNAME( NULL, "info_player_start" );
if( !FNullEnt(playerstart) )
playerstart->v.flags |= FL_KILLME;*/
// This object will get removed in the call to CHANGE_LEVEL, copy the params into "safe" memory
strcpy( st_szNextMap, m_szMapName );
@ -1879,29 +1870,23 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) @@ -1879,29 +1870,23 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
{
CBasePlayer *plr = (CBasePlayer*)UTIL_PlayerByIndex( i );
// reset all players state
// reset all players state to make it spawn again after restart
if( plr )
{
plr->m_state = STATE_UNINITIALIZED;
plr->RemoveAllItems( TRUE );
UTIL_BecomeSpectator( plr );
//plr->SetThink( &CBasePlayer::Spawn );
//plr->pev->nextthink = gpGlobals->time + 1;
// HACK: force perform reconnection
if( mp_coop_reconnect_hack.value )
CLIENT_COMMAND( plr->edict(), "reconnect\n" );
//CLIENT_COMMAND( plr->edict(), "alias cmd \"reconnect;unalias cmd\"\n" );
//MESSAGE_BEGIN( MSG_ONE, 2, NULL, plr->pev ); // svc_disconnect after stufftext
//MESSAGE_END();
//SERVER_COMMAND( UTIL_VarArgs( "kick %d\n", i-1 ) );
//SERVER_EXECUTE();
}
}
g_fPause = true;
}
s_SavedCoords.fUsed = m_bUsed;
s_SavedCoords.valid = valid;
// wait 5 frames to make sure all players are in reconnected state
if( mp_coop_reconnect_hack.value )
SERVER_COMMAND( UTIL_VarArgs( "wait;wait;wait;wait;wait;changelevel %s %s\n", st_szNextMap, st_szNextSpot ) );
else

Loading…
Cancel
Save