From 056848886dd4141fec772fe8f98d82ac617b3130 Mon Sep 17 00:00:00 2001 From: Richard Allen Date: Thu, 14 Mar 2002 02:24:39 +0000 Subject: [PATCH] Adding radio :) --- reaction/cgame/cg_consolecmds.c | 7 ++ reaction/cgame/cg_local.h | 56 +++++++++++++ reaction/cgame/cg_main.c | 68 +++++++++++++-- reaction/cgame/cg_servercmds.c | 144 ++++++++++++++++++++++++++++++++ reaction/game/bg_public.h | 13 +++ reaction/game/g_client.c | 10 +++ reaction/game/g_cmds.c | 13 ++- reaction/game/g_local.h | 6 +- reaction/game/g_teamplay.c | 142 +++++++++++++++++++++++++++++++ reaction/game/g_teamplay.h | 6 ++ 10 files changed, 456 insertions(+), 9 deletions(-) diff --git a/reaction/cgame/cg_consolecmds.c b/reaction/cgame/cg_consolecmds.c index 4c80bd77..9cf8b8cf 100644 --- a/reaction/cgame/cg_consolecmds.c +++ b/reaction/cgame/cg_consolecmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.32 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.31 2002/03/13 18:41:18 slicer // Adjusted some of elder's unzoom code for the new sniper system ( server side ) // @@ -889,6 +892,10 @@ void CG_InitConsoleCommands( void ) { #ifdef __ZCAM__ trap_AddCommand ("camera"); #endif +// JBravo: for radio + trap_AddCommand ("radio"); + trap_AddCommand ("radiogender"); + trap_AddCommand ("radio_power"); // Slicer: Matchmode trap_AddCommand ("captain"); trap_AddCommand ("ready"); diff --git a/reaction/cgame/cg_local.h b/reaction/cgame/cg_local.h index d63d3e6d..713e35e9 100644 --- a/reaction/cgame/cg_local.h +++ b/reaction/cgame/cg_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.51 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.50 2002/03/11 02:25:38 niceass // client gravity fix/tag shell ejection // @@ -1233,6 +1236,59 @@ typedef struct { sfxHandle_t cameraSound; sfxHandle_t actionSound; sfxHandle_t lca10_0Sound; +// JBravo: Radio sounds + sfxHandle_t male_1sound; + sfxHandle_t male_2sound; + sfxHandle_t male_3sound; + sfxHandle_t male_4sound; + sfxHandle_t male_5sound; + sfxHandle_t male_6sound; + sfxHandle_t male_7sound; + sfxHandle_t male_8sound; + sfxHandle_t male_9sound; + sfxHandle_t male_10sound; + sfxHandle_t male_backsound; + sfxHandle_t male_coversound; + sfxHandle_t male_downsound; + sfxHandle_t male_enemydsound; + sfxHandle_t male_enemyssound; + sfxHandle_t male_forwardsound; + sfxHandle_t male_gosound; + sfxHandle_t male_im_hitsound; + sfxHandle_t male_leftsound; + sfxHandle_t male_reportinsound; + sfxHandle_t male_rightsound; + sfxHandle_t male_taking_fsound; + sfxHandle_t male_teamdownsound; + sfxHandle_t male_treportsound; + sfxHandle_t male_upsound; + sfxHandle_t male_click; + sfxHandle_t female_1sound; + sfxHandle_t female_2sound; + sfxHandle_t female_3sound; + sfxHandle_t female_4sound; + sfxHandle_t female_5sound; + sfxHandle_t female_6sound; + sfxHandle_t female_7sound; + sfxHandle_t female_8sound; + sfxHandle_t female_9sound; + sfxHandle_t female_10sound; + sfxHandle_t female_backsound; + sfxHandle_t female_coversound; + sfxHandle_t female_downsound; + sfxHandle_t female_enemydsound; + sfxHandle_t female_enemyssound; + sfxHandle_t female_forwardsound; + sfxHandle_t female_gosound; + sfxHandle_t female_im_hitsound; + sfxHandle_t female_leftsound; + sfxHandle_t female_reportinsound; + sfxHandle_t female_rightsound; + sfxHandle_t female_taking_fsound; + sfxHandle_t female_teamdownsound; + sfxHandle_t female_treportsound; + sfxHandle_t female_upsound; + sfxHandle_t female_click; } cgMedia_t; diff --git a/reaction/cgame/cg_main.c b/reaction/cgame/cg_main.c index 1a714e5f..4d99214d 100644 --- a/reaction/cgame/cg_main.c +++ b/reaction/cgame/cg_main.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.43 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.42 2002/03/11 02:23:52 niceass // client gravity fix // @@ -660,14 +663,65 @@ static void CG_RegisterSounds( void ) { #ifdef MISSIONPACK cgs.media.countPrepareTeamSound = trap_S_RegisterSound( "sound/feedback/prepare_team.wav", qtrue ); #endif + if (cgs.gametype >= GT_TEAM || cg_buildScript.integer) { // JBravo: registering the LCA sounds. - cgs.media.lightsSound = trap_S_RegisterSound( "sound/lca/lights.wav", qtrue ); - cgs.media.cameraSound = trap_S_RegisterSound( "sound/lca/camera.wav", qtrue ); - cgs.media.actionSound = trap_S_RegisterSound( "sound/lca/action.wav", qtrue ); - cgs.media.lca10_0Sound = trap_S_RegisterSound( "sound/lca/10_0.wav", qtrue ); - - - if ( cgs.gametype >= GT_TEAM || cg_buildScript.integer ) { + cgs.media.lightsSound = trap_S_RegisterSound( "sound/lca/lights.wav", qtrue ); + cgs.media.cameraSound = trap_S_RegisterSound( "sound/lca/camera.wav", qtrue ); + cgs.media.actionSound = trap_S_RegisterSound( "sound/lca/action.wav", qtrue ); + cgs.media.lca10_0Sound = trap_S_RegisterSound( "sound/lca/10_0.wav", qtrue ); +// JBravo: and the radio sounds + cgs.media.male_1sound = trap_S_RegisterSound( "sound/radio/male/1.wav", qtrue ); + cgs.media.male_2sound = trap_S_RegisterSound( "sound/radio/male/2.wav", qtrue ); + cgs.media.male_3sound = trap_S_RegisterSound( "sound/radio/male/3.wav", qtrue ); + cgs.media.male_4sound = trap_S_RegisterSound( "sound/radio/male/4.wav", qtrue ); + cgs.media.male_5sound = trap_S_RegisterSound( "sound/radio/male/5.wav", qtrue ); + cgs.media.male_6sound = trap_S_RegisterSound( "sound/radio/male/6.wav", qtrue ); + cgs.media.male_7sound = trap_S_RegisterSound( "sound/radio/male/7.wav", qtrue ); + cgs.media.male_8sound = trap_S_RegisterSound( "sound/radio/male/8.wav", qtrue ); + cgs.media.male_9sound = trap_S_RegisterSound( "sound/radio/male/9.wav", qtrue ); + cgs.media.male_10sound = trap_S_RegisterSound( "sound/radio/male/10.wav", qtrue ); + cgs.media.male_backsound = trap_S_RegisterSound( "sound/radio/male/back.wav", qtrue ); + cgs.media.male_coversound = trap_S_RegisterSound( "sound/radio/male/cover.wav", qtrue ); + cgs.media.male_downsound = trap_S_RegisterSound( "sound/radio/male/down.wav", qtrue ); + cgs.media.male_enemydsound = trap_S_RegisterSound( "sound/radio/male/enemyd.wav", qtrue ); + cgs.media.male_enemyssound = trap_S_RegisterSound( "sound/radio/male/enemys.wav", qtrue ); + cgs.media.male_forwardsound = trap_S_RegisterSound( "sound/radio/male/forward.wav", qtrue ); + cgs.media.male_gosound = trap_S_RegisterSound( "sound/radio/male/go.wav", qtrue ); + cgs.media.male_im_hitsound = trap_S_RegisterSound( "sound/radio/male/im_hit.wav", qtrue ); + cgs.media.male_leftsound = trap_S_RegisterSound( "sound/radio/male/left.wav", qtrue ); + cgs.media.male_reportinsound = trap_S_RegisterSound( "sound/radio/male/reportin.wav", qtrue ); + cgs.media.male_rightsound = trap_S_RegisterSound( "sound/radio/male/right.wav", qtrue ); + cgs.media.male_taking_fsound = trap_S_RegisterSound( "sound/radio/male/taking_f.wav", qtrue ); + cgs.media.male_teamdownsound = trap_S_RegisterSound( "sound/radio/male/teamdown.wav", qtrue ); + cgs.media.male_treportsound = trap_S_RegisterSound( "sound/radio/male/treport.wav", qtrue ); + cgs.media.male_upsound = trap_S_RegisterSound( "sound/radio/male/up.wav", qtrue ); + cgs.media.male_click = trap_S_RegisterSound( "sound/radio/click.wav", qtrue ); + cgs.media.female_1sound = trap_S_RegisterSound( "sound/radio/female/1.wav", qtrue ); + cgs.media.female_2sound = trap_S_RegisterSound( "sound/radio/female/2.wav", qtrue ); + cgs.media.female_3sound = trap_S_RegisterSound( "sound/radio/female/3.wav", qtrue ); + cgs.media.female_4sound = trap_S_RegisterSound( "sound/radio/female/4.wav", qtrue ); + cgs.media.female_5sound = trap_S_RegisterSound( "sound/radio/female/5.wav", qtrue ); + cgs.media.female_6sound = trap_S_RegisterSound( "sound/radio/female/6.wav", qtrue ); + cgs.media.female_7sound = trap_S_RegisterSound( "sound/radio/female/7.wav", qtrue ); + cgs.media.female_8sound = trap_S_RegisterSound( "sound/radio/female/8.wav", qtrue ); + cgs.media.female_9sound = trap_S_RegisterSound( "sound/radio/female/9.wav", qtrue ); + cgs.media.female_10sound = trap_S_RegisterSound( "sound/radio/female/10.wav", qtrue ); + cgs.media.female_backsound = trap_S_RegisterSound( "sound/radio/female/back.wav", qtrue ); + cgs.media.female_coversound = trap_S_RegisterSound( "sound/radio/female/cover.wav", qtrue ); + cgs.media.female_downsound = trap_S_RegisterSound( "sound/radio/female/down.wav", qtrue ); + cgs.media.female_enemydsound = trap_S_RegisterSound( "sound/radio/female/enemyd.wav", qtrue ); + cgs.media.female_enemyssound = trap_S_RegisterSound( "sound/radio/female/enemys.wav", qtrue ); + cgs.media.female_forwardsound = trap_S_RegisterSound( "sound/radio/female/forward.wav", qtrue ); + cgs.media.female_gosound = trap_S_RegisterSound( "sound/radio/female/go.wav", qtrue ); + cgs.media.female_im_hitsound = trap_S_RegisterSound( "sound/radio/female/im_hit.wav", qtrue ); + cgs.media.female_leftsound = trap_S_RegisterSound( "sound/radio/female/left.wav", qtrue ); + cgs.media.female_reportinsound = trap_S_RegisterSound( "sound/radio/female/reportin.wav", qtrue ); + cgs.media.female_rightsound = trap_S_RegisterSound( "sound/radio/female/right.wav", qtrue ); + cgs.media.female_taking_fsound = trap_S_RegisterSound( "sound/radio/female/taking_f.wav", qtrue ); + cgs.media.female_teamdownsound = trap_S_RegisterSound( "sound/radio/female/teamdown.wav", qtrue ); + cgs.media.female_treportsound = trap_S_RegisterSound( "sound/radio/female/treport.wav", qtrue ); + cgs.media.female_upsound = trap_S_RegisterSound( "sound/radio/female/up.wav", qtrue ); + cgs.media.female_click = trap_S_RegisterSound( "sound/radio/click.wav", qtrue ); cgs.media.captureAwardSound = trap_S_RegisterSound( "sound/teamplay/flagcapture_yourteam.wav", qtrue ); cgs.media.redLeadsSound = trap_S_RegisterSound( "sound/feedback/redleads.wav", qtrue ); diff --git a/reaction/cgame/cg_servercmds.c b/reaction/cgame/cg_servercmds.c index 78390087..c7222062 100644 --- a/reaction/cgame/cg_servercmds.c +++ b/reaction/cgame/cg_servercmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.21 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.20 2002/03/13 18:41:18 slicer // Adjusted some of elder's unzoom code for the new sniper system ( server side ) // @@ -1257,6 +1260,147 @@ static void CG_ServerCommand( void ) { CG_AddBufferedSound(cgs.media.actionSound); return; } +// JBravo: radio. This implementation sucks. + if (!strcmp(cmd, "playradiosound")) { + int sound, gender; + + sound = atoi(CG_Argv(1)); + gender = atoi(CG_Argv(2)); + + if (sound == 0) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_1sound); + else + CG_AddBufferedSound(cgs.media.female_1sound); + } else if (sound == 1) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_2sound); + else + CG_AddBufferedSound(cgs.media.female_2sound); + } else if (sound == 2) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_3sound); + else + CG_AddBufferedSound(cgs.media.female_3sound); + } else if (sound == 3) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_4sound); + else + CG_AddBufferedSound(cgs.media.female_4sound); + } else if (sound == 4) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_5sound); + else + CG_AddBufferedSound(cgs.media.female_5sound); + } else if (sound == 5) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_6sound); + else + CG_AddBufferedSound(cgs.media.female_6sound); + } else if (sound == 6) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_7sound); + else + CG_AddBufferedSound(cgs.media.female_7sound); + } else if (sound == 7) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_8sound); + else + CG_AddBufferedSound(cgs.media.female_8sound); + } else if (sound == 8) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_9sound); + else + CG_AddBufferedSound(cgs.media.female_9sound); + } else if (sound == 9) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_10sound); + else + CG_AddBufferedSound(cgs.media.female_10sound); + } else if (sound == 10) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_backsound); + else + CG_AddBufferedSound(cgs.media.female_backsound); + } else if (sound == 11) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_coversound); + else + CG_AddBufferedSound(cgs.media.female_coversound); + } else if (sound == 12) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_downsound); + else + CG_AddBufferedSound(cgs.media.female_downsound); + } else if (sound == 13) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_enemydsound); + else + CG_AddBufferedSound(cgs.media.female_enemydsound); + } else if (sound == 14) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_enemyssound); + else + CG_AddBufferedSound(cgs.media.female_enemyssound); + } else if (sound == 15) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_forwardsound); + else + CG_AddBufferedSound(cgs.media.female_forwardsound); + } else if (sound == 16) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_gosound); + else + CG_AddBufferedSound(cgs.media.female_gosound); + } else if (sound == 17) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_im_hitsound); + else + CG_AddBufferedSound(cgs.media.female_im_hitsound); + } else if (sound == 18) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_leftsound); + else + CG_AddBufferedSound(cgs.media.female_leftsound); + } else if (sound == 19) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_reportinsound); + else + CG_AddBufferedSound(cgs.media.female_reportinsound); + } else if (sound == 20) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_rightsound); + else + CG_AddBufferedSound(cgs.media.female_rightsound); + } else if (sound == 21) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_taking_fsound); + else + CG_AddBufferedSound(cgs.media.female_taking_fsound); + } else if (sound == 22) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_teamdownsound); + else + CG_AddBufferedSound(cgs.media.female_teamdownsound); + } else if (sound == 23) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_treportsound); + else + CG_AddBufferedSound(cgs.media.female_treportsound); + } else if (sound == 24) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_upsound); + else + CG_AddBufferedSound(cgs.media.female_upsound); + } else if (sound == 25) { + if (!gender) + CG_AddBufferedSound(cgs.media.male_click); + else + CG_AddBufferedSound(cgs.media.female_click); + } + + return; + } CG_Printf( "Unknown client game command: %s\n", cmd ); } diff --git a/reaction/game/bg_public.h b/reaction/game/bg_public.h index 7da8cdbf..72977002 100644 --- a/reaction/game/bg_public.h +++ b/reaction/game/bg_public.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.50 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.49 2002/03/03 21:46:26 blaze // weapon stats, done, beta test for bugs // @@ -219,6 +222,16 @@ typedef enum { RQ3_SOUND_TOTAL } rq3_sounds_t; +// JBravo: radio. This part stolen from AQ +typedef struct radio_msg_s +{ + char *msg; // the msg name + int length; // length in server frames (ie tenths of a second), rounded up +} radio_msg_t; + +extern radio_msg_t male_radio_msgs[]; +extern radio_msg_t female_radio_msgs[]; + //Elder: Weapon damage and spread stats #define PISTOL_DAMAGE 90 #define MP5_DAMAGE 55 diff --git a/reaction/game/g_client.c b/reaction/game/g_client.c index bf7f6a15..0b76fc58 100644 --- a/reaction/game/g_client.c +++ b/reaction/game/g_client.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.48 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.47 2002/03/11 18:02:33 slicer // Fixed team changes and scoreboard bugs // @@ -1300,6 +1303,7 @@ void ClientSpawn(gentity_t *ent) { int accuracy_hits, accuracy_shots; int eventSequence; int savedWeapon, savedItem; // JBravo: to save weapon/item info + int savedRadiopower, savedRadiogender; // JBravo: for radio. char userinfo[MAX_INFO_STRING]; index = ent - g_entities; @@ -1407,12 +1411,18 @@ void ClientSpawn(gentity_t *ent) { // JBravo: save weapon/item info savedWeapon = client->teamplayWeapon; savedItem = client->teamplayItem; +// JBravo: save radiosettings + savedRadiopower = client->radioOff; + savedRadiogender = client->radioGender; memset (client, 0, sizeof(*client)); // bk FIXME: Com_Memset? // JBravo: restore weapon/item info client->teamplayWeapon = savedWeapon; client->teamplayItem = savedItem; +// JBravo: restore radiosettings + client->radioOff = savedRadiopower; + client->radioGender = savedRadiogender; client->pers = saved; client->sess = savedSess; diff --git a/reaction/game/g_cmds.c b/reaction/game/g_cmds.c index 344257d2..57e005f5 100644 --- a/reaction/game/g_cmds.c +++ b/reaction/game/g_cmds.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.70 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.69 2002/03/13 18:40:52 slicer // Adjusted some of elder's unzoom code for the new sniper system ( server side ) // @@ -1995,7 +1998,8 @@ void Cmd_Bandage (gentity_t *ent) ent->client->ps.weaponTime += BLEED_BANDAGE_TIME; - ent->client->bleedtick = 4; +// JBravo: bleedtick was 4. This should fix bandage bugs. + ent->client->bleedtick = 6; //Elder: added to track health to bleed off ent->client->bleedBandageCount = BLEED_BANDAGE; } @@ -2892,6 +2896,13 @@ void ClientCommand( int clientNum ) { RQ3_Cmd_Choose_f (ent); else if (Q_stricmp (cmd, "drop") == 0) RQ3_Cmd_Drop_f (ent); +// JBravo: adding radio + else if (Q_stricmp (cmd, "radiogender") == 0) + RQ3_Cmd_Radiogender_f (ent); + else if (Q_stricmp (cmd, "radio_power") == 0) + RQ3_Cmd_Radio_power_f (ent); + else if (Q_stricmp (cmd, "radio") == 0) + RQ3_Cmd_Radio_f (ent); else if (Q_stricmp (cmd, "dropweapon") == 0) // XRAY FMJ Cmd_DropWeapon_f( ent ); //Elder: stuff for dropping items diff --git a/reaction/game/g_local.h b/reaction/game/g_local.h index ca4a2b1b..1c1260b4 100644 --- a/reaction/game/g_local.h +++ b/reaction/game/g_local.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.51 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.50 2002/03/07 01:38:36 assimon // Changed Ref System. New cvar added - g_RQ3_RefID. Now referee is peserved even on map changes or map_restarts. // @@ -546,7 +549,8 @@ struct gclient_s { // JBravo adding TP stuff int teamplayWeapon; int teamplayItem; -// int savedpersistant[MAX_PERSISTANT]; + int radioGender; + qboolean radioOff; }; diff --git a/reaction/game/g_teamplay.c b/reaction/game/g_teamplay.c index 76195fec..ef7d5f04 100644 --- a/reaction/game/g_teamplay.c +++ b/reaction/game/g_teamplay.c @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.32 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.31 2002/03/11 18:02:33 slicer // Fixed team changes and scoreboard bugs // @@ -832,3 +835,142 @@ qboolean OKtoFollow( int clientnum ) } return qfalse; } + +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\""); + } else { + ent->client->radioOff = qfalse; + trap_SendServerCommand(ent-g_entities, "cp \"Radio switched on\n\""); + trap_SendServerCommand(ent-g_entities, "playradiosound 25 0\n\""); + } +} + +void RQ3_Cmd_Radiogender_f(gentity_t *ent) +{ + char arg[MAX_TOKEN_CHARS]; + + if (trap_Argc() == 1) { + if (ent->client->radioGender == 0) { + trap_SendServerCommand(ent-g_entities, "print \"Radio gender currently set to male\n\""); + return; + } else { + trap_SendServerCommand(ent-g_entities, "print \"Radio gender currently set to female\n\""); + return; + } + } + + trap_Argv(1, arg, sizeof(arg)); + if (Q_stricmp (arg, "male") == 0) { + trap_SendServerCommand(ent-g_entities, "print \"Radio gender set to male\n\""); + ent->client->radioGender = 0; + } else if (Q_stricmp (arg, "female") == 0) { + trap_SendServerCommand(ent-g_entities, "print \"Radio gender set to female\n\""); + ent->client->radioGender = 1; + } else { + trap_SendServerCommand(ent-g_entities, "print \"Invalid gender selection, try 'male' or 'female'\n\""); + } +} + +radio_msg_t male_radio_msgs[] = { + { "1", 6 }, + { "2", 6 }, + { "3", 8 }, + { "4", 7 }, + { "5", 8 }, + { "6", 9 }, + { "7", 8 }, + { "8", 7 }, + { "9", 7 }, + { "10", 6 }, + { "back", 6 }, + { "cover", 7 }, + { "down", 13 }, + { "enemyd", 10 }, + { "enemys", 9 }, + { "forward", 6 }, + { "go", 6 }, + { "im_hit", 7 }, + { "left", 7 }, + { "reportin", 9 }, + { "right", 6 }, + { "taking_f", 22 }, + { "teamdown", 13 }, + { "treport", 12 }, + { "up", 4 }, + { "click", 4 }, + { "END", 0 }, // end of list delimiter +}; + +radio_msg_t female_radio_msgs[] = { + { "1", 5 }, + { "2", 5 }, + { "3", 5 }, + { "4", 5 }, + { "5", 5 }, + { "6", 8 }, + { "7", 7 }, + { "8", 5 }, + { "9", 5 }, + { "10", 5 }, + { "back", 6 }, + { "cover", 5 }, + { "down", 6 }, + { "enemyd", 9 }, + { "enemys", 9 }, + { "forward", 8 }, + { "go", 6 }, + { "im_hit", 7 }, + { "left", 8 }, + { "reportin", 9 }, + { "right", 5 }, + { "taking_f", 22 }, + { "teamdown", 10 }, + { "treport", 12 }, + { "up", 6 }, + { "click", 6 }, + { "END", 0 }, // end of list delimiter +}; + +void RQ3_Cmd_Radio_f(gentity_t *ent) +{ + char msg[MAX_TOKEN_CHARS]; + radio_msg_t *radio_msgs; + gentity_t *player; + int i, x; + + if (ent->client->sess.sessionTeam == TEAM_SPECTATOR) + return; + if (trap_Argc () < 2) + return; + if (ent->client->radioOff == qtrue) { + trap_SendServerCommand(ent-g_entities, "print \"Your radio is off!\n\""); + return; + } + if (ent->client->radioGender == 0) + radio_msgs = male_radio_msgs; + else + radio_msgs = female_radio_msgs; + + x = 0; + + trap_Argv(1, msg, sizeof(msg)); + + while (Q_stricmp(radio_msgs[x].msg, "END")) { + if (!Q_stricmp(radio_msgs[x].msg, msg)) { + for (i = 0; i < level.maxclients; i++) { + player = &g_entities[i]; + if (!player->inuse) + continue; + if (player->client->sess.savedTeam == ent->client->sess.savedTeam) + trap_SendServerCommand(player-g_entities, va("playradiosound %i %i\n\"", x, + ent->client->radioGender)); + } + } + x++; + } +} + diff --git a/reaction/game/g_teamplay.h b/reaction/game/g_teamplay.h index b65b8ddc..a615e260 100644 --- a/reaction/game/g_teamplay.h +++ b/reaction/game/g_teamplay.h @@ -5,6 +5,9 @@ //----------------------------------------------------------------------------- // // $Log$ +// Revision 1.5 2002/03/14 02:24:39 jbravo +// Adding radio :) +// // Revision 1.4 2002/02/09 00:10:12 jbravo // Fixed spectator follow and free and updated zcam to 1.04 and added the // missing zcam files. @@ -44,3 +47,6 @@ void RQ3_Cmd_Drop_f( gentity_t *ent ); void UnstickPlayer( gentity_t *ent ); void MakeSpectator( gentity_t *ent ); qboolean OKtoFollow( int clientnum ); +void RQ3_Cmd_Radio_f ( gentity_t *ent ); +void RQ3_Cmd_Radio_power_f ( gentity_t *ent ); +void RQ3_Cmd_Radiogender_f ( gentity_t *ent );