Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
authornemo
Thu, 24 Nov 2011 16:40:17 -0500
changeset 6419 6a464d0a5c13
parent 6418 f1a3c3aab5b4
child 6420 86a2fe62f338
Tidy up flake land generation, to avoid ragged holes in landbacktex. Remove of one odd Land[] change forces a PROTO bump. Well, had to happen eventually.
CMakeLists.txt
hedgewars/GSHandlers.inc
misc/hats_js_anim.xhtml
--- a/CMakeLists.txt	Thu Nov 24 19:15:29 2011 +0100
+++ b/CMakeLists.txt	Thu Nov 24 16:40:17 2011 -0500
@@ -42,7 +42,7 @@
 set(CPACK_PACKAGE_VERSION_MAJOR 0)
 set(CPACK_PACKAGE_VERSION_MINOR 9)
 set(CPACK_PACKAGE_VERSION_PATCH 17${version_suffix})
-set(HEDGEWARS_PROTO_VER 41)
+set(HEDGEWARS_PROTO_VER 42)
 set(HEDGEWARS_VERSION "${CPACK_PACKAGE_VERSION_MAJOR}.${CPACK_PACKAGE_VERSION_MINOR}.${CPACK_PACKAGE_VERSION_PATCH}")
 
 
--- a/hedgewars/GSHandlers.inc	Thu Nov 24 19:15:29 2011 +0100
+++ b/hedgewars/GSHandlers.inc	Thu Nov 24 16:40:17 2011 -0500
@@ -655,7 +655,7 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepSnowflake(Gear: PGear);
-var xx, yy, px, py: LongInt;
+var xx, yy, px, py, rx, ry, lx, ly: LongInt;
     move, draw, allpx, gun: Boolean;
     s: PSDL_Surface;
     p: PLongwordArray;
@@ -756,34 +756,35 @@
             for py:= 0 to Pred(s^.h) do
                 begin
                 for px:= 0 to Pred(s^.w) do
-                    if ((((yy + py) and LAND_HEIGHT_MASK) = 0) and (((xx + px) and LAND_WIDTH_MASK) = 0)) and ((Land[yy + py, xx + px] and $FF) = 0) then
+                    begin
+                    lx:=xx + px; ly:=yy + py;
+                    if (ly and LAND_HEIGHT_MASK = 0) and (lx and LAND_WIDTH_MASK = 0) and (Land[ly, lx] and $FF = 0) then
                         begin
-                        if gun then
+                        rx:= lx;
+                        ry:= ly;
+                        if cReducedQuality and rqBlurryLand <> 0 then
                             begin
-                            // try to avoid speckles. might need disabling
-                            LandDirty[yy div 32, xx div 32]:= 1;
-                            Land[yy + py, xx + px]:= (Land[yy + py, xx + px] or lfDamaged or lfObject) and not lfBasic;
-                            end
-                        else if Land[yy + py, xx + px] and $FF00 = 0 then Land[yy + py, xx + px]:= lf;
-                        if (cReducedQuality and rqBlurryLand) = 0 then
-                            begin
+                            rx:= rx div 2;ry:= ry div 2;
+                            end;
+                        if Land[yy + py, xx + px] and $FF00 = 0 then
                             if gun then
-                                LandPixels[yy + py, xx + px]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
-                            else LandPixels[yy + py, xx + px]:= addBgColor(LandPixels[yy + py, xx + px], p^[px]);
-                            end
-                        else
-                            begin
-                            if gun then
-                                LandPixels[(yy + py) div 2, (xx + px) div 2]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
-                            else LandPixels[(yy + py) div 2, (xx + px) div 2]:= addBgColor(LandPixels[(yy + py) div 2, (xx + px) div 2], p^[px]);
-                            end;
+                                begin
+                                LandDirty[yy div 32, xx div 32]:= 1;
+                                if LandPixels[ry, rx] = 0 then Land[ly, lx]:=  lfDamaged or lfObject
+                                else Land[ly, lx]:=  lfDamaged or lfBasic
+                                end
+                            else Land[ly, lx]:= lf;
+                        if gun then
+                            LandPixels[ry, rx]:= (cExplosionBorderColor and not AMask) or (p^[px] and AMask)
+                        else LandPixels[ry, rx]:= addBgColor(LandPixels[ry, rx], p^[px]);
                         end
-                    else allpx:= false;
+                    else allpx:= false
+                    end;
                 p:= @(p^[s^.pitch shr 2])
                 end;
             
-            
-            Land[py, px+1]:= lfBasic;
+            // Why is this here.  For one thing, there's no test on +1 being safe. 
+            //Land[py, px+1]:= lfBasic;
             
             if allpx then UpdateLandTexture(xx, Pred(s^.h), yy, Pred(s^.w))
             else
--- a/misc/hats_js_anim.xhtml	Thu Nov 24 19:15:29 2011 +0100
+++ b/misc/hats_js_anim.xhtml	Thu Nov 24 16:40:17 2011 -0500
@@ -10,7 +10,7 @@
 {
     background: url('http://hedgewars.googlecode.com/hg/share/hedgewars/Data/Themes/Nature/Sky.png') fixed no-repeat bottom left;
     -moz-background-size: 200%;
-    background-size: 200%;
+    background-size: 100% 100%;
     font-family: sans-serif;
 }
 h1 { text-shadow: 0 0 2px white; }