-
Notifications
You must be signed in to change notification settings - Fork 30
/
config.h
executable file
·129 lines (104 loc) · 3.16 KB
/
config.h
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
#ifndef CONFIG_H
#define CONFIG_H
#define MAX_PLAYER_NAME_LENGTH (16)
#define MAX_KEYS_PER_CONTROL (8)
#define MAX_PRIMARY_WEAPONS (6)
#define MAX_SECONDARY_WEAPONS (11)
#define DIK_JOYSTICK (0x300)
#define DIK_JOYSTICK_POV (0x080)
#define JOYSTICK_BUTTON_KEYCODE( J, B ) ( DIK_JOYSTICK | ( ( (J) & 0x0F ) << 12 ) | ( (B) & 0x7F ) )
#define JOYSTICK_POVDIR_KEYCODE( J, P, D ) ( DIK_JOYSTICK | DIK_JOYSTICK_POV | ( ( (J) & 0x0F ) << 12 ) | ( ( (P) & 0x03 ) << 2 ) | ( (D) & 0x03 ) )
#define KEY_ON_KEYBOARD( K ) ( (K) < SDLK_LAST )
#define KEY_ON_MOUSE( K ) ( (K) > SDLK_LAST && (K) < DIK_JOYSTICK )
#define KEY_ON_JOYSTICK( K ) ( (K) >= DIK_JOYSTICK )
#define KEY_ON_JOYSTICK_BUTTON( K ) !( (K) & DIK_JOYSTICK_POV )
#define KEY_ON_JOYSTICK_POV( K ) ( (K) & DIK_JOYSTICK_POV )
#define KEY_JOYSTICK( K ) ( ( (K) >> 12 ) & 0x0F )
#define KEY_JOYSTICK_BUTTON( K ) ( (K) & 0x7F )
#define KEY_JOYSTICK_POV( K ) ( ( (K) >> 2 ) & 0x03 )
#define KEY_JOYSTICK_POVDIR( K ) ( (K) & 0x03 )
#include "main.h"
#include "title.h"
typedef short VirtualKeycode;
#define MAX_KEYNAME_LENGTH 32
typedef struct {
int keys;
VirtualKeycode key[MAX_KEYS_PER_CONTROL];
} USERKEY;
typedef struct _DEFKEY
{
USERKEY *def;
int selected_key;
} DEFKEY;
typedef struct {
char *keyword;
VirtualKeycode keycode;
} VIRTUALKEYMAP;
typedef struct {
char name[MAX_PLAYER_NAME_LENGTH];
u_int16_t bike;
u_int16_t bikecomp;
float mouse_x_sensitivity; // 1.0 is normal
float mouse_y_sensitivity; // 1.0 is normal
int invert_pitch; // 0 = no, otherwise yes -> pitch controls reversed
int invert_turn; // 0 = no, otherwise yes -> roll controls reversed
float autolevel_rate; // 0 = no, otherwise yes -> ship autolevelling enabled
USERKEY up;
USERKEY down;
USERKEY left;
USERKEY right;
USERKEY roll_left;
USERKEY roll_right;
USERKEY move_left;
USERKEY move_right;
USERKEY move_up;
USERKEY move_down;
USERKEY move_forward;
USERKEY move_backward;
USERKEY move;
USERKEY roll;
USERKEY turbo;
USERKEY cruise_faster;
USERKEY cruise_slower;
USERKEY fire_primary;
USERKEY fire_secondary;
USERKEY fire_mine;
USERKEY select_next_primary;
USERKEY select_prev_primary;
USERKEY select_next_secondary;
USERKEY select_prev_secondary;
USERKEY full_rear_view;
USERKEY headlights;
USERKEY select_primary[MAX_PRIMARY_WEAPONS];
USERKEY select_secondary[MAX_SECONDARY_WEAPONS];
USERKEY drop_primary;
USERKEY drop_secondary;
USERKEY drop_shield;
USERKEY drop_ammo;
USERKEY show_messages;
USERKEY show_stats;
USERKEY show_networkinfo;
USERKEY send_msg;
#ifdef PLAYER_SPEECH_TAUNTS
USERKEY send_speech;
#endif
int16_t primary_priority[MAX_PRIMARY_WEAPONS];
int16_t primary_order[MAX_PRIMARY_WEAPONS];
int16_t secondary_priority[MAX_SECONDARY_WEAPONS];
int16_t secondary_order[MAX_SECONDARY_WEAPONS];
char macro1[ MAXTEXTMSG ];
char macro2[ MAXTEXTMSG ];
char macro3[ MAXTEXTMSG ];
} USERCONFIG;
extern USERCONFIG default_config;
extern int
read_config( USERCONFIG *u, char *cfg_name );
extern int
write_config( USERCONFIG *u, char *cfg_name );
extern const char *
key_name( int keycode );
const char *
key_char( int keycode );
extern const char *
key_fullname( int keycode );
#endif // CONFIG_H