hedgewars/uGears.pas
changeset 5343 ff7ecf483759
parent 5319 51d8e4747876
child 5366 bfdd925e89a5
equal deleted inserted replaced
5340:6963e37f2dd2 5343:ff7ecf483759
    37 
    37 
    38 procedure initModule;
    38 procedure initModule;
    39 procedure freeModule;
    39 procedure freeModule;
    40 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    40 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    41 function  SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    41 function  SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    42 function  SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean ): PGear;
    42 function  SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean ): PGear;
    43 procedure ResurrectHedgehog(gear: PGear);
    43 procedure ResurrectHedgehog(gear: PGear);
    44 procedure ProcessGears;
    44 procedure ProcessGears;
    45 procedure EndTurnCleanup;
    45 procedure EndTurnCleanup;
    46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    46 procedure ApplyDamage(Gear: PGear; AttackerHog: PHedgehog; Damage: Longword; Source: TDamageSource);
    47 procedure SetAllToActive;
    47 procedure SetAllToActive;
  1683     if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH);
  1683     if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH);
  1684 
  1684 
  1685     SpawnCustomCrateAt := FollowGear;
  1685     SpawnCustomCrateAt := FollowGear;
  1686 end;
  1686 end;
  1687 
  1687 
  1688 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; trap: boolean): PGear;
  1688 function SpawnFakeCrateAt(x, y: LongInt; crate: TCrateType; explode: boolean; poison: boolean): PGear;
  1689 begin
  1689 begin
  1690     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1690     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1691     cCaseFactor := 0;
  1691     cCaseFactor := 0;
       
  1692     FollowGear^.Pos := posCaseDummy;
  1692     
  1693     
  1693     if trap then FollowGear^.Pos := posCaseTrap
  1694     if explode then FollowGear^.Pos := FollowGear^.Pos + posCaseExplode;
  1694     else FollowGear^.Pos := posCaseDummy;
  1695     if poison then FollowGear^.Pos := FollowGear^.Pos + posCasePoison;
  1695 
  1696 
  1696     case crate of
  1697     case crate of
  1697         HealthCrate: begin
  1698         HealthCrate: begin
  1698             FollowGear^.Pos := FollowGear^.Pos + posCaseHealth;
  1699             FollowGear^.Pos := FollowGear^.Pos + posCaseHealth;
  1699             AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);
  1700             AddCaption(GetEventString(eidNewHealthPack), cWhiteColor, capgrpAmmoInfo);