hedgewars/uWorld.pas
changeset 7841 43e68ac28d79
parent 7840 7d86dbcd6325
child 7845 1a61662e24e4
child 7847 a595d4f4837d
equal deleted inserted replaced
7840:7d86dbcd6325 7841:43e68ac28d79
   627     Tint($FF, $ff, $ff, $ff);
   627     Tint($FF, $ff, $ff, $ff);
   628 
   628 
   629 Pos:= -1;
   629 Pos:= -1;
   630 Slot:= -1;
   630 Slot:= -1;
   631 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   631 {$IFDEF USE_LANDSCAPE_AMMOMENU}
   632     {$IFDEF USE_AM_NUMCOLUMN}
       
   633 c:= 0;
       
   634     {$ELSE}
       
   635 c:= -1;
   632 c:= -1;
   636     {$ENDIF}
       
   637     for i:= 0 to cMaxSlotIndex do
   633     for i:= 0 to cMaxSlotIndex do
   638         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   634         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   639             begin
   635             begin
   640             inc(c);
   636             inc(c);
   641     {$IFDEF USE_AM_NUMCOLUMN}
   637     {$IFDEF USE_AM_NUMCOLUMN}
   645     {$ENDIF}
   641     {$ENDIF}
   646             for t:=0 to cMaxSlotAmmoIndex do
   642             for t:=0 to cMaxSlotAmmoIndex do
   647                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   643                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
   648                     begin
   644                     begin
   649                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g    * (AMSlotSize+1))) and
   645                     if (CursorPoint.Y <= (cScreenHeight - AmmoRect.y) - ( g    * (AMSlotSize+1))) and
   650                        (CursorPoint.Y >= (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
   646                        (CursorPoint.Y >  (cScreenHeight - AmmoRect.y) - ((g+1) * (AMSlotSize+1))) and
   651                        (CursorPoint.X >= AmmoRect.x                   + ( c    * (AMSlotSize+1))) and 
   647                        (CursorPoint.X >  AmmoRect.x                   + ( c    * (AMSlotSize+1))) and 
   652                        (CursorPoint.X <= AmmoRect.x                   + ((c+1) * (AMSlotSize+1))) then
   648                        (CursorPoint.X <= AmmoRect.x                   + ((c+1) * (AMSlotSize+1))) then
   653                         begin
   649                         begin
   654                         Slot:= i;
   650                         Slot:= i;
   655                         Pos:= t;
   651                         Pos:= t;
   656                         STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   652                         STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   661                         end;
   657                         end;
   662                         inc(g);
   658                         inc(g);
   663                    end;
   659                    end;
   664             end;
   660             end;
   665 {$ELSE}
   661 {$ELSE}
   666     {$IFDEF USE_AM_NUMCOLUMN}
       
   667 c:= -1;
   662 c:= -1;
   668     {$ELSE}
       
   669 c:= 0;
       
   670     {$ENDIF}
       
   671     for i:= 0 to cMaxSlotIndex do
   663     for i:= 0 to cMaxSlotIndex do
   672         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   664         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   673             begin
   665             begin
   674             inc(c);
   666             inc(c);
   675     {$IFDEF USE_AM_NUMCOLUMN}
   667     {$IFDEF USE_AM_NUMCOLUMN}
  1638 end;
  1630 end;
  1639 
  1631 
  1640 var PrevSentPointTime: LongWord = 0;
  1632 var PrevSentPointTime: LongWord = 0;
  1641 
  1633 
  1642 procedure MoveCamera;
  1634 procedure MoveCamera;
  1643 var EdgesDist, wdy, shs,z: LongInt;
  1635 var EdgesDist, wdy, shs,z, amNumOffsetX, amNumOffsetY: LongInt;
  1644 begin
  1636 begin
  1645 {$IFNDEF MOBILE}
  1637 {$IFNDEF MOBILE}
  1646 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
  1638 if (not (CurrentTeam^.ExtDriven and isCursorVisible and (not bShowAmmoMenu))) and cHasFocus and (GameState <> gsConfirm) then
  1647     uCursor.updatePosition();
  1639     uCursor.updatePosition();
  1648 {$ENDIF}
  1640 {$ENDIF}
  1670 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then
  1662 if ((CursorPoint.X = prevPoint.X) and (CursorPoint.Y = prevpoint.Y)) then
  1671     exit;
  1663     exit;
  1672 
  1664 
  1673 if (AMState = AMShowingUp) or (AMState = AMShowing) then
  1665 if (AMState = AMShowingUp) or (AMState = AMShowing) then
  1674 begin
  1666 begin
  1675     if CursorPoint.X < AmmoRect.x + AMSlotSize then//check left
  1667 {$IFDEF USE_LANDSCAPE_AMMOMENU}
  1676         CursorPoint.X:= AmmoRect.x + AMSlotSize;
  1668     amNumOffsetX:= 0;
  1677     if CursorPoint.X > AmmoRect.x + AmmoRect.w then//check right
  1669     {$IFDEF USE_AM_NUMCOLUMN}
  1678         CursorPoint.X:= AmmoRect.x + AmmoRect.w;
  1670     amNumOffsetY:= AMSlotSize;
  1679     if CursorPoint.Y > cScreenHeight - AmmoRect.y then//check top
  1671     {$ELSE}
  1680         CursorPoint.Y:= cScreenHeight - AmmoRect.y;
  1672     amNumOffsetY:= 0;
  1681     if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 2) then//check bottom
  1673     {$ENDIF}
  1682         CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 2);
  1674 {$ELSE}
       
  1675     amNumOffsetY:= 0;
       
  1676     {$IFDEF USE_AM_NUMCOLUMN}
       
  1677     amNumOffsetX:= AMSlotSize;
       
  1678     {$ELSE}
       
  1679     amNumOffsetX:= 0;
       
  1680     {$ENDIF}
       
  1681 
       
  1682 {$ENDIF}
       
  1683     if CursorPoint.X < AmmoRect.x + amNumOffsetX + 3 then//check left 
       
  1684         CursorPoint.X:= AmmoRect.x + amNumOffsetX + 3;
       
  1685     if CursorPoint.X > AmmoRect.x + AmmoRect.w - 3 then//check right
       
  1686         CursorPoint.X:= AmmoRect.x + AmmoRect.w - 3;
       
  1687     if CursorPoint.Y > cScreenHeight - AmmoRect.y -amNumOffsetY - 1 then//check top
       
  1688         CursorPoint.Y:= cScreenHeight - AmmoRect.y - amNumOffsetY - 1;
       
  1689     if CursorPoint.Y < cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5) then//check bottom
       
  1690         CursorPoint.Y:= cScreenHeight - (AmmoRect.y + AmmoRect.h - AMSlotSize - 5);
  1683     prevPoint:= CursorPoint;
  1691     prevPoint:= CursorPoint;
  1684     //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
  1692     //if cHasFocus then SDL_WarpMouse(CursorPoint.X + cScreenWidth div 2, cScreenHeight - CursorPoint.Y);
  1685     exit
  1693     exit
  1686 end;
  1694 end;
  1687 
  1695