aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorBorja Lorente2016-08-12 10:02:24 +0200
committerBorja Lorente2016-08-19 16:29:16 +0200
commit7b9c63b1b919ce042f72b9cd05bde5e84b8edf85 (patch)
tree52d1020dc8b774fe062629912a17364dbb1dbeda
parent580c8136f44b59b48aeb776c0d62ad20ab8c07ef (diff)
downloadscummvm-rg350-7b9c63b1b919ce042f72b9cd05bde5e84b8edf85.tar.gz
scummvm-rg350-7b9c63b1b919ce042f72b9cd05bde5e84b8edf85.tar.bz2
scummvm-rg350-7b9c63b1b919ce042f72b9cd05bde5e84b8edf85.zip
MACVENTURE: Delete duplicate code
-rw-r--r--engines/macventure/gui.cpp3
-rw-r--r--engines/macventure/macventure.cpp20
-rw-r--r--engines/macventure/macventure.h2
-rw-r--r--engines/macventure/script.cpp2
4 files changed, 6 insertions, 21 deletions
diff --git a/engines/macventure/gui.cpp b/engines/macventure/gui.cpp
index 65b11ee402..b66e2ee598 100644
--- a/engines/macventure/gui.cpp
+++ b/engines/macventure/gui.cpp
@@ -1247,7 +1247,7 @@ bool Gui::processEvent(Common::Event &event) {
bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
if (event.type == Common::EVENT_LBUTTONUP) {
if (_engine->needsClickToContinue()) {
- _engine->activateCommand(kClickToContinue);
+ _engine->selectControl(kClickToContinue);
return true;
}
@@ -1271,7 +1271,6 @@ bool Gui::processCommandEvents(WindowClick click, Common::Event &event) {
}
_engine->selectControl(data.getData().refcon);
- _engine->activateCommand(data.getData().refcon);
_engine->refreshReady();
_engine->preparedToRun();
}
diff --git a/engines/macventure/macventure.cpp b/engines/macventure/macventure.cpp
index 2eb3115bb4..48511c9330 100644
--- a/engines/macventure/macventure.cpp
+++ b/engines/macventure/macventure.cpp
@@ -270,21 +270,13 @@ void MacVentureEngine::requestUnpause() {
void MacVentureEngine::selectControl(ControlAction id) {
debugC(2, kMVDebugMain, "Select control %x", id);
- _selectedControl = id;
-}
-
-void MacVentureEngine::activateCommand(ControlAction id) {
if (id == kClickToContinue) {
_clickToContinue = false;
_paused = true;
return;
}
- if (id != _activeControl) {
- if (_activeControl)
- _activeControl = kNoCommand;
- _activeControl = id;
- }
- debugC(2, kMVDebugMain, "Activating Command %x... Command %x is active", id, _activeControl);
+
+ _selectedControl = id;
refreshReady();
}
@@ -408,7 +400,6 @@ void MacVentureEngine::handleObjectSelect(ObjID objID, WindowReference win, bool
setDeltaPoint(Common::Point(0, 0));
if (!_cmdReady) {
selectControl(kActivateObject);
- _activeControl = kActivateObject;
_cmdReady = true;
}
} else {
@@ -426,7 +417,6 @@ void MacVentureEngine::handleObjectDrop(ObjID objID, Common::Point delta, ObjID
_destObject = newParent;
setDeltaPoint(delta);
selectControl(kMoveObject);
- activateCommand(kMoveObject);
refreshReady();
preparedToRun();
}
@@ -655,16 +645,14 @@ void MacVentureEngine::playSounds(bool pause) {
}
void MacVentureEngine::updateControls() {
- if (_activeControl)
- _activeControl = kNoCommand;
+ _selectedControl = kNoCommand;
_gui->clearControls();
toggleExits();
resetVars();
}
void MacVentureEngine::resetVars() {
- _selectedControl = kNoCommand;
- _activeControl = kNoCommand;
+ selectControl(kNoCommand);
_currentSelection.clear();
_destObject = 0;
setDeltaPoint(Common::Point(0, 0));
diff --git a/engines/macventure/macventure.h b/engines/macventure/macventure.h
index a87af74333..72d09a8b11 100644
--- a/engines/macventure/macventure.h
+++ b/engines/macventure/macventure.h
@@ -201,7 +201,6 @@ public:
void requestQuit();
void requestUnpause();
void selectControl(ControlAction action);
- void activateCommand(ControlAction id);
void refreshReady();
void preparedToRun();
void gameChanged();
@@ -344,7 +343,6 @@ private: // Attributes
// Selections
ObjID _destObject;
ControlAction _selectedControl;
- ControlAction _activeControl;
Common::Array<ObjID> _currentSelection;
Common::Array<ObjID> _selectedObjs;
Common::Point _deltaPoint;
diff --git a/engines/macventure/script.cpp b/engines/macventure/script.cpp
index d191cefa12..a051ca8f75 100644
--- a/engines/macventure/script.cpp
+++ b/engines/macventure/script.cpp
@@ -1083,7 +1083,7 @@ void ScriptEngine::opd5DLOG(EngineState * state, EngineFrame * frame) {
}
void ScriptEngine::opd6ACMD(EngineState * state, EngineFrame * frame) {
- _engine->activateCommand((ControlAction)state->pop());
+ _engine->selectControl((ControlAction)state->pop());
}
void ScriptEngine::opd7LOSE(EngineState * state, EngineFrame * frame) {