hedgewars/uTeams.pas
branchcmake_pascal
changeset 8817 0d3014097240
parent 8681 d0fc1dca739c
child 9224 bce8cf41d666
equal deleted inserted replaced
8815:c28fcd8ec138 8817:0d3014097240
    18 
    18 
    19 {$INCLUDE "options.inc"}
    19 {$INCLUDE "options.inc"}
    20 
    20 
    21 unit uTeams;
    21 unit uTeams;
    22 interface
    22 interface
    23 uses uConsts, uInputHandler, uGears, uRandom, uFloat, uStats, uVisualGears, uCollisions, GLunit,
    23 uses uConsts, uInputHandler, uRandom, uFloat, uStats, uVisualGears,
    24      uSound, uStore, uTypes
    24      uCollisions, GLunit, uSound, uStore, uTypes, uScript
    25      {$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
    25      {$IFDEF USE_TOUCH_INTERFACE}, uWorld{$ENDIF};
    26 
    26 
    27 
    27 
    28 procedure initModule;
    28 procedure initModule;
    29 procedure freeModule;
    29 procedure freeModule;
    32 procedure SwitchHedgehog;
    32 procedure SwitchHedgehog;
    33 procedure AfterSwitchHedgehog;
    33 procedure AfterSwitchHedgehog;
    34 procedure InitTeams;
    34 procedure InitTeams;
    35 function  TeamSize(p: PTeam): Longword;
    35 function  TeamSize(p: PTeam): Longword;
    36 procedure RecountTeamHealth(team: PTeam);
    36 procedure RecountTeamHealth(team: PTeam);
       
    37 procedure RestoreHog(HH: PHedgehog);
       
    38 
    37 procedure RestoreTeamsFromSave;
    39 procedure RestoreTeamsFromSave;
    38 function  CheckForWin: boolean;
    40 function  CheckForWin: boolean;
    39 procedure TeamGoneEffect(var Team: TTeam);
    41 procedure TeamGoneEffect(var Team: TTeam);
    40 procedure SwitchCurrentHedgehog(newHog: PHedgehog);
    42 procedure SwitchCurrentHedgehog(newHog: PHedgehog);
    41 
    43 
   480 RecountClanHealth(team^.Clan);
   482 RecountClanHealth(team^.Clan);
   481 
   483 
   482 AddVisualGear(0, 0, vgtTeamHealthSorter)
   484 AddVisualGear(0, 0, vgtTeamHealthSorter)
   483 end;
   485 end;
   484 
   486 
       
   487 procedure RestoreHog(HH: PHedgehog);
       
   488 begin
       
   489     HH^.Gear:=HH^.GearHidden;
       
   490     HH^.GearHidden:= nil;
       
   491     InsertGearToList(HH^.Gear);
       
   492     HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
       
   493     AddGearCI(HH^.Gear);
       
   494     HH^.Gear^.Active:= true;
       
   495     ScriptCall('onHogRestore', HH^.Gear^.Uid)
       
   496 end;
       
   497 
   485 procedure RestoreTeamsFromSave;
   498 procedure RestoreTeamsFromSave;
   486 var t: LongInt;
   499 var t: LongInt;
   487 begin
   500 begin
   488 for t:= 0 to Pred(TeamsCount) do
   501 for t:= 0 to Pred(TeamsCount) do
   489    TeamsArray[t]^.ExtDriven:= false
   502    TeamsArray[t]^.ExtDriven:= false