Subversion Repositories eduke32

Rev

Rev 4766 | Rev 4827 | 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
 
4747 terminx 35
#ifndef control_private_h_
36
#define control_private_h_
4766 hendricks2 37
#ifdef __cplusplus
38
extern "C" {
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
4826 hendricks2 69
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
5 Plagman 70
 
71
// Number of JOY buttons
4826 hendricks2 72
// KEEPINSYNC gamedefs.h
5 Plagman 73
#define MAXJOYBUTTONS 32
4826 hendricks2 74
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
5 Plagman 75
 
76
// Number of JOY axes
3527 helixhorne 77
// KEEPINSYNC gamedefs.h
1552 terminx 78
#define MAXJOYAXES 8
4826 hendricks2 79
#define MAXJOYDIGITAL (MAXJOYAXES*2)
5 Plagman 80
 
81
// NORMAL axis scale
3527 helixhorne 82
#define NORMALAXISSCALE 65536
5 Plagman 83
 
4747 terminx 84
#define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x))))
85
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x))))
5 Plagman 86
 
4747 terminx 87
#define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x))))
5 Plagman 88
 
4747 terminx 89
#define LIMITCONTROL(x)                                                                                                \
90
    {                                                                                                                  \
91
        if ((*x) > MAXCONTROLVALUE)                                                                                    \
92
        {                                                                                                              \
93
            (*x) = MAXCONTROLVALUE;                                                                                    \
94
        }                                                                                                              \
95
        if ((*x) < -MAXCONTROLVALUE)                                                                                   \
96
        {                                                                                                              \
97
            (*x) = -MAXCONTROLVALUE;                                                                                   \
98
        }                                                                                                              \
5 Plagman 99
    }
4747 terminx 100
#define SGN(x) (((x) > 0) ? 1 : ((x) < 0) ? -1 : 0)
5 Plagman 101
 
102
//****************************************************************************
103
//
104
// TYPEDEFS
105
//
106
//****************************************************************************
107
 
108
typedef enum
4747 terminx 109
{
110
    motion_Left = -1,
111
    motion_Up = -1,
112
    motion_None = 0,
113
    motion_Right = 1,
114
    motion_Down = 1
115
} motion;
5 Plagman 116
 
117
 
118
typedef struct
4747 terminx 119
{
120
    int32_t joyMinX;
121
    int32_t joyMinY;
122
    int32_t threshMinX;
123
    int32_t threshMinY;
124
    int32_t threshMaxX;
125
    int32_t threshMaxY;
126
    int32_t joyMaxX;
127
    int32_t joyMaxY;
128
    int32_t joyMultXL;
129
    int32_t joyMultYL;
130
    int32_t joyMultXH;
131
    int32_t joyMultYH;
132
} JoystickDef;
5 Plagman 133
 
1346 terminx 134
//   int32_t ThrottleMin;
135
//   int32_t RudderMin;
136
//   int32_t ThrottlethreshMin;
137
//   int32_t RudderthreshMin;
138
//   int32_t ThrottlethreshMax;
139
//   int32_t RudderthreshMax;
140
//   int32_t ThrottleMax;
141
//   int32_t RudderMax;
142
//   int32_t ThrottleMultL;
143
//   int32_t RudderMultL;
144
//   int32_t ThrottleMultH;
145
//   int32_t RudderMultH;
5 Plagman 146
 
2940 helixhorne 147
 
5 Plagman 148
typedef struct
4747 terminx 149
{
150
    uint8_t active;
151
    uint8_t used;
152
    uint8_t toggle;
153
    uint8_t buttonheld;
154
    int32_t cleared;
155
} controlflags;
5 Plagman 156
 
157
typedef struct
4747 terminx 158
{
159
    kb_scancode key1;
160
    kb_scancode key2;
161
} controlkeymaptype;
5 Plagman 162
 
163
typedef struct
4747 terminx 164
{
165
    uint8_t singleclicked;
166
    uint8_t doubleclicked;
167
    uint16_t extra;
168
} controlbuttontype;
5 Plagman 169
 
170
typedef struct
4747 terminx 171
{
172
    uint8_t analogmap;
173
    uint8_t minmap;
174
    uint8_t maxmap;
175
    uint8_t extra;
176
} controlaxismaptype;
5 Plagman 177
 
178
typedef struct
4747 terminx 179
{
180
    int32_t analog;
181
    int32_t digital;
182
} controlaxistype;
5 Plagman 183
 
184
 
185
//***************************************************************************
186
//
187
// PROTOTYPES
188
//
189
//***************************************************************************
190
 
4766 hendricks2 191
#ifdef __cplusplus
192
}
5 Plagman 193
#endif
194
#endif