From f6e2c67cbb4365547851b6805b4900279a5a0aa8 Mon Sep 17 00:00:00 2001 From: Nicola Mettifogo Date: Mon, 18 Jun 2007 20:11:49 +0000 Subject: Mouse is now properly hidden during dialogues, and is restored after load/save dialog boxes are closed. Moreover, kEngineMouse constant has been renamed to better match its meaning. svn-id: r27539 --- engines/parallaction/callables.cpp | 8 ++++---- engines/parallaction/dialogue.cpp | 4 ++++ engines/parallaction/intro.cpp | 4 ++-- engines/parallaction/inventory.cpp | 4 ++-- engines/parallaction/location.cpp | 2 +- engines/parallaction/parallaction.cpp | 25 +++++++++++++------------ engines/parallaction/parallaction.h | 6 ++++-- 7 files changed, 30 insertions(+), 23 deletions(-) diff --git a/engines/parallaction/callables.cpp b/engines/parallaction/callables.cpp index 170fd609ed..1154250ffa 100644 --- a/engines/parallaction/callables.cpp +++ b/engines/parallaction/callables.cpp @@ -187,14 +187,14 @@ void _c_trasformata(void *parm) { } void _c_offMouse(void *parm) { - _mouseHidden = 1; - _engineFlags |= kEngineMouse; + _vm->showCursor(false); + _engineFlags |= kEngineBlockInput; return; } void _c_onMouse(void *parm) { - _engineFlags &= ~kEngineMouse; - _mouseHidden = 0; + _engineFlags &= ~kEngineBlockInput; + _vm->showCursor(true); return; } diff --git a/engines/parallaction/dialogue.cpp b/engines/parallaction/dialogue.cpp index ba7ada3acd..d67d6f5ffb 100644 --- a/engines/parallaction/dialogue.cpp +++ b/engines/parallaction/dialogue.cpp @@ -478,6 +478,8 @@ int16 getHoverAnswer(int16 x, int16 y, Question *q) { void Parallaction::enterDialogue() { + showCursor(false); + return; } @@ -487,6 +489,8 @@ void Parallaction::exitDialogue() { refreshInventory(_characterName); + showCursor(true); + return; } diff --git a/engines/parallaction/intro.cpp b/engines/parallaction/intro.cpp index 7dd3dbc848..96a072b28d 100644 --- a/engines/parallaction/intro.cpp +++ b/engines/parallaction/intro.cpp @@ -134,7 +134,7 @@ void _c_startIntro(void *parm) { _vm->_soundMan->playMusic(); } - _engineFlags |= kEngineMouse; + _engineFlags |= kEngineBlockInput; return; } @@ -170,7 +170,7 @@ void _c_endIntro(void *parm) { waitUntilLeftClick(); - _engineFlags &= ~kEngineMouse; + _engineFlags &= ~kEngineBlockInput; _vm->_menu->selectCharacter(); } else { waitUntilLeftClick(); diff --git a/engines/parallaction/inventory.cpp b/engines/parallaction/inventory.cpp index 0486dcfe63..3581b956a6 100644 --- a/engines/parallaction/inventory.cpp +++ b/engines/parallaction/inventory.cpp @@ -286,13 +286,13 @@ void jobHideInventory(void *parm, Job *j) { static uint16 count = 0; - _engineFlags |= kEngineMouse; + _engineFlags |= kEngineBlockInput; count++; if (count == 2) { count = 0; j->_finished = 1; - _engineFlags &= ~kEngineMouse; + _engineFlags &= ~kEngineBlockInput; } Common::Rect r(INVENTORY_WIDTH, _numInvLines * INVENTORYITEM_HEIGHT); diff --git a/engines/parallaction/location.cpp b/engines/parallaction/location.cpp index ce5a16ce89..4d8efa3255 100644 --- a/engines/parallaction/location.cpp +++ b/engines/parallaction/location.cpp @@ -316,7 +316,7 @@ void Parallaction::changeLocation(char *location) { _hoverZone = NULL; - if (_engineFlags & kEngineMouse) { + if (_engineFlags & kEngineBlockInput) { changeCursor( kCursorArrow ); } diff --git a/engines/parallaction/parallaction.cpp b/engines/parallaction/parallaction.cpp index 494cfb8bd7..65db414250 100644 --- a/engines/parallaction/parallaction.cpp +++ b/engines/parallaction/parallaction.cpp @@ -86,8 +86,6 @@ char _forwardedAnimationNames[20][20]; uint16 _numForwards = 0; char _soundFile[20]; -byte _mouseHidden = 0; - uint32 _commandFlags = 0; uint16 _introSarcData3 = 200; uint16 _introSarcData2 = 1; @@ -106,8 +104,8 @@ Parallaction::Parallaction(OSystem *syst) : // FIXME _vm = this; - - + + _mouseHidden = false; Common::File::addDefaultDirectory( _gameDataPath ); @@ -380,8 +378,8 @@ void Parallaction::runGame() { _keyDown = updateInput(); debugC(3, kDebugInput, "runGame: input flags (%i, %i, %i, %i)", - _mouseHidden == 0, - (_engineFlags & kEngineMouse) == 0, + !_mouseHidden, + (_engineFlags & kEngineBlockInput) == 0, (_engineFlags & kEngineWalking) == 0, (_engineFlags & kEngineChangeLocation) == 0 ); @@ -392,7 +390,7 @@ void Parallaction::runGame() { // Skipping input processing when kEngineChangeLocation is set solves the issue. It's // noteworthy that the programmers added this very check in Big Red Adventure's engine, // so it should be ok here in Nippon Safes too. - if ((_mouseHidden == 0) && ((_engineFlags & kEngineMouse) == 0) && ((_engineFlags & kEngineWalking) == 0) && ((_engineFlags & kEngineChangeLocation) == 0)) { + if ((!_mouseHidden) && ((_engineFlags & kEngineBlockInput) == 0) && ((_engineFlags & kEngineWalking) == 0) && ((_engineFlags & kEngineChangeLocation) == 0)) { InputData *v8 = translateInput(); if (v8) processInput(v8); } @@ -510,14 +508,14 @@ void Parallaction::processInput(InputData *data) { case kEvSaveGame: _hoverZone = NULL; - changeCursor(kCursorArrow); saveGame(); + changeCursor(kCursorArrow); break; case kEvLoadGame: _hoverZone = NULL; - changeCursor(kCursorArrow); loadGame(); + changeCursor(kCursorArrow); break; } @@ -677,7 +675,10 @@ void Parallaction::waitTime(uint32 t) { } - +void Parallaction::showCursor(bool visible) { + _mouseHidden = !visible; + g_system->showMouse(visible); +} // changes the mouse pointer // index 0 means standard pointer (from pointer.cnv) @@ -860,13 +861,13 @@ void jobWaitRemoveJob(void *parm, Job *j) { debugC(3, kDebugJobs, "jobWaitRemoveJob: count = %i", count); - _engineFlags |= kEngineMouse; + _engineFlags |= kEngineBlockInput; count++; if (count == 2) { count = 0; _vm->removeJob(arg); - _engineFlags &= ~kEngineMouse; + _engineFlags &= ~kEngineBlockInput; j->_finished = 1; } diff --git a/engines/parallaction/parallaction.h b/engines/parallaction/parallaction.h index d733c17fe9..38db16ce99 100644 --- a/engines/parallaction/parallaction.h +++ b/engines/parallaction/parallaction.h @@ -110,7 +110,7 @@ enum EngineFlags { kEngineInventory = (1 << 2), kEngineWalking = (1 << 3), kEngineChangeLocation = (1 << 4), - kEngineMouse = (1 << 5), + kEngineBlockInput = (1 << 5), kEngineDragging = (1 << 6), kEngineTransformedDonna = (1 << 7) }; @@ -182,7 +182,6 @@ extern char _slideText[][40]; extern uint16 _introSarcData3; // sarcophagus stuff to be saved extern uint16 _introSarcData2; // sarcophagus stuff to be saved extern char _saveData1[]; -extern byte _mouseHidden; extern uint32 _commandFlags; extern const char *_instructionNamesRes[]; extern const char *_commandsNamesRes[]; @@ -311,6 +310,7 @@ public: void parseLocation(const char *filename); void changeCursor(int32 index); + void showCursor(bool visible); void changeCharacter(const char *name); char *parseComment(Script &script); @@ -397,6 +397,8 @@ protected: // data bool _skipMenu; + bool _mouseHidden; + // input-only InputData _input; bool _actionAfterWalk; // actived when the character needs to move before taking an action -- cgit v1.2.3