From fb84e2e787b7e6d60df84607c166c57b4422b629 Mon Sep 17 00:00:00 2001 From: Daniel Simoes Date: Sat, 2 Feb 2002 21:57:58 +0000 Subject: [PATCH] Matchmode stuff --- reaction/cgame/cg_consolecmds.c | 8 +++++ reaction/game/g_cmds.c | 8 +++-- reaction/game/g_matchmode.c | 55 ++++++++++++++++++++++++++++++--- reaction/game/g_matchmode.h | 2 ++ 4 files changed, 67 insertions(+), 6 deletions(-) diff --git a/reaction/cgame/cg_consolecmds.c b/reaction/cgame/cg_consolecmds.c index 5ced92c7..82367df6 100644 --- a/reaction/cgame/cg_consolecmds.c +++ b/reaction/cgame/cg_consolecmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.24 2002/02/02 21:57:58 slicer +// Matchmode stuff +// // Revision 1.23 2002/01/11 20:20:57 jbravo // Adding TP to main branch // @@ -690,6 +693,7 @@ static consoleCommand_t commands[] = { { "vtell_target", CG_VoiceTellTarget_f }, { "vtell_attacker", CG_VoiceTellAttacker_f }, { "tcmd", CG_TargetCommand_f }, + #ifdef MISSIONPACK { "loadhud", CG_LoadHud_f }, { "nextTeamMember", CG_NextTeamMember_f }, @@ -813,4 +817,8 @@ void CG_InitConsoleCommands( void ) { // JBravo: adding choose and drop commands. trap_AddCommand ("choose"); trap_AddCommand ("drop"); +// Slicer: Matchmode + trap_AddCommand ("captain"); + trap_AddCommand ("ready"); + trap_AddCommand ("sub"); } diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index f0f858c2..9ad25317 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,8 +5,8 @@ //----------------------------------------------------------------------------- // // $Log$ -// Revision 1.44 2002/02/02 20:39:09 slicer -// Matchmode: Adding Captains +// Revision 1.45 2002/02/02 21:53:56 slicer +// Matchmode stuff // // Revision 1.43 2002/02/02 16:34:02 slicer // Matchmode.. @@ -2682,6 +2682,10 @@ void ClientCommand( int clientNum ) { //Slicer: matchmode else if (Q_stricmp (cmd, "captain") == 0) MM_Captain_f( ent ); + else if (Q_stricmp (cmd, "ready") == 0) + MM_Ready_f( ent ); + else if (Q_stricmp (cmd, "sub") == 0) + MM_Sub_f( ent ); // Begin Duffman else if (Q_stricmp (cmd, "reload") == 0) diff --git a/reaction/game/g_matchmode.c b/reaction/game/g_matchmode.c index 47f7cf7d..06f88d2c 100644 --- a/reaction/game/g_matchmode.c +++ b/reaction/game/g_matchmode.c @@ -28,6 +28,27 @@ void MM_RunFrame(void) { } } +void MM_Sub_f( gentity_t *ent) { + if(!g_matchmode.integer) + return; + if(ent->client->sess.savedTeam == TEAM_SPECTATOR || ent->client->sess.savedTeam == TEAM_FREE ) { + trap_SendServerCommand(ent-g_entities, "print \"You need to be on a team for that\n\""); + return; + } + Com_Printf("%d \n",ent->client->pers.sub); + if(ent->client->pers.sub == TEAM_FREE) { + ent->client->pers.sub = ent->client->sess.savedTeam; + trap_SendServerCommand( -1, va("print \"%s is now a Substitute for %s.\n\"", + ent->client->pers.netname, + ent->client->sess.savedTeam==TEAM_BLUE ? "Blue Team": "Red Team")); + } + else { + ent->client->pers.sub = TEAM_FREE; + trap_SendServerCommand( -1, va("print \"%s is no longer a Substitute for %s.\n\"", + ent->client->pers.netname, + ent->client->sess.savedTeam==TEAM_BLUE ? "Blue Team": "Red Team")); + } +} void MM_Captain_f( gentity_t *ent ) { if(!g_matchmode.integer) return; @@ -37,24 +58,50 @@ void MM_Captain_f( gentity_t *ent ) { } if(ent->client->pers.captain == TEAM_RED) { level.team1ready = qfalse; - trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain!\n\"", + trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain.\n\"", ent->client->pers.netname,"Red Team"));// Teams will have names in the future.. ent->client->pers.captain = TEAM_FREE; } else if(ent->client->pers.captain == TEAM_BLUE) { level.team2ready = qfalse; - trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain!\n\"", + trap_SendServerCommand( -1, va("print \"%s is no longer %s's Captain.\n\"", ent->client->pers.netname,"Blue Team"));// Teams will have names in the future.. ent->client->pers.captain = TEAM_FREE; } else { if(!checkCaptain(ent->client->sess.savedTeam)) { ent->client->pers.captain = ent->client->sess.savedTeam; - trap_SendServerCommand( -1, va("print \"%s is now %s's Captain!\n\"", + trap_SendServerCommand( -1, va("print \"%s is now %s's Captain.\n\"", ent->client->pers.netname, ent->client->sess.savedTeam==TEAM_BLUE ? "Blue Team": "Red Team")); } else - trap_SendServerCommand(ent-g_entities, va("print \"Your team already has a Captain\n\"")); + trap_SendServerCommand(ent-g_entities, "print \"Your team already has a Captain\n\""); } +} +void MM_Ready_f(gentity_t *ent) { + if(!g_matchmode.integer) + return; + + if(ent->client->pers.captain != TEAM_FREE) { + if(ent->client->sess.savedTeam == TEAM_RED) { + if(level.team1ready) + level.team1ready = qfalse; + else + level.team1ready = qtrue; + trap_SendServerCommand( -1, va("print \"%s is %s Ready.\n\"", + "Red Team",level.team1ready ? "": "no longer")); + } + else { + if(level.team2ready) + level.team2ready = qfalse; + else + level.team2ready = qtrue; + trap_SendServerCommand( -1, va("print \"%s is %s Ready.\n\"", + "Red Team", level.team2ready ? "": "no longer")); + } + } + else + trap_SendServerCommand(ent-g_entities, "print \"You need to be a captain for that\n\""); + } \ No newline at end of file diff --git a/reaction/game/g_matchmode.h b/reaction/game/g_matchmode.h index 6a3f8521..e1b08d9d 100644 --- a/reaction/game/g_matchmode.h +++ b/reaction/game/g_matchmode.h @@ -1,2 +1,4 @@ void MM_RunFrame( void ); void MM_Captain_f(gentity_t *ent ); +void MM_Sub_f( gentity_t *ent); +void MM_Ready_f(gentity_t *ent);