The Falcon 4.0 Brains.


Falcon 4.0 is based on a technology called the Virtual Universe - see seperate documentattion under VU/DOC. Falcon extends this OOlib by defining it's units and objects.

These entities are controled by F4's different Brains.
 

There is first of all a class called BaseBrain from this the DigitalBrain is derived. There are also the atcBrain and the FACBrain which are subclasses of the digitalBrain.The TankerBrain, heliBrain and Feature Brain are standalone classes.
 
 

The BaseBrain:

Subclass: DigitalBrain
Def: 
Implementation:
FUNCTIONS
     virtual void ReceiveOrders (FalconEvent*) {};
      virtual void JoinFlight (void) {};
      virtual void SetLead (int) {};
      virtual void FrameExec(SimObjectType*, SimObjectType*) {};
      virtual void PostInsert (void) {};
      virtual void Sleep (void) {ClearTarget();};
      void SetTarget (SimObjectType* newTarget);
      void ClearTarget(void);
      void SetFlag (int val) {flags |= val;};
      void ClearFlag (int val) {flags &= ~val;};
      int IsSetFlag (int val) {return (flags & val ? TRUE : FALSE);};
      int SkillLevel(void) {return skillLevel;};
      void SetSkill (int newLevel) {skillLevel = newLevel;};
      virtual int IsTanker(void) {return FALSE;}
      virtual void InitBoom(void) {};
      virtual void CleanupBoom(void) {};
DATA:
      int                                 flags;
      int                                 skillLevel;
      SimObjectType*          targetPtr;
      SimObjectType*             lastTarget;
      SimObjectLocalData*   targetData;
      int                                 isWing;
      float                              pStick, rStick, yPedal, throtl;
 

The DigitalBrain:

Subclasses: FACBrain, TankerBrain


 
 

   public:
      // Pete Style Maneuver Stuff
      enum BVRInterceptType {
         BvrSingleSideOffset,
         BvrPince,
         BvrPursuit,
         BvrNoIntercept,
         NumInterceptTypes
      };

      enum WVRMergeManeuverType {
         WvrMergeHitAndRun,
         WvrMergeLimited,
         WvrMergeUnlimited,
         NumWVRMergeMnverTypes
      };

      enum SpikeReactionType {
         SpikeReactNone,
         SpikeReactECM,
         SpikeReactBeam,
         SpikeReactDrag,
         NumSpikeReactionTypes
      };

      enum ACMnverClass {
         MnvrClassF4,
         MnvrClassF5,
         MnvrClassF14,
         MnvrClassF15,
         MnvrClassF16,
         MnvrClassMig25,
         MnvrClassMig27,
         MnvrClassA10,
         MnvrClassBomber,
         NumMnvrClasses
      };

      enum ACMnverClassFlags
      {
         CanLevelTurn    = 0x1,
         CanSlice        = 0x2,
         CanUseVertical  = 0x4,
         CanOneCircle    = 0x10,
         CanTwoCircle    = 0x20,
         CanJinkSnake    = 0x100,
         CanJinkLoaded   = 0x200,
         CanJinkUnloaded = 0x400
      };

   enum OffsetDirs
   {
    offForward,
    offRight,
    offBack,
    offLeft,
    taxiLeft,
    taxiRight,
    downRunway,
    upRunway,
    rightRunway,
    leftRunway,
    centerRunway,
   };
      /*--------------*/
      /* Mnvr Element */
      /*--------------*/
      typedef struct
      {
         BVRInterceptType*     intercept;
         WVRMergeManeuverType* merge;
         SpikeReactionType*    spikeReact;
         char                  numIntercepts;
         char                  numMerges;
         char                  numReacts;
      } ManeuverChoiceTable;

      typedef struct
      {
         int flags;
      } ManeuverClassData;
