Repair weapon name show in ammo menu
authorunc0rr
Sun, 13 Apr 2008 13:57:32 +0000
changeset 843 27b5180d0988
parent 842 fae2fae2fe8d
child 844 9a82149409f3
Repair weapon name show in ammo menu
hedgewars/uConsts.pas
hedgewars/uStore.pas
hedgewars/uWorld.pas
--- a/hedgewars/uConsts.pas	Sun Apr 13 12:47:18 2008 +0000
+++ b/hedgewars/uConsts.pas	Sun Apr 13 13:57:32 2008 +0000
@@ -392,6 +392,7 @@
 
       Ammoz: array [TAmmoType] of record
                                   NameId: TAmmoStrId;
+                                  NameTex: PTexture;
                                   Probability, NumberInCase: Longword;
                                   Ammo: TAmmo;
                                   Slot: 0..cMaxSlotIndex;
@@ -402,6 +403,7 @@
                                   PosSprite: TSprite;
                                   end = (
                                   (NameId: sidGrenade;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_Timerable or
@@ -419,6 +421,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidClusterBomb;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 3;
                                    Ammo: (Propz: ammoprop_Timerable or
@@ -436,6 +439,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidBazooka;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_Power;
@@ -452,6 +456,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidUFO;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_Power or
@@ -470,6 +475,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidShotgun;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_ForwMsgs;
@@ -486,6 +492,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidPickHammer;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_ForwMsgs or
@@ -505,6 +512,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidSkip;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_DontHold;
@@ -521,6 +529,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidRope;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 3;
                                    Ammo: (Propz: ammoprop_ForwMsgs or
@@ -539,6 +548,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidMine;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -556,6 +566,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidDEagle;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 2;
                                    Ammo: (Propz: 0;
@@ -572,6 +583,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidDynamite;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -590,6 +602,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidFirePunch;
+                                   NameTex: nil;
                                    Probability: 0;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -608,6 +621,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidBaseballBat;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_DontHold;
@@ -624,6 +638,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidParachute;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_ForwMsgs or
@@ -643,6 +658,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidAirAttack;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -662,6 +678,7 @@
                                    PosCount: 2;
                                    PosSprite: sprAmAirplane),
                                   (NameId: sidMineStrike;
+                                   NameTex: nil;
                                    Probability: 400;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -681,6 +698,7 @@
                                    PosCount: 2;
                                    PosSprite: sprAmAirplane),
                                   (NameId: sidBlowTorch;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 2;
                                    Ammo: (Propz: ammoprop_ForwMsgs;
@@ -697,6 +715,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidGirder;
+                                   NameTex: nil;
                                    Probability: 400;
                                    NumberInCase: 3;
                                    Ammo: (Propz: ammoprop_NoCrosshair or
@@ -716,6 +735,7 @@
                                    PosCount: 8;
                                    PosSprite: sprAmGirder),
                                   (NameId: sidTeleport;
+                                   NameTex: nil;
                                    Probability: 400;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_ForwMsgs or
@@ -736,6 +756,7 @@
                                    PosCount: 1;
                                    PosSprite: sprWater),
                                   (NameId: sidSwitch;
+                                   NameTex: nil;
                                    Probability: 100;
                                    NumberInCase: 1;
                                    Ammo: (Propz: ammoprop_ForwMsgs or
--- a/hedgewars/uStore.pas	Sun Apr 13 12:47:18 2008 +0000
+++ b/hedgewars/uStore.pas	Sun Apr 13 13:57:32 2008 +0000
@@ -118,6 +118,7 @@
 procedure StoreLoad;
 var ii: TSprite;
     fi: THWFont;
+    ai: TAmmoType;
     s: string;
     tmpsurf: PSDL_Surface;
 
@@ -295,6 +296,14 @@
 
 PauseTexture:= RenderStringTex(trmsg[sidPaused], $FFFF00, fntBig);
 
+for ai:= Low(TAmmoType) to High(TAmmoType) do
+	with Ammoz[ai] do
+		begin
+		tmpsurf:= TTF_RenderUTF8_Blended(Fontz[fnt16].Handle, Str2PChar(trAmmo[NameId]), $FFFFFF);
+		NameTex:= 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 12:47:18 2008 +0000
+++ b/hedgewars/uWorld.pas	Sun Apr 13 13:57:32 2008 +0000
@@ -132,7 +132,7 @@
      if (Pos >= 0) then
         if Ammo^[Slot, Pos].Count > 0 then
            begin
-           //DXOutText(AMxCurr + 10, cScreenHeight - 68, fnt16, trAmmo[Ammoz[Ammo^[Slot, Pos].AmmoType].NameId], Surface);
+           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);
            if bSelected then