SCI: cleanup

svn-id: r43984
This commit is contained in:
Max Horn 2009-09-06 12:59:34 +00:00
parent ae16d496b9
commit 029e3a5703
4 changed files with 10 additions and 9 deletions

@ -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);
}
}

@ -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:

@ -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);

@ -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;