summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSimon Howard2010-08-21 17:47:24 +0000
committerSimon Howard2010-08-21 17:47:24 +0000
commit3c1733b7b356efc7c4531242472a047fa23d1740 (patch)
tree47bc6cbff60b83c9f86f3c4a585b16a0c624d656
parent1d8283647fe152be88fad6b675c601ff8c423487 (diff)
downloadchocolate-doom-3c1733b7b356efc7c4531242472a047fa23d1740.tar.gz
chocolate-doom-3c1733b7b356efc7c4531242472a047fa23d1740.tar.bz2
chocolate-doom-3c1733b7b356efc7c4531242472a047fa23d1740.zip
"Bug fix".
Subversion-branch: /trunk/chocolate-doom Subversion-revision: 1961
-rw-r--r--setup/mainmenu.c57
1 files changed, 57 insertions, 0 deletions
diff --git a/setup/mainmenu.c b/setup/mainmenu.c
index 4ad1ac02..006a3547 100644
--- a/setup/mainmenu.c
+++ b/setup/mainmenu.c
@@ -45,6 +45,61 @@
#include "multiplayer.h"
#include "sound.h"
+static const int cheat_sequence[] =
+{
+ KEY_UPARROW, KEY_UPARROW, KEY_DOWNARROW, KEY_DOWNARROW,
+ KEY_LEFTARROW, KEY_RIGHTARROW, KEY_LEFTARROW, KEY_RIGHTARROW,
+ 'b', 'a', KEY_ENTER, 0
+};
+
+static unsigned int cheat_sequence_index = 0;
+
+// I think these are good "sensible" defaults:
+
+static void SensibleDefaults(void)
+{
+ key_up = 'w';
+ key_down = 's';
+ key_strafeleft = 'a';
+ key_straferight = 'd';
+ mousebprevweapon = 4;
+ mousebnextweapon = 3;
+ snd_musicdevice = 3;
+ joybspeed = 29;
+ vanilla_savegame_limit = 0;
+ vanilla_keyboard_mapping = 0;
+ vanilla_demo_limit = 0;
+ show_endoom = 0;
+ dclick_use = 0;
+ novert = 1;
+}
+
+static int MainMenuKeyPress(txt_window_t *window, int key, void *user_data)
+{
+ if (key == cheat_sequence[cheat_sequence_index])
+ {
+ ++cheat_sequence_index;
+
+ if (cheat_sequence[cheat_sequence_index] == 0)
+ {
+ SensibleDefaults();
+ cheat_sequence_index = 0;
+
+ window = TXT_NewWindow(NULL);
+ TXT_AddWidget(window, TXT_NewLabel(" \x01 "));
+ TXT_SetWindowAction(window, TXT_HORIZ_RIGHT, NULL);
+
+ return 1;
+ }
+ }
+ else
+ {
+ cheat_sequence_index = 0;
+ }
+
+ return 0;
+}
+
static void DoQuit(void *widget, void *dosave)
{
if (dosave != NULL)
@@ -136,6 +191,8 @@ void MainMenu(void)
quit_action = TXT_NewWindowAction(KEY_ESCAPE, "Quit");
TXT_SignalConnect(quit_action, "pressed", QuitConfirm, NULL);
TXT_SetWindowAction(window, TXT_HORIZ_LEFT, quit_action);
+
+ TXT_SetKeyListener(window, MainMenuKeyPress, NULL);
}
//