// Apriori existence of the maneuver choice tables and their loaders and unloaders!
      staticManeuverChoiceTable maneuverData[NumMnvrClasses][NumMnvrClasses];
      staticManeuverClassData maneuverClassData[NumMnvrClasses];
      static void ReadManeuverData (void);
      static void FreeManeuverData (void);

   //for now landing is a high priority mode so they won't get distracted
      enum DigiMode {
    TakeoffMode, GroundAvoidMode, CollisionAvoidMode, GunsJinkMode, MissileDefeatMode,
    LandingMode, DefensiveModes, RefuelingMode,
    SeparateMode, AccelMode, MergeMode, MissileEngageMode, GunsEngageMode,
    RoopMode, OverBMode, WVREngageMode, BVREngageMode,
    LoiterMode, FollowOrdersMode, RTBMode, WingyMode,
    BugoutMode, WaypointMode, GroundMnvrMode,
    LastValidMode, NoMode};

   enum WvrTacticType {WVR_NONE, WVR_RANDP, WVR_OVERB, WVR_ROOP, WVR_GUNJINK, WVR_STRAIGHT,
    WVR_BUGOUT, WVR_AVOID, WVR_BEAM, WVR_BEAM_RETURN, WVR_RUNAWAY};

    // engagement tactic from campaign
    int campTactic;

    DigiMode GetCurrentMode(void) {return curMode;}

    enum RefuelStatus{
     refNoTanker,
     refVectorTo,
     refWaiting,
     refRefueling,
     refDone,
    };
   protected:

    AircraftClass* self;
    AirframeClass* af;

    enum WaypointState {NotThereYet, Arrived, Stabalizing, OnStation, PreRoll, Departing, HoldingShort, HoldInPlace,
       TakeRunway, Takeoff, Taxi, Upwind, Crosswind, Downwind, Base, Final, Final1};

    // Controls
    SAVE_ARRAY pstickSave;
    float       autoThrottle;
    int         trackMode;
    float       maxGs, cornerSpeed;

    // Ground Avoid
    int   groundAvoidNeeded;
    float  gaRoll, gaGs;

    // Mode Stuff
    int    waypointMode;
    WaypointState onStation;
    DigiMode   curMode;
    DigiMode   lastMode;
    DigiMode   nextMode;

    void    AddMode(DigiMode);
    void    ResolveModeConflicts(void);
    void    PrtMode(void);
    void    PrintOnline(char *str);
    void    SetCurrentTactic (void);

    // Maneuvers
    float trackX, trackY, trackZ;
    float holdAlt, holdPsi;
    float gammaHoldIError;

    int  MissileEvade(void);
    int  MissileBeamManeuver(void);
    int  MachHold (float, float, int);
    void PullUp (void);
    void RollAndPull(void);
    void PullToCollisionPoint(void);
    void PullToControlPoint(void);
    void MaintainClosure(void);
    void MissileDefeat(void);
    void MissileDragManeuver(void);
    void MissileLastDitch(float xft, float yft, float zft);
    void GunsEngage (void);
      void TrainableGunsEngage (void);
      void AccelManeuver(void);
    void GunsJink (void);
    void MissileEngage(void);
    void FollowWaypoints(void);
    void Loiter(void);
    void LevelTurn(float loadFactor, float turnDir, int newTurn);
    void GammaHold (float desGamma);
    int  AltitudeHold (float desAlt);
    int  HeadingAndAltitudeHold (float desHeading, float desAlt);
    float CollisionTime(void);
    void GoToCurrentWaypoint(void);
    void SelectNextWaypoint(void);
    void SetWaypointSpecificStuff(void);
    void RollOutOfPlane (void);
    void OverBank (float delta);

    // ground attack stuff....
    void GroundAttackMode(void);
    void SetGroundTarget( FalconEntity *obj );
    void SetGroundTargetPtr( SimObjectType *obj );
    void SelectGroundTarget( int selectFilter );
    void SelectCampGroundTarget( void );
    void DoPickupAirdrop( void );
      void TakePicture(float, float);
      void DropBomb(float, float, RadarClass*);
      void DropGBU(float, float, RadarClass*);
      void FireAGMissile (float, float);
      void FireRocket (float, float);
      void GunStrafe (float, float);
      int  MaverickSetup (float, float, float, float, RadarClass* theRadar);
      int  HARMSetup (float, float, float, float);
      float rangeToIP;

      enum AG_TARGET_TYPE {TARGET_ANYTHING, TARGET_FEATURE, TARGET_UNIT};

    void    SelectGroundWeapon( void );
      int hasBomb;
      int hasAGMissile;
      int hasHARM;
      int hasRocket;
      int hasGun;
      int hasCamera;
      int hasGBU;
      int hasWeapons;

    SimObjectType* groundTargetPtr;
    int    sentWingAGAttack;
    BOOL    droppingBombs;
    BOOL    agImprovise;
     enum AG_ORDERS {AG_ORDER_NONE, AG_ORDER_FORMUP, AG_ORDER_ATTACK};
    enum AG_DOCTRINE {AGD_NONE, AGD_SHOOT_RUN, AGD_LOOK_SHOOT_LOOK, AGD_NEED_SETUP};
  enum AG_APPROACH {AGA_LOW, AGA_TOSS, AGA_HIGH, AGA_DIVE, AGA_BOMBER};

    void    SetupAGMode( WayPointClass *, WayPointClass * );

    AG_DOCTRINE agDoctrine;
    AG_APPROACH agApproach;

      VU_TIME  nextAGTargetTime;
    BOOL   madeAGPass;

    float  ipX, ipY, ipZ;    // insertion point loc for AG run

