hedgewars/uLand.pas
changeset 2981 d0471586a616
parent 2948 3f21a9dc93d0
child 3017 4a52e0705011
equal deleted inserted replaced
2980:3cbd5a39aaee 2981:d0471586a616
    35 var Land: TCollisionArray;
    35 var Land: TCollisionArray;
    36     LandPixels: TLandArray;
    36     LandPixels: TLandArray;
    37     LandDirty: TDirtyTag;
    37     LandDirty: TDirtyTag;
    38     hasBorder: boolean; 
    38     hasBorder: boolean; 
    39     hasGirders: boolean;  
    39     hasGirders: boolean;  
       
    40     isMap: boolean;  
    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.
    41     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.
    41     LandBackSurface: PSDL_Surface;
    42     LandBackSurface: PSDL_Surface;
    42 
    43 
    43 procedure init_uLand;
    44 procedure init_uLand;
    44 procedure free_uLand;
    45 procedure free_uLand;
   720 procedure LoadMap;
   721 procedure LoadMap;
   721 var tmpsurf: PSDL_Surface;
   722 var tmpsurf: PSDL_Surface;
   722     s: shortstring;
   723     s: shortstring;
   723     f: textfile;
   724     f: textfile;
   724 begin
   725 begin
       
   726 isMap:= true;
   725 WriteLnToConsole('Loading land from file...');
   727 WriteLnToConsole('Loading land from file...');
   726 AddProgress;
   728 AddProgress;
   727 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps);
   729 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', ifAlpha or ifCritical or ifTransparent or ifIgnoreCaps);
   728 TryDo((tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT), 'Map dimensions too big!', true);
   730 TryDo((tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT), 'Map dimensions too big!', true);
   729 
   731 
   760 var x, y, w, c: Longword;
   762 var x, y, w, c: Longword;
   761 begin
   763 begin
   762 hasBorder:= false;
   764 hasBorder:= false;
   763 
   765 
   764 LoadThemeConfig;
   766 LoadThemeConfig;
   765 
   767 isMap:= false;
   766 if (GameFlags and gfForts) = 0 then
   768 if (GameFlags and gfForts) = 0 then
   767    if Pathz[ptMapCurrent] <> '' then LoadMap
   769    if Pathz[ptMapCurrent] <> '' then LoadMap
   768                                 else GenLandSurface
   770                                 else GenLandSurface
   769                                else MakeFortsMap;
   771                                else MakeFortsMap;
   770 AddProgress;
   772 AddProgress;