Add green mask for anti-portal areas on custom maps. Flagged as Bouncy since it is intended for that general use. Needs testing.
authornemo
Tue, 26 Jun 2012 10:14:40 -0400
changeset 7293 468cf6d561e5
parent 7290 390d76b29ed0
child 7296 fb5b7cb58a67
Add green mask for anti-portal areas on custom maps. Flagged as Bouncy since it is intended for that general use. Needs testing.
hedgewars/GSHandlers.inc
hedgewars/uConsts.pas
hedgewars/uLand.pas
--- a/hedgewars/GSHandlers.inc	Mon Jun 25 09:40:56 2012 -0400
+++ b/hedgewars/GSHandlers.inc	Tue Jun 26 10:14:40 2012 -0400
@@ -4410,7 +4410,7 @@
     ty := 0;
     // avoid compiler hints
 
-    if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] > 255) then
+    if ((y and LAND_HEIGHT_MASK) = 0) and ((x and LAND_WIDTH_MASK) = 0) and (Land[y, x] and ($FF00 and not lfBouncy) <> 0) then
         begin
         Gear^.State := Gear^.State or gstCollision;
         Gear^.State := Gear^.State and (not gstMoving);
--- a/hedgewars/uConsts.pas	Mon Jun 25 09:40:56 2012 -0400
+++ b/hedgewars/uConsts.pas	Tue Jun 26 10:14:40 2012 -0400
@@ -94,6 +94,7 @@
     lfObject         = $2000;  
     lfDamaged        = $1000;  //
     lfIce            = $0800;  // blue
+    lfBouncy         = $0400;  // green
 
     cMaxPower     = 1500;
     cMaxAngle     = 2048;
--- a/hedgewars/uLand.pas	Mon Jun 25 09:40:56 2012 -0400
+++ b/hedgewars/uLand.pas	Tue Jun 26 10:14:40 2012 -0400
@@ -434,19 +434,22 @@
         begin
             for x:= 0 to Pred(tmpsurf^.w) do
             begin
-                if ((AMask and p^[x]) = 0) then
+                // this an if instead of masking colours to avoid confusing map creators
+                if ((AMask and p^[x]) = 0) then 
                     Land[cpY + y, cpX + x]:= 0
-                else if p^[x] = $FFFFFFFF then
+                else if p^[x] = $FFFFFFFF then                  // white
                     Land[cpY + y, cpX + x]:= lfObject
-                else if p^[x] = (AMask or RMask) then
-                    Land[cpY + y, cpX + x]:= lfIndestructible
-                else if p^[x] = AMask then
+                else if p^[x] = AMask then                      // black
                     begin
                     Land[cpY + y, cpX + x]:= lfBasic;
                     disableLandBack:= false
                     end
-                else if p^[x] = (AMask or BMask) then
+                else if p^[x] = (AMask or RMask) then           // red
+                    Land[cpY + y, cpX + x]:= lfIndestructible
+                else if p^[x] = (AMask or BMask) then           // blue
                     Land[cpY + y, cpX + x]:= lfObject or lfIce
+                else if p^[x] = (AMask or GMask) then           // green
+                    Land[cpY + y, cpX + x]:= lfObject or lfBouncy
             end;
             p:= @(p^[tmpsurf^.pitch div 4]);
         end;