Skip to content

Instantly share code, notes, and snippets.

@macaba
Created January 13, 2017 10:03
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save macaba/fba13e49a9a406dc0e44b4564599fb61 to your computer and use it in GitHub Desktop.
Save macaba/fba13e49a9a406dc0e44b4564599fb61 to your computer and use it in GitHub Desktop.
//Available PSX variables:
public bool OutboardLandingL;
public bool OutboardLandingR;
public bool InboardLandingL;
public bool InboardLandingR;
public bool RunwayTurnoffL;
public bool RunwayTurnoffR;
public bool Taxi;
public bool BeaconUpper;
public bool BeaconLower;
public bool NavL;
public bool NavR;
public bool Strobe;
public bool Wing;
public bool Logo;
//Method that converts the PSX variables into the simconnect lighting bitmask.
//You'll observe that it is far from a simple 1:1 mapping.
public UInt16 SimconnectBitMask()
{
const UInt16 navMask = 0x0001;
const UInt16 beaconMask = 0x0002;
const UInt16 landingMask = 0x0004;
const UInt16 taxiMask = 0x0008;
const UInt16 strobeMask = 0x0010;
const UInt16 panelMask = 0x0020;
const UInt16 recognitionMask = 0x0040;
const UInt16 wingMask = 0x0080;
const UInt16 logoMask = 0x0100;
const UInt16 cabinMask = 0x0200;
UInt16 mask = 0;
if (NavL && NavR)
mask |= navMask;
if (BeaconLower && BeaconUpper)
mask |= beaconMask;
if ((OutboardLandingL && OutboardLandingR) || (InboardLandingL && InboardLandingR))
mask |= landingMask;
if (Taxi)
mask |= taxiMask;
if (Strobe)
mask |= strobeMask;
if (Logo)
mask |= panelMask;
if (Logo)
mask |= recognitionMask;
if (Wing)
mask |= wingMask;
if (Logo)
mask |= logoMask;
if (Logo)
mask |= cabinMask;
return mask;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment