rnd-20091023-1-src
[rocksndiamonds.git] / src / game_sp / Input.c
index 24438057c0810497bd8b7105d3515075bfff8506..a846aaf6e047dd37e50748014dc5856d1420bb89 100644 (file)
@@ -4,7 +4,8 @@
 
 #include "Input.h"
 
-static char *VB_Name = "modInput";
+// static char *VB_Name = "modInput";
+
 // --- Option Explicit
 
 boolean KeyState[255 + 1];
@@ -36,11 +37,32 @@ int subCheckRightMouseButton()
   return subCheckRightMouseButton;
 }
 
-int subProcessKeyboardInput()
+int subProcessKeyboardInput(byte action)
 {
   int subProcessKeyboardInput;
 
-  int LastKey;
+  static int LastKey = 0;
+
+#if 1
+
+  if (action & KEY_BUTTON)
+  {
+    DemoKeyCode = (action & MV_UP      ? keySpaceUp    :
+                  action & MV_LEFT     ? keySpaceLeft  :
+                  action & MV_DOWN     ? keySpaceDown  :
+                  action & MV_RIGHT    ? keySpaceRight : keySpace);
+  }
+  else
+  {
+    DemoKeyCode = (action & MV_UP      ? keyUp         :
+                  action & MV_LEFT     ? keyLeft       :
+                  action & MV_DOWN     ? keyDown       :
+                  action & MV_RIGHT    ? keyRight      : keyNone);
+  }
+
+  return subProcessKeyboardInput;
+
+#else
 
   //  On Error GoTo NoKeyboardAccessEH
   //    Call DKeyboard.Acquire
@@ -50,9 +72,9 @@ int subProcessKeyboardInput()
   if (DemoFlag != 0)
   {
     subGetNextDemoKey();
+
     if (ExitToMenuFlag != 0)
       return subProcessKeyboardInput;
-
   }
   else
   {
@@ -105,6 +127,8 @@ int subProcessKeyboardInput()
     }
   }
 
+#endif
+
   // demo recording
   if (RecordDemoFlag == 1)
     DemoBuffer.AddDemoKey(DemoKeyCode);
@@ -125,6 +149,10 @@ int subProcessKeyboardInput()
     }
     else
     {
+#if 1
+      printf("::: Input.c: subProcessKeyboardInput(): kill murphy\n");
+#endif
+
       KillMurphyFlag = 1;
       //        ExplodeFieldSP MurphyPosIndex
       //        LeadOutCounter = &H20
@@ -148,7 +176,7 @@ int subProcessKeyboardInput()
   //  Call DKeyboard.Unacquire
   return subProcessKeyboardInput;
 
-NoKeyboardAccessEH:
+  // NoKeyboardAccessEH:
   Debug.Print("! Keyboard access");
 
   return subProcessKeyboardInput;