hedgewars/uGears.pas
changeset 3768 39947624dabb
parent 3750 3aa85b5f3318
child 3770 f54e8cb9a12b
equal deleted inserted replaced
3767:2416a3f51c77 3768:39947624dabb
    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 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
    84 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword ): PGear;
       
    85 procedure ResurrectHedgehog(gear: PGear);
    85 procedure ProcessGears;
    86 procedure ProcessGears;
    86 procedure EndTurnCleanup;
    87 procedure EndTurnCleanup;
    87 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
    88 procedure ApplyDamage(Gear: PGear; Damage: Longword; Source: TDamageSource);
    88 procedure SetAllToActive;
    89 procedure SetAllToActive;
    89 procedure SetAllHHToActive;
    90 procedure SetAllHHToActive;
   316                 gear^.Radius:= cHHRadius;
   317                 gear^.Radius:= cHHRadius;
   317                 gear^.Elasticity:= _0_35;
   318                 gear^.Elasticity:= _0_35;
   318                 gear^.Friction:= _0_999;
   319                 gear^.Friction:= _0_999;
   319                 gear^.Angle:= cMaxAngle div 2;
   320                 gear^.Angle:= cMaxAngle div 2;
   320                 gear^.Z:= cHHZ;
   321                 gear^.Z:= cHHZ;
       
   322                 if (GameFlags and gfAISurvival) <> 0 then
       
   323                     if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then
       
   324                         PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true;
   321                 end;
   325                 end;
   322 gtAmmo_Grenade: begin // bazooka
   326 gtAmmo_Grenade: begin // bazooka
   323                 gear^.Radius:= 4;
   327                 gear^.Radius:= 4;
   324                 end;
   328                 end;
   325        gtGrave: begin
   329        gtGrave: begin
  1537     t:= t^.NextGear
  1541     t:= t^.NextGear
  1538     end;
  1542     end;
  1539 CountGears:= count;
  1543 CountGears:= count;
  1540 end;
  1544 end;
  1541 
  1545 
       
  1546 procedure ResurrectHedgehog(gear: PGear);
       
  1547 begin
       
  1548     gear^.Health := 100;
       
  1549     gear^.dX := _0;
       
  1550     gear^.dY := _0;
       
  1551     gear^.State := gstWait;
       
  1552     FindPlace(Gear, false, 0, LAND_WIDTH); 
       
  1553     RenderHealth(PHedgehog(gear^.Hedgehog)^);
       
  1554     RecountTeamHealth(PHedgehog(gear^.Hedgehog)^.Team);
       
  1555     ScriptCall('onResurrect', gear^.uid);
       
  1556 end;
       
  1557 
  1542 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear;
  1558 function SpawnCustomCrateAt(x, y: LongInt; crate: TCrateType; content: Longword): PGear;
  1543 begin
  1559 begin
  1544     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1560     FollowGear := AddGear(x, y, gtCase, 0, _0, _0, 0);
  1545     cCaseFactor := 0;
  1561     cCaseFactor := 0;
  1546 
  1562