/*****************************************************************************
 * $Id: game_pony_class.hh,v 1.35 2006/08/26 21:47:51 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	GamePony 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_GAME
#ifndef GAME_PONY_CLASS_HH
#define GAME_PONY_CLASS_HH 1

class ViewRadar;
class CraftF14Tomcat;

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

// Interface:
public:						GamePony( void ) { }
public:						~GamePony() { }
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:    CraftPtrc       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 game modules,
// but keyboard assignments are considered game-specific.
private:	bool			IfAnyKeyPressed( void );
private:	void			PollKeyboard( void );
private:	int				Keyboard( Dyna& dyna, const KeyEvent& keyEvent );
private:	int				KeyboardSpecial( Dyna& dyna, const KeyEvent& keyEvent );

// Joystick:
// (GameJoystick 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( CraftPtrc pursuer, int i, int craftCnt, bool moreRandom = false );
private:	void			UpdateAltitudeLandWater( void );

// 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_GAME_PONY
public:		GamePonyStats		mStats;
#endif

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

#define GAME_PONY_LISTENERS_FRIEND 1
#include "game_pony_listeners.hh"
#undef  GAME_PONY_LISTENERS_FRIEND
};

#endif // GAME_PONY_CLASS_HH
#endif // COMPILING_GAME
