修订版 | 5917597e769159ac2295984fce420b77a0e8ad07 (tree) |
---|---|
时间 | 2008-04-23 17:00:48 |
作者 | face__ |
Commiter | face__ |
[svn r35] Added fix for ClassName.
@@ -0,0 +1,458 @@ | ||
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 |
@@ -42,7 +42,7 @@ | ||
42 | 42 | Optimization="0" |
43 | 43 | InlineFunctionExpansion="1" |
44 | 44 | AdditionalIncludeDirectories="..\..\..\include" |
45 | - PreprocessorDefinitions="WIN32;DEBUG;_WINDOWS" | |
45 | + PreprocessorDefinitions="WIN32;DEBUG;_WINDOWS;USESDOTNETWORKAROUNDS" | |
46 | 46 | StringPooling="true" |
47 | 47 | RuntimeLibrary="2" |
48 | 48 | EnableFunctionLevelLinking="true" |
@@ -27,7 +27,7 @@ | ||
27 | 27 | } |
28 | 28 | IntPtr Vessel::Handle::get(void){return (IntPtr)vessel->GetHandle();} |
29 | 29 | String^ Vessel::Name::get(void){return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetName());} |
30 | - String^ Vessel::ClassName::get(void){return String::Empty;/*return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetClassName());*/} | |
30 | + String^ Vessel::ClassName::get(void){return Marshal::PtrToStringAnsi((IntPtr)(void *)vessel->GetClassNameA());} | |
31 | 31 | int Vessel::FlightModel::get(void){return vessel->GetFlightModel();} |
32 | 32 | int Vessel::DamageModel::get(void){return vessel->GetDamageModel();} |
33 | 33 | bool Vessel::FocusEnabled::get(void){return vessel->GetEnableFocus();} |