hedgewars/uLand.pas
changeset 1795 2457fcc0dcd9
parent 1792 c30c6944bd49
child 1797 fedd8649fdd9
equal deleted inserted replaced
1794:8ae48e3b02d9 1795:2457fcc0dcd9
   638     end;
   638     end;
   639 end;
   639 end;
   640 
   640 
   641 procedure LoadMap;
   641 procedure LoadMap;
   642 var tmpsurf: PSDL_Surface;
   642 var tmpsurf: PSDL_Surface;
   643     s: string;
   643 	s: string;
   644     a,b: shortstring;
   644 	f: textfile;
   645     f: textfile;
       
   646     tn: Longint;
       
   647 
       
   648 begin
   645 begin
   649 WriteLnToConsole('Loading land from file...');
   646 WriteLnToConsole('Loading land from file...');
   650 AddProgress;
   647 AddProgress;
   651 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', true, true, true);
   648 tmpsurf:= LoadImage(Pathz[ptMapCurrent] + '/map', true, true, true);
   652 TryDo((tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT), 'Map dimensions too big!', true);
   649 TryDo((tmpsurf^.w <= LAND_WIDTH) and (tmpsurf^.h <= LAND_HEIGHT), 'Map dimensions too big!', true);
   654 // unC0Rr - should this be passed from the GUI? I'm not sure which layer does what
   651 // unC0Rr - should this be passed from the GUI? I'm not sure which layer does what
   655 s:= Pathz[ptMapCurrent] + '/map.cfg';
   652 s:= Pathz[ptMapCurrent] + '/map.cfg';
   656 WriteLnToConsole('Fetching map HH limit');
   653 WriteLnToConsole('Fetching map HH limit');
   657 Assign(f, s);
   654 Assign(f, s);
   658 Reset(f);
   655 Reset(f);
   659 Readln(f, a);
   656 Readln(f);
   660 SplitBySpace(a,b);
   657 if not eof(f) then Readln(f, MaxHedgehogs);
   661 Val(b,MaxHedgehogs,tn);
   658 
   662 if(MaxHedgehogs = 0) then MaxHedgehogs:= 18;
   659 if(MaxHedgehogs = 0) then MaxHedgehogs:= 18;
   663 
   660 
   664 playHeight:= tmpsurf^.h;
   661 playHeight:= tmpsurf^.h;
   665 playWidth:= tmpsurf^.w;
   662 playWidth:= tmpsurf^.w;
   666 leftX:= (LAND_WIDTH - playWidth) div 2;
   663 leftX:= (LAND_WIDTH - playWidth) div 2;