Added rq3_cmd

This commit is contained in:
Daniel Simoes 2002-05-06 21:41:01 +00:00
parent d981952de6
commit 7b8b6af86c
5 changed files with 165 additions and 129 deletions

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.32 2002/05/06 21:40:37 slicer
// Added rq3_cmd
//
// Revision 1.31 2002/05/02 00:02:19 jbravo
// Added a fix for the incorrect weapon at spawns
//
@ -1134,7 +1137,113 @@ char *CG_ConcatArgs (int start) {
line[len] = 0;
return line;
}
void CG_Stuffcmd(void) {
char *cmd;
cmd = CG_ConcatArgs (1);
trap_SendConsoleCommand (cmd);
}
void CG_SetTeamPlayers(void) {
int team, number;
char teamz[64];
team = atoi(CG_Argv(1));
number = atoi(CG_Argv(2));
Com_sprintf (teamz, sizeof(teamz), "%i", number);
if (team == TEAM_RED)
trap_Cvar_Set("cg_RQ3_teamCount1", teamz);
else if (team == TEAM_BLUE)
trap_Cvar_Set("cg_RQ3_teamCount2", teamz);
else if (team == TEAM_SPECTATOR || team == TEAM_FREE)
trap_Cvar_Set("cg_RQ3_numSpectators", teamz);
return;
}
void CG_Radio(void) {
int sound, gender;
sound = atoi(CG_Argv(2));
gender = atoi(CG_Argv(3));
//Slicer optimization
if(!gender) {
CG_AddBufferedSound(cgs.media.male_sounds[sound]);
} else {
CG_AddBufferedSound(cgs.media.female_sounds[sound]);
}
return;
}
/*
=================
CG_RQ3_Cmd by sLiCeR
This function will parse and handle several cmds in one ( rq3_cmd)
=================
*/
void CG_RQ3_Cmd () {
int cmd;
cmd = atoi(CG_Argv(1));
switch(cmd) {
case LIGHTS:
trap_Cvar_Set("cg_RQ3_lca", "1");
cg.showScores = qfalse;
cg.scoreTPMode = 0;
CG_CenterPrint( "LIGHTS...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nLIGHTS...\n");
// trap_S_StartLocalSound(cgs.media.lightsSound, CHAN_ANNOUNCER);
CG_AddBufferedSound(cgs.media.lightsSound);
break;
case CAMERA:
CG_CenterPrint( "CAMERA...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nCAMERA...\n");
CG_AddBufferedSound(cgs.media.cameraSound);
break;
case ACTION:
CG_CenterPrint( "ACTION!", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nACTION!\n");
trap_Cvar_Set("cg_RQ3_lca", "0");
CG_AddBufferedSound(cgs.media.actionSound);
break;
case SETTEAMPLAYERS:
CG_SetTeamPlayers();
break;
case SELECTPISTOL:
CG_Printf("Selecting pistol\n");
if (cg.snap) {
switch (cg.snap->ps.weapon) {
case WP_PISTOL:
case WP_KNIFE:
case WP_AKIMBO:
break;
//case WP_GRENADE:
default:
cg.weaponSelectTime = cg.time;
cg.weaponSelect = WP_PISTOL;
//Slicer: Done Server Side
//CG_RQ3_Zoom1x();
break;
}
}
break;
case ROUND:
trap_Cvar_Set("cg_RQ3_team_round_going", CG_Argv(1));
break;
case MAPEND:
cg.showScores = qtrue;
cg.scoreTPMode = 0;
break;
case SETWEAPON:
cg.weaponSelect = atoi(CG_Argv(1));
break;
case STUFF:
CG_Stuffcmd();
break;
case RADIO:
CG_Radio();
break;
default:
break;
}
}
/*
=================
CG_ServerCommand
@ -1318,110 +1427,10 @@ static void CG_ServerCommand( void ) {
return;
}
if ( !strcmp( cmd, "selectpistol") ) {
//CG_Printf("Selecting pistol\n");
//trap_SendConsoleCommand(va("cmd weapon %i\n", WP_PISTOL));
//Elder: condensed version of Cmd_Weapon
if (cg.snap) {
switch (cg.snap->ps.weapon) {
case WP_PISTOL:
case WP_KNIFE:
case WP_AKIMBO:
break;
//case WP_GRENADE:
default:
cg.weaponSelectTime = cg.time;
cg.weaponSelect = WP_PISTOL;
//Slicer: Done Server Side
//CG_RQ3_Zoom1x();
break;
}
}
return;
}
// NiceAss: LCA
if ( !strcmp( cmd, "lights") ) {
trap_Cvar_Set("cg_RQ3_lca", "1");
cg.showScores = qfalse;
cg.scoreTPMode = 0;
CG_CenterPrint( "LIGHTS...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nLIGHTS...\n");
// trap_S_StartLocalSound(cgs.media.lightsSound, CHAN_ANNOUNCER);
CG_AddBufferedSound(cgs.media.lightsSound);
return;
}
if ( !strcmp( cmd, "camera") ) {
CG_CenterPrint( "CAMERA...", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nCAMERA...\n");
CG_AddBufferedSound(cgs.media.cameraSound);
return;
}
if ( !strcmp( cmd, "action") ) {
CG_CenterPrint( "ACTION!", SCREEN_HEIGHT * 0.30, BIGCHAR_WIDTH );
CG_Printf("\nACTION!\n");
trap_Cvar_Set("cg_RQ3_lca", "0");
CG_AddBufferedSound(cgs.media.actionSound);
return;
}
// JBravo: client commands to use instead of CLIENTINFO cvars.
if (!strcmp(cmd, "roundbegin")) {
trap_Cvar_Set("cg_RQ3_team_round_going", "1");
return;
}
if (!strcmp(cmd, "roundend")) {
trap_Cvar_Set("cg_RQ3_team_round_going", "0");
return;
}
if (!strcmp(cmd, "mapend")) {
cg.showScores = qtrue;
cg.scoreTPMode = 0;
return;
}
if (!strcmp(cmd, "stuff")) {
char *cmd;
cmd = CG_ConcatArgs (1);
trap_SendConsoleCommand (cmd);
return;
}
if (!strcmp(cmd, "setclientweapon")) {
cg.weaponSelect = atoi(CG_Argv(1));
return;
}
// JBravo: Number of players hack.
if (!strcmp(cmd, "setteamplayers")) {
int team, number;
char teamz[64];
team = atoi(CG_Argv(1));
number = atoi(CG_Argv(2));
Com_sprintf (teamz, sizeof(teamz), "%i", number);
if (team == TEAM_RED)
trap_Cvar_Set("cg_RQ3_teamCount1", teamz);
else if (team == TEAM_BLUE)
trap_Cvar_Set("cg_RQ3_teamCount2", teamz);
else if (team == TEAM_SPECTATOR || team == TEAM_FREE)
trap_Cvar_Set("cg_RQ3_numSpectators", teamz);
return;
}
// JBravo: radio. This implementation rules. Used to suck :)
if (!strcmp(cmd, "playradiosound")) {
int sound, gender;
sound = atoi(CG_Argv(1));
gender = atoi(CG_Argv(2));
//Slicer optimization
if(!gender) {
CG_AddBufferedSound(cgs.media.male_sounds[sound]);
} else {
CG_AddBufferedSound(cgs.media.female_sounds[sound]);
}
return;
}
if(!strcmp(cmd,"rq3_cmd")) {
CG_RQ3_Cmd();
return;
}
CG_Printf( "Unknown client game command: %s\n", cmd );
}

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.61 2002/05/06 21:41:01 slicer
// Added rq3_cmd
//
// Revision 1.60 2002/05/02 12:44:58 makro
// Customizable color for the loading screen text. Bot stuff
//
@ -244,6 +247,18 @@
#define RQ3_KEVLAR_NAME "Kevlar Vest"
#define RQ3_LASER_NAME "Lasersight"
enum {
LIGHTS,
CAMERA,
ACTION,
SETTEAMPLAYERS,
SELECTPISTOL,
ROUND,
MAPEND,
SETWEAPON,
STUFF,
RADIO
};
//Elder: sound events for EV_RQ3_SOUND
typedef enum {
RQ3_SOUND_KICK,

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.72 2002/05/06 21:41:01 slicer
// Added rq3_cmd
//
// Revision 1.71 2002/04/13 15:37:53 jbravo
// limchasecam has been redone with new spec system
//
@ -1145,7 +1148,7 @@ int ThrowWeapon( gentity_t *ent, qboolean forceThrow )
if (client->ps.weapon == weap)
{
client->ps.stats[STAT_RQ3] |= RQ3_THROWWEAPON;
trap_SendServerCommand( ent-g_entities, va("selectpistol"));
trap_SendServerCommand( ent-g_entities, va("rq3_cmd %i",SELECTPISTOL));
}
client->weaponCount[weap]--;

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.54 2002/05/06 21:41:01 slicer
// Added rq3_cmd
//
// Revision 1.53 2002/05/05 15:51:16 slicer
// Captain and subs get saved on map_restarts ( moved to "sess" )
//
@ -1376,7 +1379,7 @@ void BeginIntermission( void ) {
MoveClientToIntermission( client );
// JBravo: send the TP scoreboard to players
if (g_gametype.integer == GT_TEAMPLAY)
trap_SendServerCommand (i, "mapend");
trap_SendServerCommand (i, va("rq3_cmd %i",MAPEND));
}
// send the current scoring to all clients

View file

@ -5,6 +5,9 @@
//-----------------------------------------------------------------------------
//
// $Log$
// Revision 1.82 2002/05/06 21:41:01 slicer
// Added rq3_cmd
//
// Revision 1.81 2002/05/06 00:35:49 jbravo
// Small fixes to misc stuff
//
@ -294,7 +297,8 @@ void CheckTeamRules()
level.lights_delay--;
if (level.lights_delay == 1) {
level.lights_delay = 0;
trap_SendServerCommand(-1, "lights");
//trap_SendServerCommand(-1, "lights");
trap_SendServerCommand(-1, va("rq3_cmd %i" ,LIGHTS));
}
}
@ -316,7 +320,9 @@ void CheckTeamRules()
if (level.lights_delay == 1) {
level.lights_delay = 0;
trap_SendServerCommand(-1, "lights");
//Slicer
//trap_SendServerCommand(-1, "lights");
trap_SendServerCommand(-1, va("rq3_cmd %i" ,LIGHTS));
}
if (level.team_round_countdown == 1) {
@ -364,7 +370,7 @@ void CheckTeamRules()
if (level.matchTime >= g_timelimit.integer * 60) {
level.inGame = level.team_round_going = level.team_round_countdown =
level.team_game_going = level.matchTime = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
trap_Cvar_Set("g_RQ3_team1ready", "0");
trap_Cvar_Set("g_RQ3_team2ready", "0");
MakeAllLivePlayersObservers ();
@ -378,7 +384,7 @@ void CheckTeamRules()
trap_SendServerCommand( -1, "print \"Timelimit hit.\n\"" );
//trap_SendServerCommand( -1, va("cp \"Timelimit hit.\n\""));
level.team_round_going = level.team_round_countdown = level.team_game_going = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
//Slicer: Start Intermission
BeginIntermission();
return;
@ -402,7 +408,7 @@ void CheckTeamRules()
if (WonGame(winner))
return;
level.team_round_going = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
level.lights_camera_action = 0;
level.holding_on_tie_check = 0;
level.team_round_countdown = (71*level.fps)/10;
@ -415,7 +421,7 @@ void CheckTeamRules()
if (WonGame(winner))
return;
level.team_round_going = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
level.lights_camera_action = 0;
level.holding_on_tie_check = 0;
level.team_round_countdown = (71*level.fps)/10;
@ -438,14 +444,14 @@ void ContinueLCA()
{
if (level.lights_camera_action == (21*level.fps)/10) {
G_LogPrintf ("CAMERA...\n");
trap_SendServerCommand( -1, "camera");
trap_SendServerCommand(-1, va("rq3_cmd %i" ,CAMERA));
}
else if (level.lights_camera_action == 1) {
G_LogPrintf ("ACTION!\n");
trap_SendServerCommand( -1, "action");
trap_SendServerCommand(-1, va("rq3_cmd %i" ,ACTION));
trap_Cvar_Set("g_RQ3_lca", "0");
level.team_round_going = 1;
trap_SendServerCommand( -1, "roundbegin");
trap_SendServerCommand(-1, va("rq3_cmd %i 1" ,ROUND));
level.current_round_length = 0;
}
level.lights_camera_action--;
@ -624,7 +630,7 @@ int WonGame(int winner)
if (level.matchTime >= g_timelimit.integer * 60) {
level.inGame = level.team_round_going = level.team_round_countdown =
level.team_game_going = level.matchTime = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
trap_Cvar_Set("g_RQ3_team1ready", "0");
trap_Cvar_Set("g_RQ3_team2ready", "0");
MakeAllLivePlayersObservers ();
@ -636,7 +642,7 @@ int WonGame(int winner)
if (level.time - level.startTime >= g_timelimit.integer*60000) {
trap_SendServerCommand( -1, "print \"Timelimit hit.\n\"" );
level.team_round_going = level.team_round_countdown = level.team_game_going = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
//Slicer: Start Intermission
BeginIntermission();
return 1;
@ -650,7 +656,7 @@ int WonGame(int winner)
if (g_RQ3_matchmode.integer) {
level.inGame = level.team_round_going = level.team_round_countdown =
level.team_game_going = level.matchTime = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
trap_Cvar_Set("g_RQ3_team1ready", "0");
trap_Cvar_Set("g_RQ3_team2ready", "0");
MakeAllLivePlayersObservers ();
@ -661,7 +667,7 @@ int WonGame(int winner)
trap_SendServerCommand( -1, "print \"Roundlimit hit.\n\"" );
trap_SendServerCommand( -1, va("cp \"Roundlimit hit.\n\""));
level.team_round_going = level.team_round_countdown = level.team_game_going = 0;
trap_SendServerCommand( -1, "roundend");
trap_SendServerCommand( -1, va("rq3_cmd %i 0",ROUND));
//Slicer: Start Intermission
BeginIntermission();
return 1;
@ -674,7 +680,7 @@ int WonGame(int winner)
team_t RQ3TeamCount( int ignoreClientNum, int team )
{
int i, count = 0;
char buf[64];
// char buf[64];
for (i=0; i<level.maxclients; i++) {
if (i == ignoreClientNum) {
@ -699,8 +705,8 @@ team_t RQ3TeamCount( int ignoreClientNum, int team )
else if (team == TEAM_SPECTATOR || team == TEAM_FREE)
trap_Cvar_Set("g_RQ3_numSpectators", buf); */
Com_sprintf (buf, sizeof(buf), "setteamplayers %i %i\n", team, count);
trap_SendServerCommand(-1, buf);
//Com_sprintf (buf, sizeof(buf), "setteamplayers %i %i\n", team, count);
//trap_SendServerCommand(-1, buf);
return count;
}
@ -749,7 +755,7 @@ void SpawnPlayers()
// JBravo: lets not respawn spectators in free floating mode
if (player->client->sess.savedTeam == TEAM_SPECTATOR &&
player->client->specMode == SPECTATOR_FREE) {
trap_SendServerCommand(player-g_entities, "lights");
trap_SendServerCommand(player-g_entities, va("rq3_cmd %i" ,LIGHTS));
continue;
}
@ -972,7 +978,7 @@ void EquipPlayer (gentity_t *ent)
ANIM_TOGGLEBIT) | WP_ANIM_ACTIVATE;
}
if (!(ent->r.svFlags & SVF_BOT)) {
trap_SendServerCommand(ent-g_entities, va("setclientweapon %i\n", ent->client->ps.weapon));
trap_SendServerCommand(ent-g_entities, va("rq3_cmd %i %i",SETWEAPON,ent->client->ps.weapon));
}
ent->client->ps.weaponstate = WEAPON_RAISING;
@ -1070,11 +1076,11 @@ void RQ3_Cmd_Radio_power_f(gentity_t *ent)
if (ent->client->radioOff == qfalse) {
ent->client->radioOff = qtrue;
trap_SendServerCommand(ent-g_entities, "cp \"Radio switched off\n\"");
trap_SendServerCommand(ent-g_entities, "playradiosound 25 0\n\"");
trap_SendServerCommand(ent-g_entities, va("rq3_cmd %i 25 0",RADIO));
} else {
ent->client->radioOff = qfalse;
trap_SendServerCommand(ent-g_entities, "cp \"Radio switched on\n\"");
trap_SendServerCommand(ent-g_entities, "playradiosound 25 0\n\"");
trap_SendServerCommand(ent-g_entities, va("rq3_cmd %i 25 0",RADIO));
}
}
@ -1199,7 +1205,7 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
if (!player->inuse)
continue;
if (player->client->sess.savedTeam == ent->client->sess.savedTeam)
trap_SendServerCommand(player-g_entities, va("playradiosound %i %i\n\"",
trap_SendServerCommand(player-g_entities, va("rq3_cmd %i %i %i\n",RADIO,
kills-1, ent->client->radioGender));
}
}
@ -1213,7 +1219,7 @@ void RQ3_Cmd_Radio_f(gentity_t *ent)
trap_SendServerCommand(player-g_entities, va("print \"radio %s %s\n\"",
ent->client->pers.netname, radio_msgs[x].msg));
else
trap_SendServerCommand(player-g_entities, va("playradiosound %i %i\n\"", x,
trap_SendServerCommand(player-g_entities, va("rq3_cmd %i %i %i\n",RADIO, x,
ent->client->radioGender));
}
}
@ -1810,5 +1816,5 @@ void RQ3_Cmd_Stuff (void)
client = atoi (user);
cmd = ConcatArgs(2);
trap_SendServerCommand(client, va("stuff %s\n", cmd));
trap_SendServerCommand(client, va("rq3_cmd %i %s\n",STUFF, cmd));
}