aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFilippos Karapetis2014-12-03 02:11:50 +0200
committerFilippos Karapetis2014-12-03 02:11:50 +0200
commitf578a1b3342578594d9940894a525bf3983641ff (patch)
tree8d3681865111162840f1af9f859536fe82bbc15b
parentbbec6c913ac6ad4279e3549fc903b9c6e4521f50 (diff)
downloadscummvm-rg350-f578a1b3342578594d9940894a525bf3983641ff.tar.gz
scummvm-rg350-f578a1b3342578594d9940894a525bf3983641ff.tar.bz2
scummvm-rg350-f578a1b3342578594d9940894a525bf3983641ff.zip
ZVISION: Move the key mapper function
-rw-r--r--engines/zvision/core/events.cpp106
-rw-r--r--engines/zvision/module.mk1
-rw-r--r--engines/zvision/utility/win_keys.cpp129
-rw-r--r--engines/zvision/utility/win_keys.h32
-rw-r--r--engines/zvision/zvision.h3
5 files changed, 105 insertions, 166 deletions
diff --git a/engines/zvision/core/events.cpp b/engines/zvision/core/events.cpp
index 2c0e63bf5c..52d71c92f6 100644
--- a/engines/zvision/core/events.cpp
+++ b/engines/zvision/core/events.cpp
@@ -30,8 +30,6 @@
#include "zvision/scripting/script_manager.h"
#include "zvision/animation/rlf_animation.h"
#include "zvision/core/menu.h"
-#include "zvision/utility/win_keys.h"
-#include "zvision/core/menu.h"
#include "zvision/sound/zork_raw.h"
#include "common/events.h"
@@ -214,7 +212,7 @@ void ZVision::processEvents() {
break;
}
- uint8 vkKey = VKkey(_event.kbd.keycode);
+ uint8 vkKey = getZvisionKey(_event.kbd.keycode);
_scriptManager->setStateValue(StateKey_KeyPress, vkKey);
@@ -342,4 +340,106 @@ void ZVision::onMouseMove(const Common::Point &pos) {
}
}
+uint8 ZVision::getZvisionKey(Common::KeyCode scummKeyCode) {
+ if (scummKeyCode >= Common::KEYCODE_a && scummKeyCode <= Common::KEYCODE_z)
+ return 0x41 + scummKeyCode - Common::KEYCODE_a;
+ if (scummKeyCode >= Common::KEYCODE_0 && scummKeyCode <= Common::KEYCODE_9)
+ return 0x30 + scummKeyCode - Common::KEYCODE_0;
+ if (scummKeyCode >= Common::KEYCODE_F1 && scummKeyCode <= Common::KEYCODE_F15)
+ return 0x70 + scummKeyCode - Common::KEYCODE_F1;
+ if (scummKeyCode >= Common::KEYCODE_KP0 && scummKeyCode <= Common::KEYCODE_KP9)
+ return 0x60 + scummKeyCode - Common::KEYCODE_KP0;
+
+ switch (scummKeyCode) {
+ case Common::KEYCODE_BACKSPACE:
+ return 0x8;
+ case Common::KEYCODE_TAB:
+ return 0x9;
+ case Common::KEYCODE_CLEAR:
+ return 0xC;
+ case Common::KEYCODE_RETURN:
+ return 0xD;
+ case Common::KEYCODE_CAPSLOCK:
+ return 0x14;
+ case Common::KEYCODE_ESCAPE:
+ return 0x1B;
+ case Common::KEYCODE_SPACE:
+ return 0x20;
+ case Common::KEYCODE_PAGEUP:
+ return 0x21;
+ case Common::KEYCODE_PAGEDOWN:
+ return 0x22;
+ case Common::KEYCODE_END:
+ return 0x23;
+ case Common::KEYCODE_HOME:
+ return 0x24;
+ case Common::KEYCODE_LEFT:
+ return 0x25;
+ case Common::KEYCODE_UP:
+ return 0x26;
+ case Common::KEYCODE_RIGHT:
+ return 0x27;
+ case Common::KEYCODE_DOWN:
+ return 0x28;
+ case Common::KEYCODE_PRINT:
+ return 0x2A;
+ case Common::KEYCODE_INSERT:
+ return 0x2D;
+ case Common::KEYCODE_DELETE:
+ return 0x2E;
+ case Common::KEYCODE_HELP:
+ return 0x2F;
+ case Common::KEYCODE_KP_MULTIPLY:
+ return 0x6A;
+ case Common::KEYCODE_KP_PLUS:
+ return 0x6B;
+ case Common::KEYCODE_KP_MINUS:
+ return 0x6D;
+ case Common::KEYCODE_KP_PERIOD:
+ return 0x6E;
+ case Common::KEYCODE_KP_DIVIDE:
+ return 0x6F;
+ case Common::KEYCODE_NUMLOCK:
+ return 0x90;
+ case Common::KEYCODE_SCROLLOCK:
+ return 0x91;
+ case Common::KEYCODE_LSHIFT:
+ return 0xA0;
+ case Common::KEYCODE_RSHIFT:
+ return 0xA1;
+ case Common::KEYCODE_LCTRL:
+ return 0xA2;
+ case Common::KEYCODE_RCTRL:
+ return 0xA3;
+ case Common::KEYCODE_MENU:
+ return 0xA5;
+ case Common::KEYCODE_LEFTBRACKET:
+ return 0xDB;
+ case Common::KEYCODE_RIGHTBRACKET:
+ return 0xDD;
+ case Common::KEYCODE_SEMICOLON:
+ return 0xBA;
+ case Common::KEYCODE_BACKSLASH:
+ return 0xDC;
+ case Common::KEYCODE_QUOTE:
+ return 0xDE;
+ case Common::KEYCODE_SLASH:
+ return 0xBF;
+ case Common::KEYCODE_TILDE:
+ return 0xC0;
+ case Common::KEYCODE_COMMA:
+ return 0xBC;
+ case Common::KEYCODE_PERIOD:
+ return 0xBE;
+ case Common::KEYCODE_MINUS:
+ return 0xBD;
+ case Common::KEYCODE_PLUS:
+ return 0xBB;
+ default:
+ return 0;
+ }
+
+ return 0;
+}
+
} // End of namespace ZVision
diff --git a/engines/zvision/module.mk b/engines/zvision/module.mk
index 140074c326..5efd6d4a29 100644
--- a/engines/zvision/module.mk
+++ b/engines/zvision/module.mk
@@ -48,7 +48,6 @@ MODULE_OBJS := \
utility/clock.o \
utility/lzss_read_stream.o \
utility/utility.o \
- utility/win_keys.o \
video/video.o \
video/zork_avi_decoder.o \
zvision.o
diff --git a/engines/zvision/utility/win_keys.cpp b/engines/zvision/utility/win_keys.cpp
deleted file mode 100644
index 86ed7c596f..0000000000
--- a/engines/zvision/utility/win_keys.cpp
+++ /dev/null
@@ -1,129 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#include "common/keyboard.h"
-
-namespace ZVision {
-
-uint8 VKkey(Common::KeyCode scummKeyCode) {
- if (scummKeyCode >= Common::KEYCODE_a && scummKeyCode <= Common::KEYCODE_z)
- return 0x41 + scummKeyCode - Common::KEYCODE_a;
- if (scummKeyCode >= Common::KEYCODE_0 && scummKeyCode <= Common::KEYCODE_9)
- return 0x30 + scummKeyCode - Common::KEYCODE_0;
- if (scummKeyCode >= Common::KEYCODE_F1 && scummKeyCode <= Common::KEYCODE_F15)
- return 0x70 + scummKeyCode - Common::KEYCODE_F1;
- if (scummKeyCode >= Common::KEYCODE_KP0 && scummKeyCode <= Common::KEYCODE_KP9)
- return 0x60 + scummKeyCode - Common::KEYCODE_KP0;
-
- switch (scummKeyCode) {
- case Common::KEYCODE_BACKSPACE:
- return 0x8;
- case Common::KEYCODE_TAB:
- return 0x9;
- case Common::KEYCODE_CLEAR:
- return 0xC;
- case Common::KEYCODE_RETURN:
- return 0xD;
- case Common::KEYCODE_CAPSLOCK:
- return 0x14;
- case Common::KEYCODE_ESCAPE:
- return 0x1B;
- case Common::KEYCODE_SPACE:
- return 0x20;
- case Common::KEYCODE_PAGEUP:
- return 0x21;
- case Common::KEYCODE_PAGEDOWN:
- return 0x22;
- case Common::KEYCODE_END:
- return 0x23;
- case Common::KEYCODE_HOME:
- return 0x24;
- case Common::KEYCODE_LEFT:
- return 0x25;
- case Common::KEYCODE_UP:
- return 0x26;
- case Common::KEYCODE_RIGHT:
- return 0x27;
- case Common::KEYCODE_DOWN:
- return 0x28;
- case Common::KEYCODE_PRINT:
- return 0x2A;
- case Common::KEYCODE_INSERT:
- return 0x2D;
- case Common::KEYCODE_DELETE:
- return 0x2E;
- case Common::KEYCODE_HELP:
- return 0x2F;
- case Common::KEYCODE_KP_MULTIPLY:
- return 0x6A;
- case Common::KEYCODE_KP_PLUS:
- return 0x6B;
- case Common::KEYCODE_KP_MINUS:
- return 0x6D;
- case Common::KEYCODE_KP_PERIOD:
- return 0x6E;
- case Common::KEYCODE_KP_DIVIDE:
- return 0x6F;
- case Common::KEYCODE_NUMLOCK:
- return 0x90;
- case Common::KEYCODE_SCROLLOCK:
- return 0x91;
- case Common::KEYCODE_LSHIFT:
- return 0xA0;
- case Common::KEYCODE_RSHIFT:
- return 0xA1;
- case Common::KEYCODE_LCTRL:
- return 0xA2;
- case Common::KEYCODE_RCTRL:
- return 0xA3;
- case Common::KEYCODE_MENU:
- return 0xA5;
- case Common::KEYCODE_LEFTBRACKET:
- return 0xDB;
- case Common::KEYCODE_RIGHTBRACKET:
- return 0xDD;
- case Common::KEYCODE_SEMICOLON:
- return 0xBA;
- case Common::KEYCODE_BACKSLASH:
- return 0xDC;
- case Common::KEYCODE_QUOTE:
- return 0xDE;
- case Common::KEYCODE_SLASH:
- return 0xBF;
- case Common::KEYCODE_TILDE:
- return 0xC0;
- case Common::KEYCODE_COMMA:
- return 0xBC;
- case Common::KEYCODE_PERIOD:
- return 0xBE;
- case Common::KEYCODE_MINUS:
- return 0xBD;
- case Common::KEYCODE_PLUS:
- return 0xBB;
- default:
- return 0;
- }
-
- return 0;
-}
-
-}
diff --git a/engines/zvision/utility/win_keys.h b/engines/zvision/utility/win_keys.h
deleted file mode 100644
index 53d76c4d5f..0000000000
--- a/engines/zvision/utility/win_keys.h
+++ /dev/null
@@ -1,32 +0,0 @@
-/* ScummVM - Graphic Adventure Engine
- *
- * ScummVM is the legal property of its developers, whose names
- * are too numerous to list here. Please refer to the COPYRIGHT
- * file distributed with this source distribution.
- *
- * This program is free software; you can redistribute it and/or
- * modify it under the terms of the GNU General Public License
- * as published by the Free Software Foundation; either version 2
- * of the License, or (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU General Public License
- * along with this program; if not, write to the Free Software
- * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
- *
- */
-
-#ifndef ZVISION_WIN_KEYS_H
-#define ZVISION_WIN_KEYS_H
-
-#include "common/keyboard.h"
-
-namespace ZVision {
-uint8 VKkey(Common::KeyCode scummKeyCode);
-} // End of namespace ZVision
-
-#endif
diff --git a/engines/zvision/zvision.h b/engines/zvision/zvision.h
index ae49f0640f..ca6c8e10e4 100644
--- a/engines/zvision/zvision.h
+++ b/engines/zvision/zvision.h
@@ -163,6 +163,8 @@ public:
return _gameDescription->gameId;
}
+ uint8 getZvisionKey(Common::KeyCode scummKeyCode);
+
/**
* Play a video until it is finished. This is a blocking call. It will call
* _clock.stop() when the video starts and _clock.start() when the video finishes.
@@ -196,7 +198,6 @@ public:
void checkBorders();
void showDebugMsg(const Common::String &msg, int16 delay = 3000);
-
private:
void initialize();
void initFonts();