ref: 0f5de61b743fdf05335436c1c71b4b488870483f
parent: ec03448333ca4c1d996dcb2b9c9ac01522a271bd
parent: 43748a366a4bc5494c15995273bfe158530e03de
author: Simon Howard <fraggle@gmail.com>
date: Thu Jun 11 20:23:33 EDT 2009
Merge from trunk. Subversion-branch: /branches/raven-branch Subversion-revision: 1596
--- 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"
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -37,7 +37,8 @@
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 @@
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@
--- a/src/doom/g_game.c
+++ b/src/doom/g_game.c
@@ -730,13 +730,15 @@
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:
--- 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 @@
HUSTR_PLRRED
};
-
char chat_char; // remove later.
static player_t* plr;
patch_t* hu_font[HU_FONTSIZE];
@@ -555,7 +555,7 @@
if (!chat_on)
{
- if (ev->data1 == HU_MSGREFRESH)
+ if (ev->data1 == key_message_refresh)
{
message_on = true;
message_counter = HU_MSGTIMEOUT;
--- 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
--- 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,6 +40,8 @@
void I_Endoom(byte *endoom_data)
{
unsigned char *screendata;
+ int y;
+ int indent;
// Set up text mode screen
@@ -43,9 +48,17 @@
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
--- a/src/i_video.c
+++ b/src/i_video.c
@@ -468,6 +468,15 @@
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);
}
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -732,6 +732,12 @@
#endif
//!
+ // Key to pause or unpause the game.
+ //
+
+ CONFIG_VARIABLE_KEY(key_pause),
+
+ //!
// Key that activates the menu when pressed.
//
@@ -982,6 +988,12 @@
//
CONFIG_VARIABLE_KEY(key_weapon8),
+
+ //!
+ // Key to re-display last message.
+ //
+
+ CONFIG_VARIABLE_KEY(key_message_refresh),
};
static default_collection_t extra_defaults =
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -80,6 +80,9 @@
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 @@
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 @@
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_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_incscreen", &key_menu_incscreen);
+ M_BindVariable("key_menu_decscreen", &key_menu_decscreen);
}
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -49,6 +49,9 @@
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;
--- 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"
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -43,6 +43,7 @@
&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 @@
&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 @@
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);
@@ -260,6 +263,8 @@
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);
--- a/src/setup/txt_keyinput.c
+++ b/src/setup/txt_keyinput.c
@@ -57,6 +57,11 @@
}
}
+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 @@
// 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))
--- a/textscreen/txt_sdl.c
+++ b/textscreen/txt_sdl.c
@@ -372,6 +372,15 @@
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 @@
case KEYP_MINUS: return "PAD-";
case KEYP_DIVIDE: return "PAD/";
*/
+
default: return NULL;
}
}
--- 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 */