public:
enum MissionClass {AGMission, AAMission, SupportMission, AirliftMission};
protected:
    MissionTypeEnum missionType;
      MissionClass      missionClass;
    BOOL   missionComplete;

    //ATC stuff
    VU_TIME   createTime;    //when this brain was created in terms of SimLibElapsedTime
    int    atcFlags;    //need to know what has happened to them already
    int    rwIndex;    //0 if none, else index of runway to use
    VU_ID   airbase;    //airbase to land at
    VU_TIME   rwtime;     //time scheduled to use runway
    VU_TIME   updateTime;    //time to update distance info
    float   distAirbase;   // how far are we from our desired airbase?

    AtcStatusEnum atcstatus;    //at what point in the takeoff/landing process are you?
    int     curTaxiPoint;   //index into PtDataTable, 0 means none
    float   desiredSpeed;   //speed at which we want to move so we arrive at next point on time
    float   turnDist;    //when distance to point is less than this we execute a
            //  turn onto our new heading
    VU_TIME   waittimer;    //time at which we have been in this state too long

    //Refueling stuff
    RefuelStatus  refuelstatus;   //current status
  VU_ID   tankerId;    //which tanker we are using
  int    tnkposition;   //where are we in the queue to tank, 0 == currently tanking, -1 == don't know yet
 

    void Land (void);
    void TakeOff (void);
    void TaxiBack(ObjectiveClass *Airbase);
    SimBaseClass* CheckTaxiTrackPoint(void);
    SimBaseClass* CheckPoint(float x, float y);
    BOOL CheckTaxiCollision(void);
    BOOL SimpleGroundTrack(float);
      void FuelCheck (void);
      void IPCheck (void);
 
 

    // Targeting
    float   ataDot;
    float   lastAta;
    SimObjectType* targetList;

    virtual void  SetTarget (SimObjectType* newTarget);
    void    DoTargeting (void);
    SimObjectType* InsertIntoTargetList (SimObjectType* root, SimObjectType* newObj);
 

    // Threat Avoid
    VU_ID missileDefeatId;
    int  missileFindDragPt;
    int  missileFinishedBeam;
    int  missileShouldDrag;
    float missileDefeatTtgo;

    // Missile Engage
    MissileClass* curMissile;
    int    curMissileStation;
    int    curMissileNum;
    int    flyingMissileEid;
    int    flyingMissileHid;
    VU_TIME   missileShotTimer;
      float          maxEngageRange;

    // Guns Engage
    VU_TIME  jinkTime;
    VU_TIME waitingForShot;
    float ataddot, rangeddot, mnverTime;
    float newroll, pastAta,pastPstick,pastPipperAta;

    float GunsAutoTrack (float maxGs);
    void  FineGunsTrack (float speed, float *lagAngle);
    void  CoarseGunsTrack(float speed,float leadTof,float *newata);

    // Simple flight model
    enum  SimpleTrackMode {SimpleTrackDist, SimpleTrackSpd, SimpleTrackTanker};
    void  SimpleTrack(SimpleTrackMode, float);
    float SimpleTrackAzimuth(float, float, float);
    float SimpleTrackElevation(float, float);
    float SimpleTrackDistance(float, float);
    float SimpleTrackSpeed(float);
    float SimpleScaleThrottle(float);
    void  SimpleGoToCurrentWaypoint(void);
    void  SimplePullUp(void);
    float SimpleGroundTrackSpeed(float v);
    void  CalculateRelativePos(float*, float*, float*, float*, float*, float*);

    VU_TIME mLastOrderTime;

    // Wing Radio Calls
    void RespondShortCallSign(int);

    // Controls for Simple flight Model
    int SelectFlightModel(void);

    // Decision Stuff
    void  Actions (void);
    void  DecisionLogic(void);
    void  TargetSelection(void);
    FalconEntity* CampTargetSelection(void);
    void  WeaponSelection(void);
    void  FireControl(void);
    void  RunDecisionRoutines(void);
    void  GroundCheck(void);
    void  GunsEngageCheck(void);
    void  GunsJinkCheck(void);
    void  CollisionCheck(void);
    void  MissileDefeatCheck(void);
    void  MissileEngageCheck(void);
    void  MergeCheck(void);
    void  AccelCheck(void);
    void  MergeManeuver(void);
    void     SeparateCheck(void);
    void     SensorFusion (void);
    float    SetPstick (float, float, int);
    float    SetRstick (float);
    float    SetYpedal (float);
      float    SetRollCapture (float);
      void     SetMaxRoll (float);
      void     SetMaxRollDelta (float);
      void     ResetMaxRoll (void);
    void  CollisionAvoid(void);
    float AutoTrack (float);
    float TrackPoint (float maxGs, float speed);
    float TrackPointLanding ( float speed);
    float VectorTrack (float, int fineTrack = FALSE);
    int  Stagnated (void);

    // WVR Stuff
    void    WvrEngageCheck(void);
    void    WvrChooseTactic(void);
    void    WvrEngage(void);
    void    WvrRollOutOfPlane (void);
    void    WvrStraight (void);
    void    WvrBugOut (void);
    void    WvrGunJink (void);
    void    WvrOverBank (float delta);
    void    WvrAvoid(void);
    void    WvrBeam(void);
    void    WvrRunAway(void);
    VU_TIME   mergeTimer;
    VU_TIME   wvrTacticTimer;
    VU_TIME   engagementTimer;
    WvrTacticType wvrCurrTactic;
    WvrTacticType wvrPrevTactic;
    float   maxAAWpnRange;
    BOOL    buggedOut;

    // Bvr Stuff
    void    BvrEngageCheck(void);
    void    BvrChooseTactic(void);
    void    BvrEngage(void);
    VU_TIME   bvrTacticTimer;
    BVRInterceptType bvrCurrTactic;
    BVRInterceptType bvrPrevTactic;

    // Threat handling
    SimObjectType* threatPtr;
    SimObjectType* preThreatPtr;
    float   threatTimer;
    void    SetThreat( FalconEntity *obj );
    BOOL    HandleThreat( void );

