From 1e104fa874a5789ec204cc033c726218d391616c Mon Sep 17 00:00:00 2001 From: theoddone33 Date: Thu, 30 May 2002 16:50:24 +0000 Subject: [PATCH] Keyboard partially fixed --- include/key.h | 26 +++++++++++++++++++------- src/graphics/gropengl.cpp | 6 +++--- src/io/key.cpp | 15 +++++++++++++++ src/osapi/os_unix.cpp | 7 +++++-- 4 files changed, 42 insertions(+), 12 deletions(-) diff --git a/include/key.h b/include/key.h index 9e8b8e5..9e3fe61 100644 --- a/include/key.h +++ b/include/key.h @@ -7,6 +7,9 @@ * Include file for keyboard reading routines * * $Log$ + * Revision 1.4 2002/05/30 16:50:24 theoddone33 + * Keyboard partially fixed + * * Revision 1.3 2002/05/29 23:17:49 theoddone33 * Non working text code and fixed keys * @@ -118,16 +121,16 @@ void key_clear_filter(); extern int Cheats_enabled; extern int Key_normal_game; -#define KEY_SHIFTED 0x1000 -#define KEY_ALTED 0x2000 -#define KEY_CTRLED 0x4000 -#define KEY_DEBUGGED 0x8000 -#define KEY_DEBUGGED1 0x0800 // Cheat bit in release version of game. -#define KEY_MASK 0x00FF +#ifdef PLAT_UNIX +#define KEY_SHIFTED 0x30000 //(KMOD_SHIFT)<<16; +#define KEY_ALTED 0x3000000 //(KMOD_ALT)<<16; +#define KEY_CTRLED 0xc00000 //(KMOD_CTRL)<<16; +#define KEY_DEBUGGED 0x010000 // Dummy +#define KEY_DEBUGGED1 0x2000000 // Dummy +#define KEY_MASK 0xffff #define KEY_DEBUG_KEY 0x29 // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard) -#ifdef PLAT_UNIX #define KEY_0 SDLK_0 #define KEY_1 SDLK_1 #define KEY_2 SDLK_2 @@ -245,6 +248,15 @@ extern int Key_normal_game; #define KEY_PAUSE SDLK_PAUSE #define KEY_BREAK SDLK_BREAK #else +#define KEY_SHIFTED 0x1000 +#define KEY_ALTED 0x2000 +#define KEY_CTRLED 0x4000 +#define KEY_DEBUGGED 0x8000 +#define KEY_DEBUGGED1 0x0800 // Cheat bit in release version of game. +#define KEY_MASK 0x00FF + +#define KEY_DEBUG_KEY 0x29 // KEY_LAPOSTRO (shifted = tilde, near upper-left of keyboard) + #define KEY_0 0x0B #define KEY_1 0x02 #define KEY_2 0x03 diff --git a/src/graphics/gropengl.cpp b/src/graphics/gropengl.cpp index 603b823..fd90f1c 100644 --- a/src/graphics/gropengl.cpp +++ b/src/graphics/gropengl.cpp @@ -7,6 +7,9 @@ * Code that uses the OpenGL graphics library * * $Log$ + * Revision 1.20 2002/05/30 16:50:24 theoddone33 + * Keyboard partially fixed + * * Revision 1.19 2002/05/30 08:13:14 relnev * fonts are fixed * @@ -1294,7 +1297,6 @@ int GL_max_texture_width = 0; int GL_min_texture_height = 0; int GL_max_texture_height = 0; int GL_square_textures = 0; -int GL_pow2_textures = 0; int GL_textures_in = 0; int GL_textures_in_frame = 0; int GL_last_bitmap_id = -1; @@ -1514,7 +1516,6 @@ void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int tex_w = w_in; tex_h = h_in; - if (1) { int i; for (i=0; i<16; i++ ) { @@ -1531,7 +1532,6 @@ void opengl_tcache_get_adjusted_texture_size(int w_in, int h_in, int *w_out, int } } } - if ( tex_w < GL_min_texture_width ) { tex_w = GL_min_texture_width; diff --git a/src/io/key.cpp b/src/io/key.cpp index ad25a55..2b44202 100644 --- a/src/io/key.cpp +++ b/src/io/key.cpp @@ -7,6 +7,9 @@ * * * $Log$ + * Revision 1.3 2002/05/30 16:50:24 theoddone33 + * Keyboard partially fixed + * * Revision 1.2 2002/05/29 23:17:50 theoddone33 * Non working text code and fixed keys * @@ -127,6 +130,7 @@ #include #endif +#include // for toupper #include "pstypes.h" #include "key.h" #include "fix.h" @@ -252,15 +256,26 @@ int key_to_ascii(int keycode ) if ( !key_inited ) return 255; shifted = keycode & KEY_SHIFTED; +#ifdef PLAT_UNIX + keycode &= 0xffff; +#else keycode &= 0xFF; +#endif if ( keycode>=127 ) return 255; +#ifdef PLAT_UNIX + if (shifted) + return toupper (keycode); + else + return keycode; +#else if (shifted) return shifted_ascii_table[keycode]; else return ascii_table[keycode]; +#endif } // Flush the keyboard buffer. diff --git a/src/osapi/os_unix.cpp b/src/osapi/os_unix.cpp index 01565f9..69b1087 100644 --- a/src/osapi/os_unix.cpp +++ b/src/osapi/os_unix.cpp @@ -7,6 +7,9 @@ * Low level Windows code * * $Log$ + * Revision 1.4 2002/05/30 16:50:24 theoddone33 + * Keyboard partially fixed + * * Revision 1.3 2002/05/29 06:25:13 theoddone33 * Keyboard input, mouse tracking now work * @@ -237,10 +240,10 @@ void os_poll() mouse_mark_button (MOUSE_MIDDLE_BUTTON, 0); break; case SDL_KEYDOWN: - key_mark (e.key.keysym.sym, 1, 0); + key_mark ((e.key.keysym.mod<<16) | e.key.keysym.sym, 1, 0); break; case SDL_KEYUP: - key_mark (e.key.keysym.sym, 0, 0); + key_mark ((e.key.keysym.mod<<16) | e.key.keysym.sym, 0, 0); break; default: break; -- 2.39.2