hedgewars/uAI.pas
branchwebgl
changeset 8096 453917e94e55
parent 8026 4a4f21070479
parent 8036 89740f927254
child 8833 c13ebed437cb
--- a/hedgewars/uAI.pas	Wed Nov 14 00:23:29 2012 +0100
+++ b/hedgewars/uAI.pas	Thu Nov 22 00:41:53 2012 +0100
@@ -296,18 +296,13 @@
                     begin
                     with Stack.States[Pred(Stack.Count)] do
                         begin
-                        if Me^.dX.isNegative then
+                        if (Me^.Message and gmLeft) <> 0 then
                             AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0)
                         else
                             AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0);
                             
                         AddAction(MadeActions, aia_HJump, 0, 305 + random(50), 0, 0);
                         AddAction(MadeActions, aia_HJump, 0, 350, 0, 0);
-                        
-                        if Me^.dX.isNegative then
-                            AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0)
-                        else
-                            AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);
                         end;
                     // but first check walking forward
                     Push(ticks, Stack.States[Pred(Stack.Count)].MadeActions, AltMe, Me^.Message)
@@ -322,7 +317,14 @@
                 // at final check where we go after jump walking backward
                 if Push(ticks, Actions, AltMe, Me^.Message xor 3) then
                     with Stack.States[Pred(Stack.Count)] do
+                        begin
+                        if (Me^.Message and gmLeft) <> 0 then
+                            AddAction(MadeActions, aia_LookLeft, 0, 200, 0, 0)
+                        else
+                            AddAction(MadeActions, aia_LookRight, 0, 200, 0, 0);
+
                         AddAction(MadeActions, aia_LJump, 0, 305 + random(50), 0, 0);
+                        end;
 
                 // push current position so we proceed from it after checking jump+forward walk opportunities
                 if CanGo then Push(ticks, Actions, Me^, Me^.Message);
@@ -358,6 +360,7 @@
                 addMark(hwRound(Me^.X), hwRound(Me^.Y), markWalkedHere);
 
                 TestAmmos(Actions, Me, ticks shr 12 = oldticks shr 12);
+                
                 end;
                 
             if GoInfo.FallPix >= FallPixForBranching then
@@ -454,7 +457,7 @@
             AddAction(BestActions, aia_Skip, 0, 250, 0, 0);
             end;
 
-        end else
+        end else SDL_Delay(100)
 else
     begin
     BackMe:= PGear(Me)^;