hedgewars/uWorld.pas
branchhedgeroid
changeset 6328 d14adf1c7721
parent 6224 42b256eca362
parent 6302 db8bdbb34e03
child 6344 cba81e10235c
equal deleted inserted replaced
6236:1998ff75321a 6328:d14adf1c7721
    72     missionTimer: LongInt;
    72     missionTimer: LongInt;
    73     stereoDepth: GLfloat;
    73     stereoDepth: GLfloat;
    74 
    74 
    75 const cStereo_Sky           = 0.0500;
    75 const cStereo_Sky           = 0.0500;
    76       cStereo_Horizon       = 0.0250;
    76       cStereo_Horizon       = 0.0250;
       
    77       cStereo_MidDistance   = 0.0175;
    77       cStereo_Water_distant = 0.0125;
    78       cStereo_Water_distant = 0.0125;
    78       cStereo_Land          = 0.0075;
    79       cStereo_Land          = 0.0075;
    79       cStereo_Water_near    = 0.0025;
    80       cStereo_Water_near    = 0.0025;
    80       cStereo_Outside       = 0.0400;
    81       cStereo_Outside       = -0.0400;
    81 
    82 
    82 procedure InitWorld;
    83 procedure InitWorld;
    83 var i, t: LongInt;
    84 var i, t: LongInt;
    84     cp: PClan;
    85     cp: PClan;
    85     g: ansistring;
    86     g: ansistring;
   182 prevPoint.X:= 0;
   183 prevPoint.X:= 0;
   183 prevPoint.Y:= cScreenHeight div 2;
   184 prevPoint.Y:= cScreenHeight div 2;
   184 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   185 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   185 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   186 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   186 AMSlotSize:= 33;
   187 AMSlotSize:= 33;
   187 {$IFDEF MOBILE}
   188 {$IFDEF IPHONEOS}
   188 AMxOffset:= 10;
   189 if isPhone() then
   189 AMyOffset:= 10 + 123;   // moved downwards
   190     begin
       
   191     AMxOffset:= -30 + cScreenHeight div 2;
       
   192     AMyOffset:= 10;
       
   193     end
       
   194 else
       
   195     begin
       
   196     AMxOffset:= AMSlotSize + cScreenHeight div 2;
       
   197     AMyOffset:= -10 + cScreenWidth div 3;
       
   198     end;
   190 AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset;
   199 AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset;
   191 {$ELSE}
   200 {$ELSE}
   192 AMxOffset:= 10;
   201 AMxOffset:= 10;
   193 AMyOffset:= 60;
   202 AMyOffset:= 60;
   194 AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   203 AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   208 const BORDERSIZE = 2;
   217 const BORDERSIZE = 2;
   209 var x, y, i, t, g: LongInt;
   218 var x, y, i, t, g: LongInt;
   210     Slot, Pos, STurns: LongInt;
   219     Slot, Pos, STurns: LongInt;
   211     Ammo: PHHAmmo;
   220     Ammo: PHHAmmo;
   212 begin
   221 begin
   213 if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   222     if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   214     bShowAmmoMenu:= false;
   223        ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   215 if bShowAmmoMenu then
   224         bShowAmmoMenu:= false;
   216    begin
   225 
   217    FollowGear:= nil;
   226     if bShowAmmoMenu then
   218    if AMxShift = AMWidth then prevPoint.X:= 0;
   227     // show ammo menu
   219    if (cReducedQuality and rqSlowMenu) <> 0 then
   228         begin
   220        AMxShift:= 0
   229         FollowGear:= nil;
   221    else
   230         if AMxShift = AMWidth then prevPoint.X:= 0;
   222        if AMxShift > MENUSPEED then
   231         if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= 0
   223            dec(AMxShift, MENUSPEED)
   232         else
   224        else
   233             if AMxShift > MENUSPEED then dec(AMxShift, MENUSPEED)
   225            AMxShift:= 0;
   234             else AMxShift:= 0;
   226    end else
   235         end
   227    begin
   236     else
   228    if AMxShift = 0 then
   237     // hide ammo menu
   229       begin
   238         begin
   230       CursorPoint.X:= cScreenWidth shr 1;
   239         if AMxShift = 0 then
   231       CursorPoint.Y:= cScreenHeight shr 1;
       
   232       prevPoint:= CursorPoint;
       
   233       end;
       
   234    if (cReducedQuality and rqSlowMenu) <> 0 then
       
   235        AMxShift:= AMWidth
       
   236    else
       
   237        if AMxShift < (AMWidth - MENUSPEED) then
       
   238            inc(AMxShift, MENUSPEED)
       
   239        else
       
   240            AMxShift:= AMWidth;
       
   241    end;
       
   242 Ammo:= nil;
       
   243 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
       
   244    Ammo:= CurrentHedgehog^.Ammo
       
   245 else if (LocalAmmo <> -1) then
       
   246    Ammo:= GetAmmoByNum(LocalAmmo);
       
   247 Pos:= -1;
       
   248 if Ammo = nil then
       
   249     begin
       
   250     bShowAmmoMenu:= false;
       
   251     exit
       
   252     end;
       
   253 SlotsNum:= 0;
       
   254 x:= (cScreenWidth shr 1) - AMWidth + AMxShift;
       
   255 
       
   256 {$IFDEF MOBILE}
       
   257 Slot:= cMaxSlotIndex;
       
   258 x:= x - cOffsetY;
       
   259 y:= AMyOffset;
       
   260 dec(y, BORDERSIZE);
       
   261 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
       
   262 for i:= 0 to cMaxSlotAmmoIndex do
       
   263     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   264 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
       
   265 inc(y, BORDERSIZE);
       
   266 
       
   267 for i:= 0 to cMaxSlotIndex do
       
   268     if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   269         begin
       
   270         if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i;
       
   271         inc(SlotsNum);
       
   272         DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   273         t:= 0;
       
   274         g:= 0;
       
   275         while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   276             begin
   240             begin
   277             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   241             CursorPoint.X:= cScreenWidth shr 1;
   278             if (Ammo^[i, t].AmmoType <> amNothing) then
   242             CursorPoint.Y:= cScreenHeight shr 1;
       
   243             prevPoint:= CursorPoint;
       
   244             end;
       
   245         if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= AMWidth+2
       
   246         else
       
   247             if AMxShift < (AMWidth - MENUSPEED) then inc(AMxShift, MENUSPEED)
       
   248             else AMxShift:= AMWidth;
       
   249         end;
       
   250 
       
   251     // give the assigned ammo to hedgehog
       
   252     Ammo:= nil;
       
   253     if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and
       
   254        (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
       
   255         Ammo:= CurrentHedgehog^.Ammo
       
   256     else if (LocalAmmo <> -1) then
       
   257         Ammo:= GetAmmoByNum(LocalAmmo);
       
   258     Pos:= -1;
       
   259     if Ammo = nil then
       
   260         begin
       
   261         bShowAmmoMenu:= false;
       
   262         exit
       
   263         end;
       
   264     SlotsNum:= 0;
       
   265     x:= (cScreenWidth shr 1) - AMWidth + AMxShift;
       
   266 
       
   267 {$IFDEF IPHONEOS}
       
   268     Slot:= cMaxSlotIndex;
       
   269     x:= x - cOffsetY;
       
   270     y:= AMyOffset;
       
   271     dec(y, BORDERSIZE);
       
   272     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
       
   273     for i:= 0 to cMaxSlotAmmoIndex do
       
   274         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   275     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
       
   276     inc(y, BORDERSIZE);
       
   277 
       
   278     for i:= 0 to cMaxSlotIndex do
       
   279         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   280             begin
       
   281             if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i;
       
   282             inc(SlotsNum);
       
   283             DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   284             t:= 0;
       
   285             g:= 0;
       
   286             while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
   279                 begin
   287                 begin
   280                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   288                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   281 
   289                 if (Ammo^[i, t].AmmoType <> amNothing) then
   282                 if STurns >= 0 then
       
   283                     begin
   290                     begin
   284                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   291                     STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   285                     if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
   292 
   286                     end else
   293                     if STurns >= 0 then
   287                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   294                         begin
   288                 if (Slot = i)
   295                         DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   289                 and (CursorPoint.X >= x + g * AMSlotSize)
   296                         if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
   290                 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
   297                         end
   291                     begin
   298                     else
   292                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
   299                         DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   293                     Pos:= t;
   300                     if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and
       
   301                        (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
       
   302                         begin
       
   303                         if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   304                         Pos:= t;
       
   305                         end;
       
   306                     inc(g)
   294                     end;
   307                     end;
   295                 inc(g)
       
   296                 end;
       
   297                 inc(t)
   308                 inc(t)
   298             end;
   309             end;
   299         for g:= g to cMaxSlotAmmoIndex do
   310 
   300             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   311     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   301         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   312     for i:= 0 to cMaxSlotAmmoIndex do
   302         inc(y, AMSlotSize);
       
   303         end;
       
   304 
       
   305 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
       
   306 for i:= 0 to cMaxSlotAmmoIndex do
       
   307 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   313 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   308 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   314     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   309 {$ELSE}
   315 {$ELSE}
   310 Slot:= 0;
   316     Slot:= 0;
   311 y:= cScreenHeight - AMyOffset;
   317     y:= cScreenHeight - AMyOffset;
   312 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   318     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   313 for i:= 0 to cMaxSlotAmmoIndex + 1 do
   319     for i:= 0 to cMaxSlotAmmoIndex + 1 do
   314     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   320         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   315 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   321     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   316 dec(y, AMSlotSize);
   322     dec(y, AMSlotSize);
   317 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
   323     DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
   318 for i:= 0 to cMaxSlotAmmoIndex do
   324     for i:= 0 to cMaxSlotAmmoIndex do
   319     DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
   325         DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
   320 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1);
   326     DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1);
   321 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   327     DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   322 
   328 
   323 for i:= cMaxSlotIndex downto 0 do
   329     for i:= cMaxSlotIndex downto 0 do
   324     if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   330         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   325         begin
       
   326         if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i;
       
   327         dec(y, AMSlotSize);
       
   328         inc(SlotsNum);
       
   329         DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   330         DrawSprite(sprAMSlot, x, y, 1);
       
   331         DrawSprite(sprAMSlotKeys, x, y + 1, i);
       
   332         t:= 0;
       
   333         g:= 1;
       
   334         while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   335             begin
   331             begin
   336             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   332             if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i;
   337             if (Ammo^[i, t].AmmoType <> amNothing) then
   333             dec(y, AMSlotSize);
       
   334             inc(SlotsNum);
       
   335             DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   336             DrawSprite(sprAMSlot, x, y, 1);
       
   337             DrawSprite(sprAMSlotKeys, x, y + 1, i);
       
   338             t:= 0;
       
   339             g:= 1;
       
   340             while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
   338                 begin
   341                 begin
   339                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   342                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   340 
   343                 if (Ammo^[i, t].AmmoType <> amNothing) then
   341                 if STurns >= 0 then
       
   342                     begin
   344                     begin
   343                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   345                     STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   344                     if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
   346 
   345                     end else
   347                     if STurns >= 0 then
   346                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   348                         begin
   347                 if (Slot = i)
   349                         DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   348                 and (CursorPoint.X >= x + g * AMSlotSize)
   350                         if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
   349                 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
   351                         end else
   350                     begin
   352                         DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   351                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
   353                     if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and
   352                     Pos:= t;
   354                        (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
       
   355                         begin
       
   356                         if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   357                         Pos:= t;
       
   358                         end;
       
   359                     inc(g)
   353                     end;
   360                     end;
   354                 inc(g)
   361                     inc(t)
   355                 end;
   362                 end;
   356                 inc(t)
   363             for g:= g to cMaxSlotAmmoIndex + 1 do
       
   364                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   365             DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   357             end;
   366             end;
   358         for g:= g to cMaxSlotAmmoIndex + 1 do
   367 
   359             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   368     dec(y, BORDERSIZE);
   360         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   369     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
   361         end;
   370     for i:= 0 to cMaxSlotAmmoIndex + 1 do
   362 
   371         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
   363 dec(y, BORDERSIZE);
   372     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
   364 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
       
   365 for i:= 0 to cMaxSlotAmmoIndex + 1 do
       
   366     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   367 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
       
   368 {$ENDIF}
   373 {$ENDIF}
   369 
   374 
   370 if (Pos >= 0) then
   375     if (Pos >= 0) then
   371     begin
   376         begin
   372     if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
   377         if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
   373         begin
       
   374         if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
       
   375             begin
   378             begin
   376             amSel:= Ammo^[Slot, Pos].AmmoType;
   379             if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
   377             RenderWeaponTooltip(amSel)
   380                 begin
   378             end;
   381                 amSel:= Ammo^[Slot, Pos].AmmoType;
   379 
   382                 RenderWeaponTooltip(amSel)
   380 {$IFDEF MOBILE}
   383                 end;
   381         DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   384 
   382 
   385 {$IFDEF IPHONEOS}
   383         if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   386             DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   384             DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   387             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
       
   388                 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + 163, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   385 {$ELSE}
   389 {$ELSE}
   386         DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   390             DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   387         if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   391             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   388             DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   392                 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   389 {$ENDIF}
   393 {$ENDIF}
   390 
   394 
   391         if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   395             if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   392             begin
   396                 begin
   393             bShowAmmoMenu:= false;
   397                 bShowAmmoMenu:= false;
   394             SetWeapon(Ammo^[Slot, Pos].AmmoType);
   398                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
   395             bSelected:= false;
   399                 bSelected:= false;
   396             FreeWeaponTooltip;
   400                 FreeWeaponTooltip;
   397             exit
   401                 exit
   398             end;
   402                 end;
   399        end
   403             end
   400     end
   404         end
   401 else
   405     else
   402     FreeWeaponTooltip;
   406         FreeWeaponTooltip;
   403 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   407 
   404 {$IFDEF MOBILE}
   408     if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   405     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1);
   409 {$IFDEF IPHONEOS}
       
   410         ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, 100);
   406 {$ELSE}
   411 {$ELSE}
   407     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   412         ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   408 {$ENDIF}
   413 {$ENDIF}
   409 
   414 
   410 bSelected:= false;
   415     bSelected:= false;
   411 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   416     if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   412 end;
   417 end;
   413 
   418 
   414 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   419 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   415 var VertexBuffer: array [0..3] of TVertex2f;
   420 var VertexBuffer: array [0..3] of TVertex2f;
   416     r: TSDL_Rect;
   421     r: TSDL_Rect;
   788         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
   793         DrawRepeated(sprHorizont, sprHorizontL, sprHorizontR, (WorldDx + LAND_WIDTH div 2) * 3 div 5, HorizontOffset);
   789         if SuddenDeathDmg then Tint($FF, $FF, $FF, $FF);
   794         if SuddenDeathDmg then Tint($FF, $FF, $FF, $FF);
   790     end;
   795     end;
   791 
   796 
   792     DrawVisualGears(0);
   797     DrawVisualGears(0);
       
   798     ChangeDepth(RM, -cStereo_MidDistance);
       
   799     DrawVisualGears(4);
   793 
   800 
   794     if (cReducedQuality and rq2DWater) = 0 then
   801     if (cReducedQuality and rq2DWater) = 0 then
   795     begin
   802     begin
   796         // Waves
   803         // Waves
   797         DrawWater(255, SkyOffset); 
   804         DrawWater(255, SkyOffset); 
   806     end
   813     end
   807     else
   814     else
   808         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
   815         DrawWaves(-1, 100, - (cWaveHeight + (cWaveHeight shr 1)), 0);
   809 
   816 
   810     changeDepth(RM, cStereo_Land);
   817     changeDepth(RM, cStereo_Land);
       
   818     DrawVisualGears(5);
   811     DrawLand(WorldDx, WorldDy);
   819     DrawLand(WorldDx, WorldDy);
   812 
   820 
   813     DrawWater(255, 0);
   821     DrawWater(255, 0);
   814 
   822 
   815 // Attack bar
   823 // Attack bar
   834                 end
   842                 end
   835         end;
   843         end;
   836 
   844 
   837     DrawVisualGears(1);
   845     DrawVisualGears(1);
   838     DrawGears;
   846     DrawGears;
       
   847     DrawVisualGears(6);
   839 
   848 
   840     if SuddenDeathDmg then
   849     if SuddenDeathDmg then
   841         DrawWater(cSDWaterOpacity, 0)
   850         DrawWater(cSDWaterOpacity, 0)
   842     else
   851     else
   843         DrawWater(cWaterOpacity, 0);
   852         DrawWater(cWaterOpacity, 0);
  1199 {$IFNDEF MOBILE}
  1208 {$IFNDEF MOBILE}
  1200 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then
  1209 if (not (CurrentTeam^.ExtDriven and isCursorVisible and not bShowAmmoMenu)) and cHasFocus and (GameState <> gsConfirm) then
  1201     uCursor.updatePosition();
  1210     uCursor.updatePosition();
  1202 {$ENDIF}
  1211 {$ENDIF}
  1203 z:= round(200/zoom);
  1212 z:= round(200/zoom);
  1204 if (not PlacingHogs) and (FollowGear <> nil) and (not isCursorVisible) and (not fastUntilLag) then
  1213 if not PlacingHogs and (FollowGear <> nil) and not isCursorVisible and not bShowAmmoMenu and not fastUntilLag then
  1205     if (not autoCameraOn) or ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
  1214     if (not autoCameraOn) or ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
  1206     begin
  1215         begin
  1207         FollowGear:= nil;
  1216         FollowGear:= nil;
  1208         prevPoint:= CursorPoint;
  1217         prevPoint:= CursorPoint;
  1209         exit
  1218         exit
  1210     end
  1219         end
  1211     else
  1220     else
  1212     begin
  1221         begin
  1213         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
  1222         CursorPoint.X:= (prevPoint.X * 7 + hwRound(FollowGear^.X) + hwSign(FollowGear^.dX) * z + WorldDx) div 8;
  1214         if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10)  then
  1223         if isPhone() or (cScreenHeight < 600) or ((hwSign(FollowGear^.dY) * z) < 10)  then
  1215             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1224             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + WorldDy)) div 8
  1216         else
  1225         else
  1217             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1226             CursorPoint.Y:= (prevPoint.Y * 7 + cScreenHeight - (hwRound(FollowGear^.Y) + hwSign(FollowGear^.dY) * z + WorldDy)) div 8;
  1218     end;
  1227         end;
  1219 
  1228 
  1220 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
  1229 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
  1221 if WorldDy < wdy then WorldDy:= wdy;
  1230 if WorldDy < wdy then WorldDy:= wdy;
  1222 
  1231 
  1223 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
  1232 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
  1325 end;
  1334 end;
  1326 
  1335 
  1327 procedure HideMission;
  1336 procedure HideMission;
  1328 begin
  1337 begin
  1329     missionTimer:= 0;
  1338     missionTimer:= 0;
  1330     if missionTex <> nil then FreeTexture(missionTex);
       
  1331 end;
  1339 end;
  1332 
  1340 
  1333 procedure ShakeCamera(amount: LongInt);
  1341 procedure ShakeCamera(amount: LongInt);
  1334 begin
  1342 begin
  1335     if isCursorVisible then exit;
  1343     if isCursorVisible then exit;