hedgewars/uWorld.pas
changeset 3434 6af73e7f2438
parent 3407 dcc129c4352e
child 3444 9d501dc22f71
equal deleted inserted replaced
3433:566788d32e52 3434:6af73e7f2438
    58                    EndTime: LongWord;
    58                    EndTime: LongWord;
    59                    end;
    59                    end;
    60 
    60 
    61 var cWaveWidth, cWaveHeight: LongInt;
    61 var cWaveWidth, cWaveHeight: LongInt;
    62     Captions: array[TCapGroup] of TCaptionStr;
    62     Captions: array[TCapGroup] of TCaptionStr;
    63     AMxShift, SlotsNum: LongInt;
    63     AMSlotSize, AMxOffset, AMyOffset, AMWidth, AMxShift, SlotsNum: LongInt;
    64     tmpSurface: PSDL_Surface;
    64     tmpSurface: PSDL_Surface;
    65     fpsTexture: PTexture;
    65     fpsTexture: PTexture;
    66     timeTexture: PTexture;
    66     timeTexture: PTexture;
    67     FPS: Longword;
    67     FPS: Longword;
    68     CountTicks: Longword;
    68     CountTicks: Longword;
   171 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
   171 SDL_WarpMouse(cScreenWidth div 2, cScreenHeight div 2);
   172 prevPoint.X:= 0;
   172 prevPoint.X:= 0;
   173 prevPoint.Y:= cScreenHeight div 2;
   173 prevPoint.Y:= cScreenHeight div 2;
   174 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   174 WorldDx:=  - (LAND_WIDTH div 2) + cScreenWidth div 2;
   175 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   175 WorldDy:=  - (LAND_HEIGHT - (playHeight div 2)) + (cScreenHeight div 2);
   176 AMxShift:= 210;
   176 AMSlotSize:= 33;
       
   177 {$IFDEF IPHONEOS}
       
   178 AMxOffset:= 10;
       
   179 AMyOffset:= 10;
       
   180 AMWidth:= (cMaxSlotAmmoIndex + 1) * AMSlotSize + AMxOffset;
       
   181 {$ELSE}
       
   182 AMxOffset:= 10;
       
   183 AMyOffset:= 60;
       
   184 AMWidth:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
       
   185 {$ENDIF}
       
   186 AMxShift:= AMWidth;
   177 SkyOffset:= 0;
   187 SkyOffset:= 0;
   178 HorizontOffset:= 0;
   188 HorizontOffset:= 0;
   179 end;
   189 end;
   180 
   190 
   181 
   191 
   182 procedure ShowAmmoMenu;
   192 procedure ShowAmmoMenu;
   183 const MENUSPEED = 15;
   193 const MENUSPEED = 15;
       
   194 const BORDERSIZE = 2;
       
   195 var x, y, i, t, g: LongInt;
       
   196     Slot, Pos, STurns: LongInt;
       
   197     Ammo: PHHAmmo;
       
   198 begin
       
   199 if  (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then bShowAmmoMenu:= false;
       
   200 if bShowAmmoMenu then
       
   201    begin
       
   202    FollowGear:= nil;
       
   203    if AMxShift = AMWidth then prevPoint.X:= 0;
       
   204    if cReducedQuality then
       
   205        AMxShift:= 0
       
   206    else
       
   207        if AMxShift > MENUSPEED then
       
   208       	   dec(AMxShift, MENUSPEED)
       
   209        else
       
   210            AMxShift:= 0;
       
   211    end else
       
   212    begin
       
   213    if AMxShift = 0 then
       
   214       begin
       
   215       CursorPoint.X:= cScreenWidth shr 1;
       
   216       CursorPoint.Y:= cScreenHeight shr 1;
       
   217       prevPoint:= CursorPoint;
       
   218       SDL_WarpMouse(CursorPoint.X  + cScreenWidth div 2, cScreenHeight - CursorPoint.Y)
       
   219       end;
       
   220    if cReducedQuality then
       
   221        AMxShift:= AMWidth
       
   222    else
       
   223        if AMxShift < (AMWidth - MENUSPEED) then
       
   224            inc(AMxShift, MENUSPEED)
       
   225        else
       
   226            AMxShift:= AMWidth;
       
   227    end;
       
   228 Ammo:= nil;
       
   229 if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and (CurrentHedgehog^.BotLevel = 0) then
       
   230    Ammo:= CurrentHedgehog^.Ammo
       
   231 else if (LocalAmmo <> -1) then
       
   232    Ammo:= GetAmmoByNum(LocalAmmo);
       
   233 Pos:= -1;
       
   234 if Ammo = nil then
       
   235     begin
       
   236     bShowAmmoMenu:= false;
       
   237     exit
       
   238     end;
       
   239 SlotsNum:= 0;
       
   240 x:= (cScreenWidth shr 1) - AMWidth + AMxShift;
       
   241 
   184 {$IFDEF IPHONEOS}
   242 {$IFDEF IPHONEOS}
   185 const MENUWIDTH = 210;
   243 Slot:= cMaxSlotIndex;
       
   244 y:= AMyOffset;
       
   245 dec(y, BORDERSIZE);
       
   246 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
       
   247 for i:= 0 to cMaxSlotAmmoIndex do
       
   248 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   249 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
       
   250 inc(y, BORDERSIZE);
       
   251 
       
   252 for i:= 0 to cMaxSlotIndex do
       
   253     if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   254         begin
       
   255         if (cScreenHeight - CursorPoint.Y >= y) and (cScreenHeight - CursorPoint.Y < y + AMSlotSize) then Slot:= i;
       
   256         inc(SlotsNum);
       
   257         DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   258         t:= 0;
       
   259         g:= 0;
       
   260         while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   261             begin
       
   262             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   263             if (Ammo^[i, t].AmmoType <> amNothing) then
       
   264                 begin
       
   265                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
       
   266 
       
   267                 if STurns >= 0 then
       
   268                     begin
       
   269                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   270                     if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
       
   271                     end else
       
   272                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   273                 if (Slot = i)
       
   274                 and (CursorPoint.X >= x + g * AMSlotSize)
       
   275                 and (CursorPoint.X < x + (g + 1) * AMSlotSize) then
       
   276                     begin
       
   277                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   278                     Pos:= t;
       
   279                     end;
       
   280                 inc(g)
       
   281                 end;
       
   282                 inc(t)
       
   283             end;
       
   284         for g:= g to cMaxSlotAmmoIndex do
       
   285             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   286         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   287         inc(y, AMSlotSize);
       
   288         end;
       
   289         
       
   290 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
       
   291 for i:= 0 to cMaxSlotAmmoIndex do
       
   292 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
       
   293 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
   186 {$ELSE}
   294 {$ELSE}
   187 const MENUWIDTH = 240;
   295 Slot:= 0;
       
   296 y:= cScreenHeight - AMyOffset;
       
   297 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
       
   298 for i:= 0 to cMaxSlotAmmoIndex + 1 do
       
   299 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 1);
       
   300 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 3);
       
   301 dec(y, AMSlotSize);
       
   302 DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   303 for i:= 0 to cMaxSlotAmmoIndex do
       
   304 	DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
       
   305 DrawSprite(sprAMSlot, x + (cMaxSlotAmmoIndex + 1) * AMSlotSize, y, 1);
       
   306 DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   307 
       
   308 for i:= cMaxSlotIndex downto 0 do
       
   309     if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   310         begin
       
   311         if (cScreenHeight - CursorPoint.Y >= y - AMSlotSize) and (cScreenHeight - CursorPoint.Y < y) then Slot:= i;
       
   312         dec(y, AMSlotSize);
       
   313         inc(SlotsNum);
       
   314         DrawSprite(sprAMBorderVertical, x - BORDERSIZE, y, 0);
       
   315         DrawSprite(sprAMSlot, x, y, 1);
       
   316         DrawSprite(sprAMSlotKeys, x, y + 1, i);
       
   317         t:= 0;
       
   318         g:= 1;
       
   319         while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   320             begin
       
   321             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   322             if (Ammo^[i, t].AmmoType <> amNothing) then
       
   323                 begin
       
   324                 STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
       
   325 
       
   326                 if STurns >= 0 then
       
   327                     begin
       
   328                     DrawSprite(sprAMAmmosBW, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   329                     if STurns < 100 then DrawSprite(sprTurnsLeft, x + (g + 1) * AMSlotSize - 16, y + AMSlotSize - 16, STurns);
       
   330                     end else
       
   331                     DrawSprite(sprAMAmmos, x + g * AMSlotSize, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   332                 if (Slot = i)
       
   333                 and (CursorPoint.X >= x + g * AMSlotSize)
       
   334                 and (CursorPoint.X < x + (g + 1) * AMSlotSize) then
       
   335                     begin
       
   336                     if (STurns < 0) then DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 0);
       
   337                     Pos:= t;
       
   338                     end;
       
   339                 inc(g)
       
   340                 end;
       
   341                 inc(t)
       
   342             end;
       
   343         for g:= g to cMaxSlotAmmoIndex + 1 do
       
   344             DrawSprite(sprAMSlot, x + g * AMSlotSize, y, 1);
       
   345         DrawSprite(sprAMBorderVertical, x + AMWidth - AMxOffset, y, 1);
       
   346         end;
       
   347         
       
   348 dec(y, BORDERSIZE);
       
   349 DrawSprite(sprAMCorners, x - BORDERSIZE, y, 0);
       
   350 for i:= 0 to cMaxSlotAmmoIndex + 1 do
       
   351 	DrawSprite(sprAMBorderHorizontal, x + i * AMSlotSize, y, 0);
       
   352 DrawSprite(sprAMCorners, x + AMWidth - AMxOffset, y, 1);
   188 {$ENDIF}
   353 {$ENDIF}
   189 var x, y, i, t, l, g: LongInt;
   354 
   190     Slot, Pos: LongInt;
   355 if (Pos >= 0) then
   191     Ammo: PHHAmmo;
   356     begin
   192 begin
   357     if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
   193     if (TurnTimeLeft = 0) or (not CurrentTeam^.ExtDriven and (((CurAmmoGear = nil) or 
   358         if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
   194        ((CurAmmoGear^.Ammo^.Propz and ammoprop_AltAttack) = 0)) and hideAmmoMenu)) then
   359             begin
       
   360             amSel:= Ammo^[Slot, Pos].AmmoType;
       
   361             RenderWeaponTooltip(amSel)
       
   362             end;
       
   363             
       
   364         {$IFNDEF IPHONEOS}
       
   365         DrawTexture(cScreenWidth div 2 - (AMWidth - 10) + AMxShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
       
   366 
       
   367         if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
       
   368             DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
       
   369         {$ENDIF}
       
   370 
       
   371         if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
       
   372             begin
   195             bShowAmmoMenu:= false;
   373             bShowAmmoMenu:= false;
   196     if bShowAmmoMenu then
   374             SetWeapon(Ammo^[Slot, Pos].AmmoType);
   197     begin
   375             bSelected:= false;
   198         FollowGear:= nil;
   376             FreeWeaponTooltip;
   199         if AMxShift = MENUWIDTH then 
       
   200             prevPoint.X:= 0;
       
   201         if cReducedQuality then
       
   202             AMxShift:= 0
       
   203         else
       
   204             if AMxShift > 0 then 
       
   205                 dec(AMxShift, MENUSPEED);
       
   206     end
       
   207     else
       
   208     begin
       
   209         if AMxShift = 0 then
       
   210         begin
       
   211             CursorPoint.X:= cScreenWidth shr 1;
       
   212             CursorPoint.Y:= cScreenHeight shr 1;
       
   213             prevPoint:= CursorPoint;
       
   214             SDL_WarpMouse(CursorPoint.X  + cScreenWidth div 2, cScreenHeight - CursorPoint.Y)
       
   215         end;
       
   216         if cReducedQuality then
       
   217             AMxShift:= MENUWIDTH
       
   218     else
       
   219         if AMxShift < MENUWIDTH then
       
   220             inc(AMxShift, MENUSPEED);
       
   221     end;
       
   222    
       
   223     Ammo:= nil;
       
   224     if (CurrentTeam <> nil) and (CurrentHedgehog <> nil) and (not CurrentTeam^.ExtDriven) and
       
   225        (CurrentHedgehog^.BotLevel = 0) then
       
   226         Ammo:= CurrentHedgehog^.Ammo
       
   227     else
       
   228         if (LocalAmmo <> -1) then
       
   229             Ammo:= GetAmmoByNum(LocalAmmo);
       
   230         Slot:= 0;
       
   231         Pos:= -1;
       
   232         if Ammo = nil then
       
   233         begin
       
   234             bShowAmmoMenu:= false;
       
   235             exit
   377             exit
   236         end;
       
   237         SlotsNum:= 0;
       
   238         x:= (cScreenWidth shr 1) - MENUWIDTH + AMxShift;
       
   239         y:= cScreenHeight - 40;
       
   240 
       
   241 {$IFDEF IPHONEOS}
       
   242         dec(y);
       
   243         DrawSprite(sprAMBordersIPhone, x, y, 0);
       
   244         dec(y);
       
   245         DrawSprite(sprAMBordersIPhone, x, y, 1);
       
   246         dec(y, 33);
       
   247         DrawSprite(sprAMSlotNameIPhone, x, y, 0);
       
   248 {$ELSE}
       
   249         dec(y);
       
   250         DrawSprite(sprAMBorders, x, y, 0);
       
   251         dec(y);
       
   252         DrawSprite(sprAMBorders, x, y, 1);
       
   253         dec(y, 33);
       
   254         DrawSprite(sprAMSlotName, x, y, 0);
       
   255 {$ENDIF}
       
   256 
       
   257         for i:= cMaxSlotIndex downto 0 do
       
   258             if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
       
   259             begin
       
   260                 if (cScreenHeight - CursorPoint.Y >= y - 33) and (cScreenHeight - CursorPoint.Y < y) then 
       
   261                     Slot:= i;
       
   262                 dec(y, 33);
       
   263                 inc(SlotsNum);
       
   264 {$IFDEF IPHONEOS}
       
   265                 DrawSprite(sprAMSlotIPhone, x, y, 0);
       
   266                 g:= -1;
       
   267 {$ELSE}
       
   268                 DrawSprite(sprAMSlot, x, y, 0);
       
   269                 DrawSprite(sprAMSlotKeys, x + 2, y + 1, i);
       
   270                 g:= 0;
       
   271 {$ENDIF}
       
   272                 t:= 0;
       
   273 
       
   274                 while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
       
   275                 begin
       
   276                     if (Ammo^[i, t].AmmoType <> amNothing) then
       
   277                     begin
       
   278                         l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
       
   279 
       
   280                         if l >= 0 then
       
   281                         begin
       
   282                             DrawSprite(sprAMAmmosBW, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   283                             if l < 100 then
       
   284                                 DrawSprite(sprTurnsLeft, x + g * 33 + 51, y + 17, l);
       
   285                         end
       
   286                         else
       
   287                             DrawSprite(sprAMAmmos, x + g * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType)-1);
       
   288                         if (Slot = i) and (CursorPoint.X >= x + g * 33 + 35) and (CursorPoint.X < x + g * 33 + 68) then
       
   289                         begin
       
   290                             if (l < 0) then 
       
   291                                 DrawSprite(sprAMSelection, x + g * 33 + 35, y + 1, 0);
       
   292                             Pos:= t;
       
   293                         end;
       
   294                         inc(g);
       
   295                     end;
       
   296                     inc(t);
       
   297                 end;
       
   298             end;
       
   299     dec(y, 1);
       
   300 {$IFDEF IPHONEOS}
       
   301     DrawSprite(sprAMBordersIPhone, x, y, 0);
       
   302 {$ELSE}
       
   303     DrawSprite(sprAMBorders, x, y, 0);
       
   304 {$ENDIF}
       
   305 
       
   306     if (Pos >= 0) then
       
   307     begin
       
   308         if (Ammo^[Slot, Pos].Count > 0) and (Ammo^[Slot, Pos].AmmoType <> amNothing) then
       
   309             if (amSel <> Ammo^[Slot, Pos].AmmoType) or (WeaponTooltipTex = nil) then
       
   310             begin
       
   311                 amSel:= Ammo^[Slot, Pos].AmmoType;
       
   312                 RenderWeaponTooltip(amSel)
       
   313             end;
       
   314         
       
   315             DrawTexture(cScreenWidth div 2 - (MENUWIDTH - 10) + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
       
   316 
       
   317             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
       
   318                 DrawTexture(cScreenWidth div 2 + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
       
   319 
       
   320             if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
       
   321             begin
       
   322                 bShowAmmoMenu:= false;
       
   323                 SetWeapon(Ammo^[Slot, Pos].AmmoType);
       
   324                 bSelected:= false;
       
   325                 FreeWeaponTooltip;
       
   326                 exit();
       
   327             end;
   378             end;
   328     end
   379     end
   329     else
   380 else
   330         FreeWeaponTooltip;
   381     FreeWeaponTooltip;
   331 
   382 {$IFDEF IPHONEOS}
   332     if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   383 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   333         ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y, cScreenHeight - WeaponTooltipTex^.h - 40));
   384     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, AMyOffset - 1);
   334 
   385 {$ELSE}
   335     bSelected:= false;
   386 if (WeaponTooltipTex <> nil) and (AMxShift = 0) then
   336     if AMxShift = 0 then 
   387     ShowWeaponTooltip(x - WeaponTooltipTex^.w - 3, min(y + 1, cScreenHeight - WeaponTooltipTex^.h - 40));
   337         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   388 {$ENDIF}
       
   389 
       
   390 bSelected:= false;
       
   391 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8)
   338 end;
   392 end;
   339 
   393 
   340 procedure MoveCamera; forward;
   394 procedure MoveCamera; forward;
   341 
   395 
   342 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   396 procedure DrawWater(Alpha: byte; OffsetY: LongInt);
   774             r.h:= 13;
   828             r.h:= 13;
   775             DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
   829             DrawSpriteFromRect(sprWindL, r, (cScreenWidth shr 1) - offsetY + 74 + WindBarWidth, cScreenHeight - offsetX + 2, 13, 0);
   776         end;
   830         end;
   777 
   831 
   778 // AmmoMenu
   832 // AmmoMenu
   779 if (AMxShift < 210) or bShowAmmoMenu then ShowAmmoMenu;
   833 if (AMxShift < AMWidth) or bShowAmmoMenu then ShowAmmoMenu;
   780 
   834 
   781 // Cursor
   835 // Cursor
   782 if isCursorVisible and bShowAmmoMenu then
   836 if isCursorVisible and bShowAmmoMenu then
   783    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   837    DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
   784 
   838 
   962 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
  1016 wdy:= trunc(cScreenHeight / cScaleFactor) + cScreenHeight div 2 - cWaterLine - cVisibleWater;
   963 if WorldDy < wdy then WorldDy:= wdy;
  1017 if WorldDy < wdy then WorldDy:= wdy;
   964 
  1018 
   965 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
  1019 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then exit;
   966 
  1020 
   967 if AMxShift < 210 then
  1021 if AMxShift < AMWidth then
   968     begin
  1022     begin
   969     if CursorPoint.X < cScreenWidth div 2 + AMxShift - 206 then CursorPoint.X:= cScreenWidth div 2 + AMxShift - 206;
  1023     {$IFDEF IPHONEOS}
   970     if CursorPoint.X > cScreenWidth div 2 + AMxShift - 10 then CursorPoint.X:= cScreenWidth div 2 + AMxShift - 10;
  1024     if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth;
   971     if CursorPoint.Y > 75 + SlotsNum * 33 then CursorPoint.Y:= 75 + SlotsNum * 33;
  1025     if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset;
   972     if CursorPoint.Y < 76 then CursorPoint.Y:= 76;
  1026     if CursorPoint.Y < cScreenHeight - AMyOffset - SlotsNum * AMSlotSize then CursorPoint.Y:= cScreenHeight - AMyOffset - SlotsNum * AMSlotSize;
       
  1027     if CursorPoint.Y > cScreenHeight - AMyOffset then CursorPoint.Y:= cScreenHeight - AMyOffset;
       
  1028     {$ELSE}
       
  1029     if CursorPoint.X < cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMWidth + AMSlotSize;
       
  1030     if CursorPoint.X > cScreenWidth div 2 + AMxShift - AMxOffset then CursorPoint.X:= cScreenWidth div 2 + AMxShift - AMxOffset;
       
  1031     if CursorPoint.Y > AMyOffset + (SlotsNum + 1) * AMSlotSize then CursorPoint.Y:= AMyOffset + (SlotsNum + 1) * AMSlotSize;
       
  1032     if CursorPoint.Y < AMyOffset + AMSlotSize then CursorPoint.Y:= AMyOffset + AMSlotSize;
       
  1033     {$ENDIF}
   973     prevPoint:= CursorPoint;
  1034     prevPoint:= CursorPoint;
   974     if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
  1035     if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
   975     exit
  1036     exit
   976     end;
  1037     end;
   977 
  1038