hedgewars/uLand.pas
changeset 64 9df467527ae5
parent 57 e1a77ae57065
child 67 3101306251e5
equal deleted inserted replaced
63:27e2b5bb6d4b 64:9df467527ae5
   471 var tmpsurf: PSDL_Surface;
   471 var tmpsurf: PSDL_Surface;
   472     i: Longword;
   472     i: Longword;
   473 begin
   473 begin
   474 WriteLnToConsole('Generating land...');
   474 WriteLnToConsole('Generating land...');
   475 for i:= 0 to sizeof(Land) div 4 do
   475 for i:= 0 to sizeof(Land) div 4 do
   476     PLongword(Longword(@Land) + i * 4)^:= $FFFFFF;
   476     PLongword(Longword(@Land) + i * 4)^:= COLOR_LAND;
   477 GenBlank(EdgeTemplates[getrandom(Succ(High(EdgeTemplates)))]);
   477 GenBlank(EdgeTemplates[getrandom(Succ(High(EdgeTemplates)))]);
   478 
   478 
   479 AddProgress;
   479 AddProgress;
   480 with PixelFormat^ do
   480 with PixelFormat^ do
   481      tmpsurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, 2048, 1024, BitsPerPixel, RMask, GMask, BMask, 0);
   481      tmpsurf:= SDL_CreateRGBSurface(SDL_HWSURFACE, 2048, 1024, BitsPerPixel, RMask, GMask, BMask, 0);
   537 case LandSurface.format.BytesPerPixel of
   537 case LandSurface.format.BytesPerPixel of
   538      1: OutError('We don''t work with 8 bit surfaces', true);
   538      1: OutError('We don''t work with 8 bit surfaces', true);
   539      2: for y:= 0 to 1023 do
   539      2: for y:= 0 to 1023 do
   540             begin
   540             begin
   541             for x:= 0 to 2047 do
   541             for x:= 0 to 2047 do
   542                 if PWord(p + x * 2)^ <> 0 then PLongWord(i + x * 4)^:= $FFFFFF;
   542                 if PWord(p + x * 2)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
   543             inc(i, 2048 * 4);
   543             inc(i, 2048 * 4);
   544             inc(p, LandSurface.pitch);
   544             inc(p, LandSurface.pitch);
   545             end;
   545             end;
   546      3: for y:= 0 to 1023 do
   546      3: for y:= 0 to 1023 do
   547             begin
   547             begin
   548             for x:= 0 to 2047 do
   548             for x:= 0 to 2047 do
   549                 if  (PByte(p + x * 3 + 0)^ <> 0)
   549                 if  (PByte(p + x * 3 + 0)^ <> 0)
   550                  or (PByte(p + x * 3 + 1)^ <> 0)
   550                  or (PByte(p + x * 3 + 1)^ <> 0)
   551                  or (PByte(p + x * 3 + 2)^ <> 0) then PLongWord(i + x * 4)^:= $FFFFFF;
   551                  or (PByte(p + x * 3 + 2)^ <> 0) then PLongWord(i + x * 4)^:= COLOR_LAND;
   552             inc(i, 2048 * 4);
   552             inc(i, 2048 * 4);
   553             inc(p, LandSurface.pitch);
   553             inc(p, LandSurface.pitch);
   554             end;
   554             end;
   555      4: for y:= 0 to 1023 do
   555      4: for y:= 0 to 1023 do
   556             begin
   556             begin
   557             for x:= 0 to 2047 do
   557             for x:= 0 to 2047 do
   558                 if PLongword(p + x * 4)^ <> 0 then PLongWord(i + x * 4)^:= $FFFFFF;
   558                 if PLongword(p + x * 4)^ <> 0 then PLongWord(i + x * 4)^:= COLOR_LAND;
   559             inc(i, 2048 * 4);
   559             inc(i, 2048 * 4);
   560             inc(p, LandSurface.pitch);
   560             inc(p, LandSurface.pitch);
   561             end;
   561             end;
   562      end;
   562      end;
   563 if SDL_MustLock(LandSurface) then
   563 if SDL_MustLock(LandSurface) then