aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Horn2009-09-06 12:59:34 +0000
committerMax Horn2009-09-06 12:59:34 +0000
commit029e3a5703cefb78d1dfe7d7b5d8713da5084675 (patch)
treee24a796476ce90be7e01f658993ed7709c86c552
parentae16d496b9f2b245167a8af3fdab3e124364047d (diff)
downloadscummvm-rg350-029e3a5703cefb78d1dfe7d7b5d8713da5084675.tar.gz
scummvm-rg350-029e3a5703cefb78d1dfe7d7b5d8713da5084675.tar.bz2
scummvm-rg350-029e3a5703cefb78d1dfe7d7b5d8713da5084675.zip
SCI: cleanup
svn-id: r43984
-rw-r--r--engines/sci/engine/intmap.cpp4
-rw-r--r--engines/sci/engine/intmap.h2
-rw-r--r--engines/sci/engine/ksound.cpp2
-rw-r--r--engines/sci/engine/vm.cpp11
4 files changed, 10 insertions, 9 deletions
diff --git a/engines/sci/engine/intmap.cpp b/engines/sci/engine/intmap.cpp
index 9efdd27996..666082713e 100644
--- a/engines/sci/engine/intmap.cpp
+++ b/engines/sci/engine/intmap.cpp
@@ -115,7 +115,7 @@ void IntMapper::saveLoadWithSerializer(Common::Serializer &s) {
clear();
while (true) {
s.syncAsSint32LE(key);
- if (key == 0xDEADBEEF)
+ if (key == INTMAPPER_MAGIC_KEY)
break;
s.syncAsSint32LE(idx);
// Insert into the IntMapper
@@ -133,7 +133,7 @@ void IntMapper::saveLoadWithSerializer(Common::Serializer &s) {
node = node->next;
}
}
- uint32 tmp = 0xDEADBEEF;
+ uint32 tmp = INTMAPPER_MAGIC_KEY;
s.syncAsSint32LE(tmp);
}
}
diff --git a/engines/sci/engine/intmap.h b/engines/sci/engine/intmap.h
index 1c028975a9..eebaf29d99 100644
--- a/engines/sci/engine/intmap.h
+++ b/engines/sci/engine/intmap.h
@@ -37,6 +37,8 @@ enum {
DCS_INT_HASH_MAX = 256
};
+const uint32 INTMAPPER_MAGIC_KEY = 0xDEADBEEF;
+
/**
* Defines a map from arbitrary integers to "small" integers, useable as index
* into small arrays. This class is somewhat like a hashmap, but not quite:
diff --git a/engines/sci/engine/ksound.cpp b/engines/sci/engine/ksound.cpp
index d235aea660..4d5517235d 100644
--- a/engines/sci/engine/ksound.cpp
+++ b/engines/sci/engine/ksound.cpp
@@ -825,7 +825,7 @@ static reg_t kDoSoundSci1Late(EngineState *s, int argc, reg_t *argv) {
s->resMan->sciVersion() >= SCI_VERSION_1_1) {
// Found a relevant audio resource, play it
s->_sound.stopAudio();
- warning("Initializing audio resource instead of requested sound resource %d\n", number);
+ warning("Initializing audio resource instead of requested sound resource %d", number);
sampleLen = s->_sound.startAudio(65535, number);
// Also create iterator, that will fire SI_FINISHED event, when the sound is done playing
s->_sound.sfx_add_song(build_timeriterator(s, sampleLen), 0, handle, number);
diff --git a/engines/sci/engine/vm.cpp b/engines/sci/engine/vm.cpp
index 2eb02f3c14..520910b1a7 100644
--- a/engines/sci/engine/vm.cpp
+++ b/engines/sci/engine/vm.cpp
@@ -1569,7 +1569,6 @@ int script_instantiate_common(ResourceManager *resMan, SegManager *segMan, int s
int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int script_nr) {
int objtype;
unsigned int objlength;
- reg_t reg;
int seg_id;
int relocation = -1;
int magic_pos_adder; // Usually 0; 2 for older SCI versions
@@ -1583,9 +1582,6 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
if (was_new)
return seg_id;
- reg.segment = seg_id;
- reg.offset = 0;
-
Script *scr = segMan->getScript(seg_id);
if (oldScriptHeader) {
@@ -1601,7 +1597,7 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
magic_pos_adder = 2; // Step over the funny prefix
if (locals_nr)
- segMan->scriptInitialiseLocalsZero(reg.segment, locals_nr);
+ segMan->scriptInitialiseLocalsZero(seg_id, locals_nr);
} else {
scr->mcpyInOut(0, script->data, script->size);
@@ -1611,9 +1607,12 @@ int script_instantiate_sci0(ResourceManager *resMan, SegManager *segMan, int scr
// Now do a first pass through the script objects to find the
// export table and local variable block
- objlength = 0;
+ reg_t reg;
+ reg.segment = seg_id;
reg.offset = magic_pos_adder;
+ objlength = 0;
+
do {
reg_t data_base;
reg_t addr;