188 end; |
188 end; |
189 |
189 |
190 procedure ColorizeLand(Surface: PSDL_Surface); |
190 procedure ColorizeLand(Surface: PSDL_Surface); |
191 var tmpsurf: PSDL_Surface; |
191 var tmpsurf: PSDL_Surface; |
192 r: TSDL_Rect; |
192 r: TSDL_Rect; |
|
193 y: LongWord; // stupid SDL 1.2 uses stupid SmallInt for y which limits us to 32767. But is even worse if LandTex is large, can overflow on 32767 map. |
193 begin |
194 begin |
194 tmpsurf:= LoadDataImage(ptCurrTheme, 'LandTex', ifCritical or ifIgnoreCaps); |
195 tmpsurf:= LoadDataImage(ptCurrTheme, 'LandTex', ifCritical or ifIgnoreCaps); |
195 r.y:= 0; |
196 r.y:= 0; |
196 while r.y < LAND_HEIGHT do |
197 y:= 0; |
197 begin |
198 while y < LAND_HEIGHT do |
|
199 begin |
198 r.x:= 0; |
200 r.x:= 0; |
199 while r.x < LAND_WIDTH do |
201 while r.x < LAND_WIDTH do |
200 begin |
202 begin |
201 SDL_UpperBlit(tmpsurf, nil, Surface, @r); |
203 SDL_UpperBlit(tmpsurf, nil, Surface, @r); |
202 inc(r.x, tmpsurf^.w) |
204 inc(r.x, tmpsurf^.w) |
203 end; |
205 end; |
204 inc(r.y, tmpsurf^.h) |
206 inc(y, tmpsurf^.h); |
205 end; |
207 r.y:= y |
|
208 end; |
206 SDL_FreeSurface(tmpsurf); |
209 SDL_FreeSurface(tmpsurf); |
207 |
210 |
208 // freed in freeModule() below |
211 // freed in freeModule() below |
209 LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); |
212 LandBackSurface:= LoadDataImage(ptCurrTheme, 'LandBackTex', ifIgnoreCaps or ifTransparent); |
210 if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); |
213 if (LandBackSurface <> nil) and GrayScale then Surface2GrayScale(LandBackSurface); |