/*****************************************************************************
 * $Id: mod_pony_class.hh,v 1.2 2006/11/25 17:38:09 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	ModulePony class.
 * @remarks	Moving this out of the main header file solved header dependencies.
 *//*
 * 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
#ifndef MOD_PONY_CLASS_HH
#define MOD_PONY_CLASS_HH 1

#include "mod_pony_weather.hh"

class ViewRadar;
class CraftF14Tomcat;

////////////////////////////////////////////////////////////////////////////////
/// @brief ModulePony state.
/// @remarks Module object construction and starting a module are separated
/// as a Module object is needed early in program initialization before it starts.
class ModulePony : public Module
{
PREVENT_COPYING(ModulePony)
private: typedef Module Parent;

// Interface:
public:						ModulePony( void ) { }
public:						~ModulePony() { }
public:		int				Init( int argc, char** argv, const string& appname );
public:		void			Start( void );
public:		void			End( void );
private:	void			SelfChecks( void );
public:		void			Cmdarg( int argc, char** argv );
public:		bool			IfGameMode( void ) { return mCmdarg.mGame; }
public:		void			ResetScene( void );
private:    CraftPtrConst   GetCurrentCraftOrNULL( void );  // restricted, try to use Engine::GetCurrent() instead!
private:    CraftF14Tomcat* GetCraftF14TomcatOrNULL( void );  // restricted, try to use Engine::GetCurrent() instead!
public:		int				Animate( void );
#ifndef NO_PYTHON
public:		const string&	GetPythonDir( void ) { ASSERT( ! mPythonDir.empty() ); return mPythonDir; }
#endif
public:		const string&	GetModelDir( void )  { ASSERT( ! mModelDir.empty() ); return mModelDir; }
public:		void			Tick( void );
public:		bool			IfEasterEgg( void ) { return mCmdarg.mEasterEgg; }
public:		bool			IfRude( void ) { return mCmdarg.mRude; }

// Initialization:
private:	void			StartStopListeners( bool start );
#ifndef NO_PYTHON
private:	bool			StartPython( bool startGame );
#endif

// Configuration:
public:		ConfigFile&     GetConfigFile( void );  // may return a dummy ConfigFile similar to a bad-but-safe C++ stream
public:		bool			SaveState( bool saveView );
private:	bool			LoadState( void );

// Keyboard:
// Much joystick functionality is common to all modules,
// but keyboard assignments are considered module-specific.
private:	void			PollKeyboard( void );
private:	bool			IfAnyKeyWasPressed( void );
private:	bool			Keyboard( Dyna& dyna, const KeyEvent& keyEvent );
private:	bool			KeyboardSpecial( Dyna& dyna, const KeyEvent& keyEvent );
private:	bool			KeyboardRelease( Dyna& dyna, const KeyEvent& keyEvent );
private:	bool			KeyboardSpecialRelease( Dyna& dyna, const KeyEvent& keyEvent );

// Joystick:
// (ModuleJoystick object)

// Misc:
public:		virtual bool	IfDemoMode( void ) const { return false; }		///< deprecated
public:		virtual fp		DemoModeAltitude( void ) const { return 0.0; }	///< deprecated
private:	void			StartTurkeyShoot( int craftCnt );
private:	void			SpawnTurkey( CraftPtrConst pursuer, int i, int craftCnt, bool moreRandom = false );
public:		Weather			mWeather;

// Data members:
public:		std::list<Team>		mTeamList;
private:	string				mModelDir;
#ifndef NO_PYTHON
private:	string				mPythonDir;
#endif
private:	fp					mDefaultFogDensity;
private:	DynaConfigState		mPlayer1ConfigState;
private:	DynaConfigState		mPlayer2ConfigState;
public:		fp					mAltitudeLand;
public:		fp					mAltitudeWater;
#if STATS && COMPILING_MODULE_PONY
public:		ModulePonyStats		mStats;
#endif

public:
	////////////////////////////////////////////////////////////////////////////////
	/// @brief Command-line args.
	/// Only those args whose values are needed after initialization are defined.
	/// The base Module class and derived Module classes have separate Cmdarg objects.
	struct ModulePonyCmdarg
	{
		ModulePonyCmdarg( void )
		{
			mNoReload = \
			mReloadView = \
			mDemo = \
			mGame = \
			mTreeDensity = \
			mHillDensity = \
			mFogDensity = \
			mCloudDensity = \
            mSunset = \
			mGuiZoom = \
			mRude = \
			mEasterEgg = false;
		}
		bool	mNoReload;
		bool	mReloadView;
		bool	mDemo;
		bool	mGame;
		bool	mTreeDensity;
		bool	mHillDensity;
		bool	mFogDensity;
		bool	mCloudDensity;
		bool	mSunset;
		bool	mGuiZoom;
		bool	mRude;
		bool	mEasterEgg;
	};
	ModulePonyCmdarg	mCmdarg;

#define MODULE_PONY_LISTENERS_FRIEND 1
#include "mod_pony_listeners.hh"
#undef  MODULE_PONY_LISTENERS_FRIEND
};

#endif // MOD_PONY_CLASS_HH
#endif // COMPILING_MODULE
