shithub: choc

Download patch

ref: 68d11b6ff1cb15cdf80d29443d2c3e15da434fa3
parent: ac228b3486155a0b4859b885f336769426237761
parent: 76fa96e19a7d54993c6df0ffe9076d38655d9ad4
author: Simon Howard <fraggle@soulsphere.org>
date: Mon Jan 20 13:17:57 EST 2020

Merge pull request #1238 from chocolate-doom/heretic_key_arti

Heretic: artifacts can be binded to own keys

--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -447,11 +447,52 @@
             }
         }
     }
-    if (gamekeydown[127] && !cmd->arti
+    if (gamekeydown[key_arti_tome] && !cmd->arti
         && !players[consoleplayer].powers[pw_weaponlevel2])
     {
-        gamekeydown[127] = false;
+        gamekeydown[key_arti_tome] = false;
         cmd->arti = arti_tomeofpower;
+    }
+    else if (gamekeydown[key_arti_quartz] && !cmd->arti
+        && (players[consoleplayer].mo->health < MAXHEALTH))
+    {
+        gamekeydown[key_arti_quartz] = false;
+        cmd->arti = arti_health;
+    }
+    else if (gamekeydown[key_arti_urn] && !cmd->arti)
+    {
+        gamekeydown[key_arti_urn] = false;
+        cmd->arti = arti_superhealth;
+    }
+    else if (gamekeydown[key_arti_bomb] && !cmd->arti)
+    {
+        gamekeydown[key_arti_bomb] = false;
+        cmd->arti = arti_firebomb;
+    }
+    else if (gamekeydown[key_arti_ring] && !cmd->arti)
+    {
+        gamekeydown[key_arti_ring] = false;
+        cmd->arti = arti_invulnerability;
+    }
+    else if (gamekeydown[key_arti_chaosdevice] && !cmd->arti)
+    {
+        gamekeydown[key_arti_chaosdevice] = false;
+        cmd->arti = arti_teleport;
+    }
+    else if (gamekeydown[key_arti_shadowsphere] && !cmd->arti)
+    {
+        gamekeydown[key_arti_shadowsphere] = false;
+        cmd->arti = arti_invisibility;
+    }
+    else if (gamekeydown[key_arti_wings] && !cmd->arti)
+    {
+        gamekeydown[key_arti_wings] = false;
+        cmd->arti = arti_fly;
+    }
+    else if (gamekeydown[key_arti_torch] && !cmd->arti)
+    {
+        gamekeydown[key_arti_torch] = false;
+        cmd->arti = arti_torch;
     }
 
 //
--- a/src/m_config.c
+++ b/src/m_config.c
@@ -1524,6 +1524,78 @@
     CONFIG_VARIABLE_KEY(key_nextweapon),
 
     //!
+    // @game heretic
+    //
+    // Key to use "quartz flask" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_quartz),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "mystic urn" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_urn),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "timebomb of the ancients" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_bomb),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "tome of power" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_tome),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "ring of invincibility" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_ring),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "chaos device" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_chaosdevice),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "shadowsphere" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_shadowsphere),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "wings of wrath" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_wings),
+
+    //!
+    // @game heretic
+    //
+    // Key to use "torch" artifact.
+    //
+
+    CONFIG_VARIABLE_KEY(key_arti_torch),
+
+    //!
     // @game hexen
     //
     // Key to use one of each artifact.
--- a/src/m_controls.c
+++ b/src/m_controls.c
@@ -54,6 +54,16 @@
 int key_invright = ']';
 int key_useartifact = KEY_ENTER;
 
+int key_arti_quartz = 0;
+int key_arti_urn = 0;
+int key_arti_bomb = 0;
+int key_arti_tome = 127;
+int key_arti_ring = 0;
+int key_arti_chaosdevice = 0;
+int key_arti_shadowsphere = 0;
+int key_arti_wings = 0;
+int key_arti_torch = 0;
+
 //
 // Hexen key controls
 //
@@ -254,6 +264,16 @@
     M_BindIntVariable("key_invleft",        &key_invleft);
     M_BindIntVariable("key_invright",       &key_invright);
     M_BindIntVariable("key_useartifact",    &key_useartifact);
+
+    M_BindIntVariable("key_arti_quartz",        &key_arti_quartz);
+    M_BindIntVariable("key_arti_urn",           &key_arti_urn);
+    M_BindIntVariable("key_arti_bomb",          &key_arti_bomb);
+    M_BindIntVariable("key_arti_tome",          &key_arti_tome);
+    M_BindIntVariable("key_arti_ring",          &key_arti_ring);
+    M_BindIntVariable("key_arti_chaosdevice",   &key_arti_chaosdevice);
+    M_BindIntVariable("key_arti_shadowsphere",  &key_arti_shadowsphere);
+    M_BindIntVariable("key_arti_wings",         &key_arti_wings);
+    M_BindIntVariable("key_arti_torch",         &key_arti_torch);
 }
 
 void M_BindHexenControls(void)
--- a/src/m_controls.h
+++ b/src/m_controls.h
@@ -67,6 +67,16 @@
 extern int key_weapon7;
 extern int key_weapon8;
 
+extern int key_arti_quartz;
+extern int key_arti_urn;
+extern int key_arti_bomb;
+extern int key_arti_tome;
+extern int key_arti_ring;
+extern int key_arti_chaosdevice;
+extern int key_arti_shadowsphere;
+extern int key_arti_wings;
+extern int key_arti_torch;
+
 extern int key_arti_all;
 extern int key_arti_health;
 extern int key_arti_poisonbag;
--- a/src/setup/keyboard.c
+++ b/src/setup/keyboard.c
@@ -45,6 +45,9 @@
                            &key_weapon1, &key_weapon2, &key_weapon3,
                            &key_weapon4, &key_weapon5, &key_weapon6,
                            &key_weapon7, &key_weapon8,
+                           &key_arti_quartz, &key_arti_urn, &key_arti_bomb,
+                           &key_arti_tome, &key_arti_ring, &key_arti_chaosdevice,
+                           &key_arti_shadowsphere, &key_arti_wings, &key_arti_torch,
                            &key_arti_all, &key_arti_health, &key_arti_poisonbag,
                            &key_arti_blastradius, &key_arti_teleport,
                            &key_arti_teleportother, &key_arti_egg,
@@ -238,6 +241,21 @@
         else
         {
             AddKeyControl(table, "Use artifact", &key_useartifact);
+        }
+
+        if (gamemission == heretic)
+        {
+            AddSectionLabel(table, "Artifacts", true);
+
+            AddKeyControl(table, "Quartz Flask", &key_arti_quartz);
+            AddKeyControl(table, "Mystic Urn", &key_arti_urn);
+            AddKeyControl(table, "Timebomb", &key_arti_bomb);
+            AddKeyControl(table, "Tome of Power", &key_arti_tome);
+            AddKeyControl(table, "Ring of Invincibility ", &key_arti_ring);
+            AddKeyControl(table, "Chaos Device", &key_arti_chaosdevice);
+            AddKeyControl(table, "Shadowsphere", &key_arti_shadowsphere);
+            AddKeyControl(table, "Wings of Wrath", &key_arti_wings);
+            AddKeyControl(table, "Torch", &key_arti_torch);
         }
 
         if (gamemission == hexen)