hedgewars/uGears.pas
changeset 3480 c4c3f3512404
parent 3476 1ec68b8d3bd1
child 3483 54ff8cbabaa6
equal deleted inserted replaced
3479:972ae3ec178a 3480:c4c3f3512404
    58             IntersectGear: PGear;
    58             IntersectGear: PGear;
    59             FlightTime: Longword;
    59             FlightTime: Longword;
    60             uid: Longword;
    60             uid: Longword;
    61             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
    61             ImpactSound: TSound; // first sound, others have to be after it in the sounds def.
    62             nImpactSounds: Word; // count of ImpactSounds
    62             nImpactSounds: Word; // count of ImpactSounds
    63             SoundChannel: LongInt
    63             SoundChannel: LongInt;
       
    64             PortalCounter: LongWord  // Hopefully temporary, but avoids infinite portal loops in a guaranteed fashion.
    64         end;
    65         end;
    65 
    66 
    66 var AllInactive: boolean;
    67 var AllInactive: boolean;
    67     PrvInactive: boolean;
    68     PrvInactive: boolean;
    68     CurAmmoGear: PGear;
    69     CurAmmoGear: PGear;
   827 
   828 
   828 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
   829 //Purpose, to reset all transient attributes toggled by a utility and clean up various gears and effects at end of turn
   829 //If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here.
   830 //If any of these are set as permanent toggles in the frontend, that needs to be checked and skipped here.
   830 procedure EndTurnCleanup;
   831 procedure EndTurnCleanup;
   831 var  i: LongInt;
   832 var  i: LongInt;
       
   833      t: PGear;
   832 begin
   834 begin
   833     SpeechText:= ''; // in case it has not been consumed
   835     SpeechText:= ''; // in case it has not been consumed
   834 
   836 
   835     if (GameFlags and gfLowGravity) = 0 then
   837     if (GameFlags and gfLowGravity) = 0 then
   836         cGravity:= cMaxWindSpeed * 2;
   838         cGravity:= cMaxWindSpeed * 2;
   843     if (GameFlags and gfLaserSight) = 0 then
   845     if (GameFlags and gfLaserSight) = 0 then
   844         cLaserSighting:= false;
   846         cLaserSighting:= false;
   845 
   847 
   846     if (GameFlags and gfArtillery) = 0 then
   848     if (GameFlags and gfArtillery) = 0 then
   847         cArtillery:= false;
   849         cArtillery:= false;
   848 
       
   849     // have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
   850     // have to sweep *all* current team hedgehogs since it is theoretically possible if you have enough invulnerabilities and switch turns to make your entire team invulnerable
   850     if (CurrentTeam <> nil) then
   851     if (CurrentTeam <> nil) then
   851        with CurrentTeam^ do
   852        with CurrentTeam^ do
   852           for i:= 0 to cMaxHHIndex do
   853           for i:= 0 to cMaxHHIndex do
   853               with Hedgehogs[i] do
   854               with Hedgehogs[i] do
   860 
   861 
   861                   if (Gear <> nil) then
   862                   if (Gear <> nil) then
   862                      if (GameFlags and gfInvulnerable) = 0 then
   863                      if (GameFlags and gfInvulnerable) = 0 then
   863                         Gear^.Invulnerable:= false;
   864                         Gear^.Invulnerable:= false;
   864                   end;
   865                   end;
       
   866     t:= GearsList;
       
   867     while t <> nil do
       
   868         begin
       
   869         t^.PortalCounter:= 0;
       
   870         t:= t^.NextGear
       
   871         end
   865 end;
   872 end;
   866 
   873 
   867 procedure ApplyDamage(Gear: PGear; Damage: Longword);
   874 procedure ApplyDamage(Gear: PGear; Damage: Longword);
   868 var s: shortstring;
   875 var s: shortstring;
   869     vampDmg, tmpDmg, i: Longword;
   876     vampDmg, tmpDmg, i: Longword;