The SimAircraftClass

Superclasses

VuEntity

FalconEntity

Other Subclasses: CampBaseClass , SimBaseClass,TeamClass

SimBaseClass

Other Subclasses:   SimStaticClass

SimMoverClass

Subclasses :SimWeaponClass, EjectedPilotClass


SimVehicleClass

Subclasses: SimGroundVehicle,SimHelicopter,[GNDAI]

SimAircraftClass


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

public:
        enum AutoPilotType      {ThreeAxisAP, WaypointAP, CombatAP, APOff};
   enum ACFLAGS {
      isF16    = 0x1,
      hasSwing = 0x2,};
        AircraftClass           (int flag, VU_BYTE** stream);
        AircraftClass           (int flag, FILE* filePtr);
        AircraftClass           (int flag, int type);
        virtual ~AircraftClass          (void);

        float                                   glocFactor;
        int                                             fireGun, fireMissile, lastPickle;
        FackClass*                              mFaults;
        AirframeClass*                  af;
        FireControlComputer*    FCC;
        SMSClass*                               Sms;
        GunClass*                              Guns;

        virtual void    Init (SimInitDataClass* initData);
        virtual int        Wake(void);
        virtual int     Sleep(void);
        virtual int             Exec (void);
        virtual void    JoinFlight (void);
        virtual void    InitData (int);
        virtual void    Cleanup(void);

        int            CombatClass (void);
        void           SetAutopilot (AutoPilotType flag);
        AutoPilotType   AutopilotType (void) {return autopilotType;};
        VU_ID            HomeAirbase(void);
        VU_ID            TakeoffAirbase(void);
        VU_ID            LandingAirbase(void);
        VU_ID            DivertAirbase(void);
        void           DropProgramed (void);
   int            IsF16 (void) {return (acFlags & isF16 ? TRUE : FALSE);}

    virtual void        SetVt(float newvt);
        virtual void    SetKias(float newkias);
        void                    ResetFuel (void);
        virtual long    GetTotalFuel (void);
        virtual void    GetTransform(TransformMatrix vmat);
        virtual void    ApplyDamage (FalconDamageMessage *damageMessage);
        virtual void    SetLead (int flag);
        virtual void    ReceiveOrders (FalconEvent* newOrder);
        virtual float   GetP (void);
        virtual float   GetQ (void);
        virtual float   GetR (void);
        virtual float   GetAlpha (void);
        virtual float   GetBeta (void);
        virtual float   GetNx(void);
        virtual float   GetNy(void);
        virtual float   GetNz(void);
        virtual float   GetGamma(void);
        virtual float   GetSigma(void);
        virtual float   GetMu(void);
        virtual void    MakePlayerVehicle(void);
        virtual void    MakeNonPlayerVehicle(void);
        virtual void    MakeLocal (void);
        virtual void    MakeRemote (void);
        virtual void    ConfigurePlayerAvionics(void);
        virtual void    SetVuPosition (void);
        virtual void    Regenerate (float x, float y, float z, float yaw);
        virtual                 FireControlComputer* GetFCC(void) { return FCC; };
        virtual SMSBaseClass* GetSMS(void) { return (SMSBaseClass*)Sms; };
   virtual int HasSPJamming (void);
   virtual int HasAreaJamming (void);

#ifdef _DEBUG
        virtual void    SetDead (int);
#endif // _DEBUG

        // private:
public:
        long                            mCautionCheckTime;
        BOOL                            MPOCmd;
        char                            dropChaffCmd;
        char                            dropFlareCmd;
        int            acFlags;
        AutoPilotType         autopilotType;
        VU_TIME        dropProgrammedTimer;
        unsigned short          dropProgrammedStep;
        int                                     isDigital;
        float                           bingoFuel;
        TransformMatrix         vmat;
        float                           gLoadSeconds;
        long                            lastStatus;
        BasicWeaponStation      counterMeasureStation[3];
        DrawableTrail*          smokeTrail[4];
        BOOL                            playerSmokeOn;
        DrawableGroundVehicle* pLandLitePool;
        BOOL                            mInhibitLitePool;
        void                            CleanupLitePool(void);

        void    DoWeapons (void);
        float   GlocPrediction (void);
        void    InitCountermeasures(void);
        void    CleanupCountermeasures(void);
        void    InitDamageStation(void);
        void    CleanupDamageStation (void);
        void    DoCountermeasures(void);
        void    DropChaff(void);
        void    DropFlare(void);
        void    GatherInputs(void);
        void    RunSensors(void);
        BOOL    LandingCheck( float noseAngle, float impactAngle, int groundType );
        void    GroundFeatureCheck( float groundZ );
        void    RunExplosion(void);
        void    ShowDamage (void);
        void    CleanupDamage(void);
        void    MoveSurfaces(void);
        void    RunGear (void);
        void    ToggleAutopilot (void);
        void    OnGroundInit (SimInitDataClass* initData);
        void    CheckObjectCollision( void );
        void    CheckPersistantCollision( void );
        void    CautionCheck (void);

        DigitalBrain *DBrain(void)                      {return (DigitalBrain *)theBrain;}
        TankerBrain *TBrain(void)                       {return (TankerBrain *)theBrain;}
        // so we can discover we have an aircraft at the falcentity level
        virtual int IsAirplane(void) {return TRUE;}
        virtual float   Mass(void);

        // Has the player triggered the ejection sequence?
        BOOL    ejectTriggered;
        float   ejectCountdown;
        BOOL    doEjectCountdown;

        void RemovePilot(void);
        void RunCautionChecks(void);

        // Run the ejection sequence
        void Eject(void);
   virtual int HasPilot (void) {return (IsSetFlag(PILOT_EJECTED) ? FALSE : TRUE);};

   // Public for debug
        void AddFault(int failures, unsigned int failuresPossible, int numToBreak, int sourceOctant);

private:

        //used for safe deletion of sensor array when making a player vehicle
        SensorClass** tempSensorArray;
    int tempNumSensors;

protected:
int SetDamageF16PieceType (DamageF16PieceStructure *piece, int type, int flag, int mask, float speed);
int CreateDamageF16Piece (DamageF16PieceStructure *piece, int *mask);
int CreateDamageF16Effects ();
void SetupDamageF16Effects (DamageF16PieceStructure *piece);