Also, repair weapon count show in ammo menu
authorunc0rr
Sun, 13 Apr 2008 14:06:17 +0000
changeset 844 9a82149409f3
parent 843 27b5180d0988
child 845 ca72cf446ec2
Also, repair weapon count show in ammo menu
hedgewars/uConsts.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
--- a/hedgewars/uConsts.pas	Sun Apr 13 13:57:32 2008 +0000
+++ b/hedgewars/uConsts.pas	Sun Apr 13 14:06:17 2008 +0000
@@ -775,6 +775,8 @@
                                    PosCount: 1;
                                    PosSprite: sprWater));
 
+var CountTexz: array[1..9] of PTexture;
+
 implementation
 
 end.
--- a/hedgewars/uStore.pas	Sun Apr 13 13:57:32 2008 +0000
+++ b/hedgewars/uStore.pas	Sun Apr 13 14:06:17 2008 +0000
@@ -116,11 +116,7 @@
 end;
 
 procedure StoreLoad;
-var ii: TSprite;
-    fi: THWFont;
-    ai: TAmmoType;
-    s: string;
-    tmpsurf: PSDL_Surface;
+var s: string;
 
     procedure WriteNames(Font: THWFont);
     var t: LongInt;
@@ -163,7 +159,6 @@
     procedure MakeCrossHairs;
     var t: LongInt;
         tmpsurf, texsurf: PSDL_Surface;
-        s: string;
         Color, i: Longword;
     begin
     s:= Pathz[ptGraphics] + '/' + cCHFileName;
@@ -249,6 +244,11 @@
                             $FF000000
     end;
 
+var ii: TSprite;
+    fi: THWFont;
+    ai: TAmmoType;
+    tmpsurf: PSDL_Surface;
+    i: LongInt;
 begin
 for fi:= Low(THWFont) to High(THWFont) do
     with Fontz[fi] do
@@ -304,6 +304,13 @@
 		SDL_FreeSurface(tmpsurf)
 		end;
 
+for i:= Low(CountTexz) to High(CountTexz) do
+	begin
+	tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(IntToStr(i) + 'x'), $FFFFFF);
+	CountTexz[i]:= Surface2Tex(tmpsurf);
+	SDL_FreeSurface(tmpsurf)
+	end;
+
 {$IFDEF DUMP}
 SDL_SaveBMP_RW(LandSurface, SDL_RWFromFile('LandSurface.bmp', 'wb'), 1);
 SDL_SaveBMP_RW(StoreSurface, SDL_RWFromFile('StoreSurface.bmp', 'wb'), 1);
--- a/hedgewars/uWorld.pas	Sun Apr 13 13:57:32 2008 +0000
+++ b/hedgewars/uWorld.pas	Sun Apr 13 14:06:17 2008 +0000
@@ -134,7 +134,7 @@
            begin
            DrawTexture(AMxCurr + 10, cScreenHeight - 68, Ammoz[Ammo^[Slot, Pos].AmmoType].NameTex);
            if Ammo^[Slot, Pos].Count < 10 then
-              //DXOutText(AMxCurr + 175, cScreenHeight - 68, fnt16, chr(Ammo^[Slot, Pos].Count + 48) + 'x', Surface);
+              DrawTexture(AMxCurr + 175, cScreenHeight - 68, CountTexz[Ammo^[Slot, Pos].Count]);
            if bSelected then
               begin
               bShowAmmoMenu:= false;