//static qboolean QW_CL_IsUploading(void);
static void QW_CL_StopUpload(void);
void CL_VM_UpdateIntermissionState(int intermission);
+qboolean CL_VM_Event_Sound(int sound_num, int volume, int channel, float attenuation, int ent, vec3_t pos);
/*
==================
if (ent >= cl.max_entities)
CL_ExpandEntities(ent);
- S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0f, attenuation);
+ if( !CL_VM_Event_Sound(sound_num, volume / 255.0f, channel, attenuation, ent, pos) )
+ S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0f, attenuation);
}
/*
#include "clprogdefs.h"
#include "csprogs.h"
#include "cl_collision.h"
+#include "snd_main.h"
//============================================================================
// Client prog handling
CSQC_END
}
}
+qboolean CL_VM_Event_Sound(int sound_num, int volume, int channel, float attenuation, int ent, vec3_t pos)
+{
+ qboolean r = false;
+ if(cl.csqc_loaded)
+ {
+ CSQC_BEGIN
+ if(prog->funcoffsets.CSQC_Event_Sound)
+ {
+ prog->globals.client->time = cl.time;
+ PRVM_G_FLOAT(OFS_PARM0) = ent;
+ PRVM_G_FLOAT(OFS_PARM1) = channel;
+ PRVM_G_INT(OFS_PARM2) = PRVM_SetTempString(cl.sound_name[sound_num] );
+ PRVM_G_FLOAT(OFS_PARM3) = volume;
+ PRVM_G_FLOAT(OFS_PARM4) = attenuation;
+ VectorCopy(pos, PRVM_G_VECTOR(OFS_PARM5) );
+ PRVM_ExecuteProgram(prog->funcoffsets.CSQC_Event_Sound, "QC function CSQC_Event_Sound is missing");
+ r = CSQC_RETURNVAL;
+ }
+ CSQC_END
+ }
+
+ return r;
+}
void CL_VM_UpdateCoopDeathmatchGlobals (int gametype)
{
// Avoid global names for clean(er) coding
func_t CSQC_Ent_Remove; // csqc
func_t CSQC_Ent_Update; // csqc
func_t CSQC_Event; // csqc [515]: engine call this for its own needs so csqc can do some things according to what engine it's running on. example: to say about edicts increase, whatever...
+ func_t CSQC_Event_Sound; // csqc : called by engine when an incoming sound packet arrives so CSQC can act on it
func_t CSQC_Init; // csqc
func_t CSQC_InputEvent; // csqc
func_t CSQC_Parse_CenterPrint; // csqc
prog->funcoffsets.CSQC_Ent_Remove = PRVM_ED_FindFunctionOffset("CSQC_Ent_Remove");
prog->funcoffsets.CSQC_Ent_Update = PRVM_ED_FindFunctionOffset("CSQC_Ent_Update");
prog->funcoffsets.CSQC_Event = PRVM_ED_FindFunctionOffset("CSQC_Event");
+ prog->funcoffsets.CSQC_Event_Sound = PRVM_ED_FindFunctionOffset("CSQC_Event_Sound");
prog->funcoffsets.CSQC_Init = PRVM_ED_FindFunctionOffset("CSQC_Init");
prog->funcoffsets.CSQC_InputEvent = PRVM_ED_FindFunctionOffset("CSQC_InputEvent");
prog->funcoffsets.CSQC_Parse_CenterPrint = PRVM_ED_FindFunctionOffset("CSQC_Parse_CenterPrint");