hedgewars/uStore.pas
changeset 4889 f71e30eb1d37
parent 4874 f508adb769b8
child 4894 efcea232bbf6
--- a/hedgewars/uStore.pas	Sun Jan 30 20:04:34 2011 +0100
+++ b/hedgewars/uStore.pas	Sun Jan 30 17:54:02 2011 -0500
@@ -39,6 +39,7 @@
 procedure RenderWeaponTooltip(atype: TAmmoType);
 procedure ShowWeaponTooltip(x, y: LongInt);
 procedure FreeWeaponTooltip;
+procedure MakeCrossHairs;
 
 implementation
 uses uMisc, uConsole, uMobile, uVariables, uUtils, uTextures, uRender, uRenderUtils, uCommands, uDebug;
@@ -75,6 +76,47 @@
 WriteInRect:= finalRect
 end;
 
+procedure MakeCrossHairs;
+var t: LongInt;
+    tmpsurf, texsurf: PSDL_Surface;
+    Color, i: Longword;
+    s : shortstring;
+begin
+s:= Pathz[ptGraphics] + '/' + cCHFileName;
+tmpsurf:= LoadImage(s, ifAlpha or ifCritical);
+
+for t:= 0 to Pred(TeamsCount) do
+    with TeamsArray[t]^ do
+    begin
+    texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, tmpsurf^.w, tmpsurf^.h, 32, RMask, GMask, BMask, AMask);
+    TryDo(texsurf <> nil, errmsgCreateSurface, true);
+
+    Color:= Clan^.Color;
+    Color:= SDL_MapRGB(texsurf^.format, Color shr 16, Color shr 8, Color and $FF);
+    SDL_FillRect(texsurf, nil, Color);
+
+    SDL_UpperBlit(tmpsurf, nil, texsurf, nil);
+
+    TryDo(tmpsurf^.format^.BytesPerPixel = 4, 'Ooops', true);
+
+    if SDL_MustLock(texsurf) then
+        SDLTry(SDL_LockSurface(texsurf) >= 0, true);
+
+    // make black pixel be alpha-transparent
+    for i:= 0 to texsurf^.w * texsurf^.h - 1 do
+        if PLongwordArray(texsurf^.pixels)^[i] = AMask then PLongwordArray(texsurf^.pixels)^[i]:= (RMask or GMask or BMask) and Color;
+
+    if SDL_MustLock(texsurf) then
+        SDL_UnlockSurface(texsurf);
+
+    if CrosshairTex <> nil then FreeTexture(CrosshairTex);
+    CrosshairTex:= Surface2Tex(texsurf, false);
+    SDL_FreeSurface(texsurf)
+    end;
+
+SDL_FreeSurface(tmpsurf)
+end;
+
 procedure StoreLoad;
 var s: shortstring;
 
@@ -152,7 +194,7 @@
             with Hedgehogs[i] do
                 if Gear <> nil then
                     begin
-                    NameTagTex:= RenderStringTex(Name, Clan^.Color, CheckCJKFont(Name,fnt16));
+                    NameTagTex:= RenderStringTex(Name, Clan^.Color, fnt16);
                     if Hat <> 'NoHat' then
                         begin
                         if (Length(Hat) > 39) and (Copy(Hat,1,8) = 'Reserved') and (Copy(Hat,9,32) = PlayerHash) then
@@ -177,45 +219,6 @@
         end;
     end;
 
-    procedure MakeCrossHairs;
-    var t: LongInt;
-        tmpsurf, texsurf: PSDL_Surface;
-        Color, i: Longword;
-    begin
-    s:= Pathz[ptGraphics] + '/' + cCHFileName;
-    tmpsurf:= LoadImage(s, ifAlpha or ifCritical);
-
-    for t:= 0 to Pred(TeamsCount) do
-        with TeamsArray[t]^ do
-        begin
-        texsurf:= SDL_CreateRGBSurface(SDL_SWSURFACE, tmpsurf^.w, tmpsurf^.h, 32, RMask, GMask, BMask, AMask);
-        TryDo(texsurf <> nil, errmsgCreateSurface, true);
-
-        Color:= Clan^.Color;
-        Color:= SDL_MapRGB(texsurf^.format, Color shr 16, Color shr 8, Color and $FF);
-        SDL_FillRect(texsurf, nil, Color);
-
-        SDL_UpperBlit(tmpsurf, nil, texsurf, nil);
-
-        TryDo(tmpsurf^.format^.BytesPerPixel = 4, 'Ooops', true);
-
-        if SDL_MustLock(texsurf) then
-            SDLTry(SDL_LockSurface(texsurf) >= 0, true);
-
-        // make black pixel be alpha-transparent
-        for i:= 0 to texsurf^.w * texsurf^.h - 1 do
-            if PLongwordArray(texsurf^.pixels)^[i] = AMask then PLongwordArray(texsurf^.pixels)^[i]:= (RMask or GMask or BMask) and Color;
-
-        if SDL_MustLock(texsurf) then
-            SDL_UnlockSurface(texsurf);
-
-        CrosshairTex:= Surface2Tex(texsurf, false);
-        SDL_FreeSurface(texsurf)
-        end;
-
-    SDL_FreeSurface(tmpsurf)
-    end;
-
     procedure InitHealth;
     var i, t: LongInt;
     begin