mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-08 21:14:14 +00:00
Fix menu message spamming, fix text messages
This commit is contained in:
parent
90ba38d577
commit
21b90a964e
@ -133,13 +133,13 @@ void UTIL_CoopPrintMessage( const char *format, ... )
|
||||
msglimittime2 = gpGlobals->time + 0.4;
|
||||
|
||||
va_list argptr;
|
||||
char string[256];
|
||||
char string[256] = "^2";
|
||||
|
||||
va_start( argptr, format );
|
||||
int len = vsnprintf( string, 256, format, argptr );
|
||||
int len = vsnprintf( string + 2, 253, format, argptr );
|
||||
va_end( argptr );
|
||||
string[len] = 0;
|
||||
UTIL_ClientPrintAll( HUD_PRINTCONSOLE, string );
|
||||
string[len+2] = 0;
|
||||
UTIL_ClientPrintAll( HUD_PRINTTALK, string );
|
||||
}
|
||||
|
||||
|
||||
@ -671,7 +671,7 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
|
||||
pPlayer->gravgunmod_data.m_iLocalConfirm = 1;
|
||||
if( pPlayer->gravgunmod_data.m_iLocalConfirm < 3 )
|
||||
{
|
||||
pPlayer->gravgunmod_data.menu.New("This will change map back. Are you sure?")
|
||||
pPlayer->gravgunmod_data.menu.New("This will change map back", false)
|
||||
.Add("Confirm", "confirmchangelevel")
|
||||
.Add("Cancel", "")
|
||||
.Show();
|
||||
@ -692,7 +692,8 @@ bool COOP_ConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int count2
|
||||
if( g_checkpoints[0].time && (g_checkpoints[0].origin - VecBModelOrigin(pTrigger->pev)).Length() > 150 )
|
||||
{
|
||||
COOP_ResetVote();
|
||||
UTIL_CoopPlayerMessage( pActivator, 1, 5, 0xFF0000FF, 0xFF0000FF, 0, 0.7, "Changelevel back locked by checkpoint\nCheckpoint here to activate trigger!");
|
||||
//UTIL_CoopPlayerMessage( pActivator, 1, 5, 0xFF0000FF, 0xFF0000FF, 0, 0.7, "Changelevel back locked by checkpoint\nCheckpoint here to activate trigger!");
|
||||
ClientPrint( pActivator->pev, HUD_PRINTCENTER, "Changelevel back locked by checkpoint\nCheckpoint here to activate trigger!");
|
||||
return false;
|
||||
}
|
||||
//if( count2 < 2 )
|
||||
@ -708,7 +709,7 @@ void COOP_CheckpointMenu( CBasePlayer *pPlayer )
|
||||
if( !mp_coop_checkpoints.value )
|
||||
return;
|
||||
|
||||
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint");
|
||||
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint", false);
|
||||
|
||||
if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR || pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN || pPlayer->pev->health <= 0 )
|
||||
m.Add("Map begin", "respawn");
|
||||
|
@ -448,6 +448,9 @@ void GGM_Say( edict_t *pEntity )
|
||||
|
||||
GGM_PlayerMenu &GGM_PlayerMenu::Add(const char *name, const char *command)
|
||||
{
|
||||
if( m_fShow )
|
||||
return *this;
|
||||
|
||||
if( m_iCount > 4 )
|
||||
{
|
||||
ALERT( at_error, "GGM_PlayerMenu::Add: Only 5 menu items supported" );
|
||||
@ -461,17 +464,25 @@ GGM_PlayerMenu &GGM_PlayerMenu::Add(const char *name, const char *command)
|
||||
}
|
||||
GGM_PlayerMenu &GGM_PlayerMenu::Clear()
|
||||
{
|
||||
m_fShow = false;
|
||||
m_iCount = 0;
|
||||
return *this;
|
||||
}
|
||||
|
||||
GGM_PlayerMenu &GGM_PlayerMenu::SetTitle(const char *title)
|
||||
{
|
||||
if( m_fShow )
|
||||
return *this;
|
||||
strncpy( m_sTitle, title, sizeof(m_sTitle) - 1);
|
||||
return *this;
|
||||
}
|
||||
GGM_PlayerMenu &GGM_PlayerMenu::New(const char *title)
|
||||
GGM_PlayerMenu &GGM_PlayerMenu::New(const char *title, bool force)
|
||||
{
|
||||
if( m_fShow && !force )
|
||||
return *this;
|
||||
|
||||
m_fShow = false;
|
||||
|
||||
SetTitle(title);
|
||||
return Clear();
|
||||
}
|
||||
@ -531,6 +542,7 @@ void GGM_PlayerMenu::Show()
|
||||
WRITE_STRING( buf );
|
||||
MESSAGE_END();
|
||||
}
|
||||
m_fShow = true;
|
||||
}
|
||||
|
||||
bool GGM_PlayerMenu::MenuSelect( int select )
|
||||
@ -538,6 +550,8 @@ bool GGM_PlayerMenu::MenuSelect( int select )
|
||||
if( select > m_iCount || select < 1 )
|
||||
return false;
|
||||
|
||||
m_fShow = false;
|
||||
|
||||
GGM::Cmd_TokenizeString( m_items[select-1].command );
|
||||
ClientCommand( pPlayer->edict() );
|
||||
GGM::Cmd_Reset();
|
||||
|
@ -57,12 +57,13 @@ class GGM_PlayerMenu
|
||||
} m_items[5];
|
||||
int m_iCount;
|
||||
char m_sTitle[32];
|
||||
bool m_fShow;
|
||||
|
||||
public:
|
||||
CBasePlayer *pPlayer;
|
||||
bool MenuSelect( int select );
|
||||
GGM_PlayerMenu &SetTitle( const char *title );
|
||||
GGM_PlayerMenu &New( const char *title );
|
||||
GGM_PlayerMenu &New( const char *title, bool force = true );
|
||||
GGM_PlayerMenu &Add( const char *name, const char *command );
|
||||
GGM_PlayerMenu &Clear();
|
||||
void Show();
|
||||
|
Loading…
x
Reference in New Issue
Block a user