public:
 DigitalBrain (AircraftClass *myPlatform, AirframeClass* myAf);
 virtual ~DigitalBrain (void);
   virtual void Sleep (void);
   void           ClearCurrentMissile (void) {curMissile = NULL;};

 void ReceiveOrders (FalconEvent* theEvent);
 void JoinFlight (void);
 void CheckLead(void);
 void SetLead (int flag);
 void FrameExec(SimObjectType*, SimObjectType*);
 void ThreeAxisAP (void);
 void WaypointAP (void);
 void SetHoldAltitude (float newAlt)      {holdAlt = newAlt;};
 void SetHoldHeading (float newPsi)      {holdPsi = newPsi;};
 SimObjectType* GetGroundTarget( void )             {return groundTargetPtr;};
 MissionTypeEnum MissionType(void)     {return missionType;}

#ifdef DAVE_DBG
 void SetDebugLabel(ObjectiveClass*);
#else
 void SetDebugLabel(ObjectiveClass*)   {};
#endif
 VU_TIME CreateTime(void)        {return createTime;}
 int  CalcWaitTime(ATCBrain *Atc);
 void ResetTaxiState(void);
 void SetTaxiPoint(int pt)       {curTaxiPoint = pt;}
 int  GetTaxiPoint(void)        {return curTaxiPoint;}
 void UpdateTaxipoint(void);
 AircraftClass* GetLeader(void);
 int  FindDesiredTaxiPoint(ulong takeoffTime);
 void GetTrackPoint(float *x, float *y, float *z);
 void SetTrackPoint(float x, float y, float z);
 void ChooseNextPoint(ObjectiveClass *Airbase);
 void DealWithBlocker(SimBaseClass *inTheWay, ObjectiveClass *Airbase);
 int  WingmanTakeRunway(ObjectiveClass *Airbase, AircraftClass *flightLead, AircraftClass *leader);
 int  WingmanTakeRunway(ObjectiveClass *Airbase);
 void OffsetTrackPoint(float dist, int dir);
 void ResetTimer(int delta);
 void SetATCFlag(int flag)       {atcFlags |= flag;}
 void ClearATCFlag(int flag)       {atcFlags &= ~flag;}
 int  IsSetATC(int flag)        {return (atcFlags & flag) && TRUE;}
 void ResetATC(void);
   void  FlightMemberWantsFuel (int state);

