mirror of
https://github.com/YGGverse/hlsdk-portable.git
synced 2025-02-08 21:14:14 +00:00
Partially rewrite coop menus, may be broken now
This commit is contained in:
parent
c6b15908ce
commit
b1f6135c62
@ -659,11 +659,6 @@ void ClientCommand( edict_t *pEntity )
|
|||||||
if ( g_flWeaponCheat != 0.0 )
|
if ( g_flWeaponCheat != 0.0 )
|
||||||
DumpProps();
|
DumpProps();
|
||||||
}
|
}
|
||||||
else if( FStrEq(pcmd, "unblock") )
|
|
||||||
{
|
|
||||||
if ( mp_coop.value )
|
|
||||||
UTIL_CleanSpawnPoint( pev->origin, 150 );
|
|
||||||
}
|
|
||||||
else if( FStrEq(pcmd, "client") )
|
else if( FStrEq(pcmd, "client") )
|
||||||
{
|
{
|
||||||
char args[256] = {0};
|
char args[256] = {0};
|
||||||
@ -671,6 +666,8 @@ void ClientCommand( edict_t *pEntity )
|
|||||||
strcat(args,"\n");
|
strcat(args,"\n");
|
||||||
CLIENT_COMMAND( pEntity, args );
|
CLIENT_COMMAND( pEntity, args );
|
||||||
}
|
}
|
||||||
|
else if( COOP_ClientCommand( pEntity ) )
|
||||||
|
return;
|
||||||
else if( FStrEq(pcmd, "m1"))
|
else if( FStrEq(pcmd, "m1"))
|
||||||
{
|
{
|
||||||
#define MENU_STR(VAR) (#VAR)
|
#define MENU_STR(VAR) (#VAR)
|
||||||
@ -702,11 +699,11 @@ void ClientCommand( edict_t *pEntity )
|
|||||||
if( mp_coop.value )
|
if( mp_coop.value )
|
||||||
{
|
{
|
||||||
CBasePlayer *pl = GetClassPtr( (CBasePlayer *)pev );
|
CBasePlayer *pl = GetClassPtr( (CBasePlayer *)pev );
|
||||||
const char *menu[] = {
|
pl->gravgunmod_data.menu.New( "COOP SERVER" )
|
||||||
"Join coop",
|
.Add("Join coop", "joincoop")
|
||||||
"Join spectators"
|
.Add("Spectate", "spectate")
|
||||||
};
|
.Show();
|
||||||
UTIL_CoopShowMenu( pl, "COOP SERVER", ARRAYSIZE( menu ), menu );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if( !Ent_ProcessClientCommand( pEntity ) )
|
else if( !Ent_ProcessClientCommand( pEntity ) )
|
||||||
|
112
dlls/coop.cpp
112
dlls/coop.cpp
@ -861,6 +861,118 @@ bool UTIL_CoopConfirmMenu(CBaseEntity *pTrigger, CBaseEntity *pActivator, int co
|
|||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
void COOP_CheckpointMenu( CBasePlayer *pPlayer )
|
||||||
|
{
|
||||||
|
int i;
|
||||||
|
if( !mp_coop_checkpoints.value )
|
||||||
|
return;
|
||||||
|
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New("Select checkpoint");
|
||||||
|
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");
|
||||||
|
else
|
||||||
|
m.Add("New checkpoint", "newcheckpoint");
|
||||||
|
for( i = 1; g_checkpoints[i-1].time; i++ )
|
||||||
|
{
|
||||||
|
char cmd[32];
|
||||||
|
sprintf(cmd, "loadcheckpoint %d", i-1 );
|
||||||
|
m.Add(g_checkpoints[i-1].str, cmd);
|
||||||
|
}
|
||||||
|
m.Show();
|
||||||
|
}
|
||||||
|
|
||||||
|
bool COOP_ClientCommand( edict_t *pEntity )
|
||||||
|
{
|
||||||
|
const char *pcmd = CMD_ARGV(0);
|
||||||
|
CBasePlayer *pPlayer = (CBasePlayer*)GET_PRIVATE(pEntity);
|
||||||
|
entvars_t *pev = &pEntity->v;
|
||||||
|
if( !mp_coop.value )
|
||||||
|
return false;
|
||||||
|
|
||||||
|
else if( FStrEq(pcmd, "unblock") )
|
||||||
|
{
|
||||||
|
if( pPlayer->gravgunmod_data.m_state != STATE_SPAWNED )
|
||||||
|
return false;
|
||||||
|
UTIL_CleanSpawnPoint( pev->origin, 150 );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "joincoop" ) )
|
||||||
|
{
|
||||||
|
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED )
|
||||||
|
return false;
|
||||||
|
if( mp_coop_checkpoints.value && g_checkpoints[0].str[0] )
|
||||||
|
COOP_CheckpointMenu( pPlayer );
|
||||||
|
else
|
||||||
|
{
|
||||||
|
UTIL_SpawnPlayer( pPlayer );
|
||||||
|
pPlayer->RemoveAllItems( TRUE );
|
||||||
|
pPlayer->gravgunmod_data.m_state = STATE_SPAWNED;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "coopmenu" ) )
|
||||||
|
{
|
||||||
|
//UTIL_CoopMenu( pPlayer );
|
||||||
|
if( pPlayer->gravgunmod_data.m_state == STATE_SPAWNED )
|
||||||
|
{
|
||||||
|
GGM_PlayerMenu &m = pPlayer->gravgunmod_data.menu.New( "COOP MENU" )
|
||||||
|
.Add( "Force respawn", "respawn" )
|
||||||
|
.Add( "Unblock", "unblock" )
|
||||||
|
.Add( "Become spectator", "spectate" );
|
||||||
|
if( mp_coop_checkpoints.value )
|
||||||
|
m.Add( "Checkpoints", "checkpointmenu" );
|
||||||
|
m.Add( "Cancel", "" );
|
||||||
|
m.Show();
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR )
|
||||||
|
{
|
||||||
|
pPlayer->gravgunmod_data.menu.New( "COOP MENU" )
|
||||||
|
.Add( "Join game", "joincoop" )
|
||||||
|
.Add( "Cancel", "" )
|
||||||
|
.Show();
|
||||||
|
return true;
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "respawn" ) )
|
||||||
|
{
|
||||||
|
pPlayer->RemoveAllItems( TRUE );
|
||||||
|
UTIL_SpawnPlayer( pPlayer );
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "checkpointmenu") )
|
||||||
|
{
|
||||||
|
if( !mp_coop_checkpoints.value )
|
||||||
|
return false;
|
||||||
|
COOP_CheckpointMenu( pPlayer );
|
||||||
|
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "loadcheckpoint") )
|
||||||
|
{
|
||||||
|
int i = atoi(CMD_ARGV(1));
|
||||||
|
if( i > 4 )
|
||||||
|
return false;
|
||||||
|
pPlayer->RemoveAllItems( TRUE );
|
||||||
|
UTIL_SpawnPlayer( pPlayer );
|
||||||
|
pPlayer->pev->origin = g_checkpoints[i].origin;
|
||||||
|
pPlayer->pev->angles = g_checkpoints[i].angles;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
else if( FStrEq( pcmd, "newcheckpoint") )
|
||||||
|
{
|
||||||
|
if( !mp_coop_checkpoints.value )
|
||||||
|
return false;
|
||||||
|
if( !UTIL_CoopIsBadPlayer( pPlayer ) )
|
||||||
|
UTIL_CoopNewCheckpoint( pPlayer->pev );
|
||||||
|
else
|
||||||
|
return false;
|
||||||
|
return true;
|
||||||
|
}
|
||||||
|
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
|
||||||
void COOP_RegisterCVars()
|
void COOP_RegisterCVars()
|
||||||
{
|
{
|
||||||
CVAR_REGISTER( &mp_coop );
|
CVAR_REGISTER( &mp_coop );
|
||||||
|
@ -63,6 +63,7 @@ void UTIL_CoopHudMessage( int channel, float time, unsigned int color1, unsigned
|
|||||||
void UTIL_CoopPlayerMessage( CBaseEntity *pPlayer, int channel, float time, unsigned int color1, unsigned int color2, float x, float y, const char *format, ... );
|
void UTIL_CoopPlayerMessage( CBaseEntity *pPlayer, int channel, float time, unsigned int color1, unsigned int color2, float x, float y, const char *format, ... );
|
||||||
bool UTIL_CoopPlayerDeath( CBasePlayer *pPlayer );
|
bool UTIL_CoopPlayerDeath( CBasePlayer *pPlayer );
|
||||||
void COOP_RegisterCVars( void );
|
void COOP_RegisterCVars( void );
|
||||||
|
bool COOP_ClientCommand( edict_t *pEntity );
|
||||||
|
|
||||||
#ifdef PLAYER_H
|
#ifdef PLAYER_H
|
||||||
void UTIL_CoopKickPlayer(CBaseEntity *pPlayer);
|
void UTIL_CoopKickPlayer(CBaseEntity *pPlayer);
|
||||||
|
@ -127,25 +127,6 @@ BOOL CHalfLifeMultiplay::ClientCommand( CBasePlayer *pPlayer, const char *pcmd )
|
|||||||
if( g_VoiceGameMgr.ClientCommand( pPlayer, pcmd ) )
|
if( g_VoiceGameMgr.ClientCommand( pPlayer, pcmd ) )
|
||||||
return TRUE;
|
return TRUE;
|
||||||
#endif
|
#endif
|
||||||
if( mp_coop.value )
|
|
||||||
{
|
|
||||||
if( FStrEq( pcmd, "joincoop" ) )
|
|
||||||
{
|
|
||||||
if( pPlayer->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN )
|
|
||||||
UTIL_SpawnPlayer( pPlayer );
|
|
||||||
else
|
|
||||||
ClientPrint( pPlayer->pev, HUD_PRINTCONSOLE, "You cannot use joincoop now!\n\n" );
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
|
|
||||||
if( FStrEq( pcmd, "coopmenu" ) )
|
|
||||||
{
|
|
||||||
UTIL_CoopMenu( pPlayer );
|
|
||||||
|
|
||||||
return TRUE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if( FStrEq( pcmd, "menuselect" ) )
|
if( FStrEq( pcmd, "menuselect" ) )
|
||||||
{
|
{
|
||||||
@ -522,15 +503,13 @@ void CHalfLifeMultiplay::InitHUD( CBasePlayer *pl )
|
|||||||
|
|
||||||
if( pl->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN )
|
if( pl->gravgunmod_data.m_state == STATE_SPECTATOR_BEGIN )
|
||||||
{
|
{
|
||||||
pl->gravgunmod_data.m_iMenuState = MENUSTATE_COOPMENU_SPEC;
|
|
||||||
|
|
||||||
if( mp_coop.value && !pl->gravgunmod_data.m_fTouchMenu )
|
if( mp_coop.value && !pl->gravgunmod_data.m_fTouchMenu )
|
||||||
{
|
{
|
||||||
const char *menu[] = {
|
pl->gravgunmod_data.menu.New( "COOP SERVER" )
|
||||||
"Join coop",
|
.Add("Join coop", "joincoop")
|
||||||
"Join spectators"
|
.Add("Spectate", "spectate")
|
||||||
};
|
.Show();
|
||||||
UTIL_CoopShowMenu( pl, "COOP SERVER", ARRAYSIZE( menu ), menu );
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user