about summary refs log tree commit diff
path: root/src/engine/client/snd.cpp
diff options
context:
space:
mode:
authorJoel de Vahl <joel@stalverk80.se>2007-07-14 15:57:40 +0000
committerJoel de Vahl <joel@stalverk80.se>2007-07-14 15:57:40 +0000
commitf2e8de56c8236961e874a4d356495a0e9b6ec8e1 (patch)
treef4ff97d1d2fce6022b592c0e1c48eb90ba4ff2ab /src/engine/client/snd.cpp
parentc74efbbdb2e72e2d3ec01d7e606dc1f2a4f36451 (diff)
downloadzcatch-f2e8de56c8236961e874a4d356495a0e9b6ec8e1.tar.gz
zcatch-f2e8de56c8236961e874a4d356495a0e9b6ec8e1.zip
Swaps for big endian systems.
Diffstat (limited to 'src/engine/client/snd.cpp')
-rw-r--r--src/engine/client/snd.cpp7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/engine/client/snd.cpp b/src/engine/client/snd.cpp
index fa8ba07c..5944655e 100644
--- a/src/engine/client/snd.cpp
+++ b/src/engine/client/snd.cpp
@@ -447,6 +447,13 @@ int snd_load_wav(const char *filename)
 				snd.data = (short*)mem_alloc(chunk_size, 1);
 				file.read(snd.data, chunk_size);
 				snd.num_samples = chunk_size/(2);
+#if defined(CONF_ARCH_ENDIAN_BIG)
+				for(unsigned i = 0; i < (unsigned)snd.num_samples; i++)
+				{
+					unsigned j = i << 1;
+					snd.data[i] = ((short)((char*)snd.data)[j]) + ((short)((char*)snd.data)[j+1] << 8);
+				}
+#endif
 				snd.sustain_start = -1;
 				snd.sustain_end = -1;
 				snd.last_played = 0;