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; |
|
42 |
41 |
43 // in your coding style, it appears to be "isXXXX" for a verb, and "FooBar" for everything else - should be PlayHeight ? |
42 // in your coding style, it appears to be "isXXXX" for a verb, and "FooBar" for everything else - should be PlayHeight ? |
44 |
43 |
45 procedure GenMap; |
44 procedure GenMap; |
46 function GenPreview: TPreview; |
45 function GenPreview: TPreview; |
47 procedure CheckLandDigest(s: shortstring); |
46 procedure CheckLandDigest(s: shortstring); |
48 function LandBackPixel(x, y: LongInt): LongWord; |
|
49 |
47 |
50 implementation |
48 implementation |
51 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; |
49 uses uConsole, uStore, uMisc, uRandom, uTeams, uLandObjects, uSHA, uIO, uAmmos, uLandTexture; |
52 |
50 |
53 type TPixAr = record |
51 type TPixAr = record |
309 end; |
307 end; |
310 end; |
308 end; |
311 end; |
309 end; |
312 end; |
310 end; |
313 |
311 |
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 |
|
326 procedure ColorizeLand(Surface: PSDL_Surface); |
312 procedure ColorizeLand(Surface: PSDL_Surface); |
327 var tmpsurf: PSDL_Surface; |
313 var tmpsurf: PSDL_Surface; |
328 r, rr: TSDL_Rect; |
314 r, rr: TSDL_Rect; |
329 x, yd, yu: LongInt; |
315 x, yd, yu: LongInt; |
330 begin |
316 begin |
339 inc(r.x, tmpsurf^.w) |
325 inc(r.x, tmpsurf^.w) |
340 end; |
326 end; |
341 inc(r.y, tmpsurf^.h) |
327 inc(r.y, tmpsurf^.h) |
342 end; |
328 end; |
343 SDL_FreeSurface(tmpsurf); |
329 SDL_FreeSurface(tmpsurf); |
344 |
|
345 LandBackSurface:= LoadImage(Pathz[ptCurrTheme] + '/LandBackTex', ifIgnoreCaps or ifTransparent); |
|
346 |
330 |
347 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
331 tmpsurf:= LoadImage(Pathz[ptCurrTheme] + '/Border', ifCritical or ifIgnoreCaps or ifTransparent); |
348 for x:= 0 to LAND_WIDTH - 1 do |
332 for x:= 0 to LAND_WIDTH - 1 do |
349 begin |
333 begin |
350 yd:= LAND_HEIGHT - 1; |
334 yd:= LAND_HEIGHT - 1; |