summaryrefslogtreecommitdiff
path: root/sys/src/games
diff options
context:
space:
mode:
authorcinap_lenrek <cinap_lenrek@felloff.net>2015-10-08 00:37:54 +0200
committercinap_lenrek <cinap_lenrek@felloff.net>2015-10-08 00:37:54 +0200
commit285d96be4d642def1221e184f63bb9b75df75071 (patch)
tree7254d666978797049d5b37ca0cb7a487fdfaf72a /sys/src/games
parentfa1f9f7ca6d2c7a6e31ef4612de4cf9653b84f7a (diff)
doom: fix bogus pointer arithmetic, do sfx initialization in two passes for linked sounds
Diffstat (limited to 'sys/src/games')
-rw-r--r--sys/src/games/doom/i_sound.c9
1 files changed, 6 insertions, 3 deletions
diff --git a/sys/src/games/doom/i_sound.c b/sys/src/games/doom/i_sound.c
index 5ff4715cd..a9a9cc3cd 100644
--- a/sys/src/games/doom/i_sound.c
+++ b/sys/src/games/doom/i_sound.c
@@ -135,17 +135,20 @@ void I_InitSound(void)
/* Initialize external data (all sounds) at start, keep static. */
for (i=1 ; i<NUMSFX ; i++)
{
- /* Alias? Example is the chaingun sound linked to pistol. */
if (!S_sfx[i].link)
{
/* Load data from WAD file. */
S_sfx[i].data = getsfx( S_sfx[i].name, &lengths[i] );
}
- else
+ }
+ /* Alias? Example is the chaingun sound linked to pistol. */
+ for (i=1 ; i<NUMSFX ; i++)
+ {
+ if (S_sfx[i].link)
{
/* Previously loaded already? */
S_sfx[i].data = S_sfx[i].link->data;
- lengths[i] = lengths[(S_sfx[i].link - S_sfx)/sizeof(sfxinfo_t)];
+ lengths[i] = lengths[S_sfx[i].link - S_sfx];
}
}