pull in a few changes from default 0.9.15
authornemo
Sun, 26 Dec 2010 00:47:18 -0500
branch0.9.15
changeset 4687 5160cb2f737b
parent 4685 6fbce14e2e2c (current diff)
parent 4686 3682db294dae (diff)
child 4689 5fe167cebdd1
pull in a few changes from default
--- a/hedgewars/uCollisions.pas	Sun Dec 26 00:15:41 2010 +0100
+++ b/hedgewars/uCollisions.pas	Sun Dec 26 00:47:18 2010 -0500
@@ -103,7 +103,7 @@
 mx:= hwRound(Gear^.X);
 my:= hwRound(Gear^.Y);
 
-tr:= Gear^.Radius + 2;
+tr:= Gear^.Radius;
 
 for i:= 0 to Pred(Count) do
     with cinfos[i] do
--- a/hedgewars/uLandGraphics.pas	Sun Dec 26 00:15:41 2010 +0100
+++ b/hedgewars/uLandGraphics.pas	Sun Dec 26 00:47:18 2010 -0500
@@ -198,13 +198,12 @@
            else
                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
            end
-       else if not isMap or ((Land[t, i] and lfObject) <> 0) then
-           begin
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= 0
-           else
-               LandPixels[t div 2, i div 2]:= 0
-           end;
+       else
+           if ((Land[t, i] and lfObject) <> 0) then
+               if (cReducedQuality and rqBlurryLand) = 0 then
+                   LandPixels[t, i]:= 0
+               else
+                   LandPixels[t div 2, i div 2]:= 0;
 
 t:= y - dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
@@ -217,13 +216,12 @@
            else
                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
            end
-       else if not isMap or ((Land[t, i] and lfObject) <> 0) then
-           begin
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= 0
-           else
-               LandPixels[t div 2, i div 2]:= 0
-           end;
+       else
+           if ((Land[t, i] and lfObject) <> 0) then
+               if (cReducedQuality and rqBlurryLand) = 0 then
+                   LandPixels[t, i]:= 0
+               else
+                   LandPixels[t div 2, i div 2]:= 0;
 
 t:= y + dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
@@ -232,17 +230,16 @@
            begin
            inc(cnt);
            if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= LandBackPixel(i, t)
-           else
-               LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
+           LandPixels[t, i]:= LandBackPixel(i, t)
+            else
+           LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
            end
-       else if not isMap or ((Land[t, i] and lfObject) <> 0) then
-            begin
+       else
+            if ((Land[t, i] and lfObject) <> 0) then
             if (cReducedQuality and rqBlurryLand) = 0 then
-          	    LandPixels[t, i]:= 0
+          LandPixels[t, i]:= 0
             else
-           	    LandPixels[t div 2, i div 2]:= 0
-            end;
+           LandPixels[t div 2, i div 2]:= 0;
 
 t:= y - dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
@@ -255,13 +252,12 @@
            else
                LandPixels[t div 2, i div 2]:= LandBackPixel(i, t)
            end
-       else if not isMap or ((Land[t, i] and lfObject) <> 0) then
-           begin
-           if (cReducedQuality and rqBlurryLand) = 0 then
-               LandPixels[t, i]:= 0
-           else
-               LandPixels[t div 2, i div 2]:= 0
-           end;
+       else
+          if ((Land[t, i] and lfObject) <> 0) then
+              if (cReducedQuality and rqBlurryLand) = 0 then
+                LandPixels[t, i]:= 0
+              else
+                LandPixels[t div 2, i div 2]:= 0;
 FillLandCircleLinesBG:= cnt;
 end;
 
@@ -271,7 +267,7 @@
 t:= y + dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
             LandPixels[t, i]:= cExplosionBorderColor
@@ -286,7 +282,7 @@
 t:= y - dy;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dx, 0) to Min(x + dx, LAND_WIDTH - 1) do
-       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
               LandPixels[t, i]:= cExplosionBorderColor
@@ -300,7 +296,7 @@
 t:= y + dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
            begin
            if (cReducedQuality and rqBlurryLand) = 0 then
            LandPixels[t, i]:= cExplosionBorderColor
@@ -315,7 +311,7 @@
 t:= y - dx;
 if (t and LAND_HEIGHT_MASK) = 0 then
    for i:= Max(x - dy, 0) to Min(x + dy, LAND_WIDTH - 1) do
