- Fix some stupid bugs in collisions detecting code
authorunc0rr
Mon, 04 Jun 2007 21:15:24 +0000
changeset 536 33538aadb4e7
parent 535 a14eaf35cf4b
child 537 4d2e60623e44
- Fix some stupid bugs in collisions detecting code - Add new sprite to the build system
hedgewars/uCollisions.pas
share/hedgewars/Data/Graphics/CMakeLists.txt
--- a/hedgewars/uCollisions.pas	Sun Jun 03 22:19:47 2007 +0000
+++ b/hedgewars/uCollisions.pas	Mon Jun 04 21:15:24 2007 +0000
@@ -185,14 +185,15 @@
    repeat
      if (y and $FFFFFC00) = 0 then
            if Land[y, x] = COLOR_LAND then exit(true)
-                                      else flag:= true;
+           else if Land[y, x] <> 0 then flag:= true;
      inc(y)
    until (y > i);
    end;
 TestCollisionXKick:= false;
 
-if flag and (hwAbs(Gear^.dX) > cHHKick) then
+if flag then
    begin
+   if hwAbs(Gear^.dX) < cHHKick then exit(true);
    if Count = 0 then exit;
    mx:= hwRound(Gear^.X);
    my:= hwRound(Gear^.Y);
@@ -204,12 +205,10 @@
          ((mx > x) xor (Dir > 0)) then
          if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
-             Gear^.dX:= Gear^.dX {* _0_6};
-             Gear^.dY:= Gear^.dY {* _0_6};
              with cGear^ do
                   begin
-                  dX:= Gear^.dX {* _1_5};
-                  dY:= Gear^.dY {* _1_5};
+                  dX:= Gear^.dX;
+                  dY:= Gear^.dY;
                   State:= State or gstMoving;
                   Active:= true
                   end;
@@ -235,14 +234,15 @@
      if (x and $FFFFF800) = 0 then
         if Land[y, x] > 0 then
            if Land[y, x] = COLOR_LAND then exit(true)
-                                      else flag:= true;
+           else if Land[y, x] <> 0 then flag:= true;
      inc(x)
    until (x > i);
    end;
 TestCollisionYKick:= false;
 
-if flag and (hwAbs(Gear^.dX) > cHHKick) then
+if flag then
    begin
+   if hwAbs(Gear^.dX) < cHHKick then exit(true);
    if Count = 0 then exit;
    mx:= hwRound(Gear^.X);
    my:= hwRound(Gear^.Y);
@@ -254,12 +254,10 @@
          ((my > y) xor (Dir > 0)) then
          if (cGear^.Kind in [gtHedgehog, gtMine]) then
              begin
-             Gear^.dX:= Gear^.dX {* _0_6};
-             Gear^.dY:= Gear^.dY {* _0_6};
              with cGear^ do
                   begin
-                  dX:= Gear^.dX {* _1_5};
-                  dY:= Gear^.dY {* _1_5};
+                  dX:= Gear^.dX;
+                  dY:= Gear^.dY;
                   State:= State or gstMoving;
                   Active:= true
                   end;
--- a/share/hedgewars/Data/Graphics/CMakeLists.txt	Sun Jun 03 22:19:47 2007 +0000
+++ b/share/hedgewars/Data/Graphics/CMakeLists.txt	Mon Jun 04 21:15:24 2007 +0000
@@ -34,6 +34,7 @@
 	RopeHook.png
 	RopeNode.png
 	SmokeTrace.png
+	Switch.png
 	Targetp.png
 	thinking.png
 	UFO.png