
///////////////////////////////////////////////////////////////////////////////
//
// File   : AVP_Projectile_Messages.h
// Author : Chris Wallace
// Date   : 21-Feb-2007
//
// Copyright (C) 2007 Rebellion, All Rights Reserved.
//
///////////////////////////////////////////////////////////////////////////////

#ifdef ASURA_USE_PRAGMA_ONCE
	#pragma once
#endif   // ifdef ASURA_USE_PRAGMA_ONCE

#ifndef __AVP_PROJECTILE_MESSAGES_H__
#define __AVP_PROJECTILE_MESSAGES_H__

////////////////////////////////////////////////////////////////////////////////
// Include files...
////////////////////////////////////////////////////////////////////////////////

// asura
#include "Core/Asura_Maths.h"
#include "Entity/PhysicalObject/AVP_PhysicalObject_Messages.h"
#include "Network/Asura_Guid.h"


////////////////////////////////////////////////////////////////////////////////
// Forward class declarations...
////////////////////////////////////////////////////////////////////////////////

class AVP_ServerEntity_Projectile;
class AVP_ServerProjectile_GenericProjectile;
class AVP_ServerProjectile_Disc;
class AVP_ServerProjectile_Mine;

////////////////////////////////////////////////////////////////////////////////
// Class declaration...
////////////////////////////////////////////////////////////////////////////////


class AVP_Message_ProjectileClientUpdate : public AVP_Message_PhysicalObject_ClientUpdate
{
public:
	u_int	GetDisarmFlag() const			{ return m_uDisarmFlag; }
	u_int	GetOwnerGuid() const			{ return m_uOwnerGuid; }
	float	GetScale() const				{ return m_fScale; }

	void	FillProjectile(const AVP_ServerEntity_Projectile* pxData);

#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
	static void RegisterFields(u_short usMsgID, u_short usEntityClassification);
	static void RegisterFields(class Asura_NetMsg* pxNetMsg);
	static u_char GetNumFields() { return 3 + PARENT::GetNumFields(); }
#endif//#ifdef ASURA_SUPPORT_NETMSG_SYSTEM

protected:
	typedef AVP_Message_PhysicalObject_ClientUpdate PARENT;
	
	u_int	m_uDisarmFlag;
	u_int	m_uOwnerGuid;
	float	m_fScale;
};

class AVP_Message_GenericProjectileClientUpdate : public AVP_Message_ProjectileClientUpdate
{
public:
	bool	GetIsEmbedded() const			{ return m_bIsEmbedded; }

	void	FillGenericProjectile(const AVP_ServerProjectile_GenericProjectile* pxData);

#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
	static void RegisterFields(u_short usMsgID, u_short usEntityClassification);
	static void RegisterFields(class Asura_NetMsg* pxNetMsg);
	static u_char GetNumFields() { return 1 + PARENT::GetNumFields(); }
#endif//#ifdef ASURA_SUPPORT_NETMSG_SYSTEM

protected:
	typedef AVP_Message_ProjectileClientUpdate PARENT;

	bool	m_bIsEmbedded;
};

class AVP_Message_DiscClientUpdate : public AVP_Message_ProjectileClientUpdate
{
public:
	void	FillDisc( const AVP_ServerProjectile_Disc* xDisc );

	u_int	GetDiscState() const			{ return m_uDiscState; }

#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
	static void RegisterFields(u_short usMsgID, u_short usEntityClassification);
	static void RegisterFields(class Asura_NetMsg* pxNetMsg);
	static u_char GetNumFields() { return 1 + PARENT::GetNumFields(); }
#endif//#ifdef ASURA_SUPPORT_NETMSG_SYSTEM

protected:
	u_int	m_uDiscState;

	typedef AVP_Message_ProjectileClientUpdate PARENT;
};

class AVP_Message_MineClientUpdate : public AVP_Message_ProjectileClientUpdate
{
public:
	void	FillMine( const AVP_ServerProjectile_Mine* xMine );

