hedgewars/uLand.pas
changeset 2243 b4764993f833
parent 2240 7ce9e6b7be3b
child 2244 853a1db1cff6
equal deleted inserted replaced
2242:2e8251933b71 2243:b4764993f833
    25 	GL,
    25 	GL,
    26 {$ENDIF}
    26 {$ENDIF}
    27 	uConsts;
    27 	uConsts;
    28 {$include options.inc}
    28 {$include options.inc}
    29 type TLandArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of LongWord;
    29 type TLandArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of LongWord;
       
    30 TCollisionArray = packed array[0 .. LAND_HEIGHT - 1, 0 .. LAND_WIDTH - 1] of Word;
    30 	TPreview  = packed array[0..127, 0..31] of byte;
    31 	TPreview  = packed array[0..127, 0..31] of byte;
    31 	TDirtyTag = packed array[0 .. LAND_HEIGHT div 32 - 1, 0 .. LAND_WIDTH div 32 - 1] of byte;
    32 	TDirtyTag = packed array[0 .. LAND_HEIGHT div 32 - 1, 0 .. LAND_WIDTH div 32 - 1] of byte;
    32 
    33 
    33 var  Land: TLandArray;
    34 var  Land: TCollisionArray;
    34      LandPixels: TLandArray;
    35      LandPixels: TLandArray;
    35      LandDirty: TDirtyTag;
    36      LandDirty: TDirtyTag;
    36      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
    37      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
    37      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.
    38      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.
    38      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
    39      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
   653         begin
   654         begin
   654         for x:= 0 to Pred(tmpsurf^.w) do
   655         for x:= 0 to Pred(tmpsurf^.w) do
   655             begin
   656             begin
   656             if (($FF000000 and p^[x]) = 0) then  // Tiy was having trouble generating transparent black
   657             if (($FF000000 and p^[x]) = 0) then  // Tiy was having trouble generating transparent black
   657                 Land[cpY + y, cpX + x]:= 0
   658                 Land[cpY + y, cpX + x]:= 0
   658             else    
   659             else if p^[x] = $FF0000FF then  
   659                 Land[cpY + y, cpX + x]:= p^[x];
   660                 Land[cpY + y, cpX + x]:= COLOR_INDESTRUCTIBLE
       
   661             else if p^[x] = $FFFFFFFF then
       
   662                 Land[cpY + y, cpX + x]:= COLOR_LAND;
       
   663 
   660             end;
   664             end;
   661         p:= @(p^[tmpsurf^.pitch div 4]);
   665         p:= @(p^[tmpsurf^.pitch div 4]);
   662         end;
   666         end;
   663   
   667   
   664     if SDL_MustLock(tmpsurf) then
   668     if SDL_MustLock(tmpsurf) then