shithub: choc

Download patch

ref: a1e32f11a1eed342356d28e7947baf15e3f2946e
parent: b9835e43a451fe492c9ace050b2cd068c4698e79
author: Michael Day <contact@michaelcday.com>
date: Tue Apr 26 17:30:55 EDT 2022

Heretic: Add "use artifact" mouse button

--- a/src/heretic/g_game.c
+++ b/src/heretic/g_game.c
@@ -423,7 +423,7 @@
     }
 
     // Use artifact key
-    if (gamekeydown[key_useartifact])
+    if (gamekeydown[key_useartifact] || mousebuttons[mousebuseartifact])
     {
         if (gamekeydown[key_speed] && !noartiskip)
         {
@@ -430,6 +430,7 @@
             if (players[consoleplayer].inventory[inv_ptr].type != arti_none)
             {
                 gamekeydown[key_useartifact] = false;
+                mousebuttons[mousebuseartifact] = false;
                 cmd->arti = 0xff;       // skip artifact code
             }
         }
@@ -840,7 +841,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;
@@ -864,6 +868,14 @@
             else if (i == mousebinvright)
             {
                 InventoryMoveRight();
+            }
+            else if (i == mousebuseartifact)
+            {
+                if (!inventory)
+                {
+                    plr->readyArtifact = plr->inventory[inv_ptr].type;
+                }
+                usearti = true;
             }
         }