/*****************************************************************************
 * $Id: mod_base_config.hh,v 1.1 2006/11/24 21:56:57 devel Exp $
 * @file
 * @author	Jim E. Brooks  http://www.jimbrooks.org
 * @brief	Configuration, load/state state.
 *//*
 * 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_BASE_CONFIG_HH
#define MOD_BASE_CONFIG_HH 1

// Key common to all modules but values are specific.
const string cfgkey_module = "module";

extern string cfgkey_lod;
extern string cfgkey_seed;
extern string cfgkey_window_width;
extern string cfgkey_window_height;
extern string cfgkey_collisions;
extern string cfgkey_response_eye;
extern string cfgkey_joystick;
extern string cfgkey_joystick_axis3;
extern string cfgkey_joy_left_min;
extern string cfgkey_joy_left_max;
extern string cfgkey_joy_right_min;
extern string cfgkey_joy_right_max;
extern string cfgkey_joy_up_min;
extern string cfgkey_joy_up_max;
extern string cfgkey_joy_down_min;
extern string cfgkey_joy_down_max;
extern string cfgkey_joy_slow_min;
extern string cfgkey_joy_slow_max;
extern string cfgkey_joy_fast_min;
extern string cfgkey_joy_fast_max;
extern string cfgkey_prefix_eye;

/// A Dyna's config state is interimly loaded into this struct
/// because LoadState() is called before the module creates Dyna/Craft objects.
class DynaConfigState
{
			PREVENT_COPYING(DynaConfigState)
public:
			DynaConfigState( void );
	void	LoadDyna( Dyna& dyna );
	void	SetXm( const MatrixExt& xm );
	void	SetChasePlaneDistance( double chasePlaneDistance );
	void	SetControlResponse( Percent controlResponse );

private:
	bool        mXmValid;
	MatrixExt   mXm;
	bool        mChasePlaneDistanceValid;
	double      mChasePlaneDistance;
	bool        mControlResponseValid;
	Percent     mControlResponse;
};

void
ConfigSaveDyna( ConfigFile& config, const string& prefix, const Dyna& dyna, double chaseDist );

void
ConfigLoadDyna( ConfigFile& config, const string& prefix, DynaConfigState& dynaConfigState );

void
ConfigCopyMatrix( MatrixExt& dest, const Dyna& dyna );

#endif // MOD_BASE_CONFIG_HH
#endif // COMPILING_MODULE
