1 //------------------------------------------------------------------------- 2 /* 3 Copyright (C) 1996, 2003 - 3D Realms Entertainment 4 5 This file is NOT part of Duke Nukem 3D version 1.5 - Atomic Edition 6 However, it is either an older version of a file that is, or is 7 some test code written during the development of Duke Nukem 3D. 8 This file is provided purely for educational interest. 9 10 Duke Nukem 3D is free software; you can redistribute it and/or 11 modify it under the terms of the GNU General Public License 12 as published by the Free Software Foundation; either version 2 13 of the License, or (at your option) any later version. 14 15 This program is distributed in the hope that it will be useful, 16 but WITHOUT ANY WARRANTY; without even the implied warranty of 17 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. 18 19 See the GNU General Public License for more details. 20 21 You should have received a copy of the GNU General Public License 22 along with this program; if not, write to the Free Software 23 Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA. 24 25 Prepared for public release: 03/21/2003 - Charlie Wiederhold, 3D Realms 26 */ 27 //------------------------------------------------------------------------- 28 29 //**************************************************************************** 30 // 31 // Private header for CONTROL.C 32 // 33 //**************************************************************************** 34 35 #pragma once 36 37 #ifndef control_private_h_ 38 #define control_private_h_ 39 40 #include "compat.h" 41 #include "keyboard.h" 42 43 #ifdef __cplusplus 44 extern "C" { 45 #endif 46 47 48 //**************************************************************************** 49 // 50 // DEFINES 51 // 52 //**************************************************************************** 53 54 #define AXISUNDEFINED 0x7f 55 #define BUTTONUNDEFINED 0x7f 56 #define KEYUNDEFINED 0x7f 57 58 #define THRESHOLD (0x200 * 32767 / 10000) 59 #define MINTHRESHOLD (0x80 * 32767 / 10000) 60 61 #define DEFAULTMOUSESENSITIVITY 4 // 0x7000+MINIMUMMOUSESENSITIVITY 62 63 #define INSTANT_ONOFF 0 64 #define TOGGLE_ONOFF 1 65 66 #define MAXCONTROLVALUE 0x7fff 67 68 // Number of Mouse buttons 69 70 //#define MAXMOUSEBUTTONS 10 71 72 // Number of JOY buttons 73 // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp 74 #define MAXJOYBUTTONS 32 75 #define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4) 76 77 // Number of JOY axes 78 // KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp 79 #define MAXJOYAXES 9 80 #define MAXJOYDIGITAL (MAXJOYAXES*2) 81 82 // NORMAL axis scale 83 #define NORMALAXISSCALE 65536 84 85 #define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x)))) 86 #define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x)))) 87 #define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x)))) 88 #define LIMITCONTROL(x) (*x = clamp(*x, -MAXCONTROLVALUE, MAXCONTROLVALUE)) 89 90 //**************************************************************************** 91 // 92 // TYPEDEFS 93 // 94 //**************************************************************************** 95 96 typedef enum 97 { 98 motion_Left = -1, 99 motion_Up = -1, 100 motion_None = 0, 101 motion_Right = 1, 102 motion_Down = 1 103 } motion; 104 105 106 typedef struct 107 { 108 int32_t joyMinX; 109 int32_t joyMinY; 110 int32_t threshMinX; 111 int32_t threshMinY; 112 int32_t threshMaxX; 113 int32_t threshMaxY; 114 int32_t joyMaxX; 115 int32_t joyMaxY; 116 int32_t joyMultXL; 117 int32_t joyMultYL; 118 int32_t joyMultXH; 119 int32_t joyMultYH; 120 } JoystickDef; 121 122 // int32_t ThrottleMin; 123 // int32_t RudderMin; 124 // int32_t ThrottlethreshMin; 125 // int32_t RudderthreshMin; 126 // int32_t ThrottlethreshMax; 127 // int32_t RudderthreshMax; 128 // int32_t ThrottleMax; 129 // int32_t RudderMax; 130 // int32_t ThrottleMultL; 131 // int32_t RudderMultL; 132 // int32_t ThrottleMultH; 133 // int32_t RudderMultH; 134 135 136 typedef struct 137 { 138 uint8_t active; 139 uint8_t used; 140 uint8_t toggle; 141 uint8_t buttonheld; 142 int32_t cleared; 143 } controlflags; 144 145 typedef struct 146 { 147 kb_scancode keyPrimary; 148 kb_scancode keySecondary; 149 } controlkeymaptype; 150 151 typedef struct 152 { 153 uint8_t singleclicked; 154 uint8_t doubleclicked; 155 uint16_t extra; 156 } controlbuttontype; 157 158 typedef struct 159 { 160 uint8_t analogmap; 161 uint8_t minmap; 162 uint8_t maxmap; 163 uint8_t extra; 164 } controlaxismaptype; 165 166 typedef struct 167 { 168 int32_t analog; 169 int8_t digital; 170 int8_t digitalClearedN, digitalClearedP; 171 } controlaxistype; 172 173 174 //*************************************************************************** 175 // 176 // PROTOTYPES 177 // 178 //*************************************************************************** 179 180 #ifdef __cplusplus 181 } 182 #endif 183 #endif 184