diff options
Diffstat (limited to 'engines/zvision/utility')
-rw-r--r-- | engines/zvision/utility/clock.h | 8 | ||||
-rw-r--r-- | engines/zvision/utility/lzss_read_stream.cpp | 12 | ||||
-rw-r--r-- | engines/zvision/utility/lzss_read_stream.h | 2 | ||||
-rw-r--r-- | engines/zvision/utility/single_value_container.h | 4 | ||||
-rw-r--r-- | engines/zvision/utility/utility.cpp | 10 | ||||
-rw-r--r-- | engines/zvision/utility/utility.h | 4 | ||||
-rw-r--r-- | engines/zvision/utility/win_keys.cpp | 129 | ||||
-rw-r--r-- | engines/zvision/utility/win_keys.h | 32 |
8 files changed, 183 insertions, 18 deletions
diff --git a/engines/zvision/utility/clock.h b/engines/zvision/utility/clock.h index 6ae0f86161..9a50116a8c 100644 --- a/engines/zvision/utility/clock.h +++ b/engines/zvision/utility/clock.h @@ -52,13 +52,17 @@ public: * * @return Delta time since the last frame (in milliseconds) */ - uint32 getDeltaTime() const { return _deltaTime; } + uint32 getDeltaTime() const { + return _deltaTime; + } /** * Get the time from the program starting to the last update() call * * @return Time from program start to last update() call (in milliseconds) */ - uint32 getLastMeasuredTime() { return _lastTime; } + uint32 getLastMeasuredTime() { + return _lastTime; + } /** * Pause the clock. Any future delta times will take this pause into account. diff --git a/engines/zvision/utility/lzss_read_stream.cpp b/engines/zvision/utility/lzss_read_stream.cpp index e094188ef6..14613a6fb2 100644 --- a/engines/zvision/utility/lzss_read_stream.cpp +++ b/engines/zvision/utility/lzss_read_stream.cpp @@ -28,10 +28,10 @@ namespace ZVision { LzssReadStream::LzssReadStream(Common::SeekableReadStream *source) - : _source(source), - // It's convention to set the starting cursor position to blockSize - 16 - _windowCursor(0x0FEE), - _eosFlag(false) { + : _source(source), + // It's convention to set the starting cursor position to blockSize - 16 + _windowCursor(0x0FEE), + _eosFlag(false) { // Clear the window to null memset(_window, 0, BLOCK_SIZE); } @@ -69,9 +69,9 @@ uint32 LzssReadStream::decompressBytes(byte *destination, uint32 numberOfBytes) } uint16 length = (high & 0xF) + 2; - uint16 offset = low | ((high & 0xF0)<<4); + uint16 offset = low | ((high & 0xF0) << 4); - for(int j = 0; j <= length; ++j) { + for (int j = 0; j <= length; ++j) { byte temp = _window[(offset + j) & 0xFFF]; _window[_windowCursor] = temp; destination[destinationCursor++] = temp; diff --git a/engines/zvision/utility/lzss_read_stream.h b/engines/zvision/utility/lzss_read_stream.h index b51cf3905f..b7ae5ac2cb 100644 --- a/engines/zvision/utility/lzss_read_stream.h +++ b/engines/zvision/utility/lzss_read_stream.h @@ -64,7 +64,7 @@ private: * * @param numberOfBytes How many bytes to decompress. This is a count of source bytes, not destination bytes */ - uint32 decompressBytes(byte* destination, uint32 numberOfBytes); + uint32 decompressBytes(byte *destination, uint32 numberOfBytes); }; } diff --git a/engines/zvision/utility/single_value_container.h b/engines/zvision/utility/single_value_container.h index 951383661a..ac6e99039a 100644 --- a/engines/zvision/utility/single_value_container.h +++ b/engines/zvision/utility/single_value_container.h @@ -60,7 +60,7 @@ public: explicit SingleValueContainer(Common::String value); // Copy constructor - explicit SingleValueContainer(const SingleValueContainer& other); + explicit SingleValueContainer(const SingleValueContainer &other); // Destructor ~SingleValueContainer(); @@ -91,7 +91,7 @@ public: SingleValueContainer &operator=(const double &rhs); SingleValueContainer &operator=(const Common::String &rhs); - SingleValueContainer& operator=(const SingleValueContainer &rhs); + SingleValueContainer &operator=(const SingleValueContainer &rhs); /** * Retrieve a bool from the container. If the container is not storing a diff --git a/engines/zvision/utility/utility.cpp b/engines/zvision/utility/utility.cpp index 2079d23733..537f525bd4 100644 --- a/engines/zvision/utility/utility.cpp +++ b/engines/zvision/utility/utility.cpp @@ -39,7 +39,7 @@ void writeFileContentsToFile(const Common::String &sourceFile, const Common::Str return; } - byte* buffer = new byte[f.size()]; + byte *buffer = new byte[f.size()]; f.read(buffer, f.size()); Common::DumpFile dumpFile; @@ -63,10 +63,10 @@ void trimCommentsAndWhiteSpace(Common::String *string) { } void tryToDumpLine(const Common::String &key, - Common::String &line, - Common::HashMap<Common::String, byte> *count, - Common::HashMap<Common::String, bool> *fileAlreadyUsed, - Common::DumpFile &output) { + Common::String &line, + Common::HashMap<Common::String, byte> *count, + Common::HashMap<Common::String, bool> *fileAlreadyUsed, + Common::DumpFile &output) { const byte numberOfExamplesPerType = 8; if ((*count)[key] < numberOfExamplesPerType && !(*fileAlreadyUsed)[key]) { diff --git a/engines/zvision/utility/utility.h b/engines/zvision/utility/utility.h index 063d4c0663..380034404a 100644 --- a/engines/zvision/utility/utility.h +++ b/engines/zvision/utility/utility.h @@ -71,8 +71,8 @@ void removeDuplicateEntries(Common::Array<T> &container) { uint newLength = 1; uint j; - for(uint i = 1; i < container.size(); i++) { - for(j = 0; j < newLength; j++) { + for (uint i = 1; i < container.size(); i++) { + for (j = 0; j < newLength; j++) { if (container[i] == container[j]) { break; } diff --git a/engines/zvision/utility/win_keys.cpp b/engines/zvision/utility/win_keys.cpp new file mode 100644 index 0000000000..86ed7c596f --- /dev/null +++ b/engines/zvision/utility/win_keys.cpp @@ -0,0 +1,129 @@ +/* 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 new file mode 100644 index 0000000000..53d76c4d5f --- /dev/null +++ b/engines/zvision/utility/win_keys.h @@ -0,0 +1,32 @@ +/* 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 |