hedgewars/uStore.pas
changeset 3537 8f5b3108f29c
parent 3525 1d7b056ff866
child 3558 86a4437e614b
equal deleted inserted replaced
3536:7d99655130ff 3537:8f5b3108f29c
   393         // FIXME - add a sprite attribute
   393         // FIXME - add a sprite attribute
   394         if (not cReducedQuality) or (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR, sprFlake, sprSplash, sprDroplet])) then // FIXME: hack
   394         if (not cReducedQuality) or (not (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR, sprFlake, sprSplash, sprDroplet])) then // FIXME: hack
   395         begin
   395         begin
   396             if AltPath = ptNone then
   396             if AltPath = ptNone then
   397                 if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR] then // FIXME: hack
   397                 if ii in [sprHorizontL, sprHorizontR, sprSkyL, sprSkyR] then // FIXME: hack
   398                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifLowRes)
   398                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent)
   399                 else
   399                 else
   400                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical or ifLowRes)
   400                     tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent or ifCritical)
   401             else begin
   401             else begin
   402                 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent);
   402                 tmpsurf:= LoadImage(Pathz[Path] + '/' + FileName, ifAlpha or ifTransparent);
   403                 if tmpsurf = nil then
   403                 if tmpsurf = nil then
   404                     tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent);
   404                     tmpsurf:= LoadImage(Pathz[AltPath] + '/' + FileName, ifAlpha or ifCritical or ifTransparent);
   405                 end;
   405                 end;
   409                 if imageWidth = 0 then imageWidth:= tmpsurf^.w;
   409                 if imageWidth = 0 then imageWidth:= tmpsurf^.w;
   410                 if imageHeight = 0 then imageHeight:= tmpsurf^.h;
   410                 if imageHeight = 0 then imageHeight:= tmpsurf^.h;
   411                 if Width = 0 then Width:= tmpsurf^.w;
   411                 if Width = 0 then Width:= tmpsurf^.w;
   412                 if Height = 0 then Height:= tmpsurf^.h;
   412                 if Height = 0 then Height:= tmpsurf^.h;
   413                 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then
   413                 if (ii in [sprSky, sprSkyL, sprSkyR, sprHorizont, sprHorizontL, sprHorizontR]) then
   414                     Texture:= Surface2Tex(tmpsurf, true)
   414                     begin
       
   415                     Texture:= Surface2Tex(tmpsurf, true);
       
   416                     Texture^.Scale:= 2
       
   417                     end
   415                 else
   418                 else
   416                     begin
   419                     begin
   417                     Texture:= Surface2Tex(tmpsurf, false);
   420                     Texture:= Surface2Tex(tmpsurf, false);
   418                     if (ii = sprWater) and not cReducedQuality then // HACK: We should include some sprite attribute to define the texture wrap directions
   421                     if (ii = sprWater) and not cReducedQuality then // HACK: We should include some sprite attribute to define the texture wrap directions
   419                     begin
   422                     begin
  1087         begin
  1090         begin
  1088         if (imageFlags and ifAlpha) <> 0 then WriteToConsole(' Alpha');
  1091         if (imageFlags and ifAlpha) <> 0 then WriteToConsole(' Alpha');
  1089         if (imageFlags and ifCritical) <> 0 then WriteToConsole(' Critical');
  1092         if (imageFlags and ifCritical) <> 0 then WriteToConsole(' Critical');
  1090         if (imageFlags and ifTransparent) <> 0 then WriteToConsole(' Transparent');
  1093         if (imageFlags and ifTransparent) <> 0 then WriteToConsole(' Transparent');
  1091         if (imageFlags and ifIgnoreCaps) <> 0 then WriteToConsole(' IgnoreCaps');
  1094         if (imageFlags and ifIgnoreCaps) <> 0 then WriteToConsole(' IgnoreCaps');
  1092         if (imageFlags and ifLowRes) <> 0 then WriteToConsole(' LowRes');
       
  1093         end;
  1095         end;
  1094     WriteToConsole('] ');
  1096     WriteToConsole('] ');
  1095 {$ENDIF}
  1097 {$ENDIF}
  1096 
  1098 
  1097     s:= filename + '.png';
  1099     s:= filename + '.png';
  1098     tmpsurf:= IMG_Load(Str2PChar(s));
  1100     tmpsurf:= IMG_Load(Str2PChar(s));
  1099 
       
  1100     if (imageFlags and ifLowRes) <> 0 then
       
  1101     begin
       
  1102         s:= filename + '-lowres.png';
       
  1103         if (tmpsurf <> nil) then
       
  1104         begin
       
  1105             if ((tmpsurf^.w > MaxTextureSize) or (tmpsurf^.h > MaxTextureSize)) then
       
  1106             begin
       
  1107                 SDL_FreeSurface(tmpsurf);
       
  1108                 {$IFDEF DEBUGFILE}
       
  1109                 AddFileLog('...image too big, trying to load lowres version: ' + s + '...');
       
  1110                 {$ENDIF}
       
  1111                 tmpsurf:= IMG_Load(Str2PChar(s))
       
  1112             end;
       
  1113         end
       
  1114         else
       
  1115         begin
       
  1116             {$IFDEF DEBUGFILE}
       
  1117             AddFileLog('...image not found, trying to load lowres version: ' + s + '...');
       
  1118             {$ENDIF}
       
  1119             tmpsurf:= IMG_Load(Str2PChar(s))
       
  1120         end;
       
  1121     end;
       
  1122 
  1101 
  1123     if tmpsurf = nil then
  1102     if tmpsurf = nil then
  1124     begin
  1103     begin
  1125         OutError(msgFailed, (imageFlags and ifCritical) <> 0);
  1104         OutError(msgFailed, (imageFlags and ifCritical) <> 0);
  1126         exit(nil)
  1105         exit(nil)