remove obsolete TrainingFlags code
authorkoda
Sun, 02 Jan 2011 18:12:16 +0100
changeset 4808 7c3e5b52344a
parent 4807 180dbfb13903
child 4809 9c7d5f802618
remove obsolete TrainingFlags code
hedgewars/GSHandlers.inc
hedgewars/uAmmos.pas
hedgewars/uCaptions.pas
hedgewars/uCommandHandlers.pas
hedgewars/uConsts.pas
hedgewars/uGears.pas
hedgewars/uGearsRender.pas
hedgewars/uVariables.pas
hedgewars/uWorld.pas
--- a/hedgewars/GSHandlers.inc	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/GSHandlers.inc	Sun Jan 02 18:12:16 2011 +0100
@@ -1972,28 +1972,12 @@
     if (Gear^.Tag = 0) and (Gear^.Timer < 1000) then
         inc(Gear^.Timer)
     else if Gear^.Tag = 1 then
-        begin
-            Gear^.Tag := 2;
-            if (TrainingFlags and tfTimeTrial) <> 0 then
-            begin
-                inc(TurnTimeLeft, TrainingTimeInc);
-
-                if TrainingTimeInc > TrainingTimeInM then
-                    dec(TrainingTimeInc, TrainingTimeInD);
-                if TurnTimeLeft > TrainingTimeMax then
-                    TurnTimeLeft := TrainingTimeMax;
-            end;
-        end
+        Gear^.Tag := 2
     else if Gear^.Tag = 2 then
              if Gear^.Timer > 0 then
                  dec(Gear^.Timer)
     else
     begin
-        if (TrainingFlags and tfTargetRespawn) <> 0 then
-        begin
-            TrainingTargetGear := AddGear(0, 0, gtTarget, 0, _0, _0, 0);
-            FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH);
-        end;
         DeleteGear(Gear);
         exit;
     end;
@@ -3107,11 +3091,6 @@
 begin
     AllInactive := false;
 
-    if ((TrainingFlags and tfRCPlane) = 0) and (Gear^.Timer > 0) then dec(Gear^.Timer);
-
-    if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (
-       TimeTrialStartTime = 0) then TimeTrialStartTime := RealTicks;
-
     HHGear := Gear^.Hedgehog^.Gear;
     FollowGear := Gear;
 
@@ -3154,71 +3133,42 @@
     Gear^.X := Gear^.X + Gear^.dX;
     Gear^.Y := Gear^.Y + Gear^.dY;
 
-    if (TrainingFlags and tfRCPlane) = 0 then
+    if (GameTicks and $FF) = 0 then
+        if Gear^.Timer < 3500 then
+            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace)
+    else
+        AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
+
+    if ((HHGear^.Message and gmAttack) <> 0) and (Gear^.Health <> 0) then
     begin
-        if (GameTicks and $FF) = 0 then
-            if Gear^.Timer < 3500 then
-                AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtEvilTrace)
-        else
-            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
-
-        if ((HHGear^.Message and gmAttack) <> 0) and (Gear^.Health <> 0) then
-        begin
-            HHGear^.Message := HHGear^.Message and not gmAttack;
-            AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY *
-            _0_5, 0);
-            dec(Gear^.Health)
-        end;
-
-        if ((HHGear^.Message and gmLJump) <> 0)
-           and ((Gear^.State and gsttmpFlag) = 0) then
-        begin
-            Gear^.State := Gear^.State or gsttmpFlag;
-            PauseMusic;
-            playSound(sndRideOfTheValkyries);
-        end;
-
-        // pickup bonuses
-        t := CheckGearNear(Gear, gtCase, 36, 36);
-        if t <> nil then
-            PickUp(HHGear, t);
-    end
-    else
+        HHGear^.Message := HHGear^.Message and not gmAttack;
+        AddGear(hwRound(Gear^.X), hwRound(Gear^.Y), gtAirBomb, 0, Gear^.dX * _0_5, Gear^.dY *
+        _0_5, 0);
+        dec(Gear^.Health)
+    end;
+
+    if ((HHGear^.Message and gmLJump) <> 0)
+       and ((Gear^.State and gsttmpFlag) = 0) then
     begin
-        if (GameTicks and $FF) = 0 then
-            AddVisualGear(hwRound(Gear^.X), hwRound(Gear^.Y), vgtSmokeTrace);
-
-        // pickup targets
-        t := CheckGearNear(Gear, gtTarget, 36, 36);
-        if t <> nil then
-        begin
-            if t^.Tag <> 0 then // collect it only once
-                exit;
-            PlaySound(sndShotgunReload);
-            t^.Tag := 1;
-            TrainingTargetGear := nil;
-            // remove target cursor
-            exit;
-        end;
-
-        if (TurnTimeLeft > 0) then
-            dec(TurnTimeLeft)
+        Gear^.State := Gear^.State or gsttmpFlag;
+        PauseMusic;
+        playSound(sndRideOfTheValkyries);
     end;
 
