36 LandPixels: TLandArray; |
36 LandPixels: TLandArray; |
37 LandDirty: TDirtyTag; |
37 LandDirty: TDirtyTag; |
38 hasBorder: boolean; // I'm putting this here for now. I'd like it to be toggleable by user (so user can set a border on a non-cave map) - will turn off air attacks |
38 hasBorder: boolean; // I'm putting this here for now. I'd like it to be toggleable by user (so user can set a border on a non-cave map) - will turn off air attacks |
39 hasGirders: boolean; // I think should be on template by template basis. some caverns might have open water and large spaces. Some islands do not need? It might be better to tweak the girder code based upon space above. dunno. |
39 hasGirders: boolean; // I think should be on template by template basis. some caverns might have open water and large spaces. Some islands do not need? It might be better to tweak the girder code based upon space above. dunno. |
40 playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword; // idea is that a template can specify height/width. Or, a map, a height/width by the dimensions of the image. If the map has pixels near top of image, it triggers border. Maybe not a good idea, but, for now? Could also be used to prevent placing a girder outside play area on maps with hasBorder = true |
40 playHeight, playWidth, leftX, rightX, topY, MaxHedgehogs: Longword; // idea is that a template can specify height/width. Or, a map, a height/width by the dimensions of the image. If the map has pixels near top of image, it triggers border. Maybe not a good idea, but, for now? Could also be used to prevent placing a girder outside play area on maps with hasBorder = true |
|
41 LandBackSurface: PSDL_Surface; |
41 |
42 |
42 // in your coding style, it appears to be "isXXXX" for a verb, and "FooBar" for everything else - should be PlayHeight ? |
43 // in your coding style, it appears to be "isXXXX" for a verb, and "FooBar" for everything else - should be PlayHeight ? |
43 |
44 |
44 procedure GenMap; |
45 procedure GenMap; |
45 function GenPreview: TPreview; |
46 function GenPreview: TPreview; |
46 procedure CheckLandDigest(s: shortstring); |
47 procedure CheckLandDigest(s: shortstring); |
|
48 function LandBackPixel(x, y: LongInt): LongWord; |
47 |
49 |
48 implementation |
50 implementation |
49 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; |
51 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; |
50 |
52 |
51 type TPixAr = record |
53 type TPixAr = record |
307 end; |
309 end; |
308 end; |
310 end; |
309 end; |
311 end; |
310 end; |
312 end; |
311 |
313 |
|
314 function LandBackPixel(x, y: LongInt): LongWord; |
|
315 var p: PLongWordArray; |
|
316 begin |
|
317 if LandBackSurface = nil then |
|
318 begin |
|
319 LandBackPixel:= 0; |
|
320 exit; |
|
321 end; |
|
322 p:= LandBackSurface^.pixels; |
|
323 LandBackPixel:= p^[(LandBackSurface^.w) * (y mod LandBackSurface^.h) + (x mod LandBackSurface^.w)];// or $FF000000; |
|
324 end; |
|
325 |
312 procedure ColorizeLand(Surface: PSDL_Surface); |
326 procedure ColorizeLand(Surface: PSDL_Surface); |
313 var tmpsurf: PSDL_Surface; |
327 var tmpsurf: PSDL_Surface; |
314 r, rr: TSDL_Rect; |
328 r, rr: TSDL_Rect; |
315 x, yd, yu: LongInt; |
329 x, yd, yu: LongInt; |
316 begin |
330 begin |
325 inc(r.x, tmpsurf^.w) |
339 inc(r.x, tmpsurf^.w) |
326 end; |
340 end; |
327 inc(r.y, tmpsurf^.h) |
341 inc(r.y, tmpsurf^.h) |
328 end; |
342 end; |
329 SDL_FreeSurface(tmpsurf); |
343 SDL_FreeSurface(tmpsurf); |
|
344 |
|
345 LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
330 |
346 |
331 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
347 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
332 for x:= 0 to LAND_WIDTH - 1 do |
348 for x:= 0 to LAND_WIDTH - 1 do |
333 begin |
349 begin |
334 yd:= LAND_HEIGHT - 1; |
350 yd:= LAND_HEIGHT - 1; |