hedgewars/uWorld.pas
changeset 165 9b9144948668
parent 162 4822f6face35
child 174 0b2c5b22f644
equal deleted inserted replaced
164:92cff18a3ab6 165:9b9144948668
    86 const MENUSPEED = 15;
    86 const MENUSPEED = 15;
    87 var x, y, i, t: integer;
    87 var x, y, i, t: integer;
    88     Slot, Pos: integer;
    88     Slot, Pos: integer;
    89 begin
    89 begin
    90 if (TurnTimeLeft = 0) or KbdKeyPressed then bShowAmmoMenu:= false;
    90 if (TurnTimeLeft = 0) or KbdKeyPressed then bShowAmmoMenu:= false;
    91 if      bShowAmmoMenu  and (AMxCurr > AMxLeft)      then dec(AMxCurr, MENUSPEED);
    91 if bShowAmmoMenu then
    92 if (not bShowAmmoMenu) and (AMxCurr < cScreenWidth) then inc(AMxCurr, MENUSPEED);
    92    begin
       
    93    if AMxCurr = cScreenWidth then prevPoint.X:= 0;
       
    94    if AMxCurr > AMxLeft then dec(AMxCurr, MENUSPEED);
       
    95    end else
       
    96    begin
       
    97    if AMxCurr = AMxLeft then
       
    98       begin
       
    99       CursorPoint.X:= cScreenWidth div 2;
       
   100       CursorPoint.Y:= cScreenHeight div 2;
       
   101       prevPoint:= CursorPoint;
       
   102       SDL_WarpMouse(CursorPoint.X, CursorPoint.Y)
       
   103       end;
       
   104    if AMxCurr < cScreenWidth then inc(AMxCurr, MENUSPEED);
       
   105    end;
    93 
   106 
    94 if CurrentTeam = nil then exit;
   107 if CurrentTeam = nil then exit;
    95 Slot:= 0;
   108 Slot:= 0;
    96 Pos:= -1;
   109 Pos:= -1;
    97 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
   110 with CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog] do
   135            DXOutText(AMxCurr + 10, cScreenHeight - 68, fnt16, trAmmo[Ammoz[Ammo[Slot, Pos].AmmoType].NameId], Surface);
   148            DXOutText(AMxCurr + 10, cScreenHeight - 68, fnt16, trAmmo[Ammoz[Ammo[Slot, Pos].AmmoType].NameId], Surface);
   136            if Ammo[Slot, Pos].Count < 10 then
   149            if Ammo[Slot, Pos].Count < 10 then
   137               DXOutText(AMxCurr + 175, cScreenHeight - 68, fnt16, chr(Ammo[Slot, Pos].Count + 48) + 'x', Surface);
   150               DXOutText(AMxCurr + 175, cScreenHeight - 68, fnt16, chr(Ammo[Slot, Pos].Count + 48) + 'x', Surface);
   138            if bSelected then
   151            if bSelected then
   139               begin
   152               begin
   140               CurSlot:= Slot;
   153               bShowAmmoMenu:= false;
   141               CurAmmo:= Pos;
   154               SetWeapon(Ammo[Slot, Pos].AmmoType);
   142               ApplyAmmoChanges(CurrentTeam.Hedgehogs[CurrentTeam.CurrHedgehog]);
   155               bSelected:= false;
   143               bShowAmmoMenu:= false
   156               exit
   144               end;
   157               end;
   145            end;
   158            end;
   146      end;
   159      end;
   147 
   160 
   148 bSelected:= false;
   161 bSelected:= false;
   149 DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface)
   162 if AMxLeft = AMxCurr then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8, Surface)
   150 end;
   163 end;
   151 
   164 
   152 procedure MoveCamera; forward;
   165 procedure MoveCamera; forward;
   153 
   166 
   154 procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);
   167 procedure DrawWorld(Lag: integer; Surface: PSDL_Surface);