hedgewars/uLandObjects.pas
branchphysfslayer
changeset 8028 dc30104660d3
parent 8025 07862ab415c8
child 8096 453917e94e55
child 8145 6408c0ba4ba1
equal deleted inserted replaced
8025:07862ab415c8 8028:dc30104660d3
    28 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline;
    28 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface); inline;
    29 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word);
    29 procedure BlitImageAndGenerateCollisionInfo(cpX, cpY, Width: Longword; Image: PSDL_Surface; extraFlags: Word);
    30 procedure AddOnLandObjects(Surface: PSDL_Surface);
    30 procedure AddOnLandObjects(Surface: PSDL_Surface);
    31 
    31 
    32 implementation
    32 implementation
    33 uses uStore, uConsts, uConsole, uRandom, uSound, GLunit,
    33 uses uStore, uConsts, uConsole, uRandom, uSound, GLunit
    34      uTypes, uVariables, uUtils, uDebug, SysUtils;
    34      , uTypes, uVariables, uUtils, uDebug, SysUtils
       
    35      , uPhysFSLayer;
    35 
    36 
    36 const MaxRects = 512;
    37 const MaxRects = 512;
    37       MAXOBJECTRECTS = 16;
    38       MAXOBJECTRECTS = 16;
    38       MAXTHEMEOBJECTS = 32;
    39       MAXTHEMEOBJECTS = 32;
    39 
    40 
   397         OutError('Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true);
   398         OutError('Object''s rectangle exceeds image: y + h (' + inttostr(y) + ' + ' + inttostr(h) + ') > Height (' + inttostr(Height) + ')', true);
   398 end;
   399 end;
   399 
   400 
   400 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
   401 procedure ReadThemeInfo(var ThemeObjects: TThemeObjects; var SprayObjects: TSprayObjects);
   401 var s, key: shortstring;
   402 var s, key: shortstring;
   402     f: textfile;
   403     f: PFSFile;
   403     i: LongInt;
   404     i: LongInt;
   404     ii, t: Longword;
   405     ii, t: Longword;
   405     c2: TSDL_Color;
   406     c2: TSDL_Color;
   406 begin
   407 begin
   407 
   408 
   429         end
   430         end
   430     end;
   431     end;
   431 
   432 
   432 s:= cPathz[ptCurrTheme] + '/' + cThemeCFGFilename;
   433 s:= cPathz[ptCurrTheme] + '/' + cThemeCFGFilename;
   433 WriteLnToConsole('Reading objects info...');
   434 WriteLnToConsole('Reading objects info...');
   434 Assign(f, s);
   435 f:= pfsOpenRead(s);
   435 {$I-}
   436 TryDo(f <> nil, 'Bad data or cannot access file ' + cThemeCFGFilename, true);
   436 filemode:= 0; // readonly
       
   437 Reset(f);
       
   438 
   437 
   439 ThemeObjects.Count:= 0;
   438 ThemeObjects.Count:= 0;
   440 SprayObjects.Count:= 0;
   439 SprayObjects.Count:= 0;
   441 
   440 
   442 while not eof(f) do
   441 while not pfsEOF(f) do
   443     begin
   442     begin
   444     Readln(f, s);
   443     pfsReadLn(f, s);
   445     if Length(s) = 0 then
   444     if Length(s) = 0 then
   446         continue;
   445         continue;
   447     if s[1] = ';' then
   446     if s[1] = ';' then
   448         continue;
   447         continue;
   449 
   448 
   734             SDSkyColor.b:= RQSkyColor.b;
   733             SDSkyColor.b:= RQSkyColor.b;
   735             end
   734             end
   736         end
   735         end
   737     end;
   736     end;
   738 
   737 
   739 Close(f);
   738 pfsClose(f);
   740 {$I+}
       
   741 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true);
       
   742 AddProgress;
   739 AddProgress;
   743 end;
   740 end;
   744 
   741 
   745 procedure AddThemeObjects(var ThemeObjects: TThemeObjects);
   742 procedure AddThemeObjects(var ThemeObjects: TThemeObjects);
   746 var i, ii, t: LongInt;
   743 var i, ii, t: LongInt;