hedgewars/uWorld.pas
changeset 2786 85f6425a4d74
parent 2765 8a5685581aeb
child 2803 1f446fc5c8ec
equal deleted inserted replaced
2785:de6406cd6b25 2786:85f6425a4d74
    40 procedure free_uWorld;
    40 procedure free_uWorld;
    41 
    41 
    42 procedure InitWorld;
    42 procedure InitWorld;
    43 procedure DrawWorld(Lag: LongInt);
    43 procedure DrawWorld(Lag: LongInt);
    44 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
    44 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
       
    45 procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
       
    46 procedure HideMission;
    45 
    47 
    46 implementation
    48 implementation
    47 uses	uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
    49 uses	uStore, uMisc, uTeams, uIO, uConsole, uKeys, uLocale, uSound, uAmmos, uVisualGears, uChat, uLandTexture, uLand,
    48 {$IFDEF GLES11}
    50 {$IFDEF GLES11}
    49 	gles11;
    51 	gles11;
    64     FPS: Longword;
    66     FPS: Longword;
    65     CountTicks: Longword;
    67     CountTicks: Longword;
    66     SoundTimerTicks: Longword;
    68     SoundTimerTicks: Longword;
    67     prevPoint: TPoint;
    69     prevPoint: TPoint;
    68 	amSel: TAmmoType = amNothing;
    70 	amSel: TAmmoType = amNothing;
       
    71 	missionTex: PTexture;
       
    72 	missionTimer: LongInt;
    69 
    73 
    70 procedure InitWorld;
    74 procedure InitWorld;
    71 var i, t: LongInt;
    75 var i, t: LongInt;
    72     cp: PClan;
    76     cp: PClan;
    73 begin
    77 begin
       
    78 missionTimer:= 0;
       
    79 
    74 if (GameFlags and gfRandomOrder) <> 0 then  // shuffle them up a bit
    80 if (GameFlags and gfRandomOrder) <> 0 then  // shuffle them up a bit
    75    begin
    81    begin
    76    for i:= 0 to ClansCount * 4 do
    82    for i:= 0 to ClansCount * 4 do
    77       begin
    83       begin
    78       t:= GetRandom(ClansCount);
    84       t:= GetRandom(ClansCount);
   608 DrawChat;
   614 DrawChat;
   609 
   615 
   610 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   616 if fastUntilLag then DrawCentered(0, (cScreenHeight shr 1), SyncTexture);
   611 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   617 if isPaused then DrawCentered(0, (cScreenHeight shr 1), PauseTexture);
   612 
   618 
       
   619 if missionTimer <> 0 then
       
   620 	begin
       
   621 	if missionTimer > 0 then dec(missionTimer, Lag);
       
   622 	if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
       
   623 	if missionTex <> nil then
       
   624 		DrawCentered(0, (cScreenHeight shr 1) + 100, missionTex);
       
   625 	end;
       
   626 
   613 // fps
   627 // fps
   614 {$IFDEF IPHONEOS}
   628 {$IFDEF IPHONEOS}
   615 offset:= 40;
   629 offset:= 40;
   616 {$ELSE}
   630 {$ELSE}
   617 offset:= 10;
   631 offset:= 10;
   776 if WorldDy < wdy then WorldDy:= wdy;
   790 if WorldDy < wdy then WorldDy:= wdy;
   777 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024;
   791 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024;
   778 if WorldDx > 1024 then WorldDx:= 1024;
   792 if WorldDx > 1024 then WorldDx:= 1024;
   779 end;
   793 end;
   780 
   794 
       
   795 procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
       
   796 var r: TSDL_Rect;
       
   797 begin
       
   798 r.w:= 32;
       
   799 r.h:= 32;
       
   800 
       
   801 if time = 0 then time:= 5000;
       
   802 missionTimer:= time;
       
   803 if missionTex <> nil then FreeTexture(missionTex);
       
   804 
       
   805 if icon > -1 then
       
   806 	begin
       
   807 	r.x:= 0;
       
   808 	r.y:= icon * 32;
       
   809 	missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, MissionIcons, @r)
       
   810 	end
       
   811 else
       
   812 	begin
       
   813 	r.x:= ((-icon - 1) shr 5) * 32;
       
   814 	r.y:= ((-icon - 1) mod 32) * 32;
       
   815 	missionTex:= RenderHelpWindow(caption, subcaption, text, '', 0, SpritesData[sprAMAmmos].Surface, @r)
       
   816 	end;
       
   817 end;
       
   818 
       
   819 procedure HideMission;
       
   820 begin
       
   821 missionTimer:= 0
       
   822 end;
       
   823 
   781 procedure init_uWorld;
   824 procedure init_uWorld;
   782 begin
   825 begin
   783 	fpsTexture:= nil;
   826 	fpsTexture:= nil;
   784 	FollowGear:= nil;
   827 	FollowGear:= nil;
   785 	WindBarWidth:= 0;
   828 	WindBarWidth:= 0;
   793 	FPS:= 0;
   836 	FPS:= 0;
   794 	CountTicks:= 0;
   837 	CountTicks:= 0;
   795 	SoundTimerTicks:= 0;
   838 	SoundTimerTicks:= 0;
   796 	prevPoint.X:= 0;
   839 	prevPoint.X:= 0;
   797 	prevPoint.Y:= 0;
   840 	prevPoint.Y:= 0;
       
   841 	missionTimer:= 0;
   798 	
   842 	
   799 	FillChar(Captions, sizeof(Captions), 0)
   843 	FillChar(Captions, sizeof(Captions), 0)
   800 end;
   844 end;
   801 
   845 
   802 procedure free_uWorld;
   846 procedure free_uWorld;
   803 begin
   847 begin
   804 
   848 if missionTex <> nil then FreeTexture(missionTex);
   805 end;
   849 end;
   806 
   850 
   807 end.
   851 end.