diff options
author | Paul Gilbert | 2013-07-31 21:01:04 -0400 |
---|---|---|
committer | Paul Gilbert | 2013-07-31 21:01:04 -0400 |
commit | 07d8e5643b11e109da5f3e9fabaed023e5717457 (patch) | |
tree | 00953bde6aecc9d3cb89223bc990258bd832f1bc /engines | |
parent | b0ce97bccf77a9bf1690816df29e14778bfb1d3e (diff) | |
download | scummvm-rg350-07d8e5643b11e109da5f3e9fabaed023e5717457.tar.gz scummvm-rg350-07d8e5643b11e109da5f3e9fabaed023e5717457.tar.bz2 scummvm-rg350-07d8e5643b11e109da5f3e9fabaed023e5717457.zip |
HOPKINS: Reverted to saving Breakout high scores in a separate file
Diffstat (limited to 'engines')
-rw-r--r-- | engines/hopkins/computer.cpp | 14 | ||||
-rw-r--r-- | engines/hopkins/detection.cpp | 4 | ||||
-rw-r--r-- | engines/hopkins/globals.cpp | 2 | ||||
-rw-r--r-- | engines/hopkins/globals.h | 1 | ||||
-rw-r--r-- | engines/hopkins/hopkins.h | 1 | ||||
-rw-r--r-- | engines/hopkins/saveload.cpp | 11 | ||||
-rw-r--r-- | engines/hopkins/saveload.h | 3 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.cpp | 13 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_logic.h | 10 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.cpp | 13 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes0.h | 9 | ||||
-rw-r--r-- | engines/tsage/ringworld2/ringworld2_scenes1.h | 13 |
12 files changed, 63 insertions, 31 deletions
diff --git a/engines/hopkins/computer.cpp b/engines/hopkins/computer.cpp index 82e0dd0a06..489e7e1133 100644 --- a/engines/hopkins/computer.cpp +++ b/engines/hopkins/computer.cpp @@ -578,7 +578,11 @@ void ComputerManager::displayGamesSubMenu() { * Load Highscore from file */ void ComputerManager::loadHiscore() { - const byte *ptr = _vm->_globals->_highScoreData; + byte *ptr = _vm->_globals->allocMemory(100); + memset(ptr, 0, 100); + + if (_vm->_saveLoad->saveExists(_vm->targetName() + "-highscore.dat")) + _vm->_saveLoad->load(_vm->targetName() + "-highscore.dat", ptr); for (int scoreIndex = 0; scoreIndex < 6; ++scoreIndex) { _score[scoreIndex]._name = " "; @@ -600,6 +604,7 @@ void ComputerManager::loadHiscore() { } _lowestHiScore = atol(_score[5]._score.c_str()); + _vm->_globals->freeMemory(ptr); } /** @@ -985,8 +990,8 @@ void ComputerManager::saveScore() { } } - byte *ptr = _vm->_globals->_highScoreData; - memset(ptr, 0, 99); + byte *ptr = _vm->_globals->allocMemory(100); + memset(ptr, 0, 100); for (int scorePlaceIdx = 0; scorePlaceIdx <= 5; scorePlaceIdx++) { int curBufPtr = 16 * scorePlaceIdx; for (int namePos = 0; namePos < 6; namePos++) { @@ -1006,6 +1011,9 @@ void ComputerManager::saveScore() { }; ptr[curBufPtr + 15] = 0; } + + _vm->_saveLoad->saveFile(_vm->targetName() + "-highscore.dat", ptr, 100); + _vm->_globals->freeMemory(ptr); } /** diff --git a/engines/hopkins/detection.cpp b/engines/hopkins/detection.cpp index 9d16b0ab51..45b6c2bc1d 100644 --- a/engines/hopkins/detection.cpp +++ b/engines/hopkins/detection.cpp @@ -56,6 +56,10 @@ bool HopkinsEngine::getIsDemo() const { return _gameDescription->desc.flags & ADGF_DEMO; } +Common::String HopkinsEngine::targetName() const { + return _targetName; +} + } // End of namespace Hopkins static const PlainGameDescriptor hopkinsGames[] = { diff --git a/engines/hopkins/globals.cpp b/engines/hopkins/globals.cpp index 97d6c4046c..a9a0a81f08 100644 --- a/engines/hopkins/globals.cpp +++ b/engines/hopkins/globals.cpp @@ -70,8 +70,6 @@ Globals::Globals(HopkinsEngine *vm) { for (int i = 0; i < 36; ++i) _inventory[i] = 0; - Common::fill(&_highScoreData[0], &_highScoreData[100], 0); - // Initialize fields _language = LANG_EN; diff --git a/engines/hopkins/globals.h b/engines/hopkins/globals.h index a76323bb50..94512c3d26 100644 --- a/engines/hopkins/globals.h +++ b/engines/hopkins/globals.h @@ -206,7 +206,6 @@ public: Common::String _zoneFilename; Common::String _textFilename; byte *_levelSpriteBuf; - byte _highScoreData[100]; EventMode _eventMode; diff --git a/engines/hopkins/hopkins.h b/engines/hopkins/hopkins.h index 398e41a4d2..54e7c90b78 100644 --- a/engines/hopkins/hopkins.h +++ b/engines/hopkins/hopkins.h @@ -164,6 +164,7 @@ public: Common::Platform getPlatform() const; uint16 getVersion() const; bool getIsDemo() const; + Common::String targetName() const; int getRandomNumber(int maxNumber); Common::String generateSaveName(int slotNumber); diff --git a/engines/hopkins/saveload.cpp b/engines/hopkins/saveload.cpp index 14b166294d..20ef5da44c 100644 --- a/engines/hopkins/saveload.cpp +++ b/engines/hopkins/saveload.cpp @@ -55,6 +55,13 @@ bool SaveLoadManager::save(const Common::String &file, const void *buf, size_t n return false; } +bool SaveLoadManager::saveExists(const Common::String &file) { + Common::InSaveFile *savefile = g_system->getSavefileManager()->openForLoading(file); + bool result = savefile != NULL; + delete savefile; + return result; +} + // Save File bool SaveLoadManager::saveFile(const Common::String &file, const void *buf, size_t n) { return save(file, buf, n); @@ -251,10 +258,6 @@ void SaveLoadManager::createThumbnail(Graphics::Surface *s) { } void SaveLoadManager::syncSavegameData(Common::Serializer &s, int version) { - if (version >= 3) - // Sync embedded Breakout game high score data - s.syncBytes(&_vm->_globals->_highScoreData[0], 100); - s.syncBytes(&_vm->_globals->_saveData->_data[0], 2050); syncCharacterLocation(s, _vm->_globals->_saveData->_cloneHopkins); syncCharacterLocation(s, _vm->_globals->_saveData->_realHopkins); diff --git a/engines/hopkins/saveload.h b/engines/hopkins/saveload.h index e4ee3aaeda..191cb9e18f 100644 --- a/engines/hopkins/saveload.h +++ b/engines/hopkins/saveload.h @@ -35,7 +35,7 @@ namespace Hopkins { class HopkinsEngine; -#define HOPKINS_SAVEGAME_VERSION 3 +#define HOPKINS_SAVEGAME_VERSION 2 struct hopkinsSavegameHeader { uint8 _version; @@ -56,6 +56,7 @@ private: public: SaveLoadManager(HopkinsEngine *vm); + bool saveExists(const Common::String &file); bool save(const Common::String &file, const void *buf, size_t n); bool saveFile(const Common::String &file, const void *buf, size_t n); void load(const Common::String &file, byte *buf); diff --git a/engines/tsage/ringworld2/ringworld2_logic.cpp b/engines/tsage/ringworld2/ringworld2_logic.cpp index ac6ba523f6..d9bb50453c 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.cpp +++ b/engines/tsage/ringworld2/ringworld2_logic.cpp @@ -2454,6 +2454,19 @@ void ScannerDialog::proc12(int visage, int stripFrameNum, int frameNum, int posX } } +/*--------------------------------------------------------------------------*/ + +FinePositionedObject::FinePositionedObject(): SceneObject() { + _x100 = _y100 = 0; +} + +void FinePositionedObject::synchronize(Serializer &s) { + EventHandler::synchronize(s); + + s.syncAsSint32LE(_x100); + s.syncAsSint32LE(_y100); +} + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_logic.h b/engines/tsage/ringworld2/ringworld2_logic.h index 2cf48f3cf3..371ec6be23 100644 --- a/engines/tsage/ringworld2/ringworld2_logic.h +++ b/engines/tsage/ringworld2/ringworld2_logic.h @@ -514,6 +514,16 @@ public: void proc12(int visage, int stripFrameNum, int frameNum, int posX, int posY); }; +class FinePositionedObject: public SceneObject { +public: + int _x100, _y100; +public: + FinePositionedObject(); + + virtual Common::String getClassName() { return "FinePositionedObject"; } + virtual void synchronize(Serializer &s); +}; + } // End of namespace Ringworld2 } // End of namespace TsAGE diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.cpp b/engines/tsage/ringworld2/ringworld2_scenes0.cpp index 4018921791..b977ea1516 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.cpp +++ b/engines/tsage/ringworld2/ringworld2_scenes0.cpp @@ -2312,19 +2312,6 @@ void Scene205::Action1::textLoop() { /*--------------------------------------------------------------------------*/ -Scene205::Object::Object(): SceneObject() { - _x100 = _y100 = 0; -} - -void Scene205::Object::synchronize(Serializer &s) { - EventHandler::synchronize(s); - - s.syncAsSint32LE(_x100); - s.syncAsSint32LE(_y100); -} - -/*--------------------------------------------------------------------------*/ - Scene205::Scene205(): SceneExt() { _yp = 0; _textIndex = 1; diff --git a/engines/tsage/ringworld2/ringworld2_scenes0.h b/engines/tsage/ringworld2/ringworld2_scenes0.h index 80dab89b32..b7268da788 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes0.h +++ b/engines/tsage/ringworld2/ringworld2_scenes0.h @@ -273,13 +273,8 @@ class Scene205: public SceneExt { }; /* Objects */ - class Object: public SceneObject { - public: - int _x100, _y100; - public: - Object(); - - virtual void synchronize(Serializer &s); + class Object: public FinePositionedObject { + // TODO: More derived logic }; private: void setup(); diff --git a/engines/tsage/ringworld2/ringworld2_scenes1.h b/engines/tsage/ringworld2/ringworld2_scenes1.h index 0da6b3f93d..f3e94369a7 100644 --- a/engines/tsage/ringworld2/ringworld2_scenes1.h +++ b/engines/tsage/ringworld2/ringworld2_scenes1.h @@ -39,6 +39,19 @@ namespace Ringworld2 { using namespace TsAGE; +class Scene1000 : public SceneExt { +public: + SequenceManager _sequenceManager1; + SequenceManager _sequenceManager2; + SpeakerGameText _gameTextSpeaker; + +public: + virtual void postInit(SceneObjectList *OwnerList = NULL); + virtual void remove(); + virtual void signal(); + virtual void dispatch(); +}; + class Scene1010 : public SceneExt { public: SequenceManager _sequenceManager; |