src/theft.c
changeset 0 b2e3aa63e96c
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/theft.c	Thu Jul 17 22:03:19 2025 -0400
@@ -0,0 +1,45 @@
+#include "theft.h"
+#include "firealrm.h"
+#include "common.h"
+
+static bool theftInProgress = false;
+/*
+Uint32 progressSteal(Uint32 interval)
+{
+    if(!keysHeldDown[10])
+    {
+        SDL_RemoveTimer(fadeTimer);
+        theftInProgress = false;
+        return 0;
+    }
+    else
+    {
+
+    }
+
+    return interval;
+}*/
+
+void stealItem(int levelIndex)
+{
+    if(stealProgress < 128)
+        stealProgress += 1;
+    else
+    {
+        for(int i = 0; i < sizeof player.objectsStolen; i++)
+        {
+            if(!player.objectsStolen[i])
+            {
+                if(levelTiles[player.x * LEVEL_WIDTH + player.y] == 'T')
+                {
+                    fireAlarmTimer = SDL_AddTimer(1000, ALRM_soundFireAlarm, 0);
+                }
+                player.objectsStolen[i] = levelTiles[player.x * LEVEL_WIDTH + player.y];
+                break;
+            }
+        }
+
+        levelTiles[player.x * LEVEL_WIDTH + player.y] = ' ';
+        stealProgress = 0;
+    }
+}