shithub: choc

Download patch

ref: 236bb3ae5ea98ca9fa6b6eb2a1b51717516b0647
parent: a1e32f11a1eed342356d28e7947baf15e3f2946e
author: Michael Day <contact@michaelcday.com>
date: Tue Apr 26 17:31:47 EDT 2022

Hexen: Add "use artifact" mouse button

--- a/src/hexen/g_game.c
+++ b/src/hexen/g_game.c
@@ -361,7 +361,7 @@
         look = TOCENTER;
     }
     // Use artifact key
-    if (gamekeydown[key_useartifact])
+    if (gamekeydown[key_useartifact] || mousebuttons[mousebuseartifact])
     {
         if (gamekeydown[key_speed] && artiskip)
         {
@@ -368,6 +368,7 @@
             if (players[consoleplayer].inventory[inv_ptr].type != arti_none)
             {                   // Skip an artifact
                 gamekeydown[key_useartifact] = false;
+                mousebuttons[mousebuseartifact] = false;
                 P_PlayerNextArtifact(&players[consoleplayer]);
             }
         }
@@ -805,7 +806,10 @@
 static void SetMouseButtons(unsigned int buttons_mask)
 {
     int i;
+    player_t *plr;
 
+    plr = &players[consoleplayer];
+
     for (i=0; i<MAX_MOUSE_BUTTONS; ++i)
     {
         unsigned int button_on = (buttons_mask & (1 << i)) != 0;
@@ -829,6 +833,14 @@
             else if (i == mousebinvright)
             {
                 InventoryMoveRight();
+            }
+            else if (i == mousebuseartifact)
+            {
+                if (!inventory)
+                {
+                    plr->readyArtifact = plr->inventory[inv_ptr].type;
+                }
+                usearti = true;
             }
         }