hedgewars/uLand.pas
changeset 3697 d5b30d6373fc
parent 3632 8e1bd8b5780e
child 3836 833c0f32e326
equal deleted inserted replaced
3695:c11abf387a7d 3697:d5b30d6373fc
    21 unit uLand;
    21 unit uLand;
    22 interface
    22 interface
    23 uses SDLh, uLandTemplates, uFloat, uConsts, GLunit;
    23 uses SDLh, uLandTemplates, uFloat, uConsts, GLunit;
    24 
    24 
    25 type
    25 type
    26     TLandArray = packed array of array of LongWord; 
    26     TLandArray = packed array of array of LongWord;
    27     TCollisionArray = packed array of array of Word;
    27     TCollisionArray = packed array of array of Word;
    28     TPreview  = packed array[0..127, 0..31] of byte;
    28     TPreview  = packed array[0..127, 0..31] of byte;
    29     TDirtyTag = packed array of array of byte;
    29     TDirtyTag = packed array of array of byte;
    30 
    30 
    31 var Land: TCollisionArray;
    31 var Land: TCollisionArray;
    32     LandPixels: TLandArray;
    32     LandPixels: TLandArray;
    33     LandDirty: TDirtyTag;
    33     LandDirty: TDirtyTag;
    34     hasBorder: boolean; 
    34     hasBorder: boolean;
    35     hasGirders: boolean;  
    35     hasGirders: boolean;
    36     isMap: boolean;  
    36     isMap: boolean;
    37     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.
    37     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.
    38     LandBackSurface: PSDL_Surface;
    38     LandBackSurface: PSDL_Surface;
    39     digest: shortstring;
    39     digest: shortstring;
    40 
    40 
    41 type direction = record x, y: LongInt; end;
    41 type direction = record x, y: LongInt; end;
  1154             end;
  1154             end;
  1155 
  1155 
  1156         if SDL_MustLock(tmpsurf) then
  1156         if SDL_MustLock(tmpsurf) then
  1157             SDL_UnlockSurface(tmpsurf);
  1157             SDL_UnlockSurface(tmpsurf);
  1158     end;
  1158     end;
  1159     if (tmpsurf <> nil) then 
  1159     if (tmpsurf <> nil) then
  1160         SDL_FreeSurface(tmpsurf);
  1160         SDL_FreeSurface(tmpsurf);
  1161     tmpsurf:= nil;
  1161     tmpsurf:= nil;
  1162 end;
  1162 end;
  1163 
  1163 
  1164 procedure LoadMap;
  1164 procedure LoadMap;
  1206 begin
  1206 begin
  1207     hasBorder:= false;
  1207     hasBorder:= false;
  1208 
  1208 
  1209     LoadThemeConfig;
  1209     LoadThemeConfig;
  1210     isMap:= false;
  1210     isMap:= false;
  1211     
  1211 
  1212     // is this not needed any more? let's hope setlength sets also 0s
  1212     // is this not needed any more? let's hope setlength sets also 0s
  1213     //if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then
  1213     //if ((GameFlags and gfForts) <> 0) or (Pathz[ptMapCurrent] <> '') then
  1214     //    FillChar(Land,SizeOf(TCollisionArray),0);*)
  1214     //    FillChar(Land,SizeOf(TCollisionArray),0);*)
  1215         
  1215 
  1216     if (GameFlags and gfForts) = 0 then
  1216     if (GameFlags and gfForts) = 0 then
  1217         if Pathz[ptMapCurrent] <> '' then
  1217         if Pathz[ptMapCurrent] <> '' then
  1218             LoadMap
  1218             LoadMap
  1219         else
  1219         else
  1220             GenLandSurface
  1220             GenLandSurface