aboutsummaryrefslogtreecommitdiff
path: root/engines
diff options
context:
space:
mode:
authorNicola Mettifogo2008-07-25 02:37:55 +0000
committerNicola Mettifogo2008-07-25 02:37:55 +0000
commitd1a6b175f5ef7f64435477775015730657195a11 (patch)
treec9ee97ce4ba6026a7885d9965a45810af499db38 /engines
parent6b2337740ecdce2bcc7053568c5b232845be75ff (diff)
downloadscummvm-rg350-d1a6b175f5ef7f64435477775015730657195a11.tar.gz
scummvm-rg350-d1a6b175f5ef7f64435477775015730657195a11.tar.bz2
scummvm-rg350-d1a6b175f5ef7f64435477775015730657195a11.zip
* Merged old input management flags into a single mouse status variable.
* Mouse is now displayed when it is needed, and hidden when it is not ;) svn-id: r33270
Diffstat (limited to 'engines')
-rw-r--r--engines/parallaction/callables_ns.cpp12
-rw-r--r--engines/parallaction/exec_br.cpp4
-rw-r--r--engines/parallaction/gui_ns.cpp22
-rw-r--r--engines/parallaction/input.cpp40
-rw-r--r--engines/parallaction/input.h16
-rw-r--r--engines/parallaction/parallaction.h3
-rw-r--r--engines/parallaction/parallaction_ns.cpp14
7 files changed, 68 insertions, 43 deletions
diff --git a/engines/parallaction/callables_ns.cpp b/engines/parallaction/callables_ns.cpp
index 0a39698850..9cd6b610ff 100644
--- a/engines/parallaction/callables_ns.cpp
+++ b/engines/parallaction/callables_ns.cpp
@@ -280,15 +280,11 @@ void Parallaction_ns::_c_trasformata(void *parm) {
}
void Parallaction_ns::_c_offMouse(void *parm) {
- _input->showCursor(false);
- _engineFlags |= kEngineBlockInput;
- return;
+ _input->setMouseState(MOUSE_DISABLED);
}
void Parallaction_ns::_c_onMouse(void *parm) {
- _engineFlags &= ~kEngineBlockInput;
- _input->showCursor(true);
- return;
+ _input->setMouseState(MOUSE_ENABLED_SHOW);
}
@@ -418,9 +414,7 @@ void Parallaction_ns::_c_startIntro(void *parm) {
_soundMan->playMusic();
}
- _engineFlags |= kEngineBlockInput;
-
- return;
+ _input->setMouseState(MOUSE_DISABLED);
}
void Parallaction_ns::_c_endIntro(void *parm) {
diff --git a/engines/parallaction/exec_br.cpp b/engines/parallaction/exec_br.cpp
index edb832cffc..ef671b1e0e 100644
--- a/engines/parallaction/exec_br.cpp
+++ b/engines/parallaction/exec_br.cpp
@@ -194,12 +194,12 @@ DECLARE_COMMAND_OPCODE(followme) {
DECLARE_COMMAND_OPCODE(onmouse) {
- _vm->_input->showCursor(true);
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
}
DECLARE_COMMAND_OPCODE(offmouse) {
- _vm->_input->showCursor(false);
+ _vm->_input->setMouseState(MOUSE_DISABLED);
}
diff --git a/engines/parallaction/gui_ns.cpp b/engines/parallaction/gui_ns.cpp
index 2428c4b989..ce68df46e2 100644
--- a/engines/parallaction/gui_ns.cpp
+++ b/engines/parallaction/gui_ns.cpp
@@ -135,6 +135,7 @@ public:
}
virtual void enter() {
+ _vm->_input->setMouseState(MOUSE_DISABLED);
_vm->showSlide(_slideName.c_str());
_startTime = g_system->getMillis();
}
@@ -247,6 +248,8 @@ public:
return;
}
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
+
// user can choose language in this version
_vm->showSlide("lingua");
@@ -320,6 +323,7 @@ public:
virtual void enter() {
_vm->showSlide("restore");
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
_labels[0] = _vm->_gfx->createLabel(_vm->_introFont, newGameMsg[_vm->getInternLanguage()], 1);
_labels[1] = _vm->_gfx->createLabel(_vm->_introFont, loadGameMsg[_vm->getInternLanguage()], 1);
@@ -377,7 +381,7 @@ public:
int event = _vm->_input->getLastButtonEvent();
if (event == kMouseLeftUp || event == kMouseRightUp) {
- _vm->_input->showCursor(true);
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
_vm->_gfx->freeLabels();
if (event == kMouseLeftUp) {
@@ -394,7 +398,7 @@ public:
virtual void enter() {
_vm->_disk->selectArchive("disk1");
_vm->setBackground("test", NULL, NULL);
- _vm->_input->showCursor(false);
+ _vm->_input->setMouseState(MOUSE_ENABLED_HIDE);
uint id[4];
id[0] = _vm->_gfx->createLabel(_vm->_menuFont, introMsg3[0], 1);
@@ -429,7 +433,9 @@ public:
return 0;
}
- virtual void enter() { }
+ virtual void enter() {
+ _vm->_input->setMouseState(MOUSE_DISABLED);
+ }
};
class SelectCharacterInputState : public MenuInputState {
@@ -504,7 +510,7 @@ public:
~SelectCharacterInputState() {
_block.free();
_emptySlots.free();
- }
+ }
void cleanup() {
_points[0] = _points[1] = _points[2] = 0;
@@ -614,7 +620,6 @@ public:
}
virtual void enter() {
- _vm->setArrowCursor();
_vm->_soundMan->stopMusic();
_vm->_disk->selectArchive((_vm->getFeatures() & GF_DEMO) ? "disk0" : "disk1");
_vm->showSlide("password");
@@ -627,6 +632,9 @@ public:
_labels[1] = _vm->_gfx->createLabel(_vm->_introFont, introMsg2[_vm->getInternLanguage()], 1);
cleanup();
+
+ _vm->setArrowCursor();
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
_state = CHOICE;
}
};
@@ -741,6 +749,7 @@ public:
virtual void enter() {
_current = -1;
+ _vm->_input->setMouseState(MOUSE_DISABLED);
}
};
@@ -775,12 +784,12 @@ public:
}
_vm->_gfx->freeLabels();
- _engineFlags &= ~kEngineBlockInput;
return _helper->getState("selectcharacter");
}
virtual void enter() {
_vm->_soundMan->stopMusic();
+ _vm->_input->setMouseState(MOUSE_DISABLED);
if (!_isDemo) {
int label = _vm->_gfx->createLabel(_vm->_menuFont, "CLICK MOUSE BUTTON TO START", 1);
@@ -828,6 +837,7 @@ public:
virtual void enter() {
_allPartsComplete = _vm->allPartsComplete();
+ _vm->_input->setMouseState(MOUSE_DISABLED);
uint id[4];
if (_allPartsComplete) {
diff --git a/engines/parallaction/input.cpp b/engines/parallaction/input.cpp
index 2919bc61fd..380f766fe0 100644
--- a/engines/parallaction/input.cpp
+++ b/engines/parallaction/input.cpp
@@ -131,18 +131,16 @@ void Input::updateGameInput() {
readInput();
- debugC(3, kDebugInput, "translateInput: input flags (%i, %i, %i, %i)",
- !_mouseHidden,
- (_engineFlags & kEngineBlockInput) == 0,
- (_engineFlags & kEngineWalking) == 0,
- (_engineFlags & kEngineChangeLocation) == 0
- );
-
- if ((_mouseHidden) ||
- (_engineFlags & kEngineBlockInput) ||
+ if (!isMouseEnabled() ||
(_engineFlags & kEngineWalking) ||
(_engineFlags & kEngineChangeLocation)) {
+ debugC(3, kDebugInput, "updateGameInput: input flags (mouse: %i, walking: %i, changeloc: %i)",
+ isMouseEnabled(),
+ (_engineFlags & kEngineWalking) == 0,
+ (_engineFlags & kEngineChangeLocation) == 0
+ );
+
return;
}
@@ -347,10 +345,28 @@ bool Input::updateInventoryInput() {
}
-void Input::showCursor(bool visible) {
- _mouseHidden = !visible;
- _vm->_system->showMouse(visible);
+void Input::setMouseState(MouseTriState state) {
+ assert(state == MOUSE_ENABLED_SHOW || state == MOUSE_ENABLED_HIDE || state == MOUSE_DISABLED);
+ _mouseState = state;
+
+ switch (_mouseState) {
+ case MOUSE_ENABLED_HIDE:
+ case MOUSE_DISABLED:
+ _vm->_system->showMouse(false);
+ break;
+
+ case MOUSE_ENABLED_SHOW:
+ _vm->_system->showMouse(true);
+ break;
+ }
+}
+
+MouseTriState Input::getMouseState() {
+ return _mouseState;
}
+bool Input::isMouseEnabled() {
+ return (_mouseState == MOUSE_ENABLED_SHOW) || (_mouseState == MOUSE_ENABLED_HIDE);
+}
} // namespace Parallaction
diff --git a/engines/parallaction/input.h b/engines/parallaction/input.h
index 89a98541bb..c1e912db74 100644
--- a/engines/parallaction/input.h
+++ b/engines/parallaction/input.h
@@ -49,6 +49,12 @@ struct InputData {
uint _label;
};
+enum MouseTriState {
+ MOUSE_ENABLED_SHOW,
+ MOUSE_ENABLED_HIDE,
+ MOUSE_DISABLED
+};
+
class Input {
void updateGameInput();
@@ -74,7 +80,6 @@ class Input {
Common::Point _mousePos;
uint16 _mouseButtons;
- bool _mouseHidden;
ZonePtr _hoverZone;
void enterInventoryMode();
@@ -93,7 +98,7 @@ public:
Input(Parallaction *vm) : _vm(vm) {
_transCurrentHoverItem = 0;
_hasDelayedAction = false; // actived when the character needs to move before taking an action
- _mouseHidden = false;
+ _mouseState = MOUSE_DISABLED;
_activeItem._index = 0;
_activeItem._id = 0;
_mouseButtons = 0;
@@ -103,7 +108,6 @@ public:
virtual ~Input() { }
- void showCursor(bool visible);
void getCursorPos(Common::Point& p) {
p = _mousePos;
}
@@ -119,6 +123,12 @@ public:
bool getLastKeyDown(uint16 &ascii);
void stopHovering();
+
+ MouseTriState _mouseState;
+
+ void setMouseState(MouseTriState state);
+ MouseTriState getMouseState();
+ bool isMouseEnabled();
};
} // namespace Parallaction
diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h
index 47bbda0b4a..0b1fa53e67 100644
--- a/engines/parallaction/parallaction.h
+++ b/engines/parallaction/parallaction.h
@@ -101,10 +101,8 @@ enum {
enum EngineFlags {
kEngineQuit = (1 << 0),
kEnginePauseJobs = (1 << 1),
-// kEngineInventory = (1 << 2),
kEngineWalking = (1 << 3),
kEngineChangeLocation = (1 << 4),
- kEngineBlockInput = (1 << 5),
kEngineDragging = (1 << 6),
kEngineTransformedDonna = (1 << 7),
@@ -428,7 +426,6 @@ public:
void setInternLanguage(uint id);
uint getInternLanguage();
-
};
diff --git a/engines/parallaction/parallaction_ns.cpp b/engines/parallaction/parallaction_ns.cpp
index cf5cf2cd73..e8aa32dea7 100644
--- a/engines/parallaction/parallaction_ns.cpp
+++ b/engines/parallaction/parallaction_ns.cpp
@@ -195,8 +195,6 @@ void Parallaction_ns::setArrowCursor() {
_input->_activeItem._id = 0;
_system->setMouseCursor(_mouseArrow, MOUSEARROW_WIDTH, MOUSEARROW_HEIGHT, 0, 0, 0);
- _system->showMouse(true);
-
}
void Parallaction_ns::setInventoryCursor(int pos) {
@@ -291,6 +289,9 @@ void Parallaction_ns::runPendingZones() {
void Parallaction_ns::changeLocation(char *location) {
debugC(1, kDebugExec, "changeLocation(%s)", location);
+ MouseTriState oldMouseState = _input->getMouseState();
+ _input->setMouseState(MOUSE_DISABLED);
+
_soundMan->playLocationMusic(location);
_input->stopHovering();
@@ -298,9 +299,7 @@ void Parallaction_ns::changeLocation(char *location) {
_zoneTrap = nullZonePtr;
- if (_engineFlags & kEngineBlockInput) {
- setArrowCursor();
- }
+ setArrowCursor();
_gfx->showGfxObj(_char._ani->gfxobj, false);
_location._animations.remove(_char._ani);
@@ -360,10 +359,9 @@ void Parallaction_ns::changeLocation(char *location) {
if (_location._hasSound)
_soundMan->playSfx(_location._soundFile, 0, true);
- debugC(1, kDebugExec, "changeLocation() done");
-
- return;
+ _input->setMouseState(oldMouseState);
+ debugC(1, kDebugExec, "changeLocation() done");
}