- Return of the F<numbers> in the ammomenu
authorXeli
Sat, 21 Apr 2012 17:55:45 +0200
changeset 6899 c3d44a836086
parent 6898 344b0dbd9690
child 6900 26873e68034f
- Return of the F<numbers> in the ammomenu - Cursor is now hiden on touch interfaces, rather than hidden on landscape ammomenu
hedgewars/options.inc
hedgewars/uWorld.pas
--- a/hedgewars/options.inc	Sat Apr 21 19:51:13 2012 +0400
+++ b/hedgewars/options.inc	Sat Apr 21 17:55:45 2012 +0200
@@ -65,6 +65,7 @@
 
 {$IFNDEF MOBILE}
     {$DEFINE PNG_SCREENSHOTS}
+    {$DEFINE USE_AM_NUMCOLUMN}
 {$ENDIF}
 
 //also available LUA_DISABLED
--- a/hedgewars/uWorld.pas	Sat Apr 21 19:51:13 2012 +0400
+++ b/hedgewars/uWorld.pas	Sat Apr 21 17:55:45 2012 +0200
@@ -381,6 +381,7 @@
     STurns: LongInt;
     amSurface: PSDL_Surface;
     AMRect: TSDL_Rect;
+    tmpsurf: PSDL_Surface;
 begin
     SlotsNum:= 0;
     for i:= 0 to cMaxSlotIndex do
@@ -389,11 +390,18 @@
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
     SlotsNumX:= SlotsNum;
     SlotsNumY:= cMaxSlotAmmoIndex + 2;
+    {$IFDEF USE_AM_NUMCOLUMN}
+    inc(SlotsNumY);
+    {$ENDIF}
 {$ELSE}
     SlotsNumX:= cMaxSlotAmmoIndex + 1;
     SlotsNumY:= SlotsNum + 1;
+    {$IFDEF USE_AM_NUMCOLUMN}
+    inc(SlotsNumX);
+    {$ENDIF}
 {$ENDIF}
 
+
     AmmoRect.w:= (BORDERSIZE*2) + (SlotsNumX * AMSlotSize) + (SlotsNumX-1);
     AmmoRect.h:= (BORDERSIZE*2) + (SlotsNumY * AMSlotSize) + (SlotsNumY-1);
     amSurface := SDL_CreateRGBSurface(SDL_SWSURFACE, AmmoRect.w, AmmoRect.h, 32, RMask, GMask, BMask, AMask);
@@ -415,6 +423,21 @@
 {$ELSE}
             x:= AMRect.x;
 {$ENDIF}
+{$IFDEF USE_AM_NUMCOLUMN}
+            tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar('F' + IntToStr(i)), cWhiteColorChannels);
+            copyToXY(tmpsurf, amSurface,
+                     x + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.w shr 1),
+                     y + AMSlotPadding + (AMSlotSize shr 1) - (tmpsurf^.h shr 1));
+
+            SDL_FreeSurface(tmpsurf);
+    {$IFDEF USE_LANDSCAPE_AMMOMENU}
+            y:= AMRect.y + AMSlotSize + 1;
+    {$ELSE}
+            x:= AMRect.x + AMSlotSize + 1;
+    {$ENDIF}
+{$ENDIF}
+
+
             for t:=0 to cMaxSlotAmmoIndex do
                 begin
                 if (Ammo^[i, t].Count > 0)  and (Ammo^[i, t].AmmoType <> amNothing) then
@@ -432,8 +455,8 @@
                         end
                     else //draw colored version
                         begin
-                            DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, 
-       						       y + AMSlotPadding, AMFrame);
+                        DrawSprite2Surf(sprAMAmmos, amSurface, x + AMSlotPadding, 
+                                                               y + AMSlotPadding, AMFrame);
                         end;
 {$IFDEF USE_LANDSCAPE_AMMOMENU}
 	    inc(y, AMSlotSize + 1); //the plus one is for the border
@@ -596,13 +619,17 @@
 
 Pos:= -1;
 Slot:= -1;
+{$IFDEF USE_LANDSCAPE_AMMOMENU}
 c:= -1;
-{$IFDEF USE_LANDSCAPE_AMMOMENU}
     for i:= 0 to cMaxSlotIndex do
         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
             begin
             inc(c);
+{$IFDEF USE_AM_NUMCOLUMN}
+            g:= 1;
+{$ELSE}
             g:= 0;
+{$ENDIF}
             for t:=0 to cMaxSlotAmmoIndex do
                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
                     begin
@@ -623,11 +650,20 @@
                    end;
             end;
 {$ELSE}
+{$IFDEF USE_AM_NUMCOLUMN}
+c:= 0;
+{$ELSE}
+c:= -1;
+{$ENDIF}
     for i:= 0 to cMaxSlotIndex do
         if ((i = 0) and (Ammo^[i, 1].Count > 0)) or ((i <> 0) and (Ammo^[i, 0].Count > 0)) then
             begin
             inc(c);
+{$IFDEF USE_AM_NUMCOLUMN}
+            g:= 1;
+{$ELSE}
             g:= 0;
+{$ENDIF}
             for t:=0 to cMaxSlotAmmoIndex do
                 if (Ammo^[i, t].Count > 0) and (Ammo^[i, t].AmmoType <> amNothing) then
                     begin
@@ -714,7 +750,7 @@
 {$ENDIF}
 
     bSelected:= false;
-{$IFNDEF USE_LANDSCAPE_AMMOMENU}
+{$IFNDEF USE_TOUCH_INTERFACE}
    if (AMShiftX = 0) and (AMShiftY = 0) then
         DrawSprite(sprArrow, CursorPoint.X, cScreenHeight - CursorPoint.Y, (RealTicks shr 6) mod 8);
 {$ENDIF}