diff options
author | Simon Howard | 2009-06-12 00:23:33 +0000 |
---|---|---|
committer | Simon Howard | 2009-06-12 00:23:33 +0000 |
commit | 0f5de61b743fdf05335436c1c71b4b488870483f (patch) | |
tree | 43eca2de9916341a75148e681e73fff20299d9e8 | |
parent | ec03448333ca4c1d996dcb2b9c9ac01522a271bd (diff) | |
parent | 43748a366a4bc5494c15995273bfe158530e03de (diff) | |
download | chocolate-doom-0f5de61b743fdf05335436c1c71b4b488870483f.tar.gz chocolate-doom-0f5de61b743fdf05335436c1c71b4b488870483f.tar.bz2 chocolate-doom-0f5de61b743fdf05335436c1c71b4b488870483f.zip |
Merge from trunk.
Subversion-branch: /branches/raven-branch
Subversion-revision: 1596
-rw-r--r-- | pcsound/pcsound.c | 5 | ||||
-rw-r--r-- | src/Makefile.am | 4 | ||||
-rw-r--r-- | src/doom/g_game.c | 10 | ||||
-rw-r--r-- | src/doom/hu_stuff.c | 4 | ||||
-rw-r--r-- | src/doom/hu_stuff.h | 1 | ||||
-rw-r--r-- | src/i_endoom.c | 17 | ||||
-rw-r--r-- | src/i_video.c | 9 | ||||
-rw-r--r-- | src/m_config.c | 12 | ||||
-rw-r--r-- | src/m_controls.c | 33 | ||||
-rw-r--r-- | src/m_controls.h | 3 | ||||
-rw-r--r-- | src/setup/display.c | 4 | ||||
-rw-r--r-- | src/setup/keyboard.c | 7 | ||||
-rw-r--r-- | src/setup/txt_keyinput.c | 12 | ||||
-rw-r--r-- | textscreen/txt_sdl.c | 10 | ||||
-rw-r--r-- | wince/env.h | 7 |
15 files changed, 112 insertions, 26 deletions
diff --git a/pcsound/pcsound.c b/pcsound/pcsound.c index 09ef2752..4695e6e1 100644 --- a/pcsound/pcsound.c +++ b/pcsound/pcsound.c @@ -27,7 +27,10 @@ #include <stdlib.h> #include <string.h> -#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/src/Makefile.am b/src/Makefile.am index f885f828..73256b98 100644 --- a/src/Makefile.am +++ b/src/Makefile.am @@ -37,7 +37,8 @@ net_structrw.c net_structrw.h \ z_native.c z_zone.h chocolate_server_SOURCES=$(COMMON_SOURCE_FILES) $(DEDSERV_FILES) -chocolate_server_LDADD = @LDFLAGS@ @SDLNET_LIBS@ +chocolate_server_LDADD = $(top_builddir)/wince/libc_wince.a \ + @LDFLAGS@ @SDLNET_LIBS@ # Source files used by the game binaries (chocolate-doom, etc.) @@ -162,6 +163,7 @@ z_native.c z_zone.h chocolate_setup_SOURCES=$(SETUP_FILES) $(COMMON_SOURCE_FILES) chocolate_setup_LDADD = setup/libsetup.a \ + $(top_builddir)/wince/libc_wince.a \ $(top_builddir)/textscreen/libtextscreen.a \ @LDFLAGS@ @SDL_LIBS@ @SDLNET_LIBS@ diff --git a/src/doom/g_game.c b/src/doom/g_game.c index 5d49c5b4..35bf4d74 100644 --- a/src/doom/g_game.c +++ b/src/doom/g_game.c @@ -730,13 +730,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 <NUMKEYS) + } + else if (ev->data1 <NUMKEYS) + { gamekeydown[ev->data1] = true; + } + return true; // eat key down events case ev_keyup: diff --git a/src/doom/hu_stuff.c b/src/doom/hu_stuff.c index 7cd06bd5..a106978e 100644 --- a/src/doom/hu_stuff.c +++ b/src/doom/hu_stuff.c @@ -37,6 +37,7 @@ #include "hu_stuff.h" #include "hu_lib.h" +#include "m_controls.h" #include "w_wad.h" #include "s_sound.h" @@ -89,7 +90,6 @@ char* player_names[] = HUSTR_PLRRED }; - char chat_char; // remove later. static player_t* plr; patch_t* hu_font[HU_FONTSIZE]; @@ -555,7 +555,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/doom/hu_stuff.h b/src/doom/hu_stuff.h index 26bc92ee..2e56f763 100644 --- a/src/doom/hu_stuff.h +++ b/src/doom/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_endoom.c b/src/i_endoom.c index 08cfb99e..a05d1662 100644 --- a/src/i_endoom.c +++ b/src/i_endoom.c @@ -30,6 +30,9 @@ #include "txt_main.h" +#define ENDOOM_W 80 +#define ENDOOM_H 25 + // // Displays the text mode ending screen after the game quits // @@ -37,15 +40,25 @@ void I_Endoom(byte *endoom_data) { unsigned char *screendata; + int y; + int indent; // Set up text mode screen TXT_Init(); // 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<TXT_SCREEN_H; ++y) + { + memcpy(screendata + (y * TXT_SCREEN_W * 2), + endoom_data + (y * ENDOOM_W + indent) * 2, + TXT_SCREEN_W * 2); + } // Wait for a keypress diff --git a/src/i_video.c b/src/i_video.c index 1b49f903..a41f523b 100644 --- a/src/i_video.c +++ b/src/i_video.c @@ -468,6 +468,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/src/m_config.c b/src/m_config.c index 25e59917..f70e112a 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -732,6 +732,12 @@ static default_t extra_defaults_list[] = #endif //! + // Key to pause or unpause the game. + // + + CONFIG_VARIABLE_KEY(key_pause), + + //! // Key that activates the menu when pressed. // @@ -982,6 +988,12 @@ static default_t extra_defaults_list[] = // CONFIG_VARIABLE_KEY(key_weapon8), + + //! + // Key to re-display last message. + // + + CONFIG_VARIABLE_KEY(key_message_refresh), }; static default_collection_t extra_defaults = diff --git a/src/m_controls.c b/src/m_controls.c index a4a14c02..1cca6263 100644 --- a/src/m_controls.c +++ b/src/m_controls.c @@ -80,6 +80,9 @@ int mousebstraferight = -1; int mousebbackward = -1; int mousebuse = -1; +int key_message_refresh = KEY_ENTER; +int key_pause = KEY_PAUSE; + // Weapon selection keys: int key_weapon1 = '1'; @@ -187,6 +190,8 @@ void M_BindBaseControls(void) M_BindVariable("mouseb_use", &mousebuse); M_BindVariable("mouseb_backward", &mousebbackward); M_BindVariable("dclick_use", &dclick_use); + M_BindVariable("key_pause", &key_pause); + M_BindVariable("key_message_refresh", &key_message_refresh); } void M_BindHereticControls(void) @@ -251,19 +256,19 @@ void M_BindMenuControls(void) M_BindVariable("key_menu_confirm", &key_menu_confirm); M_BindVariable("key_menu_abort", &key_menu_abort); - M_BindVariable("key_menu_help", &key_menu_help); - M_BindVariable("key_menu_save", &key_menu_save); - M_BindVariable("key_menu_load", &key_menu_load); - M_BindVariable("key_menu_volume", &key_menu_volume); - M_BindVariable("key_menu_detail", &key_menu_detail); - M_BindVariable("key_menu_qsave", &key_menu_qsave); - M_BindVariable("key_menu_endgame", &key_menu_endgame); - M_BindVariable("key_menu_messages", &key_menu_messages); - M_BindVariable("key_menu_qload", &key_menu_qload); - M_BindVariable("key_menu_quit", &key_menu_quit); - M_BindVariable("key_menu_gamma", &key_menu_gamma); - - M_BindVariable("key_menu_incscreen", &key_menu_incscreen); - M_BindVariable("key_menu_decscreen", &key_menu_decscreen); + M_BindVariable("key_menu_help", &key_menu_help); + M_BindVariable("key_menu_save", &key_menu_save); + M_BindVariable("key_menu_load", &key_menu_load); + M_BindVariable("key_menu_volume", &key_menu_volume); + M_BindVariable("key_menu_detail", &key_menu_detail); + M_BindVariable("key_menu_qsave", &key_menu_qsave); + M_BindVariable("key_menu_endgame", &key_menu_endgame); + M_BindVariable("key_menu_messages", &key_menu_messages); + M_BindVariable("key_menu_qload", &key_menu_qload); + M_BindVariable("key_menu_quit", &key_menu_quit); + M_BindVariable("key_menu_gamma", &key_menu_gamma); + + M_BindVariable("key_menu_incscreen", &key_menu_incscreen); + M_BindVariable("key_menu_decscreen", &key_menu_decscreen); } diff --git a/src/m_controls.h b/src/m_controls.h index 4591348c..5054212e 100644 --- a/src/m_controls.h +++ b/src/m_controls.h @@ -49,6 +49,9 @@ extern int key_invleft; extern int key_invright; extern int key_useartifact; +extern int key_message_refresh; +extern int key_pause; + extern int key_weapon1; extern int key_weapon2; extern int key_weapon3; diff --git a/src/setup/display.c b/src/setup/display.c index 4918d045..9fd0963b 100644 --- a/src/setup/display.c +++ b/src/setup/display.c @@ -22,6 +22,10 @@ #include <stdlib.h> #include <string.h> +#ifdef _WIN32_WCE +#include "libc_wince.h" +#endif + #include "textscreen.h" #include "m_config.h" #include "mode.h" diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c index cd5eb4f5..6e746ee9 100644 --- a/src/setup/keyboard.c +++ b/src/setup/keyboard.c @@ -43,6 +43,7 @@ static int *controls[] = { &key_left, &key_right, &key_up, &key_down, &key_flyup, &key_flydown, &key_flycenter, &key_lookup, &key_lookdown, &key_lookcenter, &key_invleft, &key_invright, &key_useartifact, + &key_pause, &key_weapon1, &key_weapon2, &key_weapon3, &key_weapon4, &key_weapon5, &key_weapon6, &key_weapon7, &key_weapon8, @@ -56,7 +57,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, @@ -246,6 +248,7 @@ static void OtherKeysDialog(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) AddSectionLabel(table, "Shortcut keys", true); + 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); @@ -261,6 +264,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); + AddSectionLabel(table, "Map", true); AddKeyControl(table, "Toggle map", &key_map_toggle); diff --git a/src/setup/txt_keyinput.c b/src/setup/txt_keyinput.c index b7e68f44..e385cc59 100644 --- a/src/setup/txt_keyinput.c +++ b/src/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/textscreen/txt_sdl.c b/textscreen/txt_sdl.c index ef00cfb4..cfeaf0b0 100644 --- a/textscreen/txt_sdl.c +++ b/textscreen/txt_sdl.c @@ -372,6 +372,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; } @@ -512,6 +521,7 @@ static char *SpecialKeyName(int key) case KEYP_MINUS: return "PAD-"; case KEYP_DIVIDE: return "PAD/"; */ + default: return NULL; } } diff --git a/wince/env.h b/wince/env.h index d91f3fab..96805c31 100644 --- a/wince/env.h +++ b/wince/env.h @@ -11,6 +11,13 @@ #include "SDL_getenv.h" +#ifndef getenv +#define getenv SDL_getenv +#endif +#ifndef putenv +#define putenv SDL_putenv +#endif + extern void PopulateEnvironment(void); #endif /* #ifndef WINCE_ENV_H */ |