hedgewars/uGears.pas
changeset 83 207c85fbef51
parent 82 2f4f3236cccc
child 89 f9db56409a86
equal deleted inserted replaced
82:2f4f3236cccc 83:207c85fbef51
   107                                                                doStepGrenade,
   107                                                                doStepGrenade,
   108                                                                doStepHealthTag,
   108                                                                doStepHealthTag,
   109                                                                doStepGrave,
   109                                                                doStepGrave,
   110                                                                doStepUFO,
   110                                                                doStepUFO,
   111                                                                doStepShotgunShot,
   111                                                                doStepShotgunShot,
   112                                                                doStepActionTimer,
       
   113                                                                doStepPickHammer,
   112                                                                doStepPickHammer,
   114                                                                doStepRope,
   113                                                                doStepRope,
   115                                                                doStepSmokeTrace,
   114                                                                doStepSmokeTrace,
   116                                                                doStepExplosion,
   115                                                                doStepExplosion,
   117                                                                doStepMine,
   116                                                                doStepMine,
   121                                                                doStepTeamHealthSorter,
   120                                                                doStepTeamHealthSorter,
   122                                                                doStepBomb,
   121                                                                doStepBomb,
   123                                                                doStepCluster,
   122                                                                doStepCluster,
   124                                                                doStepShover,
   123                                                                doStepShover,
   125                                                                doStepFlame,
   124                                                                doStepFlame,
   126                                                                doStepFirePunch
   125                                                                doStepFirePunch,
       
   126                                                                doStepActionTimer,
       
   127                                                                doStepActionTimer,
       
   128                                                                doStepActionTimer
   127                                                                );
   129                                                                );
   128 
   130 
   129 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   131 function AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
   130 const Counter: Longword = 0;
   132 const Counter: Longword = 0;
   131 begin
   133 begin
   141 Result.Active:= true;
   143 Result.Active:= true;
   142 Result.dX:= dX;
   144 Result.dX:= dX;
   143 Result.dY:= dY;
   145 Result.dY:= dY;
   144 Result.doStep:= doStepHandlers[Kind];
   146 Result.doStep:= doStepHandlers[Kind];
   145 Result.CollIndex:= High(Longword);
   147 Result.CollIndex:= High(Longword);
       
   148 Result.Timer:= Timer;
   146 if CurrentTeam <> nil then
   149 if CurrentTeam <> nil then
   147    Result.Hedgehog:= @CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog];
   150    Result.Hedgehog:= @CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog];
   148 case Kind of
   151 case Kind of
   149    gtAmmo_Bomb: begin
   152    gtAmmo_Bomb: begin
   150                 Result.Radius:= 4;
   153                 Result.Radius:= 4;
   151                 Result.Elasticity:= 0.6;
   154                 Result.Elasticity:= 0.6;
   152                 Result.Friction:= 0.995;
   155                 Result.Friction:= 0.995;
   153                 Result.Timer:= Timer
       
   154                 end;
   156                 end;
   155     gtHedgehog: begin
   157     gtHedgehog: begin
   156                 Result.Radius:= cHHRadius;
   158                 Result.Radius:= cHHRadius;
   157                 Result.Elasticity:= 0.002;
   159                 Result.Elasticity:= 0.002;
   158                 Result.Friction:= 0.999;
   160                 Result.Friction:= 0.999;
   175                 end;
   177                 end;
   176  gtShotgunShot: begin
   178  gtShotgunShot: begin
   177                 Result.Timer:= 900;
   179                 Result.Timer:= 900;
   178                 Result.Radius:= 2
   180                 Result.Radius:= 2
   179                 end;
   181                 end;
   180  gtActionTimer: begin
       
   181                 Result.Timer:= Timer
       
   182                 end;
       
   183   gtPickHammer: begin
   182   gtPickHammer: begin
   184                 Result.Radius:= 10;
   183                 Result.Radius:= 10;
   185                 Result.Timer:= 4000
   184                 Result.Timer:= 4000
   186                 end;
   185                 end;
   187   gtSmokeTrace: begin
   186   gtSmokeTrace: begin
   221                 end;
   220                 end;
   222  gtClusterBomb: begin
   221  gtClusterBomb: begin
   223                 Result.Radius:= 4;
   222                 Result.Radius:= 4;
   224                 Result.Elasticity:= 0.6;
   223                 Result.Elasticity:= 0.6;
   225                 Result.Friction:= 0.995;
   224                 Result.Friction:= 0.995;
   226                 Result.Timer:= Timer
       
   227                 end;
   225                 end;
   228        gtFlame: begin
   226        gtFlame: begin
   229                 Result.Angle:= Counter mod 64;
   227                 Result.Angle:= Counter mod 64;
   230                 Result.Radius:= 1;
   228                 Result.Radius:= 1;
   231                 Result.Health:= 2;
   229                 Result.Health:= 2;
   292             RecountTeamHealth(PHedgehog(Gear.Hedgehog)^.Team);
   290             RecountTeamHealth(PHedgehog(Gear.Hedgehog)^.Team);
   293             
   291             
   294             Gear.Damage:= 0
   292             Gear.Damage:= 0
   295             end;
   293             end;
   296       Gear:= Gear.NextGear
   294       Gear:= Gear.NextGear
   297       end
   295       end;
       
   296 CheckForWin
   298 end;
   297 end;
   299 
   298 
   300 procedure ProcessGears;
   299 procedure ProcessGears;
   301 const delay: integer = cInactDelay;
   300 const delay: integer = cInactDelay;
   302       step: (stDelay, stChDmg, stSpawn, stNTurn) = stDelay;
   301       step: (stDelay, stChDmg, stSpawn, stNTurn) = stDelay;
   411     var i, x, y: integer;
   410     var i, x, y: integer;
   412         t, k, ladd: real;
   411         t, k, ladd: real;
   413     begin
   412     begin
   414     if (X1 = X2) and (Y1 = Y2) then
   413     if (X1 = X2) and (Y1 = Y2) then
   415        begin
   414        begin
   416        {$IFDEF DEBUGFILE}AddFileLog('zero length rope line!!!!!');{$ENDIF}
   415        OutError('WARNING: zero length rope line!');
   417        exit
   416        exit
   418        end;
   417        end;
   419     if abs(X1 - X2) > abs(Y1 - Y2) then
   418     if abs(X1 - X2) > abs(Y1 - Y2) then
   420        begin
   419        begin
   421        if X1 > X2 then
   420        if X1 > X2 then
   549 var i: integer;
   548 var i: integer;
   550 begin
   549 begin
   551 for i:= 0 to cCloudsNumber do
   550 for i:= 0 to cCloudsNumber do
   552     AddGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, gtCloud, random(4),
   551     AddGear( - cScreenWidth + i * ((cScreenWidth * 2 + 2304) div cCloudsNumber), -140, gtCloud, random(4),
   553              (0.5-random)*0.02, ((i mod 2) * 2 - 1) * (0.005 + 0.015*random));
   552              (0.5-random)*0.02, ((i mod 2) * 2 - 1) * (0.005 + 0.015*random));
   554 AddGear(0, 0, gtActionTimer, gtsStartGame, 0, 0, 2000).Health:= 3;
   553 AddGear(0, 0, gtATStartGame, 0, 0, 0, 2000);
   555 if (GameFlags and gfForts) = 0 then
   554 if (GameFlags and gfForts) = 0 then
   556    for i:= 0 to 3 do
   555    for i:= 0 to 3 do
   557        FindPlace(AddGear(0, 0, gtMine, 0), false, 0, 2048);
   556        FindPlace(AddGear(0, 0, gtMine, 0), false, 0, 2048);
   558 end;
   557 end;
   559 
   558