enum ATCFlags{
  Landed      = 0x01,
  PermitRunway      = 0x02,
  PermitTakeoff     = 0x04,
  HoldShort         = 0x08,
  EmerStop          = 0x10,
  TakeoffAborted    = 0x20,
  MissionCanceled   = 0x40,
  RequestTakeoff    = 0x80,
  Refueling         = 0x100,
  NeedToRefuel      = 0x200,
  ClearToLand       = 0x400,
  PermitTakeRunway  = 0x800,
  WingmanReady      = 0x1000,
  AceGunsEngage     = 0x2000,
      SaidJoker         = 0x4000,
      SaidBingo         = 0x8000,
      SaidFumes         = 0x10000,
      SaidFlameout      = 0x20000,
      HasTrainable      = 0x40000,
      FireTrainable     = 0x80000,
      AskedToEngage     = 0x100000,
      ReachedIP         = 0x200000,
      HasAGWeapon       = 0x400000,
      OnSweep           = 0x800000,
      InShootShoot      = 0x1000000,
    CheckTaxiBack  = 0x2000000,
      WaitingPermission = 0x4000000,
    StopPlane   = 0x8000000,
    SaidRTB      = 0x10000000,
    InhibitDefensive  = 0x20000000,
 };

 void   SendATCMsg(AtcStatusEnum msg);
 void   SetATCStatus(AtcStatusEnum status)  {atcstatus = status;}
 AtcStatusEnum ATCStatus(void)       {return atcstatus;}
 void   SetWaitTimer(VU_TIME timer)  {waittimer = timer;}
 VU_TIME WaitTime(void)       {return waittimer;}

 void SetRunwayInfo(VU_ID Airbase, int rwindex, unsigned long time);
 VU_ID Airbase(void) {return airbase;}
 int  Runway(void)  {return rwIndex;}
 VU_TIME RwTime(void) {return rwtime;}
 float CalculateNextTurnDistance(void);
 float TurnDistance(void)   {return turnDist;}
 int  ReadyToGo(void);
 float CalculateTaxiSpeed(float time);

 void   StartRefueling(void);
 void   DoneRefueling(void);
 void   SetRefuelStatus(RefuelStatus newstatus)  {refuelstatus = newstatus;}
 RefuelStatus RefuelStatus(void)       {return refuelstatus;}
 void   SetTanker(VU_ID tanker)      {tankerId = tanker;}
 void   SetTnkPosition(int pos)      {tnkposition = pos;}
 VU_ID   Tanker(void)        {return tankerId;}
 void   HelpRefuel(AircraftClass *tanker);

 ///////////////////////////////////////////////////////////////////////
 // Begin Wingman Stuff
 

 // Wingman Stuff
 float   velocitySlope;
 float   velocityIntercept;
 void   SetLeader (SimBaseClass*);
 int    IsMyWingman(SimBaseClass* testEntity);
 int    IsMyWingman(VU_ID testId);
 SimBaseClass* MyWingman(void);
 SimBaseClass* flightLead;
 TransformMatrix threatAxis;
 int    pointCounter;
 void   FollowOrders (void);
 void   CommandFlight (void);
 BOOL   CommandTest(void);
 float   mAzErrInt; // Azimuth error integrator

 //for tankers
 virtual int  IsTanker(void) {return FALSE;}
 virtual void InitBoom(void) {};

