hedgewars/uGearsHandlersMess.pas
changeset 12750 c162995831d8
parent 12749 058a5d373e4a
child 12751 e1395ba033e8
equal deleted inserted replaced
12749:058a5d373e4a 12750:c162995831d8
  3196 end;
  3196 end;
  3197 
  3197 
  3198 ////////////////////////////////////////////////////////////////////////////////
  3198 ////////////////////////////////////////////////////////////////////////////////
  3199 
  3199 
  3200 procedure doStepCakeExpl(Gear: PGear);
  3200 procedure doStepCakeExpl(Gear: PGear);
       
  3201 var gi: PGear;
  3201 begin
  3202 begin
  3202     AllInactive := false;
  3203     AllInactive := false;
  3203 
  3204 
  3204     inc(Gear^.Tag);
  3205     inc(Gear^.Tag);
  3205     if Gear^.Tag < 2250 then
  3206     if Gear^.Tag < 2250 then
  3206         exit;
  3207         exit;
  3207 
  3208 
  3208     InCinematicMode:= false;
  3209     InCinematicMode:= false;
       
  3210     gi := GearsList;
       
  3211     while gi <> nil do
       
  3212         begin
       
  3213         if gi^.Kind = gtHedgehog then
       
  3214             gi^.State := gi^.State and (not gstLoser);
       
  3215         gi:= gi^.NextGear;
       
  3216         end;
       
  3217 
  3209     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3218     doMakeExplosion(hwRound(Gear^.X), hwRound(Gear^.Y), Gear^.Boom, Gear^.Hedgehog, EXPLAutoSound);
  3210     AfterAttack;
  3219     AfterAttack;
  3211     DeleteGear(Gear)
  3220     DeleteGear(Gear)
  3212 end;
  3221 end;
  3213 
  3222 
  3214 procedure doStepCakeDown(Gear: PGear);
  3223 procedure doStepCakeDown(Gear: PGear);
  3215 var
  3224 var
  3216     gi: PGear;
  3225     gi: PGear;
  3217     dmg, dmgBase, partyEpicness, i: LongInt;
  3226     dmg, dmgBase, partyEpicness, i: LongInt;
  3218     fX, fY, tdX, tdY: hwFloat;
  3227     fX, fY: hwFloat;
  3219     sparkles: PVisualGear;
  3228     sparkles: PVisualGear;
  3220 begin
  3229 begin
  3221     AllInactive := false;
  3230     AllInactive := false;
  3222 
  3231 
  3223     inc(Gear^.Tag);
  3232     inc(Gear^.Tag);
  3240         while gi <> nil do
  3249         while gi <> nil do
  3241             begin
  3250             begin
  3242             if gi^.Kind = gtHedgehog then
  3251             if gi^.Kind = gtHedgehog then
  3243                 begin
  3252                 begin
  3244                 dmg:= 0;
  3253                 dmg:= 0;
  3245                 tdX:= gi^.X-fX;
  3254                 if hwRound(PointDistance(gi^.X, fX, gi^.Y, fY, true)) < dmgBase then
  3246                 tdY:= gi^.Y-fY;
  3255                     dmg:= dmgBase - max(hwRound(PointDistance(gi^.X, fX, gi^.Y, fY, true)), gi^.Radius);
  3247                 if hwRound(hwAbs(tdX)+hwAbs(tdY)) < dmgBase then
       
  3248                     dmg:= dmgBase - max(hwRound(Distance(tdX, tdY)),gi^.Radius);
       
  3249                 if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi);
  3256                 if (dmg > 1) then dmg:= ModifyDamage(min(dmg div 2, cakeDmg), gi);
  3250                 if (dmg > 1) then
  3257                 if (dmg > 1) then
  3251                     if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then
  3258                     if (CurrentHedgehog^.Gear = gi) and (gi^.Hedgehog^.Effects[heInvulnerable] = 0) then
  3252                         begin
  3259                         begin
  3253                         gi^.State := gi^.State or gstLoser;
  3260                         gi^.State := gi^.State or gstLoser;