Extract keyboard

This commit is contained in:
Alexander Batalov 2022-10-03 16:42:34 +03:00
parent e1f22b8218
commit 0264c00ab8
28 changed files with 2398 additions and 2356 deletions

View File

@ -131,6 +131,8 @@ target_sources(${EXECUTABLE_NAME} PUBLIC
"src/inventory.h" "src/inventory.h"
"src/item.cc" "src/item.cc"
"src/item.h" "src/item.h"
"src/kb.cc"
"src/kb.h"
"src/light.cc" "src/light.cc"
"src/light.h" "src/light.h"
"src/lips.cc" "src/lips.cc"

View File

@ -18,6 +18,7 @@
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "mouse.h" #include "mouse.h"
#include "object.h" #include "object.h"

View File

@ -18,6 +18,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "graph_lib.h" #include "graph_lib.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "object.h" #include "object.h"

View File

@ -24,6 +24,7 @@
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"

View File

@ -17,6 +17,7 @@
#include "game.h" #include "game.h"
#include "game_config.h" #include "game_config.h"
#include "game_sound.h" #include "game_sound.h"
#include "kb.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"
#include "mouse.h" #include "mouse.h"

View File

@ -22,6 +22,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "loadsave.h" #include "loadsave.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"

File diff suppressed because it is too large Load Diff

View File

@ -10,337 +10,6 @@
namespace fallout { namespace fallout {
#define KEY_STATE_UP 0
#define KEY_STATE_DOWN 1
#define KEY_STATE_REPEAT 2
#define MODIFIER_KEY_STATE_NUM_LOCK 0x01
#define MODIFIER_KEY_STATE_CAPS_LOCK 0x02
#define MODIFIER_KEY_STATE_SCROLL_LOCK 0x04
#define KEYBOARD_EVENT_MODIFIER_CAPS_LOCK 0x0001
#define KEYBOARD_EVENT_MODIFIER_NUM_LOCK 0x0002
#define KEYBOARD_EVENT_MODIFIER_SCROLL_LOCK 0x0004
#define KEYBOARD_EVENT_MODIFIER_LEFT_SHIFT 0x0008
#define KEYBOARD_EVENT_MODIFIER_RIGHT_SHIFT 0x0010
#define KEYBOARD_EVENT_MODIFIER_LEFT_ALT 0x0020
#define KEYBOARD_EVENT_MODIFIER_RIGHT_ALT 0x0040
#define KEYBOARD_EVENT_MODIFIER_LEFT_CONTROL 0x0080
#define KEYBOARD_EVENT_MODIFIER_RIGHT_CONTROL 0x0100
#define KEYBOARD_EVENT_MODIFIER_ANY_SHIFT (KEYBOARD_EVENT_MODIFIER_LEFT_SHIFT | KEYBOARD_EVENT_MODIFIER_RIGHT_SHIFT)
#define KEYBOARD_EVENT_MODIFIER_ANY_ALT (KEYBOARD_EVENT_MODIFIER_LEFT_ALT | KEYBOARD_EVENT_MODIFIER_RIGHT_ALT)
#define KEYBOARD_EVENT_MODIFIER_ANY_CONTROL (KEYBOARD_EVENT_MODIFIER_LEFT_CONTROL | KEYBOARD_EVENT_MODIFIER_RIGHT_CONTROL)
#define KEY_QUEUE_SIZE 64
typedef enum Key {
KEY_ESCAPE = '\x1b',
KEY_TAB = '\x09',
KEY_BACKSPACE = '\x08',
KEY_RETURN = '\r',
KEY_SPACE = ' ',
KEY_EXCLAMATION = '!',
KEY_QUOTE = '"',
KEY_NUMBER_SIGN = '#',
KEY_DOLLAR = '$',
KEY_PERCENT = '%',
KEY_AMPERSAND = '&',
KEY_SINGLE_QUOTE = '\'',
KEY_PAREN_LEFT = '(',
KEY_PAREN_RIGHT = ')',
KEY_ASTERISK = '*',
KEY_PLUS = '+',
KEY_COMMA = ',',
KEY_MINUS = '-',
KEY_DOT = '.',
KEY_SLASH = '/',
KEY_0 = '0',
KEY_1 = '1',
KEY_2 = '2',
KEY_3 = '3',
KEY_4 = '4',
KEY_5 = '5',
KEY_6 = '6',
KEY_7 = '7',
KEY_8 = '8',
KEY_9 = '9',
KEY_COLON = ':',
KEY_SEMICOLON = ';',
KEY_LESS = '<',
KEY_EQUAL = '=',
KEY_GREATER = '>',
KEY_QUESTION = '?',
KEY_AT = '@',
KEY_UPPERCASE_A = 'A',
KEY_UPPERCASE_B = 'B',
KEY_UPPERCASE_C = 'C',
KEY_UPPERCASE_D = 'D',
KEY_UPPERCASE_E = 'E',
KEY_UPPERCASE_F = 'F',
KEY_UPPERCASE_G = 'G',
KEY_UPPERCASE_H = 'H',
KEY_UPPERCASE_I = 'I',
KEY_UPPERCASE_J = 'J',
KEY_UPPERCASE_K = 'K',
KEY_UPPERCASE_L = 'L',
KEY_UPPERCASE_M = 'M',
KEY_UPPERCASE_N = 'N',
KEY_UPPERCASE_O = 'O',
KEY_UPPERCASE_P = 'P',
KEY_UPPERCASE_Q = 'Q',
KEY_UPPERCASE_R = 'R',
KEY_UPPERCASE_S = 'S',
KEY_UPPERCASE_T = 'T',
KEY_UPPERCASE_U = 'U',
KEY_UPPERCASE_V = 'V',
KEY_UPPERCASE_W = 'W',
KEY_UPPERCASE_X = 'X',
KEY_UPPERCASE_Y = 'Y',
KEY_UPPERCASE_Z = 'Z',
KEY_BRACKET_LEFT = '[',
KEY_BACKSLASH = '\\',
KEY_BRACKET_RIGHT = ']',
KEY_CARET = '^',
KEY_UNDERSCORE = '_',
KEY_GRAVE = '`',
KEY_LOWERCASE_A = 'a',
KEY_LOWERCASE_B = 'b',
KEY_LOWERCASE_C = 'c',
KEY_LOWERCASE_D = 'd',
KEY_LOWERCASE_E = 'e',
KEY_LOWERCASE_F = 'f',
KEY_LOWERCASE_G = 'g',
KEY_LOWERCASE_H = 'h',
KEY_LOWERCASE_I = 'i',
KEY_LOWERCASE_J = 'j',
KEY_LOWERCASE_K = 'k',
KEY_LOWERCASE_L = 'l',
KEY_LOWERCASE_M = 'm',
KEY_LOWERCASE_N = 'n',
KEY_LOWERCASE_O = 'o',
KEY_LOWERCASE_P = 'p',
KEY_LOWERCASE_Q = 'q',
KEY_LOWERCASE_R = 'r',
KEY_LOWERCASE_S = 's',
KEY_LOWERCASE_T = 't',
KEY_LOWERCASE_U = 'u',
KEY_LOWERCASE_V = 'v',
KEY_LOWERCASE_W = 'w',
KEY_LOWERCASE_X = 'x',
KEY_LOWERCASE_Y = 'y',
KEY_LOWERCASE_Z = 'z',
KEY_BRACE_LEFT = '{',
KEY_BAR = '|',
KEY_BRACE_RIGHT = '}',
KEY_TILDE = '~',
KEY_DEL = 127,
KEY_136 = 136,
KEY_146 = 146,
KEY_149 = 149,
KEY_150 = 150,
KEY_151 = 151,
KEY_152 = 152,
KEY_161 = 161,
KEY_163 = 163,
KEY_164 = 164,
KEY_166 = 166,
KEY_168 = 168,
KEY_167 = 167,
KEY_170 = 170,
KEY_172 = 172,
KEY_176 = 176,
KEY_178 = 178,
KEY_179 = 179,
KEY_180 = 180,
KEY_181 = 181,
KEY_186 = 186,
KEY_191 = 191,
KEY_196 = 196,
KEY_199 = 199,
KEY_209 = 209,
KEY_214 = 214,
KEY_215 = 215,
KEY_220 = 220,
KEY_223 = 223,
KEY_224 = 224,
KEY_228 = 228,
KEY_231 = 231,
KEY_232 = 232,
KEY_233 = 233,
KEY_241 = 241,
KEY_246 = 246,
KEY_247 = 247,
KEY_249 = 249,
KEY_252 = 252,
KEY_ALT_Q = 272,
KEY_ALT_W = 273,
KEY_ALT_E = 274,
KEY_ALT_R = 275,
KEY_ALT_T = 276,
KEY_ALT_Y = 277,
KEY_ALT_U = 278,
KEY_ALT_I = 279,
KEY_ALT_O = 280,
KEY_ALT_P = 281,
KEY_ALT_A = 286,
KEY_ALT_S = 287,
KEY_ALT_D = 288,
KEY_ALT_F = 289,
KEY_ALT_G = 290,
KEY_ALT_H = 291,
KEY_ALT_J = 292,
KEY_ALT_K = 293,
KEY_ALT_L = 294,
KEY_ALT_Z = 300,
KEY_ALT_X = 301,
KEY_ALT_C = 302,
KEY_ALT_V = 303,
KEY_ALT_B = 304,
KEY_ALT_N = 305,
KEY_ALT_M = 306,
KEY_CTRL_Q = 17,
KEY_CTRL_W = 23,
KEY_CTRL_E = 5,
KEY_CTRL_R = 18,
KEY_CTRL_T = 20,
KEY_CTRL_Y = 25,
KEY_CTRL_U = 21,
KEY_CTRL_I = 9,
KEY_CTRL_O = 15,
KEY_CTRL_P = 16,
KEY_CTRL_A = 1,
KEY_CTRL_S = 19,
KEY_CTRL_D = 4,
KEY_CTRL_F = 6,
KEY_CTRL_G = 7,
KEY_CTRL_H = 8,
KEY_CTRL_J = 10,
KEY_CTRL_K = 11,
KEY_CTRL_L = 12,
KEY_CTRL_Z = 26,
KEY_CTRL_X = 24,
KEY_CTRL_C = 3,
KEY_CTRL_V = 22,
KEY_CTRL_B = 2,
KEY_CTRL_N = 14,
KEY_CTRL_M = 13,
KEY_F1 = 315,
KEY_F2 = 316,
KEY_F3 = 317,
KEY_F4 = 318,
KEY_F5 = 319,
KEY_F6 = 320,
KEY_F7 = 321,
KEY_F8 = 322,
KEY_F9 = 323,
KEY_F10 = 324,
KEY_F11 = 389,
KEY_F12 = 390,
KEY_SHIFT_F1 = 340,
KEY_SHIFT_F2 = 341,
KEY_SHIFT_F3 = 342,
KEY_SHIFT_F4 = 343,
KEY_SHIFT_F5 = 344,
KEY_SHIFT_F6 = 345,
KEY_SHIFT_F7 = 346,
KEY_SHIFT_F8 = 347,
KEY_SHIFT_F9 = 348,
KEY_SHIFT_F10 = 349,
KEY_SHIFT_F11 = 391,
KEY_SHIFT_F12 = 392,
KEY_CTRL_F1 = 350,
KEY_CTRL_F2 = 351,
KEY_CTRL_F3 = 352,
KEY_CTRL_F4 = 353,
KEY_CTRL_F5 = 354,
KEY_CTRL_F6 = 355,
KEY_CTRL_F7 = 356,
KEY_CTRL_F8 = 357,
KEY_CTRL_F9 = 358,
KEY_CTRL_F10 = 359,
KEY_CTRL_F11 = 393,
KEY_CTRL_F12 = 394,
KEY_ALT_F1 = 360,
KEY_ALT_F2 = 361,
KEY_ALT_F3 = 362,
KEY_ALT_F4 = 363,
KEY_ALT_F5 = 364,
KEY_ALT_F6 = 365,
KEY_ALT_F7 = 366,
KEY_ALT_F8 = 367,
KEY_ALT_F9 = 368,
KEY_ALT_F10 = 369,
KEY_ALT_F11 = 395,
KEY_ALT_F12 = 396,
KEY_HOME = 327,
KEY_CTRL_HOME = 375,
KEY_ALT_HOME = 407,
KEY_PAGE_UP = 329,
KEY_CTRL_PAGE_UP = 388,
KEY_ALT_PAGE_UP = 409,
KEY_INSERT = 338,
KEY_CTRL_INSERT = 402,
KEY_ALT_INSERT = 418,
KEY_DELETE = 339,
KEY_CTRL_DELETE = 403,
KEY_ALT_DELETE = 419,
KEY_END = 335,
KEY_CTRL_END = 373,
KEY_ALT_END = 415,
KEY_PAGE_DOWN = 337,
KEY_ALT_PAGE_DOWN = 417,
KEY_CTRL_PAGE_DOWN = 374,
KEY_ARROW_UP = 328,
KEY_CTRL_ARROW_UP = 397,
KEY_ALT_ARROW_UP = 408,
KEY_ARROW_DOWN = 336,
KEY_CTRL_ARROW_DOWN = 401,
KEY_ALT_ARROW_DOWN = 416,
KEY_ARROW_LEFT = 331,
KEY_CTRL_ARROW_LEFT = 371,
KEY_ALT_ARROW_LEFT = 411,
KEY_ARROW_RIGHT = 333,
KEY_CTRL_ARROW_RIGHT = 372,
KEY_ALT_ARROW_RIGHT = 413,
KEY_CTRL_BACKSLASH = 192,
KEY_NUMBERPAD_5 = 332,
KEY_CTRL_NUMBERPAD_5 = 399,
KEY_ALT_NUMBERPAD_5 = 9999,
KEY_FIRST_INPUT_CHARACTER = KEY_SPACE,
KEY_LAST_INPUT_CHARACTER = KEY_LOWERCASE_Z,
} Key;
typedef enum KeyboardLayout {
KEYBOARD_LAYOUT_QWERTY,
KEYBOARD_LAYOUT_FRENCH,
KEYBOARD_LAYOUT_GERMAN,
KEYBOARD_LAYOUT_ITALIAN,
KEYBOARD_LAYOUT_SPANISH,
} KeyboardLayout;
typedef struct STRUCT_6ABF50 { typedef struct STRUCT_6ABF50 {
// Time when appropriate key was pressed down or -1 if it's up. // Time when appropriate key was pressed down or -1 if it's up.
int tick; int tick;
@ -366,20 +35,6 @@ typedef struct TickerListNode {
struct TickerListNode* next; struct TickerListNode* next;
} TickerListNode; } TickerListNode;
typedef struct LogicalKeyEntry {
short field_0;
short unmodified;
short shift;
short lmenu;
short rmenu;
short ctrl;
} LogicalKeyEntry;
typedef struct KeyboardEvent {
int scanCode;
unsigned short modifiers;
} KeyboardEvent;
typedef int(PauseHandler)(); typedef int(PauseHandler)();
typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette); typedef int(ScreenshotHandler)(int width, int height, unsigned char* buffer, unsigned char* palette);
@ -432,13 +87,6 @@ extern void (*_scr_blit)(unsigned char* src, int src_pitch, int a3, int src_x, i
extern void (*_zero_mem)(); extern void (*_zero_mem)();
extern bool gMmxSupported; extern bool gMmxSupported;
extern unsigned char gLastVideoModePalette[268]; extern unsigned char gLastVideoModePalette[268];
extern KeyboardEvent gKeyboardEventsQueue[KEY_QUEUE_SIZE];
extern LogicalKeyEntry gLogicalKeyEntries[SDL_NUM_SCANCODES];
extern unsigned char gPressedPhysicalKeys[SDL_NUM_SCANCODES];
extern unsigned int _kb_idle_start_time;
extern KeyboardEvent gLastKeyboardEvent;
extern int gKeyboardLayout;
extern unsigned char gPressedPhysicalKeysCount;
extern SDL_Window* gSdlWindow; extern SDL_Window* gSdlWindow;
extern SDL_Surface* gSdlSurface; extern SDL_Surface* gSdlSurface;
@ -510,25 +158,6 @@ void _GNW95_MouseShowRect16(unsigned char* src, int srcPitch, int a3, int srcX,
void _GNW95_ShowRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY); void _GNW95_ShowRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY);
void _GNW95_MouseShowTransRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, unsigned char keyColor); void _GNW95_MouseShowTransRect16(unsigned char* src, int srcPitch, int a3, int srcX, int srcY, int srcWidth, int srcHeight, int destX, int destY, unsigned char keyColor);
void _GNW95_zero_vid_mem(); void _GNW95_zero_vid_mem();
int keyboardInit();
void keyboardFree();
void keyboardReset();
int _kb_getch();
void keyboardDisable();
void keyboardEnable();
int keyboardIsDisabled();
void keyboardSetLayout(int new_language);
int keyboardGetLayout();
void _kb_simulate_key(KeyboardData* data);
int _kb_next_ascii_English_US();
int keyboardDequeueLogicalKeyCode();
void keyboardBuildQwertyConfiguration();
void keyboardBuildFrenchConfiguration();
void keyboardBuildGermanConfiguration();
void keyboardBuildItalianConfiguration();
void keyboardBuildSpanishConfiguration();
void _kb_init_lock_status();
int keyboardPeekEvent(int index, KeyboardEvent** keyboardEventPtr);
int screenGetWidth(); int screenGetWidth();
int screenGetHeight(); int screenGetHeight();

View File

@ -13,6 +13,7 @@
#include "draw.h" #include "draw.h"
#include "game.h" #include "game.h"
#include "game_sound.h" #include "game_sound.h"
#include "kb.h"
#include "message.h" #include "message.h"
#include "mouse.h" #include "mouse.h"
#include "platform_compat.h" #include "platform_compat.h"

View File

@ -14,6 +14,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "pipboy.h" #include "pipboy.h"
#include "scripts.h" #include "scripts.h"

View File

@ -38,6 +38,7 @@
#include "interface.h" #include "interface.h"
#include "inventory.h" #include "inventory.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "loadsave.h" #include "loadsave.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"

View File

@ -22,6 +22,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "lips.h" #include "lips.h"
#include "memory.h" #include "memory.h"
#include "mouse.h" #include "mouse.h"

View File

@ -17,6 +17,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "mouse.h" #include "mouse.h"
#include "object.h" #include "object.h"
#include "proto.h" #include "proto.h"

View File

@ -21,6 +21,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h" #include "geometry.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "memory.h" #include "memory.h"
#include "mouse.h" #include "mouse.h"
#include "object.h" #include "object.h"

View File

@ -25,6 +25,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "light.h" #include "light.h"
#include "map.h" #include "map.h"
#include "message.h" #include "message.h"

2014
src/kb.cc Normal file

File diff suppressed because it is too large Load Diff

358
src/kb.h Normal file
View File

@ -0,0 +1,358 @@
#ifndef FALLOUT_KB_H_
#define FALLOUT_KB_H_
#include <SDL.h>
#include "dinput.h"
namespace fallout {
#define KEY_STATE_UP 0
#define KEY_STATE_DOWN 1
#define KEY_STATE_REPEAT 2
#define MODIFIER_KEY_STATE_NUM_LOCK 0x01
#define MODIFIER_KEY_STATE_CAPS_LOCK 0x02
#define MODIFIER_KEY_STATE_SCROLL_LOCK 0x04
#define KEYBOARD_EVENT_MODIFIER_CAPS_LOCK 0x0001
#define KEYBOARD_EVENT_MODIFIER_NUM_LOCK 0x0002
#define KEYBOARD_EVENT_MODIFIER_SCROLL_LOCK 0x0004
#define KEYBOARD_EVENT_MODIFIER_LEFT_SHIFT 0x0008
#define KEYBOARD_EVENT_MODIFIER_RIGHT_SHIFT 0x0010
#define KEYBOARD_EVENT_MODIFIER_LEFT_ALT 0x0020
#define KEYBOARD_EVENT_MODIFIER_RIGHT_ALT 0x0040
#define KEYBOARD_EVENT_MODIFIER_LEFT_CONTROL 0x0080
#define KEYBOARD_EVENT_MODIFIER_RIGHT_CONTROL 0x0100
#define KEYBOARD_EVENT_MODIFIER_ANY_SHIFT (KEYBOARD_EVENT_MODIFIER_LEFT_SHIFT | KEYBOARD_EVENT_MODIFIER_RIGHT_SHIFT)
#define KEYBOARD_EVENT_MODIFIER_ANY_ALT (KEYBOARD_EVENT_MODIFIER_LEFT_ALT | KEYBOARD_EVENT_MODIFIER_RIGHT_ALT)
#define KEYBOARD_EVENT_MODIFIER_ANY_CONTROL (KEYBOARD_EVENT_MODIFIER_LEFT_CONTROL | KEYBOARD_EVENT_MODIFIER_RIGHT_CONTROL)
#define KEY_QUEUE_SIZE 64
typedef enum Key {
KEY_ESCAPE = '\x1b',
KEY_TAB = '\x09',
KEY_BACKSPACE = '\x08',
KEY_RETURN = '\r',
KEY_SPACE = ' ',
KEY_EXCLAMATION = '!',
KEY_QUOTE = '"',
KEY_NUMBER_SIGN = '#',
KEY_DOLLAR = '$',
KEY_PERCENT = '%',
KEY_AMPERSAND = '&',
KEY_SINGLE_QUOTE = '\'',
KEY_PAREN_LEFT = '(',
KEY_PAREN_RIGHT = ')',
KEY_ASTERISK = '*',
KEY_PLUS = '+',
KEY_COMMA = ',',
KEY_MINUS = '-',
KEY_DOT = '.',
KEY_SLASH = '/',
KEY_0 = '0',
KEY_1 = '1',
KEY_2 = '2',
KEY_3 = '3',
KEY_4 = '4',
KEY_5 = '5',
KEY_6 = '6',
KEY_7 = '7',
KEY_8 = '8',
KEY_9 = '9',
KEY_COLON = ':',
KEY_SEMICOLON = ';',
KEY_LESS = '<',
KEY_EQUAL = '=',
KEY_GREATER = '>',
KEY_QUESTION = '?',
KEY_AT = '@',
KEY_UPPERCASE_A = 'A',
KEY_UPPERCASE_B = 'B',
KEY_UPPERCASE_C = 'C',
KEY_UPPERCASE_D = 'D',
KEY_UPPERCASE_E = 'E',
KEY_UPPERCASE_F = 'F',
KEY_UPPERCASE_G = 'G',
KEY_UPPERCASE_H = 'H',
KEY_UPPERCASE_I = 'I',
KEY_UPPERCASE_J = 'J',
KEY_UPPERCASE_K = 'K',
KEY_UPPERCASE_L = 'L',
KEY_UPPERCASE_M = 'M',
KEY_UPPERCASE_N = 'N',
KEY_UPPERCASE_O = 'O',
KEY_UPPERCASE_P = 'P',
KEY_UPPERCASE_Q = 'Q',
KEY_UPPERCASE_R = 'R',
KEY_UPPERCASE_S = 'S',
KEY_UPPERCASE_T = 'T',
KEY_UPPERCASE_U = 'U',
KEY_UPPERCASE_V = 'V',
KEY_UPPERCASE_W = 'W',
KEY_UPPERCASE_X = 'X',
KEY_UPPERCASE_Y = 'Y',
KEY_UPPERCASE_Z = 'Z',
KEY_BRACKET_LEFT = '[',
KEY_BACKSLASH = '\\',
KEY_BRACKET_RIGHT = ']',
KEY_CARET = '^',
KEY_UNDERSCORE = '_',
KEY_GRAVE = '`',
KEY_LOWERCASE_A = 'a',
KEY_LOWERCASE_B = 'b',
KEY_LOWERCASE_C = 'c',
KEY_LOWERCASE_D = 'd',
KEY_LOWERCASE_E = 'e',
KEY_LOWERCASE_F = 'f',
KEY_LOWERCASE_G = 'g',
KEY_LOWERCASE_H = 'h',
KEY_LOWERCASE_I = 'i',
KEY_LOWERCASE_J = 'j',
KEY_LOWERCASE_K = 'k',
KEY_LOWERCASE_L = 'l',
KEY_LOWERCASE_M = 'm',
KEY_LOWERCASE_N = 'n',
KEY_LOWERCASE_O = 'o',
KEY_LOWERCASE_P = 'p',
KEY_LOWERCASE_Q = 'q',
KEY_LOWERCASE_R = 'r',
KEY_LOWERCASE_S = 's',
KEY_LOWERCASE_T = 't',
KEY_LOWERCASE_U = 'u',
KEY_LOWERCASE_V = 'v',
KEY_LOWERCASE_W = 'w',
KEY_LOWERCASE_X = 'x',
KEY_LOWERCASE_Y = 'y',
KEY_LOWERCASE_Z = 'z',
KEY_BRACE_LEFT = '{',
KEY_BAR = '|',
KEY_BRACE_RIGHT = '}',
KEY_TILDE = '~',
KEY_DEL = 127,
KEY_136 = 136,
KEY_146 = 146,
KEY_149 = 149,
KEY_150 = 150,
KEY_151 = 151,
KEY_152 = 152,
KEY_161 = 161,
KEY_163 = 163,
KEY_164 = 164,
KEY_166 = 166,
KEY_168 = 168,
KEY_167 = 167,
KEY_170 = 170,
KEY_172 = 172,
KEY_176 = 176,
KEY_178 = 178,
KEY_179 = 179,
KEY_180 = 180,
KEY_181 = 181,
KEY_186 = 186,
KEY_191 = 191,
KEY_196 = 196,
KEY_199 = 199,
KEY_209 = 209,
KEY_214 = 214,
KEY_215 = 215,
KEY_220 = 220,
KEY_223 = 223,
KEY_224 = 224,
KEY_228 = 228,
KEY_231 = 231,
KEY_232 = 232,
KEY_233 = 233,
KEY_241 = 241,
KEY_246 = 246,
KEY_247 = 247,
KEY_249 = 249,
KEY_252 = 252,
KEY_ALT_Q = 272,
KEY_ALT_W = 273,
KEY_ALT_E = 274,
KEY_ALT_R = 275,
KEY_ALT_T = 276,
KEY_ALT_Y = 277,
KEY_ALT_U = 278,
KEY_ALT_I = 279,
KEY_ALT_O = 280,
KEY_ALT_P = 281,
KEY_ALT_A = 286,
KEY_ALT_S = 287,
KEY_ALT_D = 288,
KEY_ALT_F = 289,
KEY_ALT_G = 290,
KEY_ALT_H = 291,
KEY_ALT_J = 292,
KEY_ALT_K = 293,
KEY_ALT_L = 294,
KEY_ALT_Z = 300,
KEY_ALT_X = 301,
KEY_ALT_C = 302,
KEY_ALT_V = 303,
KEY_ALT_B = 304,
KEY_ALT_N = 305,
KEY_ALT_M = 306,
KEY_CTRL_Q = 17,
KEY_CTRL_W = 23,
KEY_CTRL_E = 5,
KEY_CTRL_R = 18,
KEY_CTRL_T = 20,
KEY_CTRL_Y = 25,
KEY_CTRL_U = 21,
KEY_CTRL_I = 9,
KEY_CTRL_O = 15,
KEY_CTRL_P = 16,
KEY_CTRL_A = 1,
KEY_CTRL_S = 19,
KEY_CTRL_D = 4,
KEY_CTRL_F = 6,
KEY_CTRL_G = 7,
KEY_CTRL_H = 8,
KEY_CTRL_J = 10,
KEY_CTRL_K = 11,
KEY_CTRL_L = 12,
KEY_CTRL_Z = 26,
KEY_CTRL_X = 24,
KEY_CTRL_C = 3,
KEY_CTRL_V = 22,
KEY_CTRL_B = 2,
KEY_CTRL_N = 14,
KEY_CTRL_M = 13,
KEY_F1 = 315,
KEY_F2 = 316,
KEY_F3 = 317,
KEY_F4 = 318,
KEY_F5 = 319,
KEY_F6 = 320,
KEY_F7 = 321,
KEY_F8 = 322,
KEY_F9 = 323,
KEY_F10 = 324,
KEY_F11 = 389,
KEY_F12 = 390,
KEY_SHIFT_F1 = 340,
KEY_SHIFT_F2 = 341,
KEY_SHIFT_F3 = 342,
KEY_SHIFT_F4 = 343,
KEY_SHIFT_F5 = 344,
KEY_SHIFT_F6 = 345,
KEY_SHIFT_F7 = 346,
KEY_SHIFT_F8 = 347,
KEY_SHIFT_F9 = 348,
KEY_SHIFT_F10 = 349,
KEY_SHIFT_F11 = 391,
KEY_SHIFT_F12 = 392,
KEY_CTRL_F1 = 350,
KEY_CTRL_F2 = 351,
KEY_CTRL_F3 = 352,
KEY_CTRL_F4 = 353,
KEY_CTRL_F5 = 354,
KEY_CTRL_F6 = 355,
KEY_CTRL_F7 = 356,
KEY_CTRL_F8 = 357,
KEY_CTRL_F9 = 358,
KEY_CTRL_F10 = 359,
KEY_CTRL_F11 = 393,
KEY_CTRL_F12 = 394,
KEY_ALT_F1 = 360,
KEY_ALT_F2 = 361,
KEY_ALT_F3 = 362,
KEY_ALT_F4 = 363,
KEY_ALT_F5 = 364,
KEY_ALT_F6 = 365,
KEY_ALT_F7 = 366,
KEY_ALT_F8 = 367,
KEY_ALT_F9 = 368,
KEY_ALT_F10 = 369,
KEY_ALT_F11 = 395,
KEY_ALT_F12 = 396,
KEY_HOME = 327,
KEY_CTRL_HOME = 375,
KEY_ALT_HOME = 407,
KEY_PAGE_UP = 329,
KEY_CTRL_PAGE_UP = 388,
KEY_ALT_PAGE_UP = 409,
KEY_INSERT = 338,
KEY_CTRL_INSERT = 402,
KEY_ALT_INSERT = 418,
KEY_DELETE = 339,
KEY_CTRL_DELETE = 403,
KEY_ALT_DELETE = 419,
KEY_END = 335,
KEY_CTRL_END = 373,
KEY_ALT_END = 415,
KEY_PAGE_DOWN = 337,
KEY_ALT_PAGE_DOWN = 417,
KEY_CTRL_PAGE_DOWN = 374,
KEY_ARROW_UP = 328,
KEY_CTRL_ARROW_UP = 397,
KEY_ALT_ARROW_UP = 408,
KEY_ARROW_DOWN = 336,
KEY_CTRL_ARROW_DOWN = 401,
KEY_ALT_ARROW_DOWN = 416,
KEY_ARROW_LEFT = 331,
KEY_CTRL_ARROW_LEFT = 371,
KEY_ALT_ARROW_LEFT = 411,
KEY_ARROW_RIGHT = 333,
KEY_CTRL_ARROW_RIGHT = 372,
KEY_ALT_ARROW_RIGHT = 413,
KEY_CTRL_BACKSLASH = 192,
KEY_NUMBERPAD_5 = 332,
KEY_CTRL_NUMBERPAD_5 = 399,
KEY_ALT_NUMBERPAD_5 = 9999,
KEY_FIRST_INPUT_CHARACTER = KEY_SPACE,
KEY_LAST_INPUT_CHARACTER = KEY_LOWERCASE_Z,
} Key;
typedef enum KeyboardLayout {
KEYBOARD_LAYOUT_QWERTY,
KEYBOARD_LAYOUT_FRENCH,
KEYBOARD_LAYOUT_GERMAN,
KEYBOARD_LAYOUT_ITALIAN,
KEYBOARD_LAYOUT_SPANISH,
} KeyboardLayout;
extern unsigned char gPressedPhysicalKeys[SDL_NUM_SCANCODES];
extern int gKeyboardLayout;
extern unsigned char gPressedPhysicalKeysCount;
int keyboardInit();
void keyboardFree();
void keyboardReset();
int _kb_getch();
void keyboardDisable();
void keyboardEnable();
int keyboardIsDisabled();
void keyboardSetLayout(int new_language);
int keyboardGetLayout();
void _kb_simulate_key(KeyboardData* data);
} // namespace fallout
#endif /* FALLOUT_KB_H_ */

View File

@ -30,6 +30,7 @@
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"

View File

@ -21,6 +21,7 @@
#include "game_mouse.h" #include "game_mouse.h"
#include "game_movie.h" #include "game_movie.h"
#include "game_sound.h" #include "game_sound.h"
#include "kb.h"
#include "loadsave.h" #include "loadsave.h"
#include "map.h" #include "map.h"
#include "mouse.h" #include "mouse.h"

View File

@ -4,6 +4,7 @@
#include "core.h" #include "core.h"
#include "dinput.h" #include "dinput.h"
#include "memory.h" #include "memory.h"
#include "kb.h"
#include "vcr.h" #include "vcr.h"
namespace fallout { namespace fallout {

View File

@ -20,6 +20,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h" #include "geometry.h"
#include "grayscale.h" #include "grayscale.h"
#include "kb.h"
#include "loadsave.h" #include "loadsave.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"

View File

@ -22,6 +22,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"

View File

@ -6,6 +6,7 @@
#include "db.h" #include "db.h"
#include "game.h" #include "game.h"
#include "game_config.h" #include "game_config.h"
#include "kb.h"
#include "mouse.h" #include "mouse.h"
#include "platform_compat.h" #include "platform_compat.h"
#include "vcr.h" #include "vcr.h"

View File

@ -14,6 +14,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "geometry.h" #include "geometry.h"
#include "interface.h" #include "interface.h"
#include "kb.h"
#include "map.h" #include "map.h"
#include "memory.h" #include "memory.h"
#include "message.h" #include "message.h"

View File

@ -3,6 +3,7 @@
#include <stdlib.h> #include <stdlib.h>
#include "core.h" #include "core.h"
#include "kb.h"
#include "memory.h" #include "memory.h"
#include "mouse.h" #include "mouse.h"

View File

@ -10,6 +10,7 @@
#include "draw.h" #include "draw.h"
#include "game.h" #include "game.h"
#include "interpreter_lib.h" #include "interpreter_lib.h"
#include "kb.h"
#include "memory_manager.h" #include "memory_manager.h"
#include "mouse_manager.h" #include "mouse_manager.h"
#include "mouse.h" #include "mouse.h"

View File

@ -8,6 +8,7 @@
#include "color.h" #include "color.h"
#include "core.h" #include "core.h"
#include "draw.h" #include "draw.h"
#include "kb.h"
#include "memory.h" #include "memory.h"
#include "mouse.h" #include "mouse.h"
#include "text_font.h" #include "text_font.h"

View File

@ -27,6 +27,7 @@
#include "game_sound.h" #include "game_sound.h"
#include "interface.h" #include "interface.h"
#include "item.h" #include "item.h"
#include "kb.h"
#include "memory.h" #include "memory.h"
#include "mouse.h" #include "mouse.h"
#include "object.h" #include "object.h"