hedgewars/uLandObjects.pas
changeset 1753 2ccba26f1aa4
parent 1277 752b53481057
child 1773 bc6ad6136675
equal deleted inserted replaced
1752:769986d39202 1753:2ccba26f1aa4
   166 	until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i);
   166 	until (x1 < 100) or (k = 0) or (k = 16) or (x1 < i);
   167 	
   167 	
   168 	inc(x1, 2);
   168 	inc(x1, 2);
   169 	if k = 16 then
   169 	if k = 16 then
   170 		begin
   170 		begin
   171 		while (x2 < 1900) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2);
   171 		while (x2 < (LAND_WIDTH-150)) and (CountNonZeroz(x2, y) = 0) do inc(x2, 2);
   172 		i:= x2 + 12;
   172 		i:= x2 + 12;
   173 		repeat
   173 		repeat
   174 		inc(x2, 2);
   174 		inc(x2, 2);
   175 		k:= CountNonZeroz(x2, y)
   175 		k:= CountNonZeroz(x2, y)
   176 		until (x2 > 1900) or (k = 0) or (k = 16) or (x2 > i);
   176 		until (x2 > (LAND_WIDTH-150)) or (k = 0) or (k = 16) or (x2 > i);
   177 		if (x2 < 1900) and (k = 16) and (x2 - x1 > 250)
   177 		if (x2 < (LAND_WIDTH-150)) and (k = 16) and (x2 - x1 > 250)
   178 			and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break;
   178 			and not CheckIntersect(x1 - 32, y - 64, x2 - x1 + 64, 144) then break;
   179 		end;
   179 		end;
   180 x1:= 0;
   180 x1:= 0;
   181 until y > 900;
   181 until y > (LAND_HEIGHT-125);
   182 
   182 
   183 if x1 > 0 then
   183 if x1 > 0 then
   184 	begin
   184 	begin
   185 	Result:= true;
   185 	Result:= true;
   186 	tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Girder', false, false, true);
   186 	tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Girder', false, false, true);
   271                    y:= 5000;
   271                    y:= 5000;
   272                    x:= 5000;
   272                    x:= 5000;
   273                    end
   273                    end
   274                 end;
   274                 end;
   275              inc(y, 3);
   275              inc(y, 3);
   276          until y > 1023 - Height;
   276          until y > LAND_HEIGHT - Height;
   277          inc(x, getrandom(6) + 3)
   277          inc(x, getrandom(6) + 3)
   278      until x > 2047 - Width;
   278      until x > LAND_WIDTH - Width;
   279      Result:= cnt <> 0;
   279      Result:= cnt <> 0;
   280      if Result then
   280      if Result then
   281         begin
   281         begin
   282         i:= getrandom(cnt);
   282         i:= getrandom(cnt);
   283         BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, 0, Obj.Surf);
   283         BlitImageAndGenerateCollisionInfo(ar[i].x, ar[i].y, 0, Obj.Surf);
   420 Readln(f, vobCount);
   420 Readln(f, vobCount);
   421 if vobCount > 0 then
   421 if vobCount > 0 then
   422    Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed);
   422    Readln(f, vobFramesCount, vobFrameTicks, vobVelocity, vobFallSpeed);
   423 
   423 
   424 for i:= 0 to Pred(vobCount) do
   424 for i:= 0 to Pred(vobCount) do
   425     AddVisualGear( -cScreenWidth + random(cScreenWidth * 2 + 2048), random(1200) - 100, vgtFlake);
   425     AddVisualGear( -cScreenWidth + random(cScreenWidth * 2 + LAND_WIDTH), random(LAND_HEIGHT+200) - 100, vgtFlake);
   426 
   426 
   427 Close(f);
   427 Close(f);
   428 {$I+}
   428 {$I+}
   429 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true)
   429 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true)
   430 end;
   430 end;