DEADSOFTWARE

make turret explosions ignore the turret trigger
[d2df-sdl.git] / src / game / g_weapons.pas
index 6f6b60be4f374bee6f2a45d9bce097425dbbfa72..24908271dc62734bc2f1d0fbeb019de387f9b67c 100644 (file)
@@ -1,3 +1,19 @@
+(* Copyright (C)  DooM 2D:Forever Developers
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>.
+ *)
+{$MODE DELPHI}
 unit g_weapons;
 
 interface
@@ -60,7 +76,7 @@ procedure g_Weapon_mgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean
 procedure g_Weapon_shotgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean = False);
 procedure g_Weapon_dshotgun(x, y, xd, yd: Integer; SpawnerUID: Word; Silent: Boolean = False);
 
-function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word): Boolean;
+function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word; IgnoreTrigger: Integer = -1): Boolean;
 procedure g_Weapon_BFG9000(X, Y: Integer; SpawnerUID: Word);
 procedure g_Weapon_Update();
 procedure g_Weapon_Draw();
@@ -780,14 +796,15 @@ begin
   end;
 end;
 
-function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word): Boolean;
+function g_Weapon_Explode(X, Y: Integer; rad: Integer; SpawnerUID: Word; IgnoreTrigger: Integer = -1): Boolean;
 var
   i, h, r, dx, dy, m, mm: Integer;
   _angle: SmallInt;
 begin
   Result := False;
 
-  g_Triggers_PressC(X, Y, rad, SpawnerUID, ACTIVATE_SHOT);
+  // don't let turret explosions use the turret
+  g_Triggers_PressC(X, Y, rad, SpawnerUID, ACTIVATE_SHOT, IgnoreTrigger);
 
   r := rad*rad;
 
@@ -1462,7 +1479,7 @@ begin
 
     triggers := nil;
     ShotType := WEAPON_MANCUB_FIRE;
-    g_Frames_Get(FramesID, 'FRAMES_WEAPON_MANCUBFIRE'); 
+    g_Frames_Get(FramesID, 'FRAMES_WEAPON_MANCUBFIRE');
     Animation := TAnimation.Create(FramesID, True, 4);
   end;
 
@@ -1486,7 +1503,7 @@ begin
     if Integer(find_id) >= High(Shots) then
       SetLength(Shots, find_id + 64)
   end;
+
   with Shots[find_id] do
   begin
     g_Obj_Init(@Obj);
@@ -1932,6 +1949,15 @@ begin
             else
               e_Draw(TextureID, Obj.X, Obj.Y, 0, True, False);
           end;
+
+          if g_debug_Frames then
+          begin
+            e_DrawQuad(Obj.X+Obj.Rect.X,
+                       Obj.Y+Obj.Rect.Y,
+                       Obj.X+Obj.Rect.X+Obj.Rect.Width-1,
+                       Obj.Y+Obj.Rect.Y+Obj.Rect.Height-1,
+                       0, 255, 0);
+          end;
       end;
 end;
 
@@ -2097,7 +2123,7 @@ begin
   if Shots = nil then
     Exit;
   if (I > High(Shots)) or (I < 0) then Exit;
-  
+
   with Shots[I] do
   begin
     if ShotType = 0 then Exit;
@@ -2141,7 +2167,7 @@ begin
           s := 'FRAMES_EXPLODE_PLASMA'
         else
           s := 'FRAMES_EXPLODE_BSPFIRE';
-        
+
         if g_Frames_Get(TextureID, s) and loud then
         begin
           Anim := TAnimation.Create(TextureID, False, 3);