Browse Source

Fix vote

gravgun
mittorn 6 years ago
parent
commit
90ba38d577
  1. 1
      dlls/client.cpp
  2. 42
      dlls/coop.cpp
  3. 2
      dlls/gravgunmod.cpp
  4. 2
      dlls/subs.cpp
  5. 4
      dlls/triggers.cpp

1
dlls/client.cpp

@ -628,6 +628,7 @@ void ClientCommand( edict_t *pEntity ) @@ -628,6 +628,7 @@ void ClientCommand( edict_t *pEntity )
}*/
pPlayer->RemoveAllItems(TRUE);
UTIL_BecomeSpectator(pPlayer);
pPlayer->gravgunmod_data.m_state = STATE_SPECTATOR;
}
else if( FStrEq( pcmd, "specmode" ) ) // new spectator mode
{

42
dlls/coop.cpp

@ -382,43 +382,47 @@ void GlobalVote::Process( CBasePlayer *pPlayer, int imenu ) @@ -382,43 +382,47 @@ void GlobalVote::Process( CBasePlayer *pPlayer, int imenu )
{
if( pPlayer->pev->flags & FL_SPECTATOR )
return;
if( gpGlobals->time - m_flTime > 30 )
if( gpGlobals->time - m_flTime > 20 )
{
g_iVote = 0;
m_iConfirm = 0;
COOP_ResetVote();
return;
}
g_GlobalVote.m_flTime = gpGlobals->time;
//g_GlobalVote.m_flTime = gpGlobals->time;
switch( g_iVote )
{
case 1: // touch blue trigger
m_iVoteCount++;
if( imenu == 1 ) // confirm
if( imenu == 0 ) // confirm
{
if( m_iBanCount >= 2 )
{
UTIL_CoopKickPlayer( pPlayer );
m_iConfirm-= 5;
m_iBanCount = 0;
return;
}
m_iConfirm++;
UTIL_CoopPrintMessage( "%s^7 confirmed map change\n", UTIL_CoopPlayerName( pPlayer ));
}
if( imenu == 2 ) // cancel
if( imenu == 1 ) // cancel
{
m_iConfirm--;
if( pPlayer == m_pPlayer )
{
m_iConfirm -= 100; // player mistake
g_iVote = 0;
}
}
if( imenu == 3 )
if( imenu == 2 )
{
m_iBanCount++;
if( m_iBanCount >= 2 && m_iConfirm > -50 )
UTIL_CoopKickPlayer( m_pPlayer );
g_iVote = 0;
}
break;
}
@ -439,7 +443,7 @@ void GlobalVote::ShowGlobalMenu( const char *title, int count, const char **menu @@ -439,7 +443,7 @@ void GlobalVote::ShowGlobalMenu( const char *title, int count, const char **menu
for( int j = 0; j < count; j++ )
{
char cmd[32];
sprintf(cmd, "votemenu %d", i );
sprintf(cmd, "votemenu %d", j );
m.Add( menu[j], cmd );
}
m.Show();
@ -646,19 +650,16 @@ void COOP_ResetVote( void ) @@ -646,19 +650,16 @@ void COOP_ResetVote( void )
{
g_iVote = 0;
g_GlobalVote.m_iConfirm = 0;
g_GlobalVote.m_iBanCount = 0;
g_GlobalVote.m_flTime = gpGlobals->time;
}
bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2, char *mapname )
{
if( gpGlobals->time - g_GlobalVote.m_flTime > 30 )
{
g_iVote = 0;
g_GlobalVote.m_iConfirm = 0;
}
g_GlobalVote.m_flTime = gpGlobals->time;
if( gpGlobals->time - g_GlobalVote.m_flTime > 10 )
COOP_ResetVote();
//g_GlobalVote.m_flTime = gpGlobals->time;
if( g_iVote != 1 )
{
@ -666,7 +667,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 @@ -666,7 +667,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
{
CBasePlayer *pPlayer = (CBasePlayer*)pActivator;
if( pPlayer->gravgunmod_data.m_iLocalConfirm == 0 )
if( pPlayer->gravgunmod_data.m_iLocalConfirm <= 0 )
pPlayer->gravgunmod_data.m_iLocalConfirm = 1;
if( pPlayer->gravgunmod_data.m_iLocalConfirm < 3 )
{
@ -676,7 +677,10 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 @@ -676,7 +677,10 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
.Show();
}
else
{
g_GlobalVote.ConfirmMenu(pPlayer, pTrigger, mapname );
pPlayer->gravgunmod_data.m_iLocalConfirm = 0;
}
}
return false;
}
@ -687,7 +691,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2 @@ -687,7 +691,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
// do not allow go back if there are checkpoints, but not near changelevel
if( g_checkpoints[0].time && (g_checkpoints[0].origin - VecBModelOrigin(pTrigger->pev)).Length() > 150 )
{
g_GlobalVote.m_iConfirm = 0;
COOP_ResetVote();
UTIL_CoopPlayerMessage( pActivator, 1, 5, 0xFF0000FF, 0xFF0000FF, 0, 0.7, "Changelevel back locked by checkpoint\nCheckpoint here to activate trigger!");
return false;
}
@ -804,6 +808,8 @@ bool COOP_ClientCommand( edict_t *pEntity ) @@ -804,6 +808,8 @@ bool COOP_ClientCommand( edict_t *pEntity )
{
if( !mp_coop_checkpoints.value )
return false;
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED )
return false;
if( !UTIL_CoopIsBadPlayer( pPlayer ) )
COOP_NewCheckpoint( pPlayer->pev );
else
@ -821,7 +827,7 @@ bool COOP_ClientCommand( edict_t *pEntity ) @@ -821,7 +827,7 @@ bool COOP_ClientCommand( edict_t *pEntity )
{
int i = atoi( CMD_ARGV(1) );
g_GlobalVote.Process(pPlayer, i);
return false;
return true;
}
return false;

2
dlls/gravgunmod.cpp

@ -541,4 +541,6 @@ bool GGM_PlayerMenu::MenuSelect( int select ) @@ -541,4 +541,6 @@ bool GGM_PlayerMenu::MenuSelect( int select )
GGM::Cmd_TokenizeString( m_items[select-1].command );
ClientCommand( pPlayer->edict() );
GGM::Cmd_Reset();
return true;
}

2
dlls/subs.cpp

@ -456,7 +456,7 @@ void CBaseToggle::LinearMoveDone( void ) @@ -456,7 +456,7 @@ void CBaseToggle::LinearMoveDone( void )
float error = delta.Length();
if( error > 0.03125 )
{
LinearMove( m_vecFinalDest, 100 );
LinearMove( m_vecFinalDest, 1000 );
return;
}

4
dlls/triggers.cpp

@ -1592,7 +1592,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) @@ -1592,7 +1592,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
continue;
// count only players spawned more 30 seconds ago
if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.m_flSpawnTime ) > 30 ) )
if( plr && plr->IsPlayer() && (pTrain || (gpGlobals->time -((CBasePlayer*)plr)->gravgunmod_data.m_flSpawnTime ) > 30 ) && plr->pev->modelindex )
{
count2++;
@ -1654,7 +1654,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator ) @@ -1654,7 +1654,7 @@ void CChangeLevel::ChangeLevelNow( CBaseEntity *pActivator )
ALERT( at_console, "^3CHANGELEVEL:^7 %d %d\n", count2, count1 );
if( count1 > 1 && count1 < count2 / 3 )
if( !m_fIsBack && count1 > 1 && count1 < count2 / 3 )
return;
//if( count1 <= 1 && count2 == 2 )

Loading…
Cancel
Save