[Scummvm-cvs-logs] SF.net SVN: scummvm: [29511] scummvm/trunk/sound/mods/module.cpp
Kirben at users.sourceforge.net
Kirben at users.sourceforge.net
Fri Nov 16 04:37:15 CET 2007
Revision: 29511
http://scummvm.svn.sourceforge.net/scummvm/?rev=29511&view=rev
Author: Kirben
Date: 2007-11-15 19:37:15 -0800 (Thu, 15 Nov 2007)
Log Message:
-----------
Fix loading common sample data for modules in Waxworks.
Modified Paths:
--------------
scummvm/trunk/sound/mods/module.cpp
Modified: scummvm/trunk/sound/mods/module.cpp
===================================================================
--- scummvm/trunk/sound/mods/module.cpp 2007-11-15 23:42:00 UTC (rev 29510)
+++ scummvm/trunk/sound/mods/module.cpp 2007-11-16 03:37:15 UTC (rev 29511)
@@ -112,8 +112,12 @@
108 , 101 , 96 , 90 , 85 , 80 , 76 , 72 , 68 , 64 , 60 , 57 }};
bool Module::load(Common::SeekableReadStream &st, int offs) {
+ if (offs) {
+ // Load the module with the common sample data
+ load(st, 0);
+ }
+
st.seek(offs);
-
st.read(songname, 20);
songname[20] = '\0';
@@ -160,8 +164,17 @@
}
for (int i = 0; i < NUM_SAMPLES; ++i) {
- if (offs == 0) {
- // Store locations for modules that use common samples
+ if (offs) {
+ // Restore information for modules that use common sample data
+ for (int j = 0; j < NUM_SAMPLES; ++j) {
+ if (!scumm_stricmp((const char *)commonSamples[j].name, (const char *)sample[i].name)) {
+ sample[i].len = commonSamples[j].len;
+ st.seek(commonSamples[j].offs);
+ break;
+ }
+ }
+ } else {
+ // Store information for modules that use common sample data
memcpy(commonSamples[i].name, sample[i].name, 22);
commonSamples[i].len = sample[i].len;
commonSamples[i].offs = st.pos();
@@ -171,17 +184,6 @@
if (!sample[i].len) {
sample[i].data = 0;
} else {
- if (offs != 0) {
- // For modules that use common samples
- for (int j = 0; j < NUM_SAMPLES; ++j) {
- if (!scumm_stricmp((const char *)commonSamples[j].name, (const char *)sample[i].name)) {
- sample[i].len = commonSamples[j].len;
- st.seek(commonSamples[j].offs);
- break;
- }
- }
- }
-
sample[i].data = new int8[sample[i].len];
st.read((byte *)sample[i].data, sample[i].len);
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list