From bb4a6c28996511b9c57465807276d8d8fb624cd4 Mon Sep 17 00:00:00 2001 From: Torbjörn Andersson Date: Mon, 6 Jan 2014 14:47:17 +0100 Subject: NEVERHOOD: Add mousewheel support to original save/load dialogs --- engines/neverhood/gamemodule.cpp | 12 ++++++++++++ engines/neverhood/gamemodule.h | 2 ++ engines/neverhood/menumodule.cpp | 6 ++++++ engines/neverhood/messages.h | 6 +++++- engines/neverhood/neverhood.cpp | 6 ++++++ 5 files changed, 31 insertions(+), 1 deletion(-) (limited to 'engines') diff --git a/engines/neverhood/gamemodule.cpp b/engines/neverhood/gamemodule.cpp index 45f9465a11..12703d9f39 100644 --- a/engines/neverhood/gamemodule.cpp +++ b/engines/neverhood/gamemodule.cpp @@ -119,6 +119,18 @@ void GameModule::handleMouseUp(int16 x, int16 y) { } } +void GameModule::handleWheelUp() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELUP, 0); + } +} + +void GameModule::handleWheelDown() { + if (_childObject) { + sendMessage(_childObject, NM_MOUSE_WHEELDOWN, 0); + } +} + void GameModule::handleSpaceKey() { if (_childObject) { debug(2, "GameModule::handleSpaceKey()"); diff --git a/engines/neverhood/gamemodule.h b/engines/neverhood/gamemodule.h index 2f2fecf463..198f8f6715 100644 --- a/engines/neverhood/gamemodule.h +++ b/engines/neverhood/gamemodule.h @@ -40,6 +40,8 @@ public: void handleMouseMove(int16 x, int16 y); void handleMouseDown(int16 x, int16 y); void handleMouseUp(int16 x, int16 y); + void handleWheelUp(); + void handleWheelDown(); void handleSpaceKey(); void handleAsciiKey(char key); void handleKeyDown(Common::KeyCode keyCode); diff --git a/engines/neverhood/menumodule.cpp b/engines/neverhood/menumodule.cpp index a8d88a7109..cf21bc094e 100644 --- a/engines/neverhood/menumodule.cpp +++ b/engines/neverhood/menumodule.cpp @@ -1025,6 +1025,12 @@ uint32 GameStateMenu::handleMessage(int messageNum, const MessageParam ¶m, E break; } break; + case NM_MOUSE_WHEELUP: + _listBox->scrollUp(); + break; + case NM_MOUSE_WHEELDOWN: + _listBox->scrollDown(); + break; } return 0; } diff --git a/engines/neverhood/messages.h b/engines/neverhood/messages.h index 9816c2ca86..5f1e1b87dd 100644 --- a/engines/neverhood/messages.h +++ b/engines/neverhood/messages.h @@ -65,7 +65,11 @@ enum NeverhoodMessage { NM_KLAYMEN_RELEASE_LEVER = 0x4827, NM_MOVE_TO_BACK = 0x482A, - NM_MOVE_TO_FRONT = 0x482B + NM_MOVE_TO_FRONT = 0x482B, + + // New to ScummVM + NM_MOUSE_WHEELUP = 0xF000, + NM_MOUSE_WHEELDOWN = 0xF001 }; } // End of namespace Neverhood diff --git a/engines/neverhood/neverhood.cpp b/engines/neverhood/neverhood.cpp index af09624380..82590d6c96 100644 --- a/engines/neverhood/neverhood.cpp +++ b/engines/neverhood/neverhood.cpp @@ -178,6 +178,12 @@ void NeverhoodEngine::mainLoop() { case Common::EVENT_RBUTTONUP: _gameModule->handleMouseUp(event.mouse.x, event.mouse.y); break; + case Common::EVENT_WHEELUP: + _gameModule->handleWheelUp(); + break; + case Common::EVENT_WHEELDOWN: + _gameModule->handleWheelDown(); + break; case Common::EVENT_QUIT: _system->quit(); break; -- cgit v1.2.3