hedgewars/uTeams.pas
branchwebgl
changeset 9236 ddd675825672
parent 9160 fc46e75f6b72
parent 9224 bce8cf41d666
child 9521 8054d9d775fd
equal deleted inserted replaced
9201:bcf2f7798ebb 9236:ddd675825672
    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 
   494 RecountClanHealth(team^.Clan);
   496 RecountClanHealth(team^.Clan);
   495 
   497 
   496 AddVisualGear(0, 0, vgtTeamHealthSorter)
   498 AddVisualGear(0, 0, vgtTeamHealthSorter)
   497 end;
   499 end;
   498 
   500 
       
   501 procedure RestoreHog(HH: PHedgehog);
       
   502 begin
       
   503     HH^.Gear:=HH^.GearHidden;
       
   504     HH^.GearHidden:= nil;
       
   505     InsertGearToList(HH^.Gear);
       
   506     HH^.Gear^.State:= (HH^.Gear^.State and (not (gstHHDriven or gstInvisible or gstAttacking))) or gstAttacked;
       
   507     AddGearCI(HH^.Gear);
       
   508     HH^.Gear^.Active:= true;
       
   509     ScriptCall('onHogRestore', HH^.Gear^.Uid)
       
   510 end;
       
   511 
   499 procedure RestoreTeamsFromSave;
   512 procedure RestoreTeamsFromSave;
   500 var t: LongInt;
   513 var t: LongInt;
   501 begin
   514 begin
   502 for t:= 0 to Pred(TeamsCount) do
   515 for t:= 0 to Pred(TeamsCount) do
   503    TeamsArray[t]^.ExtDriven:= false
   516    TeamsArray[t]^.ExtDriven:= false