63#ifndef _XPLMMultiplayer_h_
64#define _XPLMMultiplayer_h_
74#pragma warning(disable: 4251 4275)
82namespace XPMP2 {
class Aircraft; }
99 double elevation = 0.0;
102 float heading = 0.0f;
104 float offsetScale = 1.0f;
105 bool clampToGround =
false;
107 float label_color[4] = {1.0f,1.0f,0.0f,1.0f};
126#pragma GCC diagnostic push
127#pragma GCC diagnostic ignored "-Wpedantic"
130#pragma warning(disable: 4202 4201)
136 unsigned int lightFlags = 0x150000;
138 unsigned int timeOffset : 16;
140 unsigned int taxiLights : 1;
141 unsigned int landLights : 1;
142 unsigned int bcnLights : 1;
143 unsigned int strbLights : 1;
144 unsigned int navLights : 1;
151#pragma GCC diagnostic pop
165 float gearPosition = 0.0f;
166 float flapRatio = 0.0f;
167 float spoilerRatio = 0.0f;
168 float speedBrakeRatio = 0.0f;
169 float slatRatio = 0.0f;
170 float wingSweep = 0.0f;
172 float yokePitch = 0.0f;
173 float yokeHeading = 0.0f;
174 float yokeRoll = 0.0f;
178 float tireDeflect = 0.0f;
179 float tireRotDegree = 0.0f;
180 float tireRotRpm = 0.0f;
182 float engRotDegree = 0.0f;
183 float engRotRpm = 0.0f;
184 float propRotDegree = 0.0f;
185 float propRotRpm = 0.0f;
186 float reversRatio = 0.0f;
188 bool touchDown =
false;
198enum XPMPTransponderMode {
199 xpmpTransponderMode_Off = 0,
200 xpmpTransponderMode_Standby,
201 xpmpTransponderMode_ModeA,
202 xpmpTransponderMode_ModeC,
203 xpmpTransponderMode_Test,
204 xpmpTransponderMode_ModeS_Gnd,
205 xpmpTransponderMode_ModeS_TAOnly,
206 xpmpTransponderMode_ModeS_TARA,
212 long size =
sizeof(XPMPPlaneRadar_t);
214 XPMPTransponderMode mode = xpmpTransponderMode_ModeC;
215 const char* GetModeStr()
const;
223 long size =
sizeof(XPMPInfoTexts_t);
224 char tailNum[10] = {0};
225 char icaoAcType[5] = {0};
226 char manufacturer[40] = {0};
227 char model[40] = {0};
228 char icaoAirline[4] = {0};
229 char airline[40] = {0};
230 char flightNum [10] = {0};
231 char aptFrom [5] = {0};
232 char aptTo [5] = {0};
243enum XPMPPlaneDataType {
244 xpmpDataType_Position = 1L << 1,
245 xpmpDataType_Surfaces = 1L << 2,
246 xpmpDataType_Radar = 1L << 3,
247 xpmpDataType_InfoTexts = 1L << 4,
254enum XPMPPlaneCallbackResult {
255 xpmpData_Unavailable = 0,
281#define XPMP_CFG_SEC_MODELS "models"
282#define XPMP_CFG_SEC_PLANES "planes"
283#define XPMP_CFG_SEC_SOUND "sound"
284#define XPMP_CFG_SEC_DEBUG "debug"
290#define XPMP_CFG_ITM_REPLDATAREFS "replace_datarefs"
291#define XPMP_CFG_ITM_REPLTEXTURE "replace_texture"
292#define XPMP_CFG_ITM_CLAMPALL "clamp_all_to_ground"
293#define XPMP_CFG_ITM_HANDLE_DUP_ID "handle_dup_id"
294#define XPMP_CFG_ITM_SUPPORT_REMOTE "support_remote"
295#define XPMP_CFG_ITM_CONTR_MIN_ALT "contrail_min_alt"
296#define XPMP_CFG_ITM_CONTR_MAX_ALT "contrail_max_alt"
297#define XPMP_CFG_ITM_CONTR_LIFE "contrail_life_time"
298#define XPMP_CFG_ITM_CONTR_MULTI "contrail_multiple"
299#define XPMP_CFG_ITM_ACTIVATE_SOUND "activate_sound"
300#define XPMP_CFG_ITM_FMOD_INSTANCE "force_fmod_instance"
301#define XPMP_CFG_ITM_MUTE_ON_PAUSE "mute_on_pause"
302#define XPMP_CFG_ITM_LOGLEVEL "log_level"
303#define XPMP_CFG_ITM_MODELMATCHING "model_matching"
342[[deprecated(
"Use XPMPMultiplayerInit and XPMPLoadCSLPackages")]]
344 const char* inPluginName,
345 const char* resourceDir,
347 const char* inDefaultICAO =
nullptr,
348 const char* inPluginLogAcronym =
nullptr);
359 const char* resourceDir,
361 const char* inDefaultICAO =
nullptr,
362 const char* inPluginLogAcronym =
nullptr);
371 const char* inPluginLogAcronym =
nullptr);
393[[deprecated(
"Unsupported feature, will always return 'OBJ7 format is no longer supported'")]]
439 const char* filePath,
441 float coneDir = NAN,
float conePitch = NAN,
442 float coneInAngle = NAN,
float coneOutAngle = NAN,
443 float coneOutVol = NAN);
480#define XP_SOUND_ELECTRIC "Electric"
481#define XP_SOUND_HIBYPASSJET "HiBypassJet"
482#define XP_SOUND_LOBYPASSJET "LoBypassJet"
483#define XP_SOUND_TURBOPROP "Turboprop"
484#define XP_SOUND_PROP_AIRPLANE "PropAirplane"
485#define XP_SOUND_PROP_HELI "PropHeli"
486#define XP_SOUND_REVERSE_THRUST "ReverseThrust"
487#define XP_SOUND_ROLL_RUNWAY "RollRunway"
488#define XP_SOUND_FLAP "Flap"
489#define XP_SOUND_GEAR "Gear"
521 void* _refCon =
nullptr);
566[[deprecated(
"No longer needed, does not do anything.")]]
587[[deprecated(
"Unsafe, use XPMPGetModelInfo2() instead.")]]
588XPMP2_EXPORT void XPMPGetModelInfo(
int inIndex,
const char **outModelName,
const char **outIcao,
const char **outAirline,
const char **outLivery);
598XPMP2_EXPORT void XPMPGetModelInfo2(
int inIndex, std::string& outModelName, std::string& outIcao, std::string& outAirline, std::string& outLivery);
607 const char * inAirline,
608 const char * inLivery);
652 XPMPPlaneDataType inDataType,
669[[deprecated(
"Subclass XPMP2::Aircraft instead")]]
671 const char * inAirline,
672 const char * inLivery,
686[[deprecated(
"Subclass XPMP2::Aircraft instead")]]
688 const char * inICAOCode,
689 const char * inAirline,
690 const char * inLivery,
697[[deprecated(
"Delete subclassed XPMP2::Aircraft object instead")]]
714 const char * inICAOCode,
715 const char * inAirline,
716 const char * inLivery);
740[[deprecated(
"Unsafe pointer operations")]]
753[[deprecated(
"Unsupported")]]
755 XPMPPlaneDataType inDataType,
779 const char* _carIcaoType =
nullptr);
832[[deprecated(
"Unsupported, will not be called")]]
843[[deprecated(
"Unsupported, doesn't do anything")]]
850[[deprecated(
"Unsupported, doesn't do anything")]]
size_t XPMPAddModelDataRef(const std::string &dataRef)
Definition Aircraft.cpp:1141
Macro definitions to support building/using a Windows DLL.
#define XPMP2_EXPORT
Definition XPMPExport.h:51
bool XPMPIsICAOValid(const char *inICAO)
Definition XPMPMultiplayer.cpp:365
int XPMPModelMatchQuality(const char *inICAO, const char *inAirline, const char *inLivery)
Definition XPMPMultiplayer.cpp:353
void XPMPGetModelInfo2(int inIndex, std::string &outModelName, std::string &outIcao, std::string &outAirline, std::string &outLivery)
Definition XPMPMultiplayer.cpp:321
int(* XPMPIntPrefsFuncTy)(const char *_section, const char *_key, int _default)
Definition for the type of configuration callback function.
Definition XPMPMultiplayer.h:332
@ xpmp_Lights_Pattern_GA
GA: one strobe flash, long beacon (-*-----—*—)
Definition XPMPMultiplayer.h:120
@ xpmp_Lights_Pattern_EADS
Airbus+EADS: strobe flashes twice (-*-*--—*-*–), short beacon.
Definition XPMPMultiplayer.h:119
@ xpmp_Lights_Pattern_Default
Jets: one strobe flash, short beacon (-*—*—*—)
Definition XPMPMultiplayer.h:118
XPMP2_EXPORT XPMP2::Aircraft * XPMPGetAircraft(XPMPPlaneID _id)
Returns the underlying aircraft object, or nullptr if _id is invalid */.
Definition XPMPMultiplayer.cpp:527
XPMP2_EXPORT bool XPMPContrailsAvailable()
Are Contrails available?
Definition Contrail.cpp:306
XPMP2_EXPORT 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:394
XPMPPlaneCallbackResult XPMPGetPlaneData(XPMPPlaneID inPlane, XPMPPlaneDataType inDataType, void *outData)
Unsupported, don't use.
Definition XPMPMultiplayer.cpp:491
XPMP2_EXPORT bool XPMPSoundSetAudioDevice(int i)
Set the sound output device if using a separate FMOD instance.
Definition Sound.cpp:1203
XPMP2_EXPORT bool XPMPSoundIsEnabled()
Is Sound enabled?
Definition Sound.cpp:1126
XPMP2_EXPORT void XPMPSoundMute(bool bMute)
Mute all sounds (temporarily)
Definition Sound.cpp:1140
XPMP2_EXPORT 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:445
constexpr XPMPPlaneID MIN_MODE_S_ID
Minimum allowed XPMPPlaneID / mode S id.
Definition XPMPMultiplayer.h:269
XPMP2_EXPORT bool XPMPSoundGetAudioDeviceName(int i, std::string &devName)
List all possible audio devices if using separate FMOD instance.
Definition Sound.cpp:1185
void(* XPMPRenderPlanes_f)(int inIsBlend, void *inRef)
The original libxplanemp allowed to override rendering; no longer supported.
Definition XPMPMultiplayer.h:833
XPMP2_EXPORT bool XPMPDrawingAircraftLabels()
Returns if labels are currently configured to be drawn.
Definition 2D.cpp:305
XPMP2_EXPORT void XPMPSetDefaultPlaneICAO(const char *_acIcaoType, const char *_carIcaoType=nullptr)
Define default aircraft and ground vehicle ICAO types.
Definition XPMPMultiplayer.cpp:534
XPMP2_EXPORT 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:1101
void XPMPGetPlaneICAOAndLivery(XPMPPlaneID inPlane, char *outICAOCode, char *outLivery)
Returns ICAO aircraft type designator and livery of the given plane.
Definition XPMPMultiplayer.cpp:478
XPMP2_EXPORT void XPMPDisableAircraftLabels()
Disable drawing of labels with the aircraft.
Definition 2D.cpp:300
XPMP2_EXPORT const char * XPMPSoundEnumerate(const char *prevName, const char **ppFilePath=nullptr)
Enumerate all sounds, including the internal ones.
Definition Sound.cpp:1174
XPMP2_EXPORT const char * XPMPLoadCSLPackage(const char *inCSLFolder)
Loads CSL packages from the given folder, searching up to 5 folder levels deep.
Definition XPMPMultiplayer.cpp:267
XPMP2_EXPORT 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:122
constexpr XPMPPlaneID MAX_MODE_S_ID
Maximum allowed XPMPPlaneID / mode S id.
Definition XPMPMultiplayer.h:271
const char * XPMPMultiplayerOBJ7SupportEnable(const char *inTexturePath)
Used to set the light textures for old OBJ7 models.
Definition XPMPMultiplayer.cpp:257
XPMP2_EXPORT bool XPMPContrailsAutoEnabled()
Are automatic Contrails enabled?
Definition Contrail.cpp:299
XPMP2_EXPORT bool XPMPSoundEnable(bool bEnable=true)
Enable/Disable Sound.
Definition Sound.cpp:1111
XPMP2_EXPORT int XPMPGetPlaneModelQuality(XPMPPlaneID inPlane)
Returns the match quality of the currently used model, or -1 if inPlane is invalid.
Definition XPMPMultiplayer.cpp:500
xpmp_LightStatus lights
status of lights
Definition XPMPMultiplayer.h:176
XPMPPlaneCallbackResult(* XPMPPlaneData_f)(XPMPPlaneID inPlane, XPMPPlaneDataType inDataType, void *ioData, void *inRefcon)
Callback function your plugin provides to return updated plane data.
Definition XPMPMultiplayer.h:651
XPMP2_EXPORT void XPMPSetAircraftLabelDist(float _dist_nm, bool _bCutOffAtVisibility=true)
Definition 2D.cpp:311
XPMP2_EXPORT void XPMPUnregisterPlaneNotifierFunc(XPMPPlaneNotifier_f inFunc, void *inRefcon)
Unregisters a notification callback. Both function pointer and refcon must match what was registered.
Definition XPMPMultiplayer.cpp:580
XPMP2_EXPORT void XPMPSoundSetMasterVolume(float fVol=1.0f)
Set Master Volume.
Definition Sound.cpp:1132
XPMPPlaneNotification
Events that trigger a notification callback.
Definition XPMPMultiplayer.h:789
@ xpmp_PlaneNotification_Destroyed
a plane is about to be destroyed
Definition XPMPMultiplayer.h:792
@ xpmp_PlaneNotification_ModelChanged
a plane's model changed
Definition XPMPMultiplayer.h:791
@ xpmp_PlaneNotification_Created
a plane was just created
Definition XPMPMultiplayer.h:790
unsigned int XPMPLightsPattern
Light flash pattern (unused in XPMP2)
Definition XPMPMultiplayer.h:122
unsigned XPMPPlaneID
Unique ID for an aircraft created by a plugin.
Definition XPMPMultiplayer.h:266
XPMP2_EXPORT bool XPMPSoundSetAudioDeviceName(const std::string &deviceName)
Set the sound output device if using a separate FMOD instance.
Definition Sound.cpp:1193
XPMP2_EXPORT void XPMPEnableMap(bool _bEnable, bool _bLabels=true)
Enable or disable the drawing of aircraft icons on X-Plane's map.
Definition Map.cpp:397
XPMP2_EXPORT long XPMPCountPlanes(void)
Returns the number of planes in existence.
Definition XPMPMultiplayer.cpp:510
XPMP2_EXPORT XPMPPlaneID XPMPGetNthPlane(long index)
Returns the plane ID of the Nth plane.
Definition XPMPMultiplayer.cpp:516
XPMP2_EXPORT 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:376
xpmpData_Unchanged
These enumerations define the way the transponder of a given plane is operating.
Definition XPMPMultiplayer.h:256
XPMP2_EXPORT 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:146
XPMP2_EXPORT void XPMPSetPlaneVisibility(XPMPPlaneID _id, bool _bVisible)
Show/Hide the aircraft temporarily without destroying the object.
Definition XPMPMultiplayer.cpp:437
xpmpData_NewData
Definition XPMPMultiplayer.h:257
XPMP2_EXPORT 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:560
XPMP2_EXPORT int XPMPSoundGetActiveAudioDevice(std::string *pDevName=nullptr)
Returns the index and name of the active audio device.
Definition Sound.cpp:1211
XPMP2_EXPORT void XPMPMultiplayerCleanup()
Clean up the multiplayer library.
Definition XPMPMultiplayer.cpp:239
XPMP2_EXPORT int XPMPGetPlaneModelName(XPMPPlaneID inPlaneID, char *outTxtBuf, int outTxtBufSize)
Return the name of the model, with which the given plane is rendered.
Definition XPMPMultiplayer.cpp:460
*param[out] outModelName Receives pointer to model can be nullptr *param[out] outIcao Receives pointer to ICAO aircraft type designator can be nullptr *param[out] outAirline Receives pointer to ICAO airline code can be nullptr *param[out] outLivery Receives pointer to special livery string can be nullptr *XPMP2_EXPORT void XPMPGetModelInfo(int inIndex, const char **outModelName, const char **outIcao, const char **outAirline, const char **outLivery)
Definition XPMPMultiplayer.cpp:289
XPMP2_EXPORT void XPMPEnableAircraftLabels(bool _enable=true)
Enable or disable drawing of labels with the aircraft.
Definition 2D.cpp:271
XPMP2_EXPORT bool XPMPHasControlOfAIAircraft()
Has XPMP2 control of TCAS targets?
Definition AIMultiplayer.cpp:1224
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:801
void XPMPDumpOneCycle(void)
Legacy debug-support function, no longer supported.
Definition XPMPMultiplayer.cpp:616
XPMP2_EXPORT void XPMPSetPluginName(const char *inPluginName, const char *inPluginLogAcronym=nullptr)
Overrides the plugin's name to be used in Log output.
Definition XPMPMultiplayer.cpp:230
XPMP2_EXPORT 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:1148
void XPMPSetPlaneRenderer(XPMPRenderPlanes_f inRenderer, void *inRef)
The original libxplanemp allowed to override rendering; no longer supported.
Definition XPMPMultiplayer.cpp:611
XPMP2_EXPORT void XPMPDestroyPlane(XPMPPlaneID _id)
[Deprecated] Removes a plane previously created with XPMPCreatePlane()
Definition XPMPMultiplayer.cpp:429
void XPMPLoadPlanesIfNecessary()
Legacy function only provided for backwards compatibility. Does not actually do anything.
Definition XPMPMultiplayer.cpp:279
XPMP2_EXPORT int XPMPGetNumberOfInstalledModels()
Returns the number of loaded CSL models.
Definition XPMPMultiplayer.cpp:283
XPMP2_EXPORT void XPMPMultiplayerDisable()
Release TCAS targets control.
Definition AIMultiplayer.cpp:1189
This data structure contains the basic position info for an aircraft.
Definition XPMPMultiplayer.h:95
External physical configuration of the plane.
Definition XPMPMultiplayer.h:163
Defines, which lights of the aircraft are on.
Definition XPMPMultiplayer.h:135
Actual representation of all aircraft in XPMP2.
Definition XPMPAircraft.h:184
Definition XPMPAircraft.h:76