hedgewars/uWorld.pas
changeset 6650 56a0b7bf6c15
parent 6648 025473a2c420
child 6652 b043665dea3d
equal deleted inserted replaced
6649:7f78e8a6db69 6650:56a0b7bf6c15
   282     AMRect.y:= BORDERSIZE;
   282     AMRect.y:= BORDERSIZE;
   283     AMRect.w:= AmmoRect.w - (BORDERSIZE*2);
   283     AMRect.w:= AmmoRect.w - (BORDERSIZE*2);
   284     AMRect.h:= AmmoRect.h - (BORDERSIZE*2);
   284     AMRect.h:= AmmoRect.h - (BORDERSIZE*2);
   285 
   285 
   286     SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0));
   286     SDL_FillRect(amSurface, @AMRect, SDL_MapRGB(amSurface^.format, 0,0,0));
   287 
       
   288     
   287     
   289     x:= 0;
   288     x:= AMRect.x;
   290     y:= 0;
   289     y:= AMRect.y;
   291     for i:= 0 to cMaxSlotIndex do
   290     for i:= 0 to cMaxSlotIndex do
   292         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   291         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   293             begin
   292             begin
   294 {$IFDEF MOBILE}
   293 {$IFDEF MOBILE}
   295             y:= 0;
   294             y:= AMRect.y;
   296 {$ELSE}
   295 {$ELSE}
   297             x:= 0;
   296             x:= AMRect.x;
   298 {$ENDIF}
   297 {$ENDIF}
   299             for t:=0 to cMaxSlotAmmoIndex do
   298             for t:=0 to cMaxSlotAmmoIndex do
   300                 begin
   299                 begin
   301                 if (Ammo^[i, t].Count > 0)  and (Ammo^[i, t].AmmoType <> amNothing) then
   300                 if (Ammo^[i, t].Count > 0)  and (Ammo^[i, t].AmmoType <> amNothing) then
   302                     begin
   301                     begin
   303                     STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   302                     STurns:= Ammoz[Ammo^[i, t].AmmoType].SkipTurns - CurrentTeam^.Clan^.TurnNumber;
   304                     AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1;
   303                     AMFrame:= LongInt(Ammo^[i,t].AmmoType) - 1;
   305                     if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining
   304                     if STurns >= 0 then //weapon not usable yet, draw grayed out with turns remaining
   306                         begin
   305                         begin
   307                         DrawSprite2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding + 1, 
   306                         DrawSprite2Surf(sprAMAmmosBW, amSurface, x + AMSlotPadding, 
   308                                                                  y + AMSlotPadding + 1, AMFrame);
   307                                                                  y + AMSlotPadding, AMFrame);
   309                         if STurns < 100 then
   308                         if STurns < 100 then
   310                             DrawSprite2Surf(sprTurnsLeft, amSurface, 
   309                             DrawSprite2Surf(sprTurnsLeft, amSurface, 
   311 			    	    x + AMSlotSize-16, 
   310 			    	    x + AMSlotSize-16, 
   312 				    y + AMSlotSize + 1 - 16, STurns);
   311 				    y + AMSlotSize + 1 - 16, STurns);
   313                         end
   312                         end
   314                     else //draw colored version
   313                     else //draw colored version
   315                         begin
   314                         begin
   316                             DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding + 1, 
   315                             DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, 
   317        						       y + AMSlotPadding + 1, AMFrame);
   316        						       y + AMSlotPadding, AMFrame);
   318                         end;
   317                         end;
   319 {$IFDEF MOBILE}
   318 {$IFDEF MOBILE}
   320 	    inc(y, AMSlotSize + 1); //the plus one is for the border
   319 	    inc(y, AMSlotSize + 1); //the plus one is for the border
   321 {$ELSE}
   320 {$ELSE}
   322 	    inc(x, AMSlotSize + 1);
   321 	    inc(x, AMSlotSize + 1);
   347 DrawLine2Surf(amSurface, BORDERSIZE, AMRect.h+BORDERSIZE+i, AMRect.w + BORDERSIZE, AMRect.h+BORDERSIZE+i,160,160,160);//bottom
   346 DrawLine2Surf(amSurface, BORDERSIZE, AMRect.h+BORDERSIZE+i, AMRect.w + BORDERSIZE, AMRect.h+BORDERSIZE+i,160,160,160);//bottom
   348 DrawLine2Surf(amSurface, i, BORDERSIZE, i, AMRect.h + BORDERSIZE,160,160,160);//left
   347 DrawLine2Surf(amSurface, i, BORDERSIZE, i, AMRect.h + BORDERSIZE,160,160,160);//left
   349 DrawLine2Surf(amSurface, AMRect.w+BORDERSIZE+i, BORDERSIZE, AMRect.w + BORDERSIZE+i, AMRect.h + BORDERSIZE, 160,160,160);//right
   348 DrawLine2Surf(amSurface, AMRect.w+BORDERSIZE+i, BORDERSIZE, AMRect.w + BORDERSIZE+i, AMRect.h + BORDERSIZE, 160,160,160);//right
   350 end;
   349 end;
   351 
   350 
   352   
       
   353 GetAmmoMenuTexture:= Surface2Tex(amSurface, false);
   351 GetAmmoMenuTexture:= Surface2Tex(amSurface, false);
   354 if amSurface <> nil then SDL_FreeSurface(amSurface);
   352 if amSurface <> nil then SDL_FreeSurface(amSurface);
   355 end;
   353 end;
   356 
   354 
   357 procedure ShowAmmoMenu;
   355 procedure ShowAmmoMenu;