Subversion Repositories eduke32

Rev

Rev 8127 | 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 JOY buttons
6056 hendricks2 73
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
5 Plagman 74
#define MAXJOYBUTTONS 32
4826 hendricks2 75
#define MAXJOYBUTTONSANDHATS (MAXJOYBUTTONS+4)
5 Plagman 76
 
77
// Number of JOY axes
6056 hendricks2 78
// KEEPINSYNC duke3d/src/gamedefs.h, build/src/sdlayer.cpp
4827 hendricks2 79
#define MAXJOYAXES 9
4826 hendricks2 80
#define MAXJOYDIGITAL (MAXJOYAXES*2)
5 Plagman 81
 
82
// NORMAL axis scale
3527 helixhorne 83
#define NORMALAXISSCALE 65536
5 Plagman 84
 
4747 terminx 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))))
7216 terminx 88
#define LIMITCONTROL(x) (*x = clamp(*x, -MAXCONTROLVALUE, MAXCONTROLVALUE))
5 Plagman 89
 
90
//****************************************************************************
91
//
92
// TYPEDEFS
93
//
94
//****************************************************************************
95
 
96
typedef enum
4747 terminx 97
{
98
    motion_Left = -1,
99
    motion_Up = -1,
100
    motion_None = 0,
101
    motion_Right = 1,
102
    motion_Down = 1
103
} motion;
5 Plagman 104
 
105
 
106
typedef struct
4747 terminx 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;
5 Plagman 121
 
1346 terminx 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;
5 Plagman 134
 
2940 helixhorne 135
 
5 Plagman 136
typedef struct
4747 terminx 137
{
138
    uint8_t active;
139
    uint8_t used;
140
    uint8_t toggle;
141
    uint8_t buttonheld;
142
    int32_t cleared;
143
} controlflags;
5 Plagman 144
 
145
typedef struct
4747 terminx 146
{
8550 terminx 147
    kb_scancode keyPrimary;
148
    kb_scancode keySecondary;
4747 terminx 149
} controlkeymaptype;
5 Plagman 150
 
151
typedef struct
4747 terminx 152
{
153
    uint8_t singleclicked;
154
    uint8_t doubleclicked;
155
    uint16_t extra;
156
} controlbuttontype;
5 Plagman 157
 
158
typedef struct
4747 terminx 159
{
160
    uint8_t analogmap;
161
    uint8_t minmap;
162
    uint8_t maxmap;
163
    uint8_t extra;
164
} controlaxismaptype;
5 Plagman 165
 
166
typedef struct
4747 terminx 167
{
168
    int32_t analog;
7986 hendricks2 169
    int8_t digital;
170
    int8_t digitalClearedN, digitalClearedP;
4747 terminx 171
} controlaxistype;
5 Plagman 172
 
173
 
174
//***************************************************************************
175
//
176
// PROTOTYPES
177
//
178
//***************************************************************************
179
 
4766 hendricks2 180
#ifdef __cplusplus
181
}
5 Plagman 182
#endif
183
#endif