Subversion Repositories eduke32

Rev

Rev 4541 | Rev 4766 | 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_
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
 
4747 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
 
4747 terminx 84
#define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x))))
5 Plagman 85
 
4747 terminx 86
#define LIMITCONTROL(x)                                                                                                \
87
    {                                                                                                                  \
88
        if ((*x) > MAXCONTROLVALUE)                                                                                    \
89
        {                                                                                                              \
90
            (*x) = MAXCONTROLVALUE;                                                                                    \
91
        }                                                                                                              \
92
        if ((*x) < -MAXCONTROLVALUE)                                                                                   \
93
        {                                                                                                              \
94
            (*x) = -MAXCONTROLVALUE;                                                                                   \
95
        }                                                                                                              \
5 Plagman 96
    }
4747 terminx 97
#define SGN(x) (((x) > 0) ? 1 : ((x) < 0) ? -1 : 0)
5 Plagman 98
 
99
//****************************************************************************
100
//
101
// TYPEDEFS
102
//
103
//****************************************************************************
104
 
105
typedef enum
4747 terminx 106
{
107
    motion_Left = -1,
108
    motion_Up = -1,
109
    motion_None = 0,
110
    motion_Right = 1,
111
    motion_Down = 1
112
} motion;
5 Plagman 113
 
114
 
115
typedef struct
4747 terminx 116
{
117
    int32_t joyMinX;
118
    int32_t joyMinY;
119
    int32_t threshMinX;
120
    int32_t threshMinY;
121
    int32_t threshMaxX;
122
    int32_t threshMaxY;
123
    int32_t joyMaxX;
124
    int32_t joyMaxY;
125
    int32_t joyMultXL;
126
    int32_t joyMultYL;
127
    int32_t joyMultXH;
128
    int32_t joyMultYH;
129
} JoystickDef;
5 Plagman 130
 
1346 terminx 131
//   int32_t ThrottleMin;
132
//   int32_t RudderMin;
133
//   int32_t ThrottlethreshMin;
134
//   int32_t RudderthreshMin;
135
//   int32_t ThrottlethreshMax;
136
//   int32_t RudderthreshMax;
137
//   int32_t ThrottleMax;
138
//   int32_t RudderMax;
139
//   int32_t ThrottleMultL;
140
//   int32_t RudderMultL;
141
//   int32_t ThrottleMultH;
142
//   int32_t RudderMultH;
5 Plagman 143
 
2940 helixhorne 144
 
5 Plagman 145
typedef struct
4747 terminx 146
{
147
    uint8_t active;
148
    uint8_t used;
149
    uint8_t toggle;
150
    uint8_t buttonheld;
151
    int32_t cleared;
152
} controlflags;
5 Plagman 153
 
154
typedef struct
4747 terminx 155
{
156
    kb_scancode key1;
157
    kb_scancode key2;
158
} controlkeymaptype;
5 Plagman 159
 
160
typedef struct
4747 terminx 161
{
162
    uint8_t singleclicked;
163
    uint8_t doubleclicked;
164
    uint16_t extra;
165
} controlbuttontype;
5 Plagman 166
 
167
typedef struct
4747 terminx 168
{
169
    uint8_t analogmap;
170
    uint8_t minmap;
171
    uint8_t maxmap;
172
    uint8_t extra;
173
} controlaxismaptype;
5 Plagman 174
 
175
typedef struct
4747 terminx 176
{
177
    int32_t analog;
178
    int32_t digital;
179
} controlaxistype;
5 Plagman 180
 
181
 
182
//***************************************************************************
183
//
184
// PROTOTYPES
185
//
186
//***************************************************************************
187
 
3116 hendricks2 188
#ifdef EXTERNC
5 Plagman 189
};
190
#endif
191
#endif