# HG changeset patch # User unc0rr # Date 1218398108 0 # Node ID 73ec31d8bb6fb36191104c3bc67f5fe0ac8bc072 # Parent f66cdbbfc4b6d2032cae0a4277f88fed13b632f2 Enable back rendering objects that are put on top of land texture diff -r f66cdbbfc4b6 -r 73ec31d8bb6f hedgewars/uConsts.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; diff -r f66cdbbfc4b6 -r 73ec31d8bb6f hedgewars/uLand.pas --- 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); diff -r f66cdbbfc4b6 -r 73ec31d8bb6f hedgewars/uLandObjects.pas --- 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;