#pragma once

#include "MW4.hpp"
#include "WeaponMover.hpp"


namespace MechWarrior4
{	

	//##########################################################################
	//##################    LBXMover::CreateMessage    #########################
	//##########################################################################

	class LBXMover__CreateMessage:
		public WeaponMover__CreateMessage
	{
	public:
		
		Stuff::Scalar 
			disipationStart;
		Stuff::Scalar
			maxDisipation;

		LBXMover__CreateMessage(
			size_t length,
			int priority,
			int message_flags,
			Stuff::RegisteredClass::ClassID class_id,
			int replicator_flags,
			const ResourceID& instance_id,
			const Stuff::LinearMatrix4D &creation_matrix,
			Stuff::Scalar age,
			int execution_state,
			int name_id,
			int entity_alignment,
			const Stuff::Motion3D &initial_velocity,
			const Stuff::Motion3D &initial_acceleration,
			Stuff::Scalar damage_amount,
			Stuff::Scalar heat_amount,
			Stuff::Scalar max_distance,
// MSL 5.03 Min Distance
//			Stuff::Scalar min_distance,
			const Adept::ReplicatorID& inflicting_id,
			Stuff::Scalar splash_radius,
			Stuff::Scalar percentage_damage_direct_hit,
			Stuff::Scalar min_percentage_damage_sphere,
			Stuff::Scalar max_percentage_damage_sphere,
			int item_id,
			Stuff::Scalar disipation_start,
			Stuff::Scalar max_disipation
		):
			WeaponMover__CreateMessage(
				length, 
				priority, 
				message_flags, 
				class_id, 
				replicator_flags,
				instance_id,
				creation_matrix,
				age,
				execution_state,
				name_id,
				entity_alignment,
				initial_velocity,
				initial_acceleration,
				damage_amount,
				heat_amount,
				max_distance,
// MSL 5.03 Min Distance
//				min_distance,
				inflicting_id,
				splash_radius,
				percentage_damage_direct_hit,
				min_percentage_damage_sphere,
				max_percentage_damage_sphere,
				item_id
			),
				disipationStart(disipation_start),
				maxDisipation(max_disipation)
				{}

	};
	
	//##########################################################################
	//############################    LBXMover    ##############################
	//##########################################################################

	//-------------------------------------------------------------------------
	// The following helper classes must always be typedef'd or overriden by an
	// inheritor
	//
	typedef WeaponMover__GameModel						LBXMover__GameModel;
	typedef WeaponMover__ClassData						LBXMover__ClassData;
	typedef WeaponMover__Message						LBXMover__Message;
	typedef WeaponMover__ExecutionStateEngine			LBXMover__ExecutionStateEngine;
	
	//-----------------------  End of inheritance stuff ------------------------

	class LBXMover:
		public WeaponMover
	{
	public:
		static void
			InitializeClass();
		static void
			TerminateClass();

		typedef WeaponMover BaseClass;

	//##########################################################################
	// Inheritance support
	//
	public:
		typedef LBXMover__ClassData						ClassData;
		typedef LBXMover__GameModel						GameModel;
		typedef LBXMover__Message						Message;
		typedef LBXMover__ExecutionStateEngine			ExecutionStateEngine;
		typedef LBXMover__CreateMessage					CreateMessage;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Run-time Construction and Destruction Support
	//
	public:
		static LBXMover* 
			Make(
				CreateMessage *message,
				ReplicatorID *base_id
			);
	
		LBXMover(
			ClassData *class_data,
			CreateMessage *message,
			ReplicatorID *base_id,
			ElementRenderer::Element *element
		);

		~LBXMover();

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Class Data support
	//
	public:
		static ClassData
			*DefaultData;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Game Model support
	//
	public:
		const GameModel*
			GetGameModel()
				{return Cast_Pointer(const GameModel*, gameModelResource.GetPointer());}

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Execution Support
	//
	public:
		void
			PostCollision(Stuff::DynamicArrayOf<CollisionData> *collisions);

	public:
		Stuff::Scalar 
			m_disipationStart;
		Stuff::Scalar
			m_maxDisipation;

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Test Support
	//
	public:
		void
      		TestInstance() const;
	};
}
