hedgewars/uLandObjects.pas
changeset 5654 1cb68f420aa6
parent 5441 39962b855540
child 5689 48ef34701751
equal deleted inserted replaced
5653:fa58dea8a9ad 5654:1cb68f420aa6
   407     Delete(s, 1, i);
   407     Delete(s, 1, i);
   408 
   408 
   409     if key = 'sky' then
   409     if key = 'sky' then
   410         begin
   410         begin
   411         i:= Pos(',', s);
   411         i:= Pos(',', s);
   412         c1.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   412         SkyColor.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   413         Delete(s, 1, i);
   413         Delete(s, 1, i);
   414         i:= Pos(',', s);
   414         i:= Pos(',', s);
   415         c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   415         SkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   416         Delete(s, 1, i);
   416         Delete(s, 1, i);
   417         c1.b:= StrToInt(Trim(s));
   417         SkyColor.b:= StrToInt(Trim(s));
   418         if cGrayScale then
   418         if cGrayScale then
   419             begin
   419             begin
   420             t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE);
   420             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
   421             if t > 255 then t:= 255;
   421             if t > 255 then t:= 255;
   422             c1.r:= t;
   422             SkyColor.r:= t;
   423             c1.g:= t;
   423             SkyColor.g:= t;
   424             c1.b:= t
   424             SkyColor.b:= t
   425             end;
   425             end;
   426         glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99);
   426         glClearColor(SkyColor.r / 255, SkyColor.g / 255, SkyColor.b / 255, 0.99);
   427         SDSkyColor.r:= byte(c1.r * SDTint div 255);
   427         SDSkyColor.r:= byte(SkyColor.r * SDTint div 255);
   428         SDSkyColor.g:= byte(c1.g * SDTint div 255);
   428         SDSkyColor.g:= byte(SkyColor.g * SDTint div 255);
   429         SDSkyColor.b:= byte(c1.b * SDTint div 255);
   429         SDSkyColor.b:= byte(SkyColor.b * SDTint div 255);
   430         end
   430         end
   431     else if key = 'border' then
   431     else if key = 'border' then
   432         begin
   432         begin
   433         i:= Pos(',', s);
   433         i:= Pos(',', s);
   434         c2.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   434         c2.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   644     else if key = 'rq-sky' then
   644     else if key = 'rq-sky' then
   645         begin
   645         begin
   646         if ((cReducedQuality and rqNoBackground) <> 0) then
   646         if ((cReducedQuality and rqNoBackground) <> 0) then
   647             begin
   647             begin
   648             i:= Pos(',', s);
   648             i:= Pos(',', s);
   649             c1.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   649             RQSkyColor.r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   650             Delete(s, 1, i);
   650             Delete(s, 1, i);
   651             i:= Pos(',', s);
   651             i:= Pos(',', s);
   652             c1.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   652             RQSkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   653             Delete(s, 1, i);
   653             Delete(s, 1, i);
   654             c1.b:= StrToInt(Trim(s));
   654             RQSkyColor.b:= StrToInt(Trim(s));
   655             if cGrayScale then
   655             if cGrayScale then
   656                 begin
   656                 begin
   657                 t:= round(c1.r * RGB_LUMINANCE_RED + c1.g * RGB_LUMINANCE_GREEN + c1.b * RGB_LUMINANCE_BLUE);
   657                 t:= round(RQSkyColor.r * RGB_LUMINANCE_RED + RQSkyColor.g * RGB_LUMINANCE_GREEN + RQSkyColor.b * RGB_LUMINANCE_BLUE);
   658                 if t > 255 then t:= 255;
   658                 if t > 255 then t:= 255;
   659                 c1.r:= t;
   659                 RQSkyColor.r:= t;
   660                 c1.g:= t;
   660                 RQSkyColor.g:= t;
   661                 c1.b:= t
   661                 RQSkyColor.b:= t
   662                 end;
   662                 end;
   663             glClearColor(c1.r / 255, c1.g / 255, c1.b / 255, 0.99);
   663             glClearColor(RQSkyColor.r / 255, RQSkyColor.g / 255, RQSkyColor.b / 255, 0.99);
   664             SDSkyColor.r:= byte(c1.r * SDTint div 255);
   664             SDSkyColor.r:= byte(RQSkyColor.r * SDTint div 255);
   665             SDSkyColor.g:= byte(c1.g * SDTint div 255);
   665             SDSkyColor.g:= byte(RQSkyColor.g * SDTint div 255);
   666             SDSkyColor.b:= byte(c1.b * SDTint div 255);
   666             SDSkyColor.b:= byte(RQSkyColor.b * SDTint div 255);
   667             end
   667             end
   668         end
   668         end
   669     end;
   669     end;
   670 
   670 
   671 Close(f);
   671 Close(f);