OSDN Git Service

no idea how to get joy buttons 2 and 3 to function.
[proj16/16.git] / src / lib / 16_in.h
old mode 100644 (file)
new mode 100755 (executable)
index 8008ab8..e85b624
@@ -1,21 +1,24 @@
-/* Catacomb Apocalypse Source Code\r
- * Copyright (C) 1993-2014 Flat Rock Software\r
+/* Project 16 Source Code~\r
+ * Copyright (C) 2012-2021 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover\r
  *\r
- * This program is free software; you can redistribute it and/or modify\r
+ * This file is part of Project 16.\r
+ *\r
+ * Project 16 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
+ * the Free Software Foundation; either version 3 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
+ * Project 16 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
+ * You should have received a copy of the GNU General Public License\r
+ * along with this program.  If not, see <http://www.gnu.org/licenses/>, or\r
+ * write to the Free Software Foundation, Inc., 51 Franklin Street,\r
+ * Fifth Floor, Boston, MA 02110-1301 USA.\r
+ *\r
  */\r
-\r
 //\r
 //     ID Engine\r
 //     ID_IN.h - Header file for Input Manager\r
 #define        __16_IN__\r
 \r
 #include <string.h>\r
-#include "src/lib/16_head.h"
-#include "src/lib/bitmap.h"\r
-\r
-#ifdef __DEBUG__\r
-//#define      __DEBUG_InputMgr__\r
-#endif\r
-\r
-#ifdef __DEBUG_InputMgr__\r
-#define TESTKEYIN\r
-//#define TESTCONTROLNOISY\r
+#include "src/lib/16_head.h"\r
+#include "src/lib/16_timer.h"\r
+#include "src/lib/16_dbg.h"\r
+#ifdef __WATCOMC__     //borland C BCEXMM.EXE\r
+#include "src/lib/16_spri.h"\r
+#include "src/lib/16_enti.h"\r
 #endif\r
 \r
 #define        KeyInt  9       // The keyboard ISR number\r
 #define        JoyScaleShift   8\r
 #define        MaxJoyValue             5000\r
 \r
-#define        MaxPlayers      4\r
+//#define      MaxPlayers              2//future plans for multiple playable charaters and being able to alternate\r
 #define        MaxKbds         2\r
 #define        MaxJoys         2\r
-#define        MaxPads         2\r
 #define        NumCodes        128\r
 \r
-typedef        byte            ScanCode;\r
+//typedef      byte            ScanCode;\r
 #define        sc_None                 0\r
 #define        sc_Bad                  0xff\r
 #define        sc_Return               0x1c\r
@@ -140,27 +138,33 @@ typedef   byte            ScanCode;
 #define        key_LSuper                      0x5b\r
 #define        key_RSuper                      0x5c\r
 #define        key_Menu                        0x5d\r
+#define        sc_LBrkt                0x1a    //      [\r
+#define        sc_RBrkt                0x1b    //      ]\r
+#define        sc_BackSlash    0x2b    //      |\r
+#define        sc_ForeSlash    0x35    //      / ?\r
 \r
 //     Stuff for the mouse\r
-#define        MReset          0\r
+//moved to 16_tdef.h\r
+/*#define      MReset          0\r
 #define        MButtons        3\r
 #define        MDelta          11\r
 \r
-#define        MouseInt        0x33\r
+#define        MouseInt        0x33*/\r
+#define        Mouse(x)        _AX = x,geninterrupt(MouseInt)\r
+\r
 #ifdef DEMO0\r
 typedef        enum            {\r
                                                demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
                                        } Demo;\r
 #endif\r
