Skip to content

Commit

Permalink
Made more code for Team Arena be inside ifdef MISSIONPACK, from Ensif…
Browse files Browse the repository at this point in the history
…orm.
  • Loading branch information
zturtleman committed Jun 18, 2012
1 parent a375f89 commit 56a918b
Show file tree
Hide file tree
Showing 6 changed files with 32 additions and 8 deletions.
10 changes: 6 additions & 4 deletions code/cgame/cg_consolecmds.c
Expand Up @@ -24,8 +24,8 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// executed by a key binding

#include "cg_local.h"
#include "../ui/ui_shared.h"
#ifdef MISSIONPACK
#include "../ui/ui_shared.h"
extern menuDef_t *menuScoreboard;
#endif

Expand Down Expand Up @@ -210,6 +210,7 @@ static void CG_TellAttacker_f( void ) {
trap_SendClientCommand( command );
}

#ifdef MISSIONPACK
static void CG_VoiceTellTarget_f( void ) {
int clientNum;
char command[128];
Expand Down Expand Up @@ -240,7 +241,6 @@ static void CG_VoiceTellAttacker_f( void ) {
trap_SendClientCommand( command );
}

#ifdef MISSIONPACK
static void CG_NextTeamMember_f( void ) {
CG_SelectNextPlayer();
}
Expand Down Expand Up @@ -467,12 +467,12 @@ static consoleCommand_t commands[] = {
{ "weapnext", CG_NextWeapon_f },
{ "weapprev", CG_PrevWeapon_f },
{ "weapon", CG_Weapon_f },
{ "tcmd", CG_TargetCommand_f },
{ "tell_target", CG_TellTarget_f },
{ "tell_attacker", CG_TellAttacker_f },
#ifdef MISSIONPACK
{ "vtell_target", CG_VoiceTellTarget_f },
{ "vtell_attacker", CG_VoiceTellAttacker_f },
{ "tcmd", CG_TargetCommand_f },
#ifdef MISSIONPACK
{ "loadhud", CG_LoadHud_f },
{ "nextTeamMember", CG_NextTeamMember_f },
{ "prevTeamMember", CG_PrevTeamMember_f },
Expand Down Expand Up @@ -552,13 +552,15 @@ void CG_InitConsoleCommands( void ) {
trap_AddCommand ("say");
trap_AddCommand ("say_team");
trap_AddCommand ("tell");
#ifdef MISSIONPACK
trap_AddCommand ("vsay");
trap_AddCommand ("vsay_team");
trap_AddCommand ("vtell");
trap_AddCommand ("vtaunt");
trap_AddCommand ("vosay");
trap_AddCommand ("vosay_team");
trap_AddCommand ("votell");
#endif
trap_AddCommand ("give");
trap_AddCommand ("god");
trap_AddCommand ("notarget");
Expand Down
8 changes: 7 additions & 1 deletion code/cgame/cg_local.h
Expand Up @@ -590,10 +590,12 @@ typedef struct {
int soundTime;
qhandle_t soundBuffer[MAX_SOUNDBUFFER];

#ifdef MISSIONPACK
// for voice chat buffer
int voiceChatTime;
int voiceChatBufferIn;
int voiceChatBufferOut;
#endif

// warmup countdown
int warmup;
Expand Down Expand Up @@ -1145,8 +1147,10 @@ extern vmCvar_t cg_predictItems;
extern vmCvar_t cg_deferPlayers;
extern vmCvar_t cg_drawFriend;
extern vmCvar_t cg_teamChatsOnly;
#ifdef MISSIONPACK
extern vmCvar_t cg_noVoiceChats;
extern vmCvar_t cg_noVoiceText;
#endif
extern vmCvar_t cg_scorePlum;
extern vmCvar_t cg_smoothClients;
extern vmCvar_t pmove_fixed;
Expand Down Expand Up @@ -1445,10 +1449,12 @@ void CG_InitConsoleCommands( void );
void CG_ExecuteNewServerCommands( int latestSequence );
void CG_ParseServerinfo( void );
void CG_SetConfigValues( void );
void CG_LoadVoiceChats( void );
void CG_ShaderStateChanged(void);
#ifdef MISSIONPACK
void CG_LoadVoiceChats( void );
void CG_VoiceChatLocal( int mode, qboolean voiceOnly, int clientNum, int color, const char *cmd );
void CG_PlayBufferedVoiceChats( void );
#endif

//
// cg_playerstate.c
Expand Down
4 changes: 4 additions & 0 deletions code/cgame/cg_main.c
Expand Up @@ -158,8 +158,10 @@ vmCvar_t cg_drawTeamOverlay;
vmCvar_t cg_teamOverlayUserinfo;
vmCvar_t cg_drawFriend;
vmCvar_t cg_teamChatsOnly;
#ifdef MISSIONPACK
vmCvar_t cg_noVoiceChats;
vmCvar_t cg_noVoiceText;
#endif
vmCvar_t cg_hudFiles;
vmCvar_t cg_scorePlum;
vmCvar_t cg_smoothClients;
Expand Down Expand Up @@ -272,8 +274,10 @@ static cvarTable_t cvarTable[] = {
{ &cg_stats, "cg_stats", "0", 0 },
{ &cg_drawFriend, "cg_drawFriend", "1", CVAR_ARCHIVE },
{ &cg_teamChatsOnly, "cg_teamChatsOnly", "0", CVAR_ARCHIVE },
#ifdef MISSIONPACK
{ &cg_noVoiceChats, "cg_noVoiceChats", "0", CVAR_ARCHIVE },
{ &cg_noVoiceText, "cg_noVoiceText", "0", CVAR_ARCHIVE },
#endif
// the following variables are created in other parts of the system,
// but we also reference them here
{ &cg_buildScript, "com_buildScript", "0", 0 }, // force loading of all possible data amd error on failures
Expand Down
10 changes: 7 additions & 3 deletions code/cgame/cg_servercmds.c
Expand Up @@ -25,6 +25,7 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
// be a valid snapshot this frame

#include "cg_local.h"
#ifdef MISSIONPACK
#include "../../ui/menudef.h"

typedef struct {
Expand All @@ -46,7 +47,6 @@ static const orderTask_t validOrders[] = {

static const int numValidOrders = ARRAY_LEN(validOrders);

#ifdef MISSIONPACK
static int CG_ValidOrder(const char *p) {
int i;
for (i = 0; i < numValidOrders; i++) {
Expand Down Expand Up @@ -487,6 +487,8 @@ static void CG_MapRestart( void ) {
trap_Cvar_Set("cg_thirdPerson", "0");
}

#ifdef MISSIONPACK

#define MAX_VOICEFILESIZE 16384
#define MAX_VOICEFILES 8
#define MAX_VOICECHATS 64
Expand Down Expand Up @@ -940,7 +942,6 @@ CG_VoiceChat
=================
*/
void CG_VoiceChat( int mode ) {
#ifdef MISSIONPACK
const char *cmd;
int clientNum, color;
qboolean voiceOnly;
Expand All @@ -959,8 +960,8 @@ void CG_VoiceChat( int mode ) {
}

CG_VoiceChatLocal( mode, voiceOnly, clientNum, color, cmd );
#endif
}
#endif

/*
=================
Expand Down Expand Up @@ -1040,6 +1041,8 @@ static void CG_ServerCommand( void ) {
CG_Printf( "%s\n", text );
return;
}

#ifdef MISSIONPACK
if ( !strcmp( cmd, "vchat" ) ) {
CG_VoiceChat( SAY_ALL );
return;
Expand All @@ -1054,6 +1057,7 @@ static void CG_ServerCommand( void ) {
CG_VoiceChat( SAY_TELL );
return;
}
#endif

if ( !strcmp( cmd, "scores" ) ) {
CG_ParseScores();
Expand Down
2 changes: 2 additions & 0 deletions code/cgame/cg_view.c
Expand Up @@ -818,8 +818,10 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
// add buffered sounds
CG_PlayBufferedSounds();

#ifdef MISSIONPACK
// play buffered voice chats
CG_PlayBufferedVoiceChats();
#endif

// finish up the rest of the refdef
if ( cg.testModelEntity.hModel ) {
Expand Down
6 changes: 6 additions & 0 deletions code/game/g_cmds.c
Expand Up @@ -22,7 +22,9 @@ Foundation, Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA
//
#include "g_local.h"

#ifdef MISSIONPACK
#include "../../ui/menudef.h" // for the voice chats
#endif

/*
==================
Expand Down Expand Up @@ -937,6 +939,7 @@ static void Cmd_Tell_f( gentity_t *ent ) {
}


#ifdef MISSIONPACK
static void G_VoiceTo( gentity_t *ent, gentity_t *other, int mode, const char *id, qboolean voiceonly ) {
int color;
char *cmd;
Expand Down Expand Up @@ -1132,6 +1135,7 @@ static void Cmd_VoiceTaunt_f( gentity_t *ent ) {
// just say something
G_Voice( ent, NULL, SAY_ALL, VOICECHAT_TAUNT, qfalse );
}
#endif



Expand Down Expand Up @@ -1605,6 +1609,7 @@ void ClientCommand( int clientNum ) {
Cmd_Tell_f ( ent );
return;
}
#ifdef MISSIONPACK
if (Q_stricmp (cmd, "vsay") == 0) {
Cmd_Voice_f (ent, SAY_ALL, qfalse, qfalse);
return;
Expand Down Expand Up @@ -1633,6 +1638,7 @@ void ClientCommand( int clientNum ) {
Cmd_VoiceTaunt_f ( ent );
return;
}
#endif
if (Q_stricmp (cmd, "score") == 0) {
Cmd_Score_f (ent);
return;
Expand Down

0 comments on commit 56a918b

Please sign in to comment.