321 if Land[i, x] <> 0 then |
321 if Land[i, x] <> 0 then |
322 inc(lRes); |
322 inc(lRes); |
323 CountNonZeroz:= lRes; |
323 CountNonZeroz:= lRes; |
324 end; |
324 end; |
325 |
325 |
|
326 procedure ChecksumLandObjectImage(Image: PSDL_Surface); |
|
327 var y: LongInt; |
|
328 begin |
|
329 if Image = nil then exit; |
|
330 |
|
331 if SDL_MustLock(Image) then |
|
332 SDL_LockSurface(Image); |
|
333 |
|
334 if checkFails(Image^.format^.BytesPerPixel = 4, 'Land object image should be 32bit', true) then |
|
335 begin |
|
336 if SDL_MustLock(Image) then |
|
337 SDL_UnlockSurface(Image); |
|
338 exit |
|
339 end; |
|
340 |
|
341 for y := 0 to Image^.h-1 do |
|
342 syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(Image^.pixels)^[y*Image^.pitch], Image^.w*4); |
|
343 |
|
344 if SDL_MustLock(Image) then |
|
345 SDL_UnlockSurface(Image); |
|
346 end; |
|
347 |
326 function AddGirder(gX: LongInt; var girSurf: PSDL_Surface): boolean; |
348 function AddGirder(gX: LongInt; var girSurf: PSDL_Surface): boolean; |
327 var x1, x2, y, k, i, girderHeight: LongInt; |
349 var x1, x2, y, k, i, girderHeight: LongInt; |
328 rr: TSDL_Rect; |
350 rr: TSDL_Rect; |
329 bRes: boolean; |
351 bRes: boolean; |
330 begin |
352 begin |
331 if girSurf = nil then |
353 if girSurf = nil then |
332 girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps); |
354 girSurf:= LoadDataImageAltPath(ptCurrTheme, ptGraphics, 'Girder', ifCritical or ifColorKey or ifIgnoreCaps); |
333 |
355 |
334 for y := 0 to girsurf^.h-1 do |
356 ChecksumLandObjectImage(girsurf); |
335 syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(girsurf^.pixels)^[y*girsurf^.pitch], girsurf^.w*4); |
|
336 |
357 |
337 girderHeight:= girSurf^.h; |
358 girderHeight:= girSurf^.h; |
338 |
359 |
339 y:= topY+150; |
360 y:= topY+150; |
340 repeat |
361 repeat |
669 if i = 0 then i:= Succ(Length(S)); |
690 if i = 0 then i:= Succ(Length(S)); |
670 Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifColorKey or ifIgnoreCaps or ifCritical); |
691 Surf:= LoadDataImage(ptCurrTheme, Trim(Copy(s, 1, Pred(i))), ifColorKey or ifIgnoreCaps or ifCritical); |
671 Width:= Surf^.w; |
692 Width:= Surf^.w; |
672 Height:= Surf^.h; |
693 Height:= Surf^.h; |
673 Delete(s, 1, i); |
694 Delete(s, 1, i); |
|
695 ChecksumLandObjectImage(Surf); |
674 end; |
696 end; |
675 end; |
697 end; |
676 |
698 |
677 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
699 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects); |
678 var s, key, nameRef: shortstring; |
700 var s, key, nameRef: shortstring; |
877 i:= Pos(',', s); |
899 i:= Pos(',', s); |
878 Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
900 Maxcnt:= StrToInt(Trim(Copy(s, 1, Pred(i)))); |
879 Delete(s, 1, i); |
901 Delete(s, 1, i); |
880 if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then |
902 if (Maxcnt < 1) or (Maxcnt > MAXTHEMEOBJECTS) then |
881 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true); |
903 OutError('Object''s max count should be between 1 and '+ inttostr(MAXTHEMEOBJECTS) +' (it was '+ inttostr(Maxcnt) +').', true); |
882 for y := 0 to Surf^.h-1 do |
904 ChecksumLandObjectImage(Surf); |
883 syncedPixelDigest:= Adler32Update(syncedPixelDigest, @PByteArray(Surf^.pixels)^[y*Surf^.pitch], Surf^.w*4); |
905 ChecksumLandObjectImage(Mask); |
884 |
906 |
885 inrectcnt := 0; |
907 inrectcnt := 0; |
886 |
908 |
887 for ii := 1 to Length(S) do |
909 for ii := 1 to Length(S) do |
888 if S[ii] = ',' then |
910 if S[ii] = ',' then |