-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathDCS_F-18C_Hornet.tmc
More file actions
323 lines (253 loc) · 13.5 KB
/
DCS_F-18C_Hornet.tmc
File metadata and controls
323 lines (253 loc) · 13.5 KB
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
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
// DCS F-18C Hornet Thrustmaster Warthog/AVA/MFD Script by Astro
// TARGET version 3.0.24.618
// version 1.0, Dec 2024
include "target.tmh"
include "DCS_Fighter_Common.tmc"
// -------------------- INITIALISE --------------------
int autopilot_ALThold;
int autopilot_ATThold;
int autopilot_off;
int autopilot;
char autopilot_mode;
int override;
char override_dog;
int nosewheelsteering;
define AB 75 // detent position at AB% of full throttle reach
// -------------------- MAIN --------------------
int main()
{
// -------------------- COMMON CONFIGURATION --------------------
dcs_fighter_common_configuration(); // load dcs COMMON config
// -------------------- COMMON --------------------
dcs_fighter_common(); // load dcs COMMON controls
dcs_fighter_common_mfd(); // load dcs MFD controls
// before aircraft specific, to allow for overwriting of common controls when necessary
// -------------------- FUNCTIONS --------------------
// Autopilot function
autopilot_ALThold = CHAIN( DOWN+L_CTL+L_SHIFT, D(10), DOWN+'p', D(100), UP+'p', D(), UP+L_CTL+L_SHIFT, // Autopilot PITCH Switch - ALT HOLD (extra 100ms needed by DCS)
EXEC( "autopilot_mode = 1;" ));
autopilot_ATThold = CHAIN( DOWN+L_CTL+L_ALT, D(10), DOWN+'p', D(100), UP+'p', D(), UP+L_CTL+L_ALT, // Autopilot PITCH Switch - ATT HOLD (extra 100ms needed by DCS)
EXEC( "autopilot_mode = 1;" ));
autopilot_off = CHAIN( DOWN+L_CTL, D(10), DOWN+'p', D(100), UP+'p', D(), UP+L_CTL, // Autopilot PITCH Switch - A/P OFF (extra 100ms needed by DCS)
EXEC( "autopilot_mode = 0;" ));
autopilot_mode = 0;
autopilot = EXEC( "if(!autopilot_mode) ActKey( PULSE+KEYON+autopilot_ALThold );"
"if(autopilot_mode) ActKey( PULSE+KEYON+autopilot_off );" );
// A-A override function
override_dog = 0;
override = EXEC( "if(!override_dog) ActKey( PULSE+KEYON+L_CTL+'3' );" // DOGFIGHT/Missile Override Switch - DOGFIGHT
"if(override_dog) ActKey( PULSE+KEYON+L_CTL+'4' );" // DOGFIGHT/Missile Override Switch - MISSILE OVERRIDE
"override_dog = !override_dog;" );
// Nosewheel Steering function
nosewheelsteering = TEMPO( SEQ( PULSE+DX3,
EXEC( "if(WHDN) ActKey( PULSE+KEYON+'a' );"
"else ActKey( PULSE+KEYON+DX3 );")),
DX3, 500 );
// -------------------- FLIGHT STICK --------------------
// --DCS_Fighter_Common---------
// TG - Camera/Gun Trigger
// S1 - Nosewheel Steering Button
// S2 - Weapon Release Button
// H1 - Trim Switch
// H3 - Display Management Switch
// JOYX
// JOYY
// -----------------------------
// Expand FOV Button - S3
MapKeyUMD(&AVA_F16, S3, 'a', // U - Autopilot/Nosewheel Steering Disengage (Paddle) Switch
'a', // M - Autopilot/Nosewheel Steering Disengage (Paddle) Switch
'a' ); // D - Autopilot/Nosewheel Steering Disengage (Paddle) Switch
// Nosewheel Steering Button
// S1
// MapKeyIO(&AVA_F16, S1, SEQ( PULSE+F10, PULSE+F1 ), // I - map
// nosewheelsteering ); // O - Nosewheel Steering Button
// Target Management Switch
// H2U
MapKeyIO(&AVA_F16, H2U, ENT, // I - Throttle Designator Controller - DEPRESS
DX7 ); // O - zoom in
// H2D
MapKeyIO(&AVA_F16, H2D, DX3, // I - Undesignate/Nose Wheel Steer Switch
DX9 ); // O - zoom out
// H2R
MapKeyIO(&AVA_F16, H2R, 0, // I -
DX8 ); // O - snap view right MFD (LWIN+KP6)
// H2L
MapKeyIO(&AVA_F16, H2L, CHAIN( R_ALT, D(10), 'l' ), // I - Sensor Control Switch - Depress
DX10 ); // O - snap view left MFD (LWIN+KP4)
// Countermeasure Management Switch
// H4U
MapKeyIO(&AVA_F16, H4U, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'w', D(), UP+L_SHIFT ), // I - Select Sparrow
PULSE+'e' ); // O - Dispense Switch - Forward (CHAFF)
// H4D
MapKeyIO(&AVA_F16, H4D, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'x', D(), UP+L_SHIFT ), // I - Select Gun
PULSE+'d' ); // O - Dispense Switch - Aft (FLARE)
// H4R
MapKeyIO(&AVA_F16, H4R, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'d', D(), UP+L_SHIFT ), // I - Select AMRAAM
0 ); // O - CMS - Right
// H4L
MapKeyIO(&AVA_F16, H4L, 0, // I -
0 ); // O - CMS - Left
// H4P
MapKeyIO(&AVA_F16, H4P, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'s', D(), UP+L_SHIFT ), // I - Select Sidewinder
CHAIN( DOWN+L_ALT, D(10), DOWN+'f', D(100), UP+'f', D(), UP+L_ALT )); // O - Dispense Button
// -------------------- THROTTLE --------------------
// --DCS_Fighter_Common---------
// Left Throttle Button
// SPDF/B
// CHF/B
// MSU/D/P
// PSF/B
// EACON/OFF Landing Gear
// EOLIGN/OVER
// EORIGN/OVER
// EFLNORM/OVER
// EFRNORM/OVER
// SC
// APUON/OFF
// RDRNRM/DIS Canopy
// IDLELON/IDLERON
// THR_LEFT
// THR_RIGHT
// THR_FC
// SCX
// SCY
// -----------------------------
// Autopilot
// APENG
MapKeyIO(&Throttle, APENG, autopilot_ATThold, // I - Autopilot ATT on (Autopilot PITCH Switch - ATT HOLD)
autopilot ); // O - Autopilot ALT on or AP Off (Autopilot PITCH Switch - ALT HOLD)
// APDIS
MapKey(&Throttle, APDIS, 0); //
// APPAT
MapKey(&Throttle, APPAT, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'a', D(), UP+L_SHIFT )); // Autopilot ROLL Switch - HDG SEL
// APAH
MapKey(&Throttle, APAH, CHAIN( DOWN+L_CTL, D(10), PULSE+'a', D(), UP+L_CTL )); // Autopilot ROLL Switch - ATT HOLD
// APALT
MapKey(&Throttle, APALT, CHAIN( DOWN+L_ALT, D(10), PULSE+'a', D(), UP+L_ALT )); // Autopilot ROLL Switch - STRG SEL
// Coolie Switch
// CSU
MapKeyIOUMD(&Throttle, CSU, TEMPO( CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x56], D(), UP+L_CTL ), // IU - ICP DED Increment/Decrement Switch - Decrement (L_CTL+NUM-)
CHAIN( DOWN+L_ALT+R_SHIFT, D(10), PULSE+'9', D(), UP+L_ALT+R_SHIFT ), // [long] HSD zoom out (Right MFD OSB 19 on HSD page)
500 ), //
CHAIN( DOWN+L_ALT+R_SHIFT, D(10), PULSE+'9', D(), UP+L_ALT+R_SHIFT ), // OU - Slave/Bore toggle (Right MFD OSB 19 on SMS page)
CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x56], D(), UP+L_CTL ), // IM - ICP DED Increment/Decrement Switch - Decrement (L_CTL+NUM-)
0, // OM -
CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x56], D(), UP+L_CTL ), // ID - ICP DED Increment/Decrement Switch - Decrement (L_CTL+NUM-)
0); // OD -
// CSD
MapKeyIOUMD(&Throttle, CSD, TEMPO( CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x57], D(), UP+L_CTL ), // IU - ICP DED Increment/Decrement Switch - Increment (L_CTL+NUM+)
CHAIN( DOWN+L_ALT+R_SHIFT, D(10), PULSE+'0', D(), UP+L_ALT+R_SHIFT ), // [long] HSD zoom in (Right MFD OSB 20 on HSD page)
500 ), //
DX14, // OU - ENABLE Switch - Depress
CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x57], D(), UP+L_CTL ), // IM - ICP DED Increment/Decrement Switch - Increment (L_CTL+NUM+)
DX14, // OM - ENABLE Switch - Depress
CHAIN( DOWN+L_CTL, D(10), PULSE+USB[0x57], D(), UP+L_CTL ), // ID - ICP DED Increment/Decrement Switch - Increment (L_CTL+NUM+)
DX14); // OD - ENABLE Switch - Depress
// CSR
MapKeyIOUMD(&Throttle, CSR, CHAIN( L_CTL, D(10), RARROW ), // IU - ICP Data Control Switch - SEQ (dobber sequence)
DX23, // OU - Cage/Uncage Button
CHAIN( L_CTL, D(10), RARROW ), // IM - ICP Data Control Switch - SEQ (dobber sequence)
DX23, // OM - Cage/Uncage Button
CHAIN( L_CTL, D(10), RARROW ), // ID - ICP Data Control Switch - SEQ (dobber sequence)
DX23 ); // OD - Cage/Uncage Button
// CSL
MapKeyIOUMD(&Throttle, CSL, CHAIN( L_CTL, D(10), LARROW ), // IU - ICP Data Control Switch - RET (dobber return)
CHAIN( L_CTL, D(10), KP7 ), // OU - ICP Priority Function Button - 7(MARK)
CHAIN( L_CTL, D(10), LARROW ), // IM - ICP Data Control Switch - RET (dobber return)
CHAIN( L_CTL, D(10), KP7 ), // OM - ICP Priority Function Button - 7(MARK)
CHAIN( L_CTL, D(10), LARROW ), // ID - ICP Data Control Switch - RET (dobber return)
CHAIN( L_CTL, D(10), KP7 )); // OD - ICP Priority Function Button - 7(MARK)
// China Hat
// CHF
MapKeyIO(&Throttle, CHF, brightness_up, // I - brightness up for goggle/HMCS
REXEC( 20, 200, "ActKey( PULSE+KEYON+'=' );" )); // O - Radar Elevation Control - Up (REXEC to slow down repeat press)
// CHB
MapKeyIO(&Throttle, CHB, brightness_down, // I - brightness down for goggle/HMCS
REXEC( 21, 200, "ActKey( PULSE+KEYON+'-' );" )); // O - Radar Elevation Control - Down (REXEC to slow down repeat press)
// Flaps Switch (RF Switch)
// FLAPU
MapKey(&Throttle, FLAPU, PULSE+'f'); // FLAP Switch - AUTO
// FLAPM
MapKey(&Throttle, FLAPM, CHAIN( DOWN+L_SHIFT, D(10), PULSE+'f', D(), UP+L_SHIFT )); // FLAP Switch - HALF
// FLAPD
MapKey(&Throttle, FLAPD, CHAIN( DOWN+L_CTL, D(10), PULSE+'f', D(), UP+L_CTL )); // FLAP Switch - FULL
// Canopy //TODO check only common, or override necessary
// RDRNRM
// MapKeyIOUMD(&Throttle, RDRNRM, 0, // IU -
// 0, // OU -
// CHAIN( DOWN+L_SHIFT, D(10), PULSE+'c', D(), UP+L_SHIFT ), // IM - Canopy Handle - DOWN/UP
// CHAIN( L_CTL, D(10), 'c' ), // OM - Canopy - OPEN/CLOSE
// 0, // ID -
// 0); // OD -
// APU off DX35 here to override Common?
// Engine Operation
// EOLIGN
// EOLNORM in common
// EOLMOTOR
// MapKeyIO(&Throttle, EOLMOTOR, 0, // I -
// 0); // O -
// EORIGN
// MapKey(&Throttle, EORIGN, 0); //
// EORNORM in common
// EORMOTOR in common
// Engine Override Left
// EFLNORM
MapKeyIO(&Throttle, EFLNORM, CHAIN( 0, D(), // I - MANUAL PITCH Override Switch - NORM
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED5) ), // LED5 OFF for MANUAL PITCH Override
0 ); // O -
// EFLOVER
MapKeyIO(&Throttle, EFLOVER, CHAIN( DX22, D(), // I - MANUAL PITCH Override Switch - OVRD // TODO ********* FIX DX in DCS
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED5) ), // LED5 ON for MANUAL PITCH Override
0 ); // O -
// Engine idle/off - moved to Common
// SC
MapKeyIO(&Throttle, SC, TEMPO( CHAIN( DOWN+R_CTL, D(10), PULSE+INS, D(), UP+R_CTL ), // I - [short] re-centre IR tracker
CHAIN( DOWN+L_SHIFT, D(10), PULSE+'`', D(), UP+L_SHIFT), // [long] discord game overlay
500),
PULSE+'d'); // O - Expand/FOV Button
// U LAYER - Air-to-Air Mode
// BSF - LED1 ON/OFF
MapKeyIO(&Throttle, BSF, 0, // I - DOGFIGHT
CHAIN( DOWN+'1', D(100), UP+'1', // O - A-A mode on
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED1) )); // LED1 ON for U layer
MapKeyRIO(&Throttle, BSF, 0, // I - DOGFIGHT
CHAIN( DOWN+'1', D(100), UP+'1', // O - A-A mode off
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED1) )); // LED1 OFF for U layer
// M LAYER - Navigation Mode
// BSM - LED2 ON/OFF
MapKey(&Throttle, BSM, CHAIN( D(200), LED(&Throttle, LED_ONOFF, LED_CURRENT+LED2))); // LED2 ON for M layer
MapKeyR(&Throttle, BSM, LED(&Throttle, LED_ONOFF, LED_CURRENT-LED2)); // LED2 OFF for M layer
// D LAYER - Air-to-Ground Mode
// BSB - LED3 ON/OFF
MapKeyIO(&Throttle, BSB, 0, // I -
CHAIN( DOWN+'2', D(100), UP+'2', // O - A-G mode on
LED(&Throttle, LED_ONOFF, LED_CURRENT+LED3) )); // LED3 ON for D layer
MapKeyRIO(&Throttle, BSB, 0, // I -
CHAIN( DOWN+'2', D(100), UP+'2', // O - A-G mode off
LED(&Throttle, LED_ONOFF, LED_CURRENT-LED3) )); // LED3 OFF for D layer
}
// -------------------- AFTERBURNER DETENT --------------------
int afterburnerdetent(int x)
{
if (x == 1) { // Activate detent
SetCustomCurve(&Throttle, THR_LEFT, LIST(0,0, 25,25, 50,50, AB,AB, 100,AB));
SetCustomCurve(&Throttle, THR_RIGHT, LIST(0,0, 25,25, 50,50, AB,AB, 100,AB));
}
else { // Throttle back to full reach
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
}
}
// -------------------- EVENTHANDLE --------------------
int EventHandle(int type, alias o, int x)
{
if ((&o == &Throttle) & (x == THR_LEFT)) { // Detect left throttle position for afterburner detent
if (afterburnerdetent_present & afterburnerdetent_lifted) { // If afterburnerdetent present and detent is lifted
if (Throttle[THR_LEFT] < (100-AB)*(2*AMAX)/100) { // If left throttle below afterburner detent value of AB%
afterburnerdetent(1); // Re-engage detent
afterburnerdetent_lifted = 0; // Detent is no longer lifted
}
}
}
DefaultMapping(&o, x);
}