foxygit / doom Log in
commit 236bb3ae5ea98ca9fa6b6eb2a1b51717516b0647
Author:     Michael Day <contact@michaelcday.com>
AuthorDate: Tue Apr 26 21:31:47 2022 -0400
Commit:     Michael Day <contact@michaelcday.com>
CommitDate: Tue Apr 26 21:36:33 2022 -0400

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

diff --git a/src/hexen/g_game.c b/src/hexen/g_game.c
index 2a1b09d3..6997037c 100644
--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -361,13 +361,14 @@ void G_BuildTiccmd(ticcmd_t *cmd, int maketic)
         look = TOCENTER;
     }
     // Use artifact key
-    if (gamekeydown[key_useartifact])
+    if (gamekeydown[key_useartifact] || mousebuttons[mousebuseartifact])
     {
         if (gamekeydown[key_speed] && artiskip)
         {
             if (players[consoleplayer].inventory[inv_ptr].type != arti_none)
             {                   // Skip an artifact
                 gamekeydown[key_useartifact] = false;
+                mousebuttons[mousebuseartifact] = false;
                 P_PlayerNextArtifact(&players[consoleplayer]);
             }
         }
@@ -805,6 +806,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)
     {
@@ -830,6 +834,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;