Commit MetaInfo

Revision2783da92d53371f0712df25e3abe9486e2fcd493 (tree)
Time2008-09-03 03:02:30
Authorface__
Commiterface__

Log Message

[svn r37] Fixed GetClassNameA issue.

Change Summary

Incremental Difference

diff -r 975d62cbb663 -r 2783da92d533 Orbitersdk/include/OrbiterAPI.h
--- /dev/null Thu Jan 01 00:00:00 1970 +0000
+++ b/Orbitersdk/include/OrbiterAPI.h Tue Sep 02 20:02:30 2008 +0200
@@ -0,0 +1,1475 @@
1+// ======================================================================
2+// ORBITER SOFTWARE DEVELOPMENT KIT
3+// Copyright (C) 2001-2006 Martin Schweiger
4+// All rights reserved
5+// OrbiterAPI.h
6+// ORBITER Application Programming Interface (OAPI)
7+// ======================================================================
8+
9+#ifndef __ORBITERAPI_H
10+#define __ORBITERAPI_H
11+
12+#if defined(_MSC_VER) && (_MSC_VER >= 1300 ) // Microsoft Visual Studio Version 2003 and higher
13+#define _CRT_SECURE_NO_DEPRECATE
14+#include <fstream>
15+#else // older MSVC++ versions
16+#include <fstream.h>
17+#endif
18+#include <windows.h>
19+#include <float.h>
20+#include <math.h>
21+#if defined(_MSC_VER) && (_MSC_VER >= 1400 ) && defined(__cplusplus_cli) // Microsoft Visual Studio Version 2005 and higher while compiling C++/CLI
22+#undef GetClassName
23+#define GetClassName GetClassNameA
24+#endif
25+
26+// Assumes MS VC++ compiler. Modify these statements for other compilers
27+#define DLLEXPORT __declspec(dllexport)
28+#define DLLIMPORT __declspec(dllimport)
29+#define DLLCLBK extern "C" __declspec(dllexport)
30+
31+#ifdef OAPI_IMPLEMENTATION
32+#define OAPIFUNC DLLEXPORT
33+#else
34+#define OAPIFUNC DLLIMPORT
35+#endif
36+
37+// ======================================================================
38+// Some useful constants
39+// ======================================================================
40+
41+const double PI = 3.14159265358979;
42+const double PI05 = 1.57079632679490;
43+const double RAD = PI/180.0;
44+const double DEG = 180.0/PI;
45+const double C0 = 299792458.0; // speed of light in vacuum [m/s]
46+const double TAUA = 499.004783806; // light time for 1 AU [s]
47+const double AU = C0*TAUA; // astronomical unit (mean geocentric distance of the sun) [m]
48+const double GGRAV = 6.67259e-11; // gravitational constant [m^3 kg^-1 s^-2]
49+const double G = 9.81; // gravitational acceleration [m/s^2] at Earth mean radius
50+const double ATMP = 101.4e3; // atmospheric pressure [Pa] at Earth sea level
51+const double ATMD = 1.293; // atmospheric density [kg/m^3] at Earth sea level
52+
53+// ======================================================================
54+// API data types
55+// ======================================================================
56+
57+class VESSEL;
58+class CELBODY;
59+class ExternMFD;
60+
61+typedef void *OBJHANDLE;
62+// Handle for objects (vessels, stations, planets)
63+
64+typedef void *VISHANDLE;
65+// Handle for visuals
66+
67+typedef void *MESHHANDLE;
68+// Handle for meshes
69+
70+typedef void *SURFHANDLE;
71+// Handle for bitmap surfaces (panels and panel items)
72+
73+typedef void *FILEHANDLE;
74+
75+typedef void *THRUSTER_HANDLE;
76+typedef void *THGROUP_HANDLE;
77+// Handle for (logical) thrusters and thruster groups
78+
79+typedef void *PROPELLANT_HANDLE;
80+// Handle for propellant resource
81+
82+typedef void *PSTREAM_HANDLE;
83+// Handle for particle streams
84+
85+typedef void *DOCKHANDLE;
86+// Handle for vessel docking ports
87+
88+typedef void *ATTACHMENTHANDLE;
89+// Handle vor vessel passive attachment points
90+
91+typedef void *AIRFOILHANDLE;
92+// Handle for vessel airfoils
93+
94+typedef void *CTRLSURFHANDLE;
95+// Handle for vessel aerodynamic control surfaces
96+
97+typedef void *NAVHANDLE;
98+// Handle for a navigation radio transmitter (VOR, ILS, IDS, XPDR)
99+
100+typedef void *ANIMATIONCOMPONENT_HANDLE;
101+
102+typedef void *LAUNCHPADITEM_HANDLE;
103+// Handle for custom items added to Launchpad "Extra" list
104+
105+typedef void *NOTEHANDLE;
106+// Handle for onscreen annotations
107+
108+typedef enum { FILE_IN, FILE_OUT, FILE_APP } FileAccessMode;
109+typedef enum { ROOT, CONFIG, SCENARIOS, TEXTURES, TEXTURES2, MESHES, MODULES } PathRoot;
110+
111+typedef union { // 3 vector
112+ double data[3];
113+ struct { double x, y, z; };
114+} VECTOR3;
115+
116+typedef union { // 3x3 matrix
117+ double data[9];
118+ struct { double m11, m12, m13, m21, m22, m23, m31, m32, m33; };
119+} MATRIX3;
120+
121+typedef union { // 4x4 matrix
122+ double data[16];
123+ struct { double m11, m12, m13, m14, m21, m22, m23, m24, m31, m32, m33, m34, m41, m42, m43, m44; };
124+} MATRIX4;
125+
126+typedef struct { // colour definition
127+ float r, g, b, a; // red, green, blue, opacity (0..1)
128+} COLOUR4;
129+
130+typedef struct { // vertex definition including normals and texture coordinates
131+ float x, y, z; // position
132+ float nx, ny, nz; // normal
133+ float tu, tv; // texture coordinates
134+} NTVERTEX;
135+
136+typedef struct { // mesh group definition
137+ NTVERTEX *Vtx; // vertex list
138+ WORD *Idx; // index list
139+ DWORD nVtx; // vertex count
140+ DWORD nIdx; // index count
141+ DWORD MtrlIdx; // material index (>= 1, 0=none)
142+ DWORD TexIdx; // texture index (>= 1, 0=none)
143+ DWORD UsrFlag; // user-defined flag
144+ WORD zBias; // z bias
145+ WORD Flags; // internal flags
146+} MESHGROUP;
147+
148+typedef struct { // material definition
149+ COLOUR4 diffuse; // diffuse component
150+ COLOUR4 ambient; // ambient component
151+ COLOUR4 specular; // specular component
152+ COLOUR4 emissive; // emissive component
153+ float power; // specular power
154+} MATERIAL;
155+
156+typedef struct { // Orbital elements
157+ double a; // semi-major axis [m]
158+ double e; // eccentricity
159+ double i; // inclination [rad]
160+ double theta; // longitude of ascending node [rad]
161+ double omegab; // longitude of periapsis [rad]
162+ double L; // mean longitude at epoch
163+} ELEMENTS;
164+
165+typedef struct { // additional orbital parameters
166+ double SMi; // semi-minor axis
167+ double PeD; // periapsis distance
168+ double ApD; // apoapsis distance
169+ double MnA; // mean anomaly
170+ double TrA; // true anomaly
171+ double MnL; // mean longitude
172+ double TrL; // true longitude
173+ double EcA; // eccentric anomaly
174+ double Lec; // linear eccentricity
175+ double T; // orbit period
176+ double PeT; // time to next periapsis passage
177+ double ApT; // time to next apoapsis passage
178+} ORBITPARAM;
179+
180+typedef struct { // Planetary atmospheric constants
181+ double p0; // pressure at mean radius ('sea level') [Pa]
182+ double rho0; // density at mean radius
183+ double R; // specific gas constant [J/(K kg)]
184+ double gamma; // ratio of specific heats, c_p/c_v
185+ double C; // exponent for pressure equation (temporary)
186+ double O2pp; // partial pressure of oxygen
187+ double altlimit; // atmosphere altitude limit [m]
188+ double radlimit; // radius limit (altlimit + mean radius)
189+ double horizonalt; // horizon rendering altitude
190+ VECTOR3 color0; // sky colour at sea level during daytime
191+} ATMCONST;
192+
193+typedef struct { // Atmospheric parameters
194+ double T; // temperature [K]
195+ double p; // pressure [Pa]
196+ double rho; // density [kg/m^3]
197+} ATMPARAM;
198+
199+typedef struct { // Engine status
200+ double main; // -1 (full retro) .. +1 (full main)
201+ double hover; // 0 .. +1 (full hover)
202+ int attmode; // 0=rotation, 1=translation
203+} ENGINESTATUS;
204+
205+typedef struct { // Particle stream parameters
206+ DWORD flags; // streamspec bitflags
207+ double srcsize; // particle size at creation [m]
208+ double srcrate; // average particle creation rate [Hz]
209+ double v0; // emission velocity [m/s]
210+ double srcspread; // velocity spread during creation
211+ double lifetime; // average particle lifetime
212+ double growthrate; // particle growth rate [m/s]
213+ double atmslowdown;// slowdown rate in atmosphere
214+ enum LTYPE { EMISSIVE, DIFFUSE } ltype; // render lighting method
215+ enum LEVELMAP { LVL_FLAT, LVL_LIN, LVL_SQRT, LVL_PLIN, LVL_PSQRT } levelmap; // mapping from level to alpha
216+ double lmin, lmax; // min and max levels for level PLIN and PSQRT mapping types
217+ enum ATMSMAP { ATM_FLAT, ATM_PLIN, ATM_PLOG } atmsmap; // mapping from atmospheric params to alpha
218+ double amin, amax; // min and max densities for atms PLIN mapping
219+ SURFHANDLE tex; // particle texture handle (NULL for default)
220+} PARTICLESTREAMSPEC;
221+
222+typedef struct { // vessel beacon light parameters
223+ DWORD shape; // beacon texture identifier
224+ VECTOR3 *pos; // pointer to position in vessel coordinates
225+ VECTOR3 *col; // pointer to beacon RGB colour
226+ double size; // beacon radius
227+ double falloff; // distance falloff parameter
228+ double period; // strobe period (0 for continuous)
229+ double duration; // strobe duration
230+ double tofs; // strobe time offset
231+ bool active; // beacon lit?
232+} BEACONLIGHTSPEC;
233+
234+#define BEACONSHAPE_COMPACT 0
235+#define BEACONSHAPE_DIFFUSE 1
236+#define BEACONSHAPE_STAR 2
237+
238+typedef struct {
239+ VECTOR3 rpos; // position relative to rbody (ecliptic frame)
240+ VECTOR3 rvel; // velocity relative to rbody (ecliptic frame)
241+ VECTOR3 vrot; // rotation velocity about principal axes
242+ VECTOR3 arot; // vessel orientation against ecliptic frame
243+ double fuel; // fuel level [0..1]
244+ double eng_main; // main engine setting [-1..1]
245+ double eng_hovr; // hover engine setting [0..1]
246+ OBJHANDLE rbody; // handle of reference body
247+ OBJHANDLE base; // handle of docking or landing target
248+ int port; // designated docking or landing port
249+ int status; // 0=freeflight, 1=landed, 2=taxiing, 3=docked, 99=undefined
250+
251+ // reserved data structures for future use
252+ VECTOR3 vdata[10]; // vdata[0]: contains x=long,y=lat of landing site and z=vessel orientation if status==1
253+ double fdata[10];
254+ DWORD flag[10];
255+} VESSELSTATUS;
256+
257+typedef struct { // vessel status: interface version 2
258+ DWORD version; // version id
259+ DWORD flag; // bitflags
260+ OBJHANDLE rbody; // handle of reference body
261+ OBJHANDLE base; // handle of docking or landing target
262+ int port; // designated docking or landing port
263+ int status; // 0=freeflight, 1=landed, 3=docked to station (obsolete)
264+ VECTOR3 rpos; // position relative to rbody (ecliptic frame)
265+ VECTOR3 rvel; // velocity relative to rbody (ecliptic frame)
266+ VECTOR3 vrot; // rotation velocity about principal axes
267+ VECTOR3 arot; // vessel orientation against ecliptic frame
268+ double surf_lng; // longitude of landing position |
269+ double surf_lat; // latitude of landing position | only used when landed
270+ double surf_hdg; // heading of landed vessel |
271+ DWORD nfuel; // length of propellant level list
272+ struct FUELSPEC {
273+ DWORD idx; // propellant index
274+ double level; // propellant level
275+ } *fuel; // propellant list
276+ DWORD nthruster; // length of thruster level list
277+ struct THRUSTSPEC {
278+ DWORD idx; // thruster index
279+ double level; // thruster level
280+ } *thruster; // thruster list
281+ DWORD ndockinfo; // length of dock info list
282+ struct DOCKINFOSPEC {
283+ DWORD idx; // docking port index
284+ DWORD ridx; // docking port index of docked vessel
285+ OBJHANDLE rvessel; // docked vessel
286+ } *dockinfo; // dock info list
287+ DWORD xpdr; // transponder setting (in 0.05MHz steps from 108.00)
288+} VESSELSTATUS2;
289+
290+// VESSELSTATUSx bitflags
291+#define VS_FUELRESET 0x00000001
292+#define VS_FUELLIST 0x00000002
293+#define VS_THRUSTRESET 0x00000004
294+#define VS_THRUSTLIST 0x00000008
295+#define VS_DOCKINFOLIST 0x00000010
296+
297+typedef struct {
298+ char *helpfile;
299+ char *topic;
300+ char *toc;
301+ char *index;
302+} HELPCONTEXT;
303+
304+typedef struct {
305+ char *name;
306+ void *parent;
307+ char *desc;
308+ void (*clbkFunc)(HINSTANCE,HWND);
309+} LP_EXTRAPRM;
310+
311+#pragma pack(push,1)
312+typedef struct {
313+ union {
314+ struct {
315+ VECTOR3 ref;
316+ VECTOR3 axis;
317+ float angle;
318+ } rotparam;
319+ struct {
320+ VECTOR3 shift;
321+ } transparam;
322+ struct {
323+ VECTOR3 scale;
324+ } scaleparam;
325+ } P;
326+ int nmesh;
327+ int ngrp;
328+ enum { TRANSLATE, ROTATE, SCALE } transform;
329+} MESHGROUP_TRANSFORM;
330+#pragma pack(pop)
331+
332+typedef struct {
333+ UINT *grp;
334+ UINT ngrp;
335+ double state0;
336+ double state1;
337+ MESHGROUP_TRANSFORM trans;
338+} ANIMCOMP;
339+
340+// Transformation types for animations
341+
342+// Transformation base class
343+class MGROUP_TRANSFORM {
344+public:
345+ MGROUP_TRANSFORM () : mesh(0), grp(0), ngrp(0) {}
346+ MGROUP_TRANSFORM (UINT _mesh, UINT *_grp, UINT _ngrp)
347+ : mesh(_mesh), grp(_grp), ngrp(_ngrp) {}
348+ enum TYPE { NULLTRANSFORM, ROTATE, TRANSLATE, SCALE };
349+ virtual TYPE Type() const { return NULLTRANSFORM; }
350+
351+ UINT mesh;
352+ UINT *grp;
353+ UINT ngrp;
354+};
355+
356+// Rotation
357+class MGROUP_ROTATE: public MGROUP_TRANSFORM {
358+public:
359+ MGROUP_ROTATE (UINT _mesh, UINT *_grp, UINT _ngrp, const VECTOR3 &_ref, const VECTOR3 &_axis, float _angle)
360+ : MGROUP_TRANSFORM (_mesh, _grp, _ngrp), ref(_ref), axis(_axis), angle(_angle) {}
361+ TYPE Type() const { return ROTATE; }
362+
363+ VECTOR3 ref;
364+ VECTOR3 axis;
365+ float angle;
366+};
367+
368+// Translation
369+class MGROUP_TRANSLATE: public MGROUP_TRANSFORM {
370+public:
371+ MGROUP_TRANSLATE (UINT _mesh, UINT *_grp, UINT _ngrp, const VECTOR3 &_shift)
372+ : MGROUP_TRANSFORM (_mesh, _grp, _ngrp), shift(_shift) {}
373+ TYPE Type() const { return TRANSLATE; }
374+
375+ VECTOR3 shift;
376+};
377+
378+// Scaling
379+class MGROUP_SCALE: public MGROUP_TRANSFORM {
380+public:
381+ MGROUP_SCALE (UINT _mesh, UINT *_grp, UINT _ngrp, const VECTOR3 &_ref, const VECTOR3 &_scale)
382+ : MGROUP_TRANSFORM (_mesh, _grp, _ngrp), ref(_ref), scale(_scale) {}
383+ TYPE Type() const { return SCALE; }
384+
385+ VECTOR3 ref;
386+ VECTOR3 scale;
387+};
388+
389+#define LOCALVERTEXLIST ((UINT)(-1))
390+#define MAKEGROUPARRAY(x) ((UINT*)x)
391+
392+typedef struct {
393+ RECT pos;
394+ int nbt_left, nbt_right;
395+ int bt_yofs, bt_ydist;
396+} MFDSPEC;
397+
398+typedef struct {
399+ DWORD nmesh, ngroup;
400+} VCMFDSPEC;
401+
402+#define MFD_SHOWMODELABELS 1
403+
404+typedef struct {
405+ RECT pos;
406+ DWORD nmesh, ngroup;
407+ DWORD flag;
408+ int nbt1, nbt2;
409+ int bt_yofs, bt_ydist;
410+} EXTMFDSPEC;
411+
412+typedef struct {
413+ DWORD nmesh, ngroup;
414+ VECTOR3 hudcnt;
415+ double size;
416+} VCHUDSPEC;
417+
418+typedef struct {
419+ int W, H;
420+ int CX, CY;
421+ double Scale;
422+ int Markersize;
423+} HUDPAINTSPEC;
424+
425+typedef struct {
426+ char *name;
427+ DWORD key;
428+ int (*msgproc)(UINT,UINT,WPARAM,LPARAM);
429+} MFDMODESPEC;
430+
431+#pragma pack(push,1)
432+typedef struct {
433+ const char *line1, *line2;
434+ char selchar;
435+} MFDBUTTONMENU;
436+#pragma pack(pop)
437+
438+typedef enum {
439+ ENGINE_MAIN,
440+ ENGINE_RETRO,
441+ ENGINE_HOVER,
442+ ENGINE_ATTITUDE
443+} ENGINETYPE;
444+
445+typedef enum {
446+ EXHAUST_MAIN,
447+ EXHAUST_RETRO,
448+ EXHAUST_HOVER,
449+ EXHAUST_CUSTOM
450+} EXHAUSTTYPE;
451+
452+typedef enum {
453+ THGROUP_MAIN,
454+ THGROUP_RETRO,
455+ THGROUP_HOVER,
456+ THGROUP_ATT_PITCHUP,
457+ THGROUP_ATT_PITCHDOWN,
458+ THGROUP_ATT_YAWLEFT,
459+ THGROUP_ATT_YAWRIGHT,
460+ THGROUP_ATT_BANKLEFT,
461+ THGROUP_ATT_BANKRIGHT,
462+ THGROUP_ATT_RIGHT,
463+ THGROUP_ATT_LEFT,
464+ THGROUP_ATT_UP,
465+ THGROUP_ATT_DOWN,
466+ THGROUP_ATT_FORWARD,
467+ THGROUP_ATT_BACK,
468+ THGROUP_USER = 0x40
469+} THGROUP_TYPE;
470+
471+typedef enum {
472+ ATTMODE_DISABLED,
473+ ATTMODE_ROT,
474+ ATTMODE_LIN,
475+} ATTITUDEMODE;
476+
477+typedef double (*LiftCoeffFunc)(double aoa); // obsolete
478+
479+typedef void (*AirfoilCoeffFunc)(
480+ double aoa, double M, double Re,
481+ double *cl, double *cm, double *cd);
482+// Template for aerodynamic coefficients callback function
483+// Used to calculate lift coefficient cl, moment coefficient
484+// cm, and drag coefficient cd as a function of angle of attack
485+// aoa, Mach number M, and Reynolds number Re
486+
487+typedef void (*AirfoilCoeffFuncEx)(
488+ VESSEL *v, double aoa, double M, double Re, void *context,
489+ double *cl, double *cm, double *cd);
490+// Extended version of aerodynamic coefficients callback function
491+// Contains additional parameters (calling vessel and pointer to
492+// user-defined data)
493+
494+typedef enum {
495+ LIFT_VERTICAL,
496+ LIFT_HORIZONTAL
497+} AIRFOIL_ORIENTATION;
498+
499+typedef enum {
500+ AIRCTRL_ELEVATOR,
501+ AIRCTRL_RUDDER,
502+ AIRCTRL_AILERON,
503+ AIRCTRL_FLAP,
504+ AIRCTRL_ELEVATORTRIM,
505+ AIRCTRL_RUDDERTRIM
506+} AIRCTRL_TYPE;
507+
508+#define AIRCTRL_AXIS_AUTO 0
509+#define AIRCTRL_AXIS_YPOS 1
510+#define AIRCTRL_AXIS_YNEG 2
511+#define AIRCTRL_AXIS_XPOS 3
512+#define AIRCTRL_AXIS_XNEG 4
513+
514+// Object types
515+#define OBJTP_INVALID 0
516+#define OBJTP_GENERIC 1
517+#define OBJTP_CBODY 2
518+#define OBJTP_STAR 3
519+#define OBJTP_PLANET 4
520+#define OBJTP_VESSEL 10
521+#define OBJTP_SURFBASE 20
522+
523+#define NAVMODE_KILLROT 1
524+#define NAVMODE_HLEVEL 2
525+#define NAVMODE_PROGRADE 3
526+#define NAVMODE_RETROGRADE 4
527+#define NAVMODE_NORMAL 5
528+#define NAVMODE_ANTINORMAL 6
529+#define NAVMODE_HOLDALT 7
530+
531+#define MANCTRL_ATTMODE 0
532+#define MANCTRL_REVMODE 1
533+#define MANCTRL_ROTMODE 2
534+#define MANCTRL_LINMODE 3
535+#define MANCTRL_ANYMODE 4
536+
537+#define MANCTRL_KEYBOARD 0
538+#define MANCTRL_JOYSTICK 1
539+#define MANCTRL_ANYDEVICE 2
540+
541+#define COCKPIT_GENERIC 1
542+#define COCKPIT_PANELS 2
543+#define COCKPIT_VIRTUAL 3
544+
545+#define CAM_COCKPIT 0
546+#define CAM_TARGETRELATIVE 1
547+#define CAM_ABSDIRECTION 2
548+#define CAM_GLOBALFRAME 3
549+#define CAM_TARGETTOOBJECT 4
550+#define CAM_TARGETFROMOBJECT 5
551+#define CAM_GROUNDOBSERVER 6
552+
553+// time propagation modes
554+#define PROP_ORBITAL 0x0F
555+#define PROP_ORBITAL_ELEMENTS 0x00
556+#define PROP_ORBITAL_FIXEDSTATE 0x01
557+#define PROP_ORBITAL_FIXEDSURF 0x02
558+#define PROP_SORBITAL 0xF0
559+#define PROP_SORBITAL_ELEMENTS (0x0 << 4)
560+#define PROP_SORBITAL_FIXEDSTATE (0x1 << 4)
561+#define PROP_SORBITAL_FIXEDSURF (0x2 << 4)
562+#define PROP_SORBITAL_DESTROY (0x3 << 4)
563+
564+#define RCS_NONE 0
565+#define RCS_ROT 1
566+#define RCS_LIN 2
567+
568+#define HUD_NONE 0
569+#define HUD_ORBIT 1
570+#define HUD_SURFACE 2
571+#define HUD_DOCKING 3
572+
573+#define MFD_REFRESHBUTTONS -1
574+#define MFD_NONE 0
575+#define MFD_ORBIT 1
576+#define MFD_SURFACE 2
577+#define MFD_MAP 3
578+#define MFD_HSI 4
579+#define MFD_LANDING 5
580+#define MFD_DOCKING 6
581+#define MFD_OPLANEALIGN 7
582+#define MFD_OSYNC 8
583+#define MFD_TRANSFER 9
584+#define MFD_COMMS 10
585+#define MFD_USERTYPE 64
586+#define BUILTIN_MFD_MODES 10
587+
588+#define MAXMFD 10
589+#define MFD_LEFT 0
590+#define MFD_RIGHT 1
591+#define MFD_USER1 2
592+#define MFD_USER2 3
593+#define MFD_USER3 4
594+#define MFD_USER4 5
595+#define MFD_USER5 6
596+#define MFD_USER6 7
597+#define MFD_USER7 8
598+#define MFD_USER8 9
599+
600+#define PANEL_LEFT 0
601+#define PANEL_RIGHT 1
602+#define PANEL_UP 2
603+#define PANEL_DOWN 3
604+
605+#define PANEL_REDRAW_NEVER 0x00
606+#define PANEL_REDRAW_ALWAYS 0x01
607+#define PANEL_REDRAW_MOUSE 0x02
608+#define PANEL_REDRAW_INIT 0x03
609+#define PANEL_REDRAW_USER 0x04
610+
611+#define PANEL_MOUSE_IGNORE 0x00
612+#define PANEL_MOUSE_LBDOWN 0x01
613+#define PANEL_MOUSE_RBDOWN 0x02
614+#define PANEL_MOUSE_LBUP 0x04
615+#define PANEL_MOUSE_RBUP 0x08
616+#define PANEL_MOUSE_LBPRESSED 0x10
617+#define PANEL_MOUSE_RBPRESSED 0x20
618+#define PANEL_MOUSE_DOWN 0x03
619+#define PANEL_MOUSE_UP 0x0C
620+#define PANEL_MOUSE_PRESSED 0x30
621+#define PANEL_MOUSE_ONREPLAY 0x40
622+
623+#define PANEL_MAP_NONE 0x00
624+#define PANEL_MAP_BACKGROUND 0x01
625+#define PANEL_MAP_CURRENT 0x02
626+#define PANEL_MAP_BGONREQUEST 0x03
627+
628+#define PANEL_ATTACH_BOTTOM 0x0001
629+#define PANEL_ATTACH_TOP 0x0002
630+#define PANEL_ATTACH_LEFT 0x0004
631+#define PANEL_ATTACH_RIGHT 0x0008
632+#define PANEL_MOVEOUT_BOTTOM 0x0010
633+#define PANEL_MOVEOUT_TOP 0x0020
634+#define PANEL_MOVEOUT_LEFT 0x0040
635+#define PANEL_MOVEOUT_RIGHT 0x0080
636+
637+#define SURF_NO_CK 0xFFFFFFFF
638+#define SURF_PREDEF_CK 0xFFFFFFFE
639+
640+#define SURF_NO_ROTATION ((DWORD)-1)
641+#define SURF_HMIRROR ((DWORD)-2)
642+#define SURF_VMIRROR ((DWORD)-3)
643+#define SURF_ROTATE_90 ((DWORD)-4)
644+#define SURF_ROTATE_180 ((DWORD)-5)
645+#define SURF_ROTATE_270 ((DWORD)-6)
646+
647+#define DLG_ALLOWMULTI 0x1
648+#define DLG_CAPTIONCLOSE 0x2
649+#define DLG_CAPTIONHELP 0x4
650+
651+#define DLG_CB_TWOSTATE 0x1
652+
653+// Custom MFD message identifiers
654+#define OAPI_MSG_MFD_OPENED 1
655+#define OAPI_MSG_MFD_CLOSED 2
656+#define OAPI_MSG_MFD_UPDATE 3
657+
658+#define MESHVIS_NEVER 0x00
659+#define MESHVIS_EXTERNAL 0x01
660+#define MESHVIS_COCKPIT 0x02
661+#define MESHVIS_ALWAYS (MESHVIS_EXTERNAL|MESHVIS_COCKPIT)
662+#define MESHVIS_VC 0x04
663+#define MESHVIS_EXTPASS 0x10
664+
665+#define MESHPROPERTY_MODULATEMATALPHA 1
666+
667+// navigation radio transmitter types
668+#define TRANSMITTER_NONE 0
669+#define TRANSMITTER_VOR 1
670+#define TRANSMITTER_VTOL 2
671+#define TRANSMITTER_ILS 3
672+#define TRANSMITTER_IDS 4
673+#define TRANSMITTER_XPDR 5
674+
675+const UINT ALLDOCKS = (UINT)-1;
676+
677+typedef int (*KeyFunc)(const char *keybuf);
678+
679+// ======================================================================
680+// class LaunchpadItem
681+// ======================================================================
682+
683+class DLLEXPORT LaunchpadItem {
684+public:
685+ LaunchpadItem ();
686+ virtual ~LaunchpadItem ();
687+ virtual char *Name ();
688+ virtual char *Description ();
689+ virtual bool OpenDialog (HINSTANCE hInst, HWND hLaunchpad, int resId, DLGPROC pDlg);
690+ virtual bool clbkOpen (HWND hLaunchpad);
691+ virtual int clbkWriteConfig ();
692+
693+ LAUNCHPADITEM_HANDLE hItem;
694+};
695+
696+// ======================================================================
697+// class CameraMode and subclasses
698+// ======================================================================
699+
700+class DLLEXPORT CameraMode {
701+friend class Camera;
702+public:
703+ CameraMode ();
704+ static CameraMode *Create (char *str);
705+ virtual void Init (char *str) = 0;
706+ virtual void Store (char *str) = 0;
707+ enum Mode { CM_COCKPIT, CM_TRACK, CM_GROUND };
708+ OBJHANDLE GetTarget() const { return target; }
709+ virtual Mode GetMode() const = 0;
710+ virtual void GetDescr (char *str, int len) = 0;
711+ void SetTarget (OBJHANDLE hTgt);
712+ void SetFOV (double FOV);
713+ double GetFOV () const { return fov; }
714+
715+protected:
716+ OBJHANDLE target; // camera target
717+ double fov; // field of view [deg]
718+};
719+
720+class DLLEXPORT CameraMode_Cockpit: public CameraMode {
721+public:
722+ CameraMode_Cockpit ();
723+ void Init (char*) {}
724+ void Store (char *str);
725+ Mode GetMode() const { return CM_COCKPIT; }
726+ void GetDescr (char *str, int len);
727+};
728+
729+class DLLEXPORT CameraMode_Track: public CameraMode {
730+public:
731+ CameraMode_Track ();
732+ void Init (char *str);
733+ void Store (char *str);
734+ Mode GetMode() const { return CM_TRACK; }
735+ void GetDescr (char *str, int len);
736+ enum TrackMode { TM_CURRENT, TM_RELATIVE, TM_ABSDIR, TM_GLOBAL, TM_TARGETTOREF, TM_TARGETFROMREF };
737+ TrackMode GetTrackMode () const { return tmode; }
738+ void SetTrackMode (TrackMode trackmode, OBJHANDLE refobj = 0);
739+ OBJHANDLE GetRef() const { return ref; }
740+ void SetPosition (double rd, double ph, double th);
741+ void GetPosition (double *rd, double *ph, double *th) const;
742+
743+protected:
744+ TrackMode tmode; // camera track mode
745+ double reldist; // distance camera-targets (in units of target size)
746+ double phi, theta; // camera angle [rad]
747+ OBJHANDLE ref; // reference object (for TM_TARGETTOREF and TM_TARGETFROMREF only)
748+};
749+
750+class DLLEXPORT CameraMode_Ground: public CameraMode {
751+public:
752+ CameraMode_Ground ();
753+ void Init (char *str);
754+ void Store (char *str);
755+ Mode GetMode () const { return CM_GROUND; }
756+ void GetDescr (char *str, int len);
757+ void SetPosition (double longitude, double latitude, double altitude, OBJHANDLE hRef = 0);
758+ void GetPosition (double *longitude, double *latitude, double *altitude, OBJHANDLE *hRef) const;
759+ void SetOrientation (double ph, double th);
760+ void GetOrientation (double *ph, double *th) const;
761+ bool GetTgtLock () const { return tgtlock; }
762+ OBJHANDLE GetRef() const { return ref; }
763+
764+protected:
765+ OBJHANDLE ref;
766+ double lng, lat; // camera position on the ground [rad]
767+ double alt; // camera height over ground [m]
768+ double phi, theta; // camera direction (free mode only)
769+ bool tgtlock; // flag for target lock/free mode
770+};
771+
772+// ======================================================================
773+// Orbiter API interface methods
774+// ======================================================================
775+
776+OAPIFUNC int oapiGetOrbiterVersion ();
777+ int oapiGetModuleVersion ();
778+OAPIFUNC HINSTANCE oapiGetOrbiterInstance ();
779+OAPIFUNC const char *oapiGetCmdLine ();
780+
781+OAPIFUNC OBJHANDLE oapiGetObjectByName (char *name);
782+OAPIFUNC OBJHANDLE oapiGetObjectByIndex (int index);
783+OAPIFUNC DWORD oapiGetObjectCount ();
784+OAPIFUNC int oapiGetObjectType (OBJHANDLE hObj);
785+
786+OAPIFUNC OBJHANDLE oapiGetVesselByName (char *name);
787+OAPIFUNC OBJHANDLE oapiGetVesselByIndex (int index);
788+OAPIFUNC DWORD oapiGetVesselCount ();
789+OAPIFUNC bool oapiIsVessel (OBJHANDLE hVessel);
790+
791+OAPIFUNC OBJHANDLE oapiGetStationByName (char *name);
792+OAPIFUNC OBJHANDLE oapiGetStationByIndex (int index);
793+OAPIFUNC DWORD oapiGetStationCount ();
794+
795+OAPIFUNC OBJHANDLE oapiGetGbodyByName (char *name);
796+OAPIFUNC OBJHANDLE oapiGetGbodyByIndex (int index);
797+OAPIFUNC DWORD oapiGetGbodyCount ();
798+
799+OAPIFUNC OBJHANDLE oapiGetBaseByName (OBJHANDLE hPlanet, char *name);
800+OAPIFUNC OBJHANDLE oapiGetBaseByIndex (OBJHANDLE hPlanet, int index);
801+OAPIFUNC DWORD oapiGetBaseCount (OBJHANDLE hPlanet);
802+
803+OAPIFUNC void oapiGetObjectName (OBJHANDLE hObj, char *name, int n);
804+
805+OAPIFUNC OBJHANDLE oapiGetFocusObject ();
806+OAPIFUNC OBJHANDLE oapiSetFocusObject (OBJHANDLE hVessel);
807+
808+OAPIFUNC VESSEL *oapiGetVesselInterface (OBJHANDLE hVessel);
809+OAPIFUNC VESSEL *oapiGetFocusInterface ();
810+OAPIFUNC CELBODY *oapiGetCelbodyInterface (OBJHANDLE hBody);
811+
812+OAPIFUNC OBJHANDLE oapiCreateVessel (const char *name, const char *classname, const VESSELSTATUS &status);
813+OAPIFUNC OBJHANDLE oapiCreateVesselEx (const char *name, const char *classname, const void *status);
814+OAPIFUNC bool oapiDeleteVessel (OBJHANDLE hVessel, OBJHANDLE hAlternativeCameraTarget = 0);
815+
816+OAPIFUNC double oapiGetSize (OBJHANDLE hObj);
817+OAPIFUNC double oapiGetMass (OBJHANDLE hObj);
818+
819+OAPIFUNC double oapiGetEmptyMass (OBJHANDLE hVessel);
820+OAPIFUNC double oapiGetFuelMass (OBJHANDLE hVessel);
821+OAPIFUNC void oapiSetEmptyMass (OBJHANDLE hVessel, double mass);
822+OAPIFUNC double oapiGetMaxFuelMass (OBJHANDLE hVessel);
823+OAPIFUNC double oapiGetPropellantMaxMass (PROPELLANT_HANDLE ph);
824+OAPIFUNC double oapiGetPropellantMass (PROPELLANT_HANDLE ph);
825+OAPIFUNC PROPELLANT_HANDLE oapiGetPropellantHandle (OBJHANDLE hVessel, DWORD idx);
826+
827+OAPIFUNC DOCKHANDLE oapiGetDockHandle (OBJHANDLE hVessel, UINT n);
828+OAPIFUNC OBJHANDLE oapiGetDockStatus (DOCKHANDLE dock);
829+
830+OAPIFUNC void oapiGetGlobalPos (OBJHANDLE hObj, VECTOR3 *pos);
831+OAPIFUNC void oapiGetGlobalVel (OBJHANDLE hObj, VECTOR3 *vel);
832+OAPIFUNC void oapiGetFocusGlobalPos (VECTOR3 *pos);
833+OAPIFUNC void oapiGetFocusGlobalVel (VECTOR3 *vel);
834+
835+OAPIFUNC void oapiGetRelativePos (OBJHANDLE hObj, OBJHANDLE hRef, VECTOR3 *pos);
836+OAPIFUNC void oapiGetRelativeVel (OBJHANDLE hObj, OBJHANDLE hRef, VECTOR3 *vel);
837+OAPIFUNC void oapiGetFocusRelativePos (OBJHANDLE hRef, VECTOR3 *pos);
838+OAPIFUNC void oapiGetFocusRelativeVel (OBJHANDLE hRef, VECTOR3 *vel);
839+
840+OAPIFUNC void oapiGetBarycentre (OBJHANDLE hObj, VECTOR3 *bary);
841+OAPIFUNC void oapiGetRotationMatrix (OBJHANDLE hObj, MATRIX3 *mat);
842+
843+OAPIFUNC BOOL oapiGetAltitude (OBJHANDLE hVessel, double *alt);
844+OAPIFUNC BOOL oapiGetPitch (OBJHANDLE hVessel, double *pitch);
845+OAPIFUNC BOOL oapiGetBank (OBJHANDLE hVessel, double *bank);
846+OAPIFUNC BOOL oapiGetHeading (OBJHANDLE hVessel, double *heading);
847+OAPIFUNC BOOL oapiGetEquPos (OBJHANDLE hVessel, double *longitude, double *latitude, double *radius);
848+OAPIFUNC BOOL oapiGetFocusAltitude (double *alt);
849+OAPIFUNC BOOL oapiGetFocusPitch (double *pitch);
850+OAPIFUNC BOOL oapiGetFocusBank (double *bank);
851+OAPIFUNC BOOL oapiGetFocusHeading (double *heading);
852+OAPIFUNC BOOL oapiGetFocusEquPos (double *longitude, double *latitude, double *radius);
853+
854+OAPIFUNC BOOL oapiGetAirspeed (OBJHANDLE hVessel, double *airspeed);
855+OAPIFUNC BOOL oapiGetAirspeedVector (OBJHANDLE hVessel, VECTOR3 *speedvec);
856+OAPIFUNC BOOL oapiGetShipAirspeedVector (OBJHANDLE hVessel, VECTOR3 *speedvec);
857+OAPIFUNC BOOL oapiGetFocusAirspeed (double *airspeed);
858+OAPIFUNC BOOL oapiGetFocusAirspeedVector (VECTOR3 *speedvec);
859+OAPIFUNC BOOL oapiGetFocusShipAirspeedVector (VECTOR3 *speedvec);
860+
861+OAPIFUNC void oapiGetAtmPressureDensity (OBJHANDLE hVessel, double *pressure, double *density);
862+OAPIFUNC void oapiGetFocusAtmPressureDensity (double *pressure, double *density);
863+
864+OAPIFUNC void oapiGetEngineStatus (OBJHANDLE hVessel, ENGINESTATUS *es);
865+OAPIFUNC void oapiGetFocusEngineStatus (ENGINESTATUS *es);
866+OAPIFUNC void oapiSetEngineLevel (OBJHANDLE hVessel, ENGINETYPE engine, double level);
867+OAPIFUNC SURFHANDLE oapiRegisterExhaustTexture (char *name);
868+OAPIFUNC SURFHANDLE oapiRegisterReentryTexture (char *name);
869+OAPIFUNC SURFHANDLE oapiRegisterParticleTexture (char *name);
870+
871+OAPIFUNC int oapiGetAttitudeMode (OBJHANDLE hVessel);
872+OAPIFUNC int oapiToggleAttitudeMode (OBJHANDLE hVessel);
873+OAPIFUNC bool oapiSetAttitudeMode (OBJHANDLE hVessel, int mode);
874+OAPIFUNC int oapiGetFocusAttitudeMode ();
875+OAPIFUNC int oapiToggleFocusAttitudeMode ();
876+OAPIFUNC bool oapiSetFocusAttitudeMode (int mode);
877+
878+OAPIFUNC void oapiSetShowGrapplePoints (bool show);
879+OAPIFUNC bool oapiGetShowGrapplePoints ();
880+
881+OAPIFUNC double oapiGetSimTime ();
882+OAPIFUNC double oapiGetSimStep ();
883+OAPIFUNC double oapiGetSysTime ();
884+OAPIFUNC double oapiGetSysStep ();
885+OAPIFUNC double oapiGetSimMJD ();
886+OAPIFUNC double oapiGetSysMJD ();
887+OAPIFUNC bool oapiSetSimMJD (double mjd, int pmode = 0);
888+OAPIFUNC double oapiGetFrameRate ();
889+OAPIFUNC double oapiTime2MJD (double t);
890+OAPIFUNC double oapiGetTimeAcceleration ();
891+OAPIFUNC void oapiSetTimeAcceleration (double warp);
892+OAPIFUNC bool oapiGetPause ();
893+OAPIFUNC void oapiSetPause (bool pause);
894+
895+OAPIFUNC bool oapiAcceptDelayedKey (char key, double interval);
896+
897+// Aerodynamics helper functions
898+OAPIFUNC double oapiGetInducedDrag (double cl, double A, double e);
899+OAPIFUNC double oapiGetWaveDrag (double M, double M1, double M2, double M3, double cmax);
900+
901+// Camera functions
902+OAPIFUNC bool oapiCameraInternal ();
903+OAPIFUNC int oapiCameraMode ();
904+OAPIFUNC int oapiCockpitMode ();
905+OAPIFUNC OBJHANDLE oapiCameraTarget ();
906+OAPIFUNC void oapiCameraGlobalPos (VECTOR3 *gpos);
907+OAPIFUNC void oapiCameraGlobalDir (VECTOR3 *gdir);
908+OAPIFUNC double oapiCameraTargetDist ();
909+OAPIFUNC double oapiCameraAzimuth ();
910+OAPIFUNC double oapiCameraPolar ();
911+OAPIFUNC double oapiCameraAperture ();
912+OAPIFUNC void oapiCameraSetAperture (double aperture);
913+OAPIFUNC void oapiCameraScaleDist (double dscale);
914+OAPIFUNC void oapiCameraRotAzimuth (double dazimuth);
915+OAPIFUNC void oapiCameraRotPolar (double dpolar);
916+OAPIFUNC void oapiCameraSetCockpitDir (double polar, double azimuth, bool transition = false);
917+OAPIFUNC void oapiCameraAttach (OBJHANDLE hObj, int mode);
918+
919+// Functions for planetary bodies
920+OAPIFUNC double oapiGetPlanetPeriod (OBJHANDLE hPlanet);
921+OAPIFUNC double oapiGetPlanetObliquity (OBJHANDLE hPlanet);
922+OAPIFUNC double oapiGetPlanetTheta (OBJHANDLE hPlanet);
923+OAPIFUNC void oapiGetPlanetObliquityMatrix (OBJHANDLE hPlanet, MATRIX3 *mat);
924+OAPIFUNC double oapiGetPlanetCurrentRotation (OBJHANDLE hPlanet);
925+OAPIFUNC bool oapiPlanetHasAtmosphere (OBJHANDLE hPlanet);
926+OAPIFUNC void oapiGetPlanetAtmParams (OBJHANDLE hPlanet, double rad, ATMPARAM *prm);
927+OAPIFUNC const ATMCONST *oapiGetPlanetAtmConstants (OBJHANDLE hPlanet);
928+OAPIFUNC DWORD oapiGetPlanetJCoeffCount (OBJHANDLE hPlanet);
929+OAPIFUNC double oapiGetPlanetJCoeff (OBJHANDLE hPlanet, DWORD n);
930+
931+// Surface base interface
932+OAPIFUNC void oapiGetBaseEquPos (OBJHANDLE hBase, double *lng, double *lat, double *rad = 0);
933+OAPIFUNC DWORD oapiGetBasePadCount (OBJHANDLE hBase);
934+OAPIFUNC bool oapiGetBasePadEquPos (OBJHANDLE hBase, DWORD pad, double *lng, double *lat, double *rad = 0);
935+OAPIFUNC bool oapiGetBasePadStatus (OBJHANDLE hBase, DWORD pad, int *status);
936+OAPIFUNC NAVHANDLE oapiGetBasePadNav (OBJHANDLE hBase, DWORD pad);
937+
938+// Navigation radio transmitter functions
939+OAPIFUNC void oapiGetNavPos (NAVHANDLE hNav, VECTOR3 *gpos);
940+OAPIFUNC DWORD oapiGetNavChannel (NAVHANDLE hNav);
941+OAPIFUNC float oapiGetNavFreq (NAVHANDLE hNav);
942+OAPIFUNC float oapiGetNavRange (NAVHANDLE hNav);
943+OAPIFUNC DWORD oapiGetNavType (NAVHANDLE hNav);
944+OAPIFUNC int oapiGetNavDescr (NAVHANDLE hNav, char *descr, int maxlen);
945+OAPIFUNC bool oapiNavInRange (NAVHANDLE hNav, const VECTOR3 &gpos);
946+
947+// Visual and mesh functions
948+OAPIFUNC VISHANDLE *oapiObjectVisualPtr (OBJHANDLE hObject);
949+OAPIFUNC MESHHANDLE oapiLoadMesh (const char *fname);
950+OAPIFUNC const MESHHANDLE oapiLoadMeshGlobal (const char *fname);
951+OAPIFUNC void oapiDeleteMesh (MESHHANDLE hMesh);
952+OAPIFUNC SURFHANDLE oapiGetTextureHandle (MESHHANDLE hMesh, DWORD texidx);
953+OAPIFUNC SURFHANDLE oapiLoadTexture (const char *fname, bool dynamic = false);
954+OAPIFUNC bool oapiSetTexture (MESHHANDLE hMesh, DWORD texidx, SURFHANDLE tex);
955+OAPIFUNC DWORD oapiMeshGroupCount (MESHHANDLE hMesh);
956+OAPIFUNC MESHGROUP *oapiMeshGroup (MESHHANDLE hMesh, DWORD idx);
957+OAPIFUNC DWORD oapiMeshMaterialCount (MESHHANDLE hMesh);
958+OAPIFUNC MATERIAL *oapiMeshMaterial (MESHHANDLE hMesh, DWORD idx);
959+OAPIFUNC DWORD oapiAddMaterial (MESHHANDLE hMesh, MATERIAL *mat);
960+OAPIFUNC bool oapiDeleteMaterial (MESHHANDLE hMesh, DWORD idx);
961+OAPIFUNC bool oapiSetMeshProperty (MESHHANDLE hMesh, DWORD property, DWORD value);
962+
963+// Particle functions
964+OAPIFUNC void oapiParticleSetLevelRef (PSTREAM_HANDLE ph, double *lvl);
965+
966+// HUD, MFD and panel functions
967+OAPIFUNC bool oapiSetHUDMode (int mode);
968+OAPIFUNC int oapiGetHUDMode ();
969+OAPIFUNC void oapiToggleHUDColour ();
970+OAPIFUNC void oapiIncHUDIntensity ();
971+OAPIFUNC void oapiDecHUDIntensity ();
972+OAPIFUNC void oapiOpenMFD (int mode, int mfd);
973+OAPIFUNC void oapiToggleMFD_on (int mfd);
974+OAPIFUNC int oapiGetMFDMode (int mfd);
975+OAPIFUNC int oapiBroadcastMFDMessage (int mode, int msg, void *data);
976+OAPIFUNC int oapiSendMFDKey (int mfd, DWORD key);
977+OAPIFUNC void oapiRefreshMFDButtons (int mfd, OBJHANDLE hVessel = 0);
978+OAPIFUNC bool oapiProcessMFDButton (int mfd, int bt, int event);
979+OAPIFUNC const char *oapiMFDButtonLabel (int mfd, int bt);
980+OAPIFUNC void oapiRegisterMFD (int mfd, const MFDSPEC &spec);
981+OAPIFUNC void oapiRegisterMFD (int mfd, const EXTMFDSPEC *spec);
982+OAPIFUNC void oapiRegisterExternMFD (ExternMFD *emfd, const MFDSPEC &spec);
983+OAPIFUNC bool oapiUnregisterExternMFD (ExternMFD *emfd);
984+OAPIFUNC void oapiRegisterPanelBackground (HBITMAP hBmp, DWORD flag = PANEL_ATTACH_BOTTOM|PANEL_MOVEOUT_BOTTOM,
985+ DWORD ck = (DWORD)-1);
986+OAPIFUNC void oapiRegisterPanelArea (int id, const RECT &pos, int draw_event = PANEL_REDRAW_NEVER,
987+ int mouse_event = PANEL_MOUSE_IGNORE, int bkmode = PANEL_MAP_NONE);
988+OAPIFUNC void oapiSetPanelNeighbours (int left, int right, int top, int bottom);
989+OAPIFUNC void oapiTriggerPanelRedrawArea (int panel_id, int area_id);
990+OAPIFUNC void oapiTriggerRedrawArea (int panel_id, int vc_id, int area_id);
991+OAPIFUNC bool oapiBltPanelAreaBackground (int area_id, SURFHANDLE surf);
992+OAPIFUNC void oapiSetDefNavDisplay (int mode);
993+OAPIFUNC void oapiSetDefRCSDisplay (int mode);
994+OAPIFUNC int oapiSwitchPanel (int direction);
995+OAPIFUNC int oapiSetPanel (int panel_id);
996+OAPIFUNC HDC oapiGetDC (SURFHANDLE surf);
997+OAPIFUNC void oapiReleaseDC (SURFHANDLE surf, HDC hDC);
998+OAPIFUNC DWORD oapiGetColour (DWORD red, DWORD green, DWORD blue);
999+OAPIFUNC SURFHANDLE oapiCreateSurface (int width, int height);
1000+OAPIFUNC SURFHANDLE oapiCreateSurface (HBITMAP hBmp, bool release_bmp = true);
1001+OAPIFUNC SURFHANDLE oapiCreateTextureSurface (int width, int height);
1002+OAPIFUNC void oapiDestroySurface (SURFHANDLE surf);
1003+OAPIFUNC void oapiClearSurface (SURFHANDLE surf, DWORD col = 0);
1004+OAPIFUNC void oapiSetSurfaceColourKey (SURFHANDLE surf, DWORD ck);
1005+OAPIFUNC void oapiClearSurfaceColourKey (SURFHANDLE surf);
1006+OAPIFUNC void oapiBlt (SURFHANDLE tgt, SURFHANDLE src, int tgtx, int tgty, int srcx, int srcy, int w, int h, DWORD ck = SURF_NO_CK);
1007+OAPIFUNC void oapiBlt (SURFHANDLE tgt, SURFHANDLE src, RECT *tgtr, RECT *srcr, DWORD ck = SURF_NO_CK, DWORD rotate = SURF_NO_ROTATION);
1008+OAPIFUNC void oapiColourFill (SURFHANDLE tgt, DWORD fillcolor, int tgtx = 0, int tgty = 0, int w = 0, int h = 0);
1009+
1010+// Custom MFD mode definition
1011+OAPIFUNC int oapiRegisterMFDMode (MFDMODESPEC &spec);
1012+OAPIFUNC bool oapiUnregisterMFDMode (int mode);
1013+OAPIFUNC void oapiDisableMFDMode (int mode);
1014+OAPIFUNC int oapiGetMFDModeSpec (char *name, MFDMODESPEC **spec = 0);
1015+
1016+// virtual cockpit functions
1017+OAPIFUNC void oapiVCRegisterMFD (int mfd, const VCMFDSPEC *spec);
1018+OAPIFUNC void oapiVCRegisterArea (int id, const RECT &tgtrect, int draw_event, int mouse_event, int bkmode, SURFHANDLE tgt);
1019+OAPIFUNC void oapiVCRegisterArea (int id, int draw_event, int mouse_event);
1020+OAPIFUNC void oapiVCSetAreaClickmode_Spherical (int id, const VECTOR3 &cnt, double rad);
1021+OAPIFUNC void oapiVCSetAreaClickmode_Quadrilateral (int id, const VECTOR3 &p1, const VECTOR3 &p2, const VECTOR3 &p3, const VECTOR3 &p4);
1022+OAPIFUNC void oapiVCSetNeighbours (int left, int right, int top, int bottom);
1023+OAPIFUNC void oapiVCTriggerRedrawArea (int vc_id, int area_id);
1024+OAPIFUNC void oapiVCRegisterHUD (const VCHUDSPEC *spec);
1025+
1026+// Customisation - custom menu, dialogs
1027+OAPIFUNC LAUNCHPADITEM_HANDLE oapiRegisterLaunchpadItem (LaunchpadItem *item, LAUNCHPADITEM_HANDLE parent = 0);
1028+OAPIFUNC bool oapiUnregisterLaunchpadItem (LaunchpadItem *item);
1029+OAPIFUNC LAUNCHPADITEM_HANDLE oapiFindLaunchpadItem (const char *name = 0, LAUNCHPADITEM_HANDLE parent = 0);
1030+typedef void (*CustomFunc)(void *context);
1031+OAPIFUNC DWORD oapiRegisterCustomCmd (char *label, char *desc, CustomFunc func, void *context);
1032+OAPIFUNC bool oapiUnregisterCustomCmd (int cmdId);
1033+
1034+OAPIFUNC HWND oapiOpenDialog (HINSTANCE hDLLInst, int resourceId, DLGPROC msgProc, void *context = 0);
1035+OAPIFUNC HWND oapiOpenDialogEx (HINSTANCE hDLLInst, int resourceId, DLGPROC msgProc, DWORD flag = 0, void *context = 0);
1036+OAPIFUNC HWND oapiFindDialog (HINSTANCE hDLLInst, int resourceId);
1037+OAPIFUNC void oapiCloseDialog (HWND hDlg);
1038+OAPIFUNC void *oapiGetDialogContext (HWND hDlg);
1039+OAPIFUNC bool oapiAddTitleButton (DWORD msgid, HBITMAP hBmp, DWORD flag);
1040+OAPIFUNC DWORD oapiGetTitleButtonState (HWND hDlg, DWORD msgid);
1041+OAPIFUNC bool oapiSetTitleButtonState (HWND hDlg, DWORD msgid, DWORD state);
1042+OAPIFUNC BOOL oapiDefDialogProc (HWND hDlg, UINT uMsg, WPARAM wParam, LPARAM lParam);
1043+OAPIFUNC bool oapiOpenHelp (HELPCONTEXT *hcontext);
1044+
1045+// File IO
1046+OAPIFUNC FILEHANDLE oapiOpenFile (const char *fname, FileAccessMode mode, PathRoot root = ROOT);
1047+OAPIFUNC void oapiCloseFile (FILEHANDLE file, FileAccessMode mode);
1048+OAPIFUNC bool oapiSaveScenario (const char *fname, const char *desc);
1049+OAPIFUNC void oapiWriteLine (FILEHANDLE file, char *line);
1050+OAPIFUNC void oapiWriteLog (char *line);
1051+OAPIFUNC void oapiWriteScenario_string (FILEHANDLE scn, char *item, char *string);
1052+OAPIFUNC void oapiWriteScenario_int (FILEHANDLE scn, char *item, int i);
1053+OAPIFUNC void oapiWriteScenario_float (FILEHANDLE scn, char *item, double d);
1054+OAPIFUNC void oapiWriteScenario_vec (FILEHANDLE scn, char *item, const VECTOR3 &vec);
1055+OAPIFUNC bool oapiReadScenario_nextline (FILEHANDLE scn, char *&line);
1056+OAPIFUNC bool oapiReadItem_string (FILEHANDLE f, char *item, char *string);
1057+OAPIFUNC bool oapiReadItem_float (FILEHANDLE f, char *item, double &d);
1058+OAPIFUNC bool oapiReadItem_int (FILEHANDLE f, char *item, int &i);
1059+OAPIFUNC bool oapiReadItem_bool (FILEHANDLE f, char *item, bool &b);
1060+OAPIFUNC bool oapiReadItem_vec (FILEHANDLE f, char *item, VECTOR3 &vec);
1061+OAPIFUNC void oapiWriteItem_string (FILEHANDLE f, char *item, char *string);
1062+OAPIFUNC void oapiWriteItem_float (FILEHANDLE f, char *item, double d);
1063+OAPIFUNC void oapiWriteItem_int (FILEHANDLE f, char *item, int i);
1064+OAPIFUNC void oapiWriteItem_bool (FILEHANDLE f, char *item, bool b);
1065+OAPIFUNC void oapiWriteItem_vec (FILEHANDLE f, char *item, const VECTOR3 &vec);
1066+
1067+// Utility functions
1068+OAPIFUNC double oapiRand ();
1069+
1070+// User Input
1071+OAPIFUNC void oapiOpenInputBox (char *title, bool (*Clbk)(void*,char*,void*), char *buf = 0, int vislen = 20, void *usrdata = 0);
1072+
1073+// Onscreen annotations
1074+OAPIFUNC NOTEHANDLE oapiCreateAnnotation (bool exclusive, double size, const VECTOR3 &col);
1075+OAPIFUNC bool oapiDelAnnotation (NOTEHANDLE hNote);
1076+OAPIFUNC void oapiAnnotationSetPos (NOTEHANDLE hNote, double x1, double y1, double x2, double y2);
1077+OAPIFUNC void oapiAnnotationSetText (NOTEHANDLE hNote, char *note);
1078+
1079+// Debugging functions
1080+OAPIFUNC char *oapiDebugString ();
1081+OAPIFUNC void oapiSetTimeSteppingDebug (double step);
1082+
1083+// ======================================================================
1084+// keyboard key identifiers
1085+// ======================================================================
1086+
1087+#define OAPI_KEY_ESCAPE 0x01
1088+#define OAPI_KEY_1 0x02
1089+#define OAPI_KEY_2 0x03
1090+#define OAPI_KEY_3 0x04
1091+#define OAPI_KEY_4 0x05
1092+#define OAPI_KEY_5 0x06
1093+#define OAPI_KEY_6 0x07
1094+#define OAPI_KEY_7 0x08
1095+#define OAPI_KEY_8 0x09
1096+#define OAPI_KEY_9 0x0A
1097+#define OAPI_KEY_0 0x0B
1098+#define OAPI_KEY_MINUS 0x0C // on main keyboard
1099+#define OAPI_KEY_EQUALS 0x0D
1100+#define OAPI_KEY_BACK 0x0E // backspace
1101+#define OAPI_KEY_TAB 0x0F
1102+#define OAPI_KEY_Q 0x10
1103+#define OAPI_KEY_W 0x11
1104+#define OAPI_KEY_E 0x12
1105+#define OAPI_KEY_R 0x13
1106+#define OAPI_KEY_T 0x14
1107+#define OAPI_KEY_Y 0x15
1108+#define OAPI_KEY_U 0x16
1109+#define OAPI_KEY_I 0x17
1110+#define OAPI_KEY_O 0x18
1111+#define OAPI_KEY_P 0x19
1112+#define OAPI_KEY_LBRACKET 0x1A
1113+#define OAPI_KEY_RBRACKET 0x1B
1114+#define OAPI_KEY_RETURN 0x1C // Enter on main keyboard
1115+#define OAPI_KEY_LCONTROL 0x1D
1116+#define OAPI_KEY_A 0x1E
1117+#define OAPI_KEY_S 0x1F
1118+#define OAPI_KEY_D 0x20
1119+#define OAPI_KEY_F 0x21
1120+#define OAPI_KEY_G 0x22
1121+#define OAPI_KEY_H 0x23
1122+#define OAPI_KEY_J 0x24
1123+#define OAPI_KEY_K 0x25
1124+#define OAPI_KEY_L 0x26
1125+#define OAPI_KEY_SEMICOLON 0x27
1126+#define OAPI_KEY_APOSTROPHE 0x28
1127+#define OAPI_KEY_GRAVE 0x29 // accent grave
1128+#define OAPI_KEY_LSHIFT 0x2A
1129+#define OAPI_KEY_BACKSLASH 0x2B
1130+#define OAPI_KEY_Z 0x2C
1131+#define OAPI_KEY_X 0x2D
1132+#define OAPI_KEY_C 0x2E
1133+#define OAPI_KEY_V 0x2F
1134+#define OAPI_KEY_B 0x30
1135+#define OAPI_KEY_N 0x31
1136+#define OAPI_KEY_M 0x32
1137+#define OAPI_KEY_COMMA 0x33
1138+#define OAPI_KEY_PERIOD 0x34 // . on main keyboard
1139+#define OAPI_KEY_SLASH 0x35 // / on main keyboard
1140+#define OAPI_KEY_RSHIFT 0x36
1141+#define OAPI_KEY_MULTIPLY 0x37 // * on numeric keypad
1142+#define OAPI_KEY_LALT 0x38 // left Alt
1143+#define OAPI_KEY_SPACE 0x39
1144+#define OAPI_KEY_CAPITAL 0x3A // caps lock key
1145+#define OAPI_KEY_F1 0x3B
1146+#define OAPI_KEY_F2 0x3C
1147+#define OAPI_KEY_F3 0x3D
1148+#define OAPI_KEY_F4 0x3E
1149+#define OAPI_KEY_F5 0x3F
1150+#define OAPI_KEY_F6 0x40
1151+#define OAPI_KEY_F7 0x41
1152+#define OAPI_KEY_F8 0x42
1153+#define OAPI_KEY_F9 0x43
1154+#define OAPI_KEY_F10 0x44
1155+#define OAPI_KEY_NUMLOCK 0x45
1156+#define OAPI_KEY_SCROLL 0x46 // Scroll lock
1157+#define OAPI_KEY_NUMPAD7 0x47
1158+#define OAPI_KEY_NUMPAD8 0x48
1159+#define OAPI_KEY_NUMPAD9 0x49
1160+#define OAPI_KEY_SUBTRACT 0x4A // - on numeric keypad
1161+#define OAPI_KEY_NUMPAD4 0x4B
1162+#define OAPI_KEY_NUMPAD5 0x4C
1163+#define OAPI_KEY_NUMPAD6 0x4D
1164+#define OAPI_KEY_ADD 0x4E // + on numeric keypad
1165+#define OAPI_KEY_NUMPAD1 0x4F
1166+#define OAPI_KEY_NUMPAD2 0x50
1167+#define OAPI_KEY_NUMPAD3 0x51
1168+#define OAPI_KEY_NUMPAD0 0x52
1169+#define OAPI_KEY_DECIMAL 0x53 // . on numeric keypad
1170+#define OAPI_KEY_OEM_102 0x56 // | < > on UK/German keyboards
1171+#define OAPI_KEY_F11 0x57
1172+#define OAPI_KEY_F12 0x58
1173+#define OAPI_KEY_NUMPADENTER 0x9C // Enter on numeric keypad
1174+#define OAPI_KEY_RCONTROL 0x9D // right Control key
1175+#define OAPI_KEY_DIVIDE 0xB5 // / on numeric keypad
1176+#define OAPI_KEY_RALT 0xB8 // right Alt
1177+#define OAPI_KEY_HOME 0xC7 // Home on cursor keypad
1178+#define OAPI_KEY_UP 0xC8 // up-arrow on cursor keypad
1179+#define OAPI_KEY_PRIOR 0xC9 // PgUp on cursor keypad
1180+#define OAPI_KEY_LEFT 0xCB // left-arrow on cursor keypad
1181+#define OAPI_KEY_RIGHT 0xCD // right-arrow on cursor keypad
1182+#define OAPI_KEY_END 0xCF // End on cursor keypad
1183+#define OAPI_KEY_DOWN 0xD0 // down-arrow on cursor keypad
1184+#define OAPI_KEY_NEXT 0xD1 // PgDn on cursor keypad
1185+#define OAPI_KEY_INSERT 0xD2 // Insert on cursor keypad
1186+#define OAPI_KEY_DELETE 0xD3 // Delete on cursor keypad
1187+
1188+#define KEYDOWN(buf,key) (buf[key] & 0x80)
1189+#define RESETKEY(buf,key) (buf[key] = 0)
1190+
1191+#define KEYMOD_LSHIFT(buf) (KEYDOWN(buf,OAPI_KEY_LSHIFT))
1192+#define KEYMOD_RSHIFT(buf) (KEYDOWN(buf,OAPI_KEY_RSHIFT))
1193+#define KEYMOD_SHIFT(buf) (KEYMOD_LSHIFT(buf) || KEYMOD_RSHIFT(buf))
1194+#define KEYMOD_LCONTROL(buf) (KEYDOWN(buf,OAPI_KEY_LCONTROL))
1195+#define KEYMOD_RCONTROL(buf) (KEYDOWN(buf,OAPI_KEY_RCONTROL))
1196+#define KEYMOD_CONTROL(buf) (KEYMOD_LCONTROL(buf) || KEYMOD_RCONTROL(buf))
1197+#define KEYMOD_LALT(buf) (KEYDOWN(buf,OAPI_KEY_LALT))
1198+#define KEYMOD_RALT(buf) (KEYDOWN(buf,OAPI_KEY_RALT))
1199+#define KEYMOD_ALT(buf) (KEYMOD_LALT(buf) || KEYMOD_RALT(buf))
1200+
1201+// ======================================================================
1202+// Logical key ids
1203+// ======================================================================
1204+
1205+#define OAPI_LKEY_CockpitRotateLeft 0
1206+#define OAPI_LKEY_CockpitRotateRight 1
1207+#define OAPI_LKEY_CockpitRotateUp 2
1208+#define OAPI_LKEY_CockpitRotateDown 3
1209+#define OAPI_LKEY_CockpitDontLean 4
1210+#define OAPI_LKEY_CockpitLeanForward 5
1211+#define OAPI_LKEY_CockpitLeanLeft 6
1212+#define OAPI_LKEY_CockpitLeanRight 7
1213+#define OAPI_LKEY_CockpitResetCam 8
1214+#define OAPI_LKEY_PanelShiftLeft 9
1215+#define OAPI_LKEY_PanelShiftRight 10
1216+#define OAPI_LKEY_PanelShiftUp 11
1217+#define OAPI_LKEY_PanelShiftDown 12
1218+#define OAPI_LKEY_PanelSwitchLeft 13
1219+#define OAPI_LKEY_PanelSwitchRight 14
1220+#define OAPI_LKEY_PanelSwitchUp 15
1221+#define OAPI_LKEY_PanelSwitchDown 16
1222+#define OAPI_LKEY_TrackRotateLeft 17
1223+#define OAPI_LKEY_TrackRotateRight 18
1224+#define OAPI_LKEY_TrackRotateUp 19
1225+#define OAPI_LKEY_TrackRotateDown 20
1226+#define OAPI_LKEY_TrackAdvance 21
1227+#define OAPI_LKEY_TrackRetreat 22
1228+#define OAPI_LKEY_GroundTiltLeft 23
1229+#define OAPI_LKEY_GroundTiltRight 24
1230+#define OAPI_LKEY_GroundTiltUp 25
1231+#define OAPI_LKEY_GroundTiltDown 26
1232+#define OAPI_LKEY_IncMainThrust 27 // +-
1233+#define OAPI_LKEY_DecMainThrust 28 // |
1234+#define OAPI_LKEY_KillMainRetro 29 // |
1235+#define OAPI_LKEY_FullMainThrust 30 // | Main/retro/hover engine control
1236+#define OAPI_LKEY_FullRetroThrust 31 // |
1237+#define OAPI_LKEY_IncHoverThrust 32 // |
1238+#define OAPI_LKEY_DecHoverThrust 33 // +-
1239+#define OAPI_LKEY_RCSEnable 34
1240+#define OAPI_LKEY_RCSMode 35
1241+#define OAPI_LKEY_RCSPitchUp 36 // +-
1242+#define OAPI_LKEY_RCSPitchDown 37 // |
1243+#define OAPI_LKEY_RCSYawLeft 38 // | Reaction control
1244+#define OAPI_LKEY_RCSYawRight 39 // | (rotational mode)
1245+#define OAPI_LKEY_RCSBankLeft 40 // |
1246+#define OAPI_LKEY_RCSBankRight 41 // +-
1247+#define OAPI_LKEY_RCSUp 42 // +-
1248+#define OAPI_LKEY_RCSDown 43 // |
1249+#define OAPI_LKEY_RCSLeft 44 // | Reaction control
1250+#define OAPI_LKEY_RCSRight 45 // | (linear mode)
1251+#define OAPI_LKEY_RCSForward 46 // |
1252+#define OAPI_LKEY_RCSBack 47 // +-
1253+#define OAPI_LKEY_LPRCSPitchUp 48 // +-
1254+#define OAPI_LKEY_LPRCSPitchDown 49 // |
1255+#define OAPI_LKEY_LPRCSYawLeft 50 // | Reaction control - low power
1256+#define OAPI_LKEY_LPRCSYawRight 51 // | (rotational mode)
1257+#define OAPI_LKEY_LPRCSBankLeft 52 // |
1258+#define OAPI_LKEY_LPRCSBankRight 53 // +-
1259+#define OAPI_LKEY_LPRCSUp 54 // +-
1260+#define OAPI_LKEY_LPRCSDown 55 // |
1261+#define OAPI_LKEY_LPRCSLeft 56 // | Reaction control - low power
1262+#define OAPI_LKEY_LPRCSRight 57 // | (linear mode)
1263+#define OAPI_LKEY_LPRCSForward 58 // |
1264+#define OAPI_LKEY_LPRCSBack 59 // +-
1265+#define OAPI_LKEY_NMHoldAltitude 60 // +-
1266+#define OAPI_LKEY_NMHLevel 61 // |
1267+#define OAPI_LKEY_NMPrograde 62 // |
1268+#define OAPI_LKEY_NMRetrograde 63 // | Navigation computer modes
1269+#define OAPI_LKEY_NMNormal 64 // |
1270+#define OAPI_LKEY_NMAntinormal 65 // |
1271+#define OAPI_LKEY_NMKillrot 66 // +-
1272+#define OAPI_LKEY_Undock 67
1273+#define OAPI_LKEY_IncElevatorTrim 68
1274+#define OAPI_LKEY_DecElevatorTrim 69
1275+#define OAPI_LKEY_WheelbrakeLeft 70
1276+#define OAPI_LKEY_WheelbrakeRight 71
1277+#define OAPI_LKEY_HUD 72
1278+#define OAPI_LKEY_HUDMode 73
1279+#define OAPI_LKEY_HUDReference 74
1280+#define OAPI_LKEY_HUDTarget 75
1281+#define OAPI_LKEY_HUDColour 76
1282+#define OAPI_LKEY_IncSimSpeed 77
1283+#define OAPI_LKEY_DecSimSpeed 78
1284+#define OAPI_LKEY_IncFOV 79
1285+#define OAPI_LKEY_DecFOV 80
1286+#define OAPI_LKEY_MainMenu 81
1287+#define OAPI_LKEY_DlgHelp 82
1288+#define OAPI_LKEY_DlgCamera 83
1289+#define OAPI_LKEY_DlgSimspeed 84
1290+#define OAPI_LKEY_DlgCustomCmd 85
1291+#define OAPI_LKEY_DlgVisHelper 86
1292+#define OAPI_LKEY_DlgRecorder 87
1293+#define OAPI_LKEY_DlgInfo 88
1294+#define OAPI_LKEY_DlgMap 89
1295+#define OAPI_LKEY_DlgNavaid 90
1296+#define OAPI_LKEY_ToggleInfo 91
1297+#define OAPI_LKEY_ToggleFPS 92
1298+#define OAPI_LKEY_ToggleCamInternal 93
1299+#define OAPI_LKEY_ToggleTrackMode 94
1300+#define OAPI_LKEY_TogglePanelMode 95
1301+#define OAPI_LKEY_TogglePlanetarium 96
1302+#define OAPI_LKEY_ToggleRecPlay 97
1303+#define LKEY_COUNT 98
1304+
1305+// ======================================================================
1306+// Some helper functions
1307+// ======================================================================
1308+
1309+inline VECTOR3 _V(double x, double y, double z)
1310+{
1311+ VECTOR3 vec = {x,y,z}; return vec;
1312+}
1313+
1314+inline void veccpy (VECTOR3 &a, const VECTOR3 &b)
1315+{
1316+ a.x = b.x;
1317+ a.y = b.y;
1318+ a.z = b.z;
1319+}
1320+
1321+inline VECTOR3 operator+ (const VECTOR3 &a, const VECTOR3 &b)
1322+{
1323+ VECTOR3 c;
1324+ c.x = a.x+b.x;
1325+ c.y = a.y+b.y;
1326+ c.z = a.z+b.z;
1327+ return c;
1328+}
1329+
1330+inline VECTOR3 operator- (const VECTOR3 &a, const VECTOR3 &b)
1331+{
1332+ VECTOR3 c;
1333+ c.x = a.x-b.x;
1334+ c.y = a.y-b.y;
1335+ c.z = a.z-b.z;
1336+ return c;
1337+}
1338+
1339+inline VECTOR3 operator* (const VECTOR3 &a, const double f)
1340+{
1341+ VECTOR3 c;
1342+ c.x = a.x*f;
1343+ c.y = a.y*f;
1344+ c.z = a.z*f;
1345+ return c;
1346+}
1347+
1348+inline VECTOR3 operator/ (const VECTOR3 &a, const double f)
1349+{
1350+ VECTOR3 c;
1351+ c.x = a.x/f;
1352+ c.y = a.y/f;
1353+ c.z = a.z/f;
1354+ return c;
1355+}
1356+
1357+inline VECTOR3 &operator+= (VECTOR3 &a, const VECTOR3 &b)
1358+{
1359+ a.x += b.x;
1360+ a.y += b.y;
1361+ a.z += b.z;
1362+ return a;
1363+}
1364+
1365+inline VECTOR3 &operator-= (VECTOR3 &a, const VECTOR3 &b)
1366+{
1367+ a.x -= b.x;
1368+ a.y -= b.y;
1369+ a.z -= b.z;
1370+ return a;
1371+}
1372+
1373+inline VECTOR3 &operator*= (VECTOR3 &a, const double f)
1374+{
1375+ a.x *= f;
1376+ a.y *= f;
1377+ a.z *= f;
1378+ return a;
1379+}
1380+
1381+inline VECTOR3 &operator/= (VECTOR3 &a, const double f)
1382+{
1383+ a.x /= f;
1384+ a.y /= f;
1385+ a.z /= f;
1386+ return a;
1387+}
1388+
1389+inline VECTOR3 operator- (const VECTOR3 &a)
1390+{
1391+ VECTOR3 c;
1392+ c.x = -a.x;
1393+ c.y = -a.y;
1394+ c.z = -a.z;
1395+ return c;
1396+}
1397+
1398+inline double dotp (const VECTOR3 &a, const VECTOR3 &b)
1399+{
1400+ return a.x*b.x + a.y*b.y + a.z*b.z;
1401+}
1402+
1403+inline VECTOR3 crossp (const VECTOR3 &a, const VECTOR3 &b)
1404+{
1405+ return _V(a.y*b.z - b.y*a.z, a.z*b.x - b.z*a.x, a.x*b.y - b.x*a.y);
1406+}
1407+
1408+inline double length (const VECTOR3 &a)
1409+{
1410+ return sqrt (a.x*a.x + a.y*a.y + a.z*a.z);
1411+}
1412+
1413+inline double dist (const VECTOR3 &a, const VECTOR3 &b)
1414+{
1415+ return length (a-b);
1416+}
1417+
1418+inline MATRIX3 _M(double m11, double m12, double m13,
1419+ double m21, double m22, double m23,
1420+ double m31, double m32, double m33)
1421+{
1422+ MATRIX3 mat = {m11,m12,m13, m21,m22,m23, m31,m32,m33};
1423+ return mat;
1424+}
1425+
1426+inline VECTOR3 mul (const MATRIX3 &A, const VECTOR3 &b)
1427+{
1428+ return _V (
1429+ A.m11*b.x + A.m12*b.y + A.m13*b.z,
1430+ A.m21*b.x + A.m22*b.y + A.m23*b.z,
1431+ A.m31*b.x + A.m32*b.y + A.m33*b.z);
1432+}
1433+
1434+inline VECTOR3 tmul (const MATRIX3 &A, const VECTOR3 &b)
1435+{
1436+ return _V (
1437+ A.m11*b.x + A.m21*b.y + A.m31*b.z,
1438+ A.m12*b.x + A.m22*b.y + A.m32*b.z,
1439+ A.m13*b.x + A.m23*b.y + A.m33*b.z);
1440+}
1441+
1442+inline MATRIX3 mul (const MATRIX3 &A, const MATRIX3 &B)
1443+{
1444+ MATRIX3 mat = {
1445+ A.m11*B.m11 + A.m12*B.m21 + A.m13*B.m31, A.m11*B.m12 + A.m12*B.m22 + A.m13*B.m32, A.m11*B.m13 + A.m12*B.m23 + A.m13*B.m33,
1446+ A.m21*B.m11 + A.m22*B.m21 + A.m23*B.m31, A.m21*B.m12 + A.m22*B.m22 + A.m23*B.m32, A.m21*B.m13 + A.m22*B.m23 + A.m23*B.m33,
1447+ A.m31*B.m11 + A.m32*B.m21 + A.m33*B.m31, A.m31*B.m12 + A.m32*B.m22 + A.m33*B.m32, A.m31*B.m13 + A.m32*B.m23 + A.m33*B.m33
1448+ };
1449+ return mat;
1450+}
1451+
1452+inline RECT _R (int left, int top, int right, int bottom)
1453+{
1454+ RECT r = { left, top, right, bottom }; return r;
1455+}
1456+
1457+inline VECTOR3 POINTERTOREF (VECTOR3 *p)
1458+{
1459+ VECTOR3 v;
1460+ v.x = DBL_MAX; // flag
1461+ *((VECTOR3**)&v.z) = p; // address
1462+ v.z = 0.0;
1463+ return v;
1464+}
1465+
1466+// ======================================================================
1467+// Internal data structures
1468+// ======================================================================
1469+
1470+#ifdef ORBITER_MODULE
1471+void dummy();
1472+void calldummy () { dummy(); }
1473+#endif
1474+
1475+#endif // !__ORBITERAPI_H
\ No newline at end of file
diff -r 975d62cbb663 -r 2783da92d533 Orbitersdk/include/VesselAPI.h
--- a/Orbitersdk/include/VesselAPI.h Thu Apr 24 19:52:45 2008 +0200
+++ /dev/null Thu Jan 01 00:00:00 1970 +0000
@@ -1,458 +0,0 @@
1-// ======================================================================
2-// ORBITER SOFTWARE DEVELOPMENT KIT
3-// Copyright (C) 2001-2004 Martin Schweiger
4-// All rights reserved
5-// VesselAPI.h
6-// - VESSEL class interface
7-// - VESSEL2 class extensions
8-// ======================================================================
9-
10-#ifndef __VESSELAPI_H
11-#define __VESSELAPI_H
12-
13-// reference frame flags
14-#define FRAME_ECL 0
15-#define FRAME_EQU 1
16-
17-class Vessel; // Orbiter internal vessel class
18-
19-// ======================================================================
20-// class VESSEL
21-// This is the base class for addon vessel classes.
22-// ======================================================================
23-
24-class DLLEXPORT VESSEL {
25-public:
26- VESSEL (OBJHANDLE hVessel, int fmodel = 1);
27- inline int Version() const { return version; }
28- static OBJHANDLE Create (const char *name, const char *classname, const VESSELSTATUS &status);
29- const OBJHANDLE GetHandle (void) const;
30- char *GetName (void) const;
31-#ifdef USESDOTNETWORKAROUNDS
32- char *GetClassNameA (void) const;
33-#else
34- char *GetClassName (void) const;
35-#endif
36- int GetFlightModel (void) const;
37- int GetDamageModel (void) const;
38- bool GetEnableFocus (void) const;
39- double GetSize (void) const;
40- void SetSize (double) const;
41- void SetVisibilityLimit (double vislimit, double spotlimit = -1) const;
42- double GetClipRadius (void) const;
43- void SetClipRadius (double) const;
44- double GetMass (void) const;
45- double GetEmptyMass (void) const;
46- double GetISP (void) const;
47- double GetMaxThrust (ENGINETYPE eng) const;
48- double GetEngineLevel (ENGINETYPE eng) const;
49- double *GetMainThrustModPtr (void) const;
50- int GetAttitudeMode (void) const;
51- bool SetAttitudeMode (int mode) const;
52- int ToggleAttitudeMode (void) const;
53- DWORD GetADCtrlMode (void) const;
54- void SetADCtrlMode (DWORD mode) const;
55- void GetAttitudeRotLevel (VECTOR3 &th) const;
56- void GetAttitudeLinLevel (VECTOR3 &th) const;
57- double GetManualControlLevel (THGROUP_TYPE thgt, DWORD mode = MANCTRL_ATTMODE, DWORD device = MANCTRL_ANYDEVICE) const;
58- double GetCOG_elev (void) const;
59- void GetCrossSections (VECTOR3 &cs) const;
60- void GetCW (double &cw_z_pos, double &cw_z_neg, double &cw_x, double &cw_y) const;
61- double GetWingAspect (void) const;
62- double GetWingEffectiveness (void) const;
63- void GetRotDrag (VECTOR3&) const;
64- double GetPitchMomentScale (void) const;
65- double GetBankMomentScale (void) const;
66- double GetTrimScale (void) const;
67- void GetPMI (VECTOR3&) const;
68- void GetCameraOffset (VECTOR3&) const;
69- void GetCameraDefaultDirection (VECTOR3&) const;
70- void GetStatus (VESSELSTATUS &status) const;
71- void GetStatusEx (void *status) const;
72- DWORD GetFlightStatus (void) const;
73- const OBJHANDLE GetGravityRef () const;
74- const OBJHANDLE GetSurfaceRef () const;
75- const OBJHANDLE GetAtmRef () const;
76- double GetAtmTemperature (void) const;
77- double GetAtmDensity (void) const;
78- double GetAtmPressure (void) const;
79- double GetDynPressure (void) const;
80- double GetMachNumber (void) const;
81- double GetAltitude (void) const;
82- double GetAirspeed (void) const;
83- bool GetHorizonAirspeedVector (VECTOR3 &v) const;
84- bool GetShipAirspeedVector (VECTOR3 &v) const;
85- double GetAOA (void) const;
86- double GetSlipAngle (void) const;
87- double GetPitch (void) const;
88- double GetBank (void) const;
89- void GetGlobalPos (VECTOR3 &pos) const;
90- void GetGlobalVel (VECTOR3 &vel) const;
91- void GetRelativePos (OBJHANDLE hRef, VECTOR3 &pos) const;
92- void GetRelativeVel (OBJHANDLE hRef, VECTOR3 &vel) const;
93- void GetLinearMoment (VECTOR3 &F) const;
94- void GetAngularVel (VECTOR3 &avel) const;
95- void SetAngularVel (const VECTOR3 &avel) const;
96- void GetAngularAcc (VECTOR3 &aacc) const;
97- void GetAngularMoment (VECTOR3 &amom) const;
98- void GetGlobalOrientation (VECTOR3 &arot) const;
99- void SetGlobalOrientation (const VECTOR3 &arot) const;
100- OBJHANDLE GetEquPos (double &longitude, double &latitude, double &radius) const;
101- OBJHANDLE GetElements (ELEMENTS &el, double &mjd_ref) const;
102- bool GetElements (OBJHANDLE hRef, ELEMENTS &el, ORBITPARAM *prm = 0, double mjd_ref = 0, int frame = FRAME_ECL) const;
103- bool SetElements (OBJHANDLE hRef, const ELEMENTS &el, ORBITPARAM *prm = 0, double mjd_ref = 0, int frame = FRAME_ECL) const;
104- OBJHANDLE GetArgPer (double &arg) const;
105- OBJHANDLE GetSMi (double &smi) const;
106- OBJHANDLE GetApDist (double &apdist) const;
107- OBJHANDLE GetPeDist (double &pedist) const;
108- void SetEnableFocus (bool enable) const;
109- void SetEmptyMass (double m) const;
110- bool SetGravityGradientDamping (double damp) const;
111- double GetGravityGradientDamping (void) const;
112- void SetISP (double) const;
113- void SetMaxThrust (ENGINETYPE eng, double th) const;
114- void SetEngineLevel (ENGINETYPE eng, double level) const;
115- void IncEngineLevel (ENGINETYPE eng, double dlevel) const;
116- void SetAttitudeRotLevel (const VECTOR3 &th) const;
117- void SetAttitudeRotLevel (int axis, double th) const;
118- void SetAttitudeLinLevel (const VECTOR3 &th) const;
119- void SetAttitudeLinLevel (int axis, double th) const;
120- bool ActivateNavmode (int mode);
121- bool DeactivateNavmode (int mode);
122- bool ToggleNavmode (int mode);
123- bool GetNavmodeState (int mode);
124- void SetCOG_elev (double h) const;
125- void SetCrossSections (const VECTOR3&) const;
126- void SetCW (double cw_z_pos, double cw_z_neg, double cw_x, double cw_y) const;
127- void SetWingAspect (double aspect) const;
128- void SetWingEffectiveness (double eff) const;
129- void SetRotDrag (const VECTOR3 &rd) const;
130- void SetPitchMomentScale (double scale) const;
131- void SetBankMomentScale (double scale) const;
132- void SetPMI (const VECTOR3 &pmi) const;
133- void SetAlbedoRGB (const VECTOR3 &albedo) const;
134- void SetTrimScale (double scale) const;
135- void SetCameraOffset (const VECTOR3 &co) const;
136- void SetCameraDefaultDirection (const VECTOR3 &cd) const;
137- void SetCameraDefaultDirection (const VECTOR3 &cd, double tilt) const;
138- void SetCameraRotationRange (double left, double right, double up, double down) const;
139- void SetCameraShiftRange (const VECTOR3 &fpos, const VECTOR3 &lpos, const VECTOR3 &rpos) const;
140- void SetCameraMovement (const VECTOR3 &fpos, double fphi, double ftht, const VECTOR3 &lpos, double lphi, double ltht, const VECTOR3 &rpos, double rphi, double rtht) const;
141- void SetLiftCoeffFunc (LiftCoeffFunc lcf) const;
142- void SetTouchdownPoints (const VECTOR3 &pt1, const VECTOR3 &pt2, const VECTOR3 &pt3) const;
143- void GetTouchdownPoints (VECTOR3 &pt1, VECTOR3 &pt2, VECTOR3 &pt3) const;
144- void DefSetState (const VESSELSTATUS *status) const;
145- void DefSetStateEx (const void *status) const;
146- void SaveDefaultState (FILEHANDLE scn) const;
147- void ParseScenarioLine (char *line, VESSELSTATUS *status) const;
148- void ParseScenarioLineEx (char *line, void *status) const;
149- void ClearMeshes () const;
150- void ClearMeshes (bool retain_anim) const;
151- UINT AddMesh (const char *meshname, const VECTOR3 *ofs=0) const;
152- UINT AddMesh (MESHHANDLE hMesh, const VECTOR3 *ofs=0) const;
153- UINT InsertMesh (const char *meshname, UINT idx, const VECTOR3 *ofs=0) const;
154- UINT InsertMesh (MESHHANDLE hMesh, UINT idx, const VECTOR3 *ofs=0) const;
155- bool DelMesh (UINT idx, bool retain_anim=false) const;
156- bool ShiftMesh (UINT idx, const VECTOR3 &ofs) const;
157- void ShiftMeshes (const VECTOR3 &ofs) const;
158- MESHHANDLE GetMesh (VISHANDLE vis, UINT idx) const;
159- void SetMeshVisibilityMode (UINT meshidx, WORD mode) const;
160- void SetMeshVisibleInternal (UINT meshidx, bool visible) const;
161- bool MeshgroupTransform (VISHANDLE vis, const MESHGROUP_TRANSFORM &mt) const;
162- void SetExhaustScales (EXHAUSTTYPE exh, WORD id, double lscale, double wscale) const;
163- void SetReentryTexture (SURFHANDLE tex, double plimit=6e7, double lscale=1.0, double wscale=1.0) const;
164- void ShiftCentreOfMass (const VECTOR3 &shift);
165- void ShiftCG (const VECTOR3 &shift);
166- void AddForce (const VECTOR3 &F, const VECTOR3 &r) const;
167-
168- // vessel forces: vectors
169- bool GetWeightVector (VECTOR3 &G) const;
170- bool GetThrustVector (VECTOR3 &T) const;
171- bool GetLiftVector (VECTOR3 &L) const;
172- bool GetDragVector (VECTOR3 &D) const;
173- bool GetForceVector (VECTOR3 &F) const;
174-
175- // vessel forces: magnitudes
176- double GetLift (void) const;
177- double GetDrag (void) const;
178-
179- // Animations
180- void RegisterAnimation (void) const;
181- void UnregisterAnimation (void) const;
182- UINT RegisterAnimSequence (double defmeshstate) const; // obsolete
183- bool AddAnimComp (UINT seq, ANIMCOMP *comp); // obsolete
184- bool SetAnimState (UINT seq, double state); // obsolete
185- UINT CreateAnimation (double initial_state) const;
186- bool DelAnimation (UINT anim) const;
187- ANIMATIONCOMPONENT_HANDLE AddAnimationComponent (UINT anim, double state0, double state1,
188- MGROUP_TRANSFORM *trans, ANIMATIONCOMPONENT_HANDLE parent = NULL) const;
189- bool DelAnimationComponent (UINT anim, ANIMATIONCOMPONENT_HANDLE hAC);
190- bool SetAnimation (UINT anim, double state) const;
191-
192- // Recording/playback functions
193- bool Recording (void) const;
194- bool Playback (void) const;
195- void RecordEvent (const char *event_type, const char *event) const;
196-
197- // Transformations
198- void GetRotationMatrix (MATRIX3 &R) const;
199- void SetRotationMatrix (const MATRIX3 &R) const;
200- void GlobalRot (const VECTOR3 &rloc, VECTOR3 &rglob) const;
201- void HorizonRot (const VECTOR3 &rloc, VECTOR3 &rhorizon) const;
202- void HorizonInvRot (const VECTOR3 &rhorizon, VECTOR3 &rloc) const;
203- void Local2Global (const VECTOR3 &local, VECTOR3 &global) const;
204- void Global2Local (const VECTOR3 &global, VECTOR3 &local) const;
205- void Local2Rel (const VECTOR3 &local, VECTOR3 &rel) const;
206-
207- // Propellant resource management
208- PROPELLANT_HANDLE CreatePropellantResource (double maxmass, double mass=-1.0, double efficiency=1.0) const;
209- void DelPropellantResource (PROPELLANT_HANDLE &ph) const;
210- void ClearPropellantResources (void) const;
211- PROPELLANT_HANDLE GetPropellantHandleByIndex (DWORD idx) const;
212- DWORD GetPropellantCount (void) const;
213- void SetDefaultPropellantResource (PROPELLANT_HANDLE ph) const;
214- void SetPropellantMaxMass (PROPELLANT_HANDLE ph, double maxmass) const;
215- void SetPropellantEfficiency (PROPELLANT_HANDLE ph, double efficiency) const;
216- void SetPropellantMass (PROPELLANT_HANDLE ph, double mass) const;
217- double GetPropellantMaxMass (PROPELLANT_HANDLE ph) const;
218- double GetPropellantEfficiency (PROPELLANT_HANDLE ph) const;
219- double GetPropellantMass (PROPELLANT_HANDLE ph) const;
220- double GetPropellantFlowrate (PROPELLANT_HANDLE ph) const;
221- double GetTotalPropellantMass (void) const;
222- double GetTotalPropellantFlowrate (void) const;
223- // The following legacy functions act on the vessel's _default_ propellant resource
224- double GetFuelMass (void) const;
225- double GetFuelRate (void) const;
226- void SetFuelMass (double m) const;
227- void SetMaxFuelMass (double m) const;
228- double GetMaxFuelMass (void) const;
229-
230- // Thruster management
231- THRUSTER_HANDLE CreateThruster (const VECTOR3 &pos, const VECTOR3 &dir, double maxth0,
232- PROPELLANT_HANDLE hp=NULL, double isp0=0.0, double isp_ref=0.0, double p_ref=101.4e3) const;
233- bool DelThruster (THRUSTER_HANDLE &th) const;
234- void ClearThrusterDefinitions () const;
235- THRUSTER_HANDLE GetThrusterHandleByIndex (DWORD idx) const;
236- DWORD GetThrusterCount (void) const;
237- void SetThrusterRef (THRUSTER_HANDLE th, const VECTOR3 &pos) const;
238- void SetThrusterDir (THRUSTER_HANDLE th, const VECTOR3 &dir) const;
239- void SetThrusterMax0 (THRUSTER_HANDLE th, double maxth0) const;
240- double GetThrusterMax0 (THRUSTER_HANDLE th) const;
241- double GetThrusterMax (THRUSTER_HANDLE th) const;
242- double GetThrusterMax (THRUSTER_HANDLE th, double p_ref) const;
243- void SetThrusterIsp (THRUSTER_HANDLE th, double isp) const;
244- void SetThrusterIsp (THRUSTER_HANDLE th, double isp0, double isp_ref, double p_ref=101.4e3) const;
245- double GetThrusterIsp (THRUSTER_HANDLE th) const;
246- double GetThrusterIsp (THRUSTER_HANDLE th, double p_ref) const;
247- double GetThrusterIsp0 (THRUSTER_HANDLE th) const;
248- void SetThrusterResource (THRUSTER_HANDLE th, PROPELLANT_HANDLE ph) const;
249- PROPELLANT_HANDLE GetThrusterResource (THRUSTER_HANDLE th) const;
250- void SetThrusterLevel (THRUSTER_HANDLE th, double level) const;
251- void IncThrusterLevel (THRUSTER_HANDLE th, double dlevel) const;
252- void SetThrusterLevel_SingleStep (THRUSTER_HANDLE th, double level) const;
253- void IncThrusterLevel_SingleStep (THRUSTER_HANDLE th, double dlevel) const;
254- void GetThrusterRef (THRUSTER_HANDLE th, VECTOR3 &pos) const;
255- void GetThrusterDir (THRUSTER_HANDLE th, VECTOR3 &dir) const;
256- double GetThrusterLevel (THRUSTER_HANDLE th) const;
257- void GetThrusterMoment (THRUSTER_HANDLE th, VECTOR3 &F, VECTOR3 &T) const;
258-
259- // Thruster group management
260- THGROUP_HANDLE CreateThrusterGroup (THRUSTER_HANDLE *th, int nth, THGROUP_TYPE thgt) const;
261- bool DelThrusterGroup (THGROUP_HANDLE &thg, THGROUP_TYPE thgt, bool delth = false) const;
262- bool DelThrusterGroup (THGROUP_TYPE thgt, bool delth = false) const;
263- THGROUP_HANDLE GetThrusterGroupHandle (THGROUP_TYPE thgt) const;
264- THGROUP_HANDLE GetUserThrusterGroupHandleByIndex (DWORD idx) const;
265- DWORD GetGroupThrusterCount (THGROUP_HANDLE thg) const;
266- DWORD GetGroupThrusterCount (THGROUP_TYPE thgt) const;
267- THRUSTER_HANDLE GetGroupThruster (THGROUP_HANDLE thg, DWORD idx) const;
268- THRUSTER_HANDLE GetGroupThruster (THGROUP_TYPE thgt, DWORD idx) const;
269- DWORD GetUserThrusterGroupCount (void) const;
270- bool ThrusterGroupDefined (THGROUP_TYPE thgt) const;
271- void SetThrusterGroupLevel (THGROUP_HANDLE thg, double level) const;
272- void SetThrusterGroupLevel (THGROUP_TYPE thgt, double level) const;
273- void IncThrusterGroupLevel (THGROUP_HANDLE thg, double dlevel) const;
274- void IncThrusterGroupLevel (THGROUP_TYPE thgt, double dlevel) const;
275- void IncThrusterGroupLevel_SingleStep (THGROUP_HANDLE thg, double dlevel) const;
276- void IncThrusterGroupLevel_SingleStep (THGROUP_TYPE thgt, double dlevel) const;
277- double GetThrusterGroupLevel (THGROUP_HANDLE thg) const;
278- double GetThrusterGroupLevel (THGROUP_TYPE thgt) const;
279-
280- // Exhaust render functions
281- UINT AddExhaust (THRUSTER_HANDLE th, double lscale, double wscale, SURFHANDLE tex = 0) const;
282- UINT AddExhaust (THRUSTER_HANDLE th, double lscale, double wscale, double lofs, SURFHANDLE tex = 0) const;
283- UINT AddExhaust (THRUSTER_HANDLE th, double lscale, double wscale, const VECTOR3 &pos, const VECTOR3 &dir, SURFHANDLE tex = 0) const;
284- bool DelExhaust (UINT idx) const;
285- UINT AddExhaustRef (EXHAUSTTYPE exh, VECTOR3 &pos, double lscale = -1.0, double wscale = -1.0, VECTOR3 *dir = 0) const; // obsolete
286- void DelExhaustRef (EXHAUSTTYPE exh, WORD id) const; // obsolete
287- void ClearExhaustRefs (void) const; // obsolete
288- UINT AddAttExhaustRef (const VECTOR3 &pos, const VECTOR3 &dir, double wscale = 1.0, double lscale = 1.0) const; // obsolete
289- void AddAttExhaustMode (UINT idx, ATTITUDEMODE mode, int axis, int dir) const; // obsolete
290- void ClearAttExhaustRefs (void) const; // obsolete
291-
292- // Particle systems
293- PSTREAM_HANDLE AddParticleStream (PARTICLESTREAMSPEC *pss, const VECTOR3 &pos, const VECTOR3 &dir, double *lvl) const;
294- PSTREAM_HANDLE AddExhaustStream (THRUSTER_HANDLE th, PARTICLESTREAMSPEC *pss = 0) const;
295- PSTREAM_HANDLE AddExhaustStream (THRUSTER_HANDLE th, const VECTOR3 &pos, PARTICLESTREAMSPEC *pss = 0) const;
296- PSTREAM_HANDLE AddReentryStream (PARTICLESTREAMSPEC *pss) const;
297- bool DelExhaustStream (PSTREAM_HANDLE ch) const;
298-
299- // Airfoil and control surface functions
300- void CreateAirfoil (AIRFOIL_ORIENTATION align, const VECTOR3 &ref, AirfoilCoeffFunc cf, double c, double S, double A) const;
301- AIRFOILHANDLE CreateAirfoil2 (AIRFOIL_ORIENTATION align, const VECTOR3 &ref, AirfoilCoeffFunc cf, double c, double S, double A) const;
302- AIRFOILHANDLE CreateAirfoil3 (AIRFOIL_ORIENTATION align, const VECTOR3 &ref, AirfoilCoeffFuncEx cf, void *context, double c, double S, double A) const;
303- void EditAirfoil (AIRFOILHANDLE hAirfoil, DWORD flag, const VECTOR3 &ref, AirfoilCoeffFunc cf, double c, double S, double A) const;
304- bool DelAirfoil (AIRFOILHANDLE hAirfoil) const;
305- void ClearAirfoilDefinitions (void) const;
306- void CreateControlSurface (AIRCTRL_TYPE type, double area, double dCl, const VECTOR3 &ref, int axis = AIRCTRL_AXIS_AUTO, UINT anim = (UINT)-1) const;
307- CTRLSURFHANDLE CreateControlSurface2 (AIRCTRL_TYPE type, double area, double dCl, const VECTOR3 &ref, int axis = AIRCTRL_AXIS_AUTO, UINT anim = (UINT)-1) const;
308- bool DelControlSurface (CTRLSURFHANDLE hCtrlSurf) const;
309- void ClearControlSurfaceDefinitions (void) const;
310- void SetControlSurfaceLevel (AIRCTRL_TYPE type, double level) const;
311- double GetControlSurfaceLevel (AIRCTRL_TYPE type) const;
312- void CreateVariableDragElement (double *drag, double factor, const VECTOR3 &ref) const;
313- void ClearVariableDragElements () const;
314-
315- // Nosewheel-steering
316- void SetNosewheelSteering (bool activate) const;
317- bool GetNosewheelSteering (void) const;
318-
319- // Docking port management
320- DOCKHANDLE CreateDock (const VECTOR3 &pos, const VECTOR3 &dir, const VECTOR3 &rot) const;
321- bool DelDock (DOCKHANDLE hDock) const;
322- void ClearDockDefinitions (void) const;
323- void SetDockParams (const VECTOR3 &pos, const VECTOR3 &dir, const VECTOR3 &rot) const;
324- void SetDockParams (DOCKHANDLE hDock, const VECTOR3 &pos, const VECTOR3 &dir, const VECTOR3 &rot) const;
325- void GetDockParams (DOCKHANDLE hDock, VECTOR3 &pos, VECTOR3 &dir, VECTOR3 &rot) const;
326- UINT DockCount (void) const;
327- DOCKHANDLE GetDockHandle (UINT n) const;
328- OBJHANDLE GetDockStatus (DOCKHANDLE hDock) const;
329- int Dock (OBJHANDLE target, UINT n, UINT tgtn, UINT mode) const;
330- bool Undock (UINT n, const OBJHANDLE exclude = 0) const;
331-
332- // Passive attachment management
333- ATTACHMENTHANDLE CreateAttachment (bool toparent, const VECTOR3 &pos, const VECTOR3 &dir, const VECTOR3 &rot, const char *id, bool loose = false) const;
334- void SetAttachmentParams (ATTACHMENTHANDLE attachment, const VECTOR3 &pos, const VECTOR3 &dir, const VECTOR3 &rot) const;
335- void GetAttachmentParams (ATTACHMENTHANDLE attachment, VECTOR3 &pos, VECTOR3 &dir, VECTOR3 &rot) const;
336- const char *GetAttachmentId (ATTACHMENTHANDLE attachment) const;
337- OBJHANDLE GetAttachmentStatus (ATTACHMENTHANDLE attachment) const;
338- DWORD AttachmentCount (bool toparent) const;
339- DWORD GetAttachmentIndex (ATTACHMENTHANDLE attachment) const;
340- ATTACHMENTHANDLE GetAttachmentHandle (bool toparent, DWORD i) const;
341- bool AttachChild (OBJHANDLE child, ATTACHMENTHANDLE attachment, ATTACHMENTHANDLE child_attachment) const;
342- bool DetachChild (ATTACHMENTHANDLE attachment, double vel = 0.0) const;
343-
344- // beacon light management
345- void AddBeacon (BEACONLIGHTSPEC *bs);
346- bool DelBeacon (BEACONLIGHTSPEC *bs);
347- void ClearBeacons ();
348-
349- // Super-structure interface
350- bool GetSuperstructureCG (VECTOR3 &cg) const;
351-
352- // Surface parameters
353- void SetSurfaceFrictionCoeff (double mu_lng, double mu_lat) const;
354- void SetMaxWheelbrakeForce (double f) const;
355- void SetWheelbrakeLevel (double level, int which = 0, bool permanent = true) const;
356- double GetWheelbrakeLevel (int which) const;
357-
358- // Navigation radio interface
359- void InitNavRadios (DWORD nnav) const;
360- bool SetNavRecv (DWORD n, DWORD ch) const;
361- DWORD GetNavRecv (DWORD n) const;
362- float GetNavRecvFreq (DWORD n) const;
363- bool SetTransponderChannel (DWORD ch) const;
364- bool SetIDSChannel (DOCKHANDLE hDock, DWORD ch) const;
365- void EnableTransponder (bool enable) const;
366- void EnableIDS (DOCKHANDLE hDock, bool enable) const;
367- NAVHANDLE GetTransponder (void) const;
368- NAVHANDLE GetIDS (DOCKHANDLE hDock) const;
369- NAVHANDLE GetNavSource (DWORD n) const;
370-
371- // Status flags
372- bool GroundContact (void) const;
373- bool OrbitStabilised (void) const;
374- bool NonsphericalGravityEnabled (void) const;
375- UINT DockingStatus (UINT port) const;
376-
377- // Scenario editor interface
378- bool GetEditorModule (char *fname) const;
379-
380-protected:
381- Vessel *vessel;
382- short flightmodel;
383- short version;
384-};
385-
386-// ======================================================================
387-// class VESSEL2
388-// Extensions to the VESSEL interface. Derive your vessel classes from
389-// this instead of VESSEL to make use of the latest callback interface.
390-// ======================================================================
391-
392-class DLLEXPORT VESSEL2: public VESSEL {
393-public:
394- // Constructor
395- VESSEL2 (OBJHANDLE hVessel, int fmodel = 1);
396-
397- // Callback functions
398- virtual void clbkSetClassCaps (FILEHANDLE cfg);
399- virtual void clbkSaveState (FILEHANDLE scn);
400- virtual void clbkLoadStateEx (FILEHANDLE scn, void *status);
401- virtual void clbkSetStateEx (const void *status);
402- virtual void clbkPostCreation ();
403- virtual void clbkFocusChanged (bool getfocus, OBJHANDLE hNewVessel, OBJHANDLE hOldVessel);
404- virtual void clbkPreStep (double simt, double simdt, double mjd);
405- virtual void clbkPostStep (double simt, double simdt, double mjd);
406- virtual bool clbkPlaybackEvent (double simt, double event_t, const char *event_type, const char *event);
407- virtual void clbkVisualCreated (VISHANDLE vis, int refcount);
408- virtual void clbkVisualDestroyed (VISHANDLE vis, int refcount);
409- virtual void clbkDrawHUD (int mode, const HUDPAINTSPEC *hps, HDC hDC);
410- virtual void clbkRCSMode (int mode);
411- virtual void clbkADCtrlMode (DWORD mode);
412- virtual void clbkHUDMode (int mode);
413- virtual void clbkMFDMode (int mfd, int mode);
414- virtual void clbkNavMode (int mode, bool active);
415- virtual void clbkDockEvent (int dock, OBJHANDLE mate);
416- virtual void clbkAnimate (double simt);
417- virtual int clbkConsumeDirectKey (char *keystate);
418- virtual int clbkConsumeBufferedKey (DWORD key, bool down, char *keystate);
419- virtual bool clbkLoadGenericCockpit ();
420- virtual bool clbkLoadPanel (int id);
421- virtual bool clbkPanelMouseEvent (int id, int event, int mx, int my);
422- virtual bool clbkPanelRedrawEvent (int id, int event, SURFHANDLE surf);
423- virtual bool clbkLoadVC (int id);
424- virtual bool clbkVCMouseEvent (int id, int event, VECTOR3 &p);
425- virtual bool clbkVCRedrawEvent (int id, int event, SURFHANDLE surf);
426-};
427-
428-// ======================================================================
429-// class AnimState
430-// Auxiliary class for defining animation states
431-// ======================================================================
432-
433-class AnimState {
434-public:
435- enum Action {STOPPED, CLOSED, OPEN, CLOSING, OPENING} action;
436- double pos;
437- void Set (Action a, double p) { action = a, pos = p; }
438- bool Move (double dp) {
439- if (!Moving()) return false;
440- if (Closing()) {
441- if ((pos = max (0.0, pos-dp)) == 0.0) action = CLOSED;
442- } else {
443- if ((pos = min (1.0, pos+dp)) == 1.0) action = OPEN;
444- }
445- return true;
446- }
447- bool Moving() const { return action >= CLOSING; }
448- bool Static() const { return action < CLOSING; }
449- bool Stopped() const { return action == STOPPED; }
450- bool Closed() const { return action == CLOSED; }
451- bool Open() const { return action == OPEN; }
452- bool Closing() const { return action == CLOSING; }
453- bool Opening() const { return action == OPENING; }
454- friend OAPIFUNC void WriteScenario_state (FILEHANDLE f, char *tag, const AnimState &s);
455- friend OAPIFUNC void sscan_state (char *str, AnimState &s);
456-};
457-
458-#endif // !__VESSELAPI_H
diff -r 975d62cbb663 -r 2783da92d533 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Orbiter.Wrapper.vcproj
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Orbiter.Wrapper.vcproj Thu Apr 24 19:52:45 2008 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Orbiter.Wrapper.vcproj Tue Sep 02 20:02:30 2008 +0200
@@ -42,7 +42,8 @@
4242 Optimization="0"
4343 InlineFunctionExpansion="1"
4444 AdditionalIncludeDirectories="..\..\..\include"
45- PreprocessorDefinitions="WIN32;DEBUG;_WINDOWS;USESDOTNETWORKAROUNDS"
45+ PreprocessorDefinitions="WIN32;DEBUG;_WINDOWS"
46+ GeneratePreprocessedFile="0"
4647 StringPooling="true"
4748 RuntimeLibrary="2"
4849 EnableFunctionLevelLinking="true"
diff -r 975d62cbb663 -r 2783da92d533 Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp
--- a/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Thu Apr 24 19:52:45 2008 +0200
+++ b/Orbitersdk/samples/Orbiter.NET/Orbiter.Wrapper/Vessel.cpp Tue Sep 02 20:02:30 2008 +0200
@@ -1,4 +1,5 @@
11 //#include <vcclr.h>
2+
23 #include "orbitersdk.h"
34 #include "Vessel2Base.h"
45 #include "Vessel2.h"
@@ -27,7 +28,7 @@
2728 }
2829 IntPtr Vessel::Handle::get(void){return (IntPtr)vessel->GetHandle();}
2930 String^ Vessel::Name::get(void){return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetName());}
30- String^ Vessel::ClassName::get(void){return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetClassNameA());}
31+ String^ Vessel::ClassName::get(void){return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetClassName());}
3132 int Vessel::FlightModel::get(void){return vessel->GetFlightModel();}
3233 int Vessel::DamageModel::get(void){return vessel->GetDamageModel();}
3334 bool Vessel::FocusEnabled::get(void){return vessel->GetEnableFocus();}
Show on old repository browser