* Renamed several methods in favor of a somewhat more uniform naming scheme: setupFOO for stuff that inits static data (i.e. will be called only once, or after loading savegames), vs. resetFOO / updateFOO methods which are called frequently and (re)set dynamic data.

* Doing this, split scummInit into setupScumm and resetScumm methods
* Moved some init code to new methods (huuuuge init methods are hard to read, and hard to customize using subclassing)
* Renmaed various setup???Palette methods to set???Palette
* Some minor cleanup / tweaks

svn-id: r22227
This commit is contained in:
Max Horn 2006-04-29 16:24:39 +00:00
parent ad5a89a04b
commit c4df5037dc
17 changed files with 239 additions and 259 deletions

View file

@ -862,7 +862,7 @@ static const int v1MMActorTalkColor[25] = {
1, 7, 2, 14, 8, 1, 3, 7, 7, 12, 1, 13, 1, 4, 5, 5, 4, 3, 1, 5, 1, 1, 1, 7, 7 1, 7, 2, 14, 8, 1, 3, 7, 7, 12, 1, 13, 1, 4, 5, 5, 4, 3, 1, 5, 1, 1, 1, 7, 7
}; };
void ScummEngine::setupV1ActorTalkColor() { void ScummEngine::resetV1ActorTalkColor() {
int i; int i;
for (i = 1; i < _numActors; i++) { for (i = 1; i < _numActors; i++) {

View file

@ -73,10 +73,6 @@ static const byte default_v6_cursor[] = {
0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x0F,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF, 0x00,0x0F,0x00, 0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,0xFF,
}; };
void ScummEngine::setupCursor() {
_cursor.animate = 1;
}
void ScummEngine_v5::animateCursor() { void ScummEngine_v5::animateCursor() {
if (_cursor.animate) { if (_cursor.animate) {
if (!(_cursor.animateIndex & 0x1)) { if (!(_cursor.animateIndex & 0x1)) {

View file

@ -748,8 +748,6 @@ void ConfigDialog::close() {
} }
GUI_OptionsDialog::close(); GUI_OptionsDialog::close();
_vm->setupVolumes();
} }
void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) { void ConfigDialog::handleCommand(CommandSender *sender, uint32 cmd, uint32 data) {

View file

@ -66,7 +66,7 @@ public:
ScummEngine_v60he(OSystem *syst, const DetectorResult &dr); ScummEngine_v60he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v60he(); ~ScummEngine_v60he();
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
@ -144,7 +144,7 @@ protected:
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void saveOrLoad(Serializer *s); virtual void saveOrLoad(Serializer *s);
@ -251,7 +251,7 @@ protected:
public: public:
ScummEngine_v72he(OSystem *syst, const DetectorResult &dr); ScummEngine_v72he(OSystem *syst, const DetectorResult &dr);
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
@ -259,7 +259,7 @@ protected:
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void readArrayFromIndexFile(); virtual void readArrayFromIndexFile();
virtual byte *getStringAddress(int i); virtual byte *getStringAddress(int i);
@ -368,7 +368,7 @@ protected:
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void initCharset(int charset); virtual void initCharset(int charset);
@ -436,7 +436,7 @@ public:
ScummEngine_v90he(OSystem *syst, const DetectorResult &dr); ScummEngine_v90he(OSystem *syst, const DetectorResult &dr);
~ScummEngine_v90he(); ~ScummEngine_v90he();
virtual void scummInit(); virtual void resetScumm();
LogicHE *_logicHE; LogicHE *_logicHE;
Sprite *_sprite; Sprite *_sprite;
@ -450,7 +450,7 @@ protected:
virtual void scummLoop_handleDrawing(); virtual void scummLoop_handleDrawing();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void saveOrLoad(Serializer *s); virtual void saveOrLoad(Serializer *s);
@ -534,10 +534,10 @@ class ScummEngine_v99he : public ScummEngine_v90he {
public: public:
ScummEngine_v99he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v90he(syst, dr) {} ScummEngine_v99he(OSystem *syst, const DetectorResult &dr) : ScummEngine_v90he(syst, dr) {}
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void initScummVars(); virtual void resetScummVars();
virtual void readMAXS(int blockSize); virtual void readMAXS(int blockSize);

View file

@ -548,7 +548,7 @@ void ScummEngine_v60he::o60_roomOps() {
b = pop(); b = pop();
a = pop(); a = pop();
if (_game.heversion == 60) if (_game.heversion == 60)
setupShadowPalette(a, b, c, d, e, 0, 256); setShadowPalette(a, b, c, d, e, 0, 256);
break; break;
case 186: // SO_ROOM_TRANSFORM case 186: // SO_ROOM_TRANSFORM

View file

@ -435,7 +435,7 @@ void ScummEngine::processKbd(bool smushMode) {
vol = Audio::Mixer::kMaxMixerVolume; vol = Audio::Mixer::kMaxMixerVolume;
ConfMan.setInt("music_volume", vol); ConfMan.setInt("music_volume", vol);
setupVolumes(); updateVolumes();
} else if (_lastKeyHit == '-' || _lastKeyHit == '+') { // Change text speed } else if (_lastKeyHit == '-' || _lastKeyHit == '+') { // Change text speed
if (_lastKeyHit == '+' && _defaultTalkDelay > 0) if (_lastKeyHit == '+' && _defaultTalkDelay > 0)
_defaultTalkDelay--; _defaultTalkDelay--;

View file

@ -67,7 +67,7 @@ protected:
virtual void scummLoop_handleActors(); virtual void scummLoop_handleActors();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void decodeParseString(); virtual void decodeParseString();
virtual void saveOrLoad(Serializer *s); virtual void saveOrLoad(Serializer *s);
@ -206,16 +206,16 @@ class ScummEngine_v4 : public ScummEngine_v5 {
public: public:
ScummEngine_v4(OSystem *syst, const DetectorResult &dr); ScummEngine_v4(OSystem *syst, const DetectorResult &dr);
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void readIndexFile(); virtual void readIndexFile();
virtual void loadCharset(int no); virtual void loadCharset(int no);
virtual void loadRoomObjects(); virtual void resetRoomObjects();
virtual void readMAXS(int blockSize); virtual void readMAXS(int blockSize);
virtual void readGlobalObjects(); virtual void readGlobalObjects();
virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); virtual void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
}; };
/** /**
@ -240,9 +240,9 @@ public:
protected: protected:
virtual void readResTypeList(int id, const char *name); virtual void readResTypeList(int id, const char *name);
virtual void readIndexFile(); virtual void readIndexFile();
virtual void loadRoomSubBlocks(); virtual void setupRoomSubBlocks();
virtual void initRoomSubBlocks(); virtual void resetRoomSubBlocks();
virtual void loadRoomObjects(); virtual void resetRoomObjects();
}; };
/** /**
@ -270,7 +270,7 @@ protected:
public: public:
ScummEngine_v2(OSystem *syst, const DetectorResult &dr); ScummEngine_v2(OSystem *syst, const DetectorResult &dr);
virtual void scummInit(); virtual void resetScumm();
void checkV2MouseOver(Common::Point pos); void checkV2MouseOver(Common::Point pos);
void checkV2Inventory(int x, int y); void checkV2Inventory(int x, int y);
@ -282,7 +282,7 @@ protected:
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void decodeParseString(); virtual void decodeParseString();
virtual void readIndexFile(); virtual void readIndexFile();
@ -416,17 +416,17 @@ protected:
public: public:
ScummEngine_c64(OSystem *syst, const DetectorResult &dr); ScummEngine_c64(OSystem *syst, const DetectorResult &dr);
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL); virtual void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
virtual void setupOpcodes(); virtual void setupOpcodes();
virtual void executeOpcode(byte i); virtual void executeOpcode(byte i);
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void decodeParseString(); virtual void decodeParseString();
virtual void saveOrLoad(Serializer *s); virtual void saveOrLoad(Serializer *s);
@ -568,7 +568,7 @@ protected:
public: public:
ScummEngine_v6(OSystem *syst, const DetectorResult &dr); ScummEngine_v6(OSystem *syst, const DetectorResult &dr);
virtual void scummInit(); virtual void resetScumm();
protected: protected:
virtual void setupOpcodes(); virtual void setupOpcodes();
@ -838,7 +838,7 @@ protected:
virtual void scummLoop_handleDrawing(); virtual void scummLoop_handleDrawing();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void akos_processQueue(); virtual void akos_processQueue();
@ -890,7 +890,7 @@ protected:
virtual const char *getOpcodeDesc(byte i); virtual const char *getOpcodeDesc(byte i);
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void decodeParseString(int m, int n); virtual void decodeParseString(int m, int n);
virtual void readArrayFromIndexFile(); virtual void readArrayFromIndexFile();

View file

@ -543,7 +543,7 @@ void ScummEngine::restoreFlObjects() {
_numStoredFlObjects = 0; _numStoredFlObjects = 0;
} }
void ScummEngine::loadRoomObjects() { void ScummEngine::resetRoomObjects() {
int i, j; int i, j;
ObjectData *od; ObjectData *od;
const byte *ptr; const byte *ptr;
@ -611,13 +611,13 @@ void ScummEngine::loadRoomObjects() {
for (i = 1; i < _numLocalObjects; i++) { for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr && !_objs[i].fl_object_index) if (_objs[i].obj_nr && !_objs[i].fl_object_index)
setupRoomObject(&_objs[i], room); resetRoomObject(&_objs[i], room);
} }
CHECK_HEAP CHECK_HEAP
} }
void ScummEngine_v3old::loadRoomObjects() { void ScummEngine_v3old::resetRoomObjects() {
int i; int i;
ObjectData *od; ObjectData *od;
const byte *room, *ptr; const byte *room, *ptr;
@ -648,7 +648,7 @@ void ScummEngine_v3old::loadRoomObjects() {
od->OBIMoffset = READ_LE_UINT16(ptr); od->OBIMoffset = READ_LE_UINT16(ptr);
od->OBCDoffset = READ_LE_UINT16(ptr + 2 * _numObjectsInRoom); od->OBCDoffset = READ_LE_UINT16(ptr + 2 * _numObjectsInRoom);
setupRoomObject(od, room); resetRoomObject(od, room);
ptr += 2; ptr += 2;
@ -662,7 +662,7 @@ void ScummEngine_v3old::loadRoomObjects() {
CHECK_HEAP CHECK_HEAP
} }
void ScummEngine_v4::loadRoomObjects() { void ScummEngine_v4::resetRoomObjects() {
int i, j; int i, j;
ObjectData *od; ObjectData *od;
const byte *ptr; const byte *ptr;
@ -711,14 +711,14 @@ void ScummEngine_v4::loadRoomObjects() {
for (i = 1; i < _numLocalObjects; i++) { for (i = 1; i < _numLocalObjects; i++) {
if (_objs[i].obj_nr && !_objs[i].fl_object_index) { if (_objs[i].obj_nr && !_objs[i].fl_object_index) {
setupRoomObject(&_objs[i], room); resetRoomObject(&_objs[i], room);
} }
} }
CHECK_HEAP CHECK_HEAP
} }
void ScummEngine_c64::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) { void ScummEngine_c64::resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
assert(room); assert(room);
const byte *ptr = room + od->OBCDoffset; const byte *ptr = room + od->OBCDoffset;
ptr -= 2; ptr -= 2;
@ -742,7 +742,7 @@ void ScummEngine_c64::setupRoomObject(ObjectData *od, const byte *room, const by
od->height = *(ptr + 14) & 0xf8; od->height = *(ptr + 14) & 0xf8;
} }
void ScummEngine_v4::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) { void ScummEngine_v4::resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
assert(room); assert(room);
const byte *ptr = room + od->OBCDoffset; const byte *ptr = room + od->OBCDoffset;
@ -775,7 +775,7 @@ void ScummEngine_v4::setupRoomObject(ObjectData *od, const byte *room, const byt
} }
} }
void ScummEngine::setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr) { void ScummEngine::resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr) {
const CodeHeader *cdhd = NULL; const CodeHeader *cdhd = NULL;
const ImageHeader *imhd = NULL; const ImageHeader *imhd = NULL;
@ -1784,7 +1784,7 @@ void ScummEngine::loadFlObject(uint object, uint room) {
res.unlock(rtRoomScripts, room); res.unlock(rtRoomScripts, room);
// Setup local object flags // Setup local object flags
setupRoomObject(od, flob, flob); resetRoomObject(od, flob, flob);
od->fl_object_index = slot; od->fl_object_index = slot;
} }

View file

@ -31,7 +31,45 @@
namespace Scumm { namespace Scumm {
void ScummEngine::setupC64Palette() { void ScummEngine::resetPalette() {
if (_game.version == 1) {
if (_game.platform == Common::kPlatformC64) {
setC64Palette();
} else if (_game.platform == Common::kPlatformNES) {
setNESPalette();
} else {
setV1Palette();
}
} else if (_game.features & GF_16COLOR) {
switch (_renderMode) {
case Common::kRenderEGA:
setEGAPalette();
break;
case Common::kRenderAmiga:
setAmigaPalette();
break;
case Common::kRenderCGA:
setCGAPalette();
break;
case Common::kRenderHercA:
case Common::kRenderHercG:
setHercPalette();
break;
default:
if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST))
setAmigaPalette();
else
setEGAPalette();
}
} else
setDirtyColors(0, 255);
}
void ScummEngine::setC64Palette() {
setPalColor( 0, 0x00, 0x00, 0x00); setPalColor( 0, 0x00, 0x00, 0x00);
setPalColor( 1, 0xFD, 0xFE, 0xFC); setPalColor( 1, 0xFD, 0xFE, 0xFC);
setPalColor( 2, 0xBE, 0x1A, 0x24); setPalColor( 2, 0xBE, 0x1A, 0x24);
@ -49,10 +87,13 @@ void ScummEngine::setupC64Palette() {
setPalColor(14, 0x5F, 0x53, 0xFE); setPalColor(14, 0x5F, 0x53, 0xFE);
setPalColor(15, 0xA4, 0xA7, 0xA2); setPalColor(15, 0xA4, 0xA7, 0xA2);
// Use 17 color table for v1 games to allow correct color for inventory and
// sentence line Original games used some kind of dynamic color table
// remapping between rooms.
setPalColor(16, 255, 85, 255); setPalColor(16, 255, 85, 255);
} }
void ScummEngine::setupNESPalette() { void ScummEngine::setNESPalette() {
setPalColor(0x00,0x24,0x24,0x24); // 0x1D setPalColor(0x00,0x24,0x24,0x24); // 0x1D
setPalColor(0x01,0x00,0x24,0x92); setPalColor(0x01,0x00,0x24,0x92);
setPalColor(0x02,0x00,0x00,0xDB); setPalColor(0x02,0x00,0x00,0xDB);
@ -122,7 +163,7 @@ void ScummEngine::setupNESPalette() {
setPalColor(0x3F,0x00,0x00,0x00); setPalColor(0x3F,0x00,0x00,0x00);
} }
void ScummEngine::setupAmigaPalette() { void ScummEngine::setAmigaPalette() {
setPalColor( 0, 0, 0, 0); setPalColor( 0, 0, 0, 0);
setPalColor( 1, 0, 0, 187); setPalColor( 1, 0, 0, 187);
setPalColor( 2, 0, 187, 0); setPalColor( 2, 0, 187, 0);
@ -141,7 +182,7 @@ void ScummEngine::setupAmigaPalette() {
setPalColor(15, 255, 255, 255); setPalColor(15, 255, 255, 255);
} }
void ScummEngine::setupHercPalette() { void ScummEngine::setHercPalette() {
setPalColor( 0, 0, 0, 0); setPalColor( 0, 0, 0, 0);
if (_renderMode == Common::kRenderHercA) if (_renderMode == Common::kRenderHercA)
@ -155,7 +196,7 @@ void ScummEngine::setupHercPalette() {
setPalColor(15, 255, 255, 255); setPalColor(15, 255, 255, 255);
} }
void ScummEngine::setupCGAPalette() { void ScummEngine::setCGAPalette() {
setPalColor( 0, 0, 0, 0); setPalColor( 0, 0, 0, 0);
setPalColor( 1, 0, 168, 168); setPalColor( 1, 0, 168, 168);
setPalColor( 2, 168, 0, 168); setPalColor( 2, 168, 0, 168);
@ -167,7 +208,7 @@ void ScummEngine::setupCGAPalette() {
setPalColor(15, 255, 255, 255); setPalColor(15, 255, 255, 255);
} }
void ScummEngine::setupEGAPalette() { void ScummEngine::setEGAPalette() {
setPalColor( 0, 0, 0, 0); setPalColor( 0, 0, 0, 0);
setPalColor( 1, 0, 0, 170); setPalColor( 1, 0, 0, 170);
setPalColor( 2, 0, 170, 0); setPalColor( 2, 0, 170, 0);
@ -186,7 +227,7 @@ void ScummEngine::setupEGAPalette() {
setPalColor(15, 255, 255, 255); setPalColor(15, 255, 255, 255);
} }
void ScummEngine::setupV1Palette() { void ScummEngine::setV1Palette() {
setPalColor( 0, 0, 0, 0); setPalColor( 0, 0, 0, 0);
setPalColor( 1, 255, 255, 255); setPalColor( 1, 255, 255, 255);
setPalColor( 2, 170, 0, 0); setPalColor( 2, 170, 0, 0);
@ -530,16 +571,16 @@ void ScummEngine::palManipulate() {
_palManipCounter--; _palManipCounter--;
} }
void ScummEngine::setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor) { void ScummEngine::setShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor) {
byte *table; byte *table;
int i; int i;
byte *curpal; byte *curpal;
if (slot < 0 || slot >= NUM_SHADOW_PALETTE) if (slot < 0 || slot >= NUM_SHADOW_PALETTE)
error("setupShadowPalette: invalid slot %d", slot); error("setShadowPalette: invalid slot %d", slot);
if (startColor < 0 || startColor > 255 || endColor < 0 || startColor > 255 || endColor < startColor) if (startColor < 0 || startColor > 255 || endColor < 0 || startColor > 255 || endColor < startColor)
error("setupShadowPalette: invalid range from %d to %d", startColor, endColor); error("setShadowPalette: invalid range from %d to %d", startColor, endColor);
table = _shadowPalette + slot * 256; table = _shadowPalette + slot * 256;
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
@ -560,7 +601,7 @@ static inline uint colorWeight(int red, int green, int blue) {
return 3 * red * red + 6 * green * green + 2 * blue * blue; return 3 * red * red + 6 * green * green + 2 * blue * blue;
} }
void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end) { void ScummEngine::setShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end) {
const byte *basepal = getPalettePtr(_curPalIndex, _roomResource); const byte *basepal = getPalettePtr(_curPalIndex, _roomResource);
const byte *compareptr; const byte *compareptr;
const byte *pal = basepal + start * 3; const byte *pal = basepal + start * 3;
@ -569,7 +610,7 @@ void ScummEngine::setupShadowPalette(int redScale, int greenScale, int blueScale
// This is an implementation based on the original games code. // This is an implementation based on the original games code.
// //
// The four known rooms where setupShadowPalette is used in atlantis are: // The four known rooms where setShadowPalette is used in atlantis are:
// //
// 1) FOA Room 53: subway departing Knossos for Atlantis. // 1) FOA Room 53: subway departing Knossos for Atlantis.
// 2) FOA Room 48: subway crashing into the Atlantis entrance area // 2) FOA Room 48: subway crashing into the Atlantis entrance area

View file

@ -143,12 +143,12 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
return; return;
} }
loadRoomSubBlocks(); setupRoomSubBlocks();
initRoomSubBlocks(); resetRoomSubBlocks();
initBGBuffers(_roomHeight); initBGBuffers(_roomHeight);
loadRoomObjects(); resetRoomObjects();
restoreFlObjects(); restoreFlObjects();
if (VAR_ROOM_WIDTH != 0xFF && VAR_ROOM_HEIGHT != 0xFF) { if (VAR_ROOM_WIDTH != 0xFF && VAR_ROOM_HEIGHT != 0xFF) {
@ -225,7 +225,7 @@ void ScummEngine::startScene(int room, Actor *a, int objectNr) {
* late on. * late on.
* So it is possible to call this after loading a savegame. * So it is possible to call this after loading a savegame.
*/ */
void ScummEngine::loadRoomSubBlocks() { void ScummEngine::setupRoomSubBlocks() {
int i; int i;
const byte *ptr; const byte *ptr;
byte *roomptr, *searchptr, *roomResPtr = 0; byte *roomptr, *searchptr, *roomResPtr = 0;
@ -449,7 +449,7 @@ void ScummEngine::loadRoomSubBlocks() {
* All of the things setup in here can be modified later on by scripts. * All of the things setup in here can be modified later on by scripts.
* So it is not appropriate to call it after loading a savegame. * So it is not appropriate to call it after loading a savegame.
*/ */
void ScummEngine::initRoomSubBlocks() { void ScummEngine::resetRoomSubBlocks() {
int i; int i;
const byte *ptr; const byte *ptr;
byte *roomptr; byte *roomptr;
@ -561,7 +561,7 @@ void ScummEngine::initRoomSubBlocks() {
} }
void ScummEngine_v3old::loadRoomSubBlocks() { void ScummEngine_v3old::setupRoomSubBlocks() {
const byte *ptr; const byte *ptr;
byte *roomptr, *searchptr = 0; byte *roomptr, *searchptr = 0;
const RoomHeader *rmhd; const RoomHeader *rmhd;
@ -697,7 +697,7 @@ void ScummEngine_v3old::loadRoomSubBlocks() {
gdi.roomChanged(roomptr, _IM00_offs, 255); gdi.roomChanged(roomptr, _IM00_offs, 255);
} }
void ScummEngine_v3old::initRoomSubBlocks() { void ScummEngine_v3old::resetRoomSubBlocks() {
int i; int i;
const byte *ptr; const byte *ptr;
byte *roomptr; byte *roomptr;

View file

@ -257,7 +257,7 @@ bool ScummEngine::loadState(int slot, bool compat) {
res.nukeResource(i, j); res.nukeResource(i, j);
} }
initScummVars(); resetScummVars();
if (_game.features & GF_OLD_BUNDLE) if (_game.features & GF_OLD_BUNDLE)
loadCharset(0); // FIXME - HACK ? loadCharset(0); // FIXME - HACK ?
@ -270,7 +270,7 @@ bool ScummEngine::loadState(int slot, bool compat) {
delete in; delete in;
// Update volume settings // Update volume settings
setupVolumes(); updateVolumes();
// Init NES costume data // Init NES costume data
if (_game.platform == Common::kPlatformNES) { if (_game.platform == Common::kPlatformNES) {
@ -331,53 +331,14 @@ bool ScummEngine::loadState(int slot, bool compat) {
} }
} }
// We could simply dirty colours 0-15 for 16-colour games -- nowadays // Reset the palette.
// they handle their palette pretty much like the more recent games resetPalette();
// anyway. There was a time, though, when re-initializing was necessary
// for backwards compatibility, and it may still prove useful if we
// ever add options for using different 16-colour palettes.
if (_game.version == 1) {
if (_game.platform == Common::kPlatformC64) {
setupC64Palette();
} else if (_game.platform == Common::kPlatformNES) {
setupNESPalette();
} else {
setupV1Palette();
}
} else if (_game.features & GF_16COLOR) {
switch (_renderMode) {
case Common::kRenderEGA:
setupEGAPalette();
break;
case Common::kRenderAmiga:
setupAmigaPalette();
break;
case Common::kRenderCGA:
setupCGAPalette();
break;
case Common::kRenderHercA:
case Common::kRenderHercG:
setupHercPalette();
break;
default:
if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST))
setupAmigaPalette();
else
setupEGAPalette();
}
} else
setDirtyColors(0, 255);
if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version == 1) if (hdr.ver < VER(35) && _game.id == GID_MANIAC && _game.version == 1)
setupV1ActorTalkColor(); resetV1ActorTalkColor();
// Load the static room data // Load the static room data
loadRoomSubBlocks(); setupRoomSubBlocks();
if (!(_game.features & GF_NEW_CAMERA)) { if (!(_game.features & GF_NEW_CAMERA)) {
camera._last.x = camera._cur.x; camera._last.x = camera._cur.x;

View file

@ -1946,7 +1946,7 @@ void ScummEngine_v5::o5_roomOps() {
_opcode = fetchScriptByte(); _opcode = fetchScriptByte();
d = getVarOrDirectByte(PARAM_1); d = getVarOrDirectByte(PARAM_1);
e = getVarOrDirectByte(PARAM_2); e = getVarOrDirectByte(PARAM_2);
setupShadowPalette(a, b, c, d, e, 0, 256); setShadowPalette(a, b, c, d, e, 0, 256);
break; break;
case 13: // SO_SAVE_STRING case 13: // SO_SAVE_STRING

View file

@ -1727,7 +1727,7 @@ void ScummEngine_v6::o6_roomOps() {
c = pop(); c = pop();
b = pop(); b = pop();
a = pop(); a = pop();
setupShadowPalette(a, b, c, d, e, 0, 256); setShadowPalette(a, b, c, d, e, 0, 256);
break; break;
case 184: // SO_SAVE_STRING case 184: // SO_SAVE_STRING
@ -2571,10 +2571,10 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
a->setScale((unsigned char)args[2], -1); a->setScale((unsigned char)args[2], -1);
break; break;
case 108: case 108:
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]); setShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
break; break;
case 109: case 109:
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]); setShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
break; break;
case 114: case 114:
error("o6_kernelSetFunctions: stub114()"); error("o6_kernelSetFunctions: stub114()");
@ -2634,7 +2634,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
// Case 108 and 109 share the same function // Case 108 and 109 share the same function
if (num != 6) if (num != 6)
error("o6_kernelSetFunctions sub op %d: expected 6 params but got %d", args[0], num); error("o6_kernelSetFunctions sub op %d: expected 6 params but got %d", args[0], num);
setupShadowPalette(args[3], args[4], args[5], args[1], args[2], 0, 256); setShadowPalette(args[3], args[4], args[5], args[1], args[2], 0, 256);
break; break;
case 110: case 110:
_charset->clearCharsetMask(); _charset->clearCharsetMask();
@ -2644,7 +2644,7 @@ void ScummEngine_v6::o6_kernelSetFunctions() {
a->_shadowMode = args[2] + args[3]; a->_shadowMode = args[2] + args[3];
break; break;
case 112: /* palette shift? */ case 112: /* palette shift? */
setupShadowPalette(args[3], args[4], args[5], args[1], args[2], args[6], args[7]); setShadowPalette(args[3], args[4], args[5], args[1], args[2], args[6], args[7]);
break; break;
case 114: case 114:
// Sam & Max film noir mode // Sam & Max film noir mode

View file

@ -1292,10 +1292,10 @@ void ScummEngine_v8::o8_kernelSetFunctions() {
_quit = true; _quit = true;
break; break;
case 108: // buildPaletteShadow case 108: // buildPaletteShadow
setupShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]); setShadowPalette(args[1], args[2], args[3], args[4], args[5], args[6]);
break; break;
case 109: // setPaletteShadow case 109: // setPaletteShadow
setupShadowPalette(0, args[1], args[2], args[3], args[4], args[5]); setShadowPalette(0, args[1], args[2], args[3], args[4], args[5]);
break; break;
case 118: // blastShadowObject case 118: // blastShadowObject
enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3); enqueueObject(args[1], args[2], args[3], args[4], args[5], args[6], args[7], args[8], 3);

View file

@ -955,6 +955,25 @@ int ScummEngine::init() {
initCommonGFX(defaultTo1XScaler); initCommonGFX(defaultTo1XScaler);
_system->endGFXTransaction(); _system->endGFXTransaction();
setupScumm();
readIndexFile();
resetScumm();
resetScummVars();
if (_imuse) {
_imuse->setBase(res.address[rtSound]);
}
if (_game.version >= 5)
_sound->setupSound();
return 0;
}
void ScummEngine::setupScumm() {
// On some systems it's not safe to run CD audio games from the CD. // On some systems it's not safe to run CD audio games from the CD.
if (_game.features & GF_AUDIOTRACKS) { if (_game.features & GF_AUDIOTRACKS) {
checkCD(); checkCD();
@ -980,33 +999,10 @@ int ScummEngine::init() {
loadCJKFont(); loadCJKFont();
// Create the charset renderer // Create the charset renderer
if (_game.platform == Common::kPlatformNES) setupCharsetRenderer();
_charset = new CharsetRendererNES(this);
else if (_game.version <= 2)
_charset = new CharsetRendererV2(this, _language);
else if (_game.version == 3)
_charset = new CharsetRendererV3(this);
#ifndef DISABLE_SCUMM_7_8
else if (_game.version == 8)
_charset = new CharsetRendererNut(this);
#endif
else
_charset = new CharsetRendererClassic(this);
// Create the costume renderer // Create the costume renderer
if (_game.features & GF_NEW_COSTUMES) { setupCostumeRenderer();
_costumeRenderer = new AkosRenderer(this);
_costumeLoader = new AkosCostumeLoader(this);
} else if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
_costumeRenderer = new C64CostumeRenderer(this);
_costumeLoader = new C64CostumeLoader(this);
} else if (_game.platform == Common::kPlatformNES) {
_costumeRenderer = new NESCostumeRenderer(this);
_costumeLoader = new NESCostumeLoader(this);
} else {
_costumeRenderer = new ClassicCostumeRenderer(this);
_costumeLoader = new ClassicCostumeLoader(this);
}
#ifndef DISABLE_SCUMM_7_8 #ifndef DISABLE_SCUMM_7_8
// Create FT INSANE object // Create FT INSANE object
@ -1058,8 +1054,6 @@ int ScummEngine::init() {
_bootParam = -1; _bootParam = -1;
} }
readIndexFile();
#ifdef PALMOS_68K #ifdef PALMOS_68K
if (_game.features & GF_NEW_COSTUMES) if (_game.features & GF_NEW_COSTUMES)
res._maxHeapThreshold = gVars->memory[kMemScummNewCostGames]; res._maxHeapThreshold = gVars->memory[kMemScummNewCostGames];
@ -1076,16 +1070,6 @@ int ScummEngine::init() {
#endif #endif
res._minHeapThreshold = 400000; res._minHeapThreshold = 400000;
scummInit();
initScummVars();
if (_imuse) {
_imuse->setBase(res.address[rtSound]);
}
if (_game.version >= 5)
_sound->setupSound();
#if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__)) #if (defined(PALMOS_ARM) || defined(PALMOS_DEBUG) || defined(__GP32__))
Graphics::initfonts(); Graphics::initfonts();
#endif #endif
@ -1093,15 +1077,44 @@ int ScummEngine::init() {
// Create debugger // Create debugger
if (!_debugger) if (!_debugger)
_debugger = new ScummDebugger(this); _debugger = new ScummDebugger(this);
return 0;
} }
void ScummEngine::scummInit() { void ScummEngine::setupCharsetRenderer() {
if (_game.platform == Common::kPlatformNES)
_charset = new CharsetRendererNES(this);
else if (_game.version <= 2)
_charset = new CharsetRendererV2(this, _language);
else if (_game.version == 3)
_charset = new CharsetRendererV3(this);
#ifndef DISABLE_SCUMM_7_8
else if (_game.version == 8)
_charset = new CharsetRendererNut(this);
#endif
else
_charset = new CharsetRendererClassic(this);
}
void ScummEngine::setupCostumeRenderer() {
if (_game.features & GF_NEW_COSTUMES) {
_costumeRenderer = new AkosRenderer(this);
_costumeLoader = new AkosCostumeLoader(this);
} else if (_game.platform == Common::kPlatformC64 && _game.id == GID_MANIAC) {
_costumeRenderer = new C64CostumeRenderer(this);
_costumeLoader = new C64CostumeLoader(this);
} else if (_game.platform == Common::kPlatformNES) {
_costumeRenderer = new NESCostumeRenderer(this);
_costumeLoader = new NESCostumeLoader(this);
} else {
_costumeRenderer = new ClassicCostumeRenderer(this);
_costumeLoader = new ClassicCostumeLoader(this);
}
}
void ScummEngine::resetScumm() {
int i; int i;
_tempMusic = 0; _tempMusic = 0;
debug(9, "scummInit"); debug(9, "resetScumm");
if ((_game.id == GID_MANIAC) && (_game.version == 1) && !(_game.platform == Common::kPlatformNES)) { if ((_game.id == GID_MANIAC) && (_game.version == 1) && !(_game.platform == Common::kPlatformNES)) {
if (_game.platform == Common::kPlatformC64) if (_game.platform == Common::kPlatformC64)
@ -1118,47 +1131,12 @@ void ScummEngine::scummInit() {
for (i = 0; i < 256; i++) for (i = 0; i < 256; i++)
_roomPalette[i] = i; _roomPalette[i] = i;
resetPalette();
if (_game.version == 1) { if (_game.version == 1) {
// Use 17 color table for v1 games to allow
// correct color for inventory and sentence
// line
// Original games used some kind of dynamic
// color table remapping between rooms
if (_game.platform == Common::kPlatformC64) {
setupC64Palette();
} else if (_game.platform == Common::kPlatformNES) {
setupNESPalette();
} else {
setupV1Palette();
}
} else if (_game.features & GF_16COLOR) { } else if (_game.features & GF_16COLOR) {
for (i = 0; i < 16; i++) for (i = 0; i < 16; i++)
_shadowPalette[i] = i; _shadowPalette[i] = i;
switch (_renderMode) {
case Common::kRenderEGA:
setupEGAPalette();
break;
case Common::kRenderAmiga:
setupAmigaPalette();
break;
case Common::kRenderCGA:
setupCGAPalette();
break;
case Common::kRenderHercA:
case Common::kRenderHercG:
setupHercPalette();
break;
default:
if ((_game.platform == Common::kPlatformAmiga) || (_game.platform == Common::kPlatformAtariST))
setupAmigaPalette();
else
setupEGAPalette();
}
} }
if (_game.version >= 4 && _game.version <= 7) if (_game.version >= 4 && _game.version <= 7)
@ -1168,7 +1146,7 @@ void ScummEngine::scummInit() {
loadCharset(0); loadCharset(0);
setShake(0); setShake(0);
setupCursor(); _cursor.animate = 1;
// Allocate and Initialize actors // Allocate and Initialize actors
Actor::initActorClass(this); Actor::initActorClass(this);
@ -1184,7 +1162,7 @@ void ScummEngine::scummInit() {
} }
if (_game.id == GID_MANIAC && _game.version == 1) { if (_game.id == GID_MANIAC && _game.version == 1) {
setupV1ActorTalkColor(); resetV1ActorTalkColor();
} else if (_game.id == GID_MANIAC && _game.version == 2 && (_game.features & GF_DEMO)) { } else if (_game.id == GID_MANIAC && _game.version == 2 && (_game.features & GF_DEMO)) {
// HACK Some palette changes needed for demo script // HACK Some palette changes needed for demo script
// in Maniac Mansion (Enhanced) // in Maniac Mansion (Enhanced)
@ -1293,13 +1271,13 @@ void ScummEngine::scummInit() {
_lastSaveTime = _system->getMillis(); _lastSaveTime = _system->getMillis();
} }
void ScummEngine_c64::scummInit() { void ScummEngine_c64::resetScumm() {
ScummEngine_v2::scummInit(); ScummEngine_v2::resetScumm();
initC64Verbs(); initC64Verbs();
} }
void ScummEngine_v2::scummInit() { void ScummEngine_v2::resetScumm() {
ScummEngine::scummInit(); ScummEngine::resetScumm();
if (_game.platform == Common::kPlatformNES) { if (_game.platform == Common::kPlatformNES) {
initNESMouseOver(); initNESMouseOver();
@ -1315,8 +1293,8 @@ void ScummEngine_v2::scummInit() {
_inventoryOffset = 0; _inventoryOffset = 0;
} }
void ScummEngine_v4::scummInit() { void ScummEngine_v4::resetScumm() {
ScummEngine::scummInit(); ScummEngine::resetScumm();
// WORKAROUND for bug in boot script of Loom (CD) // WORKAROUND for bug in boot script of Loom (CD)
// The boot script sets the characters of string 21, // The boot script sets the characters of string 21,
@ -1326,13 +1304,13 @@ void ScummEngine_v4::scummInit() {
} }
} }
void ScummEngine_v6::scummInit() { void ScummEngine_v6::resetScumm() {
ScummEngine::scummInit(); ScummEngine::resetScumm();
setDefaultCursor(); setDefaultCursor();
} }
void ScummEngine_v60he::scummInit() { void ScummEngine_v60he::resetScumm() {
ScummEngine_v6::scummInit(); ScummEngine_v6::resetScumm();
// HACK cursor hotspot is wrong // HACK cursor hotspot is wrong
// Original games used // Original games used
@ -1342,15 +1320,15 @@ void ScummEngine_v60he::scummInit() {
} }
#ifndef DISABLE_HE #ifndef DISABLE_HE
void ScummEngine_v72he::scummInit() { void ScummEngine_v72he::resetScumm() {
ScummEngine_v60he::scummInit(); ScummEngine_v60he::resetScumm();
_stringLength = 1; _stringLength = 1;
memset(_stringBuffer, 0, sizeof(_stringBuffer)); memset(_stringBuffer, 0, sizeof(_stringBuffer));
} }
void ScummEngine_v90he::scummInit() { void ScummEngine_v90he::resetScumm() {
ScummEngine_v72he::scummInit(); ScummEngine_v72he::resetScumm();
_heObject = 0; _heObject = 0;
_heObjectNum = 0; _heObjectNum = 0;
@ -1384,8 +1362,8 @@ void ScummEngine_v90he::scummInit() {
} }
} }
void ScummEngine_v99he::scummInit() { void ScummEngine_v99he::resetScumm() {
ScummEngine_v90he::scummInit(); ScummEngine_v90he::resetScumm();
_hePalettes = (uint8 *)malloc((_numPalettes + 1) * 1024); _hePalettes = (uint8 *)malloc((_numPalettes + 1) * 1024);
memset(_hePalettes, 0, (_numPalettes + 1) * 1024); memset(_hePalettes, 0, (_numPalettes + 1) * 1024);
@ -1493,10 +1471,10 @@ void ScummEngine::setupMusic(int midi) {
} }
} }
setupVolumes(); updateVolumes();
} }
void ScummEngine::setupVolumes() { void ScummEngine::updateVolumes() {
// Sync the engine with the config manager // Sync the engine with the config manager
int soundVolumeMusic = ConfMan.getInt("music_volume"); int soundVolumeMusic = ConfMan.getInt("music_volume");
@ -2006,8 +1984,8 @@ void ScummEngine::restart() {
readIndexFile(); readIndexFile();
// Reinit scumm variables // Reinit scumm variables
scummInit(); resetScumm();
initScummVars(); resetScummVars();
if (_imuse) { if (_imuse) {
_imuse->setBase(res.address[rtSound]); _imuse->setBase(res.address[rtSound]);
@ -2078,6 +2056,7 @@ void ScummEngine::mainMenuDialog() {
if (!_mainMenuDialog) if (!_mainMenuDialog)
_mainMenuDialog = new MainMenuDialog(this); _mainMenuDialog = new MainMenuDialog(this);
runDialog(*_mainMenuDialog); runDialog(*_mainMenuDialog);
updateVolumes();
} }
void ScummEngine::confirmExitDialog() { void ScummEngine::confirmExitDialog() {

View file

@ -457,17 +457,19 @@ public:
int init(); int init();
protected: protected:
virtual void setupScumm();
virtual void resetScumm();
virtual void setupScummVars(); virtual void setupScummVars();
virtual void initScummVars(); virtual void resetScummVars();
virtual void scummInit(); void setupCharsetRenderer();
void setupCostumeRenderer();
virtual void loadLanguageBundle() {}
void loadCJKFont(); void loadCJKFont();
void setupMusic(int midi); void setupMusic(int midi);
public: void updateVolumes();
// The following is called by ConfigDialog::close
// TODO: Simply move that call to ScummEngine::mainMenuDialog to fix this
void setupVolumes();
protected: protected:
// Scumm main loop & helper functions. // Scumm main loop & helper functions.
@ -786,12 +788,16 @@ protected:
void convertADResource(int type, int index, byte *ptr, int size); void convertADResource(int type, int index, byte *ptr, int size);
int readSoundResourceSmallHeader(int type, int index); int readSoundResourceSmallHeader(int type, int index);
bool isResourceInUse(int type, int i) const; bool isResourceInUse(int type, int i) const;
virtual void loadRoomSubBlocks();
virtual void initRoomSubBlocks(); virtual void setupRoomSubBlocks();
void clearRoomObjects(); virtual void resetRoomSubBlocks();
void storeFlObject(int slot); void storeFlObject(int slot);
void restoreFlObjects(); void restoreFlObjects();
virtual void loadRoomObjects();
void clearRoomObjects();
virtual void resetRoomObjects();
virtual void resetRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
virtual void readArrayFromIndexFile(); virtual void readArrayFromIndexFile();
virtual void readMAXS(int blockSize) = 0; virtual void readMAXS(int blockSize) = 0;
@ -823,7 +829,6 @@ public:
uint32 *_classData; uint32 *_classData;
protected: protected:
virtual void setupRoomObject(ObjectData *od, const byte *room, const byte *searchptr = NULL);
void markObjectRectAsDirty(int obj); void markObjectRectAsDirty(int obj);
void loadFlObject(uint object, uint room); void loadFlObject(uint object, uint room);
void nukeFlObjects(int min, int max); void nukeFlObjects(int min, int max);
@ -917,7 +922,7 @@ protected:
void setActorRedrawFlags(); void setActorRedrawFlags();
void putActors(); void putActors();
void showActors(); void showActors();
void setupV1ActorTalkColor(); void resetV1ActorTalkColor();
void resetActorBgs(); void resetActorBgs();
virtual void processActors(); virtual void processActors();
void processUpperActors(); void processUpperActors();
@ -1030,13 +1035,17 @@ protected:
void actorFollowCamera(int act); void actorFollowCamera(int act);
const byte *getPalettePtr(int palindex, int room); const byte *getPalettePtr(int palindex, int room);
void setupC64Palette();
void setupNESPalette(); void setC64Palette();
void setupAmigaPalette(); void setNESPalette();
void setupHercPalette(); void setAmigaPalette();
void setupCGAPalette(); void setHercPalette();
void setupEGAPalette(); void setCGAPalette();
void setupV1Palette(); void setEGAPalette();
void setV1Palette();
void resetPalette();
void setPalette(int pal); void setPalette(int pal);
void setRoomPalette(int pal, int room); void setRoomPalette(int pal, int room);
virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1); virtual void setPaletteFromPtr(const byte *ptr, int numcolor = -1);
@ -1053,12 +1062,10 @@ public:
int remapPaletteColor(int r, int g, int b, int threshold); // Used by Actor::remapActorPalette int remapPaletteColor(int r, int g, int b, int threshold); // Used by Actor::remapActorPalette
protected: protected:
void moveMemInPalRes(int start, int end, byte direction); void moveMemInPalRes(int start, int end, byte direction);
void setupShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor); void setShadowPalette(int slot, int redScale, int greenScale, int blueScale, int startColor, int endColor);
void setupShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end); void setShadowPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor, int start, int end);
virtual void darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor); virtual void darkenPalette(int redScale, int greenScale, int blueScale, int startColor, int endColor);
void setupCursor();
void setCursorFromBuffer(const byte *ptr, int width, int height, int pitch); void setCursorFromBuffer(const byte *ptr, int width, int height, int pitch);
public: public:
@ -1223,8 +1230,6 @@ protected:
int convertNameMessage(byte *dst, int dstSize, int var); int convertNameMessage(byte *dst, int dstSize, int var);
int convertStringMessage(byte *dst, int dstSize, int var); int convertStringMessage(byte *dst, int dstSize, int var);
virtual void loadLanguageBundle() {}
public: public:
Common::Language _language; // Accessed by a hack in NutRenderer::loadFont Common::Language _language; // Accessed by a hack in NutRenderer::loadFont

View file

@ -536,7 +536,7 @@ void ScummEngine_v8::setupScummVars() {
} }
#endif #endif
void ScummEngine_c64::initScummVars() { void ScummEngine_c64::resetScummVars() {
_activeInventory = 0; _activeInventory = 0;
_activeObject = 0; _activeObject = 0;
_activeVerb = 13; _activeVerb = 13;
@ -547,7 +547,7 @@ void ScummEngine_c64::initScummVars() {
_currentLights = LIGHTMODE_actor_use_base_palette | LIGHTMODE_actor_use_colors | LIGHTMODE_room_lights_on; _currentLights = LIGHTMODE_actor_use_base_palette | LIGHTMODE_actor_use_colors | LIGHTMODE_room_lights_on;
} }
void ScummEngine_v2::initScummVars() { void ScummEngine_v2::resetScummVars() {
// This needs to be at least greater than 40 to get the more // This needs to be at least greater than 40 to get the more
// elaborate version of the EGA Zak into. I don't know where // elaborate version of the EGA Zak into. I don't know where
// else it makes any difference. // else it makes any difference.
@ -555,8 +555,8 @@ void ScummEngine_v2::initScummVars() {
VAR(VAR_MACHINE_SPEED) = 0x7FFF; VAR(VAR_MACHINE_SPEED) = 0x7FFF;
} }
void ScummEngine_v5::initScummVars() { void ScummEngine_v5::resetScummVars() {
ScummEngine::initScummVars(); ScummEngine::resetScummVars();
if (_game.version >= 4 && _game.version <= 5) if (_game.version >= 4 && _game.version <= 5)
VAR(VAR_V5_TALK_STRING_Y) = -0x50; VAR(VAR_V5_TALK_STRING_Y) = -0x50;
@ -569,8 +569,8 @@ void ScummEngine_v5::initScummVars() {
} }
#ifndef DISABLE_SCUMM_7_8 #ifndef DISABLE_SCUMM_7_8
void ScummEngine_v7::initScummVars() { void ScummEngine_v7::resetScummVars() {
ScummEngine::initScummVars(); ScummEngine::resetScummVars();
if (_game.version != 8) { if (_game.version != 8) {
VAR(VAR_V6_EMSSPACE) = 10000; VAR(VAR_V6_EMSSPACE) = 10000;
@ -581,8 +581,8 @@ void ScummEngine_v7::initScummVars() {
VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles"); VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles");
} }
void ScummEngine_v8::initScummVars() { void ScummEngine_v8::resetScummVars() {
ScummEngine_v7::initScummVars(); ScummEngine_v7::resetScummVars();
// FIXME: How do we deal with non-cd installs? // FIXME: How do we deal with non-cd installs?
VAR(VAR_CURRENTDISK) = 1; VAR(VAR_CURRENTDISK) = 1;
@ -624,8 +624,8 @@ void ScummEngine_v8::initScummVars() {
#endif #endif
#ifndef DISABLE_HE #ifndef DISABLE_HE
void ScummEngine_v70he::initScummVars() { void ScummEngine_v70he::resetScummVars() {
ScummEngine::initScummVars(); ScummEngine::resetScummVars();
if (VAR_MACHINE_SPEED != 0xFF) if (VAR_MACHINE_SPEED != 0xFF)
VAR(VAR_MACHINE_SPEED) = 13; VAR(VAR_MACHINE_SPEED) = 13;
@ -635,8 +635,8 @@ void ScummEngine_v70he::initScummVars() {
VAR(VAR_TALK_CHANNEL) = 2; VAR(VAR_TALK_CHANNEL) = 2;
} }
void ScummEngine_v72he::initScummVars() { void ScummEngine_v72he::resetScummVars() {
ScummEngine_v70he::initScummVars(); ScummEngine_v70he::resetScummVars();
VAR(VAR_VIDEO_PERFORMANCE) = 26; VAR(VAR_VIDEO_PERFORMANCE) = 26;
@ -649,8 +649,8 @@ void ScummEngine_v72he::initScummVars() {
VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1;
} }
void ScummEngine_v80he::initScummVars() { void ScummEngine_v80he::resetScummVars() {
ScummEngine_v72he::initScummVars(); ScummEngine_v72he::resetScummVars();
if (_game.platform == Common::kPlatformMacintosh) { if (_game.platform == Common::kPlatformMacintosh) {
VAR(VAR_PLATFORM) = 2; VAR(VAR_PLATFORM) = 2;
@ -662,8 +662,8 @@ void ScummEngine_v80he::initScummVars() {
VAR(VAR_COLOR_DEPTH) = 256; VAR(VAR_COLOR_DEPTH) = 256;
} }
void ScummEngine_v90he::initScummVars() { void ScummEngine_v90he::resetScummVars() {
ScummEngine_v80he::initScummVars(); ScummEngine_v80he::resetScummVars();
VAR(VAR_SCRIPT_CYCLE) = 1; VAR(VAR_SCRIPT_CYCLE) = 1;
VAR(VAR_NUM_SCRIPT_CYCLES) = 1; VAR(VAR_NUM_SCRIPT_CYCLES) = 1;
@ -680,15 +680,15 @@ void ScummEngine_v90he::initScummVars() {
} }
} }
void ScummEngine_v99he::initScummVars() { void ScummEngine_v99he::resetScummVars() {
ScummEngine_v90he::initScummVars(); ScummEngine_v90he::resetScummVars();
VAR(VAR_NUM_PALETTES) = _numPalettes; VAR(VAR_NUM_PALETTES) = _numPalettes;
VAR(VAR_NUM_UNK) = _numUnk; VAR(VAR_NUM_UNK) = _numUnk;
} }
#endif #endif
void ScummEngine::initScummVars() { void ScummEngine::resetScummVars() {
if (_game.heversion < 70 && _game.version <= 6) { if (_game.heversion < 70 && _game.version <= 6) {
switch (_musicType) { switch (_musicType) {
case MDT_NONE: case MDT_NONE: