hedgewars/uLandObjects.pas
changeset 2275 3f56c99a70f8
parent 2272 c59656d7b1de
child 2376 ece7b87f1334
equal deleted inserted replaced
2274:f413e41802d6 2275:3f56c99a70f8
   257     ar: array[0..MaxPointsIndex] of TPoint;
   257     ar: array[0..MaxPointsIndex] of TPoint;
   258     cnt, i: Longword;
   258     cnt, i: Longword;
   259     Result: boolean;
   259     Result: boolean;
   260 begin
   260 begin
   261 cnt:= 0;
   261 cnt:= 0;
       
   262 Obj.Maxcnt:= (Obj.Maxcnt * MaxHedgehogs) div 18;
   262 with Obj do
   263 with Obj do
   263      begin
   264      begin
   264      if Maxcnt = 0 then
   265      if Maxcnt = 0 then
   265         exit(false);
   266         exit(false);
   266      x:= 0;
   267      x:= 0;
   301     cnt, i: Longword;
   302     cnt, i: Longword;
   302     r: TSDL_Rect;
   303     r: TSDL_Rect;
   303     Result: boolean;
   304     Result: boolean;
   304 begin
   305 begin
   305 cnt:= 0;
   306 cnt:= 0;
       
   307 Obj.Maxcnt:= (Obj.Maxcnt * MaxHedgehogs) div 18;
   306 with Obj do
   308 with Obj do
   307 	begin
   309 	begin
   308 	if Maxcnt = 0 then
   310 	if Maxcnt = 0 then
   309 		exit(false);
   311 		exit(false);
   310 	x:= 0;
   312 	x:= 0;
   326 				y:= 5000;
   328 				y:= 5000;
   327 				x:= 5000;
   329 				x:= 5000;
   328 				end
   330 				end
   329 			end;
   331 			end;
   330 			inc(y, 12);
   332 			inc(y, 12);
   331 		until y > 1023 - Height - 8;
   333         until y > LAND_HEIGHT - 1 - Height - 8;
   332 		inc(x, getrandom(12) + 12)
   334 		inc(x, getrandom(12) + 12)
   333 	until x > 2047 - Width;
   335     until x > LAND_WIDTH - 1 - Width;
   334 	Result:= cnt <> 0;
   336 	Result:= cnt <> 0;
   335 	if Result then
   337 	if Result then
   336 		begin
   338 		begin
   337 		i:= getrandom(cnt);
   339 		i:= getrandom(cnt);
   338 		r.x:= ar[i].X;
   340 		r.x:= ar[i].X;
   492     repeat
   494     repeat
   493         AddGirder(i);
   495         AddGirder(i);
   494         i:=i+int;
   496         i:=i+int;
   495     until (i>rightX-int);
   497     until (i>rightX-int);
   496     end;
   498     end;
   497 AddThemeObjects(ThemeObjects, MaxHedgehogs div 2); // MaxHedgehogs should roughly correspond to available surface area.  Was also thinking maybe using playHeight * playWidth div constant   :)
   499 AddThemeObjects(ThemeObjects, (8 * MaxHedgehogs) div 18); // MaxHedgehogs should roughly correspond to available surface area.  Was also thinking maybe using playHeight * playWidth div constant   :)
   498 AddProgress;
   500 AddProgress;
   499 FreeRects
   501 FreeRects
   500 end;
   502 end;
   501 
   503 
   502 procedure AddOnLandObjects(Surface: PSDL_Surface);
   504 procedure AddOnLandObjects(Surface: PSDL_Surface);
   503 begin
   505 begin
   504 InitRects;
   506 InitRects;
   505 AddSprayObjects(Surface, SprayObjects, 12);
   507 //AddSprayObjects(Surface, SprayObjects, 12);
       
   508 AddSprayObjects(Surface, SprayObjects, (2 * MaxHedgehogs) div 3);
   506 FreeRects
   509 FreeRects
   507 end;
   510 end;
   508 
   511 
   509 procedure LoadThemeConfig;
   512 procedure LoadThemeConfig;
   510 begin
   513 begin