-       if (Land[t, i] and (lfBasic or lfObject)) <> 0 then
+       if ((Land[t, i] and lfBasic) <> 0) or ((Land[t, i] and lfObject) <> 0) then
           begin
            if (cReducedQuality and rqBlurryLand) = 0 then
           LandPixels[t, i]:= cExplosionBorderColor
@@ -418,13 +414,12 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            else if not isMap then
-                begin
-                if (cReducedQuality and rqBlurryLand) = 0 then
-                    LandPixels[ty, tx]:= 0
-                else
-                    LandPixels[ty div 2, tx div 2]:= 0
-                end;
+            else
+                if (Land[ty, tx] and lfObject) <> 0 then
+                    if (cReducedQuality and rqBlurryLand) = 0 then
+                        LandPixels[ty, tx]:= 0
+                    else
+                        LandPixels[ty div 2, tx div 2]:= 0;
     inc(y, dY)
     end;
 
@@ -435,7 +430,7 @@
     begin
     for ty:= Max(y - Radius, 0) to Min(y + Radius, LAND_HEIGHT) do
         for tx:= Max(0, ar^[i].Left - Radius) to Min(LAND_WIDTH, ar^[i].Right + Radius) do
-            if (Land[ty, tx] and (lfBasic or lfObject)) <> 0 then
+            if ((Land[ty, tx] and lfBasic) <> 0) or ((Land[ty, tx] and lfObject) <> 0) then
                 begin
                     if (cReducedQuality and rqBlurryLand) = 0 then
                         LandPixels[ty, tx]:= cExplosionBorderColor
@@ -479,12 +474,13 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and lfObject) <> 0)) then
         begin
         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
-        if (cReducedQuality and rqBlurryLand) = 0 then
+            if (cReducedQuality and rqBlurryLand) = 0 then
             LandPixels[ty, tx]:= cExplosionBorderColor
-        else
+            else
             LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
         end
     end;
@@ -504,13 +500,15 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and lfObject) <> 0)) then
         begin
         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
-        if (cReducedQuality and rqBlurryLand) = 0 then 
-            LandPixels[ty, tx]:= cExplosionBorderColor
-	    else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+            if (cReducedQuality and rqBlurryLand) = 0 then
+        LandPixels[ty, tx]:= cExplosionBorderColor
+            else
+        LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+
         end
     end;
     X:= nx;
@@ -528,13 +526,12 @@
                     LandPixels[ty, tx]:= LandBackPixel(tx, ty)
                 else
                     LandPixels[ty div 2, tx div 2]:= LandBackPixel(tx, ty)
-            else if not isMap or ((Land[ty, tx] and lfObject) <> 0) then
-                begin
+            else
+              if (Land[ty, tx] and lfObject) <> 0 then
                 if (cReducedQuality and rqBlurryLand) = 0 then
-                     LandPixels[ty, tx]:= 0
+                LandPixels[ty, tx]:= 0
                 else
-                     LandPixels[ty div 2, tx div 2]:= 0
-                end;
+                LandPixels[ty div 2, tx div 2]:= 0;
 
             Land[ty, tx]:= 0;
             end
@@ -547,13 +544,15 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and lfObject) <> 0)) then
         begin
         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
         if (cReducedQuality and rqBlurryLand) = 0 then
-            LandPixels[ty, tx]:= cExplosionBorderColor
+        LandPixels[ty, tx]:= cExplosionBorderColor
         else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+        LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+
         end
     end;
     nx:= nx - dY;
@@ -572,13 +571,14 @@
     ty:= hwRound(Y);
     if ((ty and LAND_HEIGHT_MASK) = 0) and
        ((tx and LAND_WIDTH_MASK) = 0) and
-       ((Land[ty, tx] and (lfBasic or lfObject)) <> 0) then
+       (((Land[ty, tx] and lfBasic) <> 0) or
+       ((Land[ty, tx] and lfObject) <> 0)) then
         begin
         Land[ty, tx]:= Land[ty, tx] or lfDamaged;
         if (cReducedQuality and rqBlurryLand) = 0 then
-            LandPixels[ty, tx]:= cExplosionBorderColor
+        LandPixels[ty, tx]:= cExplosionBorderColor
         else
-            LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
+        LandPixels[ty div 2, tx div 2]:= cExplosionBorderColor
         end
     end;
     nx:= nx - dY;
@@ -670,21 +670,9 @@
 
 // was experimenting with applying as damage occurred.
 function Despeckle(X, Y: LongInt): boolean;
