]> 4ch.mooo.com Git - 16.git/blobdiff - src/lib/16_in.h
inputest manipulates d and q like scroll.exe
[16.git] / src / lib / 16_in.h
old mode 100644 (file)
new mode 100755 (executable)
index 410831a..ad625ed
 //     ID Engine\r
 //     ID_IN.h - Header file for Input Manager\r
 //     v1.0d1w\r
-//     By Jason Blochowiak
+//     By Jason Blochowiak\r
 //     Open Watcom port by sparky4\r
 //\r
 \r
 #ifndef        __16_IN__\r
 #define        __16_IN__\r
-
+\r
 #include <string.h>\r
-#include "src/lib/lib_head.h"\r
+#include "src/lib/16_head.h"\r
+#include "src/lib/timer.h"\r
+#include "src/lib/bitmap.h"\r
+#include "src/lib/planar.h"\r
+\r
+#ifdef __DEBUG__\r
+//#define      __DEBUG_InputMgr__\r
+#endif\r
 \r
-//++++#ifdef   __DEBUG__\r
-#define        __DEBUG_InputMgr__\r
-//++++#endif\r
+#ifdef __DEBUG_InputMgr__\r
+//#define TESTKEYIN\r
+//#define TESTCONTROLNOISY\r
+#endif\r
 \r
-#define TESTKEYIN
-#define TESTCONTROLNOISY\r
+extern byte testkeyin,testcontrolnoisy,gfxtest;\r
+\r
+//if else for gfxtesting and direction\r
+#define DIRECTIONIFELSEGFXTEST (player[pn].d == 2 || player[pn].info.dir == 2)\r
+#define NDIRECTIONIFELSEGFXTEST        (player[pn].d != 2 || player[pn].info.dir != 2)\r
 \r
 #define        KeyInt  9       // The keyboard ISR number\r
 \r
@@ -46,7 +57,7 @@
 \r
 #define        MaxPlayers      4\r
 #define        MaxKbds         2\r
-#define        MaxJoys         2
+#define        MaxJoys         2\r
 #define        MaxPads         2\r
 #define        NumCodes        128\r
 \r
@@ -133,10 +144,10 @@ typedef   byte            ScanCode;
 #define        key_BackSpace   0x08\r
 #define        key_Tab                 0x09\r
 #define        key_Delete              0x7f\r
-
-#define        key_LSuper                      0x5b
-#define        key_RSuper                      0x5c
-#define        key_Menu                        0x5d
+\r
+#define        key_LSuper                      0x5b\r
+#define        key_RSuper                      0x5c\r
+#define        key_Menu                        0x5d\r
 \r
 //     Stuff for the mouse\r
 #define        MReset          0\r
