#ifdef ASURA_USE_AXON
//////////////////////////////////////////////////////////////////////////////
//
// Axon_Messages.h
//
// Created by NJD - 22 August 2006
//
// Copyright (C) 2006 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 __AXON_MESSAGES_H__
#define __AXON_MESSAGES_H__ 1

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

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

// asura
#include "Core/Asura_Maths.h"
#include "Network/Asura_Guid.h"

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

//////////////////////////////////////////////////////////////////////////////
//
// Definitions for some core Axon messages.
//
//////////////////////////////////////////////////////////////////////////////

struct Axon_Msg_Create_Goal
{
    enum { CURRENT_VERSION = 0 };
    unsigned int m_uVersion;
    int          m_iOperationMode;
    int          m_iNumBehaviours;
    u_int*       m_puBehaviourTypes;
    int          m_iNumLoops;
    bool         m_bOnceOnlyExecution;
};

struct Axon_Msg_Set_Paused
{
    enum { CURRENT_VERSION = 0 };
    unsigned int m_uVersion;
    bool         m_bPause;
};

struct Axon_Msg_Gamescene_Leave_Node_If_There
{
    enum { CURRENT_VERSION = 0 };
    unsigned int m_uVersion;
    Asura_Guid   m_uNodeGuid;
};

struct Axon_Msg_GS2_Attractor_Node_Pulse
{
    enum { CURRENT_VERSION = 0 };
    unsigned int   m_uVersion;
    Asura_Guid     m_uAttractorGuid;
    Asura_Vector_3 m_xAttractorPosition;
    u_int          m_uAttractorCondition;
	float		   m_fSpeed;

	union
	{
		u_int m_uAttractorMsgFlags;
		struct
		{
			u_int m_bOverrideGamesceneBehaviour : 1,  //Attractor can attract AIs even if they are on gamescene, off by default
                  SpareBits                     : 31;
		};
	};
};

struct Axon_Msg_Gamescene_Attract_To_Node
{
	enum { CURRENT_VERSION = 1 };
	unsigned int	m_uVersion;
	Asura_Guid		m_uAttractorGuid;
	float			m_fSpeed;

	void Initialise()
	{
		m_uVersion = CURRENT_VERSION;
		m_uAttractorGuid = ASURA_GUID_UNREGISTERED;
		m_fSpeed = 1.0f;
	}
};

struct Axon_Msg_Gamescene_Actor_Attract_To_Node
{
	enum { CURRENT_VERSION = 0 };
	unsigned int	m_uVersion;
	Asura_Guid		m_uNodeGuid;
	float			m_fSpeed;

	void Initialise()
	{
		m_uVersion = CURRENT_VERSION;
		m_uNodeGuid = ASURA_GUID_UNREGISTERED;
		m_fSpeed = 1.0f;
	}
};

struct Axon_Msg_GS2_Attractor_Node_Cancel
{
    Asura_Guid m_uAttractorGuid;
};

struct Axon_Msg_GS2_Pathfind_To_Node
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	Asura_Guid   m_uDestNodeGuid;

	void Initialise()
	{
        m_uVersion      = CURRENT_VERSION;
		m_uDestNodeGuid = ASURA_GUID_UNREGISTERED;
	}
};

struct Axon_Msg_GS2_Dont_Stop_At_Node
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	enum { NEXT_NODE, ALL_NODES, SPECIFIC_NODE, CLEAR_SETTINGS };
	int        m_iNodeType;
	// Only used if of type SPECIFIC_NODE.
	Asura_Guid m_uNodeGuid;

	void Initialise()
	{
        m_uVersion  = CURRENT_VERSION;
		m_iNodeType = NEXT_NODE;
		m_uNodeGuid = ASURA_GUID_UNREGISTERED;
	}
};

struct Axon_Msg_GS2_Set_Node_Params
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	enum DataFlags
	{
        STOP_AT_NODE       = 0x00000001,
        ANIM_SET	       = 0x00000002,
        EXIT_CONDITION     = 0x00000004,
		MIN_EXIT_WAIT_TIME = 0x00000008,
		MAX_EXIT_WAIT_TIME = 0x00000010
	};
	int   m_iDataValidFlags;
	bool  m_bStopAtNode;
	u_int m_uAnimSet;
	int   m_iExitCondition;
	float m_fMinExitWaitTime;
	float m_fMaxExitWaitTime;

	void Initialise()
	{
        m_iDataValidFlags  = 0;
        m_bStopAtNode      = false;
        m_uAnimSet         = uAXON_ANIMATION_SEQUENCE_ID_NONE;
		m_iExitCondition   = 0; // = AXON_GS2_NEC_NONE, but I don't want to include the node behaviour file here.
		m_fMinExitWaitTime = 0.0f;
		m_fMaxExitWaitTime = 0.0f;
	}
};

// Instructs the actor on gamescene to take the link if it happens upon it whilst traversing gamescene.
struct Axon_Msg_GS2_Take_Link
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	Asura_Guid   m_uLinkGuid;

	void Initialise()
	{
		m_uVersion  = CURRENT_VERSION;
		m_uLinkGuid = ASURA_GUID_UNREGISTERED;
	}
};

struct Axon_Msg_GS2_Set_Link_Weight
{
	enum { CURRENT_VERSION = 0 };
	u_int m_uVersion;
	u_int m_uNumEntries;
	// This is followed by m_uNumEntries lots of BoolGuidWeight.

	struct BoolGuidWeight
	{
		bool       m_bInUse;
		Asura_Guid m_uLinkGuid;
		float      m_fWeight;
	};
	const BoolGuidWeight* GetBGWArray() const { return reinterpret_cast< const BoolGuidWeight* >( this + 1 ); }
	BoolGuidWeight* GetBGWArray() { return reinterpret_cast< BoolGuidWeight* >( this + 1 ); }

	void Initialise()
	{
        m_uVersion    = CURRENT_VERSION;
		m_uNumEntries = 0;
	}
};

struct Axon_Msg_GS2_Anim_Change
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	unsigned int m_uAnimSet;

	void Initialise()
	{
        m_uVersion = CURRENT_VERSION;
		m_uAnimSet = uAXON_ANIMATION_SEQUENCE_ID_NONE;
	}
};

struct Axon_Msg_GS2_Teleport_To_Node
{
	enum { CURRENT_VERSION = 0 };
	unsigned int m_uVersion;
	Asura_Guid   m_uNodeGuid;

	void Initialise()
	{
		m_uVersion  = CURRENT_VERSION;
		m_uNodeGuid = ASURA_GUID_UNREGISTERED;
	}
};

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

#endif //__AXON_MESSAGES_H__
#endif // ASURA_USE_AXON
