diff options
author | Max Horn | 2005-04-20 20:34:44 +0000 |
---|---|---|
committer | Max Horn | 2005-04-20 20:34:44 +0000 |
commit | b724929466507929cd7284f6d418ec1ba50bd0e0 (patch) | |
tree | 8d218f3fba560a5f94ff62bc1c7ae9f7a454d81c /scumm | |
parent | 9216ca4ed5b42339a2807a07c4a13525b5943c5c (diff) | |
download | scummvm-rg350-b724929466507929cd7284f6d418ec1ba50bd0e0.tar.gz scummvm-rg350-b724929466507929cd7284f6d418ec1ba50bd0e0.tar.bz2 scummvm-rg350-b724929466507929cd7284f6d418ec1ba50bd0e0.zip |
Split initScummVars and overload it; this makes it possible to define more VARS in subclasses
svn-id: r17721
Diffstat (limited to 'scumm')
-rw-r--r-- | scumm/intern.h | 28 | ||||
-rw-r--r-- | scumm/scumm.cpp | 32 | ||||
-rw-r--r-- | scumm/scumm.h | 20 | ||||
-rw-r--r-- | scumm/vars.cpp | 126 |
4 files changed, 124 insertions, 82 deletions
diff --git a/scumm/intern.h b/scumm/intern.h index e77b1909a8..544dc32da2 100644 --- a/scumm/intern.h +++ b/scumm/intern.h @@ -61,6 +61,7 @@ protected: virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); + virtual void initScummVars(); virtual void decodeParseString(); virtual void readMAXS(int blockSize); @@ -256,6 +257,7 @@ protected: virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); + virtual void initScummVars(); virtual void decodeParseString(); virtual void readIndexFile(); @@ -694,6 +696,8 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + virtual void initScummVars(); + virtual void readRoomsOffsets(); virtual void readGlobalObjects(); virtual void readIndexBlock(uint32 blocktype, uint32 itemsize); @@ -763,7 +767,7 @@ protected: WizParameters _wizParams; public: - ScummEngine_v72he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) : ScummEngine_v70he(detector, syst, gs, md5sum) {} + ScummEngine_v72he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]); virtual void scummInit(); @@ -773,6 +777,7 @@ protected: virtual const char *getOpcodeDesc(byte i); virtual void setupScummVars(); + virtual void initScummVars(); virtual void readArrayFromIndexFile(); virtual byte *getStringAddress(int i); @@ -861,6 +866,20 @@ protected: void o72_getResourceSize(); void o72_setFilePath(); void o72_setWindowCaption(); + + byte VAR_NUM_ROOMS; + byte VAR_NUM_SCRIPTS; + byte VAR_NUM_SOUNDS; + byte VAR_NUM_COSTUMES; + byte VAR_NUM_IMAGES; + byte VAR_NUM_CHARSETS; + byte VAR_NUM_SPRITE_GROUPS; + byte VAR_NUM_SPRITES; + byte VAR_NUM_PALETTES; + byte VAR_NUM_UNK; + byte VAR_POLYGONS_ONLY; + byte VAR_WINDOWS_VERSION; + byte VAR_WIZ_TCOLOR; }; class ScummEngine_v80he : public ScummEngine_v72he { @@ -881,6 +900,8 @@ protected: virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + virtual void initScummVars(); + void loadImgSpot(int resId, int state, int16 &x, int16 &y); void loadWizCursor(int resId); void unknownE0(int x1, int y1, int x, int unk1, int unk2, int type, int id); @@ -949,6 +970,8 @@ protected: virtual void setupOpcodes(); virtual void executeOpcode(byte i); virtual const char *getOpcodeDesc(byte i); + + virtual void initScummVars(); virtual void readMAXS(int blockSize); @@ -1126,6 +1149,8 @@ public: virtual void scummInit(); protected: + virtual void initScummVars(); + virtual void readMAXS(int blockSize); virtual void copyPalColor(int dst, int src); @@ -1197,6 +1222,7 @@ public: protected: virtual void setupScummVars(); + virtual void initScummVars(); virtual void readMAXS(int blockSize); virtual void readGlobalObjects(); diff --git a/scumm/scumm.cpp b/scumm/scumm.cpp index f8b270deda..1ba0099b5e 100644 --- a/scumm/scumm.cpp +++ b/scumm/scumm.cpp @@ -1046,22 +1046,9 @@ ScummEngine::ScummEngine(GameDetector *detector, OSystem *syst, const ScummGameS VAR_NUM_SCRIPT_CYCLES = 0xFF; VAR_SCRIPT_CYCLE = 0xFF; - VAR_NUM_ROOMS = 0xFF; - VAR_NUM_SCRIPTS = 0xFF; - VAR_NUM_SOUNDS = 0xFF; - VAR_NUM_COSTUMES = 0xFF; - VAR_NUM_IMAGES = 0xFF; - VAR_NUM_CHARSETS = 0xFF; VAR_NUM_GLOBAL_OBJS = 0xFF; - VAR_NUM_SPRITE_GROUPS = 0xFF; - VAR_NUM_SPRITES = 0xFF; - VAR_NUM_PALETTES = 0xFF; - VAR_NUM_UNK = 0xFF; - VAR_MOUSE_STATE = 0xFF; - VAR_POLYGONS_ONLY = 0xFF; - VAR_WINDOWS_VERSION = 0xFF; VAR_KEY_STATE = 0xFF; - VAR_WIZ_TCOLOR = 0xFF; + VAR_MOUSE_STATE = 0xFF; // Use g_scumm from error() ONLY g_scumm = this; @@ -1276,6 +1263,23 @@ ScummEngine_v70he::~ScummEngine_v70he() { free(_heV7RoomOffsets); } +ScummEngine_v72he::ScummEngine_v72he(GameDetector *detector, OSystem *syst, const ScummGameSettings &gs, uint8 md5sum[16]) + : ScummEngine_v70he(detector, syst, gs, md5sum) { + VAR_NUM_ROOMS = 0xFF; + VAR_NUM_SCRIPTS = 0xFF; + VAR_NUM_SOUNDS = 0xFF; + VAR_NUM_COSTUMES = 0xFF; + VAR_NUM_IMAGES = 0xFF; + VAR_NUM_CHARSETS = 0xFF; + VAR_NUM_SPRITE_GROUPS = 0xFF; + VAR_NUM_SPRITES = 0xFF; + VAR_NUM_PALETTES = 0xFF; + VAR_NUM_UNK = 0xFF; + VAR_POLYGONS_ONLY = 0xFF; + VAR_WINDOWS_VERSION = 0xFF; + VAR_WIZ_TCOLOR = 0xFF; +} + #pragma mark - #pragma mark --- Initialization --- #pragma mark - diff --git a/scumm/scumm.h b/scumm/scumm.h index 4bd97252b7..b3e26053bf 100644 --- a/scumm/scumm.h +++ b/scumm/scumm.h @@ -405,7 +405,7 @@ public: int init(GameDetector &detector); virtual void setupScummVars(); - void initScummVars(); + virtual void initScummVars(); virtual void scummInit(); @@ -1337,22 +1337,10 @@ public: byte VAR_SCRIPT_CYCLE; byte VAR_NUM_SCRIPT_CYCLES; - byte VAR_NUM_ROOMS; - byte VAR_NUM_SCRIPTS; - byte VAR_NUM_SOUNDS; - byte VAR_NUM_COSTUMES; - byte VAR_NUM_IMAGES; - byte VAR_NUM_CHARSETS; - byte VAR_NUM_GLOBAL_OBJS; - byte VAR_NUM_SPRITE_GROUPS; - byte VAR_NUM_SPRITES; - byte VAR_NUM_PALETTES; - byte VAR_NUM_UNK; + byte VAR_NUM_GLOBAL_OBJS; // Exists both in V7 and in V72HE + + byte VAR_KEY_STATE; // Used in parseEvents() byte VAR_MOUSE_STATE; - byte VAR_POLYGONS_ONLY; - byte VAR_WINDOWS_VERSION; - byte VAR_KEY_STATE; - byte VAR_WIZ_TCOLOR; }; } // End of namespace Scumm diff --git a/scumm/vars.cpp b/scumm/vars.cpp index b55325b7e1..8a268dbb93 100644 --- a/scumm/vars.cpp +++ b/scumm/vars.cpp @@ -480,60 +480,97 @@ void ScummEngine_v8::setupScummVars() { VAR_SYNC = 134; } -void ScummEngine::initScummVars() { +void ScummEngine_v2::initScummVars() { // 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 // else it makes any difference. if (_gameId == GID_ZAK) VAR(VAR_MACHINE_SPEED) = 0x7FFF; +} - if (_version <= 2) - return; +void ScummEngine_v5::initScummVars() { + ScummEngine::initScummVars(); if (_version >= 4 && _version <= 5) VAR(VAR_V5_TALK_STRING_Y) = -0x50; - if (_version == 8) { // Fixme: How do we deal with non-cd installs? + if (VAR_CURRENT_LIGHTS != 0xFF) { + // Setup light + VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; + } + + if (_gameId == GID_MONKEY || _gameId == GID_MONKEY_SEGA) + _scummVars[74] = 1225; +} + +void ScummEngine_v7::initScummVars() { + ScummEngine::initScummVars(); + + if (_version == 8) { // FIXME: How do we deal with non-cd installs? VAR(VAR_CURRENTDISK) = 1; VAR(VAR_LANGUAGE) = _language; - } else if (_version >= 7) { + } else { VAR(VAR_V6_EMSSPACE) = 10000; VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; - } else if (_heversion >= 70) { - VAR(VAR_NUM_SOUND_CHANNELS) = 8; - VAR(VAR_MUSIC_CHANNEL) = 1; - VAR(VAR_SOUND_CHANNEL) = 2; - - if (_heversion >= 72) { - VAR(VAR_NUM_ROOMS) = _numRooms - 1; - VAR(VAR_NUM_SCRIPTS) = _numScripts - 1; - VAR(VAR_NUM_SOUNDS) = _numSounds - 1; - VAR(VAR_NUM_COSTUMES) = _numCostumes - 1; - VAR(VAR_NUM_IMAGES) = _numImages - 1; - VAR(VAR_NUM_CHARSETS) = _numCharsets - 1; - VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; - } - if (_heversion >= 80) { - VAR(78) = 1; - VAR(VAR_WINDOWS_VERSION) = 40; + } - VAR(VAR_NUM_ACTIVE_SOUND_CHANNELS) = (_heversion >= 90) ? 8 : 4; - } - if (_heversion >= 90) { - VAR(VAR_SCRIPT_CYCLE) = 1; - VAR(VAR_NUM_SCRIPT_CYCLES) = 1; - } - if (_heversion >= 95) { - VAR(VAR_NUM_SPRITE_GROUPS) = MAX(64, _numSprites / 4) - 1; - VAR(VAR_NUM_SPRITES) = _numSprites - 1; - VAR(VAR_WIZ_TCOLOR) = 5; - } - if (_heversion >= 99) { - VAR(VAR_NUM_PALETTES) = _numPalettes; - VAR(VAR_NUM_UNK) = _numUnk; - } - } else { + VAR(VAR_DEFAULT_TALK_DELAY) = 60; + VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles"); +} + +void ScummEngine_v70he::initScummVars() { + ScummEngine::initScummVars(); + + VAR(VAR_NUM_SOUND_CHANNELS) = 8; + VAR(VAR_MUSIC_CHANNEL) = 1; + VAR(VAR_SOUND_CHANNEL) = 2; +} + +void ScummEngine_v72he::initScummVars() { + ScummEngine_v70he::initScummVars(); + + VAR(VAR_NUM_ROOMS) = _numRooms - 1; + VAR(VAR_NUM_SCRIPTS) = _numScripts - 1; + VAR(VAR_NUM_SOUNDS) = _numSounds - 1; + VAR(VAR_NUM_COSTUMES) = _numCostumes - 1; + VAR(VAR_NUM_IMAGES) = _numImages - 1; + VAR(VAR_NUM_CHARSETS) = _numCharsets - 1; + VAR(VAR_NUM_GLOBAL_OBJS) = _numGlobalObjects - 1; +} + +void ScummEngine_v80he::initScummVars() { + ScummEngine_v72he::initScummVars(); + + VAR(78) = 1; + VAR(VAR_WINDOWS_VERSION) = 40; + + VAR(VAR_NUM_ACTIVE_SOUND_CHANNELS) = (_heversion >= 90) ? 8 : 4; +} + +void ScummEngine_v90he::initScummVars() { + ScummEngine_v80he::initScummVars(); + + VAR(VAR_SCRIPT_CYCLE) = 1; + VAR(VAR_NUM_SCRIPT_CYCLES) = 1; + + if (_heversion >= 95) { + VAR(VAR_NUM_SPRITE_GROUPS) = MAX(64, _numSprites / 4) - 1; + VAR(VAR_NUM_SPRITES) = _numSprites - 1; + VAR(VAR_WIZ_TCOLOR) = 5; + } +} + +void ScummEngine_v99he::initScummVars() { + ScummEngine_v90he::initScummVars(); + + VAR(VAR_NUM_PALETTES) = _numPalettes; + VAR(VAR_NUM_UNK) = _numUnk; +} + +void ScummEngine::initScummVars() { + + if (_heversion < 70 && _version <= 6) { switch (_midiDriver) { case MD_NULL: VAR(VAR_SOUNDCARD) = 0; break; case MD_PCSPK: @@ -610,19 +647,6 @@ void ScummEngine::initScummVars() { VAR(VAR_V6_EMSSPACE) = 10000; } - if (VAR_CURRENT_LIGHTS != 0xFF) { - // Setup light - VAR(VAR_CURRENT_LIGHTS) = LIGHTMODE_actor_base | LIGHTMODE_actor_color | LIGHTMODE_screen; - } - - if (_gameId == GID_MONKEY || _gameId == GID_MONKEY_SEGA) - _scummVars[74] = 1225; - - if (_version >= 7) { - VAR(VAR_DEFAULT_TALK_DELAY) = 60; - VAR(VAR_VOICE_MODE) = ConfMan.getBool("subtitles"); - } - if (VAR_FADE_DELAY != 0xFF) VAR(VAR_FADE_DELAY) = 3; |