--- a/hedgewars/uLand.pas Sun Jan 27 17:27:13 2008 +0000
+++ b/hedgewars/uLand.pas Sun Jan 27 18:39:02 2008 +0000
@@ -30,7 +30,7 @@
procedure GenMap;
function GenPreview: TPreview;
procedure CheckLandDigest(s: shortstring);
-procedure UpdateLandTexture;
+procedure UpdateLandTexture(Y, Height: LongInt);
implementation
uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO;
@@ -533,7 +533,7 @@
AddObjects(tmpsurf, LandSurface);
SDL_FreeSurface(tmpsurf);
-UpdateLandTexture;
+UpdateLandTexture(0, 1024);
AddProgress
end;
@@ -555,7 +555,7 @@
BlitImageAndGenerateCollisionInfo(1024, 0, tmpsurf, LandSurface);
SDL_FreeSurface(tmpsurf);
-UpdateLandTexture
+UpdateLandTexture(0, 1024)
end;
procedure LoadMap;
@@ -593,7 +593,7 @@
if SDL_MustLock(LandSurface) then
SDL_UnlockSurface(LandSurface);
-UpdateLandTexture
+UpdateLandTexture(0, 1024)
end;
procedure GenMap;
@@ -629,10 +629,23 @@
GenPreview:= Preview
end;
-procedure UpdateLandTexture;
+procedure UpdateLandTexture(Y, Height: LongInt);
+var p: pointer;
begin
-if LandTexture <> nil then FreeTexture(LandTexture);
-LandTexture:= Surface2Tex(LandSurface)
+if LandTexture <> nil then
+ begin
+ if SDL_MustLock(LandSurface) then
+ SDLTry(SDL_LockSurface(LandSurface) >= 0, true);
+
+ glBindTexture(GL_TEXTURE_2D, LandTexture^.id);
+
+ p:= @PByteArray(LandSurface^.pixels)^[LandSurface^.pitch * Y];
+ glTexSubImage2D(GL_TEXTURE_2D, 0, 0, Y, 2048, Height, GL_RGBA, GL_UNSIGNED_BYTE, p);
+
+ if SDL_MustLock(LandSurface) then
+ SDL_UnlockSurface(LandSurface);
+ end else
+ LandTexture:= Surface2Tex(LandSurface)
end;
initialization
--- a/hedgewars/uLandGraphics.pas Sun Jan 27 17:27:13 2008 +0000
+++ b/hedgewars/uLandGraphics.pas Sun Jan 27 18:39:02 2008 +0000
@@ -223,7 +223,7 @@
if SDL_MustLock(LandSurface) then
SDL_UnlockSurface(LandSurface);
-UpdateLandTexture
+UpdateLandTexture(Y - Radius, 2 * Radius)
end;
procedure DrawHLinesExplosions(ar: PRangeArray; Radius: LongInt; y, dY: LongInt; Count: Byte);
@@ -255,7 +255,7 @@
if SDL_MustLock(LandSurface) then
SDL_UnlockSurface(LandSurface);
-UpdateLandTexture
+//UpdateLandTexture
end;
//
@@ -323,7 +323,7 @@
if SDL_MustLock(LandSurface) then
SDL_UnlockSurface(LandSurface);
-UpdateLandTexture
+//UpdateLandTexture
end;
function TryPlaceOnLand(cpX, cpY: LongInt; Obj: TSprite; Frame: LongInt; doPlace: boolean): boolean;