public:
 int mLeadGearDown; //1 = true, 0 = false, -1 = uninitalized, -2 = waiting for message

typedef enum AiActionModeTypes {
   AI_RTB,
   AI_LANDING,
   AI_FOLLOW_FORMATION,
   AI_ENGAGE_TARGET,
   AI_EXECUTE_MANEUVER,
         AI_USE_COMPLEX,
   AI_TOTAL_ACTION_TYPES
 };

typedef enum AiSearchModeTypes {
  AI_SEARCH_FOR_TARGET,
   AI_MONITOR_TARGET,
   AI_FIXATE_ON_TARGET,
   AI_TOTAL_SEARCH_TYPES
 };

typedef enum AiDesignatedTypes {
  AI_NO_DESIGNATED,
   AI_TARGET,
   AI_GROUP,
   AI_TOTAL_DESIGNATED_TYPES
 };

typedef enum AiWeaponsAction {
  AI_WEAPONS_HOLD,
   AI_WEAPONS_FREE,
   AI_WEAPONS_ACTION_TOTAL
 };

typedef enum AiThreatPosition {
  AI_THREAT_NONE,
   AI_THREAT_LEFT,
   AI_THREAT_RIGHT,
   AI_TOTAL_THREAT_POSITIONS
 };

private:

 // Mode Arrays
 BOOL     mpActionFlags[AI_TOTAL_ACTION_TYPES];
 BOOL     mpSearchFlags[AI_TOTAL_SEARCH_TYPES];
 int     mCurrentManeuver;

 // Assigned Target
 // SimObjectType*  mpDesignatedTarget;
 VU_ID     mDesignatedObject;
 int     mFormation;
 BOOL     mLeaderTookOff;

 // Mode Basis
 AiDesignatedTypes  mDesignatedType;
 char     mSearchDomain;
 AiWeaponsAction  mWeaponsAction;
 AiWeaponsAction mSavedWeapons;

 // Saved mode Basis
 // AiDesignatedTypes mSaveDesignatedType;
 char     mSaveSearchDomain;
 // AiWeaponsAction  mSaveWeaponsAction;

 BOOL     mInPositionFlag;

 float     mHeadingOrdered;
 float     mAltitudeOrdered;
 float     mSpeedOrdered;

 int      mPointCounter;
 float     mpManeuverPoints[3][2];

 // Last time wingman gave a scheduled report
 VU_TIME     mLastReportTime;
 SimObjectType*   mpLastTargetPtr;

 // Formation Offsets
 BOOL     mSplitFlight;
 float     mFormRelativeAltitude;
 int     mFormSide;
 float     mFormLateralSpaceFactor;

 // Breaking the flight
 void AiSplitFlight(int, VU_ID, int);
 void AiGlueFlight(int, VU_ID, int);

 // Targeting
 void AiRunTargetSelection(void);
 void AiSearchTargetList(VuEntity*);

 // Wingman Decision Fuctions
 void AiRunDecisionRoutines(void);
 void AiCheckManeuvers(void);
 void AiCheckFormation(void);
 void AiCheckEngage(void);
 void AiCheckRTB(void);
 void AiCheckLandTakeoff(void);
 void AiCheckForUnauthLand(VU_ID);

 // Wingman Actions
 void AiPerformManeuver(void);
 void AiFollowLead(void);

 // Wingman Monitor for targets
 void AiMonitorTargets();

 // Wingman Utility Functions
 void AiSaveWeaponState(void);
 void AiRestoreWeaponState(void);

 void AiSaveSetSearchDomain(char);
 void AiRestoreSearchDomain(void);

 void AiSetManeuver(int);
 void AiClearManeuver(void);

 // Commands that modify Action and Search States
 void AiClearLeadersSix(FalconWingmanMsg*);
 void AiCheckOwnSix(FalconWingmanMsg*);
 void AiEngageThreatAtSix(VU_ID);
 void AiBreakLeft(void);
 void AiBreakRight(void);
 void AiGoShooter(void);
 void AiGoCover(void);
 void AiSearchForTargets(char);
 void AiResumeFlightPlan(FalconWingmanMsg*);
 void AiRejoin(FalconWingmanMsg*);
 void AiSetRadarActive(FalconWingmanMsg*);
 void AiSetRadarStby(FalconWingmanMsg*);
 void AiBuddySpikeReact(FalconWingmanMsg*);
 void AiRaygun(FalconWingmanMsg*);

 void AiRTB(FalconWingmanMsg*);

 // Commands that modify the state basis
 void AiDesignateTarget(FalconWingmanMsg*);
 void AiDesignateGroup(FalconWingmanMsg*);
 void AiSetWeaponsAction(FalconWingmanMsg*, AiWeaponsAction);

 // Commands that modify formation
 void AiSetFormation(FalconWingmanMsg*);
 void AiKickout(FalconWingmanMsg*);
 void AiCloseup(FalconWingmanMsg*);
 void AiToggleSide(void);
 void AiIncreaseRelativeAltitude(void);
 void AiDecreaseRelativeAltitude(void);

 // Transient Commands
 void AiGiveBra(FalconWingmanMsg*);
 void AiGiveStatus(FalconWingmanMsg*);
 void AiGiveDamageReport(FalconWingmanMsg*);
 void AiGiveFuelStatus(FalconWingmanMsg*);
 void AiGiveWeaponsStatus(void);

 // Other Commands
 void AiRefuel(void);
 void AiPromote(void);
 void AiCheckInPositionCall(float trX, float trY, float trZ);
 void AiCheckPosition (void);
 void AiCheckFormStrip(void);
 void AiSmokeOn(FalconWingmanMsg*);
 void AiSmokeOff(FalconWingmanMsg*);
 void AiSendUnauthNotice(void);
 void AiHandleUnauthNotice(FalconWingmanMsg*);
