Experiment in making ice more treacherous. also tweak to snow/christmas flake spawn
authornemo
Mon, 10 Oct 2011 14:13:35 -0400
changeset 6117 2a4829172a29
parent 6116 93e04cddd08e
child 6118 7684ca4f9808
Experiment in making ice more treacherous. also tweak to snow/christmas flake spawn
hedgewars/HHHandlers.inc
hedgewars/uVisualGears.pas
--- a/hedgewars/HHHandlers.inc	Sun Oct 09 21:47:47 2011 -0400
+++ b/hedgewars/HHHandlers.inc	Mon Oct 10 14:13:35 2011 -0400
@@ -1095,6 +1095,9 @@
 
 ////////////////////////////////////////////////////////////////////////////////
 procedure doStepHedgehog(Gear: PGear);
+(*
+var x,y,tx,ty: LongInt;
+    tdX, tdY, slope: hwFloat; *)
 begin
 if (Gear^.Message and gmDestroy) <> 0 then
     begin
@@ -1112,4 +1115,32 @@
         else
             doStepHedgehogDriven(Gear)
     end;
+
+if ((GameTicks mod 100) = 0) and (Gear^.State and (gstMoving or gstHHJumping or gstHHHJump) = 0) and ((Gear^.Message and gmAllStoppable) = 0) and 
+    (TestCollisionYwithGear(Gear, 1) and lfIce <> 0) then
+    begin
+    if CheckLandValue(hwRound(Gear^.X), hwRound(Gear^.Y)+cHHRadius, lfIce) then
+        begin
+        Gear^.dX.QWordValue:= Gear^.dX.QWordValue + cGravity.QWordValue * 150;
+        Gear^.State:= Gear^.State or gstMoving;
+        end
+(*
+    // check land slope, and impart a dX based on it
+    tdX:= Gear^.dX;
+    tdY:= Gear^.dY;
+    Gear^.dX:= _0;
+    Gear^.dY:= _1;
+    x := hwRound(Gear^.X);
+    y := hwRound(Gear^.Y);
+    tx := 0;
+    ty := 0;
+    if not CalcSlopeTangent(Gear, x, y+cHHRadius, tx, ty, 255) then
+        begin
+        slope:= _1/DistanceI(tx,ty);
+        AddFileLog(FloatToStr(tdX)+ ' == '+FloatToStr(slope));
+        tdX:= tdX + (cGravity * slope / _10)  // this will need tuning 
+        end;
+    Gear^.dX:= tdX;
+    Gear^.dY:= tdY  *)
+    end;
 end;
--- a/hedgewars/uVisualGears.pas	Sun Oct 09 21:47:47 2011 -0400
+++ b/hedgewars/uVisualGears.pas	Mon Oct 10 14:13:35 2011 -0400
@@ -768,7 +768,7 @@
 begin
 if (cReducedQuality and rqKillFlakes) <> 0 then exit;
 
-if ((GameFlags and gfBorder) <> 0) or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then
+if hasBorder or ((Theme <> 'Snow') and (Theme <> 'Christmas')) then
     for i:= 0 to Pred(vobCount * cScreenSpace div LAND_WIDTH) do
         AddVisualGear(cLeftScreenBorder + random(cScreenSpace), random(1024+200) - 100 + LAND_HEIGHT, vgtFlake)
 else