summaryrefslogtreecommitdiff
path: root/src/setup/mainmenu.c
diff options
context:
space:
mode:
Diffstat (limited to 'src/setup/mainmenu.c')
-rw-r--r--src/setup/mainmenu.c60
1 files changed, 60 insertions, 0 deletions
diff --git a/src/setup/mainmenu.c b/src/setup/mainmenu.c
index 46e4b4e6..c3cb7db5 100644
--- a/src/setup/mainmenu.c
+++ b/src/setup/mainmenu.c
@@ -46,6 +46,64 @@
#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)
+{
+#if 0
+ // TODO for raven-branch
+ 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;
+#endif
+}
+
+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)
@@ -174,6 +232,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);
}
//