74 if SDL_MustLock(Image) then |
74 if SDL_MustLock(Image) then |
75 SDLTry(SDL_LockSurface(Image) >= 0, true); |
75 SDLTry(SDL_LockSurface(Image) >= 0, true); |
76 |
76 |
77 bpp:= Image^.format^.BytesPerPixel; |
77 bpp:= Image^.format^.BytesPerPixel; |
78 TryDo(bpp = 4, 'Land object should be 32bit', true); |
78 TryDo(bpp = 4, 'Land object should be 32bit', true); |
|
79 |
79 p:= Image^.pixels; |
80 p:= Image^.pixels; |
80 |
|
81 for y:= 0 to Pred(Image^.h) do |
81 for y:= 0 to Pred(Image^.h) do |
82 begin |
82 begin |
83 for x:= 0 to Pred(Image^.w) do |
83 for x:= 0 to Pred(Image^.w) do |
84 if LandPixels[cpY + y, cpX + x] = 0 then |
84 if LandPixels[cpY + y, cpX + x] = 0 then |
85 begin |
85 begin |
86 LandPixels[cpY + y, cpX + x]:= PLongword(@(p^[x * 4]))^; |
86 LandPixels[cpY + y, cpX + x]:= p^[x]; |
87 if (PLongword(@(p^[x * 4]))^ and $FF000000) <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND; |
87 if (p^[x] and $FF000000) <> 0 then Land[cpY + y, cpX + x]:= COLOR_LAND; |
88 end; |
88 end; |
89 p:= @(p^[Image^.pitch]); |
89 p:= @(p^[Image^.pitch div 4]); |
90 end; |
90 end; |
91 |
91 |
92 if SDL_MustLock(Image) then |
92 if SDL_MustLock(Image) then |
93 SDL_UnlockSurface(Image); |
93 SDL_UnlockSurface(Image); |
94 WriteLnToConsole(msgOK) |
94 WriteLnToConsole(msgOK) |