Added a new sv cmd: vox
Clients can test it with vox_test
This commit is contained in:
parent
cbe9b42d93
commit
e4a0a778cc
7 changed files with 68 additions and 19 deletions
|
@ -196,6 +196,8 @@ void CSQC_UpdateView( float fWinWidth, float fWinHeight, float fGameFocus ) {
|
|||
CSQC_VGUI_Draw();
|
||||
}
|
||||
}
|
||||
|
||||
Sound_ProcessWordQue();
|
||||
}
|
||||
|
||||
/*
|
||||
|
|
|
@ -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() );
|
||||
}
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -60,8 +60,8 @@ HUDScope.c
|
|||
HUDWeaponSelect.c
|
||||
HUDOrbituaries.c
|
||||
HUD.c
|
||||
Draw.c
|
||||
Sound.c
|
||||
Draw.c
|
||||
Entities.c
|
||||
Event.c
|
||||
Init.c
|
||||
|
|
|
@ -60,7 +60,7 @@
|
|||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\TraceAttack.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Triggers.c" />
|
||||
</category>
|
||||
<category name="Menu" expanded="no">
|
||||
<category name="Menu" expanded="yes">
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Defs.h" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Draw.c" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\Header.c" />
|
||||
|
@ -114,19 +114,5 @@
|
|||
</project>
|
||||
|
||||
<workspace version="Crimson Editor 3.60">
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Menu\MenuConfiguration.c" linenum="51" placement="0:1:-1:-1:-4:-23:22:22:904:454" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Player.c" linenum="107" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\PhysicsMove.c" linenum="158" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\freecs\default.cfg" linenum="70" placement="2:3:-1:-1:-4:-23:88:88:974:524" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\freecs\ftesrv.cfg" linenum="11" placement="0:1:-1:-1:-4:-23:110:110:996:546" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Client.c" linenum="20" placement="0:1:-1:-1:-4:-23:132:132:1018:568" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Main.c" linenum="154" placement="0:1:-1:-1:-4:-23:154:154:1040:590" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUITeamSelect.c" linenum="1" placement="0:1:-1:-1:-4:-23:22:22:908:458" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUIBuyMenu.c" linenum="145" placement="0:1:-1:-1:-4:-23:44:44:930:480" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUI.c" linenum="81" placement="0:1:-1:-1:-4:-23:66:66:952:502" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\Defs.h" linenum="21" placement="0:1:-1:-1:-4:-23:88:88:974:524" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Client\VGUI.h" linenum="47" placement="0:1:-1:-1:-4:-23:110:110:996:546" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Builtins.h" linenum="2395" placement="0:1:-1:-1:-4:-23:198:198:1084:634" />
|
||||
<localfile path="C:\cygwin\home\User\FreeCS\Source\Server\Footsteps.c" linenum="41" placement="0:1:-1:-1:-4:-23:0:0:886:436" />
|
||||
</workspace>
|
||||
|
||||
|
|
|
@ -234,7 +234,8 @@ enum {
|
|||
EV_RADIOMSG2,
|
||||
EV_ORBITUARY,
|
||||
EV_CHAT,
|
||||
EV_CHAT_TEAM
|
||||
EV_CHAT_TEAM,
|
||||
EV_CHAT_VOX
|
||||
};
|
||||
|
||||
// Submodel materials
|
||||
|
|
|
@ -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 ) {
|
||||
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue