Engine:
authorsmxx
Sun, 14 Mar 2010 20:22:00 +0000
changeset 2990 b62e567f17b9
parent 2989 b49d87499398
child 2991 142ea64ce8a2
Engine: * Removed obsolete trigger code
hedgewars/CCHandlers.inc
hedgewars/CMakeLists.txt
hedgewars/HHHandlers.inc
hedgewars/hwengine.pas
hedgewars/uConsole.pas
hedgewars/uGears.pas
hedgewars/uTriggers.pas
--- a/hedgewars/CCHandlers.inc	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/CCHandlers.inc	Sun Mar 14 20:22:00 2010 +0000
@@ -392,7 +392,6 @@
 TryDo(AllInactive, '/nextturn called when not all gears are inactive', true);
 
 if not CurrentTeam^.ExtDriven then SendIPC('N');
-TickTrigger(trigTurns);
 {$IFDEF DEBUGFILE}AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));{$ENDIF}
 end;
 
@@ -720,42 +719,6 @@
 if ((GameFlags and gfInvulnerable) = 0) then cTagsMask:= cTagsMasks[cTagsMask] else cTagsMask:= cTagsMasksNoHealth[cTagsMask];
 end;
 
-procedure chAddTrigger(var s: shortstring);
-const MAXPARAMS = 16;
-var params: array[0..Pred(MAXPARAMS)] of Longword;
-    i: LongInt;
-    c: char;
-    tmp: shortstring;
-begin
-c:= s[1];
-Delete(s, 1, 1);
-
-i:= 0;
-while (i < MAXPARAMS) and
-    (Length(s) > 0) do
-    begin
-    SplitBySpace(s, tmp);
-    val(s, params[i]);
-    s:= tmp;
-    inc(i)
-    end;
-
-case c of
-'s': begin // sTYPE TICKS LIVES GEARTYPE X Y GEARTRIGGER
-    TryDo(i = 7, errmsgWrongNumber, true);
-    AddTriggerSpawner(params[0], params[1], params[2], TGearType(params[3]), params[4], params[5], params[6]);
-    end;
-'C': begin
-    TryDo(i = 3, errmsgWrongNumber, true);
-    AddTriggerSuccess(params[0], params[1], params[2]);
-    end;
-'F': begin
-    TryDo(i = 3, errmsgWrongNumber, true);
-    AddTriggerFail(params[0], params[1], params[2]);
-    end;
-end
-end;
-
 procedure chSpeedup_p(var s: shortstring);
 begin
 isSpeed:= true
--- a/hedgewars/CMakeLists.txt	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/CMakeLists.txt	Sun Mar 14 20:22:00 2010 +0000
@@ -66,7 +66,6 @@
 	uStats.pas
 	uStore.pas
 	uTeams.pas
-	uTriggers.pas
 	uVisualGears.pas
 	uWorld.pas
 	CCHandlers.inc
--- a/hedgewars/HHHandlers.inc	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/HHHandlers.inc	Sun Mar 14 20:22:00 2010 +0000
@@ -191,7 +191,7 @@
                        amNapalm: AddGear(Ammo^[CurSlot, CurAmmo].Pos, 0, gtAirAttack, 2, _0, _0, 0);
                         amDrill: FollowGear:= AddGear(hwRound(X), hwRound(Y), gtDrill, 0, xx*Power/cPowerDivisor, yy*Power/cPowerDivisor, 0);
                       amBallgun: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBallgun,  0, xx * _0_5, yy * _0_5, 0);
-                    amJetpack: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtJetpack, 0, _0, _0, 0);
+                    amJetpack: CurAmmoGear:= AddGear(hwRound(X), hwRound(Y), gtBirdy, 0, _0, _0, 0);
                       amLowGravity: begin
                                     PlaySound(sndLowGravity);
                                     cGravity:= cMaxWindSpeed / 2
--- a/hedgewars/hwengine.pas	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/hwengine.pas	Sun Mar 14 20:22:00 2010 +0000
@@ -57,7 +57,6 @@
     uFloat in 'uFloat.pas',
     uStats in 'uStats.pas',
     uChat in 'uChat.pas',
-    uTriggers in 'uTriggers.pas',
     uLandTexture in 'uLandTexture.pas',
     uScript in 'uScript.pas',
     {$IFDEF IPHONEOS}PascalExports in 'PascalExports.pas',{$ENDIF}
@@ -347,7 +346,6 @@
     init_uStats();
     init_uStore();
     init_uTeams();
-    init_uTriggers();
     init_uVisualGears();
     init_uWorld();
     init_uScript();
@@ -357,7 +355,6 @@
 begin
     free_uWorld();
     free_uVisualGears();    //stub
-    free_uTriggers();   //stub
     free_uTeams();
     free_uStore();
     free_uStats();      //stub
--- a/hedgewars/uConsole.pas	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/uConsole.pas	Sun Mar 14 20:22:00 2010 +0000
@@ -38,7 +38,7 @@
 
 implementation
 uses uMisc, uStore, Types, uConsts, uGears, uTeams, uIO, uKeys, uWorld, uLand,
-     uRandom, uAmmos, uTriggers, uStats, uGame, uChat, SDLh, uSound, uVisualGears, uScript;
+     uRandom, uAmmos, uStats, uGame, uChat, SDLh, uSound, uVisualGears, uScript;
 
 const cLineWidth: LongInt = 0;
       cLinesCount = 256;
@@ -230,7 +230,6 @@
     RegisterVariable('capture' , vtCommand, @chCapture      , true );
     RegisterVariable('rotmask' , vtCommand, @chRotateMask   , true );
     RegisterVariable('addteam' , vtCommand, @chAddTeam      , false);
-    RegisterVariable('addtrig' , vtCommand, @chAddTrigger   , false);
     RegisterVariable('rdriven' , vtCommand, @chTeamLocal    , false);
     RegisterVariable('map'     , vtCommand, @chSetMap       , false);
     RegisterVariable('theme'   , vtCommand, @chSetTheme     , false);
--- a/hedgewars/uGears.pas	Sun Mar 14 17:04:36 2010 +0000
+++ b/hedgewars/uGears.pas	Sun Mar 14 20:22:00 2010 +0000
@@ -55,7 +55,6 @@
             Tex: PTexture;
             Z: Longword;
             IntersectGear: PGear;
-            TriggerId: Longword;
             FlightTime: Longword;
             uid: Longword;
             SoundChannel: LongInt
@@ -95,7 +94,7 @@
 
 implementation
 uses uWorld, uMisc, uStore, uConsole, uSound, uTeams, uRandom, uCollisions, uLand, uIO, uLandGraphics,
-    uAIMisc, uLocale, uAI, uAmmos, uTriggers, uStats, uVisualGears, uScript, 
+    uAIMisc, uLocale, uAI, uAmmos, uStats, uVisualGears, uScript, 
 {$IFDEF GLES11}
     gles11;
 {$ELSE}
@@ -507,7 +506,6 @@
 with Gear^ do AddFileLog('Delete: #' + inttostr(uid) + ' (' + inttostr(hwRound(x)) + ',' + inttostr(hwRound(y)) + '), d(' + floattostr(dX) + ',' + floattostr(dY) + ') type = ' + inttostr(ord(Kind)));
 {$ENDIF}
 
-if Gear^.TriggerId <> 0 then TickTrigger(Gear^.TriggerId);
 if CurAmmoGear = Gear then CurAmmoGear:= nil;
 if FollowGear = Gear then FollowGear:= nil;
 RemoveGearFromList(Gear);
@@ -1694,7 +1692,6 @@
         for i:= 0 to Pred(cLandAdditions) do
             begin
             Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
-            Gear^.TriggerId:= i + 1;
             FindPlace(Gear, false, 0, LAND_WIDTH);
             end;
 //  No game flag for this for now
