# HG changeset patch # User nemo # Date 1255355276 0 # Node ID a4af95e6382c09c56f1159a047f573c0f2813109 # Parent b52344de23aed6e64d570af194f789e84d3fa7d5 sheepluva's basic 45° test. NEEDS TESTING diff -r b52344de23ae -r a4af95e6382c hedgewars/GSHandlers.inc --- a/hedgewars/GSHandlers.inc Mon Oct 12 13:44:34 2009 +0000 +++ b/hedgewars/GSHandlers.inc Mon Oct 12 13:47:56 2009 +0000 @@ -108,15 +108,19 @@ //////////////////////////////////////////////////////////////////////////////// procedure doStepFallingGear(Gear: PGear); -var isFalling: boolean; +var isFalling, isCollV, isCollH: boolean; +tmp: QWord; begin Gear^.State:= Gear^.State and not gstCollision; +isCollV:= false; +isCollH:= false; if Gear^.dY.isNegative then begin isFalling:= true; if TestCollisionYwithGear(Gear, -1) then begin + isCollV:= true; Gear^.dX:= Gear^.dX * Gear^.Friction; Gear^.dY:= - Gear^.dY * Gear^.Elasticity; Gear^.State:= Gear^.State or gstCollision @@ -124,6 +128,7 @@ end else if TestCollisionYwithGear(Gear, 1) then begin + isCollV:= true; isFalling:= false; Gear^.dX:= Gear^.dX * Gear^.Friction; Gear^.dY:= - Gear^.dY * Gear^.Elasticity; @@ -132,9 +137,19 @@ if TestCollisionXwithGear(Gear, hwSign(Gear^.dX)) then begin + isCollH:= true; Gear^.dX:= - Gear^.dX * Gear^.Elasticity; Gear^.dY:= Gear^.dY * Gear^.Elasticity; Gear^.State:= Gear^.State or gstCollision + end else + if TestCollisionXwithGear(Gear, -hwSign(Gear^.dX)) then + isCollH:= true; + +if isCollV and isCollH then + begin + tmp:= Gear^.dX.QWordValue; + Gear^.dX.QWordValue:= Gear^.dY.QWordValue; + Gear^.dY.QWordValue:= tmp; end; if isFalling then Gear^.dY:= Gear^.dY + cGravity; diff -r b52344de23ae -r a4af95e6382c hedgewars/uLandTemplates.pas --- a/hedgewars/uLandTemplates.pas Mon Oct 12 13:44:34 2009 +0000 +++ b/hedgewars/uLandTemplates.pas Mon Oct 12 13:47:56 2009 +0000 @@ -1917,7 +1917,7 @@ 18, 19, 20, 21, 22, 23, 24, 25, 26, 27, 28, 29, 30, 31, 32, 33, 34, 35, 37, 38 ); -const CavernTemplates: array[0..5] of Longword = (36, 15, 2, 3, 21, 29); +const CavernTemplates: array[0..4] of Longword = (36, 2, 3, 21, 29); const WackyTemplates: array[0..3] of Longword = (37, 38, 39, 40); implementation