Enable back rendering objects that are put on top of land texture
authorunc0rr
Sun, 10 Aug 2008 19:55:08 +0000
changeset 1190 73ec31d8bb6f
parent 1189 f66cdbbfc4b6
child 1191 5539aa59f703
Enable back rendering objects that are put on top of land texture
hedgewars/uConsts.pas
hedgewars/uLand.pas
hedgewars/uLandObjects.pas
--- a/hedgewars/uConsts.pas	Sun Aug 10 15:03:53 2008 +0000
+++ b/hedgewars/uConsts.pas	Sun Aug 10 19:55:08 2008 +0000
@@ -126,7 +126,7 @@
 	cMaxAngle     = 2048;
 	cPowerDivisor = 1500;
 
-	MAXNAMELEN = 32;
+	MAXNAMELEN = 192;
 
 	COLOR_LAND = $00FFFFFF;
 
--- a/hedgewars/uLand.pas	Sun Aug 10 15:03:53 2008 +0000
+++ b/hedgewars/uLand.pas	Sun Aug 10 19:55:08 2008 +0000
@@ -534,6 +534,7 @@
 
 TryDo(tmpsurf <> nil, 'Error creating pre-land surface', true);
 ColorizeLand(tmpsurf);
+AddOnLandObjects(tmpsurf);
 
 LandSurface2LandPixels(tmpsurf);
 SDL_FreeSurface(tmpsurf);
--- a/hedgewars/uLandObjects.pas	Sun Aug 10 15:03:53 2008 +0000
+++ b/hedgewars/uLandObjects.pas	Sun Aug 10 19:55:08 2008 +0000
@@ -24,10 +24,11 @@
 procedure AddObjects();
 procedure LoadThemeConfig;
 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface);
+procedure AddOnLandObjects(Surface: PSDL_Surface);
 
 implementation
 uses uLand, uStore, uConsts, uMisc, uConsole, uRandom, uVisualGears, uFloat, GL, uSound;
-const MaxRects = 256;
+const MaxRects = 512;
       MAXOBJECTRECTS = 16;
       MAXTHEMEOBJECTS = 32;
 
@@ -297,46 +298,46 @@
 begin
 cnt:= 0;
 with Obj do
-     begin
-     if Maxcnt = 0 then
-        exit(false);
-     x:= 0;
-     r.x:= 0;
-     r.y:= 0;
-     r.w:= Width;
-     r.h:= Height + 16;
-     repeat
-         y:= 8;
-         repeat
-             if CheckLand(r, x, y - 8, $FFFFFF)
-                and not CheckIntersect(x, y, Width, Height) then
-                begin
-                ar[cnt].x:= x;
-                ar[cnt].y:= y;
-                inc(cnt);
-                if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
-                   begin
-                   y:= 5000;
-                   x:= 5000;
-                   end
-                end;
-             inc(y, 12);
-         until y > 1023 - Height - 8;
-         inc(x, getrandom(12) + 12)
-     until x > 2047 - Width;
-     Result:= cnt <> 0;
-     if Result then
-        begin
-        i:= getrandom(cnt);
-        r.x:= ar[i].X;
-        r.y:= ar[i].Y;
-        r.w:= Width;
-        r.h:= Height;
-        SDL_UpperBlit(Obj.Surf, nil, Surface, @r);
-        AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
-        dec(Maxcnt)
-        end else Maxcnt:= 0
-     end;
+	begin
+	if Maxcnt = 0 then
+		exit(false);
+	x:= 0;
+	r.x:= 0;
+	r.y:= 0;
+	r.w:= Width;
+	r.h:= Height + 16;
+	repeat
+		y:= 8;
+		repeat
+			if CheckLand(r, x, y - 8, $FFFFFF)
+			and not CheckIntersect(x, y, Width, Height) then
+			begin
+			ar[cnt].x:= x;
+			ar[cnt].y:= y;
+			inc(cnt);
+			if cnt > MaxPointsIndex then // buffer is full, do not check the rest land
+				begin
+				y:= 5000;
+				x:= 5000;
+				end
+			end;
+			inc(y, 12);
+		until y > 1023 - Height - 8;
+		inc(x, getrandom(12) + 12)
+	until x > 2047 - Width;
+	Result:= cnt <> 0;
+	if Result then
+		begin
+		i:= getrandom(cnt);
+		r.x:= ar[i].X;
+		r.y:= ar[i].Y;
+		r.w:= Width;
+		r.h:= Height;
+		SDL_UpperBlit(Obj.Surf, nil, Surface, @r);
+		AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
+		dec(Maxcnt)
+		end else Maxcnt:= 0
+	end;
 TryPut:= Result
 end;
 
@@ -461,8 +462,13 @@
 AddGirder(1792);
 AddThemeObjects(ThemeObjects, 8);
 AddProgress;
-{SDL_UpperBlit(InSurface, nil, Surface, nil);
-AddSprayObjects(Surface, SprayObjects, 10);}
+FreeRects
+end;
+
+procedure AddOnLandObjects(Surface: PSDL_Surface);
+begin
+InitRects;
+AddSprayObjects(Surface, SprayObjects, 12);
 FreeRects
 end;