MACVENTURE: Delete duplicate code

This commit is contained in:
Borja Lorente 2016-08-12 10:02:24 +02:00
parent 580c8136f4
commit 7b9c63b1b9
4 changed files with 6 additions and 21 deletions

View File

@ -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();
}

View File

@ -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));

View File

@ -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;

View File

@ -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) {