-typedef        enum            {\r
+//moved to 16_tdef.h\r
+/*typedef      enum            {\r
                                                //ctrl_None,                            // MDM (GAMERS EDGE) - added\r
                                                ctrl_Keyboard,\r
                                                        ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
                                                ctrl_Joystick,\r
                                                        ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
                                                ctrl_Mouse,\r
-                                               ctrl_Joypad,\r
-                                                       ctrl_Joypad1 = ctrl_Joypad,ctrl_Joypad2\r
                                        } ControlType;\r
 typedef        enum            {\r
                                                motion_Left = -1,motion_Up = -1,\r
@@ -175,14 +179,14 @@ typedef   enum            {
                                                dir_South,//dir_Soutinest,\r
                                        } Direction;\r
 typedef        struct          {\r
-                                               boolean         button0,button1,button2,button3;\r
-                                               int                     x,y;\r
-                                               Motion          xaxis,yaxis;\r
-                                               Direction       dir;\r
+                                               boolean near    button0,button1,button2,button3;\r
+                                               int     near            x,y;\r
+                                               Motion  near    xaxis,yaxis;\r
+                                               Direction near  dir;\r
                                        } CursorInfo;\r
 \r
 typedef        struct          {\r
-                                               ScanCode        button0,button1,\r
+                                               ScanCode near   button0,button1,\r
                                                                        //upleft,\r
                                                                        up,\r
                                                                        down,\r
@@ -194,36 +198,13 @@ typedef   struct          {
                                                                        ;\r
                                        } KeyboardDef;\r
 typedef        struct          {\r
-                                               word            joyMinX,joyMinY,\r
+                                               word    near    joyMinX,joyMinY,\r
                                                                        threshMinX,threshMinY,\r
                                                                        threshMaxX,threshMaxY,\r
                                                                        joyMaxX,joyMaxY,\r
                                                                        joyMultXL,joyMultYL,\r
                                                                        joyMultXH,joyMultYH;\r
-                                       } JoystickDef;\r
-typedef        struct\r
-{\r
-       boolean w;\r
-} JoypadDef;\r
-\r
-typedef        struct\r
-{\r
-       int x; //player exact position on the viewable map\r
-       int y; //player exact position on the viewable map\r
-       int tx; //player tile position on the viewable map\r
-       int ty; //player tile position on the viewable map\r
-       int triggerx; //player's trigger box tile position on the viewable map\r
-       int triggery; //player's trigger box tile position on the viewable map\r
-       int setx; //NOT USED YET! player sprite sheet set on the image x\r
-       int sety; //NOT USED YET! player sprite sheet set on the image y\r
-       word q; //loop variable
-       word speed;             //player speed!\r
-       bitmap_t data; //supposively the sprite sheet data\r
-       int hp; //hitpoints of the player
-       word persist_aniframe;    /* gonna be increased to 1 before being used, so 0 is ok for default */\r
-       CursorInfo      info;\r
-       ControlType     Controls;
-} player_t;\r
+                                       } JoystickDef;*/\r
 \r
 /*\r
 =============================================================================\r
@@ -232,70 +213,53 @@ typedef   struct
 \r
 =============================================================================\r
 */\r
-/*extern struct inconfig\r
-{\r
-       boolean                 MousePresent;\r
-       boolean                 JoysPresent[MaxJoys];\r
-       boolean                 JoyPadPresent[MaxPads];\r
-       boolean         Keyboard[NumCodes];\r
-       boolean         Paused;\r
-       char            LastASCII;\r
-       ScanCode        LastScan;\r
-\r
-       KeyboardDef     KbdDefs[MaxKbds];\r
-       JoystickDef     JoyDefs[MaxJoys];\r
-       JoypadDef       JoypadDefs[MaxPads];\r
-} inpu;*/\r
-\r
 #ifdef DEMO0\r
                static Demo             DemoMode = demo_Off;\r
                static byte /*_seg*/    *DemoBuffer;\r
                static word             DemoOffset,DemoSize;\r
 #endif\r
 \r
-extern dword far* clockdw;\r
-\r
 //     Internal routines\r
