hedgewars/uGearsHandlersMess.pas
changeset 12169 869cf5f34700
parent 12120 1aae30470fa3
child 12171 115867d77982
equal deleted inserted replaced
12168:666e18b1ca32 12169:869cf5f34700
   145 
   145 
   146 implementation
   146 implementation
   147 uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound
   147 uses uConsts, uVariables, uVisualGearsList, uRandom, uCollisions, uGearsList, uUtils, uSound
   148     , SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics
   148     , SDLh, uScript, uGearsHedgehog, uGearsUtils, uIO, uCaptions, uLandGraphics
   149     , uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture, uCommands
   149     , uGearsHandlers, uTextures, uRenderUtils, uAmmos, uTeams, uLandTexture, uCommands
   150     , uStore, uAI, uStats;
   150     , uStore, uAI, uStats, uLocale;
   151 
   151 
   152 procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean);
   152 procedure doStepPerPixel(Gear: PGear; step: TGearStepProcedure; onlyCheckIfChanged: boolean);
   153 var
   153 var
   154     dX, dY, sX, sY: hwFloat;
   154     dX, dY, sX, sY: hwFloat;
   155     i, steps: LongWord;
   155     i, steps: LongWord;
  1750                     Gear^.State := Gear^.State or gstAttacking
  1750                     Gear^.State := Gear^.State or gstAttacking
  1751             end
  1751             end
  1752         else // gstAttacking <> 0
  1752         else // gstAttacking <> 0
  1753             begin
  1753             begin
  1754             AllInactive := false;
  1754             AllInactive := false;
  1755             // tag of 1 means this mine has a random timer
       
  1756             if (Gear^.Tag = 1) and (Gear^.Timer = 0) then
       
  1757                 begin
       
  1758                 if (GameTicks mod 2 = 0) then GetRandom(2);
       
  1759                 if (GameTicks mod 3 = 0) then GetRandom(2);
       
  1760                 Gear^.Timer:= GetRandom(51) * 100;
       
  1761                 Gear^.Tag:= 0;
       
  1762                 end;
       
  1763             if (Gear^.Timer and $FF) = 0 then
  1755             if (Gear^.Timer and $FF) = 0 then
  1764                 PlaySound(sndMineTick);
  1756                 PlaySound(sndMineTick);
  1765             if Gear^.Timer = 0 then
  1757             if Gear^.Timer = 0 then
  1766                 begin
  1758                 begin
  1767                 if ((Gear^.State and gstWait) <> 0)
  1759                 if ((Gear^.State and gstWait) <> 0)
  3038 var
  3030 var
  3039     i: LongWord;
  3031     i: LongWord;
  3040     HHGear: PGear;
  3032     HHGear: PGear;
  3041     sparkles: PVisualGear;
  3033     sparkles: PVisualGear;
  3042     hasWishes: boolean;
  3034     hasWishes: boolean;
       
  3035     s: ansistring;
  3043 begin
  3036 begin
  3044     AllInactive := false;
  3037     AllInactive := false;
  3045     hasWishes:= ((Gear^.Message and (gmPrecise or gmSwitch)) = (gmPrecise or gmSwitch));
  3038     hasWishes:= ((Gear^.Message and (gmPrecise or gmSwitch)) = (gmPrecise or gmSwitch));
  3046     if hasWishes then
  3039     if hasWishes then
  3047         Gear^.AdvBounce:= 1;
  3040         Gear^.AdvBounce:= 1;
  3135                         if random(2) = 0 then
  3128                         if random(2) = 0 then
  3136                             dy := -dy;
  3129                             dy := -dy;
  3137                         FrameTicks:= random(400) + 250
  3130                         FrameTicks:= random(400) + 250
  3138                         end
  3131                         end
  3139                 end;
  3132                 end;
       
  3133         s:= ansistring(Gear^.Hedgehog^.Name);
       
  3134         AddCaption(FormatA(GetEventString(eidKamikaze), s), cWhiteColor, capgrpMessage);
  3140         AfterAttack;
  3135         AfterAttack;
  3141         HHGear^.Message:= HHGear^.Message or gmDestroy;
  3136         HHGear^.Message:= HHGear^.Message or gmDestroy;
  3142         DeleteGear(Gear);
  3137         DeleteGear(Gear);
  3143     end
  3138     end
  3144     else
  3139     else
  5438 var
  5433 var
  5439     graves: PGearArrayS;
  5434     graves: PGearArrayS;
  5440     resgear: PGear;
  5435     resgear: PGear;
  5441     hh: PHedgehog;
  5436     hh: PHedgehog;
  5442     i: LongInt;
  5437     i: LongInt;
       
  5438     s: ansistring;
  5443 begin
  5439 begin
  5444     if (TurnTimeLeft > 0) then
  5440     if (TurnTimeLeft > 0) then
  5445         dec(TurnTimeLeft);
  5441         dec(TurnTimeLeft);
  5446 
  5442 
  5447     AllInactive := false;
  5443     AllInactive := false;
  5509                 graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy;
  5505                 graves.ar^[i]^.Message:= graves.ar^[i]^.Message or gmDestroy;
  5510                 graves.ar^[i]^.Active:= true;
  5506                 graves.ar^[i]^.Active:= true;
  5511                 RenderHealth(resgear^.Hedgehog^);
  5507                 RenderHealth(resgear^.Hedgehog^);
  5512                 RecountTeamHealth(resgear^.Hedgehog^.Team);
  5508                 RecountTeamHealth(resgear^.Hedgehog^.Team);
  5513                 resgear^.Hedgehog^.Effects[heResurrected]:= 1;
  5509                 resgear^.Hedgehog^.Effects[heResurrected]:= 1;
       
  5510                 s:= ansistring(resgear^.Hedgehog^.Name);
       
  5511                 AddCaption(FormatA(GetEventString(eidResurrected), s), cWhiteColor, capgrpMessage);
  5514                 // only make hat-less hedgehogs look like zombies, preserve existing hats
  5512                 // only make hat-less hedgehogs look like zombies, preserve existing hats
  5515 
  5513 
  5516                 if resgear^.Hedgehog^.Hat = 'NoHat' then
  5514                 if resgear^.Hedgehog^.Hat = 'NoHat' then
  5517                     LoadHedgehogHat(resgear^.Hedgehog^, 'Reserved/Zombie');
  5515                     LoadHedgehogHat(resgear^.Hedgehog^, 'Reserved/Zombie');
  5518                 end;
  5516                 end;
  5712 *)
  5710 *)
  5713 
  5711 
  5714 procedure doStepTardisWarp(Gear: PGear);
  5712 procedure doStepTardisWarp(Gear: PGear);
  5715 var HH: PHedgehog;
  5713 var HH: PHedgehog;
  5716     i,j,cnt: LongWord;
  5714     i,j,cnt: LongWord;
       
  5715     s: ansistring;
  5717 begin
  5716 begin
  5718 HH:= Gear^.Hedgehog;
  5717 HH:= Gear^.Hedgehog;
  5719 if Gear^.Pos = 2 then
  5718 if Gear^.Pos = 2 then
  5720     begin
  5719     begin
  5721     StopSoundChan(Gear^.SoundChannel);
  5720     StopSoundChan(Gear^.SoundChannel);
  5729             ((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
  5728             ((Gear^.State and (gstMoving or gstHHDeath or gstHHGone)) = 0) then
  5730                 HideHog(HH)
  5729                 HideHog(HH)
  5731             end
  5730             end
  5732         //else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then
  5731         //else if (HH^.Gear <> nil) and (HH^.Gear^.State and gstInvisible <> 0) then
  5733         else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then
  5732         else if (HH^.GearHidden <> nil) then// and (HH^.Gear^.State and gstInvisible <> 0) then
  5734             RestoreHog(HH)
  5733             begin
       
  5734             RestoreHog(HH);
       
  5735             s:= ansistring(HH^.Name);
       
  5736             AddCaption(FormatA(GetEventString(eidTimeTravelEnd), s), cWhiteColor, capgrpMessage)
       
  5737             end
  5735         end;
  5738         end;
  5736 
  5739 
  5737     inc(Gear^.Timer);
  5740     inc(Gear^.Timer);
  5738     if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then
  5741     if (Gear^.Timer > 2000) and ((GameTicks mod 2000) = 1000) then
  5739         begin
  5742         begin