hedgewars/uLandObjects.pas
changeset 54 839fd258ae6f
parent 51 b6e3ae05857f
child 56 a29135563e94
equal deleted inserted replaced
53:0e27949850e3 54:839fd258ae6f
   183 x1:= 0;
   183 x1:= 0;
   184 until y > 900;
   184 until y > 900;
   185 if x1 > 0 then
   185 if x1 > 0 then
   186    begin
   186    begin
   187    Result:= true;
   187    Result:= true;
   188    tmpsurf:= LoadImage(Pathz[ptGraphics] + 'Girder.png', false);
   188    tmpsurf:= LoadImage(Pathz[ptGraphics] + '/Girder.png', false);
   189    rr.x:= x1;
   189    rr.x:= x1;
   190    rr.y:= y;
   190    rr.y:= y;
   191    while rr.x + 100 < x2 do
   191    while rr.x + 100 < x2 do
   192          begin
   192          begin
   193          SDL_UpperBlit(tmpsurf, nil, Surface, @rr);
   193          SDL_UpperBlit(tmpsurf, nil, Surface, @rr);
   290     s: string;
   290     s: string;
   291     ThemeObjects: array[1..MAXTHEMEOBJECTS] of TThemeObject;
   291     ThemeObjects: array[1..MAXTHEMEOBJECTS] of TThemeObject;
   292     i, ii, t, n: Longword;
   292     i, ii, t, n: Longword;
   293     b: boolean;
   293     b: boolean;
   294 begin
   294 begin
   295 s:= Pathz[ptThemeCurrent] + cThemeCFGFilename;
   295 s:= Pathz[ptThemeCurrent] + '/' + cThemeCFGFilename;
   296 WriteLnToConsole('Adding objects...');
   296 WriteLnToConsole('Adding objects...');
   297 AssignFile(f, s);
   297 AssignFile(f, s);
   298 {$I-}
   298 {$I-}
   299 Reset(f);
   299 Reset(f);
   300 Readln(f, s); // skip color
   300 Readln(f, s); // skip color
   302 for i:= 1 to n do
   302 for i:= 1 to n do
   303     begin
   303     begin
   304     Readln(f, s); // filename
   304     Readln(f, s); // filename
   305     with ThemeObjects[i] do
   305     with ThemeObjects[i] do
   306          begin
   306          begin
   307          Surf:= LoadImage(Pathz[ptThemeCurrent] + s + '.png', false);
   307          Surf:= LoadImage(Pathz[ptThemeCurrent] + '/' + s + '.png', false);
   308          Read(f, Width, Height);
   308          Read(f, Width, Height);
   309          with inland do Read(f, x, y, w, h);
   309          with inland do Read(f, x, y, w, h);
   310          Read(f, rectcnt);
   310          Read(f, rectcnt);
   311          for ii:= 1 to rectcnt do
   311          for ii:= 1 to rectcnt do
   312              with outland[ii] do Read(f, x, y, w, h);
   312              with outland[ii] do Read(f, x, y, w, h);
   313          ReadLn(f)
   313          ReadLn(f)
   314          end;
   314          end;
   315     end;
   315     end;
   316 Closefile(f);
   316 Closefile(f);
   317 {$I+}
   317 {$I+}
   318 TryDo(IOResult = 0, 'Bad data or cannot access file', true);
   318 TryDo(IOResult = 0, 'Bad data or cannot access file ' + cThemeCFGFilename, true);
   319 
   319 
   320 // loaded objects, try to put on land
   320 // loaded objects, try to put on land
   321 if n = 0 then exit;
   321 if n = 0 then exit;
   322 i:= 1;
   322 i:= 1;
   323 repeat
   323 repeat