]> 4ch.mooo.com Git - 16.git/blobdiff - 16/keen456/KEEN4-6/ID_IN.H
extrcted keen code remake
[16.git] / 16 / keen456 / KEEN4-6 / ID_IN.H
diff --git a/16/keen456/KEEN4-6/ID_IN.H b/16/keen456/KEEN4-6/ID_IN.H
new file mode 100755 (executable)
index 0000000..d3ade29
--- /dev/null
@@ -0,0 +1,232 @@
+/* Reconstructed Commander Keen 4-6 Source Code\r
+ * Copyright (C) 2021 K1n9_Duk3\r
+ *\r
+ * This file is primarily based on:\r
+ * Catacomb 3-D Source Code\r
+ * Copyright (C) 1993-2014 Flat Rock Software\r
+ *\r
+ * This program is free software; you can redistribute it and/or modify\r
+ * it under the terms of the GNU General Public License as published by\r
+ * the Free Software Foundation; either version 2 of the License, or\r
+ * (at your option) any later version.\r
+ *\r
+ * This program is distributed in the hope that it will be useful,\r
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of\r
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the\r
+ * GNU General Public License for more details.\r
+ *\r
+ * You should have received a copy of the GNU General Public License along\r
+ * with this program; if not, write to the Free Software Foundation, Inc.,\r
+ * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.\r
+ */\r
+\r
+//\r
+//     ID Engine\r
+//     ID_IN.h - Header file for Input Manager\r
+//     v1.0d1\r
+//     By Jason Blochowiak\r
+//\r
+\r
+#ifndef        __TYPES__\r
+#include "ID_Types.h"\r
+#endif\r
+\r
+#ifndef        __ID_IN__\r
+#define        __ID_IN__\r
+\r
+#ifdef __DEBUG__\r
+#define        __DEBUG_InputMgr__\r
+#endif\r
+\r
+#define        MaxPlayers      4\r
+#define        MaxKbds         2\r
+#define        MaxJoys         2\r
+#define        NumCodes        128\r
+\r
+typedef        byte            ScanCode;\r
+#define        sc_None                 0\r
+#define        sc_Bad                  0xff\r
+#define        sc_Return               0x1c\r
+#define        sc_Enter                sc_Return\r
+#define        sc_Escape               0x01\r
+#define        sc_Space                0x39\r
+#define        sc_BackSpace    0x0e\r
+#define        sc_Tab                  0x0f\r
+#define        sc_Alt                  0x38\r
+#define        sc_Control              0x1d\r
+#define        sc_CapsLock             0x3a\r
+#define        sc_LShift               0x2a\r
+#define        sc_RShift               0x36\r
+#define        sc_UpArrow              0x48\r
+#define        sc_DownArrow    0x50\r
+#define        sc_LeftArrow    0x4b\r
+#define        sc_RightArrow   0x4d\r
+#define        sc_Insert               0x52\r
+#define        sc_Delete               0x53\r
+#define        sc_Home                 0x47\r
+#define        sc_End                  0x4f\r
+#define        sc_PgUp                 0x49\r
+#define        sc_PgDn                 0x51\r
+#define        sc_F1                   0x3b\r
+#define        sc_F2                   0x3c\r
+#define        sc_F3                   0x3d\r
+#define        sc_F4                   0x3e\r
+#define        sc_F5                   0x3f\r
+#define        sc_F6                   0x40\r
+#define        sc_F7                   0x41\r
+#define        sc_F8                   0x42\r
+#define        sc_F9                   0x43\r
+#define        sc_F10                  0x44\r
+#define        sc_F11                  0x57\r
+#define        sc_F12                  0x59    // BUG: F12 uses scan code 0x58!\r
+\r
+#define        sc_A                    0x1e\r
+#define        sc_B                    0x30\r
+#define        sc_C                    0x2e\r
+#define        sc_D                    0x20\r
+#define        sc_E                    0x12\r
+#define        sc_F                    0x21\r
+#define        sc_G                    0x22\r
+#define        sc_H                    0x23\r
+#define        sc_I                    0x17\r
+#define        sc_J                    0x24\r
+#define        sc_K                    0x25\r
+#define        sc_L                    0x26\r
+#define        sc_M                    0x32\r
+#define        sc_N                    0x31\r
+#define        sc_O                    0x18\r
+#define        sc_P                    0x19\r
+#define        sc_Q                    0x10\r
+#define        sc_R                    0x13\r
+#define        sc_S                    0x1f\r
+#define        sc_T                    0x14\r
+#define        sc_U                    0x16\r
+#define        sc_V                    0x2f\r
+#define        sc_W                    0x11\r
+#define        sc_X                    0x2d\r
+#define        sc_Y                    0x15\r
+#define        sc_Z                    0x2c\r
+\r
+#define        sc_1                    0x02\r
+#define        sc_2                    0x03\r
+#define        sc_3                    0x04\r
+#define        sc_4                    0x05\r
+#define        sc_5                    0x06\r
+#define        sc_6                    0x07\r
+#define        sc_7                    0x08\r
+#define        sc_8                    0x09\r
+#define        sc_9                    0x0a\r
+#define        sc_0                    0x0b\r
+\r
+#define        key_None                0\r
+#define        key_Return              0x0d\r
+#define        key_Enter               key_Return\r
+#define        key_Escape              0x1b\r
+#define        key_Space               0x20\r
+#define        key_BackSpace   0x08\r
+#define        key_Tab                 0x09\r
+#define        key_Delete              0x7f\r
+\r
+//     Stuff for the mouse\r
+#define        MReset          0\r
+#define        MButtons        3\r
+#define        MDelta          11\r
+\r
+#define        MouseInt        0x33\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
+typedef        enum            {\r
+                                               demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
+                                       } Demo;\r
+typedef        enum            {\r
+                                               ctrl_Keyboard,\r
+                                                       ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
+                                               ctrl_Joystick,\r
+                                                       ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
+                                               ctrl_Mouse\r
+                                       } ControlType;\r
+typedef        enum            {\r
+                                               motion_Left = -1,motion_Up = -1,\r
+                                               motion_None = 0,\r
+                                               motion_Right = 1,motion_Down = 1\r
+                                       } Motion;\r
+typedef        enum            {\r
+                                               dir_North,dir_NorthEast,\r
+                                               dir_East,dir_SouthEast,\r
+                                               dir_South,dir_SouthWest,\r
+                                               dir_West,dir_NorthWest,\r
+                                               dir_None\r
+                                       } Direction;\r
+typedef        enum            {\r
+                                               ga_Jump,\r
+                                               ga_Pogo,\r
+                                               ga_Fire,\r
+                                               ga_Status\r
+                                       } GravisAType;\r
+typedef        struct          {\r
+                                               boolean         button0,button1;\r
+                                               int                     x,y;\r
+                                               Motion          xaxis,yaxis;\r
+                                               Direction       dir;\r
+                                       } CursorInfo;\r
+typedef        CursorInfo      ControlInfo;\r
+typedef        struct          {\r
+                                               ScanCode        button0,button1,\r
+                                                                       upleft,         up,             upright,\r
+                                                                       left,                           right,\r
+                                                                       downleft,       down,   downright;\r
+                                       } KeyboardDef;\r
+typedef        struct          {\r
+                                               word            joyMinX,joyMinY,\r
+                                                                       threshMinX,threshMinY,\r
+                                                                       threshMaxX,threshMaxY,\r
+                                                                       joyMaxX,joyMaxY,\r
+                                                                       joyMultXL,joyMultYL,\r
+                                                                       joyMultXH,joyMultYH;\r
+                                       } JoystickDef;\r
+// Global variables\r
+extern boolean         Keyboard[],\r
+                                       MousePresent,\r
+                                       JoysPresent[];\r
+extern boolean         Paused;\r
+extern char            LastASCII;\r
+extern ScanCode        LastScan;\r
+extern KeyboardDef     KbdDefs[];\r
+extern JoystickDef     JoyDefs[];\r
+extern ControlType     Controls[MaxPlayers];\r
+extern boolean         GravisGamepad;\r
+extern word            GravisAction[4];\r
+extern word            GravisMap[4];\r
+\r
+extern Demo            DemoMode;\r
+extern byte _seg       *DemoBuffer;\r
+extern word            DemoOffset,DemoSize;\r
+\r
+// Function prototypes\r
+#define        IN_KeyDown(code)        (Keyboard[(code)])\r
+#define        IN_ClearKey(code)       {Keyboard[code] = false;\\r
+                                                       if (code == LastScan) LastScan = sc_None;}\r
+\r
+// DEBUG - put names in prototypes\r
+extern void            IN_Startup(void),IN_Shutdown(void),\r
+                                       IN_Default(boolean gotit,ControlType in),\r
+                                       IN_SetKeyHook(void (*)()),\r
+                                       IN_ClearKeysDown(void),\r
+                                       IN_ReadCursor(CursorInfo *),\r
+                                       IN_ReadControl(int,ControlInfo *),\r
+                                       IN_SetControlType(int,ControlType),\r
+                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+                                       IN_SetupJoy(word joy,word minx,word maxx,\r
+                                                               word miny,word maxy),\r
+                                       IN_StartDemoPlayback(byte _seg *buffer,word bufsize),\r
+                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
+                                       IN_Ack(void),IN_AckBack(void);\r
+extern boolean         IN_UserInput(longword delay,boolean clear),\r
+                                       IN_IsUserInput(void),\r
+                                       IN_StartDemoRecord(word bufsize);\r
+extern byte            *IN_GetScanName(ScanCode);\r
+extern char            IN_WaitForASCII(void);\r
+extern ScanCode        IN_WaitForKey(void);\r
+extern word            IN_GetJoyButtonsDB(word joy);\r
+\r
+#endif\r