hedgewars/uTeams.pas
changeset 2376 ece7b87f1334
parent 2289 cb850ba733bd
child 2431 23242609c44b
equal deleted inserted replaced
2375:99f05a01a6a3 2376:ece7b87f1334
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    16  * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA
    17  *)
    17  *)
    18 
    18 
    19 unit uTeams;
    19 unit uTeams;
    20 interface
    20 interface
    21 uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears, 
    21 uses SDLh, uConsts, uKeys, uGears, uRandom, uFloat, uStats, uVisualGears,
    22 {$IFDEF GLES11}
    22 {$IFDEF GLES11}
    23 	gles11,
    23 	gles11,
    24 {$ELSE}
    24 {$ELSE}
    25 	GL,
    25 	GL,
    26 {$ENDIF}
    26 {$ENDIF}
    31 	THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
    31 	THHAmmo = array[0..cMaxSlotIndex, 0..cMaxSlotAmmoIndex] of TAmmo;
    32 
    32 
    33 	PHedgehog = ^THedgehog;
    33 	PHedgehog = ^THedgehog;
    34 	PTeam     = ^TTeam;
    34 	PTeam     = ^TTeam;
    35 	PClan     = ^TClan;
    35 	PClan     = ^TClan;
    36 	
    36 
    37 	THedgehog = record
    37 	THedgehog = record
    38 			Name: string[MAXNAMELEN];
    38 			Name: string[MAXNAMELEN];
    39 			Gear: PGear;
    39 			Gear: PGear;
    40 			SpeechGear: PVisualGear;
    40 			SpeechGear: PVisualGear;
    41 			NameTagTex,
    41 			NameTagTex,
    50 			BotLevel  : LongWord; // 0 - Human player
    50 			BotLevel  : LongWord; // 0 - Human player
    51 			HatVisibility: GLfloat;
    51 			HatVisibility: GLfloat;
    52 			stats: TStatistics;
    52 			stats: TStatistics;
    53 			Hat: String;
    53 			Hat: String;
    54 			end;
    54 			end;
    55 			
    55 
    56 	TTeam = record
    56 	TTeam = record
    57 			Clan: PClan;
    57 			Clan: PClan;
    58 			TeamName: string[MAXNAMELEN];
    58 			TeamName: string[MAXNAMELEN];
    59 			ExtDriven: boolean;
    59 			ExtDriven: boolean;
    60 			Binds: TBinds;
    60 			Binds: TBinds;
    73 			AttackBar: LongWord;
    73 			AttackBar: LongWord;
    74 			HedgehogsNumber: Longword;
    74 			HedgehogsNumber: Longword;
    75 			hasGone: boolean;
    75 			hasGone: boolean;
    76 			voicepack: PVoicepack;
    76 			voicepack: PVoicepack;
    77 			end;
    77 			end;
    78 			
    78 
    79 	TClan = record
    79 	TClan = record
    80 			Color: Longword;
    80 			Color: Longword;
    81 			Teams: array[0..Pred(cMaxTeams)] of PTeam;
    81 			Teams: array[0..Pred(cMaxTeams)] of PTeam;
    82 			TeamsNumber: Longword;
    82 			TeamsNumber: Longword;
    83 			CurrTeam: LongWord;
    83 			CurrTeam: LongWord;
   148 			with Teams[j]^ do
   148 			with Teams[j]^ do
   149 				for i:= 0 to cMaxHHIndex do
   149 				for i:= 0 to cMaxHHIndex do
   150 					with Hedgehogs[i] do
   150 					with Hedgehogs[i] do
   151 						if (Gear <> nil) then
   151 						if (Gear <> nil) then
   152 							Gear^.State:= gstWinner;
   152 							Gear^.State:= gstWinner;
   153 		
   153 
   154 		AddCaption(s, $FFFFFF, capgrpGameState);
   154 		AddCaption(s, $FFFFFF, capgrpGameState);
   155 		SendStat(siGameResult, s);
   155 		SendStat(siGameResult, s);
   156 		AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   156 		AddGear(0, 0, gtATFinishGame, 0, _0, _0, 3000)
   157 		end;
   157 		end;
   158 SendStats
   158 SendStats
   293 TeamsCount:= 0
   293 TeamsCount:= 0
   294 end;
   294 end;
   295 
   295 
   296 procedure RecountAllTeamsHealth;
   296 procedure RecountAllTeamsHealth;
   297 var t: LongInt;
   297 var t: LongInt;
   298 begin 
   298 begin
   299 for t:= 0 to Pred(TeamsCount) do
   299 for t:= 0 to Pred(TeamsCount) do
   300     RecountTeamHealth(TeamsArray[t])
   300     RecountTeamHealth(TeamsArray[t])
   301 end;
   301 end;
   302 
   302 
   303 procedure InitTeams;
   303 procedure InitTeams;
   342 var i: LongInt;
   342 var i: LongInt;
   343 begin
   343 begin
   344 with team^ do
   344 with team^ do
   345 	begin
   345 	begin
   346 	NewTeamHealthBarWidth:= 0;
   346 	NewTeamHealthBarWidth:= 0;
   347 	
   347 
   348 	if not hasGone then
   348 	if not hasGone then
   349 		for i:= 0 to cMaxHHIndex do
   349 		for i:= 0 to cMaxHHIndex do
   350 			if Hedgehogs[i].Gear <> nil then
   350 			if Hedgehogs[i].Gear <> nil then
   351 				inc(NewTeamHealthBarWidth, Hedgehogs[i].Gear^.Health);
   351 				inc(NewTeamHealthBarWidth, Hedgehogs[i].Gear^.Health);
   352 
   352 
   382 with TeamsArray[t]^ do
   382 with TeamsArray[t]^ do
   383 	begin
   383 	begin
   384 	AddChatString('** '+ TeamName + ' is gone');
   384 	AddChatString('** '+ TeamName + ' is gone');
   385 	hasGone:= true
   385 	hasGone:= true
   386 	end;
   386 	end;
   387 	
   387 
   388 RecountTeamHealth(TeamsArray[t])
   388 RecountTeamHealth(TeamsArray[t])
   389 end;
   389 end;
   390 
   390 
   391 procedure TeamGoneEffect(var Team: TTeam);
   391 procedure TeamGoneEffect(var Team: TTeam);
   392 var i: LongInt;
   392 var i: LongInt;