hedgewars/uGearsHandlersMess.pas
changeset 13812 1f15b0ee8e34
parent 13796 096cc009e0b8
child 13855 4e4111a75256
equal deleted inserted replaced
13811:54725a1d1db8 13812:1f15b0ee8e34
   305 or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
   305 or (SuddenDeathDmg and (SDWaterOpacity < $FF))) and ((GameTicks and $1F) = 0) then
   306     if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
   306     if (Gear^.Kind = gtHedgehog) and (Random(4) = 0) then
   307         AddVisualGear(bubbleX, bubbleY, vgtBubble)
   307         AddVisualGear(bubbleX, bubbleY, vgtBubble)
   308 else if Random(12) = 0 then
   308 else if Random(12) = 0 then
   309         AddVisualGear(bubbleX, bubbleY, vgtBubble);
   309         AddVisualGear(bubbleX, bubbleY, vgtBubble);
       
   310 // Insta-delete gear and skip drowning animation if water is 100% opaque
   310 if (not SuddenDeathDmg and (WaterOpacity > $FE))
   311 if (not SuddenDeathDmg and (WaterOpacity > $FE))
   311 or (SuddenDeathDmg and (SDWaterOpacity > $FE))
   312 or (SuddenDeathDmg and (SDWaterOpacity > $FE)) then
   312 or (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
   313     begin
       
   314     // Teleport gear to a suitable position for the damage tag in the water
       
   315     if (WorldEdge = weSea) and (hwRound(Gear^.X) - Gear^.Radius < leftX) then
       
   316         begin
       
   317         if (hwRound(Gear^.X) - Gear^.Radius > leftX - 90) then
       
   318             Gear^.X := Gear^.X - _90
       
   319         end
       
   320     else if (WorldEdge = weSea) and (hwRound(Gear^.X) + Gear^.Radius > rightX) then
       
   321         begin
       
   322         if (hwRound(Gear^.X) - Gear^.Radius < rightX + 90) then
       
   323             Gear^.X := Gear^.X + _90
       
   324         end
       
   325     else
       
   326         Gear^.Y := int2hwFloat(Gear^.Radius + cWaterLine + cVisibleWater);
       
   327     DeleteGear(Gear);
       
   328     exit;
       
   329     end;
       
   330 // Delete normally if gear is outside of visible range
       
   331 if (hwRound(Gear^.Y) > Gear^.Radius + cWaterLine + cVisibleWater) then
   313     DeleteGear(Gear);
   332     DeleteGear(Gear);
   314 end;
   333 end;
   315 
   334 
   316 ////////////////////////////////////////////////////////////////////////////////
   335 ////////////////////////////////////////////////////////////////////////////////
   317 procedure doStepFallingGear(Gear: PGear);
   336 procedure doStepFallingGear(Gear: PGear);
  3247     HHGear := Gear^.Hedgehog^.Gear;
  3266     HHGear := Gear^.Hedgehog^.Gear;
  3248     OnUsedAmmo(HHGear^.Hedgehog^);
  3267     OnUsedAmmo(HHGear^.Hedgehog^);
  3249     with HHGear^ do
  3268     with HHGear^ do
  3250         begin
  3269         begin
  3251         State := State and (not gstAttacking);
  3270         State := State and (not gstAttacking);
  3252         Message := Message and (not gmAttack)
  3271         Message := Message and (not (gmAttack or gmSwitch))
  3253         end
  3272         end
  3254 end;
  3273 end;
  3255 
  3274 
  3256 ////////////////////////////////////////////////////////////////////////////////
  3275 ////////////////////////////////////////////////////////////////////////////////
  3257 procedure doStepMortar(Gear: PGear);
  3276 procedure doStepMortar(Gear: PGear);
  5457         // push the shooting Hedgehog back
  5476         // push the shooting Hedgehog back
  5458         Gear^.dX.isNegative := not Gear^.dX.isNegative;
  5477         Gear^.dX.isNegative := not Gear^.dX.isNegative;
  5459         Gear^.dY.isNegative := not Gear^.dY.isNegative;
  5478         Gear^.dY.isNegative := not Gear^.dY.isNegative;
  5460         HHGear^.dX := Gear^.dX;
  5479         HHGear^.dX := Gear^.dX;
  5461         HHGear^.dY := Gear^.dY;
  5480         HHGear^.dY := Gear^.dY;
  5462         AmmoShove(Gear, 0, 80);
  5481         AmmoShove(Gear, 0, 79);
  5463         Gear^.dX.isNegative := not Gear^.dX.isNegative;
  5482         Gear^.dX.isNegative := not Gear^.dX.isNegative;
  5464         Gear^.dY.isNegative := not Gear^.dY.isNegative;
  5483         Gear^.dY.isNegative := not Gear^.dY.isNegative;
  5465         end;
  5484         end;
  5466 
  5485 
  5467     Gear^.doStep := @doStepSineGunShotWork;
  5486     Gear^.doStep := @doStepSineGunShotWork;
  5887                 graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy;
  5906                 graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy;
  5888                 graves.ar^[i]^.Active:= true;
  5907                 graves.ar^[i]^.Active:= true;
  5889                 RenderHealth(resgear^.Hedgehog^);
  5908                 RenderHealth(resgear^.Hedgehog^);
  5890                 RecountTeamHealth(resgear^.Hedgehog^.Team);
  5909                 RecountTeamHealth(resgear^.Hedgehog^.Team);
  5891                 resgear^.Hedgehog^.Effects[heResurrected]:= 1;
  5910                 resgear^.Hedgehog^.Effects[heResurrected]:= 1;
       
  5911                 { Reviving a hog implies its clan is now alive, too. }
       
  5912                 resgear^.Hedgehog^.Team^.Clan^.DeathLogged:= false;
  5892                 s:= ansistring(resgear^.Hedgehog^.Name);
  5913                 s:= ansistring(resgear^.Hedgehog^.Name);
  5893                 AddCaption(FormatA(GetEventString(eidResurrected), s), capcolDefault, capgrpMessage);
  5914                 AddCaption(FormatA(GetEventString(eidResurrected), s), capcolDefault, capgrpMessage);
  5894                 // only make hat-less hedgehogs look like zombies, preserve existing hats
  5915                 // only make hat-less hedgehogs look like zombies, preserve existing hats
  5895 
  5916 
  5896                 if resgear^.Hedgehog^.Hat = 'NoHat' then
  5917                 if resgear^.Hedgehog^.Hat = 'NoHat' then