hedgewars/uGears.pas
changeset 4372 3836973380b9
parent 4370 d1d5c1a57a50
child 4373 fe0e3903bb9e
equal deleted inserted replaced
4371:ae172b2b03ed 4372:3836973380b9
   195 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
   195 procedure spawnHealthTagForHH(HHGear: PGear; dmg: Longword);
   196 var tag: PVisualGear;
   196 var tag: PVisualGear;
   197 begin
   197 begin
   198 tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
   198 tag:= AddVisualGear(hwRound(HHGear^.X), hwRound(HHGear^.Y), vgtHealthTag, dmg);
   199 if (tag <> nil) then
   199 if (tag <> nil) then
   200     tag^.Hedgehog:= PHedgehog(HHGear^.Hedgehog); // the tag needs the tag to determine the text color
   200     tag^.Hedgehog:= HHGear^.Hedgehog; // the tag needs the tag to determine the text color
   201 AllInactive:= false;
   201 AllInactive:= false;
   202 HHGear^.Active:= true;
   202 HHGear^.Active:= true;
   203 end;
   203 end;
   204 
   204 
   205 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
   205 function AddGear(X, Y: LongInt; Kind: TGearType; State: Longword; dX, dY: hwFloat; Timer: LongWord): PGear;
   265                 gear^.Elasticity:= _0_35;
   265                 gear^.Elasticity:= _0_35;
   266                 gear^.Friction:= _0_999;
   266                 gear^.Friction:= _0_999;
   267                 gear^.Angle:= cMaxAngle div 2;
   267                 gear^.Angle:= cMaxAngle div 2;
   268                 gear^.Z:= cHHZ;
   268                 gear^.Z:= cHHZ;
   269                 if (GameFlags and gfAISurvival) <> 0 then
   269                 if (GameFlags and gfAISurvival) <> 0 then
   270                     if PHedgehog(gear^.Hedgehog)^.BotLevel > 0 then
   270                     if gear^.Hedgehog^.BotLevel > 0 then
   271                         PHedgehog(gear^.Hedgehog)^.Effects[heResurrectable] := true;
   271                         gear^.Hedgehog^.Effects[heResurrectable] := true;
   272                 end;
   272                 end;
   273        gtShell: begin
   273        gtShell: begin
   274                 gear^.Radius:= 4;
   274                 gear^.Radius:= 4;
   275                 end;
   275                 end;
   276        gtGrave: begin
   276        gtGrave: begin
   927                     end;
   927                     end;
   928     t:= GearsList;
   928     t:= GearsList;
   929     while t <> nil do
   929     while t <> nil do
   930         begin
   930         begin
   931         t^.PortalCounter:= 0;
   931         t^.PortalCounter:= 0;
   932         if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < PHedgehog(t^.Hedgehog)^.InitialHealth) then
   932         if ((GameFlags and gfResetHealth) <> 0) and (t^.Kind = gtHedgehog) and (t^.Health < t^.Hedgehog^.InitialHealth) then
   933             begin
   933             begin
   934             t^.Health:= PHedgehog(t^.Hedgehog)^.InitialHealth;
   934             t^.Health:= t^.Hedgehog^.InitialHealth;
   935             RenderHealth(PHedgehog(t^.Hedgehog)^);
   935             RenderHealth(t^.Hedgehog^);
   936             end;
   936             end;
   937         t:= t^.NextGear
   937         t:= t^.NextGear
   938         end;
   938         end;
   939    
   939    
   940     if ((GameFlags and gfResetWeps) <> 0) and not PlacingHogs then
   940     if ((GameFlags and gfResetWeps) <> 0) and not PlacingHogs then
  1611     with CurrentHedgehog^ do begin
  1611     with CurrentHedgehog^ do begin
  1612         inc(Team^.stats.AIKills);
  1612         inc(Team^.stats.AIKills);
  1613         if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
  1613         if Team^.AIKillsTex <> nil then FreeTexture(Team^.AIKillsTex);
  1614         Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
  1614         Team^.AIKillsTex := RenderStringTex(inttostr(Team^.stats.AIKills), Team^.Clan^.Color, fnt16);
  1615     end;
  1615     end;
  1616     tempTeam := PHedgehog(gear^.Hedgehog)^.Team;
  1616     tempTeam := gear^.Hedgehog^.Team;
  1617     DeleteCI(gear);
  1617     DeleteCI(gear);
  1618     FindPlace(gear, false, 0, LAND_WIDTH); 
  1618     FindPlace(gear, false, 0, LAND_WIDTH); 
  1619     if gear <> nil then begin
  1619     if gear <> nil then begin
  1620         RenderHealth(PHedgehog(gear^.Hedgehog)^);
  1620         RenderHealth(gear^.Hedgehog^);
  1621         ScriptCall('onGearResurrect', gear^.uid);
  1621         ScriptCall('onGearResurrect', gear^.uid);
  1622     end;
  1622     end;
  1623     RecountTeamHealth(tempTeam);
  1623     RecountTeamHealth(tempTeam);
  1624 end;
  1624 end;
  1625 
  1625