summaryrefslogtreecommitdiff
path: root/src/cgame
diff options
context:
space:
mode:
Diffstat (limited to 'src/cgame')
-rw-r--r--src/cgame/cg_event.c18
-rw-r--r--src/cgame/cg_local.h17
-rw-r--r--src/cgame/cg_main.c3
-rw-r--r--src/cgame/cg_servercmds.c57
-rw-r--r--src/cgame/cg_view.c3
5 files changed, 83 insertions, 15 deletions
diff --git a/src/cgame/cg_event.c b/src/cgame/cg_event.c
index 40df8b9..c8ca2e6 100644
--- a/src/cgame/cg_event.c
+++ b/src/cgame/cg_event.c
@@ -41,7 +41,7 @@ static void CG_Obituary( entityState_t *ent )
const char *attackerInfo;
char targetName[ MAX_NAME_LENGTH ];
char attackerName[ MAX_NAME_LENGTH ];
- char className[ 64 ];
+ char className[ 64 ], victimClassName[ 64 ];
gender_t gender;
clientInfo_t *ci;
qboolean teamKill = qfalse;
@@ -77,6 +77,12 @@ static void CG_Obituary( entityState_t *ent )
message2 = "";
+ if( ent->modelindex >= PCL_ALIEN_BUILDER0 &&
+ ent->modelindex <= PCL_ALIEN_LEVEL4 )
+ Com_sprintf( victimClassName, 64, "'s %s", BG_ClassConfig( ent->modelindex )->humanName );
+ else
+ victimClassName[ 0 ] = '\0';
+
// check for single client messages
switch( mod )
@@ -196,7 +202,7 @@ static void CG_Obituary( entityState_t *ent )
if( message )
{
- CG_Printf( "%s" S_COLOR_WHITE " %s\n", targetName, message );
+ CG_Printf( "%s" S_COLOR_WHITE "%s %s\n", targetName, victimClassName, message );
return;
}
@@ -360,10 +366,10 @@ static void CG_Obituary( entityState_t *ent )
if( message )
{
- CG_Printf( "%s" S_COLOR_WHITE " %s %s%s" S_COLOR_WHITE "%s\n",
- targetName, message,
+ CG_Printf( "%s" S_COLOR_WHITE "%s %s %s%s" S_COLOR_WHITE "%s, %iHP left\n",
+ targetName, victimClassName, message,
( teamKill ) ? S_COLOR_RED "TEAMMATE " S_COLOR_WHITE : "",
- attackerName, message2 );
+ attackerName, message2, ent->groundEntityNum );
if( teamKill && attacker == cg.clientNum )
{
CG_CenterPrint( va ( "You killed " S_COLOR_RED "TEAMMATE "
@@ -375,7 +381,7 @@ static void CG_Obituary( entityState_t *ent )
}
// we don't know what it was
- CG_Printf( "%s" S_COLOR_WHITE " died\n", targetName );
+ CG_Printf( "%s" S_COLOR_WHITE "%s died\n", targetName, victimClassName );
}
diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h
index 7dd951b..43e1701 100644
--- a/src/cgame/cg_local.h
+++ b/src/cgame/cg_local.h
@@ -941,6 +941,8 @@ typedef struct
// After this many msec the crosshair name fades out completely
#define CROSSHAIR_CLIENT_TIMEOUT 1000
+#define MAX_ANNOUNCER_STACK 16
+
typedef struct
{
int clientFrame; // incremented each frame
@@ -1185,9 +1187,15 @@ typedef struct
qboolean forbidCuboids; //if true then dont let player build a cuboid
int latestCBNumber; //wait for this number from server before building a cuboid
int lastCuboidError; //last time error sound was played
+
+ qhandle_t announcerStack[ MAX_ANNOUNCER_STACK ];
+ int announcerStackPos;
+ int announcerStackLatest;
} cg_t;
+
+
// all of the model, shader, and sound references that are
// loaded at gamestate time are stored in cgMedia_t
// Other media that can be tied to clients, weapons, or items are
@@ -1939,6 +1947,10 @@ void CG_WritePTRCode( int code );
const char *CG_TutorialText( void );
//
+// cg_svcmds.c
+void CG_ProcessAnnouncer( void );
+
+//
//===============================================
//
@@ -2171,12 +2183,13 @@ typedef enum
// mod version data
-#define MODVER_CURRENT 4
+#define MODVER_CURRENT 5
+#define MODVER_C2_0_1_4 5
#define MODVER_C2_0_1_3 4
#define MODVER_C2_0_1_2 3
#define MODVER_C2_0_1_1 2
#define MODVER_C2_0_1_0 1
-#define MODVER_TITLE "0.1.3 (Sep 10)"
+#define MODVER_TITLE "0.1.4 (Sep 12)"
diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c
index 4191cc7..427a571 100644
--- a/src/cgame/cg_main.c
+++ b/src/cgame/cg_main.c
@@ -1921,6 +1921,9 @@ void CG_Init( int serverMessageNum, int serverCommandSequence, int clientNum )
CG_ShaderStateChanged( );
trap_S_ClearLoopingSounds( qtrue );
+
+ cg.announcerStackLatest = -1;
+ cg.announcerStackPos = -1;
}
/*
diff --git a/src/cgame/cg_servercmds.c b/src/cgame/cg_servercmds.c
index f11aa7e..2a71b62 100644
--- a/src/cgame/cg_servercmds.c
+++ b/src/cgame/cg_servercmds.c
@@ -1261,12 +1261,36 @@ static void CG_PoisonCloud_f( void )
/*
=================
-CG_VoteEvent_f
+CG_ProcessAnnouncer
+=================
+*/
+#define ANNOUNCER_DELAY 2000
+void CG_ProcessAnnouncer( void )
+{
+ static int last = -ANNOUNCER_DELAY;
+
+ if( cg.announcerStackPos == cg.announcerStackLatest )
+ return;
-Vote sounds use commands to save on events and entities
+ if( last + ANNOUNCER_DELAY > cg.time )
+ return;
+
+ cg.announcerStackPos++;
+ cg.announcerStackPos %= MAX_ANNOUNCER_STACK;
+
+ trap_S_StartLocalSound( cg.announcerStack[ cg.announcerStackPos ], CHAN_VOICE );
+
+ last = cg.time;
+}
+
+/*
+=================
+CG_Announce_f
+
+Play an announcer sound
=================
*/
-static void CG_VoteEvent( void )
+static void CG_Announce( void )
{
const char *event, *soundName;
@@ -1278,12 +1302,31 @@ static void CG_VoteEvent( void )
if( !Q_stricmp( event, "votenow" ) ||
!Q_stricmp( event, "votecancelled" ) ||
!Q_stricmp( event, "votefailed" ) ||
- !Q_stricmp( event, "votepassed" ) )
+ !Q_stricmp( event, "votepassed" ) ||
+ !Q_stricmp( event, "timelimit_hit" ) ||
+ !Q_stricmp( event, "timelimit_1min" ) ||
+ !Q_stricmp( event, "timelimit_5min" ) ||
+ !Q_stricmp( event, "suddendeath" ) ||
+ !Q_stricmp( event, "sdimminent" ) ||
+ !Q_stricmp( event, "alienswin" ) ||
+ !Q_stricmp( event, "aliensadmit" ) ||
+ !Q_stricmp( event, "alienslocked" ) ||
+ !Q_stricmp( event, "aliensunlocked" ) ||
+ !Q_stricmp( event, "humanswin" ) ||
+ !Q_stricmp( event, "humansadmit" ) ||
+ !Q_stricmp( event, "humanslocked" ) ||
+ !Q_stricmp( event, "humansunlocked" ) ||
+ !Q_stricmp( event, "stalemate" ) ||
+ !Q_stricmp( event, "1minremains" ) ||
+ !Q_stricmp( event, "5minremains" ) )
soundName = va( "sound/feedback/%s.wav", event );
else
return;
- trap_S_StartLocalSound( trap_S_RegisterSound( soundName, qfalse ), CHAN_VOICE );
+ cg.announcerStackLatest++;
+ cg.announcerStackLatest %= MAX_ANNOUNCER_STACK;
+
+ cg.announcerStack[ cg.announcerStackLatest ] = trap_S_RegisterSound( soundName, qfalse );
}
static void CG_GameCmds_f( void )
@@ -1303,6 +1346,7 @@ static void CG_GameCmds_f( void )
static consoleCommand_t svcommands[ ] =
{
+ { "announce", CG_Announce },
{ "cb2", CG_Cuboid_Response }, // set local cuboid
{ "cb3", CG_Cuboid_Response }, // set local cuboid and print a "limit exceeded" warning
{ "chat", CG_Chat_f },
@@ -1317,8 +1361,7 @@ static consoleCommand_t svcommands[ ] =
{ "serverclosemenus", CG_ServerCloseMenus_f },
{ "servermenu", CG_ServerMenu_f },
{ "tinfo", CG_ParseTeamInfo },
- { "voice", CG_ParseVoice },
- { "voteevent", CG_VoteEvent }
+ { "voice", CG_ParseVoice }
};
/*
diff --git a/src/cgame/cg_view.c b/src/cgame/cg_view.c
index cd5e384..4b2b254 100644
--- a/src/cgame/cg_view.c
+++ b/src/cgame/cg_view.c
@@ -1459,6 +1459,9 @@ void CG_DrawActiveFrame( int serverTime, stereoFrame_t stereoView, qboolean demo
// update audio positions
trap_S_Respatialize( cg.snap->ps.clientNum, cg.refdef.vieworg, cg.refdef.viewaxis, inwater );
+
+ // update announcer
+ CG_ProcessAnnouncer( );
// make sure the lagometerSample and frame timing isn't done twice when in stereo
if( stereoView != STEREO_RIGHT )