hedgewars/uLandObjects.pas
changeset 6982 8d41d22a291d
parent 6700 e04da46ee43c
child 6986 409dd3851309
equal deleted inserted replaced
6981:045e8162c9cd 6982:8d41d22a291d
   404     c2: TSDL_Color;
   404     c2: TSDL_Color;
   405 begin
   405 begin
   406 
   406 
   407 AddProgress;
   407 AddProgress;
   408 // Set default water greyscale values
   408 // Set default water greyscale values
   409 if cGrayScale then
   409 if GrayScale then
   410     begin
   410     begin
   411     for i:= 0 to 3 do
   411     for i:= 0 to 3 do
   412         begin
   412         begin
   413         t:= round(SDWaterColorArray[i].r * RGB_LUMINANCE_RED + SDWaterColorArray[i].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[i].b * RGB_LUMINANCE_BLUE);
   413         t:= round(SDWaterColorArray[i].r * RGB_LUMINANCE_RED + SDWaterColorArray[i].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[i].b * RGB_LUMINANCE_BLUE);
   414         if t > 255 then
   414         if t > 255 then
   459         Delete(s, 1, i);
   459         Delete(s, 1, i);
   460         i:= Pos(',', s);
   460         i:= Pos(',', s);
   461         SkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   461         SkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   462         Delete(s, 1, i);
   462         Delete(s, 1, i);
   463         SkyColor.b:= StrToInt(Trim(s));
   463         SkyColor.b:= StrToInt(Trim(s));
   464         if cGrayScale
   464         if GrayScale
   465             then
   465             then
   466             begin
   466             begin
   467             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
   467             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
   468             if t > 255 then
   468             if t > 255 then
   469                 t:= 255;
   469                 t:= 255;
   483         Delete(s, 1, i);
   483         Delete(s, 1, i);
   484         i:= Pos(',', s);
   484         i:= Pos(',', s);
   485         c2.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   485         c2.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   486         Delete(s, 1, i);
   486         Delete(s, 1, i);
   487         c2.b:= StrToInt(Trim(s));
   487         c2.b:= StrToInt(Trim(s));
   488         if cGrayScale then
   488         if GrayScale then
   489             begin
   489             begin
   490             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
   490             t:= round(SkyColor.r * RGB_LUMINANCE_RED + SkyColor.g * RGB_LUMINANCE_GREEN + SkyColor.b * RGB_LUMINANCE_BLUE);
   491             if t > 255 then
   491             if t > 255 then
   492                 t:= 255;
   492                 t:= 255;
   493             c2.r:= t;
   493             c2.r:= t;
   494             c2.g:= t;
   494             c2.g:= t;
   495             c2.b:= t
   495             c2.b:= t
   496             end;
   496             end;
   497         cExplosionBorderColor:= c2.value or AMask;
   497         ExplosionBorderColor:= c2.value or AMask;
   498         end
   498         end
   499     else if key = 'water-top' then
   499     else if key = 'water-top' then
   500         begin
   500         begin
   501         i:= Pos(',', s);
   501         i:= Pos(',', s);
   502         WaterColorArray[0].r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   502         WaterColorArray[0].r:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   504         i:= Pos(',', s);
   504         i:= Pos(',', s);
   505         WaterColorArray[0].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   505         WaterColorArray[0].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   506         Delete(s, 1, i);
   506         Delete(s, 1, i);
   507         WaterColorArray[0].b:= StrToInt(Trim(s));
   507         WaterColorArray[0].b:= StrToInt(Trim(s));
   508         WaterColorArray[0].a := 255;
   508         WaterColorArray[0].a := 255;
   509         if cGrayScale then
   509         if GrayScale then
   510             begin
   510             begin
   511             t:= round(WaterColorArray[0].r * RGB_LUMINANCE_RED + WaterColorArray[0].g * RGB_LUMINANCE_GREEN + WaterColorArray[0].b * RGB_LUMINANCE_BLUE);
   511             t:= round(WaterColorArray[0].r * RGB_LUMINANCE_RED + WaterColorArray[0].g * RGB_LUMINANCE_GREEN + WaterColorArray[0].b * RGB_LUMINANCE_BLUE);
   512             if t > 255 then
   512             if t > 255 then
   513                 t:= 255;
   513                 t:= 255;
   514             WaterColorArray[0].r:= t;
   514             WaterColorArray[0].r:= t;
   525         i:= Pos(',', s);
   525         i:= Pos(',', s);
   526         WaterColorArray[2].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   526         WaterColorArray[2].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   527         Delete(s, 1, i);
   527         Delete(s, 1, i);
   528         WaterColorArray[2].b:= StrToInt(Trim(s));
   528         WaterColorArray[2].b:= StrToInt(Trim(s));
   529         WaterColorArray[2].a := 255;
   529         WaterColorArray[2].a := 255;
   530         if cGrayScale then
   530         if GrayScale then
   531             begin
   531             begin
   532             t:= round(WaterColorArray[2].r * RGB_LUMINANCE_RED + WaterColorArray[2].g * RGB_LUMINANCE_GREEN + WaterColorArray[2].b * RGB_LUMINANCE_BLUE);
   532             t:= round(WaterColorArray[2].r * RGB_LUMINANCE_RED + WaterColorArray[2].g * RGB_LUMINANCE_GREEN + WaterColorArray[2].b * RGB_LUMINANCE_BLUE);
   533             if t > 255 then
   533             if t > 255 then
   534                 t:= 255;
   534                 t:= 255;
   535             WaterColorArray[2].r:= t;
   535             WaterColorArray[2].r:= t;
   538             end;
   538             end;
   539         WaterColorArray[3]:= WaterColorArray[2];
   539         WaterColorArray[3]:= WaterColorArray[2];
   540         end
   540         end
   541     else if key = 'water-opacity' then
   541     else if key = 'water-opacity' then
   542         begin
   542         begin
   543         cWaterOpacity:= StrToInt(Trim(s));
   543         WaterOpacity:= StrToInt(Trim(s));
   544         cSDWaterOpacity:= cWaterOpacity
   544         SDWaterOpacity:= WaterOpacity
   545         end
   545         end
   546     else if key = 'music' then
   546     else if key = 'music' then
   547         MusicFN:= Trim(s)
   547         MusicFN:= Trim(s)
   548     else if key = 'clouds' then
   548     else if key = 'clouds' then
   549         begin
   549         begin
   656         i:= Pos(',', s);
   656         i:= Pos(',', s);
   657         SDWaterColorArray[0].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   657         SDWaterColorArray[0].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   658         Delete(s, 1, i);
   658         Delete(s, 1, i);
   659         SDWaterColorArray[0].b:= StrToInt(Trim(s));
   659         SDWaterColorArray[0].b:= StrToInt(Trim(s));
   660         SDWaterColorArray[0].a := 255;
   660         SDWaterColorArray[0].a := 255;
   661         if cGrayScale then
   661         if GrayScale then
   662             begin
   662             begin
   663             t:= round(SDWaterColorArray[0].r * RGB_LUMINANCE_RED + SDWaterColorArray[0].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[0].b * RGB_LUMINANCE_BLUE);
   663             t:= round(SDWaterColorArray[0].r * RGB_LUMINANCE_RED + SDWaterColorArray[0].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[0].b * RGB_LUMINANCE_BLUE);
   664             if t > 255 then
   664             if t > 255 then
   665                 t:= 255;
   665                 t:= 255;
   666             SDWaterColorArray[0].r:= t;
   666             SDWaterColorArray[0].r:= t;
   677         i:= Pos(',', s);
   677         i:= Pos(',', s);
   678         SDWaterColorArray[2].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   678         SDWaterColorArray[2].g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   679         Delete(s, 1, i);
   679         Delete(s, 1, i);
   680         SDWaterColorArray[2].b:= StrToInt(Trim(s));
   680         SDWaterColorArray[2].b:= StrToInt(Trim(s));
   681         SDWaterColorArray[2].a := 255;
   681         SDWaterColorArray[2].a := 255;
   682         if cGrayScale then
   682         if GrayScale then
   683             begin
   683             begin
   684             t:= round(SDWaterColorArray[2].r * RGB_LUMINANCE_RED + SDWaterColorArray[2].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[2].b * RGB_LUMINANCE_BLUE);
   684             t:= round(SDWaterColorArray[2].r * RGB_LUMINANCE_RED + SDWaterColorArray[2].g * RGB_LUMINANCE_GREEN + SDWaterColorArray[2].b * RGB_LUMINANCE_BLUE);
   685             if t > 255 then
   685             if t > 255 then
   686                 t:= 255;
   686                 t:= 255;
   687             SDWaterColorArray[2].r:= t;
   687             SDWaterColorArray[2].r:= t;
   689             SDWaterColorArray[2].b:= t
   689             SDWaterColorArray[2].b:= t
   690             end;
   690             end;
   691         SDWaterColorArray[3]:= SDWaterColorArray[2];
   691         SDWaterColorArray[3]:= SDWaterColorArray[2];
   692         end
   692         end
   693     else if key = 'sd-water-opacity' then
   693     else if key = 'sd-water-opacity' then
   694         cSDWaterOpacity:= StrToInt(Trim(s))
   694         SDWaterOpacity:= StrToInt(Trim(s))
   695     else if key = 'sd-clouds' then
   695     else if key = 'sd-clouds' then
   696         cSDCloudsNumber:= Word(StrToInt(Trim(s))) * cScreenSpace div LAND_WIDTH
   696         cSDCloudsNumber:= Word(StrToInt(Trim(s))) * cScreenSpace div LAND_WIDTH
   697     else if key = 'sd-flakes' then
   697     else if key = 'sd-flakes' then
   698         begin
   698         begin
   699         i:= Pos(',', s);
   699         i:= Pos(',', s);
   722             Delete(s, 1, i);
   722             Delete(s, 1, i);
   723             i:= Pos(',', s);
   723             i:= Pos(',', s);
   724             RQSkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   724             RQSkyColor.g:= StrToInt(Trim(Copy(s, 1, Pred(i))));
   725             Delete(s, 1, i);
   725             Delete(s, 1, i);
   726             RQSkyColor.b:= StrToInt(Trim(s));
   726             RQSkyColor.b:= StrToInt(Trim(s));
   727             if cGrayScale then
   727             if GrayScale then
   728                 begin
   728                 begin
   729                 t:= round(RQSkyColor.r * RGB_LUMINANCE_RED + RQSkyColor.g * RGB_LUMINANCE_GREEN + RQSkyColor.b * RGB_LUMINANCE_BLUE);
   729                 t:= round(RQSkyColor.r * RGB_LUMINANCE_RED + RQSkyColor.g * RGB_LUMINANCE_GREEN + RQSkyColor.b * RGB_LUMINANCE_BLUE);
   730                 if t > 255 then
   730                 if t > 255 then
   731                     t:= 255;
   731                     t:= 255;
   732                 RQSkyColor.r:= t;
   732                 RQSkyColor.r:= t;