Use LUT instead of case for spike sound effects. Faster and more compact, though less legible.

This commit is contained in:
Ragnvald Maartmann-Moe IV 2002-08-06 19:46:13 +00:00
parent ff14989edf
commit e56404d242

View file

@ -293,6 +293,9 @@ CL_ParseTEnt (void)
int colorStart, colorLength; int colorStart, colorLength;
int cnt = -1; int cnt = -1;
vec3_t pos; vec3_t pos;
sfx_t * spike_sound[] = {
cl_sfx_ric3, cl_sfx_ric3, cl_sfx_ric2, cl_sfx_ric1,
};
type = MSG_ReadByte (net_message); type = MSG_ReadByte (net_message);
switch (type) { switch (type) {
@ -311,40 +314,32 @@ CL_ParseTEnt (void)
case TE_SPIKE: // spike hitting wall case TE_SPIKE: // spike hitting wall
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_SpikeEffect (pos); R_SpikeEffect (pos);
{
int i;
sfx_t *sound;
switch (rand () % 20) { i = (rand () % 20) - 16;
case 19: if (i >= 0)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); sound = spike_sound[i];
break; else
case 18: sound = cl_sfx_tink1;
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); S_StartSound (-1, 0, sound, pos, 1, 1);
break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} }
break; break;
case TE_SUPERSPIKE: // super spike hitting wall case TE_SUPERSPIKE: // super spike hitting wall
MSG_ReadCoordV (net_message, pos); MSG_ReadCoordV (net_message, pos);
R_SuperSpikeEffect (pos); R_SuperSpikeEffect (pos);
{
int i;
sfx_t *sound;
switch (rand () % 20) { i = (rand () % 20) - 16;
case 19: if (i >= 0)
S_StartSound (-1, 0, cl_sfx_ric1, pos, 1, 1); sound = spike_sound[i];
break; else
case 18: sound = cl_sfx_tink1;
S_StartSound (-1, 0, cl_sfx_ric2, pos, 1, 1); S_StartSound (-1, 0, sound, pos, 1, 1);
break;
case 17:
case 16:
S_StartSound (-1, 0, cl_sfx_ric3, pos, 1, 1);
break;
default:
S_StartSound (-1, 0, cl_sfx_tink1, pos, 1, 1);
} }
break; break;