@@ -155,8 +166,8 @@ typedef     enum            {
                                                        ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2,\r
                                                ctrl_Joystick,\r
                                                        ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2,\r
-                                               ctrl_Mouse,
-                                               ctrl_Joypad,
+                                               ctrl_Mouse,\r
+                                               ctrl_Joypad,\r
                                                        ctrl_Joypad1 = ctrl_Joypad,ctrl_Joypad2\r
                                        } ControlType;\r
 typedef        enum            {\r
@@ -166,119 +177,136 @@ typedef enum            {
                                        } Motion;\r
 typedef        enum            {\r
                                                dir_North,//dir_NorthEast,\r
-                                               dir_East,//dir_SouthEast,\r
-                                               dir_South,//dir_Soutinest,\r
                                                dir_West,//dir_Nortinest,\r
-                                               dir_None\r
+                                               dir_None,\r
+                                               dir_East,//,dir_SouthEast,\r
+                                               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
+                                                                       left,\r
+                                                                       right\r
                                                                        //upright,\r
-                                                                       left,                           right,\r
                                                                        //downleft,\r
-                                                                       down\r
                                                                        //,downright\r
                                                                        ;\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;
-typedef        struct
-{
+                                       } JoystickDef;\r
+typedef        struct\r
+{\r
        boolean w;\r
-} JoypadDef;
-
-typedef        struct
-{
-       CursorInfo      info;
-       ControlType     Controls;
-} player_t;
-
+} 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 sheetsetx; //NOT USED YET! player sprite sheet set on the image x\r
+       int sheetsety; //NOT USED YET! player sprite sheet set on the image y\r
+       byte d;         //direction to render sprite!! wwww\r
+       byte q;         //loop variable for anumation and locking the playing to compleate the animation cycle to prevent issues with misalignment www\r
+       byte near pdir; //previous direction~\r
+       word speed;             //player speed!\r
+//0000 planar_buf_t huge *data; //supposively the sprite sheet data\r
+//     planar_buf_t data; //supposively the sprite sheet data\r
+////0000----\r
+       bitmap_t huge *data; //supposively the sprite sheet data\r
+       sword hp; //hitpoints of the player\r
+       int persist_aniframe;    /* gonna be increased to 1 before being used, so 0 is ok for default */\r
+       CursorInfo      info;\r
+       ControlType     Controls;\r
+} player_t;\r
+\r
 /*\r
 =============================================================================\r
 \r
                                        GLOBAL VARIABLES\r
 \r
 =============================================================================\r
-*/
-/*extern struct inconfig
-{
+*/\r
+/*extern struct inconfig\r
+{\r
        boolean                 MousePresent;\r
        boolean                 JoysPresent[MaxJoys];\r
-       boolean                 JoyPadPresent[MaxPads];
+       boolean                 JoyPadPresent[MaxPads];\r
        boolean         Keyboard[NumCodes];\r
        boolean         Paused;\r
        char            LastASCII;\r
-       ScanCode        LastScan;
-
-       KeyboardDef     KbdDefs[MaxKbds];
-       JoystickDef     JoyDefs[MaxJoys];
-       JoypadDef       JoypadDefs[MaxPads];
-} inpu;*/
-
+       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
-
-extern dword far* clockdw;\r
 \r
-//     Internal routines
-extern void interrupt INL_KeyService();
-extern void Mouse(int x);
-//static void INL_GetMouseDelta(int *x,int *y);
-//static word INL_GetMouseButtons(void);
-extern void IN_GetJoyAbs(word joy,word *xp,word *yp);
-//static void INL_GetJoyDelta(word joy,int *dx,int *dy,boolean adaptive);
-//static word INL_GetJoyButtons(word joy);
-extern word IN_GetJoyButtonsDB(word joy);
-//static void INL_StartKbd(void);
-//static void INL_ShutKbd(void);
-//static boolean INL_StartMouse(void);
-//static void INL_ShutMouse(void);
-//static void INL_SetJoyScale(word joy);
-extern void IN_SetupJoy(word joy,word minx,word maxx,word miny,word maxy);
-//static boolean INL_StartJoy(word joy);
-//static void INL_ShutJoy(word joy);
-extern void IN_Startup();
-extern void IN_Default(boolean gotit,player_t *player,ControlType nt);
-extern void IN_Shutdown();
-extern void IN_SetKeyHook(void (*hook)());
-extern void IN_ClearKeysDown();
-//static void INL_AdjustCursor(CursorInfo *info,word buttons,int dx,int dy);
-extern void IN_ReadCursor(CursorInfo *info);
-extern void IN_ReadControl(int playnum,player_t *player);
-extern void IN_SetControlType(word playnum,player_t *player,ControlType type);
-#if DEMO0
-extern boolean IN_StartDemoRecord(word bufsize);
-extern void IN_StartDemoPlayback(byte /*__segment*/ *buffer,word bufsize);
-extern void IN_StopDemo(void);
-extern void IN_FreeDemoBuffer(void);
-#endif
-extern byte *IN_GetScanName(ScanCode scan);
-extern ScanCode IN_WaitForKey();
-extern char IN_WaitForASCII();
-extern void IN_AckBack();
-extern void IN_Ack();
-extern boolean IN_IsUserInput();
-extern boolean IN_UserInput(dword delay,boolean clear);
-extern boolean IN_KeyDown(byte code);
-extern void IN_ClearKey(byte code);
-extern boolean IN_qb(byte kee);
+//     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 near IN_ReadControl(int pn,player_t *player);\r
+extern void IN_SetControlType(word pn,player_t *player,ControlType type);\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
+#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
 \r
 #endif\r