[Gcblue-commits] gcb_wx/include/scriptinterface tcPlatformInterface.h,1.11,1.11.2.1 tcScenarioInterf
Status: Alpha
Brought to you by:
ddcforge
From: <ddc...@us...> - 2004-02-17 14:35:55
|
Update of /cvsroot/gcblue/gcb_wx/include/scriptinterface In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32097/include/scriptinterface Modified Files: Tag: v0_5_0 tcPlatformInterface.h tcScenarioInterface.h tcSimPythonInterface.h Log Message: Index: tcPlatformInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcPlatformInterface.h,v retrieving revision 1.11 retrieving revision 1.11.2.1 diff -C2 -d -r1.11 -r1.11.2.1 *** tcPlatformInterface.h 8 Jan 2004 23:54:27 -0000 1.11 --- tcPlatformInterface.h 17 Feb 2004 14:27:01 -0000 1.11.2.1 *************** *** 87,113 **** // basic nav commands: heading, speed, altitude float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} float GetFuel() const; ! float GetMaxAltitude() {return mpPlatformObj->mpDBObject->mfMaxAltitude_m;} float GetSpeed() {return mpPlatformObj->mcKin.mfSpeed_kts;} float GetMaxSpeed() {return mpPlatformObj->mpDBObject->mfMaxSpeed_kts;} float GetHeading() {return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad;} float GetHeadingRad() {return mpPlatformObj->mcKin.mfHeading_rad;} float GetTerrainElevation(); bool HasThrottle(); ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} void SetPitchLimitDeg(float lim_deg); void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! void SetSpeedToMax(void); void SetThrottle(float throttleFraction); void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} float GetHeadingToDatum(float afLon_rad, float afLat_rad); float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info std::string GetPlatformName(void); std::string GetPlatformClass(void); bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; --- 87,143 ---- // basic nav commands: heading, speed, altitude + /// gets platform altitude in meters float GetAltitude() {return mpPlatformObj->mcKin.mfAlt_m;} + /// gets fraction of fuel remaining from 0 - 1 float GetFuel() const; ! /// gets max altitude in meters indicated in database entry. ! float GetMaxAltitude() {return mpPlatformObj->mpDBObject->mfMaxAltitude_m;} ! /// gets current platform speed in kts float GetSpeed() {return mpPlatformObj->mcKin.mfSpeed_kts;} + /// gets max platform speed indicated in database (only a nominal max for aerodynamic air platforms) float GetMaxSpeed() {return mpPlatformObj->mpDBObject->mfMaxSpeed_kts;} + /// gets current heading in degrees float GetHeading() {return C_180OVERPI*mpPlatformObj->mcKin.mfHeading_rad;} + /// gets current heading in radians float GetHeadingRad() {return mpPlatformObj->mcKin.mfHeading_rad;} + /// gets height of terrain under platform in meters float GetTerrainElevation(); + /// true if platform has a throttle control (aero air models) bool HasThrottle(); ! /// set goal altitude for platform in meters ! /** ! * For air objects ! * @param alt_m goal altitude of platform in meters ! */ ! void SetAltitude(float alt_m) {mpPlatformObj->mcGS.mfGoalAltitude_m = alt_m;} ! /// sets maximum +/- pitch for air objects in degrees, workaround to slow descent for cv landing void SetPitchLimitDeg(float lim_deg); + /// sets speed of platform void SetSpeed(float speed_kts) {mpPlatformObj->SetSpeed(speed_kts);} ! /// set speed of platform to maximum speed (use SetThrottle for aero air objects) ! void SetSpeedToMax(void); ! /// set throttle for air objects ! /** ! * for air objects, sets throttle ! * @param throttleFraction 0 - 1.1, use 0 - 1 for non afterburning throttle, 1.1 for afterburners ! */ void SetThrottle(float throttleFraction); + /// sets heading in degrees void SetHeading(float heading_deg) {mpPlatformObj->SetHeading(C_PIOVER180*heading_deg);} + /// sets heading in radians void SetHeadingRad(float heading_rad) {mpPlatformObj->SetHeading(heading_rad);} + /// get heading to (lon,lat) datum in degrees float GetHeadingToDatum(float afLon_rad, float afLat_rad); + /// get range to (lon,lat) datum in km float GetRangeToDatum(float afLon_rad, float afLat_rad); // platform info + /// get unit name of platform std::string GetPlatformName(void); + /// get database class name of platform std::string GetPlatformClass(void); + /// returns true if platform is a surface platform bool IsSurface() {return (mpPlatformObj->mnModelType == MTYPE_SURFACE);} + /// returns true if platform is an air platform bool IsAir() { UINT32 nModelType = mpPlatformObj->mnModelType; *************** *** 117,176 **** // script variables UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands void SetTarget(long anID) {mpPlatformObj->mcAI.SetTarget(anID);} long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} float GetRangeToTarget(void); tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! bool IsLauncherEffective(int anLauncher); ///< is launcher effective vs. target float SetHeadingToInterceptTarget(void); // weapon related commands ! tcLauncherInfo GetBestLauncher(void); ///< best launcher for target int GetLauncherCount(void); void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); bool HandoffTargetToLauncher(int anLauncher); void Launch(int anLauncher, int quantity); std::string GetLauncherWeaponName(int anLauncher); int GetLauncherQuantity(int anLauncher); bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands bool HasOrders(void); tcOrder GetCurrentOrder(void); void CompletedOrder(void); void AddOrder(std::string order_text, long data = -1); void AddNavOrder(float afLon_rad, float afLat_rad); void ClearOrders(void); void DeleteOrder(int n); int GetOrderCount(); tcOrder GetOrder(int n); // sensor map and sensor commands tcTrackIterator GetFirstTrack(void); int GetTrackCount(void); tcTrackIterator GetNextTrack(long nPos); int GetSensorCount(); tcSensorInfo GetSensorInfo(int n); void SetSensorState(int n, int state); ! void SetAllSensorState(int anState); ///< 0 - off, 1 - on tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); float GetInterceptHeadingToTrack(const tcTrack& track); float GetRangeToTrack(const tcTrack& track); float SetHeadingToInterceptTrack(tcTrack track); tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); --- 147,249 ---- // script variables + /// returns user variable n UINT32 GetVar(int n) {return mpPlatformObj->mcAI.GetVar(n);} + /// sets user variable n void SetVar(int n, UINT32 val) {mpPlatformObj->mcAI.SetVar(n,val);} // target commands + /// set target for platform void SetTarget(long anID) {mpPlatformObj->mcAI.SetTarget(anID);} + /// get platform target, -1 for no target long GetTarget(void) {return mpPlatformObj->mcAI.GetTarget();} + /// get range to target in km float GetRangeToTarget(void); + /// get track info object for target tcTrack GetTargetTrackInfo(void); tcGameObject* GetTargetObj(void); bool GetTargetTrack(tcTrack& track); ! /// returns true if launcher is effective vs. current target ! bool IsLauncherEffective(int anLauncher); ! /// if target is valid, sets heading to intercept target. float SetHeadingToInterceptTarget(void); // weapon related commands ! /// gets launcher info object for best launcher for target ! tcLauncherInfo GetBestLauncher(void); ! /// gets number of launchers available on platform int GetLauncherCount(void); + /// sets datum for launcher void SendDatumToLauncher(float afLon_rad, float afLat_rad, int anLauncher); + /// hands off platform target to launcher bool HandoffTargetToLauncher(int anLauncher); + /// orders launch void Launch(int anLauncher, int quantity); + /// get class name of launcher weapon std::string GetLauncherWeaponName(int anLauncher); + /// get quantity available for launch in launcher int GetLauncherQuantity(int anLauncher); + /// true if launcher can launch using datum only (i.e. no track just a set of coordinates) bool IsDatumLaunch(int anLauncher) {return mpPlatformObj->mcLauncherState.IsDatumLaunch(anLauncher);} bool GetLauncherInfo(tcLauncherInfo& info, int anLauncher); // order related commands + + /// true if platform has any orders bool HasOrders(void); + /// gets order info object for current platform order tcOrder GetCurrentOrder(void); + /// called to indicate current order is complete and to move to next order void CompletedOrder(void); + /// adds generic order void AddOrder(std::string order_text, long data = -1); + /// adds navigation order void AddNavOrder(float afLon_rad, float afLat_rad); + /// clear all orders void ClearOrders(void); + /// delete order void DeleteOrder(int n); + /// get total number of orders int GetOrderCount(); + /// get order info object for order n tcOrder GetOrder(int n); // sensor map and sensor commands + /// get first track in alliance sensor map, track iterator object is returned tcTrackIterator GetFirstTrack(void); + /// gets total number of tracks in alliance sensor map int GetTrackCount(void); + /// gets next track in sensor map, nPos is obtained from track iterator from last call tcTrackIterator GetNextTrack(long nPos); + /// gets number of sensors on platform int GetSensorCount(); + /// gets sensor info object for sensor n tcSensorInfo GetSensorInfo(int n); + /// sets state of sensor n, 0 - off, 1 - on void SetSensorState(int n, int state); ! /// sets state of all sensors on platform, 0 - off, 1 - on ! void SetAllSensorState(int anState); ! /// gets track info object for closest track within range that matches classification and affiliation parameters tcTrack GetClosestTrack(float afMaxRange_km, UINT16 anClassMask, UINT8 anAffiliation); + /// gets track info object for closest air track within range matching affiliation tcTrack GetClosestAirTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest surface track within range matching affiliation tcTrack GetClosestSurfaceTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track info object for closest missile track within range matching affiliation tcTrack GetClosestMissileTrack(float afMaxRange_km, UINT8 anAffiliation); + /// gets track list object that has all tracks within range matching affiliation tcTrackList GetTrackList(int anClassMask, float afMaxRange_km, UINT8 anAffiliation); + /// get intercept heading to track in radians float GetInterceptHeadingToTrack(const tcTrack& track); + /// get range to track in km float GetRangeToTrack(const tcTrack& track); + /// set heading to intercept track float SetHeadingToInterceptTrack(tcTrack track); + /// get track info object corresponding to track id tcTrack GetTrackById(long id); // flightport (airstrip, cv flight deck, helo pad) + /// true if platform has a flight port (e.g. carrier) bool HasFlightPort(void); tcFlightPortInterface GetFlightPortInfo(void); *************** *** 181,188 **** --- 254,266 ---- void GetUserInput(std::string callback, std::string uitype); void SendCommand(std::string command); + /// display text message in user console void DisplayMessage(std::string text); + /// play sound effect void PlaySound(int n); + /// sets text displayed in platform info panel void SetActionText(std::string text) {mpPlatformObj->mcAI.mzActionText = text;} + /// sets update interval for AI script revisits void SetUpdateInterval(float afInterval) {mpPlatformObj->mcAI.mfUpdateInterval = (afInterval >= 0.25) ? afInterval : 0.25f;} + /// returns a random number between 0 and 1 float GetRand() {return randf();} static void SetObj(tcPlatformObject *apObj) {mpStaticPlatformObj = apObj;} Index: tcScenarioInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcScenarioInterface.h,v retrieving revision 1.7 retrieving revision 1.7.2.1 diff -C2 -d -r1.7 -r1.7.2.1 *** tcScenarioInterface.h 5 Jan 2004 02:48:02 -0000 1.7 --- tcScenarioInterface.h 17 Feb 2004 14:27:01 -0000 1.7.2.1 *************** *** 53,56 **** --- 53,59 ---- }; + /** + * Class to define platform for scenario. + */ class tcScenarioUnit { *************** *** 71,75 **** }; /** ! * Interface class to python scenario generation scripts. */ class tcScenarioInterface --- 74,78 ---- }; /** ! * Interface class for python scenario generation scripts. */ class tcScenarioInterface *************** *** 77,126 **** public: // Interface functions to be called through Python bool AddUnitToAlliance(tcScenarioUnit unit, int alliance); bool AddUnitToFlightDeck(std::string parentName, std::string className, std::string unitName, int locCode); void CreateAlliance(int alliance, std::string name); tcOrder GetDefaultOrder(); tcScenarioUnit GetDefaultUnit(); tcDatum GetRandomDatum(double lon, double lat, float min_alt, float max_alt, float rand_offset); void SetAllianceGoal(int alliance, tcGoal& goal); void SetDateTime(int year, int month, int day, int hour, int min, int sec); void SetScenarioDescription(std::string s); void SetScenarioLoaded(bool state); void SetScenarioName(std::string s); void SetUserAlliance(int alliance); // tcDirector interface functions for briefing events // time/mode events void ClearEvents(); void HookPlatform(std::string unitName); void Pause(); void Resume(); void Set3DMode(int modeCode); void SetBriefingMode(bool state); void SetEventTime(double t); // audio events void PauseAudio(); void PlayAudio(std::string audioName, double seekTime); ! void PlayEffect(int effectNumber); ///< may want to use string for this instead ! void SeekAudio(double seekTime); // text console and map events void ChangeMapView(double lon_deg, double lat_deg, double lonSpan_deg); void ConsoleText(std::string text); void MapText(std::string text, double lon_deg, double lat_deg, double duration, int effect); // camera and 3D events void FlybyCamera(std::string unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m); void TrackCamera(std::string unitName, double duration, float x1, float x2, float y1, float y2, float z1, float z2); void Text3D(std::string text, double duration, float x, float y, float size, int effect); // goal class creation methods (cannot find a way to do directly) tcCompoundGoal CompoundGoal(int type); tcTimeGoal TimeGoal(); tcDestroyGoal DestroyGoal(std::string target); --- 80,161 ---- public: // Interface functions to be called through Python + /// Adds unit to alliance bool AddUnitToAlliance(tcScenarioUnit unit, int alliance); + /// Adds unit to flight deck of parent unit bool AddUnitToFlightDeck(std::string parentName, std::string className, std::string unitName, int locCode); + /// Create alliance (side) with name void CreateAlliance(int alliance, std::string name); + /// Get default order object, workaround to create an order object in Python tcOrder GetDefaultOrder(); + /// Get default unit object, workaround to create a unit object in Python tcScenarioUnit GetDefaultUnit(); + /// Gets random datum to place an object at tcDatum GetRandomDatum(double lon, double lat, float min_alt, float max_alt, float rand_offset); + /// Sets top level goal for alliance void SetAllianceGoal(int alliance, tcGoal& goal); + /// Sets date and time for scenario void SetDateTime(int year, int month, int day, int hour, int min, int sec); + /// Sets description string for scenario void SetScenarioDescription(std::string s); + /// Set true to indicate scenario creation is finished and successful void SetScenarioLoaded(bool state); + /// Set name for scenario void SetScenarioName(std::string s); + /// Set alliance of user void SetUserAlliance(int alliance); // tcDirector interface functions for briefing events // time/mode events + /// Clear all director (dynamic briefing) events void ClearEvents(); + /// Hook platform void HookPlatform(std::string unitName); + /// Pause game void Pause(); + /// Resume / unpause game void Resume(); + /// Set 3D display mode: 0 - 3D off, 1 - 3D small, 2 - 3D med, 3 - 3D full void Set3DMode(int modeCode); + /// Set briefing mode: 0 - normal display, 1 - tactical briefing display void SetBriefingMode(bool state); + /// Set time for event, called before event command in script void SetEventTime(double t); // audio events + /// Pause music void PauseAudio(); + /// Play music / audio file, use seek time to play at different locations in file void PlayAudio(std::string audioName, double seekTime); ! /// Play sound effect ! void PlayEffect(int effectNumber); // (may want to use string for this instead) ! /// Jump to different location in music / audio file ! void SeekAudio(double seekTime); // text console and map events + /// change 2D map view center and zoom void ChangeMapView(double lon_deg, double lat_deg, double lonSpan_deg); + /// display console text void ConsoleText(std::string text); + /// display text on map at indicated location, effect codes: 0 - no effect, 1 - fade in/out void MapText(std::string text, double lon_deg, double lat_deg, double duration, int effect); // camera and 3D events + /// flyby 3D camera move void FlybyCamera(std::string unitName, double duration, float az1_deg, float az2_deg, float el1_deg, float el2_deg, float r1_m, float r2_m); + /// tracking camera move void TrackCamera(std::string unitName, double duration, float x1, float x2, float y1, float y2, float z1, float z2); + /// display text on 3D window void Text3D(std::string text, double duration, float x, float y, float size, int effect); // goal class creation methods (cannot find a way to do directly) + /// create compound goal object, type 0 - AND, 1 - OR tcCompoundGoal CompoundGoal(int type); + /// create time goal object tcTimeGoal TimeGoal(); + /// create destroy goal object tcDestroyGoal DestroyGoal(std::string target); Index: tcSimPythonInterface.h =================================================================== RCS file: /cvsroot/gcblue/gcb_wx/include/scriptinterface/tcSimPythonInterface.h,v retrieving revision 1.8 retrieving revision 1.8.2.1 diff -C2 -d -r1.8 -r1.8.2.1 *** tcSimPythonInterface.h 29 Dec 2003 01:10:25 -0000 1.8 --- tcSimPythonInterface.h 17 Feb 2004 14:27:01 -0000 1.8.2.1 *************** *** 44,48 **** namespace ScriptInterface { ! class tcMenuInterface { public: void AddItem(std::string caption, std::string command); --- 44,52 ---- namespace ScriptInterface { ! /** ! * Interface class for creating popup mouse menus. ! */ ! class tcMenuInterface ! { public: void AddItem(std::string caption, std::string command); |