////////////////////////////////////////////////////////////
// Target Script File (TMC)
////////////////////////////////////////////////////////////
// Simulator: Il2 Sturmovik Cliffs of Dover
// Date: 29_03_2011
// Prepared By: TX_Gunslinger
//
http://txsquadron.com//////////////////////////////////////////////////////////////
//:
//1. Customized
include "target.tmh"
include "Il2-CoD-u2nxt-warthog.ttm"
int main()
{
//Exclude non-existant devices
Exclude(&Joystick);
Exclude(&T16000);
Exclude(&LMFD);
Exclude(&RMFD);
if(Init(&EventHandle)) return 1;
SetKBRate(32, 50);
SetKBLayout(KB_ENG);
//Map Joystick Axis
MapAxis(&HCougar, JOYX, DX_X_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&HCougar, JOYX, 0, 0, 0, 0, 0);
MapAxis(&HCougar, JOYY, DX_Y_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&HCougar, JOYY, 0, 0, 0, 0, 0);
//Map Rudder Axis (through Cougar connector)
MapAxis(&HCougar, RUDDER, DX_Z_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&HCougar, RUDDER, 0, 0, 0, 0, 0);
MapAxis(&HCougar, MAN_RNG, DX_XROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&HCougar, MAN_RNG, 0, 0, 0, 0, 0);
MapAxis(&HCougar, THROTTLE, DX_YROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&HCougar, THROTTLE, 0, 0, 0, 0, 0);
//Now that Axis are mapped - setup EXEC for X,Y,Z Trim on S4
MapKeyIO(&HCougar, S4,
EXEC("TrimDXAxis(DX_Z_AXIS, SET(0)); TrimDXAxis(DX_X_AXIS, SET(0)); TrimDXAxis(DX_Y_AXIS, SET(0));"),
EXEC("LockDXAxis(DX_Z_AXIS, 1); LockDXAxis(DX_X_AXIS, 1); LockDXAxis(DX_Y_AXIS, 1);"
"TrimDXAxis(DX_Z_AXIS, CURRENT);TrimDXAxis(DX_X_AXIS, CURRENT); TrimDXAxis(DX_Y_AXIS, CURRENT);",
"LockDXAxis(DX_Z_AXIS, 0); LockDXAxis(DX_X_AXIS, 0); LockDXAxis(DX_Y_AXIS, 0);"));
//Set Cougar Joystick S3 as U/D shift control AND Warthog Boat Switch as U/M/D Layers
//U/M/D Layers effect ONLY Weapons. BSF = U Layer while BSB = D Layer
//Boat Switch Back places Cannon on S2 switch (for fighters only0 - S2 = Cannon TG1 = MG
//Boat Switch Middle configures S2 to drop one bomb (unshifted or /U)
//Boat Switch Forward configures S2 to repeat bombs until S2 released
SetShiftButton(&HCougar, S3, &Throttle, BSF, BSB,0);
//Triggers on Cougar - Controlled by WARTHOG BOAT SWITCH
MapKeyIOUMD(&HCougar, TG1, Weapon_1, Weapon_1, Weapon_2, Weapon_1, Weapon_2, Weapon_1);
MapKeyIOUMD(&HCougar, TG2, Weapon_1, Weapon_1, 0, Weapon_1_2, 0, Weapon_1_2);
MapKeyIO(&HCougar, S1, PULSE+Loosen_Shoulder_Straps, Toggle_Gunsight_Dimmer);
MapKeyIOUMD(&HCougar, S2,
PULSE+Weapon_3, //Boat Switch Forward, S3 pressed and held Rockets - Switch Forward = "Release all Bombs"
REXEC(1, 40, "ActKey(KEYON+PULSE+Weapon_4);"), //Boat Switch Forward Bombs
PULSE+Weapon_3, //Boat Switch Middle, S3 pressed and held Rockets - Switch Middle = Normal - Single Bomb release per S2 actuation
PULSE+Weapon_4, //Boat Switch Middle Bombs
PULSE+Weapon_3, //Boat Switch Back, S3 pressed and held Rockets - Switch Back = Sturmjager mode. Wgfr-21 and Cannons
Weapon_2); //Boat Switch Back Cannon
//Hat1 - FINE TRIM NON REPEAT - small adjustments for work in concert with trim sliders - routine left in as option
//MapKeyIO(&HCougar, H1U, PULSE+Rudder_Trim_Neutral,PULSE+Elevator_Trim_Negative);
//MapKeyIO(&HCougar, H1D, PULSE+Aileron_Trim_Neutral, PULSE+Elevator_Trim_Positive);
//MapKeyIO(&HCougar, H1L, PULSE+Aileron_Trim_Left, PULSE+Rudder_Trim_Left);
//MapKeyIO(&HCougar, H1R, PULSE+Aileron_Trim_Right, PULSE+Rudder_Trim_Right);
//Hat1 - FINE TRIM REPEAT - Auto Fine Trim Routine
MapKeyIO(&HCougar, H1U,
PULSE+Rudder_Trim_Neutral,
REXEC(2,60,"ActKey(KEYON+PULSE+Elevator_Trim_Positive);"));
MapKeyIO(&HCougar, H1D,
PULSE+Aileron_Trim_Neutral,
REXEC(3, 60, "ActKey(KEYON+PULSE+Elevator_Trim_Negative);"));
MapKeyIO(&HCougar, H1L,
REXEC(4, 60, "ActKey(KEYON+PULSE+Aileron_Trim_Left);"),
REXEC(5,60,"ActKey(KEYON+PULSE+Rudder_Trim_Left);"));
MapKeyIO(&HCougar, H1R,
REXEC(6, 60, "ActKey(KEYON+PULSE+Aileron_Trim_Right);"),
REXEC(7, 60, "ActKey(KEYON+PULSE+Rudder_Trim_Right);"));
// Hat 2 - GUNSIGHT SECTION
MapKeyIO(&HCougar, H2U,
REXEC(8, 60, "ActKey(KEYON+PULSE+Incr_Sight_Distance);"),
Toggle_Gunsight_Dimmer);
MapKeyIO(&HCougar, H2D,
REXEC(9, 60,"ActKey(KEYON+PULSE+Decr_Sight_Distance);"),
PULSE+Toggle_Gunsight_Illum);
MapKeyIO(&HCougar, H2L,
REXEC(10, 60, "ActKey(KEYON+PULSE+Adjust_Sight_Left);") ,
REXEC(11,60,"ActKey(KEYON+PULSE+Incr_Gunsight_Illum);"));
MapKeyIO(&HCougar, H2R,
REXEC(12, 60, "ActKey(KEYON+PULSE+Adjust_Sight_Right);"),
REXEC(13, 60,"ActKey(KEYON+PULSE+Decr_Gunsight_Illum);"));
//Hat 3 - VIEWS
//Trackir Centre
MapKeyIO(&HCougar, H3U,External_View,Center_TrackIR);
//H3R Zoom View Sequence
MapKeyIO(&HCougar, H3R,
PULSE+Next_Friendly_View,
SEQ( PULSE+Gunsight_Zoom_View, PULSE+Wide_View, PULSE+Normal_View));
//H3D Chase and "Six Checker" for enabled external views - 2nd Line is key release which returns view to cockpit
MapKeyIO(&HCougar, H3D, PULSE+Fly_by_View, PULSE+Chase_View);
MapKeyRIO(&HCougar, H3D, PULSE+Cockpit_View, PULSE+Cockpit_View);
//H3L Cockpit and External Enemy View
MapKeyIO(&HCougar, H3L, PULSE+Next_Enemy_View, PULSE+Cockpit_View);
//Hat 4 - FLAPS/TAILWHEEL/CANOPY/CHOCKS
MapKeyIO(&HCougar, H4U, Extend_Slats, PULSE+Flaps_Up);
MapKeyIO(&HCougar, H4R, PULSE+Arresting_Hook, PULSE+Toggle_Canopy_Hatch_Door);
MapKeyIO(&HCougar, H4D, Retract_Slats, PULSE+Flaps_Down);
MapKeyIO(&HCougar, H4L, PULSE+Toggle_Chocks, PULSE+Toggle_Sidewindow);
//COUGAR THROTTLE - Transplanted to Project Box
//Throttle Thumbmouse mapped as Cockpit light dimmer controls
KeyAxis(&HCougar, RDR_Y,
0, AXMAP2(3, REXEC(13, 60, "ActKey(KEYON+PULSE+Incr_Prim_Pit_Lights);"),
0, REXEC(14, 60, "ActKey(KEYON+PULSE+Decr_Prim_Pit_Lights);")));
KeyAxis(&HCougar, RDR_X,
0, AXMAP2(3, REXEC(15, 60, "ActKey(KEYON+PULSE+Incr_2ndary_Pit_Lights);"),
0,REXEC(16, 60, "ActKey(KEYON+PULSE+Decr_2ndary_Pit_Lights);")));
//T1 is assigned to Primary and Secondary Cockpit Lights
MapKeyIO(&HCougar, T1, PULSE+Toggle_Prim_Pit_Lights,PULSE+Toggle_2ndary_Pit_Lights);
//T2/3/4 are not assigned shifted values
MapKeyIO(&HCougar, T2, PULSE+Cockpit_Lights, PULSE+Cockpit_Lights);
MapKeyIO(&HCougar, T3, PULSE+Toggle_Mirrors, PULSE+Toggle_Mirrors);
MapKeyIO(&HCougar, T4, PULSE+Pilot_or_Gunner_Position, PULSE+Pilot_or_Gunner_Position);
//T5 is OPEN -
//T6 is PROP PITCH AUTO - with slider controlling prop pitch
MapKey(&HCougar, T6, PULSE+Prop_Pitch_Auto);
//Jettison Tanks/Stores and Emergency Switch
MapKeyIO(&HCougar, T7, Jettison_Canopy, PULSE+Jettison_Stores);
MapKeyIO(&HCougar, T8, PULSE+Bail_Out, PULSE+Jettison_Droptanks);
//Electric Prop Pitch Routine (HS-129)
MapKey(&HCougar, T10, REXEC(17, 50, "ActKey(KEYON+PULSE+Increase_Prop_Pitch);"));
MapKey(&HCougar, T9, REXEC(18, 50, "ActKey(KEYON+PULSE+Decrease_Prop_Pitch);"));
//WARTHOG THROTTLE
//LTB - small red push button is WEP
MapKeyIO(&Throttle, LTB, PULSE+Boost_Cut_Out,PULSE+Boost_WEP_Toggle);
//****SC should be setup as Comms PTT switch
//CSU Hat is single layer engine controls
MapKey(&Throttle, CSU, PULSE+Decrease_Mixture);
MapKey(&Throttle, CSD, PULSE+Increase_Mixture);
MapKey(&Throttle, CSR, PULSE+Supercharger_Next_Stage);
MapKey(&Throttle, CSL, PULSE+Supercharger_Prev_Stage);
//MSP Switch = in flight Map toggle
MapKey(&Throttle, MSP, PULSE+Radiator_Auto);
MapKeyIO(&Throttle, MSU,
REXEC(19, 260, "ActKey(KEYON+PULSE+Carb_Heat_Increase);"),
PULSE+Carb_Heat_Toggle);
MapKeyIO(&Throttle, MSD,
REXEC(20, 260, "ActKey(KEYON+PULSE+Carb_Heat_Decrease);"),
PULSE+Pitot_Heat);
MapKeyIO(&Throttle, MSL,
REXEC(22, 260, "ActKey(KEYON+PULSE+Oil_Radiator_Decrease);"),
REXEC(23, 260, "ActKey(KEYON+PULSE+Radiator_Decrease);"));
MapKeyIO(&Throttle, MSR,
REXEC(24, 260, "ActKey(KEYON+PULSE+Oil_Radiator_Increase);"),
REXEC(25, 260, "ActKey(KEYON+PULSE+Radiator_Increase);"));
//Coolie Switch Forward - Radiator *Note Il2 Radiator function only moves in one direction i.e. forward.
//This sequence is the only option for accessing AUTO Radiator function
//found in many aircraft. Mapping Radiator to a direct X rotary does not allow access to the "Auto" radiator function.
//MapKeyIO(&Throttle, CHF, Oil_Radiator_Increase, Radiator_Increase);
//Coolie Switch Back - Yes, duplicate of the forward position. This is in prepartion for Il2 "Cliffs of Dover" in which a more functional radiator is anticipated.
//MapKeyIO(&Throttle, CHB, Oil_Radiator_Decrease, Radiator_Decrease);
//Three Way switch on the left side of Throttle is setup to control external lights
MapKey(&Throttle, PSF, PULSE+Nav_Lights);
MapKey(&Throttle, PSB, PULSE+Landing_Lights);
//SPDB Switch (Momentary) = Wheel Brakes
MapKey(&Throttle, SPDB, Wheel_Brakes);
MapKey(&Throttle, SPDF, PULSE+Airbrake);
MapKeyR(&Throttle,SPDF, PULSE+Airbrake);
// TRACK RECORD - Bottom Left of throttle base
MapKey(&Throttle, EACON, PULSE+Quick_Start_Save_Track);
MapKeyR(&Throttle, EACON, PULSE+Quick_Start_Save_Track);
//Auto Manual Gear routine for aircraft with Manual Landing gear (I-16, F4F, etc)
MapKey(&Throttle, FLAPD, REXEC(25, 50, "ActKey(KEYON+PULSE+Lower_Gear_Manually);"));
MapKey(&Throttle, FLAPU, REXEC(26, 50, "ActKey(KEYON+PULSE+Raise_Gear_Manually);"));
//EFL Left and Right are setup as engine select switches - current setup is optimized for single and twin engine aircraft
MapKey(&Throttle, EFLNORM, PULSE+Select_Engine_1);
MapKey(&Throttle, EFRNORM, PULSE+Select_Engine_2);
MapKeyIO(&Throttle, EOLMOTOR, PULSE+Magneto2_Eng1_Toggle, PULSE+Magneto1_Eng1_Toggle);
MapKeyIO(&Throttle, EORMOTOR, PULSE+Magneto2_Eng2_Toggle, PULSE+Magneto1_Eng2_Toggle);
MapKey(&Throttle, EFLOVER, PULSE+Select_Unselect_Eng1);
MapKey(&Throttle, EFROVER, PULSE+Select_Unselect_Eng2);
//Engine Operate switches start and stop the ignition
//***MUST FIND BETTER USE OF THIS SWITCH - IN COD PROBABLY CARB HEAT
// MapKey(&Throttle, APUON, PULSE+Boost_WEP_Toggle);
// MapKey(&Throttle, APUOFF, PULSE+Boost_WEP_Toggle);
// MapKeyR(&Throttle, APUOFF, PULSE+Boost_WEP_Toggle);
//LDGH button is Landing Gear
MapKeyIO(&Throttle, LDGH, Emergency_Gear_Toggle, Landing_Gear_Toggle);
//***** NEED TO find some use for RDRNRM swtich
//MapAxis(&Throttle, SCX, 0, AXIS_NORMAL, MAP_ABSOLUTE);
//SetSCurve(&Throttle, SCX, 0, 0, 0, 0, 0);
//MapAxis(&Throttle, SCY, 0, AXIS_NORMAL, MAP_ABSOLUTE);
//SetSCurve(&Throttle, SCY, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_RIGHT, DX_THROTTLE_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_RIGHT, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_LEFT, DX_ZROT_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_LEFT, 0, 0, 0, 0, 0);
MapAxis(&Throttle, THR_FC, DX_SLIDER_AXIS, AXIS_NORMAL, MAP_ABSOLUTE);
SetSCurve(&Throttle, THR_FC, 0, 0, 0, 0, 0);
}
int EventHandle(int type, alias o, int x)
{
DefaultMapping(&o, x);
}