hedgewars/uWorld.pas
changeset 2716 b9ca1bfca24f
parent 2713 71250942e95b
child 2724 601158aaa201
equal deleted inserted replaced
2715:0e4e0db79e2a 2716:b9ca1bfca24f
    20 
    20 
    21 unit uWorld;
    21 unit uWorld;
    22 interface
    22 interface
    23 uses SDLh, uGears, uConsts, uFloat, uRandom;
    23 uses SDLh, uGears, uConsts, uFloat, uRandom;
    24 
    24 
    25 const WorldDx: LongInt = -512;
    25 
    26       WorldDy: LongInt = -256;
       
    27 
       
    28 procedure init_uWorld;
       
    29 procedure InitWorld;
       
    30 procedure DrawWorld(Lag: LongInt);
       
    31 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
       
    32 
       
    33 {$IFDEF COUNTTICKS}
       
    34 var cntTicks: LongWord;
       
    35 {$ENDIF}
       
    36 var FollowGear: PGear;
    26 var FollowGear: PGear;
    37     WindBarWidth: LongInt;
    27     WindBarWidth: LongInt;
    38     bShowAmmoMenu: boolean;
    28     bShowAmmoMenu: boolean;
    39     bSelected: boolean;
    29     bSelected: boolean;
    40     bShowFinger: boolean;
    30     bShowFinger: boolean;
    41     Frames: Longword;
    31     Frames: Longword;
    42     WaterColor, DeepWaterColor: TSDL_Color;
    32     WaterColor, DeepWaterColor: TSDL_Color;
       
    33     WorldDx: LongInt;
       
    34     WorldDy: LongInt;
       
    35 {$IFDEF COUNTTICKS}
       
    36     cntTicks: LongWord;
       
    37 {$ENDIF}
       
    38 
       
    39 procedure init_uWorld;
       
    40 procedure free_uWorld;
       
    41 
       
    42 procedure InitWorld;
       
    43 procedure DrawWorld(Lag: LongInt);
       
    44 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
    43 
    45 
    44 implementation
    46 implementation
    45 uses	uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
    47 uses	uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
    46 {$IFDEF GLES11}
    48 {$IFDEF GLES11}
    47 	gles11;
    49 	gles11;
    48 {$ELSE}
    50 {$ELSE}
    49 	GL;
    51 	GL;
    50 {$ENDIF}
    52 {$ENDIF}
    51 
    53 
    52 const FPS: Longword = 0;
       
    53       CountTicks: Longword = 0;
       
    54       SoundTimerTicks: Longword = 0;
       
    55       prevPoint: TPoint = (X: 0; Y: 0);
       
    56 
       
    57 type TCaptionStr = record
    54 type TCaptionStr = record
    58                    Tex: PTexture;
    55                    Tex: PTexture;
    59                    EndTime: LongWord;
    56                    EndTime: LongWord;
    60                    end;
    57                    end;
    61 
    58 
    62 var cWaveWidth, cWaveHeight: LongInt;
    59 var cWaveWidth, cWaveHeight: LongInt;
    63     Captions: array[TCapGroup] of TCaptionStr;
    60     Captions: array[TCapGroup] of TCaptionStr;
    64     AMxShift, SlotsNum: LongInt;
    61     AMxShift, SlotsNum: LongInt;
    65     tmpSurface: PSDL_Surface;
    62     tmpSurface: PSDL_Surface;
    66     fpsTexture: PTexture;
    63     fpsTexture: PTexture;
       
    64     FPS: Longword;
       
    65     CountTicks: Longword;
       
    66     SoundTimerTicks: Longword;
       
    67     prevPoint: TPoint;
    67 
    68 
    68 procedure InitWorld;
    69 procedure InitWorld;
    69 var i, t: LongInt;
    70 var i, t: LongInt;
    70     cp: PClan;
    71     cp: PClan;
    71 begin
    72 begin
   503 i:= 53;
   504 i:= 53;
   504 {$ELSE}
   505 {$ELSE}
   505 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then i:= 48 else i:= 8;
   506 if ((TrainingFlags and tfTimeTrial) <> 0) and (TimeTrialStartTime > 0) then i:= 48 else i:= 8;
   506 {$ENDIF}
   507 {$ENDIF}
   507 
   508 
   508 for grp:= Low(TCapGroup) to High(TCapGroup) do
   509 	for grp:= Low(TCapGroup) to High(TCapGroup) do
   509     with Captions[grp] do
   510 		with Captions[grp] do
   510          if Tex <> nil then
   511 			if Tex <> nil then
   511             begin
   512 			begin
   512             DrawCentered(0, i, Tex);
   513 				DrawCentered(0, i, Tex);
   513             inc(i, Tex^.h + 2);
   514 				inc(i, Tex^.h + 2);
   514             if EndTime <= RealTicks then
   515 				if EndTime <= RealTicks then
   515                begin
   516 				begin
   516                FreeTexture(Tex);
   517 					FreeTexture(Tex);
   517                Tex:= nil;
   518 					Tex:= nil;
   518                EndTime:= 0
   519 					EndTime:= 0
   519                end
   520 				end;
   520             end;
   521 			end;
   521 
   522 
   522 // Teams Healths
   523 // Teams Healths
   523 for t:= 0 to Pred(TeamsCount) do
   524 for t:= 0 to Pred(TeamsCount) do
   524    with TeamsArray[t]^ do
   525    with TeamsArray[t]^ do
   525       begin
   526       begin
   751 	WindBarWidth:= 0;
   752 	WindBarWidth:= 0;
   752 	bShowAmmoMenu:= false;
   753 	bShowAmmoMenu:= false;
   753 	bSelected:= false;
   754 	bSelected:= false;
   754 	bShowFinger:= false;
   755 	bShowFinger:= false;
   755 	Frames:= 0;
   756 	Frames:= 0;
       
   757 	WorldDx:= -512;
       
   758 	WorldDy:= -256;
       
   759     
       
   760 	FPS:= 0;
       
   761 	CountTicks:= 0;
       
   762 	SoundTimerTicks:= 0;
       
   763 	prevPoint.X:= 0;
       
   764 	prevPoint.Y:= 0;
   756 	
   765 	
   757 	FillChar(Captions, sizeof(Captions), 0)
   766 	FillChar(Captions, sizeof(Captions), 0)
   758 end;
   767 end;
   759 
   768 
       
   769 procedure free_uWorld;
       
   770 begin
       
   771 
       
   772 end;
       
   773 
   760 end.
   774 end.