//////////////////////////////////////////////////////////////////////////////
//
// AVP_ClientEntity_PhysicsObject.h
//
// 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 AVP_CLIENTENTITY_PHYSICSOBJECT_H___
#define AVP_CLIENTENTITY_PHYSICSOBJECT_H___ 1

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

// Engine independent.
#include "Entity/PhysicalObject/Asura_ClientEntity_PhysicsObject.h"

// Project independent.
#include "Entity/PhysicalObject/AVP_ClientEntity_PhysicalObject.h"

class AVP_Message_PhysicsObject_ClientUpdate;
class AVP_Message_PhysicsObject_ClientCreate;

// C L A S S E S /////////////////////////////////////////////////////////////

class AVP_ClientEntity_PhysicsObject : public AVP_ClientEntity_PhysicalObject, public virtual Asura_ClientEntity_PhysicsObject
{

public:

	static void Create( const Asura_Message* pxMsg );
	static AVP_ClientEntity_PhysicsObject* FindEntity( Asura_Guid uGUID ) { return s_xList.FindEntity( uGUID ); }
    static const Asura_Hashed_List<AVP_ClientEntity_PhysicsObject>* GetList( void ) { return &s_xList; }

	virtual bool HandleMessage( const Asura_Message* pxMsg );
	virtual void Update(void) {}

protected:

	AVP_ClientEntity_PhysicsObject();
	virtual ~AVP_ClientEntity_PhysicsObject();

	void SetupDynamicObject( u_int uPhysicalObjectFlags );

	void	ProcessClientUpdate(const AVP_Message_PhysicsObject_ClientUpdate* pxData, float fServerTime, bool bProcessPosAndOri = true);
	void	ProcessClientCreate(const AVP_Message_PhysicsObject_ClientCreate* pxData, float fServerTime, bool bProcessPosAndOri = true);

	// Overridden event functions...
	virtual	void	OnDeath(const AVP_EntityDamage_ApplyToEntity& xDamage);
	virtual	void	OnApplyDamage(const AVP_EntityDamage_ApplyToEntity& xDamage);

private:
	typedef AVP_ClientEntity_PhysicalObject PARENT;
	typedef Asura_ClientEntity_PhysicsObject PARENT_ASURA;

	static Asura_Hashed_List<AVP_ClientEntity_PhysicsObject> s_xList;

};

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

#endif // #ifndef AVP_CLIENTENTITY_PHYSICSOBJECT_H___
