diff options
author | Paul Gilbert | 2016-03-19 08:08:01 -0400 |
---|---|---|
committer | Paul Gilbert | 2016-03-19 08:08:01 -0400 |
commit | 2665e0e08f0f1c8e70738dad793de20176e0d9c4 (patch) | |
tree | dde10074c2fbd35297b50a1a5d30d754dea5b124 /engines | |
parent | 3a42c8ca449248dfc67a98f3bedd65c237d06fa0 (diff) | |
download | scummvm-rg350-2665e0e08f0f1c8e70738dad793de20176e0d9c4.tar.gz scummvm-rg350-2665e0e08f0f1c8e70738dad793de20176e0d9c4.tar.bz2 scummvm-rg350-2665e0e08f0f1c8e70738dad793de20176e0d9c4.zip |
TITANIC: Added various preSave and postSave methods
Diffstat (limited to 'engines')
-rw-r--r-- | engines/titanic/game_manager.cpp | 36 | ||||
-rw-r--r-- | engines/titanic/game_manager.h | 36 | ||||
-rw-r--r-- | engines/titanic/sound/sound.h | 10 | ||||
-rw-r--r-- | engines/titanic/sound/sound_manager.h | 5 | ||||
-rw-r--r-- | engines/titanic/true_talk/true_talk_manager.h | 10 |
5 files changed, 95 insertions, 2 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b181edcaeb..1d34650552 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -27,7 +27,6 @@ #include "titanic/core/project_item.h" #include "titanic/messages/messages.h" - namespace Titanic { void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { @@ -35,12 +34,30 @@ void CGameManagerList::postLoad(uint ticks, CProjectItem *project) { (*i)->postLoad(ticks, project); } +void CGameManagerList::preSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->preSave(); +} + +void CGameManagerList::postSave() { + for (iterator i = begin(); i != end(); ++i) + (*i)->postSave(); +} + /*------------------------------------------------------------------------*/ void CGameManagerListItem::postLoad(uint ticks, CProjectItem *project) { warning("TODO"); } +void CGameManagerListItem::preSave() { + warning("TODO: CGameManagerListItem::preSave"); +} + +void CGameManagerListItem::postSave() { + warning("TODO: CGameManagerListItem::postSave"); +} + /*------------------------------------------------------------------------*/ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): @@ -97,6 +114,23 @@ void CGameManager::postLoad(CProjectItem *project) { _sound.postLoad(); } +void CGameManager::preSave(CProjectItem *project) { + // Generate a message that a save is being done + updateDiskTicksCount(); + CPreSaveMsg msg(_lastDiskTicksCount); + msg.execute(project, nullptr, MSGFLAG_SCAN); + + // Notify sub-objects of the save + _list.preSave(); + _trueTalkManager.preSave(); + _sound.preSave(); +} + +void CGameManager::postSave() { + _list.postSave(); + _trueTalkManager.postSave(); +} + void CGameManager::initBounds() { _bounds = Common::Rect(0, 0, SCREEN_WIDTH, SCREEN_HEIGHT); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 4380e4f8ec..43d0dff025 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -42,12 +42,38 @@ class CGameManagerListItem : public ListItem { private: static int _v1; public: + /** + * Called after loading a game has finished + */ void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); }; class CGameManagerList : public List<CGameManagerListItem> { public: + /** + * Called after loading a game has finished + */ void postLoad(uint ticks, CProjectItem *project); + + /** + * Called when a game is about to be saved + */ + void preSave(); + + /** + * Called when a game has finished being saved + */ + void postSave(); }; class CGameManager { @@ -92,6 +118,16 @@ public: void postLoad(CProjectItem *project); /** + * Called when a game is about to be saved + */ + void preSave(CProjectItem *project); + + /** + * Called when a game has finished being saved + */ + void postSave(); + + /** * Updates the game time when the last disk access started */ void updateDiskTicksCount(); diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index 1b98507a93..fce29eb625 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -56,6 +56,16 @@ public: * Called when loading a game is complete */ void postLoad() { _soundManager.postLoad(); } + + /** + * Called when a game is about to be saved + */ + void preSave() { _soundManager.preSave(); } + + /** + * Called when a game has finished being saved + */ + void postSave() { _soundManager.postSave(); } }; } // End of namespace Titanic diff --git a/engines/titanic/sound/sound_manager.h b/engines/titanic/sound/sound_manager.h index 6a2e5a79d3..99513aefe8 100644 --- a/engines/titanic/sound/sound_manager.h +++ b/engines/titanic/sound/sound_manager.h @@ -73,7 +73,10 @@ public: */ virtual void postLoad() {} - virtual void proc26() {} + /** + * Called when a game is about to be saved + */ + virtual void preSave() {} /** * Save the data for the class to file diff --git a/engines/titanic/true_talk/true_talk_manager.h b/engines/titanic/true_talk/true_talk_manager.h index ac36102cf0..8a59655075 100644 --- a/engines/titanic/true_talk/true_talk_manager.h +++ b/engines/titanic/true_talk/true_talk_manager.h @@ -88,6 +88,16 @@ public: void postLoad() {} /** + * Called when a game is about to be saved + */ + void preSave() {} + + /** + * Called when a game has finished being saved + */ + void postSave() {} + + /** * Returns the scripts for the manager */ TTScripts &getScripts() { return _scripts; } |