63 #ifndef _XPLMMultiplayer_h_
64 #define _XPLMMultiplayer_h_
75 namespace XPMP2 {
class Aircraft; }
119 #pragma GCC diagnostic push
120 #pragma GCC diagnostic ignored "-Wpedantic"
122 #pragma warning(push)
123 #pragma warning(disable: 4202 4201)
131 unsigned int timeOffset : 16;
133 unsigned int taxiLights : 1;
134 unsigned int landLights : 1;
135 unsigned int bcnLights : 1;
136 unsigned int strbLights : 1;
137 unsigned int navLights : 1;
144 #pragma GCC diagnostic pop
267 #define XPMP_CFG_SEC_MODELS "models"
268 #define XPMP_CFG_SEC_PLANES "planes"
269 #define XPMP_CFG_SEC_SOUND "sound"
270 #define XPMP_CFG_SEC_DEBUG "debug"
276 #define XPMP_CFG_ITM_REPLDATAREFS "replace_datarefs"
277 #define XPMP_CFG_ITM_REPLTEXTURE "replace_texture"
278 #define XPMP_CFG_ITM_CLAMPALL "clamp_all_to_ground"
279 #define XPMP_CFG_ITM_HANDLE_DUP_ID "handle_dup_id"
280 #define XPMP_CFG_ITM_SUPPORT_REMOTE "support_remote"
281 #define XPMP_CFG_ITM_CONTR_MIN_ALT "contrail_min_alt"
282 #define XPMP_CFG_ITM_CONTR_MAX_ALT "contrail_max_alt"
283 #define XPMP_CFG_ITM_CONTR_LIFE "contrail_life_time"
284 #define XPMP_CFG_ITM_CONTR_MULTI "contrail_multiple"
285 #define XPMP_CFG_ITM_ACTIVATE_SOUND "activate_sound"
286 #define XPMP_CFG_ITM_FMOD_INSTANCE "force_fmod_instance"
287 #define XPMP_CFG_ITM_MUTE_ON_PAUSE "mute_on_pause"
288 #define XPMP_CFG_ITM_LOGLEVEL "log_level"
289 #define XPMP_CFG_ITM_MODELMATCHING "model_matching"
328 [[deprecated(
"Use XPMPMultiplayerInit and XPMPLoadCSLPackages")]]
330 const char* inPluginName,
331 const char* resourceDir,
333 const char* inDefaultICAO =
nullptr,
334 const char* inPluginLogAcronym =
nullptr);
345 const char* resourceDir,
347 const char* inDefaultICAO =
nullptr,
348 const char* inPluginLogAcronym =
nullptr);
357 const char* inPluginLogAcronym =
nullptr);
379 [[deprecated(
"Unsupported feature, will always return 'OBJ7 format is no longer supported'")]]
425 const char* filePath,
427 float coneDir = NAN,
float conePitch = NAN,
428 float coneInAngle = NAN,
float coneOutAngle = NAN,
429 float coneOutVol = NAN);
437 const char*
XPMPSoundEnumerate (
const char* prevName,
const char** ppFilePath =
nullptr);
445 #define XP_SOUND_ELECTRIC "Electric"
446 #define XP_SOUND_HIBYPASSJET "HiBypassJet"
447 #define XP_SOUND_LOBYPASSJET "LoBypassJet"
448 #define XP_SOUND_TURBOPROP "Turboprop"
449 #define XP_SOUND_PROP_AIRPLANE "PropAirplane"
450 #define XP_SOUND_PROP_HELI "PropHeli"
451 #define XP_SOUND_REVERSE_THRUST "ReverseThrust"
452 #define XP_SOUND_ROLL_RUNWAY "RollRunway"
453 #define XP_SOUND_FLAP "Flap"
454 #define XP_SOUND_GEAR "Gear"
486 void* _refCon =
nullptr);
531 [[deprecated(
"No longer needed, does not do anything.")]]
552 [[deprecated(
"Unsafe, use XPMPGetModelInfo2() instead.")]]
553 void XPMPGetModelInfo(
int inIndex,
const char **outModelName,
const char **outIcao,
const char **outAirline,
const char **outLivery);
563 void XPMPGetModelInfo2(
int inIndex, std::string& outModelName, std::string& outIcao, std::string& outAirline, std::string& outLivery);
572 const char * inAirline,
573 const char * inLivery);
634 [[deprecated(
"Subclass XPMP2::Aircraft instead")]]
636 const char * inAirline,
637 const char * inLivery,
651 [[deprecated(
"Subclass XPMP2::Aircraft instead")]]
653 const char * inICAOCode,
654 const char * inAirline,
655 const char * inLivery,
662 [[deprecated(
"Delete subclassed XPMP2::Aircraft object instead")]]
679 const char * inICAOCode,
680 const char * inAirline,
681 const char * inLivery);
705 [[deprecated(
"Unsafe pointer operations")]]
718 [[deprecated(
"Unsupported")]]
744 const char* _carIcaoType =
nullptr);
797 [[deprecated(
"Unsupported, will not be called")]]
808 [[deprecated(
"Unsupported, doesn't do anything")]]
815 [[deprecated(
"Unsupported, doesn't do anything")]]
int(* XPMPIntPrefsFuncTy)(const char *_section, const char *_key, int _default)
Definition for the type of configuration callback function.
Definition: XPMPMultiplayer.h:318
void XPMPSetAircraftLabelDist(float _dist_nm, bool _bCutOffAtVisibility=true)
Definition: 2D.cpp:301
bool clampToGround
enables ground-clamping for this aircraft (can be expensive, see XPMP2::Aircraft::bClampToGround)
Definition: XPMPMultiplayer.h:98
@ xpmp_Lights_Pattern_GA
GA: one strobe flash, long beacon (-*-----—*—)
Definition: XPMPMultiplayer.h:113
@ xpmp_Lights_Pattern_EADS
Airbus+EADS: strobe flashes twice (-*-*--—*-*–), short beacon.
Definition: XPMPMultiplayer.h:112
@ xpmp_Lights_Pattern_Default
Jets: one strobe flash, short beacon (-*—*—*—)
Definition: XPMPMultiplayer.h:111
double elevation
current altitude of aircraft [ft above MSL]
Definition: XPMPMultiplayer.h:92
const char * XPMPMultiplayerEnable(void(*_callback)(void *)=nullptr, void *_refCon=nullptr)
Tries to grab control of TCAS targets (formerly known as AI/multiplayer) from X-Plane.
Definition: AIMultiplayer.cpp:1087
XPMPTransponderMode mode
current radar mode, if not xpmpTransponderMode_Standby then is plane considered for TCAS display
Definition: XPMPMultiplayer.h:201
long XPMPCountPlanes(void)
Returns the number of planes in existence.
Definition: XPMPMultiplayer.cpp:487
double lat
current position of aircraft (latitude)
Definition: XPMPMultiplayer.h:90
bool XPMPContrailsAvailable()
Are Contrails available?
Definition: Contrail.cpp:306
float pitch
pitch [degrees, psitive up]
Definition: XPMPMultiplayer.h:93
int XPMPGetPlaneModelName(XPMPPlaneID inPlaneID, char *outTxtBuf, int outTxtBufSize)
Return the name of the model, with which the given plane is rendered.
Definition: XPMPMultiplayer.cpp:437
float engRotRpm
engine rotation speed (rpm)
Definition: XPMPMultiplayer.h:176
XPMPPlaneCallbackResult XPMPGetPlaneData(XPMPPlaneID inPlane, XPMPPlaneDataType inDataType, void *outData)
Unsupported, don't use.
Definition: XPMPMultiplayer.cpp:468
char tailNum[10]
registration, tail number
Definition: XPMPMultiplayer.h:210
float yokePitch
yoke pitch ratio [0..1]
Definition: XPMPMultiplayer.h:165
XPMPPlaneDataType
This enum defines the different categories of aircraft information we can query about.
Definition: XPMPMultiplayer.h:229
@ xpmpDataType_Surfaces
physical appearance in XPMPPlaneSurfaces_t
Definition: XPMPMultiplayer.h:231
@ xpmpDataType_Radar
radar information in XPMPPlaneRadar_t
Definition: XPMPMultiplayer.h:232
@ xpmpDataType_InfoTexts
informational texts in XPMPInfoTexts_t
Definition: XPMPMultiplayer.h:233
@ xpmpDataType_Position
position data in XPMPPlanePosition_t
Definition: XPMPMultiplayer.h:230
float gearPosition
gear position [0..1]
Definition: XPMPMultiplayer.h:158
bool XPMPIsICAOValid(const char *inICAO)
Is inICAO a valid ICAO aircraft type designator?
Definition: XPMPMultiplayer.cpp:342
void XPMPSoundSetMasterVolume(float fVol=1.0f)
Set Master Volume.
Definition: Sound.cpp:1089
void XPMPRegisterPlaneNotifierFunc(XPMPPlaneNotifier_f inFunc, void *inRefcon)
Registers a callback, which is called when one of the events defined in XPMPPlaneNotification happens...
Definition: XPMPMultiplayer.cpp:537
const char * XPMPMultiplayerInit(const char *inPluginName, const char *resourceDir, XPMPIntPrefsFuncTy inIntPrefsFunc=nullptr, const char *inDefaultICAO=nullptr, const char *inPluginLogAcronym=nullptr)
Initializes the XPMP2 library. This shall be your first call to the library.
Definition: XPMPMultiplayer.cpp:129
char label[32]
label to show with the aircraft
Definition: XPMPMultiplayer.h:96
constexpr XPMPPlaneID MIN_MODE_S_ID
Minimum allowed XPMPPlaneID / mode S id.
Definition: XPMPMultiplayer.h:255
const char * XPMPSoundAdd(const char *sName, const char *filePath, bool bLoop, float coneDir=NAN, float conePitch=NAN, float coneInAngle=NAN, float coneOutAngle=NAN, float coneOutVol=NAN)
Add a sound that can later be referenced from an XPMP2::Aircraft.
Definition: Sound.cpp:1105
bool touchDown
just now is moment of touch down?
Definition: XPMPMultiplayer.h:181
void(* XPMPRenderPlanes_f)(int inIsBlend, void *inRef)
The original libxplanemp allowed to override rendering; no longer supported.
Definition: XPMPMultiplayer.h:798
int XPMPModelMatchQuality(const char *inICAO, const char *inAirline, const char *inLivery)
Tests model match quality based on the given parameters.
Definition: XPMPMultiplayer.cpp:330
void XPMPGetPlaneICAOAndLivery(XPMPPlaneID inPlane, char *outICAOCode, char *outLivery)
Returns ICAO aircraft type designator and livery of the given plane.
Definition: XPMPMultiplayer.cpp:455
char aptFrom[5]
Origin airport (ICAO)
Definition: XPMPMultiplayer.h:217
long code
current radar code, published via dataRef sim/cockpit2/tcas/targets/modeC_code
Definition: XPMPMultiplayer.h:200
float tireRotRpm
tire rotation speed (rpm)
Definition: XPMPMultiplayer.h:173
float heading
heading [degrees]
Definition: XPMPMultiplayer.h:95
float yokeRoll
yoke roll ratio [0..1]
Definition: XPMPMultiplayer.h:167
char airline[40]
airline, human readable
Definition: XPMPMultiplayer.h:215
long size
structure size
Definition: XPMPMultiplayer.h:199
float flapRatio
flap extension ratio [0..1]
Definition: XPMPMultiplayer.h:159
constexpr XPMPPlaneID MAX_MODE_S_ID
Maximum allowed XPMPPlaneID / mode S id.
Definition: XPMPMultiplayer.h:257
void XPMPSoundMute(bool bMute)
Mute all sounds (temporarily)
Definition: Sound.cpp:1097
XPMPPlaneID XPMPGetNthPlane(long index)
Returns the plane ID of the Nth plane.
Definition: XPMPMultiplayer.cpp:493
char flightNum[10]
flight number
Definition: XPMPMultiplayer.h:216
char manufacturer[40]
a/c manufacturer, human readable
Definition: XPMPMultiplayer.h:212
float label_color[4]
label base color (RGB), defaults to yellow
Definition: XPMPMultiplayer.h:100
int aiPrio
Priority for AI/TCAS consideration, the lower the earlier.
Definition: XPMPMultiplayer.h:99
void XPMPUnregisterPlaneNotifierFunc(XPMPPlaneNotifier_f inFunc, void *inRefcon)
Unregisters a notification callback. Both function pointer and refcon must match what was registered.
Definition: XPMPMultiplayer.cpp:557
char model[40]
a/c model, human readable
Definition: XPMPMultiplayer.h:213
xpmp_LightStatus lights
status of lights
Definition: XPMPMultiplayer.h:169
float engRotDegree
engine rotation angle (degrees 0..360)
Definition: XPMPMultiplayer.h:175
float reversRatio
thrust reversers ratio
Definition: XPMPMultiplayer.h:179
const char * XPMPSoundEnumerate(const char *prevName, const char **ppFilePath=nullptr)
Enumerate all sounds, including the internal ones.
Definition: Sound.cpp:1131
XPMPPlaneCallbackResult(* XPMPPlaneData_f)(XPMPPlaneID inPlane, XPMPPlaneDataType inDataType, void *ioData, void *inRefcon)
Callback function your plugin provides to return updated plane data.
Definition: XPMPMultiplayer.h:616
void XPMPDisableAircraftLabels()
Disable drawing of labels with the aircraft.
Definition: 2D.cpp:290
void XPMPEnableMap(bool _bEnable, bool _bLabels=true)
Enable or disable the drawing of aircraft icons on X-Plane's map.
Definition: Map.cpp:397
float offsetScale
how much of the surface contact correction offset should be applied [0..1]
Definition: XPMPMultiplayer.h:97
bool XPMPHasControlOfAIAircraft()
Has XPMP2 control of TCAS targets?
Definition: AIMultiplayer.cpp:1210
int XPMPChangePlaneModel(XPMPPlaneID inPlaneID, const char *inICAOCode, const char *inAirline, const char *inLivery)
Perform model matching again and change the CSL model to the resulting match.
Definition: XPMPMultiplayer.cpp:422
XPMPPlaneCallbackResult
Definfes the different responses to asking for information.
Definition: XPMPMultiplayer.h:240
@ xpmpData_Unchanged
Definition: XPMPMultiplayer.h:242
@ xpmpData_Unavailable
Definition: XPMPMultiplayer.h:241
@ xpmpData_NewData
Definition: XPMPMultiplayer.h:243
XPMPPlaneID XPMPCreatePlane(const char *inICAOCode, const char *inAirline, const char *inLivery, XPMPPlaneData_f inDataFunc, void *inRefcon, XPMPPlaneID inModeS_id=0)
Creates a new plane.
Definition: XPMPMultiplayer.cpp:353
char icaoAcType[5]
ICAO aircraft type designator, 3-4 chars.
Definition: XPMPMultiplayer.h:211
XPMPPlaneNotification
Events that trigger a notification callback.
Definition: XPMPMultiplayer.h:754
@ xpmp_PlaneNotification_Destroyed
a plane is about to be destroyed
Definition: XPMPMultiplayer.h:757
@ xpmp_PlaneNotification_ModelChanged
a plane's model changed
Definition: XPMPMultiplayer.h:756
@ xpmp_PlaneNotification_Created
a plane was just created
Definition: XPMPMultiplayer.h:755
unsigned int XPMPLightsPattern
Light flash pattern (unused in XPMP2)
Definition: XPMPMultiplayer.h:115
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition: XPMPMultiplayer.h:252
const char * XPMPMultiplayerInitLegacyData(const char *inCSLFolder, const char *inPluginName, const char *resourceDir, XPMPIntPrefsFuncTy inIntPrefsFunc=nullptr, const char *inDefaultICAO=nullptr, const char *inPluginLogAcronym=nullptr)
Deprecated legacy initialization of XPMP2.
Definition: XPMPMultiplayer.cpp:105
bool XPMPSoundIsEnabled()
Is Sound enabled?
Definition: Sound.cpp:1083
long size
structure size
Definition: XPMPMultiplayer.h:209
long size
size of structure
Definition: XPMPMultiplayer.h:89
const char * XPMPMultiplayerOBJ7SupportEnable(const char *inTexturePath)
Used to set the light textures for old OBJ7 models.
Definition: XPMPMultiplayer.cpp:234
const char * XPMPLoadCSLPackage(const char *inCSLFolder)
Loads CSL packages from the given folder, searching up to 5 folder levels deep.
Definition: XPMPMultiplayer.cpp:244
float spoilerRatio
spoiler extension ratio [0..1]
Definition: XPMPMultiplayer.h:160
float yokeHeading
yoke heading ratio [0..1]
Definition: XPMPMultiplayer.h:166
void XPMPDestroyPlane(XPMPPlaneID _id)
[Deprecated] Removes a plane previously created with XPMPCreatePlane()
Definition: XPMPMultiplayer.cpp:406
void XPMPSetPlaneVisibility(XPMPPlaneID _id, bool _bVisible)
Show/Hide the aircraft temporarily without destroying the object.
Definition: XPMPMultiplayer.cpp:414
void XPMPSetDefaultPlaneICAO(const char *_acIcaoType, const char *_carIcaoType=nullptr)
Define default aircraft and ground vehicle ICAO types.
Definition: XPMPMultiplayer.cpp:511
unsigned int lightFlags
this defaults to taxi | beacon | nav lights on
Definition: XPMPMultiplayer.h:129
float wingSweep
wing sweep ratio [0..1]
Definition: XPMPMultiplayer.h:163
float propRotDegree
prop rotation angle (degrees 0..360)
Definition: XPMPMultiplayer.h:177
XPMP2::Aircraft * XPMPGetAircraft(XPMPPlaneID _id)
Returns the underlying aircraft object, or nullptr if _id is invalid.
Definition: XPMPMultiplayer.cpp:504
float propRotRpm
prop rotation speed (rpm)
Definition: XPMPMultiplayer.h:178
char icaoAirline[4]
ICAO airline code.
Definition: XPMPMultiplayer.h:214
XPMPPlaneID XPMPCreatePlaneWithModelName(const char *inModelName, const char *inICAOCode, const char *inAirline, const char *inLivery, XPMPPlaneData_f inDataFunc, void *inRefcon, XPMPPlaneID inModeS_id=0)
Creates a new plane, providing a specific CSL model name.
Definition: XPMPMultiplayer.cpp:371
void XPMPGetModelInfo2(int inIndex, std::string &outModelName, std::string &outIcao, std::string &outAirline, std::string &outLivery)
Fetch information about a CSL model identified by an index.
Definition: XPMPMultiplayer.cpp:298
double lon
current position of aircraft (longitude)
Definition: XPMPMultiplayer.h:91
bool XPMPContrailsAutoEnabled()
Are automatic Contrails enabled?
Definition: Contrail.cpp:299
float tireDeflect
tire deflection (meters)
Definition: XPMPMultiplayer.h:171
float thrust
thrust ratio [0..1]
Definition: XPMPMultiplayer.h:164
void XPMPSetPluginName(const char *inPluginName, const char *inPluginLogAcronym=nullptr)
Overrides the plugin's name to be used in Log output.
Definition: XPMPMultiplayer.cpp:207
XPMPTransponderMode
These enumerations define the way the transponder of a given plane is operating.
Definition: XPMPMultiplayer.h:188
@ xpmpTransponderMode_ModeC
transponder is on
Definition: XPMPMultiplayer.h:191
@ xpmpTransponderMode_Mode3A
transponder is on
Definition: XPMPMultiplayer.h:190
@ xpmpTransponderMode_ModeC_Ident
transponder is on
Definition: XPMPMultiplayer.h:193
@ xpmpTransponderMode_ModeC_Low
transponder is on
Definition: XPMPMultiplayer.h:192
@ xpmpTransponderMode_Standby
transponder is in standby, not currently sending -> aircraft not visible on TCAS
Definition: XPMPMultiplayer.h:189
float speedBrakeRatio
speed brake extension ratio [0..1]
Definition: XPMPMultiplayer.h:161
void XPMPMultiplayerCleanup()
Clean up the multiplayer library.
Definition: XPMPMultiplayer.cpp:216
int multiIdx
OUT: set by XPMP2 to inform application about TCAS target index in use [1..63], with [1....
Definition: XPMPMultiplayer.h:101
void(* XPMPPlaneNotifier_f)(XPMPPlaneID inPlaneID, XPMPPlaneNotification inNotification, void *inRefcon)
Type of the callback function you provide, called when one of the events defined in XPMPPlaneNotifica...
Definition: XPMPMultiplayer.h:766
void XPMPDumpOneCycle(void)
Legacy debug-support function, no longer supported.
Definition: XPMPMultiplayer.cpp:593
float roll
roll [degrees, positive right]
Definition: XPMPMultiplayer.h:94
float tireRotDegree
tire rotation angle (degrees 0..360)
Definition: XPMPMultiplayer.h:172
int XPMPGetNumberOfInstalledModels()
Returns the number of loaded CSL models.
Definition: XPMPMultiplayer.cpp:260
void XPMPMultiplayerDisable()
Release TCAS targets control.
Definition: AIMultiplayer.cpp:1175
void XPMPGetModelInfo(int inIndex, const char **outModelName, const char **outIcao, const char **outAirline, const char **outLivery)
Fetch information about a CSL model identified by an index.
Definition: XPMPMultiplayer.cpp:266
bool XPMPSoundEnable(bool bEnable=true)
Enable/Disable Sound.
Definition: Sound.cpp:1068
bool XPMPDrawingAircraftLabels()
Returns if labels are currently configured to be drawn.
Definition: 2D.cpp:295
size_t XPMPAddModelDataRef(const std::string &dataRef)
Add a user-defined dataRef to the list of dataRefs supported by every plane.
Definition: Aircraft.cpp:1141
float slatRatio
slats extension ratio [0..1]
Definition: XPMPMultiplayer.h:162
int XPMPGetPlaneModelQuality(XPMPPlaneID inPlane)
Returns the match quality of the currently used model, or -1 if inPlane is invalid.
Definition: XPMPMultiplayer.cpp:477
void XPMPSetPlaneRenderer(XPMPRenderPlanes_f inRenderer, void *inRef)
The original libxplanemp allowed to override rendering; no longer supported.
Definition: XPMPMultiplayer.cpp:588
long size
structure size
Definition: XPMPMultiplayer.h:157
void XPMPLoadPlanesIfNecessary()
Legacy function only provided for backwards compatibility. Does not actually do anything.
Definition: XPMPMultiplayer.cpp:256
char aptTo[5]
Destination airport (ICAO)
Definition: XPMPMultiplayer.h:218
void XPMPEnableAircraftLabels(bool _enable=true)
Enable or disable drawing of labels with the aircraft.
Definition: 2D.cpp:261
Textual information of planes to be passed on via shared dataRefs to other plugins.
Definition: XPMPMultiplayer.h:208
This data structure contains the basic position info for an aircraft.
Definition: XPMPMultiplayer.h:88
defines information about an aircraft visible to radar.
Definition: XPMPMultiplayer.h:198
External physical configuration of the plane.
Definition: XPMPMultiplayer.h:156
Defines, which lights of the aircraft are on.
Definition: XPMPMultiplayer.h:128
Actual representation of all aircraft in XPMP2.
Definition: XPMPAircraft.h:178
Definition: XPMPAircraft.h:70