# HG changeset patch # User unc0rr # Date 1201466140 0 # Node ID 788efc1d649fd4a28684ebb2fe8f469d6013b30c # Parent 2886dafa5bcf9ea44fccd05f28429322614ab3cc - Save 8 MB of memory by freeing LandSurface and not using it anymore after game initialization - Reanimate girder (and partly teleportation tool) diff -r 2886dafa5bcf -r 788efc1d649f hedgewars/uConsts.pas --- a/hedgewars/uConsts.pas Sun Jan 27 19:29:00 2008 +0000 +++ b/hedgewars/uConsts.pas Sun Jan 27 20:35:40 2008 +0000 @@ -239,101 +239,102 @@ FileName: String[31]; Path, AltPath: TPathType; Texture: PTexture; + Surface: PSDL_Surface; Width, Height: LongInt; - hasAlpha: boolean; + saveSurf: boolean; end = ( - (FileName: 'BlueWater'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 256; Height: 48; hasAlpha: false),// sprWater - (FileName: 'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; - Width: 256; Height:128; hasAlpha: false),// sprCloud - (FileName: 'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprBomb - (FileName: 'BigDigits'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: true),// sprBigDigit - (FileName: 'Frame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 4; Height: 32; hasAlpha: true),// sprFrame - (FileName: 'Lag'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 65; Height: 65; hasAlpha: true),// sprLag - (FileName: 'Arrow'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprCursor - (FileName: 'Grenade'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprGrenade - (FileName: 'Targetp'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprTargetP - (FileName: 'UFO'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprUFO - (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: true),// sprSmokeTrace - (FileName: 'RopeHook'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprRopeHook - (FileName: 'Expl50'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 64; Height: 64; hasAlpha: false),// sprExplosion50 - (FileName: 'MineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprMineOff - (FileName: 'MineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprMineOn - (FileName: 'Case'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprCase - (FileName: 'FirstAid'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 48; Height: 48; hasAlpha: false),// sprFAid - (FileName: 'dynamite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprDynamite - (FileName: 'Power'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: true),// sprPower - (FileName: 'ClBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprClusterBomb - (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprClusterParticle - (FileName: 'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 16; Height: 16; hasAlpha: false),// sprFlame - (FileName: 'horizont'; Path: ptCurrTheme; AltPath: ptNone; Texture: nil; - Width: 0; Height: 0; hasAlpha: false),// sprHorizont - (FileName: 'Sky'; Path: ptCurrTheme; AltPath: ptNone; Texture: nil; - Width: 0; Height: 0; hasAlpha: false),// sprSky - (FileName: 'BrdrLines'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 202; Height: 1; hasAlpha: false),// sprAMBorders - (FileName: 'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 202; Height: 33; hasAlpha: false),// sprAMSlot - (FileName: 'AmmoName'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 202; Height: 33; hasAlpha: false),// sprAMSlotName - (FileName: 'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprAMAmmos - (FileName: 'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprAMSlotKeys - (FileName: 'Selection'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprAMSelection - (FileName: 'Finger'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 48; hasAlpha: false),// sprFinger - (FileName: 'AirBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprAirBomb - (FileName: 'Airplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 125; Height: 42; hasAlpha: false),// sprAirplane - (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 64; Height: 32; hasAlpha: true),// sprAirplane - (FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 160; Height:160; hasAlpha: false),// sprAmGirder - (FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprHHTelepMask - (FileName: 'Switch'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: true),// sprSwitch - (FileName: 'Parachute'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 48; Height: 48; hasAlpha: true),// sprParachute - (FileName: 'Target'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprTarget - (FileName: 'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 6; Height: 6; hasAlpha: false),// sprRopeNode - (FileName: 'Console'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 256; Height:256; hasAlpha: false),// sprConsoleBG - (FileName: 'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 32; Height: 32; hasAlpha: false),// sprQuestion - (FileName: 'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 256; Height: 32; hasAlpha: false),// sprPowerBar - (FileName: 'WindBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 151; Height: 17; hasAlpha: false),// sprWindBar - (FileName: 'WindL'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 80; Height: 13; hasAlpha: false),// sprWindL - (FileName: 'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; - Width: 80; Height: 13; hasAlpha: false) // sprWindR + (FileName: 'BlueWater'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 256; Height: 48; saveSurf: false),// sprWater + (FileName: 'Clouds'; Path: ptCurrTheme;AltPath: ptGraphics; Texture: nil; Surface: nil; + Width: 256; Height:128; saveSurf: false),// sprCloud + (FileName: 'Bomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprBomb + (FileName: 'BigDigits'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprBigDigit + (FileName: 'Frame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 4; Height: 32; saveSurf: false),// sprFrame + (FileName: 'Lag'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 65; Height: 65; saveSurf: false),// sprLag + (FileName: 'Arrow'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprCursor + (FileName: 'Grenade'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprGrenade + (FileName: 'Targetp'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprTargetP + (FileName: 'UFO'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprUFO + (FileName: 'SmokeTrace'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprSmokeTrace + (FileName: 'RopeHook'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprRopeHook + (FileName: 'Expl50'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 64; saveSurf: false),// sprExplosion50 + (FileName: 'MineOff'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprMineOff + (FileName: 'MineOn'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprMineOn + (FileName: 'Case'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprCase + (FileName: 'FirstAid'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; saveSurf: false),// sprFAid + (FileName: 'dynamite'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprDynamite + (FileName: 'Power'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprPower + (FileName: 'ClBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprClusterBomb + (FileName: 'ClParticle'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprClusterParticle + (FileName: 'Flame'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 16; Height: 16; saveSurf: false),// sprFlame + (FileName: 'horizont'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; saveSurf: false),// sprHorizont + (FileName: 'Sky'; Path: ptCurrTheme;AltPath: ptNone; Texture: nil; Surface: nil; + Width: 0; Height: 0; saveSurf: false),// sprSky + (FileName: 'BrdrLines'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 202; Height: 1; saveSurf: false),// sprAMBorders + (FileName: 'Slot'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 202; Height: 33; saveSurf: false),// sprAMSlot + (FileName: 'AmmoName'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 202; Height: 33; saveSurf: false),// sprAMSlotName + (FileName: 'Ammos'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprAMAmmos + (FileName: 'SlotKeys'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprAMSlotKeys + (FileName: 'Selection'; Path: ptAmmoMenu; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprAMSelection + (FileName: 'Finger'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 48; saveSurf: false),// sprFinger + (FileName: 'AirBomb'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprAirBomb + (FileName: 'Airplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 125; Height: 42; saveSurf: false),// sprAirplane + (FileName: 'amAirplane'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 64; Height: 32; saveSurf: false),// sprAirplane + (FileName: 'amGirder'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 160; Height:160; saveSurf: true),// sprAmGirder + (FileName: 'hhMask'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: true),// sprHHTelepMask + (FileName: 'Switch'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprSwitch + (FileName: 'Parachute'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 48; Height: 48; saveSurf: false),// sprParachute + (FileName: 'Target'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprTarget + (FileName: 'RopeNode'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 6; Height: 6; saveSurf: false),// sprRopeNode + (FileName: 'Console'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 256; Height:256; saveSurf: false),// sprConsoleBG + (FileName: 'thinking'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 32; Height: 32; saveSurf: false),// sprQuestion + (FileName: 'PowerBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 256; Height: 32; saveSurf: false),// sprPowerBar + (FileName: 'WindBar'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 151; Height: 17; saveSurf: false),// sprWindBar + (FileName: 'WindL'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 80; Height: 13; saveSurf: false),// sprWindL + (FileName: 'WindR'; Path: ptGraphics; AltPath: ptNone; Texture: nil; Surface: nil; + Width: 80; Height: 13; saveSurf: false) // sprWindR ); Soundz: array[TSound] of record diff -r 2886dafa5bcf -r 788efc1d649f hedgewars/uLand.pas --- a/hedgewars/uLand.pas Sun Jan 27 19:29:00 2008 +0000 +++ b/hedgewars/uLand.pas Sun Jan 27 20:35:40 2008 +0000 @@ -640,6 +640,7 @@ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, @LandPixels[Y, 0]); end else begin + TryDo(LandSurface <> nil, 'Assert (LandSurface <> nil) failed', true); LandTexture:= Surface2Tex(LandSurface); if SDL_MustLock(LandSurface) then @@ -648,7 +649,10 @@ Move(LandSurface^.pixels^, LandPixels, 2048 * 1024 * 4); if SDL_MustLock(LandSurface) then - SDL_UnlockSurface(LandSurface) + SDL_UnlockSurface(LandSurface); + + SDL_FreeSurface(LandSurface); + LandSurface:= nil end; end; diff -r 2886dafa5bcf -r 788efc1d649f hedgewars/uLandGraphics.pas --- a/hedgewars/uLandGraphics.pas Sun Jan 27 19:29:00 2008 +0000 +++ b/hedgewars/uLandGraphics.pas Sun Jan 27 20:35:40 2008 +0000 @@ -281,53 +281,24 @@ end; function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean; -(*var X, Y, bpp, h, w: LongInt; +var X, Y, bpp, h, w: LongInt; p: PByteArray; r, rr: TSDL_Rect; - Image: PSDL_Surface;*) + Image: PSDL_Surface; begin -(*Image:= SpritesData[Obj].Surface; +TryDo(SpritesData[Obj].Surface <> nil, 'Assert SpritesData[Obj].Surface failed', true); +Image:= SpritesData[Obj].Surface; w:= SpritesData[Obj].Width; -h:= SpritesData[Obj].Height; +h:= SpritesData[Obj].Height; if SDL_MustLock(Image) then SDLTry(SDL_LockSurface(Image) >= 0, true); bpp:= Image^.format^.BytesPerPixel; -TryDo(bpp <> 1, 'We don''t work with 8 bit surfaces', true); -// Check that sprites fits free space +TryDo(bpp = 4, 'It should be 32 bpp sprite', true); +// Check that sprite fits free space p:= @(PByteArray(Image^.pixels)^[Image^.pitch * Frame * h]); case bpp of - 2: for y:= 0 to Pred(h) do - begin - for x:= 0 to Pred(w) do - if PWord(@(p^[x * 2]))^ <> 0 then - if (((cpY + y) and $FFFFFC00) <> 0) or - (((cpX + x) and $FFFFF800) <> 0) or - (Land[cpY + y, cpX + x] <> 0) then - begin - if SDL_MustLock(Image) then - SDL_UnlockSurface(Image); - exit(false) - end; - p:= @(p^[Image^.pitch]); - end; - 3: for y:= 0 to Pred(h) do - begin - for x:= 0 to Pred(w) do - if (p^[x * 3 + 0] <> 0) - or (p^[x * 3 + 1] <> 0) - or (p^[x * 3 + 2] <> 0) then - if (((cpY + y) and $FFFFFC00) <> 0) or - (((cpX + x) and $FFFFF800) <> 0) or - (Land[cpY + y, cpX + x] <> 0) then - begin - if SDL_MustLock(Image) then - SDL_UnlockSurface(Image); - exit(false) - end; - p:= @(p^[Image^.pitch]); - end; 4: for y:= 0 to Pred(h) do begin for x:= 0 to Pred(w) do @@ -345,43 +316,34 @@ end; TryPlaceOnLand:= true; -if not doPlace then exit; +if not doPlace then + begin + if SDL_MustLock(Image) then + SDL_UnlockSurface(Image); + exit + end; // Checked, now place p:= @(PByteArray(Image^.pixels)^[Image^.pitch * Frame * h]); case bpp of - 2: for y:= 0 to Pred(h) do - begin - for x:= 0 to Pred(w) do - if PWord(@(p^[x * 2]))^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND; - p:= @(p^[Image^.pitch]); - end; - 3: for y:= 0 to Pred(h) do - begin - for x:= 0 to Pred(w) do - if (p^[x * 3 + 0] <> 0) - or (p^[x * 3 + 1] <> 0) - or (p^[x * 3 + 2] <> 0) then Land[cpY + y, cpX + x]:= COLOR_LAND; - p:= @(p^[Image^.pitch]); - end; 4: for y:= 0 to Pred(h) do begin for x:= 0 to Pred(w) do - if PLongword(@(p^[x * 4]))^ <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND; + if PLongword(@(p^[x * 4]))^ <> 0 then + begin + Land[cpY + y, cpX + x]:= COLOR_LAND; + LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^ + end; p:= @(p^[Image^.pitch]); end; end; if SDL_MustLock(Image) then SDL_UnlockSurface(Image); -// Draw sprite on Land surface -r.x:= 0; -r.y:= SpritesData[Obj].Height * Frame; -r.w:= SpritesData[Obj].Width; -r.h:= SpritesData[Obj].Height; -rr.x:= cpX; -rr.y:= cpY; -SDL_UpperBlit(Image, @r, LandSurface, @rr)*) +y:= max(cpY, 0); +h:= min(cpY + Image^.h, 1023) - y; +addfilelog(inttostr(y) + ' <<<<<<<<>>>>>>>> '+inttostr(h)); +UpdateLandTexture(y, h) end; diff -r 2886dafa5bcf -r 788efc1d649f hedgewars/uStore.pas --- a/hedgewars/uStore.pas Sun Jan 27 19:29:00 2008 +0000 +++ b/hedgewars/uStore.pas Sun Jan 27 20:35:40 2008 +0000 @@ -268,17 +268,6 @@ end; AddProgress; -WriteToConsole('LandSurface tuning... '); -tmpsurf:= LandSurface; -TryDo(tmpsurf <> nil, msgFailed, true); -if cFullScreen then - begin - LandSurface:= SDL_DisplayFormat(tmpsurf); - SDL_FreeSurface(tmpsurf); - end else LandSurface:= tmpsurf; -TryDo(SDL_SetColorKey(LandSurface, SDL_SRCCOLORKEY, 0) = 0, errmsgTransparentSet, true); -WriteLnToConsole(msgOK); - GetExplosionBorderColor; AddProgress; @@ -291,16 +280,16 @@ with SpritesData[ii] do begin if AltPath = ptNone then - tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, hasAlpha, true, true) + tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, true, true, true) else begin - tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, hasAlpha, false, true); + tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, true, false, true); if tmpsurf = nil then - tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, hasAlpha, true, true) + tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, true, true, true) end; if Width = 0 then Width:= tmpsurf^.w; if Height = 0 then Height:= tmpsurf^.h; Texture:= Surface2Tex(tmpsurf); - SDL_FreeSurface(tmpsurf) + if saveSurf then Surface:= tmpsurf else SDL_FreeSurface(tmpsurf) end; GetSkyColor; @@ -487,7 +476,10 @@ var ii: TSprite; begin for ii:= Low(TSprite) to High(TSprite) do + begin FreeTexture(SpritesData[ii].Texture); + if SpritesData[ii].Surface <> nil then SDL_FreeSurface(SpritesData[ii].Surface) + end; FreeTexture(HHTexture); FreeTexture(LandTexture); diff -r 2886dafa5bcf -r 788efc1d649f share/hedgewars/Data/Graphics/amGirder.png Binary file share/hedgewars/Data/Graphics/amGirder.png has changed