-extern void interrupt INL_KeyService();\r
-extern void Mouse(int x);\r
-//static void INL_GetMouseDelta(int *x,int *y);\r
-//static word INL_GetMouseButtons(void);\r
-extern void IN_GetJoyAbs(word joy,word *xp,word *yp);\r
-//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);\r
-//static word INL_GetJoyButtons(word joy);\r
-extern word IN_GetJoyButtonsDB(word joy);\r
-//static void INL_StartKbd(void);\r
-//static void INL_ShutKbd(void);\r
-//static boolean INL_StartMouse(void);\r
-//static void INL_ShutMouse(void);\r
-//static void INL_SetJoyScale(word joy);\r
-extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);\r
-//static boolean INL_StartJoy(word joy);\r
-//static void INL_ShutJoy(word joy);\r
-extern void IN_Startup();\r
-extern void IN_Default(boolean gotit,player_t *player,ControlType nt);\r
-extern void IN_Shutdown();\r
-extern void IN_SetKeyHook(void (*hook)());\r
-extern void IN_ClearKeysDown();\r
-//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);\r
-extern void IN_ReadCursor(CursorInfo *info);\r
-extern void IN_ReadControl(int playnum,player_t *player);\r
-extern void IN_SetControlType(word playnum,player_t *player,ControlType type);\r
+extern void            IN_Startup(global_game_variables_t *gvar),IN_Shutdown(global_game_variables_t *gvar),\r
+                                       IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar),\r
+                                       IN_SetKeyHook(void (*)()),\r
+                                       IN_ClearKeysDown(void),\r
+                                       IN_ReadCursor(CursorInfo *, global_game_variables_t *gvar),\r
+                                       IN_ReadControl(player_t *player, global_game_variables_t *gvar),\r
+                                       IN_SetControlType(player_t *player,ControlType type),\r
+                                       IN_GetJoyAbs(word joy,word *xp,word *yp),\r
+                                       IN_SetupJoy(word joy,word minx,word maxx,\r
+                                                               word miny,word maxy, global_game_variables_t *gvar),\r
 #if DEMO0\r
-extern boolean IN_StartDemoRecord(word bufsize);\r
-extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);\r
-extern void IN_StopDemo(void);\r
-extern void IN_FreeDemoBuffer(void);\r
+                                       IN_StopDemo(void),IN_FreeDemoBuffer(void),\r
 #endif\r
-extern byte *IN_GetScanName(ScanCode scan);\r
-extern ScanCode IN_WaitForKey();\r
-extern char IN_WaitForASCII();\r
-extern void IN_AckBack();\r
-extern void IN_Ack();\r
-extern boolean IN_IsUserInput();\r
-extern boolean IN_UserInput(dword delay,boolean clear);\r
-extern boolean IN_KeyDown(byte code);\r
-extern void IN_ClearKey(byte code);\r
-extern boolean IN_qb(byte kee);\r
+                                       IN_Ack(global_game_variables_t *gvar),IN_AckBack(void);\r
+extern boolean         IN_UserInput(word delay, global_game_variables_t *gvar);\r
+extern char            IN_WaitForASCII(void);\r
+extern ScanCode        IN_WaitForKey(void);\r
+extern word            IN_GetJoyButtonsDB(word joy);\r
+extern byte            *IN_GetScanName(ScanCode);\r
+\r
+\r
+byte   IN_MouseButtons (global_game_variables_t *gvar);\r
+word   IN_JoyButtons (void);\r
+\r
+void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar);\r
+void IN_StartAck(global_game_variables_t *gvar);\r
+boolean IN_CheckAck (global_game_variables_t *gvar);\r
+boolean IN_IsUserInput(global_game_variables_t *gvar);\r
+#if DEMO0\r
+boolean IN_StartDemoRecord(word bufsize);\r
+void IN_StartDemoPlayback(byte *buffer,word bufsize);\r
+void IN_StopDemo(void);\r
+void IN_FreeDemoBuffer(void);\r
+#endif\r
+\r
+//boolean      IN_KeyDown(byte code),\r
+//             IN_qb(byte kee);\r
+void           IN_ClearKey(byte code),\r
+               IN_KbdLED();\r
+ScanCode       IN_GetLastScan(),\r
+               IN_GetCurCode();\r
 \r
 #endif\r