hedgewars/uLandObjects.pas
changeset 12711 20dbb3a03e61
parent 12593 d6bd8b327a09
child 12758 49c31d8cc740
equal deleted inserted replaced
12710:1ab53b945140 12711:20dbb3a03e61
    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;
    38      , uPhysFSLayer, adler32;
    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';
   258     rr: TSDL_Rect;
   258     rr: TSDL_Rect;
   259     bRes: boolean;
   259     bRes: boolean;
   260 begin
   260 begin
   261 if girSurf = nil then
   261 if girSurf = nil then
   262     girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps);
   262     girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps);
       
   263 
       
   264 for y := 0 to girsurf^.h-1 do
       
   265     syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PLongWordArray(girsurf^.pixels)^[y*girsurf^.w], girsurf^.w);
   263 
   266 
   264 girderHeight:= girSurf^.h;
   267 girderHeight:= girSurf^.h;
   265 
   268 
   266 y:= topY+150;
   269 y:= topY+150;
   267 repeat
   270 repeat
   496 end;
   499 end;
   497 
   500 
   498 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
   501 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
   499 var s, key: shortstring;
   502 var s, key: shortstring;
   500     f: PFSFile;
   503     f: PFSFile;
   501     i: LongInt;
   504     i, y: LongInt;
   502     ii, t: Longword;
   505     ii, t: Longword;
   503     c2: TSDL_Color;
   506     c2: TSDL_Color;
   504 begin
   507 begin
   505 
   508 
   506 AddProgress;
   509 AddProgress;
   693             i:= Pos(',', s);
   696             i:= Pos(',', s);
   694             Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   697             Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   695             Delete(s, 1, i);
   698             Delete(s, 1, i);
   696             if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then
   699             if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then
   697                 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true);
   700                 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true);
       
   701             for y := 0 to Surf^.h-1 do
       
   702                 syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PLongWordArray(Surf^.pixels)^[y*Surf^.w], Surf^.w);
   698 
   703 
   699             inrectcnt := 0;
   704             inrectcnt := 0;
   700 
   705 
   701             for ii := 1 to Length(S) do
   706             for ii := 1 to Length(S) do
   702               if S[ii] = ',' then
   707               if S[ii] = ',' then