// AnimNode.h: interface for the CAnimNode class.
//
//////////////////////////////////////////////////////////////////////

#if !defined(AFX_ANIMNODE_H__55E965C5_6AD6_11D3_9C1B_00609712FBEF__INCLUDED_)
#define AFX_ANIMNODE_H__55E965C5_6AD6_11D3_9C1B_00609712FBEF__INCLUDED_

#if _MSC_VER > 1000
#pragma once
#endif // _MSC_VER > 1000

#include "mw4headers.hpp"
#include "Vehicle.hpp"
#include "MechAnimationState.hpp"

class CAnimTypeNode;
class CCurveTypeNode;
class CAttribTypeNode;
class CParamNode;

class CAnimNode : public CObject  
{
private:
	CString m_strName;
protected:
	bool m_bIsTransition;
public:
	CMapWordToOb m_mapParams;		//Map of WORD(Type Name Token) - CString( Value )
	HTREEITEM m_hItem;
	bool m_bValid;

	CParamNode *GetParam(int);
	CParamNode *SetParam(int,CParamNode *);
	
	CAnimNode(CString);
	virtual ~CAnimNode();

	CParamNode *CreateParam(int,Page * = NULL);
	void CreateAnimTypeParams(CAnimTypeNode *,Page * = NULL);
	CString GetName() {return m_strName;}
	bool IsTransition() {return m_bIsTransition;}
	virtual bool LoadState(Page *);
	virtual bool SaveState(NotationFile *);
};

// These are the data section objects
// There is really nothing unique only to Animation State nodes
class CAnimStateNode : public CAnimNode
{
public:
	CAnimStateNode(CString);
	virtual ~CAnimStateNode();

	virtual bool LoadState(Page *);
};

// Transition State nodes have the basic stuff, and more parameters
class CTransStateNode : public CAnimStateNode
{
public:
	CAnimNode *m_pStartNode;
	CAnimNode *m_pEndNode;

	CTransStateNode(CAnimStateNode *,CAnimStateNode *);
	virtual ~CTransStateNode ();

	virtual bool LoadState(Page *);
};






// NOTE: When adding new type, make sure that in the AnimNode::CreateParam it has an associated node
// that filter is set up from CPageAnimType::ShowParam()
// that the animation type params have the parameters linked
enum // Enumerate the parameter types
{
	PARAM_ANIMTYPE = 0,	// All AnimNodes will have this in their parameter map
	PARAM_START,
	PARAM_POSITION,
	PARAM_ANIM,
	PARAM_STARTOVERLAPCURVE,
	PARAM_ENDOVERLAPCURVE,
	PARAM_TRANSITIONSTART,
	PARAM_PLAYOLDSTATETILL,
	PARAM_OVERRIDENEWSTATEPOSITION,
	PARAM_STARTNEWSTATE,
	PARAM_PITCHATTRIB,
	PARAM_ROLLATTRIB,
	PARAM_SPEEDATTRIB,
	PARAM_FASTANIM,
	PARAM_SLOWANIM,
	PARAM_SLOWSPEEDMULTIPLIER,
	PARAM_LERPTIME,
	PARAM_SLOWUPANIM,
	PARAM_SLOWEVENANIM,
	PARAM_SLOWDOWNANIM,
	PARAM_FASTUPANIM,
	PARAM_FASTEVENANIM,
	PARAM_FASTDOWNANIM,
	PARAM_UPANIM,
	PARAM_EVENANIM,
	PARAM_DOWNANIM,
	PARAM_LEFTANIM,
	PARAM_RIGHTANIM,
	PARAM_SLOWLEFTANIM,	
	PARAM_SLOWRIGHTANIM,
	PARAM_FASTLEFTANIM,	
	PARAM_FASTRIGHTANIM,

	PARAM_COUNT
};
// Text defined in AnimNode.cpp

// These are Parameter map objects

// Base class for all param nodes (the node specific for the Animation Type
class CParamNode : public CObject 
{
public:
	int m_iParamType;

	CParamNode();
	virtual ~CParamNode() {};

	CString GetKeyString();
	virtual CString GetValueString();	//Returns the display output string (for human readability)
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

class CAnimTypeNode : public CParamNode
{
public:
	CString m_strName;
	int m_iIndex;
	int m_iType;

	CAnimTypeNode(int);
	virtual ~CAnimTypeNode() {};

	virtual CString GetValueString();
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

class CCurveTypeNode : public CParamNode, public MechWarrior4::AnimCurve
{
public:
	CString m_strName;
	int m_iType;
	CCurveTypeNode(int,int);
	virtual ~CCurveTypeNode() {};

	virtual CString GetValueString();
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

class CAttribTypeNode : public CParamNode
{
public:
	CString m_strName;
	int m_iType;
	CAttribTypeNode(int,int);
	virtual ~CAttribTypeNode() {};

	virtual CString GetValueString();
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

class CFloatNode : public CParamNode
{
public:
	float m_fValue;

	CFloatNode(int);
	virtual ~CFloatNode() {};

	virtual CString GetValueString();
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

class CPathNode : public CParamNode
{
public:
	CString m_strPath;
	MW4Animation::AnimData *m_pAnimData;
	
	CPathNode(int);
	virtual ~CPathNode();

	virtual CString GetValueString();
	virtual bool OnModify();
	virtual CString GetValue();		// Returns the file output string (for computer readability)
	virtual bool SetValue(CString);		// Load the values, based on a string
};

#endif // !defined(AFX_ANIMNODE_H__55E965C5_6AD6_11D3_9C1B_00609712FBEF__INCLUDED_)
