X-Git-Url: http://4ch.mooo.com/gitweb/?a=blobdiff_plain;f=src%2Flib%2F16_in.h;h=97a560d0e998168a09c4a2d9b88aedb62ff83618;hb=af2715fef8681d909afe82f7baaf5e13baabb76f;hp=7cc143725578b3bf812312e8f18fac064221e5a5;hpb=3a9d099252b5c317c6ef40c1d7e8541400159cb6;p=16.git diff --git a/src/lib/16_in.h b/src/lib/16_in.h old mode 100644 new mode 100755 index 7cc14372..97a560d0 --- a/src/lib/16_in.h +++ b/src/lib/16_in.h @@ -1,40 +1,43 @@ -/* Catacomb Armageddon Source Code - * Copyright (C) 1993-2014 Flat Rock Software +/* Project 16 Source Code~ + * Copyright (C) 2012-2017 sparky4 & pngwen & andrius4669 & joncampbell123 & yakui-lover * - * This program is free software; you can redistribute it and/or modify + * This file is part of Project 16. + * + * Project 16 is free software; you can redistribute it and/or modify * it under the terms of the GNU General Public License as published by - * the Free Software Foundation; either version 2 of the License, or + * the Free Software Foundation; either version 3 of the License, or * (at your option) any later version. * - * This program is distributed in the hope that it will be useful, + * Project 16 is distributed in the hope that it will be useful, * but WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU General Public License for more details. * - * You should have received a copy of the GNU General Public License along - * with this program; if not, write to the Free Software Foundation, Inc., - * 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA. + * You should have received a copy of the GNU General Public License + * along with this program. If not, see , or + * write to the Free Software Foundation, Inc., 51 Franklin Street, + * Fifth Floor, Boston, MA 02110-1301 USA. + * */ - // // ID Engine // ID_IN.h - Header file for Input Manager -// v1.0d1 +// v1.0d1w // By Jason Blochowiak +// Open Watcom port by sparky4 // #ifndef __16_IN__ #define __16_IN__ -#include "src/lib/lib_head.h" -//#include "src/lib/16_us.h" - -//++++#ifdef __DEBUG__ -#define __DEBUG_InputMgr__ -//++++#endif - -//#define DOMO -#define TESTKEYIN +#include +#include "src/lib/16_head.h" +#include "src/lib/16_timer.h" +#include "src/lib/16_dbg.h" +#ifdef __WATCOMC__ //borland C BCEXMM.EXE +#include "src/lib/16_spri.h" +#include "src/lib/16_enti.h" +#endif #define KeyInt 9 // The keyboard ISR number @@ -43,12 +46,12 @@ #define JoyScaleShift 8 #define MaxJoyValue 5000 -#define MaxPlayers 4 +//#define MaxPlayers 2//future plans for multiple playable charaters and being able to alternate #define MaxKbds 2 #define MaxJoys 2 #define NumCodes 128 -typedef byte ScanCode; +//typedef byte ScanCode; #define sc_None 0 #define sc_Bad 0xff #define sc_Return 0x1c @@ -132,6 +135,10 @@ typedef byte ScanCode; #define key_Tab 0x09 #define key_Delete 0x7f +#define key_LSuper 0x5b +#define key_RSuper 0x5c +#define key_Menu 0x5d + // Stuff for the mouse #define MReset 0 #define MButtons 3 @@ -143,13 +150,14 @@ typedef enum { demo_Off,demo_Record,demo_Playback,demo_PlayDone } Demo; #endif -typedef enum { - ctrl_None, // MDM (GAMERS EDGE) - added +//moved to 16_tdef.h +/*typedef enum { + //ctrl_None, // MDM (GAMERS EDGE) - added ctrl_Keyboard, ctrl_Keyboard1 = ctrl_Keyboard,ctrl_Keyboard2, ctrl_Joystick, ctrl_Joystick1 = ctrl_Joystick,ctrl_Joystick2, - ctrl_Mouse + ctrl_Mouse, } ControlType; typedef enum { motion_Left = -1,motion_Up = -1, @@ -158,38 +166,39 @@ typedef enum { } Motion; typedef enum { dir_North,//dir_NorthEast, - dir_East,//dir_SouthEast, - dir_South,//dir_SouthWest, - dir_West,//dir_NorthWest, - dir_None + dir_West,//dir_Nortinest, + dir_None, + dir_East,//,dir_SouthEast, + dir_South,//dir_Soutinest, } Direction; typedef struct { - boolean button0,button1; - int x,y; - Motion xaxis,yaxis; - Direction dir; + boolean near button0,button1,button2,button3; + int near x,y; + Motion near xaxis,yaxis; + Direction near dir; } CursorInfo; -typedef CursorInfo ControlInfo; typedef struct { - ScanCode button0,button1, + ScanCode near button0,button1, //upleft, up, + down, + left, + right //upright, - left, right, //downleft, - down //,downright ; } KeyboardDef; typedef struct { - word joyMinX,joyMinY, + word near joyMinX,joyMinY, threshMinX,threshMinY, threshMaxX,threshMaxY, joyMaxX,joyMaxY, joyMultXL,joyMultYL, joyMultXH,joyMultYH; - } JoystickDef; + } JoystickDef;*/ + /* ============================================================================= @@ -197,136 +206,55 @@ typedef struct { ============================================================================= */ - -// -// configuration variables -// -static boolean MousePresent; -static boolean JoysPresent[MaxJoys]; -static boolean JoyPadPresent; - -// Global variables - extern boolean JoystickCalibrated; // MDM (GAMERS EDGE) - added - extern ControlType ControlTypeUsed; // MDM (GAMERS EDGE) - added - - extern boolean Keyboard[NumCodes]; - extern boolean Paused; - extern char LastASCII; - extern ScanCode LastScan; - - //extern KeyboardDef KbdDefs[]; - static KeyboardDef KbdDefs[] = {0x1d,0x38,0x47,0x48,0x49,0x4b,0x4d,0x4f,0x50,0x51}; - extern JoystickDef JoyDefs[MaxJoys]; - extern ControlType Controls[MaxPlayers]; - - extern dword MouseDownCount; - #ifdef DEMO0 static Demo DemoMode = demo_Off; static byte /*_seg*/ *DemoBuffer; static word DemoOffset,DemoSize; #endif -extern dword far* clockdw; - -/* -============================================================================= - - LOCAL VARIABLES - -============================================================================= -*/ -static byte far ASCIINames[] = // Unshifted ASCII for scan codes - { -// 0 1 2 3 4 5 6 7 8 9 A B C D E F - 0 ,27 ,'1','2','3','4','5','6','7','8','9','0','-','=',8 ,9 , // 0 - 'q','w','e','r','t','y','u','i','o','p','[',']',13 ,0 ,'a','s', // 1 - 'd','f','g','h','j','k','l',';',39 ,'`',0 ,92 ,'z','x','c','v', // 2 - 'b','n','m',',','.','/',0 ,'*',0 ,' ',0 ,0 ,0 ,0 ,0 ,0 , // 3 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,'7','8','9','-','4','5','6','+','1', // 4 - '2','3','0',127,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 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,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 5 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 , // 6 - 0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 ,0 // 7 - }; - - -static boolean IN_Started; -static boolean CapsLock; -static ScanCode CurCode,LastCode; - -static Direction DirTable[] = // Quick lookup for total direction - { - //dir_NorthWest, - dir_North, - //dir_NorthEast, - dir_West, dir_None, dir_East, - //dir_SouthWest, - dir_South//,dir_SouthEast - }; - -static void (*INL_KeyHook)(void); -static void interrupt (*OldKeyVect)(void); - -static char *ParmStrings[] = {"nojoys","nomouse",nil}; - -// Function prototypes -#define IN_KeyDown(code) (Keyboard[(code)]) -#define IN_ClearKey(code) {Keyboard[code] = false;\ - if (code == LastScan) LastScan = sc_None;} - -// DEBUG - put names in prototypes -extern void IN_Startup(void),IN_Shutdown(void), - IN_Default(boolean gotit,ControlType in), +// Internal routines +extern void IN_Startup(global_game_variables_t *gvar),IN_Shutdown(global_game_variables_t *gvar), + IN_Default(boolean gotit,player_t *player,ControlType nt, global_game_variables_t *gvar), IN_SetKeyHook(void (*)()), IN_ClearKeysDown(void), - IN_ReadCursor(CursorInfo *), - IN_ReadControl(int,ControlInfo *), - IN_SetControlType(int,ControlType), + IN_ReadCursor(CursorInfo *, global_game_variables_t *gvar), + IN_ReadControl(player_t *player, global_game_variables_t *gvar), + IN_SetControlType(player_t *player,ControlType type), IN_GetJoyAbs(word joy,word *xp,word *yp), IN_SetupJoy(word joy,word minx,word maxx, - word miny,word maxy), - Mouse(int x), -#ifdef DEMO0 - IN_StartDemoPlayback(byte __segment *buffer,word bufsize), + word miny,word maxy, global_game_variables_t *gvar), +#if DEMO0 IN_StopDemo(void),IN_FreeDemoBuffer(void), #endif - IN_Ack(void),IN_AckBack(void); -extern boolean IN_UserInput(dword delay,boolean clear), - IN_IsUserInput(void) -#ifdef DEMO0 - , IN_StartDemoRecord(word bufsize) -#endif -; -extern byte *IN_GetScanName(ScanCode); + IN_Ack(global_game_variables_t *gvar),IN_AckBack(void); +extern boolean IN_UserInput(word delay, global_game_variables_t *gvar); extern char IN_WaitForASCII(void); extern ScanCode IN_WaitForKey(void); extern word IN_GetJoyButtonsDB(word joy); +extern byte *IN_GetScanName(ScanCode); + + +byte IN_MouseButtons (global_game_variables_t *gvar); +byte IN_JoyButtons (void); + +void INL_GetJoyDelta(word joy,int *dx,int *dy/*,boolean adaptive*/, global_game_variables_t *gvar); +void IN_StartAck(global_game_variables_t *gvar); +boolean IN_CheckAck (global_game_variables_t *gvar); +boolean IN_IsUserInput(global_game_variables_t *gvar); +#define Mouse(x) INL_Mouse(x) +//void IN_SetKeyHook(void (*hook)()); +#if DEMO0 +boolean IN_StartDemoRecord(word bufsize); +void IN_StartDemoPlayback(byte *buffer,word bufsize); +void IN_StopDemo(void); +void IN_FreeDemoBuffer(void); +#endif +boolean IN_KeyDown(byte code), + IN_qb(byte kee); +void IN_ClearKey(byte code), + IN_KbdLED(); +ScanCode IN_GetLastScan(), + IN_GetCurCode(); -void interrupt INL_KeyService(void); -boolean IN_qb(byte kee); #endif