-var nx, ny, i, j, c, xx, yy: LongInt;
-    pixelsweep: boolean;
+var nx, ny, i, j, c: LongInt;
 begin
-if (cReducedQuality and rqBlurryLand) = 0 then
-   begin
-   xx:= X;
-   yy:= Y;
-   end
-else
-   begin
-   xx:= X div 2;
-   yy:= Y div 2;
-   end;
-pixelsweep:= not isMap and ((Land[Y, X] and $FF00) = 0) and (LandPixels[yy, xx] <> 0);
-if (((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0)) or pixelsweep then
+if ((Land[Y, X] and lfDamaged) <> 0) and ((Land[Y, X] and lfIndestructible) = 0) then // check neighbours
     begin
     c:= 0;
     for i:= -1 to 1 do
@@ -694,25 +682,22 @@
                 ny:= Y + i;
                 nx:= X + j;
                 if ((ny and LAND_HEIGHT_MASK) = 0) and ((nx and LAND_WIDTH_MASK) = 0) then
-                    begin
-                    if pixelsweep then
-                        begin
-                        if ((cReducedQuality and rqBlurryLand) <> 0) then
-                            begin
-                            nx:= nx div 2;
-                            ny:= ny div 2
-                            end;
-                        if LandPixels[ny, nx] <> 0 then inc(c);
-                        end
-                    else if Land[ny, nx] > 255 then inc(c);
-                    end
+                    if Land[ny, nx] > 255 then
+                        inc(c);
                 end;
 
     if c < 4 then // 0-3 neighbours
         begin
+        if (cReducedQuality and rqBlurryLand) = 0 then
             if (Land[Y, X] and lfBasic) <> 0 then
-                LandPixels[yy, xx]:= LandBackPixel(X, Y)
-            else LandPixels[yy, xx]:= 0;
+                LandPixels[Y, X]:= LandBackPixel(X, Y)
+            else
+                LandPixels[Y, X]:= 0
+        else
+            if (Land[Y, X] and lfBasic) <> 0 then
+                LandPixels[Y div 2, X div 2]:= LandBackPixel(X, Y)
+            else
+                LandPixels[Y div 2, X div 2]:= 0;
 
         Land[Y, X]:= 0;
         exit(true);
--- a/hedgewars/uScript.pas	Sun Dec 26 00:15:41 2010 +0100
+++ b/hedgewars/uScript.pas	Sun Dec 26 00:47:18 2010 -0500
@@ -443,6 +443,25 @@
     lc_getgearmessage:= 1
 end;
 
+function lc_getgearelasticity(L : Plua_State) : LongInt; Cdecl;
+var gear : PGear;
+begin
+    if lua_gettop(L) <> 1 then
+        begin
+        LuaError('Lua: Wrong number of parameters passed to GetGearElasticity!');
+        lua_pushnil(L); // return value on stack (nil)
+        end
+    else
+        begin
+        gear:= GearByUID(lua_tointeger(L, 1));
+        if gear <> nil then
+            lua_pushinteger(L, hwRound(gear^.elasticity * _10000))
+        else
+            lua_pushnil(L);
+        end;
+    lc_getgearelasticity:= 1
+end;
+
 function lc_setgearmessage(L : Plua_State) : LongInt; Cdecl;
 var gear : PGear;
 begin
@@ -1504,6 +1523,7 @@
 lua_register(luaState, 'HogTurnLeft', @lc_hogturnleft);
 lua_register(luaState, 'CampaignLock', @lc_campaignlock);
 lua_register(luaState, 'CampaignUnlock', @lc_campaignunlock);
+lua_register(luaState, 'GetGearElasticity', @lc_getgearelasticity);
 lua_register(luaState, 'GetGearMessage', @lc_getgearmessage);
 lua_register(luaState, 'SetGearMessage', @lc_setgearmessage);
 lua_register(luaState, 'GetRandom', @lc_getrandom);
--- a/share/hedgewars/Data/Maps/Control/CMakeLists.txt	Sun Dec 26 00:15:41 2010 +0100
+++ b/share/hedgewars/Data/Maps/Control/CMakeLists.txt	Sun Dec 26 00:47:18 2010 -0500
@@ -3,4 +3,4 @@
 	map.lua
 	map.png
 	preview.png
-	DESTINATION ${SHAREPATH}Data/Maps/Cogs)
+	DESTINATION ${SHAREPATH}Data/Maps/Control)