Subversion Repositories eduke32

Rev

Rev 3527 | Rev 4747 | Go to most recent revision | Details | Compare with Previous | Last modification | View Log | RSS feed

Rev Author Line No. Line
5 Plagman 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
4541 hendricks2 23
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301, USA.
5 Plagman 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
#ifndef _control_private
36
#define _control_private
3116 hendricks2 37
#ifdef EXTERNC
38
{
5 Plagman 39
#endif
40
 
1346 terminx 41
 
5 Plagman 42
//****************************************************************************
43
//
44
// DEFINES
45
//
46
//****************************************************************************
47
 
48
#define AXISUNDEFINED   0x7f
49
#define BUTTONUNDEFINED 0x7f
50
#define KEYUNDEFINED    0x7f
51
 
52
#define THRESHOLD        0x200
53
#define MINTHRESHOLD     0x80
54
 
1658 terminx 55
#define DEFAULTMOUSESENSITIVITY 7 // 0x7000+MINIMUMMOUSESENSITIVITY
127 terminx 56
 
5 Plagman 57
#define INSTANT_ONOFF       0
58
#define TOGGLE_ONOFF        1
59
 
60
#define MAXCONTROLVALUE  0x7fff
61
 
62
// Number of Mouse buttons
63
 
3527 helixhorne 64
//#define MAXMOUSEBUTTONS 10
5 Plagman 65
 
66
// Number of Mouse Axes
3527 helixhorne 67
// KEEPINSYNC gamedefs.h
5 Plagman 68
#define MAXMOUSEAXES 2
69
 
70
// Number of JOY buttons
3527 helixhorne 71
// XXX: out of sync with gamedefs.h
5 Plagman 72
#define MAXJOYBUTTONS 32
73
 
74
// Number of JOY axes
3527 helixhorne 75
// KEEPINSYNC gamedefs.h
1552 terminx 76
#define MAXJOYAXES 8
5 Plagman 77
 
78
// NORMAL axis scale
3527 helixhorne 79
#define NORMALAXISSCALE 65536
5 Plagman 80
 
1492 terminx 81
#define BUTTONSET(x,value) (CONTROL_ButtonState |= ((uint64_t)value<<((uint64_t)(x))))
82
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1<<((uint64_t)(x))))
5 Plagman 83
 
1492 terminx 84
#define BUTTONHELDSET(x,value) (CONTROL_ButtonHeldState |= (uint64_t)(value<<((uint64_t)(x))))
5 Plagman 85
 
86
#define LIMITCONTROL(x)\
87
    {\
88
    if ((*x)>MAXCONTROLVALUE) \
89
       {\
90
       (*x) = MAXCONTROLVALUE;\
91
       }\
92
    if ((*x)<-MAXCONTROLVALUE) \
93
       {\
94
       (*x) = -MAXCONTROLVALUE;\
95
       }\
96
    }
97
#define SGN(x) \
98
    ( ( (x) > 0 ) ? 1 : ( (x) < 0 ) ? -1 : 0 )
99
 
100
//****************************************************************************
101
//
102
// TYPEDEFS
103
//
104
//****************************************************************************
105
 
106
typedef enum
107
   {
108
   motion_Left  = -1,
109
   motion_Up    = -1,
110
   motion_None  = 0,
111
   motion_Right = 1,
112
   motion_Down  = 1
113
   } motion;
114
 
115
 
116
typedef struct
117
   {
1346 terminx 118
   int32_t joyMinX;
119
   int32_t joyMinY;
120
   int32_t threshMinX;
121
   int32_t threshMinY;
122
   int32_t threshMaxX;
123
   int32_t threshMaxY;
124
   int32_t joyMaxX;
125
   int32_t joyMaxY;
126
   int32_t joyMultXL;
127
   int32_t joyMultYL;
128
   int32_t joyMultXH;
129
   int32_t joyMultYH;
5 Plagman 130
   } JoystickDef;
131
 
1346 terminx 132
//   int32_t ThrottleMin;
133
//   int32_t RudderMin;
134
//   int32_t ThrottlethreshMin;
135
//   int32_t RudderthreshMin;
136
//   int32_t ThrottlethreshMax;
137
//   int32_t RudderthreshMax;
138
//   int32_t ThrottleMax;
139
//   int32_t RudderMax;
140
//   int32_t ThrottleMultL;
141
//   int32_t RudderMultL;
142
//   int32_t ThrottleMultH;
143
//   int32_t RudderMultH;
5 Plagman 144
 
2940 helixhorne 145
 
5 Plagman 146
typedef struct
147
   {
1346 terminx 148
   uint8_t active     ;
149
   uint8_t used       ;
150
   uint8_t toggle     ;
151
   uint8_t buttonheld ;
152
   int32_t cleared    ;
5 Plagman 153
   } controlflags;
154
 
155
typedef struct
156
   {
157
   kb_scancode key1;
158
   kb_scancode key2;
159
   } controlkeymaptype;
160
 
161
typedef struct
162
   {
1346 terminx 163
   uint8_t singleclicked;
164
   uint8_t doubleclicked;
165
   uint16_t extra;
5 Plagman 166
   } controlbuttontype;
167
 
168
typedef struct
169
   {
1346 terminx 170
   uint8_t analogmap;
171
   uint8_t minmap;
172
   uint8_t maxmap;
173
   uint8_t extra;
5 Plagman 174
   } controlaxismaptype;
175
 
176
typedef struct
177
   {
1346 terminx 178
   int32_t analog;
179
   int32_t digital;
5 Plagman 180
   } controlaxistype;
181
 
182
 
183
//***************************************************************************
184
//
185
// PROTOTYPES
186
//
187
//***************************************************************************
188
 
3116 hendricks2 189
#ifdef EXTERNC
5 Plagman 190
};
191
#endif
192
#endif