hedgewars/uWorld.pas
changeset 2905 f3c79f7193a9
parent 2904 209a0c573917
child 2908 bd1909984a09
equal deleted inserted replaced
2904:209a0c573917 2905:f3c79f7193a9
    39 procedure init_uWorld;
    39 procedure init_uWorld;
    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: shortstring; Color: Longword; Group: TCapGroup);
    45 procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
    45 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
    46 procedure HideMission;
    46 procedure HideMission;
    47 
    47 
    48 implementation
    48 implementation
    49 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,
    50 {$IFDEF GLES11}
    50 {$IFDEF GLES11}
    77     cp: PClan;
    77     cp: PClan;
    78     g: ansistring;
    78     g: ansistring;
    79 
    79 
    80     // helper functions to create the goal/game mode string
    80     // helper functions to create the goal/game mode string
    81     function AddGoal(s: ansistring; gf: LongInt; si: TGoalStrId; i: LongInt): ansistring;
    81     function AddGoal(s: ansistring; gf: LongInt; si: TGoalStrId; i: LongInt): ansistring;
    82     var t: string;
    82     var t: ansistring;
    83     begin
    83     begin
    84         if (GameFlags and gf) <> 0 then
    84         if (GameFlags and gf) <> 0 then
    85             begin
    85             begin
    86             t:= inttostr(i);
    86             t:= inttostr(i);
    87             s:= s + format(trgoal[si], t) + '|'
    87             s:= s + format(trgoal[si], t) + '|'
   127 g:= AddGoal(g, gfKing, gidKing); // king?
   127 g:= AddGoal(g, gfKing, gidKing); // king?
   128 g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement?
   128 g:= AddGoal(g, gfPlaceHog, gidPlaceHog); // placement?
   129 g:= AddGoal(g, gfArtillery, gidArtillery); // artillery?
   129 g:= AddGoal(g, gfArtillery, gidArtillery); // artillery?
   130 g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land?
   130 g:= AddGoal(g, gfSolidLand, gidSolidLand); // solid land?
   131 g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo?
   131 g:= AddGoal(g, gfSharedAmmo, gidSharedAmmo); // shared ammo?
   132 if cMinesTime <> 3000 then g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000); // changed mine timer?
   132 if cMinesTime <> 3000 then // changed mine timer?
       
   133 	begin
       
   134 	if cMinesTime = 0 then
       
   135 		g:= AddGoal(g, gfMines, gidNoMineTimer)
       
   136 	else if cMinesTime < 0 then
       
   137 		g:= AddGoal(g, gfMines, gidRandomMineTimer)
       
   138 	else
       
   139 		g:= AddGoal(g, gfMines, gidMineTimer, cMinesTime div 1000);
       
   140 	end;
   133 // if the string has been set, show it for (default timeframe) seconds
   141 // if the string has been set, show it for (default timeframe) seconds
   134 if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0);
   142 if g <> '' then ShowMission(trgoal[gidCaption], trgoal[gidSubCaption], g, 1, 0);
   135 
   143 
   136 cWaveWidth:= SpritesData[sprWater].Width;
   144 cWaveWidth:= SpritesData[sprWater].Width;
   137 //cWaveHeight:= SpritesData[sprWater].Height;
   145 //cWaveHeight:= SpritesData[sprWater].Height;
   678 if missionTimer <> 0 then
   686 if missionTimer <> 0 then
   679 	begin
   687 	begin
   680 	if missionTimer > 0 then dec(missionTimer, Lag);
   688 	if missionTimer > 0 then dec(missionTimer, Lag);
   681 	if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   689 	if missionTimer < 0 then missionTimer:= 0; // avoid subtracting below 0
   682 	if missionTex <> nil then
   690 	if missionTex <> nil then
   683 		DrawCentered(0, (cScreenHeight shr 1) + 100, missionTex);
   691 		DrawCentered(0, min((cScreenHeight shr 1) + 100, cScreenHeight - 48 - missionTex^.h), missionTex);
   684 	end;
   692 	end;
   685 
   693 
   686 // fps
   694 // fps
   687 {$IFDEF IPHONEOS}
   695 {$IFDEF IPHONEOS}
   688 offset:= 300;
   696 offset:= 300;
   768 
   776 
   769 glDisable(GL_TEXTURE_2D);
   777 glDisable(GL_TEXTURE_2D);
   770 glDisable(GL_BLEND)
   778 glDisable(GL_BLEND)
   771 end;
   779 end;
   772 
   780 
   773 procedure AddCaption(s: string; Color: Longword; Group: TCapGroup);
   781 procedure AddCaption(s: shortstring; Color: Longword; Group: TCapGroup);
   774 begin
   782 begin
   775 //if Group in [capgrpGameState] then WriteLnToConsole(s);
   783 //if Group in [capgrpGameState] then WriteLnToConsole(s);
   776 if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex);
   784 if Captions[Group].Tex <> nil then FreeTexture(Captions[Group].Tex);
   777 
   785 
   778 Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
   786 Captions[Group].Tex:= RenderStringTex(s, Color, fntBig);
   871 if WorldDy < wdy then WorldDy:= wdy;
   879 if WorldDy < wdy then WorldDy:= wdy;
   872 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024;
   880 if WorldDx < - LAND_WIDTH - 1024 then WorldDx:= - LAND_WIDTH - 1024;
   873 if WorldDx > 1024 then WorldDx:= 1024;
   881 if WorldDx > 1024 then WorldDx:= 1024;
   874 end;
   882 end;
   875 
   883 
   876 procedure ShowMission(caption, subcaption, text: string; icon, time : LongInt);
   884 procedure ShowMission(caption, subcaption, text: ansistring; icon, time : LongInt);
   877 var r: TSDL_Rect;
   885 var r: TSDL_Rect;
   878 begin
   886 begin
   879 r.w:= 32;
   887 r.w:= 32;
   880 r.h:= 32;
   888 r.h:= 32;
   881 
   889