make the mask colours more liberal due to possibility that OSX/SDL2 are slightly distorting them
authornemo
Mon, 19 Aug 2019 11:41:59 -0400
changeset 15342 0230c4766aa6
parent 15341 53ca3783eca3
child 15343 ae4c5738e8cb
make the mask colours more liberal due to possibility that OSX/SDL2 are slightly distorting them
hedgewars/uLandObjects.pas
--- a/hedgewars/uLandObjects.pas	Mon Aug 19 18:24:08 2019 +0300
+++ b/hedgewars/uLandObjects.pas	Mon Aug 19 11:41:59 2019 -0400
@@ -89,18 +89,18 @@
     // this an if instead of masking colours to avoid confusing map creators
     if ((AMask and Pixel) = 0) then
         LandWord:= 0
-    else if Pixel = $FFFFFFFF then                  // white
+    else if (Pixel and AMask > 0) and (Pixel and RMask > 0) and (Pixel and GMask > 0) and (Pixel and BMask > 0) then // whiteish
         LandWord:= lfObject
-    else if Pixel = AMask then                      // black
+    else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask = 0) and (Pixel and BMask = 0) then // blackish
         begin
         LandWord:= lfBasic;
         disableLandBack:= false
         end
-    else if Pixel = (AMask or RMask) then           // red
+    else if (Pixel and AMask > 0) and (Pixel and RMask > 0) and (Pixel and GMask = 0) and (Pixel and BMask = 0) then // reddish
         LandWord:= lfIndestructible
-    else if Pixel = (AMask or BMask) then           // blue
+    else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask = 0) and (Pixel and BMask > 0) then // blueish
         LandWord:= lfObject or lfIce
-    else if Pixel = (AMask or GMask) then           // green
+    else if (Pixel and AMask > 0) and (Pixel and RMask = 0) and (Pixel and GMask > 0) and (Pixel and BMask = 0) then // greenish
         LandWord:= lfObject or lfBouncy
 end;