--- a/hedgewars/uTriggers.pas	Sun Mar 14 17:04:36 2010 +0000
+++ /dev/null	Thu Jan 01 00:00:00 1970 +0000
@@ -1,158 +0,0 @@
-(*
- * Hedgewars, a free turn based strategy game
- * Copyright (c) 2007 Andrey Korotaev <unC0Rr@gmail.com>
- *
- * 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; version 2 of the License
- *
- * 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, write to the Free Software
- * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
- *)
-
-{$INCLUDE "options.inc"}
-
-unit uTriggers;
-
-interface
-uses SDLh, uConsts;
-
-type TTrigAction = (taSpawnGear, taSuccessFinish, taFailFinish);
-
-procedure init_uTriggers;
-procedure free_uTriggers;
-procedure AddTriggerSpawner(id, Ticks, Lives: Longword; GearType: TGearType; X, Y: LongInt; GearTriggerId: Longword);
-procedure AddTriggerSuccess(id, Ticks, Lives: Longword);
-procedure AddTriggerFail(id, Ticks, Lives: Longword);
-procedure TickTrigger(id: Longword);
-
-implementation
-uses uGears, uFloat, uMisc, uWorld;
-type PTrigger = ^TTrigger;
-     TTrigger = record
-                id: Longword;
-                Ticks: Longword;
-                Lives: Longword;
-                TicksPerLife: LongWord;
-                Action: TTrigAction;
-                X, Y: LongInt;
-                SpawnGearType: TGearType;
-                SpawnGearTriggerId: Longword;
-                Next: PTrigger;
-                end;
-var TriggerList: PTrigger;
-
-function AddTrigger(id, Ticks, Lives: Longword): PTrigger;
-var tmp: PTrigger;
-begin
-new(tmp);
-FillChar(tmp^, sizeof(TTrigger), 0);
-
-tmp^.id:= id;
-tmp^.Ticks:= Ticks;
-tmp^.TicksPerLife:= Ticks;
-tmp^.Lives:= Lives;
-
-if TriggerList <> nil then tmp^.Next:= TriggerList;
-TriggerList:= tmp;
-AddTrigger:= tmp
-end;
-
-procedure AddTriggerSpawner(id, Ticks, Lives: Longword; GearType: TGearType; X, Y: LongInt; GearTriggerId: Longword);
-var tmp: PTrigger;
-begin
-if (Ticks = 0) or (Lives = 0) then exit;
-
-tmp:= AddTrigger(id, Ticks, Lives);
-tmp^.Action:= taSpawnGear;
-tmp^.X:= X;
-tmp^.Y:= Y;
-tmp^.SpawnGearType:= GearType;
-tmp^.SpawnGearTriggerId:= GearTriggerId
-end;
-
-procedure AddTriggerSuccess(id, Ticks, Lives: Longword);
-begin
-with AddTrigger(id, Ticks, Lives)^ do
-     Action:= taSuccessFinish
-end;
-
-procedure AddTriggerFail(id, Ticks, Lives: Longword);
-begin
-with AddTrigger(id, Ticks, Lives)^ do
-     Action:= taFailFinish
-end;
-
-procedure TickTriggerT(Trigger: PTrigger);
-begin
-{$IFDEF DEBUGFILE}AddFileLog('Tick trigger (type: ' + inttostr(LongWord(Trigger^.Action)) + ')');{$ENDIF}
-with Trigger^ do
-  case Action of
-     taSpawnGear: begin
-                  FollowGear:= AddGear(X, Y, SpawnGearType, 0, _0, _0, 0);
-                  FollowGear^.TriggerId:= SpawnGearTriggerId
-                  end;
- taSuccessFinish: begin
-                  GameState:= gsExit
-                  end;
-    taFailFinish: begin
-                  GameState:= gsExit
-                  end
-  end
-end;
-
-procedure TickTrigger(id: Longword);
-var t, pt, nt: PTrigger;
-begin
-t:= TriggerList;
-pt:= nil;
-
-while (t <> nil) do
-  begin
-  nt:= t^.Next;
-  if (t^.id = id) then
-    begin
-    dec(t^.Ticks);
-    if (t^.Ticks = 0) then
-       begin
-       TickTriggerT(t);
-       dec(t^.Lives);
-       t^.Ticks:= t^.TicksPerLife;
-       if (t^.Lives = 0) then
-          begin
-          if t = TriggerList then
-             begin
-             TriggerList:= nt;
-             Dispose(t)
-             end
-          else
-             begin
-             pt^.Next:= nt;
-             Dispose(t);
-             t:= pt
-             end
-          end
-       end
-    end;
-  pt:= t;
-  t:= nt
-  end
-end;
-
-procedure init_uTriggers;
-begin
-    TriggerList:= nil;
-end;
-
-procedure free_uTriggers;
-begin
-
-end;
-
-end.