mirror of
https://github.com/nzp-team/fteqw.git
synced 2024-11-10 06:32:00 +00:00
Fix some missing ambient sounds on large bloated maps/mods (this really should have been fixed years ago).
git-svn-id: https://svn.code.sf.net/p/fteqw/code/trunk@6281 fc73d0e0-1445-4013-8a0c-d673dee63da5
This commit is contained in:
parent
4afdb54861
commit
c4b043d39f
5 changed files with 34 additions and 12 deletions
|
@ -4973,23 +4973,34 @@ static void CL_ParseStaticProt (int baselinetype)
|
||||||
CL_ParseStaticSound
|
CL_ParseStaticSound
|
||||||
===================
|
===================
|
||||||
*/
|
*/
|
||||||
static void CL_ParseStaticSound (qboolean large)
|
static void CL_ParseStaticSound (unsigned int flags)
|
||||||
{
|
{
|
||||||
extern cvar_t cl_staticsounds;
|
extern cvar_t cl_staticsounds;
|
||||||
vec3_t org;
|
vec3_t org;
|
||||||
int sound_num;
|
size_t sound_num;
|
||||||
float vol, atten;
|
float vol, atten;
|
||||||
int i;
|
int i;
|
||||||
|
|
||||||
|
if (flags & ~(1))
|
||||||
|
Host_EndGame("CL_ParseStaticSound: unsupported flags & %x\n", flags&~(1));
|
||||||
|
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
org[i] = MSG_ReadCoord ();
|
org[i] = MSG_ReadCoord ();
|
||||||
if (large || (cls.protocol == CP_NETQUAKE && cls.protocol_nq == CPNQ_BJP2))
|
if (flags || (cls.protocol == CP_NETQUAKE && cls.protocol_nq == CPNQ_BJP2))
|
||||||
|
{
|
||||||
|
if (cls.fteprotocolextensions2&PEXT2_LERPTIME)
|
||||||
|
sound_num = (unsigned short)MSG_ReadULEB128();
|
||||||
|
else
|
||||||
sound_num = (unsigned short)MSG_ReadShort();
|
sound_num = (unsigned short)MSG_ReadShort();
|
||||||
|
}
|
||||||
else
|
else
|
||||||
sound_num = MSG_ReadByte ();
|
sound_num = MSG_ReadByte ();
|
||||||
vol = MSG_ReadByte ()/255.0;
|
vol = MSG_ReadByte ()/255.0;
|
||||||
atten = MSG_ReadByte ()/64.0;
|
atten = MSG_ReadByte ()/64.0;
|
||||||
|
|
||||||
|
if (sound_num >= countof(cl.sound_precache))
|
||||||
|
return; //no crashing, please.
|
||||||
|
|
||||||
vol *= cl_staticsounds.value;
|
vol *= cl_staticsounds.value;
|
||||||
if (vol < 0)
|
if (vol < 0)
|
||||||
return;
|
return;
|
||||||
|
@ -7520,6 +7531,9 @@ void CLQW_ParseServerMessage (void)
|
||||||
case svc_spawnstaticsound:
|
case svc_spawnstaticsound:
|
||||||
CL_ParseStaticSound (false);
|
CL_ParseStaticSound (false);
|
||||||
break;
|
break;
|
||||||
|
case svcfte_spawnstaticsound2:
|
||||||
|
CL_ParseStaticSound (MSG_ReadByte());
|
||||||
|
break;
|
||||||
|
|
||||||
case svc_cdtrack:
|
case svc_cdtrack:
|
||||||
{
|
{
|
||||||
|
|
|
@ -334,6 +334,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
|
||||||
#define svcfte_temp_entity_sized 91 //svc_temp_entity with an extra short size right after the svc (high bit means nq, unset means qw).
|
#define svcfte_temp_entity_sized 91 //svc_temp_entity with an extra short size right after the svc (high bit means nq, unset means qw).
|
||||||
#define svcfte_csqcentities_sized 92 //entity lump for csqc (with size info)
|
#define svcfte_csqcentities_sized 92 //entity lump for csqc (with size info)
|
||||||
#define svcfte_setanglebase 93 //updates the base angle (and optionally locks the view, otherwise nudging it without race conditions.)
|
#define svcfte_setanglebase 93 //updates the base angle (and optionally locks the view, otherwise nudging it without race conditions.)
|
||||||
|
#define svcfte_spawnstaticsound2 94 //*sigh*
|
||||||
|
|
||||||
//fitz svcs
|
//fitz svcs
|
||||||
#define svcfitz_skybox 37
|
#define svcfitz_skybox 37
|
||||||
|
|
|
@ -3675,7 +3675,7 @@ void PF_ambientsound_Internal (float *pos, const char *samp, float vol, float at
|
||||||
VectorCopy(pos, state->position);
|
VectorCopy(pos, state->position);
|
||||||
state->soundnum = soundnum;
|
state->soundnum = soundnum;
|
||||||
state->volume = bound(0, (int)(vol*255), 255);
|
state->volume = bound(0, (int)(vol*255), 255);
|
||||||
state->attenuation = attenuation*64;
|
state->attenuation = bound(0,attenuation*64,255);
|
||||||
}
|
}
|
||||||
|
|
||||||
static void QCBUILTIN PF_ambientsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
static void QCBUILTIN PF_ambientsound (pubprogfuncs_t *prinst, struct globalvars_s *pr_globals)
|
||||||
|
|
|
@ -1201,11 +1201,8 @@ void SV_StartSound (int ent, vec3_t origin, float *velocity, int seenmask, int c
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
if (attenuation < 0 || attenuation > 4)
|
if (attenuation < 0 || attenuation >= 4)
|
||||||
{
|
Con_DPrintf ("SV_StartSound: attenuation = %f", attenuation);
|
||||||
Con_Printf ("SV_StartSound: attenuation = %f", attenuation);
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (channel < 0 || channel > 255)
|
if (channel < 0 || channel > 255)
|
||||||
{
|
{
|
||||||
|
|
|
@ -1694,9 +1694,14 @@ void SV_SendClientPrespawnInfo(client_t *client)
|
||||||
large = true;
|
large = true;
|
||||||
if (client->protocol == SCP_BJP3)
|
if (client->protocol == SCP_BJP3)
|
||||||
continue; //not supported
|
continue; //not supported
|
||||||
|
else if (ISQWCLIENT(client) && (client->fteprotocolextensions2 & PEXT2_REPLACEMENTDELTAS))
|
||||||
|
{
|
||||||
|
MSG_WriteByte(&client->netchan.message, svcfte_spawnstaticsound2);
|
||||||
|
MSG_WriteByte(&client->netchan.message, 1);
|
||||||
|
}
|
||||||
else if (ISDPCLIENT(client))
|
else if (ISDPCLIENT(client))
|
||||||
MSG_WriteByte(&client->netchan.message, svcdp_spawnstaticsound2);
|
MSG_WriteByte(&client->netchan.message, svcdp_spawnstaticsound2);
|
||||||
else if (ISNQCLIENT(client))
|
else if (client->protocol == SCP_FITZ666)
|
||||||
MSG_WriteByte(&client->netchan.message, svcfitz_spawnstaticsound2);
|
MSG_WriteByte(&client->netchan.message, svcfitz_spawnstaticsound2);
|
||||||
else
|
else
|
||||||
continue; //not supported
|
continue; //not supported
|
||||||
|
@ -1707,7 +1712,12 @@ void SV_SendClientPrespawnInfo(client_t *client)
|
||||||
for (i=0 ; i<3 ; i++)
|
for (i=0 ; i<3 ; i++)
|
||||||
MSG_WriteCoord(&client->netchan.message, sound->position[i]);
|
MSG_WriteCoord(&client->netchan.message, sound->position[i]);
|
||||||
if (large)
|
if (large)
|
||||||
|
{
|
||||||
|
if (client->fteprotocolextensions2&PEXT2_LERPTIME)
|
||||||
|
MSG_WriteULEB128(&client->netchan.message, sound->soundnum);
|
||||||
|
else
|
||||||
MSG_WriteShort(&client->netchan.message, sound->soundnum);
|
MSG_WriteShort(&client->netchan.message, sound->soundnum);
|
||||||
|
}
|
||||||
else
|
else
|
||||||
MSG_WriteByte(&client->netchan.message, sound->soundnum);
|
MSG_WriteByte(&client->netchan.message, sound->soundnum);
|
||||||
MSG_WriteByte(&client->netchan.message, sound->volume);
|
MSG_WriteByte(&client->netchan.message, sound->volume);
|
||||||
|
|
Loading…
Reference in a new issue