2006-04-13 20:47:06 +00:00
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
/*
|
|
|
|
Copyright (C) 1996, 2003 - 3D Realms Entertainment
|
|
|
|
|
|
|
|
This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition
|
|
|
|
However, it is either an older version of a file that is, or is
|
|
|
|
some test code written during the development of Duke Nukem 3D.
|
|
|
|
This file is provided purely for educational interest.
|
|
|
|
|
|
|
|
Duke Nukem 3D 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 (at your option) any later version.
|
|
|
|
|
|
|
|
This program 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
|
2014-07-20 08:55:56 +00:00
|
|
|
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms
|
|
|
|
*/
|
|
|
|
//-------------------------------------------------------------------------
|
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
//
|
|
|
|
// Private header for CONTROL.C
|
|
|
|
//
|
|
|
|
//****************************************************************************
|
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#ifndef control_private_h_
|
|
|
|
#define control_private_h_
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
extern "C" {
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
//****************************************************************************
|
|
|
|
//
|
|
|
|
// DEFINES
|
|
|
|
//
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
#define AXISUNDEFINED 0x7f
|
|
|
|
#define BUTTONUNDEFINED 0x7f
|
|
|
|
#define KEYUNDEFINED 0x7f
|
|
|
|
|
|
|
|
#define THRESHOLD 0x200
|
|
|
|
#define MINTHRESHOLD 0x80
|
|
|
|
|
2010-06-22 21:50:01 +00:00
|
|
|
#define DEFAULTMOUSESENSITIVITY 7 // 0x7000+MINIMUMMOUSESENSITIVITY
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
#define INSTANT_ONOFF 0
|
|
|
|
#define TOGGLE_ONOFF 1
|
|
|
|
|
|
|
|
#define MAXCONTROLVALUE 0x7fff
|
|
|
|
|
|
|
|
// Number of Mouse buttons
|
|
|
|
|
2013-02-25 15:31:22 +00:00
|
|
|
//#define MAXMOUSEBUTTONS 10
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// Number of Mouse Axes
|
2014-12-18 18:16:16 +00:00
|
|
|
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
|
2006-04-13 20:47:06 +00:00
|
|
|
#define MAXMOUSEAXES 2
|
2014-12-18 18:15:51 +00:00
|
|
|
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// Number of JOY buttons
|
2014-12-18 18:16:16 +00:00
|
|
|
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
|
2006-04-13 20:47:06 +00:00
|
|
|
#define MAXJOYBUTTONS 32
|
2014-12-18 18:15:51 +00:00
|
|
|
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
// Number of JOY axes
|
2014-12-18 18:16:16 +00:00
|
|
|
// KEEPINSYNC source/gamedefs.h, build/src/sdlayer.c
|
|
|
|
#define MAXJOYAXES 9
|
2014-12-18 18:15:51 +00:00
|
|
|
#define MAXJOYDIGITAL (MAXJOYAXES*2)
|
2006-12-11 04:38:10 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
// NORMAL axis scale
|
2013-02-25 15:31:22 +00:00
|
|
|
#define NORMALAXISSCALE 65536
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2014-11-22 12:32:56 +00:00
|
|
|
#define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x))))
|
|
|
|
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x))))
|
|
|
|
|
|
|
|
#define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x))))
|
|
|
|
|
|
|
|
#define LIMITCONTROL(x) \
|
|
|
|
{ \
|
|
|
|
if ((*x) > MAXCONTROLVALUE) \
|
|
|
|
{ \
|
|
|
|
(*x) = MAXCONTROLVALUE; \
|
|
|
|
} \
|
|
|
|
if ((*x) < -MAXCONTROLVALUE) \
|
|
|
|
{ \
|
|
|
|
(*x) = -MAXCONTROLVALUE; \
|
|
|
|
} \
|
2006-04-13 20:47:06 +00:00
|
|
|
}
|
2014-11-22 12:32:56 +00:00
|
|
|
#define SGN(x) (((x) > 0) ? 1 : ((x) < 0) ? -1 : 0)
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
//****************************************************************************
|
|
|
|
//
|
|
|
|
// TYPEDEFS
|
|
|
|
//
|
|
|
|
//****************************************************************************
|
|
|
|
|
|
|
|
typedef enum
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
motion_Left = -1,
|
|
|
|
motion_Up = -1,
|
|
|
|
motion_None = 0,
|
|
|
|
motion_Right = 1,
|
|
|
|
motion_Down = 1
|
|
|
|
} motion;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
int32_t joyMinX;
|
|
|
|
int32_t joyMinY;
|
|
|
|
int32_t threshMinX;
|
|
|
|
int32_t threshMinY;
|
|
|
|
int32_t threshMaxX;
|
|
|
|
int32_t threshMaxY;
|
|
|
|
int32_t joyMaxX;
|
|
|
|
int32_t joyMaxY;
|
|
|
|
int32_t joyMultXL;
|
|
|
|
int32_t joyMultYL;
|
|
|
|
int32_t joyMultXH;
|
|
|
|
int32_t joyMultYH;
|
|
|
|
} JoystickDef;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2009-04-26 05:57:42 +00:00
|
|
|
// int32_t ThrottleMin;
|
|
|
|
// int32_t RudderMin;
|
|
|
|
// int32_t ThrottlethreshMin;
|
|
|
|
// int32_t RudderthreshMin;
|
|
|
|
// int32_t ThrottlethreshMax;
|
|
|
|
// int32_t RudderthreshMax;
|
|
|
|
// int32_t ThrottleMax;
|
|
|
|
// int32_t RudderMax;
|
|
|
|
// int32_t ThrottleMultL;
|
|
|
|
// int32_t RudderMultL;
|
|
|
|
// int32_t ThrottleMultH;
|
|
|
|
// int32_t RudderMultH;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
2012-08-20 21:24:54 +00:00
|
|
|
|
2006-04-13 20:47:06 +00:00
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
uint8_t active;
|
|
|
|
uint8_t used;
|
|
|
|
uint8_t toggle;
|
|
|
|
uint8_t buttonheld;
|
|
|
|
int32_t cleared;
|
|
|
|
} controlflags;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
kb_scancode key1;
|
|
|
|
kb_scancode key2;
|
|
|
|
} controlkeymaptype;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
uint8_t singleclicked;
|
|
|
|
uint8_t doubleclicked;
|
|
|
|
uint16_t extra;
|
|
|
|
} controlbuttontype;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
uint8_t analogmap;
|
|
|
|
uint8_t minmap;
|
|
|
|
uint8_t maxmap;
|
|
|
|
uint8_t extra;
|
|
|
|
} controlaxismaptype;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
typedef struct
|
2014-11-22 12:32:56 +00:00
|
|
|
{
|
|
|
|
int32_t analog;
|
|
|
|
int32_t digital;
|
|
|
|
} controlaxistype;
|
2006-04-13 20:47:06 +00:00
|
|
|
|
|
|
|
|
|
|
|
//***************************************************************************
|
|
|
|
//
|
|
|
|
// PROTOTYPES
|
|
|
|
//
|
|
|
|
//***************************************************************************
|
|
|
|
|
2014-11-26 04:39:23 +00:00
|
|
|
#ifdef __cplusplus
|
|
|
|
}
|
2006-04-13 20:47:06 +00:00
|
|
|
#endif
|
|
|
|
#endif
|