	u_int	GetMineState() const		{ return m_uMineState; }
	float	GetDetonationOffset() const	{ return m_fDetonationOffset; }

#ifdef ASURA_SUPPORT_NETMSG_SYSTEM
	static void RegisterFields(u_short usMsgID, u_short usEntityClassification);
	static void RegisterFields(class Asura_NetMsg* pxNetMsg);
	static u_char GetNumFields() { return 1 + PARENT::GetNumFields(); }
#endif//#ifdef ASURA_SUPPORT_NETMSG_SYSTEM

protected:
	u_int	m_uMineState;
	float	m_fDetonationOffset;

	typedef AVP_Message_ProjectileClientUpdate PARENT;
};

class AVP_Message_CreateGenericProjectile
{
public:
	void					SetPosition( const Asura_Vector_3& xPos )					{ m_xPosition = xPos; }
	const Asura_Vector_3&	GetPosition() const											{ return m_xPosition; }
	
	void					SetOrientation( const Asura_Quat& xOri )					{ m_xOrientation = xOri; }
	const Asura_Quat&		GetOrientation() const										{ return m_xOrientation; }
	
	void					SetDamageScale( const float fScale )						{ m_fDamageScale = fScale; }
	float					GetDamageScale() const										{ return m_fDamageScale; }

	void					SetProjectileBlueprintHash( const Asura_Hash_ID uBPHash )	{ m_uProjectileBPHash = uBPHash; }
	Asura_Hash_ID			GetProjectileBlueprintHash() const							{ return m_uProjectileBPHash; }
	
	void					SetLaunch( const bool bLaunch )								{ m_bLaunch = bLaunch; }
	bool					GetLaunch() const											{ return m_bLaunch; }

	void					SetActorVelocity( const Asura_Vector_3& ActorVel ) 			{ m_xActorVel = ActorVel; }
	const Asura_Vector_3&	GetActorVelocity() const									{ return m_xActorVel; }

	void					SetTargetGuid( const Asura_Guid uGuid ) 					{ m_uTargetGuid = uGuid; }
	Asura_Guid				GetTargetGuid() const										{ return m_uTargetGuid; }

protected:
	Asura_Vector_3	m_xPosition;
	Asura_Vector_3	m_xActorVel;
	Asura_Quat		m_xOrientation;
	float			m_fDamageScale;
	Asura_Hash_ID	m_uProjectileBPHash;
	bool			m_bLaunch;
	Asura_Guid		m_uTargetGuid;
};

class AVP_Message_CreateProjectile_Disc : public AVP_Message_CreateGenericProjectile
{
public:
//	void		SetTargetData( Asura_Guid uGuid, Asura_Hash_ID uHash ) { m_uGuid = uGuid; m_uHash = uHash; }
//	void		GetTargetData( Asura_Guid& uGuid, Asura_Hash_ID& uHash ) const { uGuid = m_uGuid; uHash = m_uHash; }

	void		SetBounceMode(bool bBounce) { m_bBounceMode = bBounce; }
	bool		GetBounceMode(void) const { return(m_bBounceMode); }

	void		SetLaserTargetMode( bool bIsInLaserTargetMode )		{ m_bIsInLaserTargetMode = bIsInLaserTargetMode; }
	bool		GetLaserTargetMode() const							{ return m_bIsInLaserTargetMode; }

private:
//	Asura_Guid		m_uGuid;	// Guid and Hash are not used anymore. Because disc can't be lock on specific target anymore. It follows laser instead.
//	Asura_Hash_ID	m_uHash;	// Guid and Hash are not used anymore. Because disc can't be lock on specific target anymore. It follows laser instead.
	bool			m_bBounceMode;
	bool			m_bIsInLaserTargetMode;

	AVP_Message_CreateProjectile_Disc  (const AVP_Message_CreateProjectile_Disc& xOther);
	AVP_Message_CreateProjectile_Disc&	operator=	(const AVP_Message_CreateProjectile_Disc& xOther);
};

class AVP_Message_CreateProjectile_Mine : public AVP_Message_CreateGenericProjectile
{
public:

private:
	Asura_Guid		m_uGuid;
	Asura_Hash_ID	m_uHash;

	AVP_Message_CreateProjectile_Mine  (const AVP_Message_CreateProjectile_Mine& xOther);
	AVP_Message_CreateProjectile_Mine&	operator=	(const AVP_Message_CreateProjectile_Mine& xOther);
};

#endif   // ifndef __AVP_PROJECTILE_MESSAGES_H__

/// End of file. ///
