shithub: choc

Download patch

ref: ac28eb407daaee8a92fb9efb28ac2426c4edb97b
parent: b6491fa4aefc073a760d4bad51f55c2d6c0f5f35
author: Simon Howard <[email protected]>
date: Wed Jun 10 15:03:08 EDT 2009

Add key bindings for pause, message refresh.

Subversion-branch: /trunk/chocolate-doom
Subversion-revision: 1586

--- a/setup/configfile.c
+++ b/setup/configfile.c
@@ -287,6 +287,7 @@
     {"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 @@
     {"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 =
--- a/setup/keyboard.c
+++ b/setup/keyboard.c
@@ -39,6 +39,8 @@
 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_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 *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 @@
                             &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 @@
                           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);
@@ -264,6 +271,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);
 
     TXT_AddWidgets(table, TXT_NewStrut(0, 1),
                           TXT_NewStrut(0, 1),
--- a/setup/keyboard.h
+++ b/setup/keyboard.h
@@ -35,6 +35,8 @@
 extern int joybspeed;
 extern int vanilla_keyboard_mapping;
 
+extern int key_pause;
+
 // Menu keys:
 
 extern int key_menu_activate;
@@ -87,6 +89,8 @@
 extern int key_weapon6;
 extern int key_weapon7;
 extern int key_weapon8;
+
+extern int key_message_refresh;
 
 void ConfigKeyboard(void);
 
--- a/src/g_game.c
+++ b/src/g_game.c
@@ -182,6 +182,8 @@
 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 @@
     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/hu_stuff.c
+++ b/src/hu_stuff.c
@@ -88,6 +88,7 @@
     HUSTR_PLRRED
 };
 
+int key_message_refresh = KEY_ENTER;
 
 char			chat_char; // remove later.
 static player_t*	plr;
@@ -597,7 +598,7 @@
 
     if (!chat_on)
     {
-	if (ev->data1 == HU_MSGREFRESH)
+	if (ev->data1 == key_message_refresh)
 	{
 	    message_on = true;
 	    message_counter = HU_MSGTIMEOUT;
--- 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
--- a/src/i_system.c
+++ b/src/i_system.c
@@ -133,6 +133,9 @@
     I_InitJoystick();
 }
 
+#define ENDOOM_W 80
+#define ENDOOM_H 25
+
 // 
 // Displays the text mode ending screen after the game quits
 //
@@ -141,6 +144,8 @@
 {
     unsigned char *endoom_data;
     unsigned char *screendata;
+    int y;
+    int indent;
 
     endoom_data = W_CacheLumpName(DEH_String("ENDOOM"), PU_STATIC);
 
@@ -156,7 +161,15 @@
     // 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/m_config.c
+++ b/src/m_config.c
@@ -87,6 +87,8 @@
 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_weapon6;
 extern int key_weapon7;
 extern int key_weapon8;
+
+extern int key_message_refresh;
  
 extern int	mousebfire;
 extern int	mousebstrafe;
@@ -767,6 +771,12 @@
 #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 @@
     //
 
     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 =