diff options
author | Carsten Weisse <[email protected]> | 2005-04-26 20:17:54 +0000 |
---|---|---|
committer | Carsten Weisse <[email protected]> | 2005-04-26 20:17:54 +0000 |
commit | 60bf8f9a05c2431404de68d8b3b4caefbb1f6ffe (patch) | |
tree | cee141f7d66792cc0d6bd5a17b5671b563c5c13f /src/jake2/sound | |
parent | ce4513e421be446829008cab1547bca01066f3e6 (diff) |
bugfix: very stupid sound registration ;-)
now the dynamic sounds (weapons) will be loaded only once.
This solves the lwjgl crash too.
Diffstat (limited to 'src/jake2/sound')
-rw-r--r-- | src/jake2/sound/joal/JOALSoundImpl.java | 12 | ||||
-rw-r--r-- | src/jake2/sound/lwjgl/LWJGLSoundImpl.java | 8 |
2 files changed, 13 insertions, 7 deletions
diff --git a/src/jake2/sound/joal/JOALSoundImpl.java b/src/jake2/sound/joal/JOALSoundImpl.java index 2caf98c..348bf11 100644 --- a/src/jake2/sound/joal/JOALSoundImpl.java +++ b/src/jake2/sound/joal/JOALSoundImpl.java @@ -2,7 +2,7 @@ * JOALSoundImpl.java * Copyright (C) 2004 * - * $Id: JOALSoundImpl.java,v 1.10 2004-11-03 12:17:17 hzi Exp $ + * $Id: JOALSoundImpl.java,v 1.11 2005-04-26 20:17:54 cawe Exp $ */ package jake2.sound.joal; @@ -509,8 +509,12 @@ public final class JOALSoundImpl implements Sound { ============== */ public sfxcache_t LoadSound(sfx_t s) { + if (s.isCached) return s.cache; sfxcache_t sc = WaveLoader.LoadSound(s); - initBuffer(s); + if (sc != null) { + initBuffer(s); + s.isCached = true; + } return sc; } @@ -518,9 +522,7 @@ public final class JOALSoundImpl implements Sound { * @see jake2.sound.Sound#StartLocalSound(java.lang.String) */ public void StartLocalSound(String sound) { - sfx_t sfx; - - sfx = RegisterSound(sound); + sfx_t sfx = RegisterSound(sound); if (sfx == null) { Com.Printf("S_StartLocalSound: can't cache " + sound + "\n"); return; diff --git a/src/jake2/sound/lwjgl/LWJGLSoundImpl.java b/src/jake2/sound/lwjgl/LWJGLSoundImpl.java index eb8ed8c..3936b87 100644 --- a/src/jake2/sound/lwjgl/LWJGLSoundImpl.java +++ b/src/jake2/sound/lwjgl/LWJGLSoundImpl.java @@ -2,7 +2,7 @@ * LWJGLSoundImpl.java * Copyright (C) 2004 * - * $Id: LWJGLSoundImpl.java,v 1.4 2004-12-23 00:52:12 cawe Exp $ + * $Id: LWJGLSoundImpl.java,v 1.5 2005-04-26 20:17:54 cawe Exp $ */ package jake2.sound.lwjgl; @@ -481,8 +481,12 @@ public final class LWJGLSoundImpl implements Sound { ============== */ public sfxcache_t LoadSound(sfx_t s) { + if (s.isCached) return s.cache; sfxcache_t sc = WaveLoader.LoadSound(s); - initBuffer(s); + if (sc != null) { + initBuffer(s); + s.isCached = true; + } return sc; } |