Skip to content

Commit

Permalink
ZVISION: Implement action:preferences
Browse files Browse the repository at this point in the history
  • Loading branch information
Marisa-Chan committed Nov 8, 2014
1 parent 44eeb40 commit 19e2251
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 1 deletion.
21 changes: 21 additions & 0 deletions engines/zvision/scripting/actions.cpp
Expand Up @@ -473,6 +473,27 @@ bool ActionPanTrack::execute() {
return true;
}

//////////////////////////////////////////////////////////////////////////////
// ActionPreferences
//////////////////////////////////////////////////////////////////////////////

ActionPreferences::ActionPreferences(ZVision *engine, int32 slotkey, const Common::String &line) :
ResultAction(engine, slotkey) {
if (line.compareToIgnoreCase("save") == 0)
_save = true;
else
_save = false;
}

bool ActionPreferences::execute() {
if (_save)
_engine->saveSettings();
else
_engine->loadSettings();

return true;
}

//////////////////////////////////////////////////////////////////////////////
// ActionPreloadAnimation
//////////////////////////////////////////////////////////////////////////////
Expand Down
9 changes: 9 additions & 0 deletions engines/zvision/scripting/actions.h
Expand Up @@ -334,6 +334,15 @@ class ActionPreloadAnimation : public ResultAction {
int32 _framerate;
};

class ActionPreferences : public ResultAction {
public:
ActionPreferences(ZVision *engine, int32 slotkey, const Common::String &line);
bool execute();

private:
bool _save;
};

class ActionQuit : public ResultAction {
public:
ActionQuit(ZVision *engine, int32 slotkey) : ResultAction(engine, slotkey) {}
Expand Down
2 changes: 1 addition & 1 deletion engines/zvision/scripting/scr_file_handling.cpp
Expand Up @@ -260,7 +260,7 @@ void ScriptManager::parseResults(Common::SeekableReadStream &stream, Common::Lis
} else if (act.matchString("playpreload", true)) {
actionList.push_back(new ActionPlayPreloadAnimation(_engine, slot, args));
} else if (act.matchString("preferences", true)) {
// TODO: Implement ActionPreferences
actionList.push_back(new ActionPreferences(_engine, slot, args));
} else if (act.matchString("quit", true)) {
actionList.push_back(new ActionQuit(_engine, slot));
} else if (act.matchString("random", true)) {
Expand Down

0 comments on commit 19e2251

Please sign in to comment.