
#pragma once

#include "MW4.hpp"

namespace MechWarrior4
{
	class MWGUIManager;
	class Weapon;

	class GUIWeapon:
		public Plug
	{
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Construction, Destruction
	//
	public:
		static void InitializeClass();
		static void TerminateClass();

		GUIWeapon(
			const char *weapon_name,
			Scalar weapon_count,
			RGBAColor *weapon_color,
			int *ammo_count,
			Weapon *weapon = NULL
		);
		~GUIWeapon();

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

	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Member variables and functions
	//
	public:
		virtual void Draw(int y_location);
		void Reload();
// MSL 5.03 RTX
		void RecoverFromJam();
		void SetJamCount(Stuff::Scalar new_count);
		void SetCount(Stuff::Scalar new_count);
		void Ready();
		void Select();
		void SetAmmoCount(int *new_ammo)
				{ammoCount = new_ammo;}
		void SetStatus(int new_status)
		{
			Check_Object(this);
			m_status = new_status;
		}
// MSL 5.03 Ammo Bay Fire
		void RecoverFromFire();
		void SetFireCount(Stuff::Scalar new_count);

// MSL 5.03 RTX
		enum
		{
			ReadyStatus = 0,
			ReloadingStatus,
			DestroyedStatus,
			JammedStatus,
			AmmoFireStatus
		};

// MSL 5.03 RTX
		Stuff::Scalar weaponJamCount;
		Stuff::Scalar weaponFireCount;
		char *weaponName;
		Stuff::Scalar weaponCount;
		Stuff::RGBAColor weaponColor;
		Stuff::RGBAColor readyColor;
		int *ammoCount;
		Scalar m_Range;
		Weapon *m_weapon;
		int m_status;
	};

	//####################################################################
	//###########################    GUIWeaponManager   ##################
	//####################################################################

	class GUIWeapon;

	class GUIWeaponManager:
		public Plug
	{
		
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Construction, Destruction
	//
	public:
		GUIWeaponManager();
		~GUIWeaponManager();
		
	//~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
	// Public Data
	//
	public:
		GUIWeapon
			*MakeGUIWeapon(
				const char *weapon_name,
				Stuff::Scalar weapon_count,
				RGBAColor *weapon_color,
				int *ammo_count,
				Weapon *owning_weapon
			);
		void ClearWeaponsManager();
		void ChangeGroup(GUIWeapon *weapon);
		void Draw();

		
		int GetWeaponInfo (char **name_array, int *status_array,int *ammo_array,Stuff::Scalar *reloadtimes,Stuff::Scalar *current_times,int *group_1_array,int *group_2_array,int *group_3_array, int *group_4_array,int *group_5_array,int *group_6_array,int *num_weapons, int size);
		GUIWeapon *GetWeapon (int id)
		{
			GUIWeapon *weap;
			weap = weaponList.GetNth (id);
			if (!weap)
				return NULL;
			return weap;
		}

		int drawMode;

//		HGOSFONT3D weaponFontHandle;

		Stuff::ChainOf<GUIWeapon *> weaponList;

		MWGUIManager *guiManager;

	};
}
