- Allow camera movement while current hedgehog is falling
authorunc0rr
Tue, 05 Jun 2012 14:07:28 +0400
changeset 7187 aff30d80bd7b
parent 7185 92a045156255
child 7189 c45b0ef1eb4c
- Allow camera movement while current hedgehog is falling - Some tiny changes
hedgewars/uCommandHandlers.pas
hedgewars/uGearsHedgehog.pas
hedgewars/uWorld.pas
--- a/hedgewars/uCommandHandlers.pas	Tue Jun 05 19:36:07 2012 +0200
+++ b/hedgewars/uCommandHandlers.pas	Tue Jun 05 14:07:28 2012 +0400
@@ -436,7 +436,7 @@
         end
     else
         TryDo(checksum = lastTurnChecksum, 'Desync detected', true);
-    AddFileLog('Doing SwitchHedgehog: time '+inttostr(GameTicks));
+    AddFileLog('Next turn: time '+inttostr(GameTicks));
 end;
 
 procedure chTimer(var s: shortstring);
--- a/hedgewars/uGearsHedgehog.pas	Tue Jun 05 19:36:07 2012 +0200
+++ b/hedgewars/uGearsHedgehog.pas	Tue Jun 05 14:07:28 2012 +0400
@@ -707,12 +707,10 @@
     if (Gear^.Message and gmLeft  )<>0 then
         Gear^.dX:= -cLittle else
     if (Gear^.Message and gmRight )<>0 then
-        Gear^.dX:=  cLittle else exit;
+        Gear^.dX:=  cLittle 
+        else exit;
 
-    if (Gear^.Message and (gmLeft or gmRight)) <> 0 then
-        begin
-        StepSoundTimer:= cHHStepTicks;
-        end;
+    StepSoundTimer:= cHHStepTicks;
    
     GHStepTicks:= cHHStepTicks;
     if PrevdX <> hwSign(Gear^.dX) then
@@ -837,6 +835,7 @@
     if (CurrentHedgehog^.Gear = Gear)
         and (hwSqr(Gear^.dX) + hwSqr(Gear^.dY) > _0_003) then 
         begin
+        // TODO: why so aggressive at setting FollowGear when falling?
         FollowGear:= Gear;
         end;
     if isUnderwater then
--- a/hedgewars/uWorld.pas	Tue Jun 05 19:36:07 2012 +0200
+++ b/hedgewars/uWorld.pas	Tue Jun 05 14:07:28 2012 +0400
@@ -1606,7 +1606,10 @@
 {$ENDIF}
 z:= round(200/zoom);
 if not PlacingHogs and (FollowGear <> nil) and (not isCursorVisible) and (not bShowAmmoMenu) and (not fastUntilLag) then
-    if (not autoCameraOn) or ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
+    if (not autoCameraOn) then
+        FollowGear:= nil
+    else        
+    if ((abs(CursorPoint.X - prevPoint.X) + abs(CursorPoint.Y - prevpoint.Y)) > 4) then
         begin
         FollowGear:= nil;
         prevPoint:= CursorPoint;
@@ -1656,7 +1659,7 @@
     EdgesDist:= cGearScrEdgesDist;
 
 // this generates the border around the screen that moves the camera when cursor is near it
-if isCursorVisible or (FollowGear <> nil) then
+if isCursorVisible or ((FollowGear <> nil) and autoCameraOn) then
     begin
     if CursorPoint.X < - cScreenWidth div 2 + EdgesDist then
         begin