hedgewars/uLandTexture.pas
changeset 10266 a90a55ec5b98
parent 10124 aabd1b75d5a3
child 10267 237b403f92be
equal deleted inserted replaced
10265:7e8d4cd76ce7 10266:a90a55ec5b98
   171                         end;
   171                         end;
   172                     end
   172                     end
   173 end;
   173 end;
   174 
   174 
   175 procedure DrawLand(dX, dY: LongInt);
   175 procedure DrawLand(dX, dY: LongInt);
   176 var x, y: LongInt;
   176 var x, y, tX, ty, tSize, offscreen: LongInt;
       
   177     tScale: GLfloat;
       
   178     overlap: boolean;
   177 begin
   179 begin
   178 RealLandTexUpdate;
   180 RealLandTexUpdate;
   179 
   181 
       
   182 // init values based on quality settings
       
   183 if (cReducedQuality and rqBlurryLand) <> 0 then
       
   184     begin
       
   185     tSize:= TEXSIZE * 2;
       
   186     tScale:= 2.0;
       
   187     overlap:= (cReducedQuality and rqClampLess) <> 0;
       
   188     end
       
   189 else
       
   190     begin
       
   191     tSize:= TEXSIZE;
       
   192     tScale:= 1.0;
       
   193     overlap:= false;
       
   194     end;
       
   195 
       
   196 tX:= dX;
       
   197 
       
   198 // loop through all columns
   180 for x:= 0 to LANDTEXARW -1 do
   199 for x:= 0 to LANDTEXARW -1 do
   181     for y:= 0 to LANDTEXARH - 1 do
   200     begin
   182         with LandTextures[x, y] do
   201 
   183             if tex <> nil then
   202     // don't draw column if offscreen
   184                 if (cReducedQuality and rqBlurryLand) = 0 then
   203     offscreen:= isDxAreaOffscreen(tX, tSize);
   185                     DrawTexture(dX + x * TEXSIZE, dY + y * TEXSIZE, tex)
   204 
   186                 else if (cReducedQuality and rqClampLess) = 0 then
   205     if offscreen = 0 then
   187                     DrawTexture(dX + x * TEXSIZE * 2, dY + y * TEXSIZE * 2, tex, 2.0)
   206         begin
   188                 else
   207         // loop through all textures in this column
   189                     DrawTexture2(dX + x * TEXSIZE * 2, dY + y * TEXSIZE * 2, tex, 2.0, BLURRYLANDOVERLAP);
   208         for y:= 0 to LANDTEXARH - 1 do
       
   209             with LandTextures[x, y] do
       
   210                 if tex <> nil then
       
   211                     begin
       
   212                     ty:= dY + y * tSize;
       
   213 
       
   214                     // don't draw texture if offscreen
       
   215                     offscreen:= isDyAreaOffscreen(tY, tSize);
       
   216 
       
   217                     if offscreen = 0 then
       
   218                         begin
       
   219                         if overlap then
       
   220                             DrawTexture2(tX, ty, tex, tScale, BLURRYLANDOVERLAP)
       
   221                         else
       
   222                             DrawTexture(tX, ty, tex, tScale);
       
   223                         end
       
   224 
       
   225                     // if below screen, skip remaining textures in this column
       
   226                     else if offscreen > 1 then
       
   227                         break;
       
   228                     end;
       
   229 
       
   230         end
       
   231     // if right of screen, skip remaining columns
       
   232     else if offscreen > 0 then
       
   233         break;
       
   234 
       
   235     // increment texX
       
   236     inc(tX, tSize);
       
   237     end;
   190 end;
   238 end;
   191 
   239 
   192 procedure SetLandTexture;
   240 procedure SetLandTexture;
   193 begin
   241 begin
   194     if (cReducedQuality and rqBlurryLand) = 0 then
   242     if (cReducedQuality and rqBlurryLand) = 0 then