Browse Source

ship slide left/right

Dave Schuyler 20 years ago
parent
commit
66c1e93888
2 changed files with 37 additions and 6 deletions
  1. 31 0
      direct/src/controls/ControlManager.py
  2. 6 6
      direct/src/controls/ShipPilot.py

+ 31 - 0
direct/src/controls/ControlManager.py

@@ -114,6 +114,37 @@ class ControlManager:
             inputState.watch("turnRight", "control-alt-e", "e-up")
             inputState.watch("turnRight", "control-alt-e", "e-up")
             inputState.watch("turnRight", "shift-e", "e-up")
             inputState.watch("turnRight", "shift-e", "e-up")
 
 
+            
+            # Ship turns and slides are reversed from avatar walking
+            inputState.watch("shipSlideLeft", "q", "q-up")
+            inputState.watch("shipSlideLeft", "control-q", "q-up")
+            inputState.watch("shipSlideLeft", "shift-control-q", "q-up")
+            inputState.watch("shipSlideLeft", "alt-q", "alt-q-up")
+            inputState.watch("shipSlideLeft", "control-alt-q", "alt-q-up")
+            inputState.watch("shipSlideLeft", "shift-q", "q-up")
+
+            inputState.watch("shipSlideRight", "e", "e-up")
+            inputState.watch("shipSlideRight", "control-e", "e-up")
+            inputState.watch("shipSlideRight", "shift-control-e", "e-up")
+            inputState.watch("shipSlideRight", "alt-e", "e-up")
+            inputState.watch("shipSlideRight", "control-alt-e", "e-up")
+            inputState.watch("shipSlideRight", "shift-e", "e-up")
+
+            # Ship turns and slides are reversed from avatar walking
+            inputState.watch("shipTurnLeft", "a", "a-up")
+            inputState.watch("shipTurnLeft", "control-a", "a-up")
+            inputState.watch("shipTurnLeft", "shift-control-a", "a-up")
+            inputState.watch("shipTurnLeft", "alt-a", "alt-a-up")
+            inputState.watch("shipTurnLeft", "control-alt-a", "alt-a-up")
+            inputState.watch("shipTurnLeft", "shift-a", "a-up")
+
+            inputState.watch("shipTurnRight", "d", "d-up")
+            inputState.watch("shipTurnRight", "control-d", "d-up")
+            inputState.watch("shipTurnRight", "shift-control-d", "d-up")
+            inputState.watch("shipTurnRight", "alt-d", "d-up")
+            inputState.watch("shipTurnRight", "control-alt-d", "d-up")
+            inputState.watch("shipTurnRight", "shift-d", "d-up")
+
 
 
         # Jump controls
         # Jump controls
         if self.wantWASD:
         if self.wantWASD:

+ 6 - 6
direct/src/controls/ShipPilot.py

@@ -608,11 +608,11 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
         # get the button states:
         # get the button states:
         forward = inputState.isSet("forward")
         forward = inputState.isSet("forward")
         reverse = inputState.isSet("reverse")
         reverse = inputState.isSet("reverse")
-        turnLeft = inputState.isSet("turnLeft")
-        turnRight = inputState.isSet("turnRight")
-        slide = 0#inputState.isSet("slide")
-        slideLeft = 0#inputState.isSet("slideLeft")
-        slideRight = 0#inputState.isSet("slideRight")
+        turnLeft = inputState.isSet("shipTurnLeft")
+        turnRight = inputState.isSet("shipTurnRight")
+        slide = inputState.isSet("slide")
+        slideLeft = inputState.isSet("shipSlideLeft")
+        slideRight = inputState.isSet("shipSlideRight")
         jump = inputState.isSet("jump")
         jump = inputState.isSet("jump")
         # Determine what the speeds are based on the buttons:
         # Determine what the speeds are based on the buttons:
 
 
@@ -640,7 +640,7 @@ class ShipPilot(PhysicsWalker.PhysicsWalker):
         #self.__slideSpeed=slide and (
         #self.__slideSpeed=slide and (
         #        (turnLeft and -avatarSlideSpeed) or 
         #        (turnLeft and -avatarSlideSpeed) or 
         #        (turnRight and avatarSlideSpeed))
         #        (turnRight and avatarSlideSpeed))
-        self.__slideSpeed=(
+        self.__slideSpeed=(forward or reverse) and (
                 (slideLeft and -avatarSlideSpeed) or 
                 (slideLeft and -avatarSlideSpeed) or 
                 (slideRight and avatarSlideSpeed))
                 (slideRight and avatarSlideSpeed))
         self.__rotationSpeed=not slide and (
         self.__rotationSpeed=not slide and (