hedgewars/uWorld.pas
changeset 6276 1e2f8da1860a
parent 6250 cd01e4f93ed9
child 6289 95ffd59d0f4a
equal deleted inserted replaced
6274:a3e1eb794249 6276:1e2f8da1860a
   183 prevPoint.Y:= cScreenHeight div 2;
   183 prevPoint.Y:= cScreenHeight div 2;
   184 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   184 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   185 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   185 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   186 AMSlotSize:= 33;
   186 AMSlotSize:= 33;
   187 {$IFDEF IPHONEOS}
   187 {$IFDEF IPHONEOS}
   188 AMxOffset:= 10;
   188 if isPhone() then
   189 AMyOffset:= 10 + 123;   // moved downwards
   189     begin
       
   190     AMxOffset:= -30 + cScreenHeight div 2;
       
   191     AMyOffset:= 10;
       
   192     end
       
   193 else
       
   194     begin
       
   195     AMxOffset:= AMSlotSize + cScreenHeight div 2;
       
   196     AMyOffset:= -10 + cScreenWidth div 3;
       
   197     end;
   190 AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset;
   198 AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset;
   191 {$ELSE}
   199 {$ELSE}
   192 AMxOffset:= 10;
   200 AMxOffset:= 10;
   193 AMyOffset:= 60;
   201 AMyOffset:= 60;
   194 AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   202 AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   208 const BORDERSIZE = 2;
   216 const BORDERSIZE = 2;
   209 var x, y, i, t, g: LongInt;
   217 var x, y, i, t, g: LongInt;
   210     Slot, Pos, STurns: LongInt;
   218     Slot, Pos, STurns: LongInt;
   211     Ammo: PHHAmmo;
   219     Ammo: PHHAmmo;
   212 begin
   220 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
   221     if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or
   214     bShowAmmoMenu:= false;
   222        ((Ammoz[CurAmmoGear^.AmmoType].Ammo.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   215 if bShowAmmoMenu then
   223         bShowAmmoMenu:= false;
   216    begin
   224 
   217    FollowGear:= nil;
   225     if bShowAmmoMenu then
   218    if AMxShift = AMWidth then prevPoint.X:= 0;
   226     // show ammo menu
   219    if (cReducedQuality and rqSlowMenu) <> 0 then
   227         begin
   220        AMxShift:= 0
   228         FollowGear:= nil;
   221    else
   229         if AMxShift = AMWidth then prevPoint.X:= 0;
   222        if AMxShift > MENUSPEED then
   230         if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= 0
   223            dec(AMxShift, MENUSPEED)
   231         else
   224        else
   232             if AMxShift > MENUSPEED then dec(AMxShift, MENUSPEED)
   225            AMxShift:= 0;
   233             else AMxShift:= 0;
   226    end else
   234         end
   227    begin
   235     else
   228    if AMxShift = 0 then
   236     // hide ammo menu
   229       begin
   237         begin
   230       CursorPoint.X:= cScreenWidth shr 1;
   238         if AMxShift = 0 then
   231       CursorPoint.Y:= cScreenHeight shr 1;
   239             begin
   232       prevPoint:= CursorPoint;
   240             CursorPoint.X:= cScreenWidth shr 1;
   233       end;
   241             CursorPoint.Y:= cScreenHeight shr 1;
   234    if (cReducedQuality and rqSlowMenu) <> 0 then
   242             prevPoint:= CursorPoint;
   235        AMxShift:= AMWidth
   243             end;
   236    else
   244         if (cReducedQuality and rqSlowMenu) <> 0 then AMxShift:= AMWidth+2
   237        if AMxShift < (AMWidth - MENUSPEED) then
   245         else
   238            inc(AMxShift, MENUSPEED)
   246             if AMxShift < (AMWidth - MENUSPEED) then inc(AMxShift, MENUSPEED)
   239        else
   247             else AMxShift:= AMWidth;
   240            AMxShift:= AMWidth;
   248         end;
   241    end;
   249 
   242 Ammo:= nil;
   250     // give the assigned ammo to hedgehog
   243 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
   251     Ammo:= nil;
   244    Ammo:= CurrentHedgehog^.Ammo
   252     if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and
   245 else if (LocalAmmo <> -1) then
   253        (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
   246    Ammo:= GetAmmoByNum(LocalAmmo);
   254         Ammo:= CurrentHedgehog^.Ammo
   247 Pos:= -1;
   255     else if (LocalAmmo <> -1) then
   248 if Ammo = nil then
   256         Ammo:= GetAmmoByNum(LocalAmmo);
   249     begin
   257     Pos:= -1;
   250     bShowAmmoMenu:= false;
   258     if Ammo = nil then
   251     exit
   259         begin
   252     end;
   260         bShowAmmoMenu:= false;
   253 SlotsNum:= 0;
   261         exit
   254 x:= (cScreenWidth shr 1) - AMWidth + AMxShift;
   262         end;
       
   263     SlotsNum:= 0;
       
   264     x:= (cScreenWidth shr 1) - AMWidth + AMxShift;
   255 
   265 
   256 {$IFDEF IPHONEOS}
   266 {$IFDEF IPHONEOS}
   257 Slot:= cMaxSlotIndex;
   267     Slot:= cMaxSlotIndex;
   258 x:= x - cOffsetY;
   268     x:= x - cOffsetY;
   259 y:= AMyOffset;
   269     y:= AMyOffset;
   260 dec(y, BORDERSIZE);
   270     dec(y, BORDERSIZE);
   261 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
   271     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
   262 for i:= 0 to cMaxSlotAmmoIndex do
   272     for i:= 0 to cMaxSlotAmmoIndex do
   263     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
   273         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
   264 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
   274     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
   265 inc(y, BORDERSIZE);
   275     inc(y, BORDERSIZE);
   266 
   276 
   267 for i:= 0 to cMaxSlotIndex do
   277     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
   278         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
   279             begin
   277             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   280             if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y <= y + AMSlotSize) then Slot:= i;
   278             if (Ammo^[i, t].AmmoType <> amNothing) then
   281             inc(SlotsNum);
       
   282             DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   283             t:= 0;
       
   284             g:= 0;
       
   285             while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
   279                 begin
   286                 begin
   280                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   287                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   281 
   288                 if (Ammo^[i, t].AmmoType <> amNothing) then
   282                 if STurns >= 0 then
       
   283                     begin
   289                     begin
   284                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   290                     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);
   291 
   286                     end else
   292                     if STurns >= 0 then
   287                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   293                         begin
   288                 if (Slot = i)
   294                         DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   289                 and (CursorPoint.X >= x + g * AMSlotSize)
   295                         if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
   290                 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
   296                         end
       
   297                     else
       
   298                         DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   299                     if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and
       
   300                        (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
       
   301                         begin
       
   302                         if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   303                         Pos:= t;
       
   304                         end;
       
   305                     inc(g)
       
   306                     end;
       
   307                 inc(t)
       
   308                 end;
       
   309             for g:= g to cMaxSlotAmmoIndex do
       
   310                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   311             DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   312             inc(y, AMSlotSize);
       
   313             end;
       
   314 
       
   315     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
       
   316     for i:= 0 to cMaxSlotAmmoIndex do
       
   317 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
       
   318     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
       
   319 {$ELSE}
       
   320     Slot:= 0;
       
   321     y:= cScreenHeight - AMyOffset;
       
   322     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
       
   323     for i:= 0 to cMaxSlotAmmoIndex + 1 do
       
   324         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
       
   325     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
       
   326     dec(y, AMSlotSize);
       
   327     DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   328     for i:= 0 to cMaxSlotAmmoIndex do
       
   329         DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
       
   330     DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1);
       
   331     DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   332 
       
   333     for i:= cMaxSlotIndex downto 0 do
       
   334         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   335             begin
       
   336             if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y <= y) then Slot:= i;
       
   337             dec(y, AMSlotSize);
       
   338             inc(SlotsNum);
       
   339             DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   340             DrawSprite(sprAMSlot, x, y, 1);
       
   341             DrawSprite(sprAMSlotKeys, x, y + 1, i);
       
   342             t:= 0;
       
   343             g:= 1;
       
   344             while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   345                 begin
       
   346                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   347                 if (Ammo^[i, t].AmmoType <> amNothing) then
   291                     begin
   348                     begin
   292                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
   349                     STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   293                     Pos:= t;
   350 
       
   351                     if STurns >= 0 then
       
   352                         begin
       
   353                         DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   354                         if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
       
   355                         end else
       
   356                         DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   357                     if (Slot = i) and (CursorPoint.X >= x + g * AMSlotSize) and
       
   358                        (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
       
   359                         begin
       
   360                         if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   361                         Pos:= t;
       
   362                         end;
       
   363                     inc(g)
   294                     end;
   364                     end;
   295                 inc(g)
   365                     inc(t)
   296                 end;
   366                 end;
   297                 inc(t)
   367             for g:= g to cMaxSlotAmmoIndex + 1 do
       
   368                 DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   369             DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   298             end;
   370             end;
   299         for g:= g to cMaxSlotAmmoIndex do
   371 
   300             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   372     dec(y, BORDERSIZE);
   301         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   373     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
   302         inc(y, AMSlotSize);
   374     for i:= 0 to cMaxSlotAmmoIndex + 1 do
   303         end;
   375         DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
   304 
   376     DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
   305 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   377 {$ENDIF}
   306 for i:= 0 to cMaxSlotAmmoIndex do
   378 
   307 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   379     if (Pos >= 0) then
   308 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   380         begin
       
   381         if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
       
   382             begin
       
   383             if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
       
   384                 begin
       
   385                 amSel:= Ammo^[Slot, Pos].AmmoType;
       
   386                 RenderWeaponTooltip(amSel)
       
   387                 end;
       
   388 
       
   389 {$IFDEF IPHONEOS}
       
   390             DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
       
   391             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
       
   392                 DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + 163, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   309 {$ELSE}
   393 {$ELSE}
   310 Slot:= 0;
   394             DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   311 y:= cScreenHeight - AMyOffset;
   395             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   312 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   396                 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   313 for i:= 0 to cMaxSlotAmmoIndex + 1 do
   397 {$ENDIF}
   314     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
   398 
   315 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   399             if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   316 dec(y, AMSlotSize);
       
   317 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   318 for i:= 0 to cMaxSlotAmmoIndex do
       
   319     DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
       
   320 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1);
       
   321 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   322 
       
   323 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
       
   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
       
   336             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   337             if (Ammo^[i, t].AmmoType <> amNothing) then
       
   338                 begin
   400                 begin
   339                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   401                 bShowAmmoMenu:= false;
   340 
   402                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
   341                 if STurns >= 0 then
   403                 bSelected:= false;
   342                     begin
   404                 FreeWeaponTooltip;
   343                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
   405                 exit
   344                     if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
       
   345                     end else
       
   346                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   347                 if (Slot = i)
       
   348                 and (CursorPoint.X >= x + g * AMSlotSize)
       
   349                 and (CursorPoint.X <= x + (g + 1) * AMSlotSize) then
       
   350                     begin
       
   351                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   352                     Pos:= t;
       
   353                     end;
       
   354                 inc(g)
       
   355                 end;
   406                 end;
   356                 inc(t)
   407             end
   357             end;
   408         end
   358         for g:= g to cMaxSlotAmmoIndex + 1 do
   409     else
   359             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
   410         FreeWeaponTooltip;
   360         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
   411 
   361         end;
   412     if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   362 
   413 {$IFDEF IPHONEOS}
   363 dec(y, BORDERSIZE);
   414         ShowWeaponTooltip(-WeaponTooltipTex^.w div 2, 100);
   364 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
   415 {$ELSE}
   365 for i:= 0 to cMaxSlotAmmoIndex + 1 do
   416         ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   366     DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   367 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
       
   368 {$ENDIF}
   417 {$ENDIF}
   369 
   418 
   370 if (Pos >= 0) then
   419     bSelected:= false;
   371     begin
   420     if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   372     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
       
   376             amSel:= Ammo^[Slot, Pos].AmmoType;
       
   377             RenderWeaponTooltip(amSel)
       
   378             end;
       
   379 
       
   380 {$IFDEF IPHONEOS}
       
   381         DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
       
   382 
       
   383         if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
       
   384             DrawTexture(cScreenWidth div 2 + AMxOffset - 45, AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
       
   385 {$ELSE}
       
   386         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
       
   388             DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
       
   389 {$ENDIF}
       
   390 
       
   391         if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
       
   392             begin
       
   393             bShowAmmoMenu:= false;
       
   394             SetWeapon(Ammo^[Slot, Pos].AmmoType);
       
   395             bSelected:= false;
       
   396             FreeWeaponTooltip;
       
   397             exit
       
   398             end;
       
   399        end
       
   400     end
       
   401 else
       
   402     FreeWeaponTooltip;
       
   403 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
       
   404 {$IFDEF IPHONEOS}
       
   405     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1);
       
   406 {$ELSE}
       
   407     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, Min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
       
   408 {$ENDIF}
       
   409 
       
   410 bSelected:= false;
       
   411 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
       
   412 end;
   421 end;
   413 
   422 
   414 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   423 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   415 var VertexBuffer: array [0..3] of TVertex2f;
   424 var VertexBuffer: array [0..3] of TVertex2f;
   416     r: TSDL_Rect;
   425     r: TSDL_Rect;