foxygit / doom Log in
commit a1e32f11a1eed342356d28e7947baf15e3f2946e
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Tue Apr 26 21:30:55 2022 -0400
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Tue Apr 26 21:36:26 2022 -0400

    Heretic: Add "use artifact" mouse button
---
 src/heretic/g_game.c | 14 +++++++++++++-
 1 file changed, 13 insertions(+), 1 deletion(-)

diff --git a/src/heretic/g_game.c b/src/heretic/g_game.c
index e0b4ede2..fbce5e39 100644
--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -423,13 +423,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic)
     }

     // Use artifact key
-    if (gamekeydown[key_useartifact])
+    if (gamekeydown[key_useartifact] || mousebuttons[mousebuseartifact])
     {
         if (gamekeydown[key_speed] && !noartiskip)
         {
             if (players[consoleplayer].inventory[inv_ptr].type != arti_none)
             {
                 gamekeydown[key_useartifact] = false;
+                mousebuttons[mousebuseartifact] = false;
                 cmd->arti = 0xff;       // skip artifact code
             }
         }
@@ -840,6 +841,9 @@ static boolean InventoryMoveRight()
 static void SetMouseButtons(unsigned int buttons_mask)
 {
     int i;
+    player_t *plr;
+
+    plr = &players[consoleplayer];

     for (i=0; i<MAX_MOUSE_BUTTONS; ++i)
     {
@@ -865,6 +869,14 @@ static void SetMouseButtons(unsigned int buttons_mask)
             {
                 InventoryMoveRight();
             }
+            else if (i == mousebuseartifact)
+            {
+                if (!inventory)
+                {
+                    plr->readyArtifact = plr->inventory[inv_ptr].type;
+                }
+                usearti = true;
+            }
         }

         mousebuttons[i] = button_on;