hedgewars/uGears.pas
changeset 3750 3aa85b5f3318
parent 3749 d0920e92008e
child 3768 39947624dabb
equal deleted inserted replaced
3749:d0920e92008e 3750:3aa85b5f3318
    79     StepSoundChannel: LongInt;
    79     StepSoundChannel: LongInt;
    80 
    80 
    81 procedure initModule;
    81 procedure initModule;
    82 procedure freeModule;
    82 procedure freeModule;
    83 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    83 function  AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
    84 procedure SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword );
    84 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    85 procedure ProcessGears;
    85 procedure ProcessGears;
    86 procedure EndTurnCleanup;
    86 procedure EndTurnCleanup;
    87 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
    87 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
    88 procedure SetAllToActive;
    88 procedure SetAllToActive;
    89 procedure SetAllHHToActive;
    89 procedure SetAllHHToActive;
  1537     t:= t^.NextGear
  1537     t:= t^.NextGear
  1538     end;
  1538     end;
  1539 CountGears:= count;
  1539 CountGears:= count;
  1540 end;
  1540 end;
  1541 
  1541 
  1542 procedure SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword);
  1542 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear;
  1543 begin
  1543 begin
  1544     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1544     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1545     cCaseFactor := 0;
  1545     cCaseFactor := 0;
  1546 
  1546 
  1547     if (content < ord(Low(TAmmoType))) then content := 0;
       
  1548     if (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType));
  1547     if (content > ord(High(TAmmoType))) then content := ord(High(TAmmoType));
  1549 
  1548 
  1550     case crate of
  1549     case crate of
  1551         HealthCrate: begin
  1550         HealthCrate: begin
  1552             FollowGear^.Health := 25;
  1551             FollowGear^.Health := 25;
  1562             FollowGear^.Pos := posCaseUtility;
  1561             FollowGear^.Pos := posCaseUtility;
  1563             FollowGear^.State := content;
  1562             FollowGear^.State := content;
  1564             AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo);
  1563             AddCaption(GetEventString(eidNewUtilityPack), cWhiteColor, capgrpAmmoInfo);
  1565             end;
  1564             end;
  1566     end;
  1565     end;
       
  1566 
       
  1567     if ( (x = 0) and (y = 0) ) then FindPlace(FollowGear, true, 0, LAND_WIDTH);
       
  1568 
       
  1569     SpawnCustomCrateAt := FollowGear;
  1567 end;
  1570 end;
  1568 
  1571 
  1569 procedure SpawnBoxOfSmth;
  1572 procedure SpawnBoxOfSmth;
  1570 var t, aTot, uTot, a, h: LongInt;
  1573 var t, aTot, uTot, a, h: LongInt;
  1571     i: TAmmoType;
  1574     i: TAmmoType;