+    // pickup bonuses
+    t := CheckGearNear(Gear, gtCase, 36, 36);
+    if t <> nil then
+        PickUp(HHGear, t);
+
     CheckCollision(Gear);
 
-    if ((Gear^.State and gstCollision) <> 0) or (((TrainingFlags and tfRCPlane) <> 0) and (
-       TurnTimeLeft = 0))
-       or CheckGearDrowning(Gear) then
+    if ((Gear^.State and gstCollision) <> 0) or CheckGearDrowning(Gear) then
     begin
-        if ((TrainingFlags and tfRCPlane) <> 0) and ((TrainingFlags and tfTimeTrial) <> 0 ) and (
-           TimeTrialStopTime = 0) then TimeTrialStopTime := RealTicks;
         StopSound(Gear^.SoundChannel);
         StopSound(sndRideOfTheValkyries);
         ResumeMusic;
 
-        if ((Gear^.State and gstCollision) <> 0) or (((TrainingFlags and tfRCPlane) <> 0) and (
-           TurnTimeLeft = 0)) then
+        if ((Gear^.State and gstCollision) <> 0) then
         begin
             doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), 25, EXPLAutoSound);
             for i:= 0 to 32 do
@@ -3235,10 +3185,6 @@
         CurAmmoGear := nil;
         if (GameFlags and gfInfAttack) = 0 then TurnTimeLeft := 14 * 125;
 
