-/* Catacomb Apocalypse 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.0d1w\r
-// 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/16_head.h"\r
-#include "src/lib/16_timer.h"\r
-#include "src/lib/16_sprite.h"\r
-#ifdef __WATCOMC__\r
-#include "src/lib/16_dbg.h"\r
-#endif\r
-#ifdef __DEBUG__\r
-//#define __DEBUG_InputMgr__\r
-#endif\r
-\r
-#ifdef __DEBUG_InputMgr__\r
-//#define TESTKEYIN\r
-//#define TESTCONTROLNOISY\r
-#endif\r
-\r
-extern boolean testkeyin,testcontrolnoisy;\r
-\r
-//if else for gfxtesting and direction\r
-//player[pn].d == 2 ||\r
-//player[pn].d != 2 ||\r
-#define DIRECTIONIFELSE (player[pn].info.dir == 2)\r
-//#define NDIRECTIONIFELSE (player[pn].info.dir != 2)\r
-\r
-#define KeyInt 9 // The keyboard ISR number\r
-\r
-// Stuff for the joystick\r
-#define JoyScaleMax 32768\r
-#define JoyScaleShift 8\r
-#define MaxJoyValue 5000\r
-\r
-#define MaxPlayers 4\r
-#define MaxKbds 2\r
-#define MaxJoys 2\r
-#define MaxPads 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\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 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 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
-#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
-#define MButtons 3\r
-#define MDelta 11\r
-\r
-#define MouseInt 0x33\r
-#ifdef DEMO0\r
-typedef enum {\r
- demo_Off,demo_Record,demo_Playback,demo_PlayDone\r
- } Demo;\r
-#endif\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
- } 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_West,//dir_Nortinest,\r
- dir_None,\r
- dir_East,//,dir_SouthEast,\r
- dir_South,//dir_Soutinest,\r
- } Direction;\r
-typedef struct {\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 near button0,button1,\r
- //upleft,\r
- up,\r
- down,\r
- left,\r
- right\r
- //upright,\r
- //downleft,\r
- //,downright\r
- ;\r
- } KeyboardDef;\r
-typedef struct {\r
- word near joyMinX,joyMinY,\r
- threshMinX,threshMinY,\r
- threshMaxX,threshMaxY,\r
- joyMaxX,joyMaxY,\r
- joyMultXL,joyMultYL,\r
- joyMultXH,joyMultYH;\r
- } JoystickDef;\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
- //byte near kd[2]; //array of arrow key pressed\r
- word speed; //player speed!\r
- word spt; //speed per tile\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
- struct sprite *spri; //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
-*/\r
-/*extern struct inconfig\r
-{\r
- boolean MousePresent;\r
- boolean JoysPresent[MaxJoys];\r
- boolean Keyboard[NumCodes];\r
- boolean Paused;\r
- char LastASCII;\r
- ScanCode LastScan;\r
-\r
- KeyboardDef KbdDefs[MaxKbds];\r
- JoystickDef JoyDefs[MaxJoys];\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
-// 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
-void IN_initplayer(player_t *player, word pn);\r
-\r
-#endif\r