[Scummvm-cvs-logs] SF.net SVN: scummvm:[33270] scummvm/trunk/engines/parallaction
peres001 at users.sourceforge.net
peres001 at users.sourceforge.net
Fri Jul 25 04:37:56 CEST 2008
Revision: 33270
http://scummvm.svn.sourceforge.net/scummvm/?rev=33270&view=rev
Author: peres001
Date: 2008-07-25 02:37:55 +0000 (Fri, 25 Jul 2008)
Log Message:
-----------
* 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 ;)
Modified Paths:
--------------
scummvm/trunk/engines/parallaction/callables_ns.cpp
scummvm/trunk/engines/parallaction/exec_br.cpp
scummvm/trunk/engines/parallaction/gui_ns.cpp
scummvm/trunk/engines/parallaction/input.cpp
scummvm/trunk/engines/parallaction/input.h
scummvm/trunk/engines/parallaction/parallaction.h
scummvm/trunk/engines/parallaction/parallaction_ns.cpp
Modified: scummvm/trunk/engines/parallaction/callables_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/callables_ns.cpp 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/callables_ns.cpp 2008-07-25 02:37:55 UTC (rev 33270)
@@ -280,15 +280,11 @@
}
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 @@
_soundMan->playMusic();
}
- _engineFlags |= kEngineBlockInput;
-
- return;
+ _input->setMouseState(MOUSE_DISABLED);
}
void Parallaction_ns::_c_endIntro(void *parm) {
Modified: scummvm/trunk/engines/parallaction/exec_br.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/exec_br.cpp 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/exec_br.cpp 2008-07-25 02:37:55 UTC (rev 33270)
@@ -194,12 +194,12 @@
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);
}
Modified: scummvm/trunk/engines/parallaction/gui_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/gui_ns.cpp 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/gui_ns.cpp 2008-07-25 02:37:55 UTC (rev 33270)
@@ -135,6 +135,7 @@
}
virtual void enter() {
+ _vm->_input->setMouseState(MOUSE_DISABLED);
_vm->showSlide(_slideName.c_str());
_startTime = g_system->getMillis();
}
@@ -247,6 +248,8 @@
return;
}
+ _vm->_input->setMouseState(MOUSE_ENABLED_SHOW);
+
// user can choose language in this version
_vm->showSlide("lingua");
@@ -320,6 +323,7 @@
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 @@
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 @@
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 @@
return 0;
}
- virtual void enter() { }
+ virtual void enter() {
+ _vm->_input->setMouseState(MOUSE_DISABLED);
+ }
};
class SelectCharacterInputState : public MenuInputState {
@@ -504,7 +510,7 @@
~SelectCharacterInputState() {
_block.free();
_emptySlots.free();
- }
+ }
void cleanup() {
_points[0] = _points[1] = _points[2] = 0;
@@ -614,7 +620,6 @@
}
virtual void enter() {
- _vm->setArrowCursor();
_vm->_soundMan->stopMusic();
_vm->_disk->selectArchive((_vm->getFeatures() & GF_DEMO) ? "disk0" : "disk1");
_vm->showSlide("password");
@@ -627,6 +632,9 @@
_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 @@
virtual void enter() {
_current = -1;
+ _vm->_input->setMouseState(MOUSE_DISABLED);
}
};
@@ -775,12 +784,12 @@
}
_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 @@
virtual void enter() {
_allPartsComplete = _vm->allPartsComplete();
+ _vm->_input->setMouseState(MOUSE_DISABLED);
uint id[4];
if (_allPartsComplete) {
Modified: scummvm/trunk/engines/parallaction/input.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/input.cpp 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/input.cpp 2008-07-25 02:37:55 UTC (rev 33270)
@@ -131,18 +131,16 @@
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 @@
}
-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
Modified: scummvm/trunk/engines/parallaction/input.h
===================================================================
--- scummvm/trunk/engines/parallaction/input.h 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/input.h 2008-07-25 02:37:55 UTC (rev 33270)
@@ -49,6 +49,12 @@
uint _label;
};
+enum MouseTriState {
+ MOUSE_ENABLED_SHOW,
+ MOUSE_ENABLED_HIDE,
+ MOUSE_DISABLED
+};
+
class Input {
void updateGameInput();
@@ -74,7 +80,6 @@
Common::Point _mousePos;
uint16 _mouseButtons;
- bool _mouseHidden;
ZonePtr _hoverZone;
void enterInventoryMode();
@@ -93,7 +98,7 @@
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 @@
virtual ~Input() { }
- void showCursor(bool visible);
void getCursorPos(Common::Point& p) {
p = _mousePos;
}
@@ -119,6 +123,12 @@
bool getLastKeyDown(uint16 &ascii);
void stopHovering();
+
+ MouseTriState _mouseState;
+
+ void setMouseState(MouseTriState state);
+ MouseTriState getMouseState();
+ bool isMouseEnabled();
};
} // namespace Parallaction
Modified: scummvm/trunk/engines/parallaction/parallaction.h
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction.h 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/parallaction.h 2008-07-25 02:37:55 UTC (rev 33270)
@@ -101,10 +101,8 @@
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 @@
void setInternLanguage(uint id);
uint getInternLanguage();
-
};
Modified: scummvm/trunk/engines/parallaction/parallaction_ns.cpp
===================================================================
--- scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-07-25 01:14:38 UTC (rev 33269)
+++ scummvm/trunk/engines/parallaction/parallaction_ns.cpp 2008-07-25 02:37:55 UTC (rev 33270)
@@ -195,8 +195,6 @@
_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::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 @@
_zoneTrap = nullZonePtr;
- if (_engineFlags & kEngineBlockInput) {
- setArrowCursor();
- }
+ setArrowCursor();
_gfx->showGfxObj(_char._ani->gfxobj, false);
_location._animations.remove(_char._ani);
@@ -360,10 +359,9 @@
if (_location._hasSound)
_soundMan->playSfx(_location._soundFile, 0, true);
- debugC(1, kDebugExec, "changeLocation() done");
+ _input->setMouseState(oldMouseState);
- return;
-
+ debugC(1, kDebugExec, "changeLocation() done");
}
This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site.
More information about the Scummvm-git-logs
mailing list