// void AiQueryLeadGear(void);
// void AiHandleLeadGearUp(FalconWingmanMsg*);
// void AiHandleLeadGearDown(FalconWingmanMsg*);
 void AiGlueWing(void);
 void AiSplitWing(void);
public:
 void AiCheckPlayerInPosition(void);
 void AiSetInPosition(void);
// void AiHandleGearQuery(void);
private:

 // Execution for Maneuvers
 void AiInitSSOffset(FalconWingmanMsg*);
 void AiInitPince(FalconWingmanMsg*, int doSplit);
 void AiInitFlex(void);
 void AiInitChainsaw(FalconWingmanMsg*);
 void AiInitPosthole(FalconWingmanMsg*);
 void AiInitTrig(mlTrig*, mlTrig*);

 void AiExecBreakRL(void);
 void AiExecPosthole(void);
 void AiExecChainsaw(void);
 void AiExecPince(void);
 void AiExecFlex(void);
 void AiExecClearSix();
 void AiExecSearchForTargets(char);

 // End Wingman Stuff
 

#ifdef USE_SH_POOLS
public:
 // Overload new/delete to use a SmartHeap fixed size pool
 void *operator new(size_t size) { ShiAssert( size == sizeof(DigitalBrain) ); return MemAllocFS(pool); };
 void operator delete(void *mem) { if (mem) MemFreeFS(mem); };
 static void InitializeStorage() { pool = MemPoolInitFS( sizeof(DigitalBrain), 200, 0 ); };
 static void ReleaseStorage() { MemPoolFree( pool ); };
 static MEM_POOL pool;
