diff options
author | Travis Howell | 2009-08-16 01:03:09 +0000 |
---|---|---|
committer | Travis Howell | 2009-08-16 01:03:09 +0000 |
commit | ac45cf6f6f0cf6e41b608561316bcbda115fb6b1 (patch) | |
tree | 01d5f13eec4f6a91859093de4fac88ef7991f756 /engines/gob | |
parent | 09845556e0383fb187f548c7cfc1a68b22329f7e (diff) | |
parent | b6a0f3e3716614ee270df048414c7f938299c476 (diff) | |
download | scummvm-rg350-ac45cf6f6f0cf6e41b608561316bcbda115fb6b1.tar.gz scummvm-rg350-ac45cf6f6f0cf6e41b608561316bcbda115fb6b1.tar.bz2 scummvm-rg350-ac45cf6f6f0cf6e41b608561316bcbda115fb6b1.zip |
Merged revisions 43338-43340,43342,43344-43347,43349-43350,43352-43354,43357-43358,43362,43366,43369,43375,43377,43380,43383-43384,43386,43388,43390,43393,43400,43402,43404,43406-43409,43411,43413-43414 via svnmerge from
https://scummvm.svn.sourceforge.net/svnroot/scummvm/scummvm/trunk
........
r43338 | lordhoto | 2009-08-13 10:19:26 +1000 (Thu, 13 Aug 2009) | 1 line
Little optimization in Screen::setPaletteIndex, now it only resets the palette, when the color index really changed.
........
r43339 | lordhoto | 2009-08-13 10:20:37 +1000 (Thu, 13 Aug 2009) | 1 line
Fix key input in credits sequences.
........
r43340 | lordhoto | 2009-08-13 10:21:42 +1000 (Thu, 13 Aug 2009) | 1 line
Fix serious bug in StaticResource::unloadId.
........
r43342 | lordhoto | 2009-08-13 10:26:41 +1000 (Thu, 13 Aug 2009) | 1 line
Do not unload credits data after copying it to a temporary buffer in Kyrandia 1 Amiga, since the credits will be looped and need reload every time.
........
r43344 | strangerke | 2009-08-13 19:56:54 +1000 (Thu, 13 Aug 2009) | 1 line
Initial save handler for Playtoons
........
r43345 | strangerke | 2009-08-13 19:59:44 +1000 (Thu, 13 Aug 2009) | 2 lines
- Add a specific OPCODEFUNC checkData to avoid having a Playtoons workaround in working code
- Replace OPCODEDRAW 0x20,0x23 and 0x25
........
r43346 | strangerke | 2009-08-13 20:00:35 +1000 (Thu, 13 Aug 2009) | 1 line
Suppress no longer needed Playtoons workaround
........
r43347 | strangerke | 2009-08-13 20:08:07 +1000 (Thu, 13 Aug 2009) | 1 line
fix methods
........
r43349 | lordhoto | 2009-08-14 01:55:12 +1000 (Fri, 14 Aug 2009) | 1 line
Implemented support for the "Lore of the Lands" special of Lands of Lore CD.
........
r43350 | lordhoto | 2009-08-14 02:41:07 +1000 (Fri, 14 Aug 2009) | 1 line
Move version string in Modern theme beneath the Logo in high res mode, this saves some space and looks nicer.
........
r43352 | lordhoto | 2009-08-14 02:50:30 +1000 (Fri, 14 Aug 2009) | 1 line
Little fix of new modern theme layout in the launcher for 3x.
........
r43353 | lordhoto | 2009-08-14 03:00:19 +1000 (Fri, 14 Aug 2009) | 1 line
Cleanup.
........
r43354 | lordhoto | 2009-08-14 03:00:40 +1000 (Fri, 14 Aug 2009) | 1 line
Cleanup.
........
r43357 | agent-q | 2009-08-14 07:46:41 +1000 (Fri, 14 Aug 2009) | 1 line
Allow VOCs to stream from disk. Disabled by default, use symbol STREAM_AUDIO_FROM_DISK to enable. See patch #2834001.
........
r43358 | Kirben | 2009-08-14 10:44:36 +1000 (Fri, 14 Aug 2009) | 1 line
The Nintendo DS hack for introduction in Simon the Sorcerer 1 is only required for Windows version (WAV format) now.
........
r43362 | anotherguest | 2009-08-14 16:42:57 +1000 (Fri, 14 Aug 2009) | 1 line
Updated files from 1.0.0 branch
........
r43366 | drmccoy | 2009-08-15 01:22:43 +1000 (Sat, 15 Aug 2009) | 2 lines
Setting gob3 save/load mode of the temporary sprite "intro.$$$" to ignore and remove the TempSpriteHandler.
Gob3 doesn't use it at all and Lost in Time only saves (with an invalid index) and never loads
........
r43369 | joostp | 2009-08-15 02:13:00 +1000 (Sat, 15 Aug 2009) | 2 lines
PSP: create an EBOOT.PBP when building via configure
........
r43375 | joostp | 2009-08-15 02:44:29 +1000 (Sat, 15 Aug 2009) | 2 lines
Fix incorrect memset() call (reported by Peter Bortas).
........
r43377 | joostp | 2009-08-15 02:54:43 +1000 (Sat, 15 Aug 2009) | 2 lines
add psp_clean build rule to clean up EBOOT.PBP and scummvm_stripped.elf
........
r43380 | joostp | 2009-08-15 03:18:03 +1000 (Sat, 15 Aug 2009) | 3 lines
MIPSpro compilation fixes / workarounds (from a patch by Rainer Canavan)
The hashmap.h change is ugly, but so far the only thing found to work. Suggestions for a better "fix" appreciated!
........
r43383 | lordhoto | 2009-08-15 03:49:30 +1000 (Sat, 15 Aug 2009) | 1 line
Little fix for lopping credits in Kyrandia 1 Amiga.
........
r43384 | joostp | 2009-08-15 04:02:17 +1000 (Sat, 15 Aug 2009) | 2 lines
PSP: also create param.sfo when building via configure
........
r43386 | joostp | 2009-08-15 04:34:01 +1000 (Sat, 15 Aug 2009) | 2 lines
PSP: add svn revision + build date to SFO title.
........
r43388 | joostp | 2009-08-15 09:20:46 +1000 (Sat, 15 Aug 2009) | 2 lines
remove double semi-colon -- hopefully this kicks the buildbot back into action =)
........
r43390 | waltervn | 2009-08-15 10:28:59 +1000 (Sat, 15 Aug 2009) | 2 lines
SCI: Added enum for map and volume versions. Removed res_version setting from
detection.cpp (should be detectable). Cleanup.
........
r43393 | dhewg | 2009-08-15 15:39:44 +1000 (Sat, 15 Aug 2009) | 1 line
Fix compilation.
........
r43400 | Kirben | 2009-08-15 20:09:32 +1000 (Sat, 15 Aug 2009) | 1 line
Fix regression, that caused multiple sounds in Simon the Sorcerer 2 to be cut off.
........
r43402 | Kirben | 2009-08-15 20:31:20 +1000 (Sat, 15 Aug 2009) | 1 line
Restore code to clear screen, before playing videos with smaller resolution in the Amiga version of The Feeble Files.
........
r43404 | joostp | 2009-08-15 20:44:58 +1000 (Sat, 15 Aug 2009) | 2 lines
Properly implement PSPFilesystemFactory::makeCurrentDirectoryFileNode()
........
r43406 | dreammaster | 2009-08-15 21:50:59 +1000 (Sat, 15 Aug 2009) | 1 line
Added Dirty Rect handling functionality
........
r43407 | waltervn | 2009-08-15 22:09:47 +1000 (Sat, 15 Aug 2009) | 1 line
SCI: Rename sci_version_t to SciVersion
........
r43408 | waltervn | 2009-08-15 22:17:23 +1000 (Sat, 15 Aug 2009) | 1 line
SCI: Add missing versions to exe version parsing
........
r43409 | eriktorbjorn | 2009-08-16 00:13:48 +1000 (Sun, 16 Aug 2009) | 2 lines
Removed unnecessary semi-colons.
........
r43411 | lordhoto | 2009-08-16 00:59:11 +1000 (Sun, 16 Aug 2009) | 1 line
Added const qualifiers to static data.
........
r43413 | lordhoto | 2009-08-16 01:30:35 +1000 (Sun, 16 Aug 2009) | 1 line
Yet another slight graphic fix for the Kyrandia 1 Amiga credits.
........
r43414 | buddha_ | 2009-08-16 05:04:21 +1000 (Sun, 16 Aug 2009) | 4 lines
Fix for bug #2835581 (KQ3: Game Crash When Leaving Tavern as Fly):
- Use AGI version 0x3149 instead of the previous 0x3086
- Makes ESC pause the game (Identical to original in this respect)
........
svn-id: r43418
Diffstat (limited to 'engines/gob')
-rw-r--r-- | engines/gob/gob.cpp | 8 | ||||
-rw-r--r-- | engines/gob/inter.h | 15 | ||||
-rw-r--r-- | engines/gob/inter_playtoons.cpp | 141 | ||||
-rw-r--r-- | engines/gob/inter_v2.cpp | 6 | ||||
-rw-r--r-- | engines/gob/module.mk | 1 | ||||
-rw-r--r-- | engines/gob/save/saveload.h | 47 | ||||
-rw-r--r-- | engines/gob/save/saveload_playtoons.cpp | 276 | ||||
-rw-r--r-- | engines/gob/save/saveload_v3.cpp | 7 | ||||
-rw-r--r-- | engines/gob/video_v6.cpp | 2 |
9 files changed, 463 insertions, 40 deletions
diff --git a/engines/gob/gob.cpp b/engines/gob/gob.cpp index 082345e675..a348fbdb08 100644 --- a/engines/gob/gob.cpp +++ b/engines/gob/gob.cpp @@ -460,14 +460,14 @@ bool GobEngine::initGameParts() { case kGameTypePlaytnCk: case kGameTypeBambou: _init = new Init_v2(this); - _video = new Video_v2(this); - _inter = new Inter_v6(this); + _video = new Video_v6(this); + _inter = new Inter_Playtoons(this); _mult = new Mult_v2(this); _draw = new Draw_v2(this); _map = new Map_v2(this); - _goblin = new Goblin_v2(this); + _goblin = new Goblin_v4(this); _scenery = new Scenery_v2(this); - _saveLoad = new SaveLoad_Playtoons(this); + _saveLoad = new SaveLoad_Playtoons(this, _targetName.c_str()); break; default: diff --git a/engines/gob/inter.h b/engines/gob/inter.h index a31860885f..c3d3a26f47 100644 --- a/engines/gob/inter.h +++ b/engines/gob/inter.h @@ -547,6 +547,21 @@ protected: void probe16bitMusic(char *fileName); }; +class Inter_Playtoons : public Inter_v6 { +public: + Inter_Playtoons(GobEngine *vm); + virtual ~Inter_Playtoons() {} + +protected: + virtual void setupOpcodesDraw(); + virtual void setupOpcodesFunc(); + virtual void setupOpcodesGob(); + + bool oPlaytoons_checkData(OpFuncParams ¶ms); + void oPlaytoons_CD_20_23(); + void oPlaytoons_CD_25(); +}; + } // End of namespace Gob #endif // GOB_INTER_H diff --git a/engines/gob/inter_playtoons.cpp b/engines/gob/inter_playtoons.cpp new file mode 100644 index 0000000000..285360c613 --- /dev/null +++ b/engines/gob/inter_playtoons.cpp @@ -0,0 +1,141 @@ +/* ScummVM - Graphic Adventure Engine + * + * ScummVM is the legal property of its developers, whose names + * are too numerous to list here. Please refer to the COPYRIGHT + * file distributed with this source distribution. + * + * This program is free software; you can redistribute it and/or + * modify it under the terms of the GNU General Public License + * as published by the Free Software Foundation; either version 2 + * of the License, or (at your option) any later version. + + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + + * You should have received a copy of the GNU General Public License + * along with this program; if not, write to the Free Software + * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. + * + * $URL$ + * $Id$ + * + */ + +#include "common/endian.h" + +#include "gob/gob.h" +#include "gob/inter.h" +#include "gob/global.h" +#include "gob/util.h" +#include "gob/dataio.h" +#include "gob/draw.h" +#include "gob/game.h" +#include "gob/script.h" +#include "gob/palanim.h" +#include "gob/video.h" +#include "gob/videoplayer.h" +#include "gob/save/saveload.h" +#include "gob/sound/sound.h" + +namespace Gob { + +#define OPCODEVER Inter_Playtoons +#define OPCODEDRAW(i, x) _opcodesDraw[i]._OPCODEDRAW(OPCODEVER, x) +#define OPCODEFUNC(i, x) _opcodesFunc[i]._OPCODEFUNC(OPCODEVER, x) +#define OPCODEGOB(i, x) _opcodesGob[i]._OPCODEGOB(OPCODEVER, x) + +Inter_Playtoons::Inter_Playtoons(GobEngine *vm) : Inter_v6(vm) { +} + +void Inter_Playtoons::setupOpcodesDraw() { + Inter_v6::setupOpcodesDraw(); + +// In the code, the Draw codes 0x00 to 0x06 and 0x13 are replaced by an engrish +// error message. As it's useless, they are simply cleared. + CLEAROPCODEDRAW(0x00); + CLEAROPCODEDRAW(0x01); + CLEAROPCODEDRAW(0x02); + CLEAROPCODEDRAW(0x03); + CLEAROPCODEDRAW(0x04); + CLEAROPCODEDRAW(0x05); + CLEAROPCODEDRAW(0x06); + CLEAROPCODEDRAW(0x13); + + CLEAROPCODEDRAW(0x21); + CLEAROPCODEDRAW(0x22); + CLEAROPCODEDRAW(0x24); + + OPCODEDRAW(0x20, oPlaytoons_CD_20_23); + OPCODEDRAW(0x23, oPlaytoons_CD_20_23); + OPCODEDRAW(0x25, oPlaytoons_CD_25); +} + +void Inter_Playtoons::setupOpcodesFunc() { + Inter_v6::setupOpcodesFunc(); + + OPCODEFUNC(0x3F, oPlaytoons_checkData); +} + +void Inter_Playtoons::setupOpcodesGob() { +} + +bool Inter_Playtoons::oPlaytoons_checkData(OpFuncParams ¶ms) { + int16 handle; + int16 varOff; + int32 size; + SaveLoad::SaveMode mode; + + _vm->_game->_script->evalExpr(0); + varOff = _vm->_game->_script->readVarIndex(); + + size = -1; + handle = 1; + + char *file = _vm->_game->_script->getResultStr(); + + // WORKAROUND: In Playtoons games, some files are read on CD (and only on CD). + // In this case, "@:\" is replaced by the CD drive letter. + // As the files are copied on the HDD, those characters are skipped. + if (strncmp(file, "@:\\", 3) == 0) { + debugC(2, kDebugFileIO, "File check: \"%s\" instead of \"%s\"", file + 3, file); + file += 3; + } + + mode = _vm->_saveLoad->getSaveMode(file); + if (mode == SaveLoad::kSaveModeNone) { + + if (_vm->_dataIO->existData(file)) + size = _vm->_dataIO->getDataSize(file); + else + warning("File \"%s\" not found", file); + + } else if (mode == SaveLoad::kSaveModeSave) + size = _vm->_saveLoad->getSize(file); + else if (mode == SaveLoad::kSaveModeExists) + size = 23; + + if (size == -1) + handle = -1; + + debugC(2, kDebugFileIO, "Requested size of file \"%s\": %d", + file, size); + + WRITE_VAR_OFFSET(varOff, handle); + WRITE_VAR(16, (uint32) size); + + return false; +} + +void Inter_Playtoons::oPlaytoons_CD_20_23() { + _vm->_game->_script->evalExpr(0); +} + +void Inter_Playtoons::oPlaytoons_CD_25() { + _vm->_game->_script->readVarIndex(); + _vm->_game->_script->readVarIndex(); +} + + +} // End of namespace Gob diff --git a/engines/gob/inter_v2.cpp b/engines/gob/inter_v2.cpp index b4e5bf7623..da9e55685c 100644 --- a/engines/gob/inter_v2.cpp +++ b/engines/gob/inter_v2.cpp @@ -1305,12 +1305,6 @@ bool Inter_v2::o2_checkData(OpFuncParams ¶ms) { char *file = _vm->_game->_script->getResultStr(); - // WORKAROUND: In some games (at least all the Playtoons), some files are - // read on CD (and only on CD). "@:\" is replaced by the CD drive letter. - // As the files are copied on the HDD, those characters are skipped. - if (strncmp(file, "@:\\", 3) ==0 ) - file += 3; - // WORKAROUND: For some reason, the variable indicating which TOT to load next // is overwritten in the guard house card game in Woodruff. if ((_vm->getGameType() == kGameTypeWoodruff) && !scumm_stricmp(file, "6.TOT")) diff --git a/engines/gob/module.mk b/engines/gob/module.mk index 26cc4e5d27..5b26cb97d4 100644 --- a/engines/gob/module.mk +++ b/engines/gob/module.mk @@ -30,6 +30,7 @@ MODULE_OBJS := \ inter_v2.o \ inter_bargon.o \ inter_fascin.o \ + inter_playtoons.o \ inter_v3.o \ inter_v4.o \ inter_v5.o \ diff --git a/engines/gob/save/saveload.h b/engines/gob/save/saveload.h index 1a1a47178b..4779de703c 100644 --- a/engines/gob/save/saveload.h +++ b/engines/gob/save/saveload.h @@ -251,7 +251,6 @@ protected: GameHandler *_gameHandler; NotesHandler *_notesHandler; - TempSpriteHandler *_tempSpriteHandler; ScreenshotHandler *_screenshotHandler; SaveHandler *getHandler(const char *fileName) const; @@ -450,13 +449,16 @@ protected: }; /** Save/Load class for Playtoons. */ -/** Only used for the moment to check file presence */ - class SaveLoad_Playtoons : public SaveLoad { public: - SaveLoad_Playtoons(GobEngine *vm); + static const uint32 kSlotCount = 60; + static const uint32 kSlotNameLength = 40; + + SaveLoad_Playtoons(GobEngine *vm, const char *targetName); virtual ~SaveLoad_Playtoons(); + SaveMode getSaveMode(const char *fileName) const; + protected: struct SaveFile { const char *sourceName; @@ -465,14 +467,45 @@ protected: const char *description; }; + /** Handles the save slots. */ + class GameHandler : public SaveHandler { + public: + GameHandler(GobEngine *vm, const char *target); + ~GameHandler(); + + int32 getSize(); + bool load(int16 dataVar, int32 size, int32 offset); + bool save(int16 dataVar, int32 size, int32 offset); + + private: + /** Slot file construction. */ + class File : public SlotFileIndexed { + public: + File(GobEngine *vm, const char *base); + ~File(); + + int getSlot(int32 offset) const; + int getSlotRemainder(int32 offset) const; + }; + + byte _props[500]; + /** The index. 500 bytes properties + kSlotCount * kSlotNameLength bytes. */ + byte _index[2400]; + + File *_slotFile; + + void buildIndex(byte *buffer) const; + }; + static SaveFile _saveFiles[]; - SaveMode getSaveMode(const char *fileName) const; + GameHandler *_gameHandler; + + SaveHandler *getHandler(const char *fileName) const; + const char *getDescription(const char *fileName) const; const SaveFile *getSaveFile(const char *fileName) const; - SaveFile *getSaveFile(const char *fileName); - }; } // End of namespace Gob diff --git a/engines/gob/save/saveload_playtoons.cpp b/engines/gob/save/saveload_playtoons.cpp index 3014e3f2bf..392c9a94ac 100644 --- a/engines/gob/save/saveload_playtoons.cpp +++ b/engines/gob/save/saveload_playtoons.cpp @@ -30,14 +30,17 @@ namespace Gob { SaveLoad_Playtoons::SaveFile SaveLoad_Playtoons::_saveFiles[] = { - { "disk.001", kSaveModeExists, 0, 0}, // Playtoons 1 identification file - { "disk.002", kSaveModeExists, 0, 0}, // Playtoons 2 identification file - { "disk.003", kSaveModeExists, 0, 0}, // Playtoons 3 identification file - { "disk.004", kSaveModeExists, 0, 0}, // Playtoons 4 identification file - { "disk.005", kSaveModeExists, 0, 0}, // Playtoons 5 identification file - { "disk.006", kSaveModeExists, 0, 0}, // Playtoons CK 1 identification file - { "disk.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 identification file - { "disk.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 identification file + { "did.inf", kSaveModeSave, 0, 0}, // + { "dan.itk", kSaveModeNone, 0, 0}, // Playtoons CK initial detection file + { "disk.001", kSaveModeExists, 0, 0}, // Playtoons 1 identification file + { "disk.002", kSaveModeExists, 0, 0}, // Playtoons 2 identification file + { "disk.003", kSaveModeExists, 0, 0}, // Playtoons 3 identification file + { "disk.004", kSaveModeExists, 0, 0}, // Playtoons 4 identification file + { "disk.005", kSaveModeExists, 0, 0}, // Playtoons 5 identification file + { "disk.006", kSaveModeExists, 0, 0}, // Playtoons CK 1 identification file + { "disk.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 identification file + { "disk.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 identification file +/* { "titre.001", kSaveModeExists, 0, 0}, // Playtoons 1 titles { "titre.002", kSaveModeExists, 0, 0}, // Playtoons 2 titles { "titre.003", kSaveModeExists, 0, 0}, // Playtoons 3 titles @@ -46,25 +49,237 @@ SaveLoad_Playtoons::SaveFile SaveLoad_Playtoons::_saveFiles[] = { { "titre.006", kSaveModeExists, 0, 0}, // Playtoons CK 1 empty title (???) { "titre.007", kSaveModeExists, 0, 0}, // Playtoons CK 2 empty title (???) { "titre.008", kSaveModeExists, 0, 0}, // Playtoons CK 3 empty title (???) - { "mdo.def", kSaveModeExists, 0, 0}, - { "dan.itk", kSaveModeNone, 0, 0}, - { "did.inf", kSaveModeSave, 0, 0}, + { "mdo.def", kSaveModeExists, 0, 0}, // +*/ }; -SaveLoad::SaveMode SaveLoad_Playtoons::getSaveMode(const char *fileName) const { - const SaveFile *saveFile = getSaveFile(fileName); +SaveLoad_Playtoons::GameHandler::File::File(GobEngine *vm, const char *base) : + SlotFileIndexed(vm, SaveLoad_Playtoons::kSlotCount, base, "s") { +} - if (saveFile) - return saveFile->mode; +SaveLoad_Playtoons::GameHandler::File::~File() { +} - return kSaveModeNone; +int SaveLoad_Playtoons::GameHandler::File::getSlot(int32 offset) const { + uint32 varSize = SaveHandler::getVarSize(_vm); + + if (varSize == 0) + return -1; + + return ((offset - 2900) / varSize); +} + +int SaveLoad_Playtoons::GameHandler::File::getSlotRemainder(int32 offset) const { + uint32 varSize = SaveHandler::getVarSize(_vm); + + if (varSize == 0) + return -1; + + return ((offset - 2900) % varSize); +} + + +SaveLoad_Playtoons::GameHandler::GameHandler(GobEngine *vm, const char *target) : SaveHandler(vm) { + memset(_props, 0, 500); + memset(_index, 0, 2400); + + _slotFile = new File(vm, target); +} + +SaveLoad_Playtoons::GameHandler::~GameHandler() { + delete _slotFile; +} + +int32 SaveLoad_Playtoons::GameHandler::getSize() { + uint32 varSize = SaveHandler::getVarSize(_vm); + + if (varSize == 0) + return -1; + + return _slotFile->tallyUpFiles(varSize, 2900); +} + +bool SaveLoad_Playtoons::GameHandler::load(int16 dataVar, int32 size, int32 offset) { + uint32 varSize = SaveHandler::getVarSize(_vm); + + if (varSize == 0) + return false; + + if (size == 0) { + // Indicator to load all variables + dataVar = 0; + size = varSize; + } + + if (offset < 500) { + // Properties + + if ((offset + size) > 500) { + warning("Wrong index size (%d, %d)", size, offset); + return false; + } + + _vm->_inter->_variables->copyFrom(dataVar, _props + offset, size); + + } else if (offset < 2900) { + // Save index + + if (size != 2400) { + warning("Wrong index size (%d, %d)", size, offset); + return false; + } + + buildIndex(_vm->_inter->_variables->getAddressOff8(dataVar)); + + } else { + // Save slot, whole variable block + + uint32 slot = _slotFile->getSlot(offset); + int slotRem = _slotFile->getSlotRemainder(offset); + + debugC(2, kDebugSaveLoad, "Loading from slot %d", slot); + + if ((slot >= kSlotCount) || (slotRem != 0) || + (dataVar != 0) || (((uint32) size) != varSize)) { + + warning("Invalid loading procedure (%d, %d, %d, %d, %d)", + dataVar, size, offset, slot, slotRem); + return false; + } + + Common::String slotFile = _slotFile->build(slot); + + SaveReader *reader = 0; + + // New save, load directly + reader = new SaveReader(2, slot, slotFile); + + SavePartInfo info(kSlotNameLength, (uint32) _vm->getGameType(), 0, + _vm->getEndianness(), varSize); + SavePartVars vars(_vm, varSize); + + if (!reader->load()) { + delete reader; + return false; + } + + if (!reader->readPart(0, &info)) { + delete reader; + return false; + } + if (!reader->readPart(1, &vars)) { + delete reader; + return false; + } + + // Get all variables + if (!vars.writeInto(0, 0, varSize)) { + delete reader; + return false; + } + + delete reader; + } + + return true; } -SaveLoad_Playtoons::SaveLoad_Playtoons(GobEngine *vm) : +bool SaveLoad_Playtoons::GameHandler::save(int16 dataVar, int32 size, int32 offset) { + uint32 varSize = SaveHandler::getVarSize(_vm); + + warning("Saving %d %d %d", dataVar, size, offset); + + if (varSize == 0) + return false; + + if (size == 0) { + // Indicator to save all variables + dataVar = 0; + size = varSize; + } + + if (offset < 500) { + // Properties + + if ((offset + size) > 500) { + warning("Wrong index size (%d, %d)", size, offset); + return false; + } + + _vm->_inter->_variables->copyTo(dataVar, _props + offset, size); + + } else if (offset < 2900) { + // Save index + + if (size != 2400) { + warning("Wrong index size (%d, %d)", size, offset); + return false; + } + + // Just copy the index into our buffer + _vm->_inter->_variables->copyTo(dataVar, _index, 2400); + + } else { + // Save slot, whole variable block + + uint32 slot = _slotFile->getSlot(offset); + int slotRem = _slotFile->getSlotRemainder(offset); + + debugC(2, kDebugSaveLoad, "Saving to slot %d", slot); + + if ((slot >= kSlotCount) || (slotRem != 0) || + (dataVar != 0) || (((uint32) size) != varSize)) { + + warning("Invalid saving procedure (%d, %d, %d, %d, %d)", + dataVar, size, offset, slot, slotRem); + return false; + } + + Common::String slotFile = _slotFile->build(slot); + + SaveWriter writer(2, slot, slotFile); + SavePartInfo info(kSlotNameLength, (uint32) _vm->getGameType(), 0, + _vm->getEndianness(), varSize); + SavePartVars vars(_vm, varSize); + + // Write the description + info.setDesc(_index + (slot * kSlotNameLength), kSlotNameLength); + // Write all variables + if (!vars.readFrom(0, 0, varSize)) + return false; + + if (!writer.writePart(0, &info)) + return false; + if (!writer.writePart(1, &vars)) + return false; + } + + return true; +} + +void SaveLoad_Playtoons::GameHandler::buildIndex(byte *buffer) const { + uint32 varSize = SaveHandler::getVarSize(_vm); + + if (varSize == 0) + return; + + SavePartInfo info(kSlotNameLength, (uint32) _vm->getGameType(), + 0, _vm->getEndianness(), varSize); + + _slotFile->buildIndex(buffer, info, 0); +} + + +SaveLoad_Playtoons::SaveLoad_Playtoons(GobEngine *vm, const char *targetName) : SaveLoad(vm) { + + _gameHandler = new GameHandler(vm, targetName); + + _saveFiles[0].handler = _gameHandler; } SaveLoad_Playtoons::~SaveLoad_Playtoons() { + delete _gameHandler; } const SaveLoad_Playtoons::SaveFile *SaveLoad_Playtoons::getSaveFile(const char *fileName) const { @@ -87,4 +302,31 @@ SaveLoad_Playtoons::SaveFile *SaveLoad_Playtoons::getSaveFile(const char *fileNa return 0; } +SaveHandler *SaveLoad_Playtoons::getHandler(const char *fileName) const { + const SaveFile *saveFile = getSaveFile(fileName); + + if (saveFile) + return saveFile->handler; + + return 0; +} + +const char *SaveLoad_Playtoons::getDescription(const char *fileName) const { + const SaveFile *saveFile = getSaveFile(fileName); + + if (saveFile) + return saveFile->description; + + return 0; +} + +SaveLoad::SaveMode SaveLoad_Playtoons::getSaveMode(const char *fileName) const { + const SaveFile *saveFile = getSaveFile(fileName); + + if (saveFile) + return saveFile->mode; + + return kSaveModeNone; +} + } // End of namespace Gob diff --git a/engines/gob/save/saveload_v3.cpp b/engines/gob/save/saveload_v3.cpp index 58232e6991..c24b13d27b 100644 --- a/engines/gob/save/saveload_v3.cpp +++ b/engines/gob/save/saveload_v3.cpp @@ -33,8 +33,8 @@ namespace Gob { SaveLoad_v3::SaveFile SaveLoad_v3::_saveFiles[] = { { "cat.inf", kSaveModeSave , 0, "savegame"}, { "ima.inf", kSaveModeSave , 0, "screenshot"}, - { "intro.$$$", kSaveModeSave , 0, "temporary sprite"}, { "bloc.inf", kSaveModeSave , 0, "notes"}, + { "intro.$$$", kSaveModeIgnore, 0, "temporary sprite"}, { "prot", kSaveModeIgnore, 0, 0}, { "config", kSaveModeIgnore, 0, 0} }; @@ -496,20 +496,17 @@ SaveLoad_v3::SaveLoad_v3(GobEngine *vm, const char *targetName, ScreenshotType s _screenshotHandler = new ScreenshotHandler(vm, _gameHandler, sShotType); } - _tempSpriteHandler = new TempSpriteHandler(vm); _notesHandler = new NotesHandler(2560, vm, targetName); _saveFiles[0].handler = _gameHandler; _saveFiles[1].handler = _screenshotHandler; - _saveFiles[2].handler = _tempSpriteHandler; - _saveFiles[3].handler = _notesHandler; + _saveFiles[2].handler = _notesHandler; } SaveLoad_v3::~SaveLoad_v3() { delete _screenshotHandler; delete _gameHandler; delete _notesHandler; - delete _tempSpriteHandler; } const SaveLoad_v3::SaveFile *SaveLoad_v3::getSaveFile(const char *fileName) const { diff --git a/engines/gob/video_v6.cpp b/engines/gob/video_v6.cpp index 983eeea8cf..5468f7c89d 100644 --- a/engines/gob/video_v6.cpp +++ b/engines/gob/video_v6.cpp @@ -40,7 +40,7 @@ Video_v6::Video_v6(GobEngine *vm) : Video_v2(vm) { } void Video_v6::setPrePalette() { - byte *tpal = (byte *) _vm->_draw->_vgaPalette;; + byte *tpal = (byte *) _vm->_draw->_vgaPalette; const byte *fpal = (const byte *) _ditherPalette; for (int i = 0; i < 256; i++) { |