From ac28eb407daaee8a92fb9efb28ac2426c4edb97b Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Wed, 10 Jun 2009 19:03:08 +0000 Subject: Add key bindings for pause, message refresh. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1586 --- setup/configfile.c | 2 ++ setup/keyboard.c | 11 ++++++++++- setup/keyboard.h | 4 ++++ src/g_game.c | 12 ++++++++---- src/hu_stuff.c | 3 ++- src/hu_stuff.h | 1 - src/i_system.c | 15 ++++++++++++++- src/m_config.c | 16 ++++++++++++++++ 8 files changed, 56 insertions(+), 8 deletions(-) diff --git a/setup/configfile.c b/setup/configfile.c index 3714a35f..3b6007f5 100644 --- a/setup/configfile.c +++ b/setup/configfile.c @@ -287,6 +287,7 @@ static default_t extra_defaults_list[] = {"mouseb_backward", &mousebbackward, DEFAULT_INT, 0, 0}, {"use_libsamplerate", &use_libsamplerate, DEFAULT_INT, 0, 0}, + {"key_pause", &key_pause, DEFAULT_KEY, 0, 0}, {"key_menu_activate", &key_menu_activate, DEFAULT_KEY, 0, 0}, {"key_menu_up", &key_menu_up, DEFAULT_KEY, 0, 0}, {"key_menu_down", &key_menu_down, DEFAULT_KEY, 0, 0}, @@ -330,6 +331,7 @@ static default_t extra_defaults_list[] = {"key_weapon6", &key_weapon6, DEFAULT_KEY, 0, 0}, {"key_weapon7", &key_weapon7, DEFAULT_KEY, 0, 0}, {"key_weapon8", &key_weapon8, DEFAULT_KEY, 0, 0}, + {"key_message_refresh", &key_message_refresh, DEFAULT_KEY, 0, 0}, }; static default_collection_t extra_defaults = diff --git a/setup/keyboard.c b/setup/keyboard.c index 27ade663..79cb90e7 100644 --- a/setup/keyboard.c +++ b/setup/keyboard.c @@ -39,6 +39,8 @@ int key_use = ' '; int key_strafe = KEY_RALT; int key_speed = KEY_RSHIFT; +int key_pause = KEY_PAUSE; + // Menu keys: int key_menu_activate = KEY_ESCAPE; @@ -88,6 +90,8 @@ int key_weapon6 = '6'; int key_weapon7 = '7'; int key_weapon8 = '8'; +int key_message_refresh = KEY_ENTER; + int vanilla_keyboard_mapping = 1; static int always_run = 0; @@ -97,6 +101,7 @@ static int always_run = 0; static int *controls[] = { &key_left, &key_right, &key_up, &key_down, &key_strafeleft, &key_straferight, &key_fire, &key_use, &key_strafe, &key_speed, + &key_pause, &key_weapon1, &key_weapon2, &key_weapon3, &key_weapon4, &key_weapon5, &key_weapon6, &key_weapon7, &key_weapon8, NULL }; @@ -109,7 +114,8 @@ static int *shortcuts[] = { &key_menu_help, &key_menu_save, &key_menu_load, &key_menu_volume, &key_menu_detail, &key_menu_qsave, &key_menu_endgame, &key_menu_messages, &key_menu_qload, &key_menu_quit, &key_menu_gamma, - &key_menu_incscreen, &key_menu_decscreen, NULL }; + &key_menu_incscreen, &key_menu_decscreen, + &key_message_refresh, NULL }; static int *map_keys[] = { &key_map_north, &key_map_south, &key_map_east, &key_map_west, &key_map_zoomin, &key_map_zoomout, @@ -250,6 +256,7 @@ static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) TXT_NewStrut(0, 0), NULL); + AddKeyControl(table, "Pause game", &key_pause); AddKeyControl(table, "Help screen", &key_menu_help); AddKeyControl(table, "Save game", &key_menu_save); AddKeyControl(table, "Load game", &key_menu_load); @@ -265,6 +272,8 @@ static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) AddKeyControl(table, "Increase screen size", &key_menu_incscreen); AddKeyControl(table, "Decrease screen size", &key_menu_decscreen); + AddKeyControl(table, "Display last message", &key_message_refresh); + TXT_AddWidgets(table, TXT_NewStrut(0, 1), TXT_NewStrut(0, 1), TXT_NewLabel(" - Map - "), diff --git a/setup/keyboard.h b/setup/keyboard.h index 29ff2a1a..fa3c0db3 100644 --- a/setup/keyboard.h +++ b/setup/keyboard.h @@ -35,6 +35,8 @@ extern int key_speed; extern int joybspeed; extern int vanilla_keyboard_mapping; +extern int key_pause; + // Menu keys: extern int key_menu_activate; @@ -88,6 +90,8 @@ extern int key_weapon6; extern int key_weapon7; extern int key_weapon8; +extern int key_message_refresh; + void ConfigKeyboard(void); #endif /* #ifndef SETUP_KEYBOARD_H */ diff --git a/src/g_game.c b/src/g_game.c index cd070884..8255fdd0 100644 --- a/src/g_game.c +++ b/src/g_game.c @@ -182,6 +182,8 @@ int key_weapon5 = '5'; int key_weapon6 = '6'; int key_weapon7 = '7'; int key_weapon8 = '8'; + +int key_pause = KEY_PAUSE; int mousebfire = 0; int mousebstrafe = 1; @@ -790,13 +792,15 @@ boolean G_Responder (event_t* ev) switch (ev->type) { case ev_keydown: - if (ev->data1 == KEY_PAUSE) + if (ev->data1 == key_pause) { sendpause = true; - return true; - } - if (ev->data1 data1 data1] = true; + } + return true; // eat key down events case ev_keyup: diff --git a/src/hu_stuff.c b/src/hu_stuff.c index 886236ba..0ab750fb 100644 --- a/src/hu_stuff.c +++ b/src/hu_stuff.c @@ -88,6 +88,7 @@ char* player_names[] = HUSTR_PLRRED }; +int key_message_refresh = KEY_ENTER; char chat_char; // remove later. static player_t* plr; @@ -597,7 +598,7 @@ boolean HU_Responder(event_t *ev) if (!chat_on) { - if (ev->data1 == HU_MSGREFRESH) + if (ev->data1 == key_message_refresh) { message_on = true; message_counter = HU_MSGTIMEOUT; diff --git a/src/hu_stuff.h b/src/hu_stuff.h index 310201f6..9b1618c1 100644 --- a/src/hu_stuff.h +++ b/src/hu_stuff.h @@ -40,7 +40,6 @@ #define HU_BROADCAST 5 -#define HU_MSGREFRESH KEY_ENTER #define HU_MSGX 0 #define HU_MSGY 0 #define HU_MSGWIDTH 64 // in characters diff --git a/src/i_system.c b/src/i_system.c index 714f63cc..5f90fd7d 100644 --- a/src/i_system.c +++ b/src/i_system.c @@ -133,6 +133,9 @@ void I_Init (void) I_InitJoystick(); } +#define ENDOOM_W 80 +#define ENDOOM_H 25 + // // Displays the text mode ending screen after the game quits // @@ -141,6 +144,8 @@ void I_Endoom(void) { unsigned char *endoom_data; unsigned char *screendata; + int y; + int indent; endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC); @@ -156,7 +161,15 @@ void I_Endoom(void) // Write the data to the screen memory screendata = TXT_GetScreenData(); - memcpy(screendata, endoom_data, 4000); + + indent = (ENDOOM_W - TXT_SCREEN_W) / 2; + + for (y=0; y #include -#include "SDL_getenv.h" +#ifdef _WIN32_WCE +#include "libc_wince.h" +#endif + #include "config.h" #include "pcsound.h" #include "pcsound_internal.h" diff --git a/setup/display.c b/setup/display.c index a0960dfe..596b8a43 100644 --- a/setup/display.c +++ b/setup/display.c @@ -21,6 +21,10 @@ #include +#ifdef _WIN32_WCE +#include "libc_wince.h" +#endif + #include "textscreen.h" #include "display.h" -- cgit v1.2.3 From 779a2157c0e5afe358b03c8236e88a661b35bca0 Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 11 Jun 2009 19:41:20 +0000 Subject: Grab the input in setup when reading a new key binding, so that Windows CE buttons are read properly. Map buttons to PC function keys. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1594 --- setup/txt_keyinput.c | 12 ++++++++++++ src/i_video.c | 9 +++++++++ textscreen/txt_sdl.c | 10 ++++++++++ 3 files changed, 31 insertions(+) diff --git a/setup/txt_keyinput.c b/setup/txt_keyinput.c index b7e68f44..e385cc59 100644 --- a/setup/txt_keyinput.c +++ b/setup/txt_keyinput.c @@ -57,6 +57,11 @@ static int KeyPressCallback(txt_window_t *window, int key, } } +static void ReleaseGrab(TXT_UNCAST_ARG(window), TXT_UNCAST_ARG(unused)) +{ + SDL_WM_GrabInput(SDL_GRAB_OFF); +} + static void OpenPromptWindow(txt_key_input_t *key_input) { txt_window_t *window; @@ -78,6 +83,13 @@ static void OpenPromptWindow(txt_key_input_t *key_input) // Disable key mappings while we prompt for the key press TXT_EnableKeyMapping(0); + + // Grab input while reading the key. On Windows Mobile + // handheld devices, the hardware keypresses are only + // detected when input is grabbed. + + SDL_WM_GrabInput(SDL_GRAB_ON); + TXT_SignalConnect(window, "closed", ReleaseGrab, NULL); } static void TXT_KeyInputSizeCalc(TXT_UNCAST_ARG(key_input)) diff --git a/src/i_video.c b/src/i_video.c index c3055b5d..e0db6145 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -362,6 +362,15 @@ static int TranslateKey(SDL_keysym *sym) case SDLK_PAGEUP: return KEY_PGUP; case SDLK_PAGEDOWN: return KEY_PGDN; +#ifdef SDL_HAVE_APP_KEYS + case SDLK_APP1: return KEY_F1; + case SDLK_APP2: return KEY_F2; + case SDLK_APP3: return KEY_F3; + case SDLK_APP4: return KEY_F4; + case SDLK_APP5: return KEY_F5; + case SDLK_APP6: return KEY_F6; +#endif + default: return tolower(sym->sym); } diff --git a/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index 6cfee614..367ed095 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -368,6 +368,15 @@ static int TranslateKey(SDL_keysym *sym) case SDLK_PAGEUP: return KEY_PGUP; case SDLK_PAGEDOWN: return KEY_PGDN; +#ifdef SDL_HAVE_APP_KEYS + case SDLK_APP1: return KEY_F1; + case SDLK_APP2: return KEY_F2; + case SDLK_APP3: return KEY_F3; + case SDLK_APP4: return KEY_F4; + case SDLK_APP5: return KEY_F5; + case SDLK_APP6: return KEY_F6; +#endif + default: break; } @@ -508,6 +517,7 @@ static char *SpecialKeyName(int key) case KEYP_MINUS: return "PAD-"; case KEYP_DIVIDE: return "PAD/"; */ + default: return NULL; } } -- cgit v1.2.3 From 43748a366a4bc5494c15995273bfe158530e03de Mon Sep 17 00:00:00 2001 From: Simon Howard Date: Thu, 11 Jun 2009 21:34:36 +0000 Subject: Include libc_wince.a in chocolate-server build. Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1595 --- src/Makefile.am | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/Makefile.am b/src/Makefile.am index 64e23b79..208039a5 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -21,7 +21,7 @@ net_structrw.c net_structrw.h \ z_native.c z_zone.h chocolate_server_SOURCES=$(DEDSERV_FILES) -chocolate_server_LDADD = @LDFLAGS@ @SDLNET_LIBS@ +chocolate_server_LDADD = ../wince/libc_wince.a @LDFLAGS@ @SDLNET_LIBS@ MAIN_SOURCE_FILES=\ am_map.c am_map.h \ -- cgit v1.2.3