summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2009-06-10 19:03:08 +0000
committerSimon Howard2009-06-10 19:03:08 +0000
commitac28eb407daaee8a92fb9efb28ac2426c4edb97b (patch)
treecd4f3f467ea3e3e5daddb65f82af25b94eeb1960
parentb6491fa4aefc073a760d4bad51f55c2d6c0f5f35 (diff)
downloadchocolate-doom-ac28eb407daaee8a92fb9efb28ac2426c4edb97b.tar.gz
chocolate-doom-ac28eb407daaee8a92fb9efb28ac2426c4edb97b.tar.bz2
chocolate-doom-ac28eb407daaee8a92fb9efb28ac2426c4edb97b.zip
Add key bindings for pause, message refresh.
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1586
-rw-r--r--setup/configfile.c2
-rw-r--r--setup/keyboard.c11
-rw-r--r--setup/keyboard.h4
-rw-r--r--src/g_game.c12
-rw-r--r--src/hu_stuff.c3
-rw-r--r--src/hu_stuff.h1
-rw-r--r--src/i_system.c15
-rw-r--r--src/m_config.c16
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 <NUMKEYS)
+ }
+ else if (ev->data1 <NUMKEYS)
+ {
gamekeydown[ev->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<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/m_config.c b/src/m_config.c
index 5bc46ca3..9e770e48 100644
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -87,6 +87,8 @@ extern int key_use;
extern int key_strafe;
extern int key_speed;
+extern int key_pause;
+
// Menu control keys:
extern int key_menu_activate;
@@ -137,6 +139,8 @@ extern int key_weapon5;
extern int key_weapon6;
extern int key_weapon7;
extern int key_weapon8;
+
+extern int key_message_refresh;
extern int mousebfire;
extern int mousebstrafe;
@@ -767,6 +771,12 @@ static default_t extra_defaults_list[] =
#endif
//!
+ // Key to pause or unpause the game.
+ //
+
+ CONFIG_VARIABLE_KEY(key_pause, key_pause),
+
+ //!
// Key that activates the menu when pressed.
//
@@ -1017,6 +1027,12 @@ static default_t extra_defaults_list[] =
//
CONFIG_VARIABLE_KEY(key_weapon8, key_weapon8),
+
+ //!
+ // Key to re-display last message.
+ //
+
+ CONFIG_VARIABLE_KEY(key_message_refresh, key_message_refresh),
};
static default_collection_t extra_defaults =