The EjectedPilotClass

Superclasses

VuEntity

FalconEntity

Other Subclasses: CampBaseClass , SimBaseClass,TeamClass

SimBaseClass

Other Subclasses:   SimStaticClass

SimMoverClass

Subclasses :SimWeaponClass, SimVehicleClass


EjectedPilotClass


public:
        // Constructors.
        EjectedPilotClass(AircraftClass *ac, int mode);
        EjectedPilotClass (VU_BYTE** stream);
 
        // Destructor.
        virtual ~EjectedPilotClass();

        // Simulation methods.
        virtual void Init(SimInitDataClass *initData);
        virtual int Exec();
//      void ExecFromAircraft();
        virtual void ApplyDamage(FalconDamageMessage *damageMsg);
        virtual void SetDead(int flag);
        virtual int Wake (void);
        virtual int Sleep (void);
   virtual int IsEject (void) {return TRUE;};
        virtual float Mass(void)                {return 20.0F;}

    // virtual function interface
    // serialization functions
    virtual int SaveSize();
    virtual int Save(VU_BYTE **stream); // returns bytes written

        // Access methods.
        virtual void GetTransform(TransformMatrix vmat);

        // Where should the camera look if it is interested in me?
        virtual void GetFocusPoint
        (
                BIG_SCALAR &x,
                BIG_SCALAR &y,
                BIG_SCALAR &z
        );

        // Which aircraft did I eject from?
        AircraftClass *MyAircraft();

        // Get the class type.
        static int ClassType();

        // Get the parent aircraft
        AircraftClass* GetParentAircraft (void);
//      // Tell me when my aircraft has died.
//      void NotifyOfAircraftsDeath();

        // Am I the player pilot?
        BOOL IsPlayerPilot() const;
        // Am I a digi pilot?
        BOOL IsDigiPilot() const;

//      // Can I collide with my own aircraft yet?
//      BOOL CanCollideWithOwnAircraft() const;
 
protected:
        // Right now, EM_F16_MODE1 is the only valid mode.
        void InitData(AircraftClass *ac, int mode);

private:
        // Stage time access functions
        SIM_FLOAT StageEndTime(int stage) const;
        SIM_FLOAT StageEndTime() const;

        // Physical data access functions.
        SIM_FLOAT DragFactor() const;
        SIM_FLOAT Mass() const;
        SIM_FLOAT EjectSpeed() const;
        SIM_FLOAT SeatThrust() const;
        SIM_FLOAT EjectAngle() const;
        SIM_FLOAT StartPitch() const;
        SIM_FLOAT PitchDecay() const;
        SIM_FLOAT YawSpeed() const;
        EP_VECTOR SeatOffset() const;

        // When was the current model created?
        SIM_FLOAT ModelCreateTime(int model) const;

        // Set the ejection sequence mode.
        // This will point us at the correct physical data.
        void SetMode(int mode);

        // Advance time.  This returns delta time.
        void AdvanceTime();

        // Set stage.  This returns the new stage.
        void SetStage(int stage);
        int AdvanceStage();

        // Set the current model to draw.
        void SetModel(int model);
 
        // Initialize each stage of the ejection sequence
        void InitJettisonCanopy();
        void InitEjectSeat();
        void InitFreeFallWithSeat();
        void InitChuteOpening();
        void InitFreeFallWithOpenChute();
        void InitFreeFallWithCollapsedChute();
        void InitSafeLanding();
        void InitCrashLanding();

        // Run each stage of the ejection sequence.
        void RunJettisonCanopy();
        void RunEjectSeat();
        void RunFreeFallWithOpenChute();
        void RunFreeFall();
        void RunCrashLanding();
        void RunSafeLanding();
 
        // Reference the aircraft I ejected from until I am
        // done with the aircraft's data, then dereference it.
//      void ReferenceAircraft(AircraftClass *ac);
//      void DereferenceAircraft();

        // Calculations used in the motion model.
        void CalculateAndSetPositionAndOrientationInCockpit();
        void CalculateThrustVector(EP_VECTOR &result) const;
        void CalculateDragVector(EP_VECTOR &result) const;
        void CalculateGravityVector(EP_VECTOR &result) const;
        void CalculateEjectionVector(EP_VECTOR &result) const;
        void FixOrientationRange();
        void ZeroPitchAndRoll();

        // Have I hit the ground?
        BOOL HasHitGround() const;

        // Handle ground collision.
        void HitGround();

        // Spew some debug info to the mono monitor.
        void SpewDebugData();

        // Returns "Digi" if I am a digi pilot,
        // and "Human" if I am a human pilot.
        char *DigiOrHumanString() const;

        // Aircraft I ejected from.
//      AircraftClass                           *_aircraft;
        VU_ID                                           _aircraftId;
        VU_ID                                           _flightId;

        // Physical data.
        EP_PHYS_DATA                            *_pd;
        int                                                     _stage;

        // Model data.
        EP_MODEL_DATA                           *_md;
        int                                                     _model;

        // Total time the ejected pilot simulation has been running.
        SIM_FLOAT                                       _runTime;
        SIM_FLOAT                                       _deltaTime;
        SIM_FLOAT                                       _endStageTimeAdjust;
        SIM_FLOAT                                       _stageTimer;
 
        // My position and rotation.
        EP_VECTOR                                       _pos;
        EP_VECTOR                                       _rot;

        // My velocity and angular velocity.
        EP_VECTOR                                       _vel;
        EP_VECTOR                                       _aVel;

        // Am I a digital pilot, or a human pilot?
        BOOL                                                    _isDigital;
        // Am I the player or just something else
        BOOL                                                    _isPlayer;

        // Have I hit the ground?
        BOOL                                                    _hitGround;
        SIM_FLOAT                                               _hitGroundTime;

        // Has something caused my chute to collapse?
        BOOL                                                    _collapseChute;
        SIM_FLOAT                                       _chuteCollapsedTime;
 
        // Current model space focus point.
        EP_VECTOR                                       _focusPoint;

        // These are here so that the class type only has to
        // be looked up once (apparently it's expensive).
        static int                                      _classType;
        static BOOL                                     _classTypeFound;

        // Hold on to the death message, I don't die when
        // I'm gunned down, I die when I hit the ground.
        FalconDeathMessage              *_deathMsg;

        // Hold on to the label, since there are multiple bsp's that
        // are used in the ejection sequence.
        char                                                    _label[32];
        DWORD                                                   _labelColor;

        // Do we want the exec function to be called from my aircraft?
//      BOOL                                                    _execFromAircraft;

        // Was exec called from my aircraft?
        BOOL                                                    _execCalledFromAircraft;

        // This is used to sync the transfer of execution control
        SIM_UINT                                                _lastFrameCount;
        int                                                     _execCount;