#endif
 
 
 

The FACBrain

FUNCTION
      void RequestTarget(SimVehicleClass* theFighter);
      void RequestMark(void);
      void RequestLocation(void);
      void RequestTACAN(void);
      void RequestBDA(SimVehicleClass* theFighter);
      SimBaseClass* AssignTarget (void);
      void AddToQ (SimVehicleClass* theFighter);
      void RemoveFromQ (SimVehicleClass* theFighter);
      void FrameExec(SimObjectType*, SimObjectType*);
      FACBrain (AircraftClass *myPlatform, AirframeClass* myAf);
      ~FACBrain (void);
      virtual void PostInsert (void);
 

DATA

      TailInsertList *fighterQ;
      int lastTarget;
      int numInTarget;
      SimBaseClass*controlledFighter;
      CampBaseClass*campaignTarget;

Tanker Brain


Also derived from the digital brain.
enum TnkrType{
  TNKR_KC10,
  TNKR_KC135,
  TNKR_IL78,
  TNKR_UNKNOWN
 };

   private:
      TailInsertList *thirstyQ;
   HeadInsertList *waitQ;
      SimVehicleClass* curThirsty;
   int  numBooms;
   DrawableBSP* rack[3];
   BoomData boom[3];
   TnkrType type;
      int flags;
      float holdAlt;
      SimObjectType* tankingPtr;
      long lastStabalize;
      long lastBoomCommand;

      void CallNext (void);
      void DriveBoom (void);
      void DriveLights (void);
      void BreakAway (void);
      void TurnTo (float newHeading);
      void FollowThirsty (void);
 

   public:

      enum TankerFlags {
         IsRefueling = 0x1,
         PatternDefined = 0x2,
         GivingGas = 0x4,
         PrecontactPos = 0x10,
         ContactPos = 0x20,
   ClearingPlane = 0x40};
      TankerBrain (AircraftClass *myPlatform, AirframeClass* myAf);
      virtual ~TankerBrain (void);
      void FrameExec(SimObjectType*, SimObjectType*);
      int  AddToQ (SimVehicleClass* thirstyOne);
      void RemoveFromQ (SimVehicleClass* thirstyOne);
   int AddToWaitQ (SimVehicleClass* doneOne);
   void PurgeWaitQ (void);
   int TankingPosition(SimVehicleClass* thirstyOne);
   void DoneRefueling (void);
   int IsSet(int flag)    {return (flags & flag) && TRUE;}
   SimObjectType* TankingPtr(void) {return tankingPtr;}

   void OptTankingPosition(Tpoint *pos);
   void BoomWorldPosition(Tpoint *pos);
   void ReceptorRelPosition(Tpoint *pos, SimVehicleClass *thirsty);
   void BoomTipPosition(Tpoint *pos);
   virtual int IsTanker(void) {return TRUE;}
   virtual void InitBoom(void);
   virtual void CleanupBoom(void);

#ifdef USE_SH_POOLS
public:
 // Overload new/delete because our parent class does (and assumes a fixed size)
 void *operator new(size_t size) { return MemAllocPtr(pool, size, 0); };
 void operator delete(void *mem) { if (mem) MemFreePtr(mem); };
#endif
 

The Feature Brain


This class isdefined within the same files as The Base Brain . It's a nonderived baseclass itself. The functionality is still obscure.

 public:
      FeatureBrain (void);
      virtual ~FeatureBrain(void);

      virtual void Exec(void) {}; // ?>>>>>emty function!