From 4948652e17917c2879c9c6a37fc125653dee9d73 Mon Sep 17 00:00:00 2001 From: Spoike Date: Sat, 21 Aug 2010 13:31:39 +0000 Subject: [PATCH] Fixed the hexen2 looping sound bug (implemented stopsound). Muted some hexen2 effect warning prints, so it feels more stable even if its not. git-svn-id: https://svn.code.sf.net/p/fteqw/code/branches/wip@3597 fc73d0e0-1445-4013-8a0c-d673dee63da5 --- engine/client/cl_parse.c | 17 +++++++++++++++-- engine/client/snd_dma.c | 5 +++-- engine/server/pr_cmds.c | 40 +++++++++++++++++++++++++++++++++++----- engine/server/sv_send.c | 15 ++++++++++----- 4 files changed, 63 insertions(+), 14 deletions(-) diff --git a/engine/client/cl_parse.c b/engine/client/cl_parse.c index b17edf0a7..8fc10a254 100644 --- a/engine/client/cl_parse.c +++ b/engine/client/cl_parse.c @@ -3344,7 +3344,12 @@ void CL_ParseStartSoundPacket(void) #ifdef PEXT_CSQC if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation)) #endif - S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); + { + if (!sound_num) + S_StopSound(ent, channel); + else + S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); + } if (ent == cl.playernum[0]+1) @@ -3475,7 +3480,15 @@ void CLNQ_ParseStartSoundPacket(void) for (i=0 ; i<3 ; i++) pos[i] = MSG_ReadCoord (); - S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); +#ifdef PEXT_CSQC + if (!CSQC_StartSound(ent, channel, cl.sound_name[sound_num], pos, volume/255.0, attenuation)) +#endif + { + if (!sound_num) + S_StopSound(ent, channel); + else + S_StartSound (ent, channel, cl.sound_precache[sound_num], pos, volume/255.0, attenuation); + } if (ent == cl.playernum[0]+1) TP_CheckPickupSound(cl.sound_name[sound_num], pos); diff --git a/engine/client/snd_dma.c b/engine/client/snd_dma.c index 3450aa2ce..81ae1691d 100644 --- a/engine/client/snd_dma.c +++ b/engine/client/snd_dma.c @@ -1020,11 +1020,12 @@ void S_StopSoundCard(soundcardinfo_t *sc, int entnum, int entchannel) for (i=0 ; itotal_chans ; i++) { if (sc->channel[i].entnum == entnum - && sc->channel[i].entchannel == entchannel) + && (!entchannel || sc->channel[i].entchannel == entchannel)) { sc->channel[i].end = 0; sc->channel[i].sfx = NULL; - return; + if (entchannel) + return; } } } diff --git a/engine/server/pr_cmds.c b/engine/server/pr_cmds.c index 4ca8eec88..d5a7b9ffc 100644 --- a/engine/server/pr_cmds.c +++ b/engine/server/pr_cmds.c @@ -7145,6 +7145,7 @@ void PF_h2matchAngleToSlope(progfuncs_t *prinst, struct globalvars_s *pr_globals actor->v->angles[0] = dot*pitch; actor->v->angles[2] = (1-fabs(dot))*pitch*mod; } +/*objective type stuff, this goes into a stat*/ void PF_h2updateinfoplaque(progfuncs_t *prinst, struct globalvars_s *pr_globals) { unsigned int idx = G_FLOAT(OFS_PARM0); @@ -7179,7 +7180,7 @@ void PF_h2starteffect(progfuncs_t *prinst, struct globalvars_s *pr_globals) SV_Effect(G_VECTOR(OFS_PARM1), PF_precache_model_Internal(prinst, "models/sm_white.spr"), 0, 3, 20); break; case 11: //yellowred_flash - SV_Effect(G_VECTOR(OFS_PARM1), PF_precache_model_Internal(prinst, "models/yr_flash.spr"), 0, 21, 20); + SV_Effect(G_VECTOR(OFS_PARM1), PF_precache_model_Internal(prinst, "models/yr_flsh.spr"), 0, 21, 20); break; case 13: //sm_blue_flash SV_Effect(G_VECTOR(OFS_PARM1), PF_precache_model_Internal(prinst, "models/bluflash.spr"), 0, 5, 20); @@ -7242,10 +7243,17 @@ void PF_h2starteffect(progfuncs_t *prinst, struct globalvars_s *pr_globals) case 56: //bomb SV_Effect(G_VECTOR(OFS_PARM1), PF_precache_model_Internal(prinst, "models/pow.spr"), 0, 6, 20); break; - case 46: - case 52: - case 53: - case 57: + case 5: //bluespark + case 43: //snow + case 46: //acid_muzzfl + case 51: //lball_expl + case 52: //acid_splat + case 53: //acid_expl + case 57: //brn_bounce + case 58: //lshock + case 38: //teleporterpuffs + case 39: //teleporterbody + case 62: //onfire break; @@ -7272,18 +7280,40 @@ void PF_h2endeffect(progfuncs_t *prinst, struct globalvars_s *pr_globals) void PF_h2rain_go(progfuncs_t *prinst, struct globalvars_s *pr_globals) { + /* + float *min = G_VECTOR(OFS_PARM0); + float *max = G_VECTOR(OFS_PMAR1); + float *size = G_VECTOR(OFS_PARM2); + float *dir = G_VECTOR(OFS_PARM3); + float colour = G_FLOAT(OFS_PARM4); + float count = G_FLOAT(OFS_PARM5); + */ + Con_DPrintf("rain go\n", (int)G_FLOAT(OFS_PARM0)); } void PF_h2StopSound(progfuncs_t *prinst, struct globalvars_s *pr_globals) { + int channel; + edict_t *entity; + + entity = G_EDICT(prinst, OFS_PARM0); + channel = G_FLOAT(OFS_PARM1); + + SVQ1_StartSound (entity, channel, "", 1, 0); } void PF_h2updatesoundpos(progfuncs_t *prinst, struct globalvars_s *pr_globals) { + Con_DPrintf("updatesoundpos\n"); } void PF_h2whiteflash(progfuncs_t *prinst, struct globalvars_s *pr_globals) { + /* + broadcast a stuffcmd, I guess, to flash the screen white + Only seen this occur once: after killing pravus. + */ + Con_DPrintf("white flash\n", (int)G_FLOAT(OFS_PARM0)); } void PF_h2getstring(progfuncs_t *prinst, struct globalvars_s *pr_globals) diff --git a/engine/server/sv_send.c b/engine/server/sv_send.c index cad452549..8666e613b 100644 --- a/engine/server/sv_send.c +++ b/engine/server/sv_send.c @@ -819,10 +819,15 @@ void SV_StartSound (int ent, vec3_t origin, int seenmask, int channel, char *sam } // find precache number for sound - for (sound_num=1 ; sound_num