Subversion Repositories eduke32

Rev

Rev 7216 | Rev 7970 | 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
5768 hendricks2 17
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
5 Plagman 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
 
5662 terminx 35
#pragma once
36
 
4747 terminx 37
#ifndef control_private_h_
38
#define control_private_h_
7216 terminx 39
 
40
#include "compat.h"
41
#include "keyboard.h"
42
 
4766 hendricks2 43
#ifdef __cplusplus
44
extern "C" {
5 Plagman 45
#endif
46
 
1346 terminx 47
 
5 Plagman 48
//****************************************************************************
49
//
50
// DEFINES
51
//
52
//****************************************************************************
53
 
54
#define AXISUNDEFINED   0x7f
55
#define BUTTONUNDEFINED 0x7f
56
#define KEYUNDEFINED    0x7f
57
 
7968 hendricks2 58
#define THRESHOLD        (0x200 * 32767 / 10000)
59
#define MINTHRESHOLD     (0x80 * 32767 / 10000)
5 Plagman 60
 
7123 terminx 61
#define DEFAULTMOUSESENSITIVITY 4 // 0x7000+MINIMUMMOUSESENSITIVITY
127 terminx 62
 
5 Plagman 63
#define INSTANT_ONOFF       0
64
#define TOGGLE_ONOFF        1
65
 
66
#define MAXCONTROLVALUE  0x7fff
67
 
68
// Number of Mouse buttons
69
 
3527 helixhorne 70
//#define MAXMOUSEBUTTONS 10
5 Plagman 71
 
72
// Number of Mouse Axes
6056 hendricks2 73
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
5 Plagman 74
#define MAXMOUSEAXES 2
4826 hendricks2 75
#define MAXMOUSEDIGITAL (MAXMOUSEAXES*2)
5 Plagman 76
 
77
// Number of JOY buttons
6056 hendricks2 78
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
5 Plagman 79
#define MAXJOYBUTTONS 32
4826 hendricks2 80
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
5 Plagman 81
 
82
// Number of JOY axes
6056 hendricks2 83
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
4827 hendricks2 84
#define MAXJOYAXES 9
4826 hendricks2 85
#define MAXJOYDIGITAL (MAXJOYAXES*2)
5 Plagman 86
 
87
// NORMAL axis scale
3527 helixhorne 88
#define NORMALAXISSCALE 65536
5 Plagman 89
 
4747 terminx 90
#define BUTTONSET(x, value) (CONTROL_ButtonState |= ((uint64_t)value << ((uint64_t)(x))))
91
#define BUTTONCLEAR(x) (CONTROL_ButtonState &= ~((uint64_t)1 << ((uint64_t)(x))))
92
#define BUTTONHELDSET(x, value) (CONTROL_ButtonHeldState |= (uint64_t)(value << ((uint64_t)(x))))
7216 terminx 93
#define LIMITCONTROL(x) (*x = clamp(*x, -MAXCONTROLVALUE, MAXCONTROLVALUE))
5 Plagman 94
 
95
//****************************************************************************
96
//
97
// TYPEDEFS
98
//
99
//****************************************************************************
100
 
101
typedef enum
4747 terminx 102
{
103
    motion_Left = -1,
104
    motion_Up = -1,
105
    motion_None = 0,
106
    motion_Right = 1,
107
    motion_Down = 1
108
} motion;
5 Plagman 109
 
110
 
111
typedef struct
4747 terminx 112
{
113
    int32_t joyMinX;
114
    int32_t joyMinY;
115
    int32_t threshMinX;
116
    int32_t threshMinY;
117
    int32_t threshMaxX;
118
    int32_t threshMaxY;
119
    int32_t joyMaxX;
120
    int32_t joyMaxY;
121
    int32_t joyMultXL;
122
    int32_t joyMultYL;
123
    int32_t joyMultXH;
124
    int32_t joyMultYH;
125
} JoystickDef;
5 Plagman 126
 
1346 terminx 127
//   int32_t ThrottleMin;
128
//   int32_t RudderMin;
129
//   int32_t ThrottlethreshMin;
130
//   int32_t RudderthreshMin;
131
//   int32_t ThrottlethreshMax;
132
//   int32_t RudderthreshMax;
133
//   int32_t ThrottleMax;
134
//   int32_t RudderMax;
135
//   int32_t ThrottleMultL;
136
//   int32_t RudderMultL;
137
//   int32_t ThrottleMultH;
138
//   int32_t RudderMultH;
5 Plagman 139
 
2940 helixhorne 140
 
5 Plagman 141
typedef struct
4747 terminx 142
{
143
    uint8_t active;
144
    uint8_t used;
145
    uint8_t toggle;
146
    uint8_t buttonheld;
147
    int32_t cleared;
148
} controlflags;
5 Plagman 149
 
150
typedef struct
4747 terminx 151
{
152
    kb_scancode key1;
153
    kb_scancode key2;
154
} controlkeymaptype;
5 Plagman 155
 
156
typedef struct
4747 terminx 157
{
158
    uint8_t singleclicked;
159
    uint8_t doubleclicked;
160
    uint16_t extra;
161
} controlbuttontype;
5 Plagman 162
 
163
typedef struct
4747 terminx 164
{
165
    uint8_t analogmap;
166
    uint8_t minmap;
167
    uint8_t maxmap;
168
    uint8_t extra;
169
} controlaxismaptype;
5 Plagman 170
 
171
typedef struct
4747 terminx 172
{
173
    int32_t analog;
174
    int32_t digital;
175
} controlaxistype;
5 Plagman 176
 
177
 
178
//***************************************************************************
179
//
180
// PROTOTYPES
181
//
182
//***************************************************************************
183
 
4766 hendricks2 184
#ifdef __cplusplus
185
}
5 Plagman 186
#endif
187
#endif