From ae2c47344237e341a979adba4b2a20b68e4de559 Mon Sep 17 00:00:00 2001 From: Fabian Greffrath Date: Thu, 13 Mar 2014 07:25:31 +0100 Subject: Allow to rebind artifact keys in Hexen. --- src/hexen/g_game.c | 32 +++++++++++++------------- src/m_config.c | 64 ++++++++++++++++++++++++++++++++++++++++++++++++++++ src/m_controls.c | 18 +++++++++++++++ src/m_controls.h | 9 ++++++++ src/setup/keyboard.c | 20 +++++++++++++++- 5 files changed, 126 insertions(+), 17 deletions(-) diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c index a448134b..9c20afe0 100644 --- a/src/hexen/g_game.c +++ b/src/hexen/g_game.c @@ -396,46 +396,46 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic) } // Artifact hot keys - if (gamekeydown[KEY_BACKSPACE] && !cmd->arti) + if (gamekeydown[key_arti_all] && !cmd->arti) { - gamekeydown[KEY_BACKSPACE] = false; // Use one of each artifact + gamekeydown[key_arti_all] = false; // Use one of each artifact cmd->arti = NUMARTIFACTS; } - else if (gamekeydown['\\'] && !cmd->arti + else if (gamekeydown[key_arti_health] && !cmd->arti && (players[consoleplayer].mo->health < MAXHEALTH)) { - gamekeydown['\\'] = false; + gamekeydown[key_arti_health] = false; cmd->arti = arti_health; } - else if (gamekeydown['0'] && !cmd->arti) + else if (gamekeydown[key_arti_poisonbag] && !cmd->arti) { - gamekeydown['0'] = false; + gamekeydown[key_arti_poisonbag] = false; cmd->arti = arti_poisonbag; } - else if (gamekeydown['9'] && !cmd->arti) + else if (gamekeydown[key_arti_blastradius] && !cmd->arti) { - gamekeydown['9'] = false; + gamekeydown[key_arti_blastradius] = false; cmd->arti = arti_blastradius; } - else if (gamekeydown['8'] && !cmd->arti) + else if (gamekeydown[key_arti_teleport] && !cmd->arti) { - gamekeydown['8'] = false; + gamekeydown[key_arti_teleport] = false; cmd->arti = arti_teleport; } - else if (gamekeydown['7'] && !cmd->arti) + else if (gamekeydown[key_arti_teleportother] && !cmd->arti) { - gamekeydown['7'] = false; + gamekeydown[key_arti_teleportother] = false; cmd->arti = arti_teleportother; } - else if (gamekeydown['6'] && !cmd->arti) + else if (gamekeydown[key_arti_egg] && !cmd->arti) { - gamekeydown['6'] = false; + gamekeydown[key_arti_egg] = false; cmd->arti = arti_egg; } - else if (gamekeydown['5'] && !cmd->arti + else if (gamekeydown[key_arti_invulnerability] && !cmd->arti && !players[consoleplayer].powers[pw_invulnerability]) { - gamekeydown['5'] = false; + gamekeydown[key_arti_invulnerability] = false; cmd->arti = arti_invulnerability; } diff --git a/src/m_config.c b/src/m_config.c index 9d421d3f..dd15f1af 100644 --- a/src/m_config.c +++ b/src/m_config.c @@ -1297,6 +1297,70 @@ static default_t extra_defaults_list[] = CONFIG_VARIABLE_KEY(key_nextweapon), + //! + // @game hexen + // + // Key to use one of each artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_all), + + //! + // @game hexen + // + // Key to use "quartz flask" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_health), + + //! + // @game hexen + // + // Key to use "flechette" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_poisonbag), + + //! + // @game hexen + // + // Key to use "disc of repulsion" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_blastradius), + + //! + // @game hexen + // + // Key to use "chaos device" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_teleport), + + //! + // @game hexen + // + // Key to use "banishment device" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_teleportother), + + //! + // @game hexen + // + // Key to use "porkalator" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_egg), + + //! + // @game hexen + // + // Key to use "icon of the defender" artifact. + // + + CONFIG_VARIABLE_KEY(key_arti_invulnerability), + //! // Key to re-display last message. // diff --git a/src/m_controls.c b/src/m_controls.c index 41b97fdd..59fe1115 100644 --- a/src/m_controls.c +++ b/src/m_controls.c @@ -67,6 +67,15 @@ int key_useartifact = KEY_ENTER; int key_jump = '/'; +int key_arti_all = KEY_BACKSPACE; +int key_arti_health = '\\'; +int key_arti_poisonbag = '0'; +int key_arti_blastradius = '9'; +int key_arti_teleport = '8'; +int key_arti_teleportother = '7'; +int key_arti_egg = '6'; +int key_arti_invulnerability = '5'; + // // Strife key controls // @@ -252,6 +261,15 @@ void M_BindHexenControls(void) M_BindVariable("key_jump", &key_jump); M_BindVariable("mouseb_jump", &mousebjump); M_BindVariable("joyb_jump", &joybjump); + + M_BindVariable("key_arti_all", &key_arti_all); + M_BindVariable("key_arti_health", &key_arti_health); + M_BindVariable("key_arti_poisonbag", &key_arti_poisonbag); + M_BindVariable("key_arti_blastradius", &key_arti_blastradius); + M_BindVariable("key_arti_teleport", &key_arti_teleport); + M_BindVariable("key_arti_teleportother", &key_arti_teleportother); + M_BindVariable("key_arti_egg", &key_arti_egg); + M_BindVariable("key_arti_invulnerability", &key_arti_invulnerability); } void M_BindStrifeControls(void) diff --git a/src/m_controls.h b/src/m_controls.h index 75bd9355..67b3e1a1 100644 --- a/src/m_controls.h +++ b/src/m_controls.h @@ -75,6 +75,15 @@ extern int key_weapon6; extern int key_weapon7; extern int key_weapon8; +extern int key_arti_all; +extern int key_arti_health; +extern int key_arti_poisonbag; +extern int key_arti_blastradius; +extern int key_arti_teleport; +extern int key_arti_teleportother; +extern int key_arti_egg; +extern int key_arti_invulnerability; + extern int key_demo_quit; extern int key_spy; extern int key_prevweapon; diff --git a/src/setup/keyboard.c b/src/setup/keyboard.c index 0e576870..670f0c92 100644 --- a/src/setup/keyboard.c +++ b/src/setup/keyboard.c @@ -49,6 +49,10 @@ static int *controls[] = { &key_left, &key_right, &key_up, &key_down, &key_weapon1, &key_weapon2, &key_weapon3, &key_weapon4, &key_weapon5, &key_weapon6, &key_weapon7, &key_weapon8, + &key_arti_all, &key_arti_health, &key_arti_poisonbag, + &key_arti_blastradius, &key_arti_teleport, + &key_arti_teleportother, &key_arti_egg, + &key_arti_invulnerability, &key_prevweapon, &key_nextweapon, NULL }; static int *menu_nav[] = { &key_menu_activate, &key_menu_up, &key_menu_down, @@ -184,7 +188,7 @@ static void ConfigExtraKeys(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) table = TXT_NewTable(2); - TXT_SetColumnWidths(table, 20, 9); + TXT_SetColumnWidths(table, 21, 9); if (extra_keys) { @@ -229,6 +233,20 @@ static void ConfigExtraKeys(TXT_UNCAST_ARG(widget), TXT_UNCAST_ARG(unused)) { AddKeyControl(table, "Use artifact", &key_useartifact); } + + if (gamemission == hexen) + { + AddSectionLabel(table, "Artifacts", true); + + AddKeyControl(table, "One of each", &key_arti_all); + AddKeyControl(table, "Quartz Flask", &key_arti_health); + AddKeyControl(table, "Flechette", &key_arti_poisonbag); + AddKeyControl(table, "Disc of Repulsion", &key_arti_blastradius); + AddKeyControl(table, "Chaos Device", &key_arti_teleport); + AddKeyControl(table, "Banishment Device", &key_arti_teleportother); + AddKeyControl(table, "Porkalator", &key_arti_egg); + AddKeyControl(table, "Icon of the Defender", &key_arti_invulnerability); + } } else { -- cgit v1.2.3