//////////////////////////////////////////////////////////////////////////////
//
// AVP_GS2_AnimPackage.h
//
// Copyright (C) 2009 Rebellion. All Rights Reserved.
//
//////////////////////////////////////////////////////////////////////////////

// B E G I N   F I L E   W R A P P E R ///////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
#pragma once
#endif

#ifndef __AVP_GS2_ANIMPACKAGE_H__
#define __AVP_GS2_ANIMPACKAGE_H__ 1

// E N D   F I L E   W R A P P E R ///////////////////////////////////////////

// I N C L U D E S ///////////////////////////////////////////////////////////

// axon
#include "AnimTemplates/Axon_GS2_AnimPackage.h"

//////////////////////////////////////////////////////////////////////////////
//
// Mapping Factors
// Note that all mapping factors must have a "don't care" option, so they
// can be ignored for mappings if required.
//
//////////////////////////////////////////////////////////////////////////////

// Don't move any of these entries around as they are saved out.
// These must be consecutive, as arrays are built using their values.
// These entries are ordered by priority.
enum AVP_GS2_MAPPING_FACTOR
{
	AVP_GS2_MF_SKIN = 0,
	AVP_GS2_MF_WEAPON,

	NUM_AVP_GS2_MAPPING_FACTORS
};

// Used to provide data to the anim package when working out which mapping matches.
struct AVP_GS2_AnimMappingData
{
	u_int m_auFactorValues[ NUM_AVP_GS2_MAPPING_FACTORS ];
};

// Will probably have to add more of these in future.
// Only add at the end, as these are saved out.
enum AVP_WeaponMappingFactors
{
	AVP_WMF_X, // "don't care"
	AVP_WMF_FLAMETHROWER,
	AVP_WMF_SHOTGUN,
	AVP_WMF_SMARTGUN,

	AVP_WMF_NUM_WEAPONMAPPINGFACTORS
};

//////////////////////////////////////////////////////////////////////////////
//
// AVP_GS2_AnimMapping
//
//////////////////////////////////////////////////////////////////////////////

class AVP_GS2_AnimMapping : public Axon_GS2_AnimMapping
{
	typedef Axon_GS2_AnimMapping PARENT;

public:
	virtual void ReadFromChunkStream( Asura_Chunk_Stream& xStream );
	virtual void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

	virtual bool Matches( const void* pMappingData ) const;

#ifdef ASURA_TOOLS
	u_int& GetFactor( u_int u ) { return m_auFactors[ u ]; }
#endif

private:
	u_int m_auFactors[ NUM_AVP_GS2_MAPPING_FACTORS ];

private:
	static const u_int uCURRENT_CHUNK_VERSION = 0;
};

//////////////////////////////////////////////////////////////////////////////
//
// AVP_GS2_AnimPackage
//
//////////////////////////////////////////////////////////////////////////////

class AVP_GS2_AnimPackage : public Axon_GS2_AnimPackage
{
	typedef Axon_GS2_AnimPackage PARENT;

public:
	AVP_GS2_AnimPackage();

	virtual void ReadFromChunkStream( Asura_Chunk_Stream& xStream );
#ifdef ASURA_TOOLS
	virtual void WriteToChunkStream( Asura_Chunk_Stream& xStream ) const;

	void SetFinalPosture( u_int u ) { m_uFinalPosture = u; }
	void SetFinalPose( u_int u )    { m_uFinalPose = u; }
#endif

	u_int GetFinalPosture() const { return m_uFinalPosture; }
	u_int GetFinalPose()    const { return m_uFinalPose; }

protected:
	virtual Axon_GS2_AnimMapping* CreateAnimMapping( bool bSetToDefaults );

private:
	// Posture and pose to set once the animation has played.
	u_int m_uFinalPosture;
	u_int m_uFinalPose;

	static const u_int uCURRENT_CHUNK_VERSION = 0;
};

//////////////////////////////////////////////////////////////////////////////
//
// 
//
//////////////////////////////////////////////////////////////////////////////

#endif //__AVP_GS2_ANIMPACKAGE_H__
