hedgewars/uTeams.pas
changeset 3379 f73e0e8e55c2
parent 3355 dc9e61e67484
child 3381 f8800c44b3de
equal deleted inserted replaced
3378:4f2185ed8ca8 3379:f73e0e8e55c2
    78             PlayerHash: shortstring;   // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
    78             PlayerHash: shortstring;   // md5 hash of player name. For temporary enabling of hats as thank you. Hashed for privacy of players
    79             end;
    79             end;
    80 
    80 
    81     TClan = record
    81     TClan = record
    82             Color: Longword;
    82             Color: Longword;
       
    83             RColor: Longword; // color with reversed byte order
    83             Teams: array[0..Pred(cMaxTeams)] of PTeam;
    84             Teams: array[0..Pred(cMaxTeams)] of PTeam;
    84             TeamsNumber: Longword;
    85             TeamsNumber: Longword;
    85             CurrTeam: LongWord;
    86             CurrTeam: LongWord;
    86             ClanHealth: LongInt;
    87             ClanHealth: LongInt;
    87             ClanIndex: LongInt;
    88             ClanIndex: LongInt;
   109 procedure RecountTeamHealth(team: PTeam);
   110 procedure RecountTeamHealth(team: PTeam);
   110 procedure RestoreTeamsFromSave;
   111 procedure RestoreTeamsFromSave;
   111 function  CheckForWin: boolean;
   112 function  CheckForWin: boolean;
   112 procedure TeamGone(s: shortstring);
   113 procedure TeamGone(s: shortstring);
   113 procedure TeamGoneEffect(var Team: TTeam);
   114 procedure TeamGoneEffect(var Team: TTeam);
       
   115 function GetTeamStatString(p: PTeam): shortstring;
   114 
   116 
   115 implementation
   117 implementation
   116 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat;
   118 uses uMisc, uWorld, uAI, uLocale, uConsole, uAmmos, uChat;
   117 const MaxTeamHealth: LongInt = 0;
   119 const MaxTeamHealth: LongInt = 0;
   118 
   120 
   310    ClansArray[ClansCount]:= team^.Clan;
   312    ClansArray[ClansCount]:= team^.Clan;
   311    inc(ClansCount);
   313    inc(ClansCount);
   312    with team^.Clan^ do
   314    with team^.Clan^ do
   313         begin
   315         begin
   314         ClanIndex:= Pred(ClansCount);
   316         ClanIndex:= Pred(ClansCount);
   315         Color:= TeamColor
   317         Color:= TeamColor;
       
   318         RColor:= $FF000000 or ((Color shr 16) and $FF) or ((Color shl 16) and $00FF0000) or (Color and $0000FF00)
   316         end
   319         end
   317    end else
   320    end else
   318    begin
   321    begin
   319    team^.Clan:= ClansArray[c];
   322    team^.Clan:= ClansArray[c];
   320    end;
   323    end;
   456                 Gear^.Invulnerable:= false;
   459                 Gear^.Invulnerable:= false;
   457                 Gear^.Damage:= Gear^.Health
   460                 Gear^.Damage:= Gear^.Health
   458                 end
   461                 end
   459 end;
   462 end;
   460 
   463 
       
   464 function GetTeamStatString(p: PTeam): shortstring;
       
   465 var s: ansistring;
       
   466 begin
       
   467     s:= p^.TeamName + ':' + inttostr(p^.TeamHealth) + ':';
       
   468     GetTeamStatString:= s;
       
   469 end;
       
   470 
   461 procedure initModule;
   471 procedure initModule;
   462 begin
   472 begin
   463     CurrentTeam:= nil;
   473     CurrentTeam:= nil;
   464     PreviousTeam:= nil;
   474     PreviousTeam:= nil;
   465     CurrentHedgehog:= nil;
   475     CurrentHedgehog:= nil;