X-Git-Url: https://git.artsoft.org/?a=blobdiff_plain;f=src%2Fgame_sp%2FInput.c;h=5271795c48a8ee35bccad43f318b9504b3bb9643;hb=4a8368abd71c718621838773eed914b5bbd4e1d8;hp=42ad1201ae2c8d4e93d35c27545d02b8a032bd70;hpb=1e83803d7c99eb5232eab7d48a4194de3cf6f77f;p=rocksndiamonds.git diff --git a/src/game_sp/Input.c b/src/game_sp/Input.c index 42ad1201..5271795c 100644 --- a/src/game_sp/Input.c +++ b/src/game_sp/Input.c @@ -24,6 +24,37 @@ DemoBufferObject DemoBuffer; int KeyScanCode7; +int map_key_RND_to_SP(int key) +{ + if (key & KEY_BUTTON) + { + return (key & MV_UP ? keySpaceUp : + key & MV_LEFT ? keySpaceLeft : + key & MV_DOWN ? keySpaceDown : + key & MV_RIGHT ? keySpaceRight : keySpace); + } + else + { + return (key & MV_UP ? keyUp : + key & MV_LEFT ? keyLeft : + key & MV_DOWN ? keyDown : + key & MV_RIGHT ? keyRight : keyNone); + } +} + +int map_key_SP_to_RND(int key) +{ + return (key == keyUp ? MV_UP : + key == keyLeft ? MV_LEFT : + key == keyDown ? MV_DOWN : + key == keyRight ? MV_RIGHT : + key == keySpaceUp ? KEY_BUTTON | MV_UP : + key == keySpaceLeft ? KEY_BUTTON | MV_LEFT : + key == keySpaceDown ? KEY_BUTTON | MV_DOWN : + key == keySpaceRight ? KEY_BUTTON | MV_RIGHT : + key == keySpace ? KEY_BUTTON : MV_NONE); +} + void subCheckJoystick() { } @@ -37,12 +68,24 @@ int subCheckRightMouseButton() return subCheckRightMouseButton; } -int subProcessKeyboardInput() +int subProcessKeyboardInput(byte action) { int subProcessKeyboardInput; static int LastKey = 0; +#if 1 + + DemoKeyCode = map_key_RND_to_SP(action); + +#if 0 + printf("::: DemoKeyCode == %d\n", DemoKeyCode); +#endif + + return subProcessKeyboardInput; + +#else + // On Error GoTo NoKeyboardAccessEH // Call DKeyboard.Acquire // On Error GoTo 0 @@ -51,9 +94,13 @@ int subProcessKeyboardInput() if (DemoFlag != 0) { subGetNextDemoKey(); + +#if 0 + printf("::: DemoKeyCode == %d\n", DemoKeyCode); +#endif + if (ExitToMenuFlag != 0) return subProcessKeyboardInput; - } else { @@ -106,6 +153,8 @@ int subProcessKeyboardInput() } } +#endif + // demo recording if (RecordDemoFlag == 1) DemoBuffer.AddDemoKey(DemoKeyCode);