TSAGE: Implement code for restarting the game in Blue Force

This commit is contained in:
Paul Gilbert 2011-11-02 19:43:52 +11:00
parent e38921855c
commit e9aebf0a21
3 changed files with 22 additions and 1 deletions

View File

@ -315,6 +315,24 @@ void BlueForceGame::processEvent(Event &event) {
}
}
void BlueForceGame::restart() {
g_globals->_scenePalette.clearListeners();
g_globals->_soundHandler.stop();
// Reset the globals
g_globals->reset();
// Clear save/load slots
g_globals->_sceneHandler->_saveGameSlot = -1;
g_globals->_sceneHandler->_loadGameSlot = -1;
g_globals->_stripNum = 0;
g_globals->_events.setCursor(CURSOR_WALK);
// Change to the first game scene
g_globals->_sceneManager.changeScene(190);
}
/*--------------------------------------------------------------------------*/
AObjectArray::AObjectArray(): EventHandler() {

View File

@ -45,6 +45,7 @@ public:
virtual void processEvent(Event &event);
virtual bool canSaveGameStateCurrently();
virtual bool canLoadGameStateCurrently();
virtual void restart();
};
#define OBJ_ARRAY_SIZE 10

View File

@ -3220,9 +3220,11 @@ void Scene190::postInit(SceneObjectList *OwnerList) {
(BF_GLOBALS._sceneManager._previousScene == 20)) {
// clearScreen();
}
if (BF_GLOBALS._dayNumber == 0)
if (BF_GLOBALS._dayNumber == 0) {
// If at start of game, change to first day
BF_GLOBALS._dayNumber = 1;
g_globals->_sceneManager._previousScene = 100;
}
// Load the scene data
loadScene(190);