hedgewars/uLandObjects.pas
changeset 12842 f72c6f64c94c
parent 12759 df9d9d19406a
child 12915 4d3b52f1ba18
equal deleted inserted replaced
12841:afd312fc270d 12842:f72c6f64c94c
    33 procedure SetLand(var LandWord: Word; Pixel: LongWord); inline;
    33 procedure SetLand(var LandWord: Word; Pixel: LongWord); inline;
    34 
    34 
    35 implementation
    35 implementation
    36 uses uStore, uConsts, uConsole, uRandom, uSound
    36 uses uStore, uConsts, uConsole, uRandom, uSound
    37      , uTypes, uVariables, uDebug, uUtils
    37      , uTypes, uVariables, uDebug, uUtils
    38      , uPhysFSLayer, adler32;
    38      , uPhysFSLayer, adler32, uRenderUtils;
    39 
    39 
    40 const MaxRects = 512;
    40 const MaxRects = 512;
    41       MAXOBJECTRECTS = 16;
    41       MAXOBJECTRECTS = 16;
    42       MAXTHEMEOBJECTS = 32;
    42       MAXTHEMEOBJECTS = 32;
    43       cThemeCFGFilename = 'theme.cfg';
    43       cThemeCFGFilename = 'theme.cfg';
   470             inc(y, 12);
   470             inc(y, 12);
   471         until y >= LAND_HEIGHT - Height - 8;
   471         until y >= LAND_HEIGHT - Height - 8;
   472         inc(x, getrandom(12) + 12)
   472         inc(x, getrandom(12) + 12)
   473     until x >= LAND_WIDTH - Width;
   473     until x >= LAND_WIDTH - Width;
   474     bRes:= cnt <> 0;
   474     bRes:= cnt <> 0;
   475 AddFileLog('CHECKPOINT 004');
       
   476     if bRes then
   475     if bRes then
   477         begin
   476         begin
   478         i:= getrandom(cnt);
   477         i:= getrandom(cnt);
   479         r.x:= ar[i].X;
   478         copyToXY(Obj.Surf, Surface, ar[i].X, ar[i].Y);
   480         r.y:= ar[i].Y;
       
   481         r.w:= Width;
       
   482         r.h:= Height;
       
   483         SDL_UpperBlit(Obj.Surf, nil, Surface, @r);
       
   484         AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
   479         AddRect(ar[i].x - 32, ar[i].y - 32, Width + 64, Height + 64);
   485         dec(Maxcnt)
   480         dec(Maxcnt)
   486         end
   481         end
   487     else Maxcnt:= 0
   482     else Maxcnt:= 0
   488     end;
   483     end;