hedgewars/uWorld.pas
changeset 6608 9305a12f66bf
parent 6607 ae523c0e8e54
child 6609 5861b2cc991f
equal deleted inserted replaced
6607:ae523c0e8e54 6608:9305a12f66bf
   205     begin
   205     begin
   206     AMxOffset:= 0;
   206     AMxOffset:= 0;
   207     AMyOffset:= AMSlotSize * 2;
   207     AMyOffset:= AMSlotSize * 2;
   208     end;
   208     end;
   209 //aligns it to the bottom of the screen, minus the border
   209 //aligns it to the bottom of the screen, minus the border
   210 AMShiftTarget:= ((cMaxSlotAmmoIndex + 1) * AMSlotSize) + AMyOffset;
   210 AMShiftTarget:= ((cMaxSlotAmmoIndex + 2) * AMSlotSize) + AMyOffset;
   211 AMShift:= AMShiftTarget;
   211 AMShift:= AMShiftTarget;
   212 {$ELSE}
   212 {$ELSE}
   213 AMxOffset:= 10;
   213 AMxOffset:= 10;
   214 AMyOffset:= 60;
   214 AMyOffset:= 60;
   215 AMShiftTarget:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   215 AMShiftTarget:= (cMaxSlotAmmoIndex + 2) * AMSlotSize + AMxOffset;
   306 
   306 
   307     x:= AMxOffset - ((SlotsNum * AMSlotSize) shr 1);
   307     x:= AMxOffset - ((SlotsNum * AMSlotSize) shr 1);
   308     y:= cScreenHeight - AMShiftTarget + AMShift;
   308     y:= cScreenHeight - AMShiftTarget + AMShift;
   309     dec(x, BORDERSIZE);
   309     dec(x, BORDERSIZE);
   310     DrawSprite(sprAMCorners, x, y - BORDERSIZE, 0);//top left corner
   310     DrawSprite(sprAMCorners, x, y - BORDERSIZE, 0);//top left corner
   311     for i:= 0 to cMaxSlotAmmoIndex do
   311     for i:= 0 to cMaxSlotAmmoIndex +1 do
   312         DrawSprite(sprAMBorderVertical, x, y + i * AMSlotSize, 0);
   312         DrawSprite(sprAMBorderVertical, x, y + i * AMSlotSize, 0);
   313     DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize) , 2);
   313     DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+2) * AMSlotSize) , 2);//bottom left corner
   314     inc(x, BORDERSIZE);
   314     inc(x, BORDERSIZE);
   315 
   315 
       
   316     for i:= 0 to SlotsNum -2 do
       
   317         DrawSprite(sprAMSlot, x + i * AMSlotSize, y, 2);
       
   318     DrawSprite(sprAMSlot, x + (SlotsNum-1) * AMSlotSize, y, 1);
       
   319 
       
   320     inc(y, AMSlotSize);
   316     for i:= 0 to cMaxSlotIndex do
   321     for i:= 0 to cMaxSlotIndex do
   317         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   322         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
   318             begin
   323             begin
   319             if (CursorPoint.X >= x) and (CursorPoint.X <= x + AMSlotSize) then
   324             if (CursorPoint.X >= x) and (CursorPoint.X <= x + AMSlotSize) then
   320                 Slot:= i;
   325                 Slot:= i;
   321             DrawSprite(sprAMBorderHorizontal, x, y - BORDERSIZE, 0);
   326             DrawSprite(sprAMBorderHorizontal, x, y - BORDERSIZE - AMSlotSize, 0);
   322             g:= 0;
   327             g:= 0;
       
   328             
   323             for t:=0 to cMaxSlotAmmoIndex do
   329             for t:=0 to cMaxSlotAmmoIndex do
   324                 begin
   330                 begin
   325                 DrawSprite(sprAMSlot, x, y + t * AMSlotSize, 1);
   331                 DrawSprite(sprAMSlot, x, y + t * AMSlotSize, 1);
   326                 if (Ammo^[i, t].Count > 0) then
   332                 if (Ammo^[i, t].Count > 0) then
   327                     begin
   333                     begin
   353             end;
   359             end;
   354 
   360 
   355     DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 3); //bottom right corner
   361     DrawSprite(sprAMCorners, x, y + ((cMaxSlotAmmoIndex+1) * AMSlotSize), 3); //bottom right corner
   356     DrawSprite(sprAMCorners, x - BORDERSIZE, y + (AMSlotSize * cMaxSlotAmmoIndex), 1);//top right  corner
   362     DrawSprite(sprAMCorners, x - BORDERSIZE, y + (AMSlotSize * cMaxSlotAmmoIndex), 1);//top right  corner
   357 
   363 
   358     for i:= 0 to cMaxSlotAmmoIndex do
   364     dec(y, AMSlotSize);
       
   365     for i:= 0 to cMaxSlotAmmoIndex + 1 do
   359         DrawSprite(sprAMBorderVertical, x,y + i * AMSlotSize, 1);
   366         DrawSprite(sprAMBorderVertical, x,y + i * AMSlotSize, 1);
       
   367     inc(y, AMSlotSize);
   360 {$ELSE}
   368 {$ELSE}
   361     Slot:= 0;
   369     Slot:= 0;
   362     x:= (cScreenWidth shr 1) - AMShiftTarget + AMShift;
   370     x:= (cScreenWidth shr 1) - AMShiftTarget + AMShift;
   363     y:= cScreenHeight - AMyOffset;
   371     y:= cScreenHeight - AMyOffset;
   364     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   372     DrawSprite(sprAMCorners, x - BORDERSIZE, y, 2);
   430                 amSel:= Ammo^[Slot, Pos].AmmoType;
   438                 amSel:= Ammo^[Slot, Pos].AmmoType;
   431                 RenderWeaponTooltip(amSel)
   439                 RenderWeaponTooltip(amSel)
   432                 end;
   440                 end;
   433 
   441 
   434 {$IFDEF MOBILE}
   442 {$IFDEF MOBILE}
   435             DrawTexture(AMxOffset - ((SlotsNum * AMSlotSize) shr 1) + (AMSlotSize shr 1), cScreenHeight - AMShiftTarget + AMShift - (AMSlotSize shr 1), Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   443             DrawTexture(AMxOffset - ((SlotsNum * AMSlotSize) shr 1) + (AMSlotSize shr 1),
       
   444                         cScreenHeight - AMShiftTarget + AMShift + (Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h shr 1),
       
   445                         Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   436             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   446             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   437                 DrawTexture(AMxOffset - ((SlotsNum * AMSlotSize) shr 1) + Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.w + 25, cScreenHeight - AMShiftTarget + AMShift - (AMSlotSize shr 1), CountTexz[Ammo^[Slot, Pos].Count]);
   447                 DrawTexture(AMxOffset + ((SlotsNum * AMSlotSize) shr 1) - Round(Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h * 1.5),
       
   448                             cScreenHeight - AMShiftTarget + AMShift + (Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex^.h shr 1),
       
   449                             CountTexz[Ammo^[Slot, Pos].Count]);
   438 {$ELSE}
   450 {$ELSE}
   439             DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + AMShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   451             DrawTexture(cScreenWidth div 2 - (AMShiftTarget - 10) + AMShift, cScreenHeight - AMyOffset - 25, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
   440             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   452             if Ammo^[Slot, Pos].Count < AMMO_INFINITE then
   441                 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   453                 DrawTexture(cScreenWidth div 2 + AMxOffset - 45, cScreenHeight - AMyOffset - 25, CountTexz[Ammo^[Slot, Pos].Count]);
   442 {$ENDIF}
   454 {$ENDIF}
  1307 {$IFDEF MOBILE}
  1319 {$IFDEF MOBILE}
  1308     if CursorPoint.X < AMxOffset - ((SlotsNum * AMSlotSize) shr 1) then//check left 
  1320     if CursorPoint.X < AMxOffset - ((SlotsNum * AMSlotSize) shr 1) then//check left 
  1309         CursorPoint.X:= AMxOffset - ((SlotsNum* AMSlotSize) shr 1);
  1321         CursorPoint.X:= AMxOffset - ((SlotsNum* AMSlotSize) shr 1);
  1310     if CursorPoint.X > (AMxOffset + (SlotsNum * AMSlotSize) shr 1) then//check right
  1322     if CursorPoint.X > (AMxOffset + (SlotsNum * AMSlotSize) shr 1) then//check right
  1311         CursorPoint.X:= (AMxOffset + (SlotsNum * AMSlotSize) shr 1);
  1323         CursorPoint.X:= (AMxOffset + (SlotsNum * AMSlotSize) shr 1);
  1312     if CursorPoint.Y > (AMShiftTarget + AMShift) then//check top
  1324     if CursorPoint.Y > (AMShiftTarget + AMShift - AMSlotSize) then//check top
  1313         CursorPoint.Y:= AMShiftTarget + AMShift;
  1325         CursorPoint.Y:= AMShiftTarget + AMShift - AMSlotSize;
  1314     if CursorPoint.Y < (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+1) * AMSlotSize) then//check bottom
  1326     if CursorPoint.Y < (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+2) * AMSlotSize) then//check bottom
  1315         CursorPoint.Y:= (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+1) * AMSlotSize);
  1327         CursorPoint.Y:= (AMShiftTarget + AMShift) - ((cMaxSlotAmmoIndex+2) * AMSlotSize);
  1316 {$ELSE}
  1328 {$ELSE}
  1317     if CursorPoint.X < cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize then
  1329     if CursorPoint.X < cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize then
  1318         CursorPoint.X:= cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize;
  1330         CursorPoint.X:= cScreenWidth div 2 + AMShift - AMShiftTarget + AMSlotSize;
  1319     if CursorPoint.X > cScreenWidth div 2 + AMShift - AMxOffset then
  1331     if CursorPoint.X > cScreenWidth div 2 + AMShift - AMxOffset then
  1320         CursorPoint.X:= cScreenWidth div 2 + AMShift - AMxOffset;
  1332         CursorPoint.X:= cScreenWidth div 2 + AMShift - AMxOffset;