-        if (TrainingFlags and tfRCPlane) <> 0 then
-            TurnTimeLeft := 0;
-        // HACK: RCPlane training allows unlimited plane starts in last 2 seconds
-
         HHGear^.Message := 0;
         ParseCommand('/taunt '#1, true)
     end
--- a/hedgewars/uAmmos.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uAmmos.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -94,7 +94,6 @@
         Ammoz[a].Probability:= probability[byte(ammoProbability[ord(a)]) - byte('0')];
         Ammoz[a].SkipTurns:= (byte(ammoDelay[ord(a)]) - byte('0'));
         Ammoz[a].NumberInCase:= (byte(ammoReinforcement[ord(a)]) - byte('0'));
-        if (TrainingFlags and tfIgnoreDelays) <> 0 then Ammoz[a].SkipTurns:= 0;
         cnt:= byte(ammoLoadout[ord(a)]) - byte('0');
         // avoid things we already have infinite number
         if cnt = 9 then
--- a/hedgewars/uCaptions.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uCaptions.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -39,14 +39,11 @@
     grp: TCapGroup;
     offset: LongInt;
 begin
-    {$IFDEF IPHONEOS}
+{$IFDEF IPHONEOS}
     offset:= 40;
-    {$ELSE}
-    if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then
-        offset:= 48
-    else
-        offset:= 8;
-    {$ENDIF}
+{$ELSE}
+    offset:= 8;
+{$ENDIF}
 
     for grp:= Low(TCapGroup) to High(TCapGroup) do
         with Captions[grp] do
--- a/hedgewars/uCommandHandlers.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uCommandHandlers.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -575,7 +575,6 @@
     RegisterVariable('minesnum', vtLongInt, @cLandMines     , false);
     RegisterVariable('explosives',vtLongInt,@cExplosives    , false);
     RegisterVariable('gmflags' , vtLongInt, @GameFlags      , false);
-    RegisterVariable('trflags' , vtLongInt, @TrainingFlags  , false);
     RegisterVariable('turntime', vtLongInt, @cHedgehogTurnTime, false);
     RegisterVariable('minestime',vtLongInt, @cMinesTime     , false);
     RegisterVariable('fort'    , vtCommand, @chFort         , false);
--- a/hedgewars/uConsts.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uConsts.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -163,14 +163,6 @@
     cSendEmptyPacketTime = 1000;
     trigTurns = $80000001;
 
-    // Training Flags
-    tfNone          = $00000000;
-    tfTimeTrial     = $00000001;
-    tfRCPlane       = $00000002;
-    tfSpawnTargets  = $00000004;
-    tfIgnoreDelays  = $00000008;
-    tfTargetRespawn = $00000010;
-
     gfAny                = $FFFFFFFF;
     gfOneClanMode        = $00000001;           // used in trainings
     gfMultiWeapon        = $00000002;           // used in trainings
--- a/hedgewars/uGears.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uGears.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -1091,12 +1091,6 @@
 begin
 AddGear(0, 0, gtATStartGame, 0, _0, _0, 2000);
 
-if (TrainingFlags and tfSpawnTargets) <> 0 then
-    begin
-    TrainingTargetGear:= AddGear(0, 0, gtTarget, 0, _0, _0, 0);
-    FindPlace(TrainingTargetGear, false, 0, LAND_WIDTH);
-    end;
-
 for i:= 0 to Pred(cLandMines) do
     begin
     Gear:= AddGear(0, 0, gtMine, 0, _0, _0, 0);
@@ -1894,7 +1888,6 @@
     SuddenDeath:= false;
     SuddenDeathDmg:= false;
     SpeechType:= 1;
-    TrainingTargetGear:= nil;
     skipFlag:= false;
 
     AllInactive:= false;
--- a/hedgewars/uGearsRender.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uGearsRender.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -855,8 +855,6 @@
                      DrawRotated(sprPlane, x, y, -1,  DxDy2Angle(Gear^.dX, Gear^.dY) + 90)
                   else
                      DrawRotated(sprPlane, x, y,0,DxDy2Angle(Gear^.dY, Gear^.dX));
-                  if ((TrainingFlags and tfRCPlane) <> 0) and (TrainingTargetGear <> nil) and ((Gear^.State and gstDrowning) = 0) then
-                     DrawRotatedf(sprFinger, x, y, GameTicks div 32 mod 16, 0, DxDy2Angle(Gear^.X - TrainingTargetGear^.X, TrainingTargetGear^.Y - Gear^.Y));
                   end;
        gtBall: DrawRotatedf(sprBalls, x, y, Gear^.Tag,0, Gear^.DirAngle);
 
--- a/hedgewars/uVariables.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uVariables.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -45,7 +45,6 @@
     GameType        : TGameType;
     InputMask       : LongWord;
     GameFlags       : Longword;
-    TrainingFlags   : Longword;
     TurnTimeLeft    : Longword;
     ReadyTimeLeft   : Longword;
     cSuddenDTurns   : LongInt;
@@ -76,13 +75,6 @@
     cGearScrEdgesDist: LongInt;
 
     GameTicks   : LongWord;
-    TrainingTimeInc : Longword;
-    TrainingTimeInD : Longword;
-    TrainingTimeInM : Longword;
-    TrainingTimeMax : Longword;
-
-    TimeTrialStartTime: Longword;
-    TimeTrialStopTime : Longword;
 
     // originally from uConsts
     Pathz: array[TPathType] of shortstring;
@@ -2054,7 +2046,6 @@
     SuddenDeathDmg: Boolean;
     SpeechType: Longword;
     SpeechText: shortstring;
-    TrainingTargetGear: PGear;
     skipFlag: boolean;
     PlacingHogs: boolean; // a convenience flag to indicate placement of hogs is still in progress
     StepSoundTimer: LongInt;
@@ -2215,18 +2206,11 @@
     CursorMovementX     := 0;
     CursorMovementY     := 0;
     GameTicks           := 0;
-    TrainingTimeInc     := 10000;
-    TrainingTimeInD     := 500;
-    TrainingTimeInM     := 5000;
-    TrainingTimeMax     := 60000;
-    TimeTrialStartTime  := 0;
-    TimeTrialStopTime   := 0;
     cWaterLine          := LAND_HEIGHT;
     cGearScrEdgesDist   := 240;
 
     InputMask           := $FFFFFFFF;
     GameFlags           := 0;
-    TrainingFlags       := 0;
     TurnTimeLeft        := 0;
     cSuddenDTurns       := 15;
     cDamagePercent      := 100;
--- a/hedgewars/uWorld.pas	Sun Jan 02 13:54:28 2011 +0100
+++ b/hedgewars/uWorld.pas	Sun Jan 02 18:12:16 2011 +0100
@@ -723,52 +723,6 @@
    DrawSprite(sprFrame, -(cScreenWidth shr 1) + t - 4 + offsetY, cScreenHeight - offsetX, 0);
    end;
 
-{$IFNDEF IPHONEOS}
-// Timetrial
-if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then
-    begin
-    if TimeTrialStopTime = 0 then i:= RealTicks - TimeTrialStartTime else i:= TimeTrialStopTime - TimeTrialStartTime;
-    t:= 272;
-    // right frame
-    DrawSprite(sprFrame, -cScreenWidth div 2 + t, 8, 1);
-    dec(t, 32);
-    // 1 ms
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    dec(t, 32);
-    i:= i div 10;
-    // 10 ms
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    dec(t, 32);
-    i:= i div 10;
-    // 100 ms
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    dec(t, 16);
-    // Point
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 11);
-    dec(t, 32);
-    i:= i div 10;
-    // 1 s
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    dec(t, 32);
-    i:= i div 10;
-    // 10s
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 6);
-    dec(t, 16);
-    // Point
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, 10);
-    dec(t, 32);
-    i:= i div 6;
-    // 1 m
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    dec(t, 32);
-    i:= i div 10;
-    // 10 m
-    DrawSprite(sprBigDigit, -cScreenWidth div 2 + t, 8, i mod 10);
-    // left frame
-    DrawSprite(sprFrame, -cScreenWidth div 2 + t - 4, 8, 0);
-    end;
-{$ENDIF}
-
 // Captions
 DrawCaptions;