mirror of
https://github.com/libretro/scummvm.git
synced 2025-02-03 09:23:37 +00:00
TSAGE: Cleaned up the savegame code, and enabled it for Blue Force
This commit is contained in:
parent
c75da8051c
commit
b3773f7c37
@ -3790,8 +3790,9 @@ void SceneHandler::process(Event &event) {
|
||||
}
|
||||
|
||||
// Mouse press handling
|
||||
if (_globals->_player._uiEnabled && (event.eventType == EVENT_BUTTON_DOWN) &&
|
||||
!_globals->_sceneItems.empty()) {
|
||||
bool enabled = (_vm->getGameID() == GType_BlueForce) ? _globals->_player._enabled :
|
||||
_globals->_player._uiEnabled;
|
||||
if (enabled && (event.eventType == EVENT_BUTTON_DOWN) && !_globals->_sceneItems.empty()) {
|
||||
// Check if the mouse is on the player
|
||||
if (_globals->_player.contains(event.mousePos)) {
|
||||
playerAction(event);
|
||||
|
@ -196,7 +196,7 @@ void EventsClass::setCursor(CursorType cursorType) {
|
||||
// Exit cursor (Blue Force)
|
||||
assert(_vm->getGameID() == GType_BlueForce);
|
||||
cursor = _resourceManager->getSubResource(1, 5, 7, &size);
|
||||
_currentCursor = CURSOR_TALK;
|
||||
_currentCursor = CURSOR_EXIT;
|
||||
break;
|
||||
|
||||
case CURSOR_ARROW:
|
||||
|
@ -188,7 +188,24 @@ BlueForceGlobals::BlueForceGlobals(): Globals() {
|
||||
|
||||
void BlueForceGlobals::synchronize(Serializer &s) {
|
||||
Globals::synchronize(s);
|
||||
error("Sync variables");
|
||||
|
||||
s.syncAsSint16LE(_dayNumber);
|
||||
s.syncAsSint16LE(_v4CEA4);
|
||||
s.syncAsSint16LE(_v4CEA8);
|
||||
s.syncAsSint16LE(_driveFromScene);
|
||||
s.syncAsSint16LE(_driveToScene);
|
||||
s.syncAsSint16LE(_v4CF9E);
|
||||
s.syncAsSint16LE(_v4E238);
|
||||
s.syncAsSint16LE(_v501FC);
|
||||
s.syncAsSint16LE(_v50696);
|
||||
s.syncAsSint16LE(_v51C42);
|
||||
s.syncAsSint16LE(_v51C44);
|
||||
s.syncAsSint16LE(_interfaceY);
|
||||
s.syncAsSint16LE(_bookmark);
|
||||
s.syncAsSint16LE(_mapLocationId);
|
||||
s.syncAsSint16LE(_clip1Bullets);
|
||||
s.syncAsSint16LE(_clip2Bullets);
|
||||
|
||||
}
|
||||
|
||||
void BlueForceGlobals::reset() {
|
||||
|
@ -166,6 +166,7 @@ class BlueForceGlobals: public Globals {
|
||||
public:
|
||||
ASoundExt _sound1, _sound2, _sound3;
|
||||
UIElements _uiElements;
|
||||
StripProxy _stripProxy;
|
||||
int _dayNumber;
|
||||
int _v4CEA4;
|
||||
int _v4CEA8;
|
||||
@ -173,15 +174,14 @@ public:
|
||||
int _driveToScene;
|
||||
int _v4CF9E;
|
||||
int _v4E238;
|
||||
int _v50696;
|
||||
int _v501FC;
|
||||
int _v50696;
|
||||
int _v51C42;
|
||||
int _v51C44;
|
||||
int _interfaceY;
|
||||
Bookmark _bookmark;
|
||||
int _mapLocationId;
|
||||
int _clip1Bullets, _clip2Bullets;
|
||||
StripProxy _stripProxy;
|
||||
|
||||
BlueForceGlobals();
|
||||
void reset();
|
||||
|
@ -21,8 +21,6 @@
|
||||
*/
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/translation.h"
|
||||
#include "gui/saveload.h"
|
||||
#include "tsage/ringworld/ringworld_logic.h"
|
||||
#include "tsage/scenes.h"
|
||||
#include "tsage/tsage.h"
|
||||
@ -406,51 +404,6 @@ RingworldInvObjectList::RingworldInvObjectList() :
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
void RingworldGame::restartGame() {
|
||||
if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
|
||||
_globals->_game->restart();
|
||||
}
|
||||
|
||||
void RingworldGame::saveGame() {
|
||||
if (!_vm->canSaveGameStateCurrently())
|
||||
MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||
else {
|
||||
// Show the save dialog
|
||||
handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName);
|
||||
}
|
||||
}
|
||||
|
||||
void RingworldGame::restoreGame() {
|
||||
if (!_vm->canLoadGameStateCurrently())
|
||||
MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||
else {
|
||||
// Show the load dialog
|
||||
handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
|
||||
}
|
||||
}
|
||||
|
||||
void RingworldGame::quitGame() {
|
||||
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
|
||||
_vm->quitGame();
|
||||
}
|
||||
|
||||
void RingworldGame::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
|
||||
const EnginePlugin *plugin = 0;
|
||||
EngineMan.findGame(_vm->getGameId(), &plugin);
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
if (saveFlag)
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
|
||||
else
|
||||
dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
|
||||
|
||||
dialog->setSaveMode(saveFlag);
|
||||
|
||||
saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
saveName = dialog->getResultString();
|
||||
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void RingworldGame::start() {
|
||||
// Set some default flags
|
||||
_globals->setFlag(12);
|
||||
|
@ -147,15 +147,9 @@ public:
|
||||
#define RING_INVENTORY (*((::TsAGE::Ringworld::RingworldInvObjectList *)_globals->_inventory))
|
||||
|
||||
class RingworldGame: public Game {
|
||||
protected:
|
||||
virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
|
||||
public:
|
||||
virtual void start();
|
||||
virtual void restart();
|
||||
virtual void restartGame();
|
||||
virtual void saveGame();
|
||||
virtual void restoreGame();
|
||||
virtual void quitGame();
|
||||
virtual void endGame(int resNum, int lineNum);
|
||||
|
||||
virtual Scene *createScene(int sceneNumber);
|
||||
|
@ -20,11 +20,15 @@
|
||||
*
|
||||
*/
|
||||
|
||||
#include "common/config-manager.h"
|
||||
#include "common/translation.h"
|
||||
#include "gui/saveload.h"
|
||||
#include "tsage/scenes.h"
|
||||
#include "tsage/globals.h"
|
||||
#include "tsage/ringworld/ringworld_logic.h"
|
||||
#include "tsage/tsage.h"
|
||||
#include "tsage/saveload.h"
|
||||
#include "tsage/staticres.h"
|
||||
|
||||
namespace TsAGE {
|
||||
|
||||
@ -505,6 +509,51 @@ void Scene::setZoomPercents(int yStart, int minPercent, int yEnd, int maxPercent
|
||||
|
||||
/*--------------------------------------------------------------------------*/
|
||||
|
||||
void Game::restartGame() {
|
||||
if (MessageDialog::show(RESTART_MSG, CANCEL_BTN_STRING, RESTART_BTN_STRING) == 1)
|
||||
_globals->_game->restart();
|
||||
}
|
||||
|
||||
void Game::saveGame() {
|
||||
if (!_vm->canSaveGameStateCurrently())
|
||||
MessageDialog::show(SAVING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||
else {
|
||||
// Show the save dialog
|
||||
handleSaveLoad(true, _globals->_sceneHandler->_saveGameSlot, _globals->_sceneHandler->_saveName);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::restoreGame() {
|
||||
if (!_vm->canLoadGameStateCurrently())
|
||||
MessageDialog::show(RESTORING_NOT_ALLOWED_MSG, OK_BTN_STRING);
|
||||
else {
|
||||
// Show the load dialog
|
||||
handleSaveLoad(false, _globals->_sceneHandler->_loadGameSlot, _globals->_sceneHandler->_saveName);
|
||||
}
|
||||
}
|
||||
|
||||
void Game::quitGame() {
|
||||
if (MessageDialog::show(QUIT_CONFIRM_MSG, CANCEL_BTN_STRING, QUIT_BTN_STRING) == 1)
|
||||
_vm->quitGame();
|
||||
}
|
||||
|
||||
void Game::handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {
|
||||
const EnginePlugin *plugin = 0;
|
||||
EngineMan.findGame(_vm->getGameId(), &plugin);
|
||||
GUI::SaveLoadChooser *dialog;
|
||||
if (saveFlag)
|
||||
dialog = new GUI::SaveLoadChooser(_("Save game:"), _("Save"));
|
||||
else
|
||||
dialog = new GUI::SaveLoadChooser(_("Load game:"), _("Load"));
|
||||
|
||||
dialog->setSaveMode(saveFlag);
|
||||
|
||||
saveSlot = dialog->runModalWithPluginAndTarget(plugin, ConfMan.getActiveDomainName());
|
||||
saveName = dialog->getResultString();
|
||||
|
||||
delete dialog;
|
||||
}
|
||||
|
||||
void Game::execute() {
|
||||
// Main game loop
|
||||
bool activeFlag = false;
|
||||
|
@ -115,7 +115,7 @@ protected:
|
||||
SynchronizedList<GameHandler *> _handlers;
|
||||
|
||||
static bool notLockedFn(GameHandler *g);
|
||||
virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName) {}
|
||||
virtual void handleSaveLoad(bool saveFlag, int &saveSlot, Common::String &saveName);
|
||||
public:
|
||||
virtual ~Game() {}
|
||||
|
||||
@ -125,10 +125,10 @@ public:
|
||||
void execute();
|
||||
virtual void start() = 0;
|
||||
virtual void restart() {}
|
||||
virtual void restartGame() {}
|
||||
virtual void saveGame() {}
|
||||
virtual void restoreGame() {}
|
||||
virtual void quitGame() {}
|
||||
virtual void restartGame();
|
||||
virtual void saveGame();
|
||||
virtual void restoreGame();
|
||||
virtual void quitGame();
|
||||
virtual void endGame(int resNum, int lineNum) {}
|
||||
virtual Scene *createScene(int sceneNumber) = 0;
|
||||
virtual void processEvent(Event &event) {}
|
||||
|
Loading…
x
Reference in New Issue
Block a user