TITANIC: Beginnings of game manager data loading

This commit is contained in:
Paul Gilbert 2016-03-10 18:44:18 -05:00
parent 759c0e3b45
commit 0fead6fe56
11 changed files with 164 additions and 4 deletions

View File

@ -40,9 +40,10 @@ CGameManager::CGameManager(CProjectItem *project, CGameView *gameView):
void CGameManager::load(SimpleFile *file) { void CGameManager::load(SimpleFile *file) {
file->readNumber(); file->readNumber();
//_gameState.load(file); _gameState.load(file);
//_list.load(file); _list.load(file);
_trueTalkManager.load(file);
_sound.load(file);
} }

View File

@ -38,6 +38,12 @@ namespace Titanic {
class CProjectItem; class CProjectItem;
class CGameView; class CGameView;
class CGameManagerListItem : public ListItem {
};
class CGameManagerList : public List<CGameManagerListItem> {
};
class CGameManager { class CGameManager {
private: private:
CProjectItem *_project; CProjectItem *_project;
@ -49,6 +55,7 @@ private:
CMusicRoom _musicRoom; CMusicRoom _musicRoom;
CTrueTalkManager _trueTalkManager; CTrueTalkManager _trueTalkManager;
Common::Rect _bounds; Common::Rect _bounds;
CGameManagerList _list;
int _field30; int _field30;
int _field34; int _field34;
int _field48; int _field48;

View File

@ -29,7 +29,30 @@ CGameState::CGameState(CGameManager *gameManager) :
_field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0), _field8(0), _fieldC(0), _field10(10), _field14(0), _field18(0),
_field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0), _field1C(0), _field20(0), _field24(0), _field28(0), _field2C(0),
_field30(0), _field34(0), _field38(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 } // End of namespace Titanic z

View File

@ -59,6 +59,16 @@ public:
int _field38; int _field38;
public: public:
CGameState(CGameManager *gameManager); 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 } // End of namespace Titanic

View File

@ -29,4 +29,17 @@ CGameStateSub::CGameStateSub(CGameState *owner) : _gameState(owner),
_field0(0), _field4(0), _field8(0), _fieldC(0) { _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 } // End of namespace Titanic z

View File

@ -23,6 +23,8 @@
#ifndef TITANIC_GAME_STATE_SUB_H #ifndef TITANIC_GAME_STATE_SUB_H
#define TITANIC_GAME_STATE_SUB_H #define TITANIC_GAME_STATE_SUB_H
#include "titanic/simple_file.h"
namespace Titanic { namespace Titanic {
class CGameState; class CGameState;
@ -37,6 +39,16 @@ public:
int _fieldC; int _fieldC;
public: public:
CGameStateSub(CGameState *owner); 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 } // End of namespace Titanic

View File

@ -24,7 +24,54 @@
namespace Titanic { 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) { 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 } // End of namespace Titanic

View File

@ -23,15 +23,41 @@
#ifndef TITANIC_TRUE_TALK_MANAGER_H #ifndef TITANIC_TRUE_TALK_MANAGER_H
#define TITANIC_TRUE_TALK_MANAGER_H #define TITANIC_TRUE_TALK_MANAGER_H
#include "titanic/simple_file.h"
namespace Titanic { namespace Titanic {
class CGameManager; class CGameManager;
class CTrueTalkManager { 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: public:
CGameManager *_gameManager; CGameManager *_gameManager;
public: public:
CTrueTalkManager(CGameManager *owner); 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 } // End of namespace Titanic

View File

@ -126,7 +126,8 @@ void OSScreenManager::proc20() {}
void OSScreenManager::proc21() {} void OSScreenManager::proc21() {}
CVideoSurface *OSScreenManager::createSurface(int w, int h) { CVideoSurface *OSScreenManager::createSurface(int w, int h) {
error("TODO"); warning("TODO");
return nullptr;
} }
void OSScreenManager::proc23() {} void OSScreenManager::proc23() {}

View File

@ -27,4 +27,12 @@ namespace Titanic {
CSound::CSound(CGameManager *owner) : _gameManager(owner) { CSound::CSound(CGameManager *owner) : _gameManager(owner) {
} }
void CSound::save(SimpleFile *file) const {
}
void CSound::load(SimpleFile *file) {
}
} // End of namespace Titanic z } // End of namespace Titanic z

View File

@ -23,6 +23,8 @@
#ifndef TITANIC_SOUND_H #ifndef TITANIC_SOUND_H
#define TITANIC_SOUND_H #define TITANIC_SOUND_H
#include "titanic/simple_file.h"
namespace Titanic { namespace Titanic {
class CGameManager; class CGameManager;
@ -32,6 +34,16 @@ public:
CGameManager *_gameManager; CGameManager *_gameManager;
public: public:
CSound(CGameManager *owner); 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 } // End of namespace Titanic