hedgewars/uWorld.pas
changeset 1529 3bc916b419cd
parent 1439 340c47ad5600
child 1595 33529f567d2d
equal deleted inserted replaced
1528:3fee15104c1d 1529:3bc916b419cd
    93 
    93 
    94 if CurrentTeam = nil then exit;
    94 if CurrentTeam = nil then exit;
    95 Slot:= 0;
    95 Slot:= 0;
    96 Pos:= -1;
    96 Pos:= -1;
    97 with CurrentHedgehog^ do
    97 with CurrentHedgehog^ do
    98      begin
    98 	begin
    99      if Ammo = nil then exit;
    99 	if Ammo = nil then exit;
   100      SlotsNum:= 0;
   100 	SlotsNum:= 0;
   101      x:= cScreenWidth - 210 + AMxShift;
   101 	x:= cScreenWidth - 210 + AMxShift;
   102      y:= cScreenHeight - 40;
   102 	y:= cScreenHeight - 40;
   103      dec(y);
   103 	dec(y);
   104      DrawSprite(sprAMBorders, x, y, 0);
   104 	DrawSprite(sprAMBorders, x, y, 0);
   105      dec(y);
   105 	dec(y);
   106      DrawSprite(sprAMBorders, x, y, 1);
   106 	DrawSprite(sprAMBorders, x, y, 1);
   107      dec(y, 33);
   107 	dec(y, 33);
   108      DrawSprite(sprAMSlotName, x, y, 0);
   108 	DrawSprite(sprAMSlotName, x, y, 0);
   109      for i:= cMaxSlotIndex downto 0 do
   109 	for i:= cMaxSlotIndex downto 0 do
   110          if Ammo^[i, 0].Count > 0 then
   110 		if Ammo^[i, 0].Count > 0 then
   111             begin
   111 			begin
   112             if (CursorPoint.Y >= y - 33) and (CursorPoint.Y < y) then Slot:= i;
   112 			if (CursorPoint.Y >= y - 33) and (CursorPoint.Y < y) then Slot:= i;
   113             dec(y, 33);
   113 			dec(y, 33);
   114             inc(SlotsNum);
   114 			inc(SlotsNum);
   115             DrawSprite(sprAMSlot, x, y, 0);
   115 			DrawSprite(sprAMSlot, x, y, 0);
   116             DrawSprite(sprAMSlotKeys, x + 2, y + 1, i);
   116 			DrawSprite(sprAMSlotKeys, x + 2, y + 1, i);
   117             t:= 0;
   117 			t:= 0;
   118             while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
   118 			while (t <= cMaxSlotAmmoIndex) and (Ammo^[i, t].Count > 0) do
   119                   begin
   119 				begin
   120                   l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   120 				l:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   121 
   121 
   122                   if l >= 0 then
   122 				if l >= 0 then
   123                      begin
   123 					begin
   124                      DrawSprite(sprAMAmmosBW, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType));
   124 					DrawSprite(sprAMAmmosBW, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType));
   125                      DrawSprite(sprTurnsLeft, x + t * 33 + 51, y + 17, l);
   125 					DrawSprite(sprTurnsLeft, x + t * 33 + 51, y + 17, l);
   126                      end else
   126 					end else
   127                      DrawSprite(sprAMAmmos, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType));
   127 					DrawSprite(sprAMAmmos, x + t * 33 + 35, y + 1, LongInt(Ammo^[i, t].AmmoType));
   128 
   128 
   129                   if (Slot = i) and (CursorPoint.X >= x + t * 33 + 35) and (CursorPoint.X < x + t * 33 + 68) then
   129 				if (Slot = i)
   130                      begin
   130 				and (CursorPoint.X >= x + t * 33 + 35)
   131                      DrawSprite(sprAMSelection, x + t * 33 + 35, y + 1, 0);
   131 				and (CursorPoint.X < x + t * 33 + 68) then
   132                      Pos:= t;
   132 					begin
   133                      end;
   133 					if (l < 0) then DrawSprite(sprAMSelection, x + t * 33 + 35, y + 1, 0);
   134                   inc(t)
   134 					Pos:= t;
   135                   end
   135 					end;
   136             end;
   136 				inc(t)
   137      dec(y, 1);
   137 				end
   138      DrawSprite(sprAMBorders, x, y, 0);
   138 			end;
   139 
   139 	dec(y, 1);
   140      if (Pos >= 0) then
   140 	DrawSprite(sprAMBorders, x, y, 0);
   141         if Ammo^[Slot, Pos].Count > 0 then
   141 
   142            begin
   142 	if (Pos >= 0) then
   143            DrawTexture(cScreenWidth - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   143 		if Ammo^[Slot, Pos].Count > 0 then
   144            if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   144 		begin
   145               DrawTexture(cScreenWidth + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   145 		DrawTexture(cScreenWidth - 200 + AMxShift, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   146            if bSelected then
   146 		
   147               begin
   147 		if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   148               bShowAmmoMenu:= false;
   148 			DrawTexture(cScreenWidth + AMxShift - 35, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
   149               SetWeapon(Ammo^[Slot, Pos].AmmoType);
   149 		
   150               bSelected:= false;
   150 		if bSelected and (Ammoz[Ammo^[Slot, Pos].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber < 0) then
   151               exit
   151 			begin
   152               end;
   152 			bShowAmmoMenu:= false;
   153            end;
   153 			SetWeapon(Ammo^[Slot, Pos].AmmoType);
   154      end;
   154 			bSelected:= false;
       
   155 			exit
       
   156 			end;
       
   157 		end;
       
   158 	end;
   155 
   159 
   156 bSelected:= false;
   160 bSelected:= false;
   157 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8)
   161 if AMxShift = 0 then DrawSprite(sprArrow, CursorPoint.X, CursorPoint.Y, (RealTicks shr 6) mod 8)
   158 end;
   162 end;
   159 
   163