hedgewars/uGears.pas
changeset 38 c1ec4b15d70e
parent 37 2b7f2a43b999
child 39 b78e7185ed13
equal deleted inserted replaced
37:2b7f2a43b999 38:c1ec4b15d70e
    55              Timer : LongWord;
    55              Timer : LongWord;
    56              Elasticity: Real;
    56              Elasticity: Real;
    57              Friction  : Real;
    57              Friction  : Real;
    58              Message : Longword;
    58              Message : Longword;
    59              Hedgehog: pointer;
    59              Hedgehog: pointer;
    60              Health, Damage: LongWord;
    60              Health, Damage: integer;
    61              CollIndex: Longword;
    61              CollIndex: Longword;
    62              Tag: integer;
    62              Tag: integer;
    63              end;
    63              end;
    64 
    64 
    65 function  AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
    65 function  AddGear(X, Y: integer; Kind: TGearType; State: Cardinal; const dX: real=0.0; dY: real=0.0; Timer: LongWord=0): PGear;
    86                                   end;
    86                                   end;
    87                  end;
    87                  end;
    88 
    88 
    89 procedure DeleteGear(Gear: PGear); forward;
    89 procedure DeleteGear(Gear: PGear); forward;
    90 procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward;
    90 procedure doMakeExplosion(X, Y, Radius: integer; Mask: LongWord); forward;
       
    91 procedure AmmoShove(Ammo, Gear: PGear; Power: Longword); forward;
    91 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; forward;
    92 function  CheckGearNear(Gear: PGear; Kind: TGearType; rX, rY: integer): PGear; forward;
    92 procedure SpawnBoxOfSmth; forward;
    93 procedure SpawnBoxOfSmth; forward;
    93 procedure AfterAttack; forward;
    94 procedure AfterAttack; forward;
    94 
    95 
    95 {$INCLUDE GSHandlers.inc}
    96 {$INCLUDE GSHandlers.inc}
   203                 Result.HalfHeight:= 14;
   204                 Result.HalfHeight:= 14;
   204                 Result.Elasticity:= 0.6
   205                 Result.Elasticity:= 0.6
   205                 end;
   206                 end;
   206   gtDEagleShot: begin
   207   gtDEagleShot: begin
   207                 Result.HalfWidth:= 1;
   208                 Result.HalfWidth:= 1;
   208                 Result.HalfHeight:= 1
   209                 Result.HalfHeight:= 1;
       
   210                 Result.Health:= 50
   209                 end;
   211                 end;
   210      end;
   212      end;
   211 if GearsList = nil then GearsList:= Result
   213 if GearsList = nil then GearsList:= Result
   212                    else begin
   214                    else begin
   213                    GearsList.PrevGear:= Result;
   215                    GearsList.PrevGear:= Result;
   539                   gtMine,
   541                   gtMine,
   540                   gtCase: begin
   542                   gtCase: begin
   541                           inc(Gear.Damage, dmg);
   543                           inc(Gear.Damage, dmg);
   542                           Gear.dX:= Gear.dX + dmg / 200 * sign(Gear.X - X);
   544                           Gear.dX:= Gear.dX + dmg / 200 * sign(Gear.X - X);
   543                           Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
   545                           Gear.dY:= Gear.dY + dmg / 200 * sign(Gear.Y - Y);
       
   546                           Gear.Active:= true;
   544                           FollowGear:= Gear
   547                           FollowGear:= Gear
   545                           end;
   548                           end;
   546                  gtGrave: Gear.dY:= - dmg / 250;
   549                  gtGrave: Gear.dY:= - dmg / 250;
   547               end;
   550               end;
   548          end;
   551          end;
   549       Gear:= Gear.NextGear
   552       Gear:= Gear.NextGear
   550       end
   553       end
       
   554 end;
       
   555 
       
   556 procedure AmmoShove(Ammo, Gear: PGear; Power: Longword);
       
   557 begin
       
   558 case Gear.Kind of
       
   559      gtHedgehog: begin
       
   560                  inc(Gear.Damage, Power);
       
   561                  Gear.dX:= Ammo.dX * Power * 0.01;
       
   562                  Gear.dY:= Ammo.dY * Power * 0.01;
       
   563                  Gear.Active:= true;
       
   564                  FollowGear:= Gear
       
   565                  end;
       
   566      end;
   551 end;
   567 end;
   552 
   568 
   553 procedure AssignHHCoords;
   569 procedure AssignHHCoords;
   554 var Gear: PGear;
   570 var Gear: PGear;
   555     pX, pY: integer;
   571     pX, pY: integer;