diff options
author | Paul Gilbert | 2016-03-10 18:44:18 -0500 |
---|---|---|
committer | Paul Gilbert | 2016-03-10 18:44:18 -0500 |
commit | 0fead6fe565d6e4a70adc1ab2273b55026e07655 (patch) | |
tree | 707ee760ad7bbfc612f6697f985c2b33820fac49 /engines/titanic | |
parent | 759c0e3b4584d412f12250e0f248bad062581215 (diff) | |
download | scummvm-rg350-0fead6fe565d6e4a70adc1ab2273b55026e07655.tar.gz scummvm-rg350-0fead6fe565d6e4a70adc1ab2273b55026e07655.tar.bz2 scummvm-rg350-0fead6fe565d6e4a70adc1ab2273b55026e07655.zip |
TITANIC: Beginnings of game manager data loading
Diffstat (limited to 'engines/titanic')
-rw-r--r-- | engines/titanic/game_manager.cpp | 7 | ||||
-rw-r--r-- | engines/titanic/game_manager.h | 7 | ||||
-rw-r--r-- | engines/titanic/game_state.cpp | 23 | ||||
-rw-r--r-- | engines/titanic/game_state.h | 10 | ||||
-rw-r--r-- | engines/titanic/game_state_sub.cpp | 13 | ||||
-rw-r--r-- | engines/titanic/game_state_sub.h | 12 | ||||
-rw-r--r-- | engines/titanic/npcs/true_talk_manager.cpp | 47 | ||||
-rw-r--r-- | engines/titanic/npcs/true_talk_manager.h | 26 | ||||
-rw-r--r-- | engines/titanic/screen_manager.cpp | 3 | ||||
-rw-r--r-- | engines/titanic/sound/sound.cpp | 8 | ||||
-rw-r--r-- | engines/titanic/sound/sound.h | 12 |
11 files changed, 164 insertions, 4 deletions
diff --git a/engines/titanic/game_manager.cpp b/engines/titanic/game_manager.cpp index b26c9b3297..b677bf28e0 100644 --- a/engines/titanic/game_manager.cpp +++ b/engines/titanic/game_manager.cpp @@ -40,9 +40,10 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView): void CGameManager::load(SimpleFile *file) { file->readNumber(); - //_gameState.load(file); - //_list.load(file); - + _gameState.load(file); + _list.load(file); + _trueTalkManager.load(file); + _sound.load(file); } diff --git a/engines/titanic/game_manager.h b/engines/titanic/game_manager.h index 7ba1b3e01c..200f34fd5c 100644 --- a/engines/titanic/game_manager.h +++ b/engines/titanic/game_manager.h @@ -38,6 +38,12 @@ namespace Titanic { class CProjectItem; class CGameView; +class CGameManagerListItem : public ListItem { +}; + +class CGameManagerList : public List<CGameManagerListItem> { +}; + class CGameManager { private: CProjectItem *_project; @@ -49,6 +55,7 @@ private: CMusicRoom _musicRoom; CTrueTalkManager _trueTalkManager; Common::Rect _bounds; + CGameManagerList _list; int _field30; int _field34; int _field48; diff --git a/engines/titanic/game_state.cpp b/engines/titanic/game_state.cpp index 3ead6d153e..59e4b7b837 100644 --- a/engines/titanic/game_state.cpp +++ b/engines/titanic/game_state.cpp @@ -29,7 +29,30 @@ CGameState::CGameState(CGameManager *gameManager) : _field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field30(0), _field34(0), _field38(0) { +} + +void CGameState::save(SimpleFile *file) const { + file->writeNumber(_field18); + file->writeNumber(_field8); + file->writeNumber(_fieldC); + file->writeNumber(_field14); + file->writeNumber(_field24); + file->writeNumber(_field38); + _sub.save(file); + file->writeNumber(_field1C); +} + +void CGameState::load(SimpleFile *file) { + _field18 = file->readNumber(); + _field8 = file->readNumber(); + _fieldC = file->readNumber(); + _field14 = file->readNumber(); + _field24 = file->readNumber(); + _field38 = file->readNumber(); + _sub.load(file); + _field1C = file->readNumber(); + _field28 = _field2C = 0; } } // End of namespace Titanic z diff --git a/engines/titanic/game_state.h b/engines/titanic/game_state.h index f52e0d6b8d..e6275dee01 100644 --- a/engines/titanic/game_state.h +++ b/engines/titanic/game_state.h @@ -59,6 +59,16 @@ public: int _field38; public: CGameState(CGameManager *gameManager); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/game_state_sub.cpp b/engines/titanic/game_state_sub.cpp index 11cea2b3b0..212fcce676 100644 --- a/engines/titanic/game_state_sub.cpp +++ b/engines/titanic/game_state_sub.cpp @@ -29,4 +29,17 @@ CGameStateSub::CGameStateSub(CGameState *owner) : _gameState(owner), _field0(0), _field4(0), _field8(0), _fieldC(0) { } +void CGameStateSub::save(SimpleFile *file) const { + file->writeNumber(_field4); + file->writeNumber(_field8); + file->writeNumber(_fieldC); +} + +void CGameStateSub::load(SimpleFile *file) { + _field0 = 0; + _field4 = file->readNumber(); + _field8 = file->readNumber(); + _fieldC = file->readNumber(); +} + } // End of namespace Titanic z diff --git a/engines/titanic/game_state_sub.h b/engines/titanic/game_state_sub.h index 41f27df8fc..2ea6bd60b0 100644 --- a/engines/titanic/game_state_sub.h +++ b/engines/titanic/game_state_sub.h @@ -23,6 +23,8 @@ #ifndef TITANIC_GAME_STATE_SUB_H #define TITANIC_GAME_STATE_SUB_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameState; @@ -37,6 +39,16 @@ public: int _fieldC; public: CGameStateSub(CGameState *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.cpp b/engines/titanic/npcs/true_talk_manager.cpp index a9cc829e72..dbf97128a7 100644 --- a/engines/titanic/npcs/true_talk_manager.cpp +++ b/engines/titanic/npcs/true_talk_manager.cpp @@ -24,7 +24,54 @@ namespace Titanic { +int CTrueTalkManager::_v1; +int CTrueTalkManager::_v2; +int CTrueTalkManager::_v3; +bool CTrueTalkManager::_v4; +bool CTrueTalkManager::_v5; +int CTrueTalkManager::_v6; +int CTrueTalkManager::_v7; +bool CTrueTalkManager::_v8; +int CTrueTalkManager::_v9; +bool CTrueTalkManager::_v10; +int CTrueTalkManager::_v11[41]; + CTrueTalkManager::CTrueTalkManager(CGameManager *owner) : _gameManager(owner) { } +void CTrueTalkManager::save(SimpleFile *file) const { + +} + +void CTrueTalkManager::load(SimpleFile *file) { + loadStatics(file); + + int count = file->readNumber(); + //TODO +} + +void CTrueTalkManager::loadStatics(SimpleFile *file) { + int count = file->readNumber(); + _v1 = file->readNumber(); + _v2 = file->readNumber(); + _v3 = file->readNumber(); + _v4 = file->readNumber() != 0; + _v5 = file->readNumber() != 0; + _v6 = file->readNumber(); + _v7 = file->readNumber(); + _v8 = file->readNumber() != 0; + _v9 = file->readNumber(); + _v10 = file->readNumber() != 0; + + for (int idx = count; count > 10; --idx) + file->readNumber(); + + int count2 = file->readNumber(); + for (int idx = 0; idx < count2; ++idx) { + int v = file->readNumber(); + if (idx < 41) + _v11[idx] = v; + } +} + } // End of namespace Titanic diff --git a/engines/titanic/npcs/true_talk_manager.h b/engines/titanic/npcs/true_talk_manager.h index decc593773..d491a61dab 100644 --- a/engines/titanic/npcs/true_talk_manager.h +++ b/engines/titanic/npcs/true_talk_manager.h @@ -23,15 +23,41 @@ #ifndef TITANIC_TRUE_TALK_MANAGER_H #define TITANIC_TRUE_TALK_MANAGER_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameManager; class CTrueTalkManager { +private: + void loadStatics(SimpleFile *file); +public: + static int _v1; + static int _v2; + static int _v3; + static bool _v4; + static bool _v5; + static int _v6; + static int _v7; + static bool _v8; + static int _v9; + static bool _v10; + static int _v11[41]; public: CGameManager *_gameManager; public: CTrueTalkManager(CGameManager *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic diff --git a/engines/titanic/screen_manager.cpp b/engines/titanic/screen_manager.cpp index 145ba432c0..47e5d3d49a 100644 --- a/engines/titanic/screen_manager.cpp +++ b/engines/titanic/screen_manager.cpp @@ -126,7 +126,8 @@ void OSScreenManager::proc20() {} void OSScreenManager::proc21() {} CVideoSurface *OSScreenManager::createSurface(int w, int h) { - error("TODO"); + warning("TODO"); + return nullptr; } void OSScreenManager::proc23() {} diff --git a/engines/titanic/sound/sound.cpp b/engines/titanic/sound/sound.cpp index c0fd9fe2ed..cea377eef7 100644 --- a/engines/titanic/sound/sound.cpp +++ b/engines/titanic/sound/sound.cpp @@ -27,4 +27,12 @@ namespace Titanic { CSound::CSound(CGameManager *owner) : _gameManager(owner) { } +void CSound::save(SimpleFile *file) const { + +} + +void CSound::load(SimpleFile *file) { + +} + } // End of namespace Titanic z diff --git a/engines/titanic/sound/sound.h b/engines/titanic/sound/sound.h index d9db81961a..2d0ccecbc5 100644 --- a/engines/titanic/sound/sound.h +++ b/engines/titanic/sound/sound.h @@ -23,6 +23,8 @@ #ifndef TITANIC_SOUND_H #define TITANIC_SOUND_H +#include "titanic/simple_file.h" + namespace Titanic { class CGameManager; @@ -32,6 +34,16 @@ public: CGameManager *_gameManager; public: CSound(CGameManager *owner); + + /** + * Save the data for the class to file + */ + void save(SimpleFile *file) const; + + /** + * Load the data for the class from file + */ + void load(SimpleFile *file); }; } // End of namespace Titanic |