/*****************************************************************************
 * $Id: mod_pony_craft.hh,v 1.1 2006/11/24 21:56:58 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Craft derivative class.
 *//*
 * LEGAL:	COPYRIGHT (C) 2004 JIM E. BROOKS
 *          THIS SOURCE CODE IS RELEASED UNDER THE TERMS
 *          OF THE GNU GENERAL PUBLIC LICENSE (GPL).
 *****************************************************************************/

#if COMPILING_MODULE_PONY
#ifndef MOD_PONY_CRAFT_HH
#define MOD_PONY_CRAFT_HH 1

#include "eng_dyna_part.hh"

////////////////////////////////////////////////////////////////////////////////
/// @brief Craft F-14 Tomcat class.
class CraftF14Tomcat : public Craft
{
private:
	PREVENT_COPYING(CraftF14Tomcat)
	typedef Craft Parent;

public:
					CraftF14Tomcat( QuadrantPtrConst q, const Position& pos, const vector<string>& fnameModelVec );
					~CraftF14Tomcat();
    void            Reset( void );
	const string	GetName( void ) { return string("CraftF14Tomcat"); }
	int				Animate( void );
    void    		Rotate( uint axis, Degree deg );
    bool            AdjustTailplanes( const fp dirLeft, const fp dirRight );
    void            RetractLandingGears( void );
    void            ExtendLandingGears( void );
    void            ToggleLandingGears( void )
    {
        if ( mGearState == eGear_UP )
            mGearState = eGear_DOWN;
        else if ( mGearState == eGear_DOWN )
            mGearState = eGear_UP;
    }

private:
    void            SaveLocalVertexsNormals( vector<LocalVertex>& savedLocalVertexs /*OUT*/, vector<pair<Normal,Nix> >& savedLocalNormals /*OUT*/, const vector<Vix>& vixs );
	bool			AdjustWings( void );
    void            AdjustWings2( const Degree deg );
	bool			AdjustGloveVanes( const Degree degSweep );
    bool            AdjustTailplanes( void );
    bool            AdjustOneTailplane( Degree& deg, Degree& degGoal, MeshPart& part );
    bool            AdjustGears( void );
    void            AdjustGears2( const Degree deg );

	void SetVertexCnt( uint vcnt ) { }				// OBJECT NOP
	void SetWorldVertexs( WorldVertex* wv ) { }		// OBJECT NOP

private:
	Degree              mDegSweep;						///< current wing sweep (degrees)
	Degree              mDegGloveVanes;
    Degree              mDegLeftTailplane,     mDegRightTailplane;      ///< current degree
    Degree              mDegLeftTailplaneGoal, mDegRightTailplaneGoal;  ///< what degree tailplanes should stop rotating at
	Degree              mDegGears;
	uint                mAdjustWingsMilsec;             ///< last time when wings were adjusted
	uint                mAdjustGearsMilsec;             ///< last time when wings were adjusted
    enum eGear { eGear_DOWN, eGear_UP };
    eGear               mGearState;
    MeshPart            mPartLeftWing;
    MeshPart            mPartRightWing;
    MeshPart            mPartLeftGloveVane;
    MeshPart            mPartRightGloveVane;
    MeshPart            mPartLeftTailplane;
    MeshPart            mPartRightTailplane;
    MeshPart            mPartFrontGear;
    MeshPart            mPartLeftGear;
    MeshPart            mPartRightGear;
};

#endif // MOD_PONY_CRAFT_HH
#endif // COMPILING_MODULE_PONY
