diff --git a/Source/Client/Draw.c b/Source/Client/Draw.c
index cde3489d..f7ad73c5 100755
--- a/Source/Client/Draw.c
+++ b/Source/Client/Draw.c
@@ -196,6 +196,8 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
CSQC_VGUI_Draw();
}
}
+
+ Sound_ProcessWordQue();
}
/*
diff --git a/Source/Client/Event.c b/Source/Client/Event.c
index 647871e1..861d6dab 100755
--- a/Source/Client/Event.c
+++ b/Source/Client/Event.c
@@ -26,6 +26,7 @@ Init all the cmds in one place
=================
*/
void CSQC_ConsoleCommand_Init( void ) {
+ registercommand( "vox_test" );
registercommand( "+attack2" );
registercommand( "-attack2" );
registercommand( "+reload" );
@@ -115,6 +116,10 @@ Can interject cmds and create new ones
float CSQC_ConsoleCommand( string sCMD ) {
tokenize( sCMD );
switch ( argv(0) ) {
+ case "vox_test":
+ Sound_PlayVOX( sCMD );
+ return TRUE;
+ break;
case "+attack2":
iInputAttack2 = TRUE;
return TRUE;
@@ -513,6 +518,8 @@ void CSQC_Parse_Event( void ) {
string sMessage2 = readstring();
CSQC_Parse_Print( sprintf( "%s%s^xF80: %s", HUD_GetChatColorHEXTeam( fTeam2 ), getplayerkeyvalue( fSender2, "name" ), sMessage2 ), PRINT_CHAT );
+ } else if ( fHeader == EV_CHAT_VOX ) {
+ Sound_PlayVOX( readstring() );
}
}
diff --git a/Source/Client/Sound.c b/Source/Client/Sound.c
index 20b4d8b7..32250a5c 100755
--- a/Source/Client/Sound.c
+++ b/Source/Client/Sound.c
@@ -18,6 +18,44 @@ along with this program; if not, write to the Free Software
Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
-/*float CSQC_Event_Sound( float entnum, float channel, string soundname, float vol, float attenuation, vector pos, float pitchmod, float flags ) {
+typedef struct {
+ string sSample;
+ float fLength;
+} sound_t;
-}*/
+sound_t *sndVOX;
+var int iVOXCount;
+var int iVOXPos;
+var float fSampleTime = 0.0f;
+
+void Sound_PlayVOX( string sMessage ) {
+ if ( iVOXCount ) {
+ return;
+ }
+
+ iVOXCount = tokenize( sMessage );
+ sndVOX = memalloc( sizeof( sound_t ) * iVOXCount );
+
+ for ( int i = 0; i < iVOXCount; i++ ) {
+ sndVOX[i].sSample = sprintf( "vox/%s.wav", argv( i ) );
+ sndVOX[i].fLength = soundlength( sndVOX[i].sSample );
+ }
+ fSampleTime = time;
+}
+
+void Sound_ProcessWordQue( void ) {
+ if ( iVOXCount ) {
+ if ( fSampleTime < time ) {
+ localcmd( sprintf( "play %s\n", sndVOX[ iVOXPos ].sSample ) );
+ iVOXPos++;
+
+ if ( iVOXPos == iVOXCount ) {
+ memfree( sndVOX );
+ iVOXCount = 0;
+ iVOXPos = 0;
+ } else {
+ fSampleTime = time + sndVOX[ iVOXPos ].fLength;
+ }
+ }
+ }
+}
\ No newline at end of file
diff --git a/Source/Client/progs.src b/Source/Client/progs.src
index 06f772bf..113eca83 100755
--- a/Source/Client/progs.src
+++ b/Source/Client/progs.src
@@ -60,8 +60,8 @@ HUDScope.c
HUDWeaponSelect.c
HUDOrbituaries.c
HUD.c
-Draw.c
Sound.c
+Draw.c
Entities.c
Event.c
Init.c
diff --git a/Source/FreeCS-CE.prj b/Source/FreeCS-CE.prj
index 73b8c46a..f37c1bfe 100644
--- a/Source/FreeCS-CE.prj
+++ b/Source/FreeCS-CE.prj
@@ -60,7 +60,7 @@
-
+
@@ -114,19 +114,5 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
diff --git a/Source/Globals.h b/Source/Globals.h
index 68ce3516..7e2482e7 100755
--- a/Source/Globals.h
+++ b/Source/Globals.h
@@ -234,7 +234,8 @@ enum {
EV_RADIOMSG2,
EV_ORBITUARY,
EV_CHAT,
- EV_CHAT_TEAM
+ EV_CHAT_TEAM,
+ EV_CHAT_VOX
};
// Submodel materials
diff --git a/Source/Server/Main.c b/Source/Server/Main.c
index b14209ba..71567285 100755
--- a/Source/Server/Main.c
+++ b/Source/Server/Main.c
@@ -76,6 +76,21 @@ void SV_ParseClientCommand( string sCommand ) {
clientcommand( self, sCommand );
}
+float ConsoleCmd( string sCommand ) {
+ tokenize( sCommand );
+
+ if ( argv( 0 ) == "vox" ) {
+ localcmd( sprintf( "echo [VOX] Sending: %s\n", argv( 1 ) ) );
+ WriteByte( MSG_MULTICAST, SVC_CGAMEPACKET );
+ WriteByte( MSG_MULTICAST, EV_CHAT_VOX );
+ WriteString( MSG_MULTICAST, argv( 1 ) );
+ msg_entity = world;
+ multicast( '0 0 0', MULTICAST_ALL );
+ return TRUE;
+ }
+ return FALSE;
+}
+
void SV_PausedTic( float fDuration ) {
}