#define CSQC_RETURNVAL prog->globals.generic[OFS_RETURN]
#define CSQC_BEGIN csqc_tmpprog=prog;prog=0;PRVM_SetProg(PRVM_CLIENTPROG);
#define CSQC_END prog=csqc_tmpprog;
+
static prvm_prog_t *csqc_tmpprog;
//[515]: these are required funcs
Con_Print("CSQC ^1unloaded\n");
cl.csqc_loaded = false;
}
+
+qboolean CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out)
+{
+ prvm_edict_t *ed;
+ dp_model_t *mod;
+ qboolean r = 0;
+
+ CSQC_BEGIN;
+
+ ed = PRVM_EDICT_NUM(entnum - 32768);
+
+ if(!ed->priv.required->free)
+ {
+ mod = CL_GetModelFromEdict(ed);
+ VectorCopy(ed->fields.client->origin, out);
+ if (mod && mod->soundfromcenter)
+ VectorMAMAM(1.0f, out, 0.5f, mod->normalmins, 0.5f, mod->normalmaxs, out);
+ r = 1;
+ }
+
+ CSQC_END;
+
+ return r;
+}
qboolean MakeDownloadPacket(const char *filename, unsigned char *data, unsigned long len, int crc, int cnt, sizebuf_t *buf, int protocol);
+qboolean CL_VM_GetEntitySoundOrigin(int entnum, vec3_t out);
+
#endif
#include "snd_main.h"
#include "snd_ogg.h"
#include "snd_modplug.h"
+#include "csprogs.h"
#define SND_MIN_SPEED 8000
{
if (ch->entnum >= 32768)
{
- // TODO: sounds that follow CSQC entities?
+ //Con_Printf("-- entnum %i origin %f %f %f neworigin %f %f %f\n", ch->entnum, ch->origin[0], ch->origin[1], ch->origin[2], cl.entities[ch->entnum].state_current.origin[0], cl.entities[ch->entnum].state_current.origin[1], cl.entities[ch->entnum].state_current.origin[2]);
+
+ CL_VM_GetEntitySoundOrigin(ch->entnum, ch->origin);
}
else if (cl.entities[ch->entnum].state_current.active)
{