
#pragma once
#ifndef AI_SPECIALS_HPP
#define AI_SPECIALS_HPP

#include <Stuff\Auto_Container.hpp>
#pragma warning(push)
#include <stlport\string>
#include <stlport\vector>
#pragma warning(pop)
#include <Adept\Resource.hpp>
#include <Stuff\NotationFile.hpp>
#include <Stuff\Point3D.hpp>



namespace Stuff
{
	class Point3D;
};

namespace MechWarrior4
{
	class MWObject;
};


namespace MW4AI
{
	class Specials
	{
	  public:
		Specials();
		~Specials();

		static void IncrementRefCount();
		static void DecrementRefCount();

		static Specials* Instance();

		void LaunchSignalFlare(const Stuff::Point3D& pos);
		void LaunchFireworks(const Stuff::Point3D& pos, int duration);
		void LaunchConfetti();
		void LaunchFighterSmoke(MechWarrior4::MWObject& mwobject, int smoke_index);

		int GetNumFireworkTypes() const;

		void Update();

	  private:
		std::string GetResourceName(const std::string& block_name, const std::string& item_name);
		void GetResourceName_Multiple(const std::string& block_name, const std::string& item_name, std::vector<std::string>& resource_names);

		MWObject* GetPlayerVehicle();

		void LaunchFirework(unsigned int type, const Stuff::Point3D& pos);

		Stuff::Time GetTimeToNextFirework() const;
		void LaunchRandomFirework();

		void AttachSmoke(MechWarrior4::MWObject& mwobject, int smoke_index, const Stuff::Point3D& offset);

	  private:
		int m_RefCount;
		static Specials* m_Instance;

		Adept::Resource m_Resource;
		Stuff::Auto_Ptr<Stuff::NotationFile> m_NotationFile;

		Stuff::Auto_Ptr<Adept::Resource> m_FlareResource;
		Stuff::Auto_Container<Adept::Resource, std::vector<Adept::Resource*> > m_FireworksResource;
		Stuff::Auto_Ptr<Adept::Resource> m_ConfettiResource;
		Stuff::Auto_Container<Adept::Resource, std::vector<Adept::Resource*> > m_FighterSmoke;

		Stuff::Time m_FireworksStopTime;
		Stuff::Time m_NextFireworkStartTime;
		Stuff::Point3D m_FireworksOrigin;

		bool m_LaunchConfetti;
		bool m_ConfettiLaunched;
		std::vector<Stuff::Point3D> m_QueuedSignalFlares;
	};
};


#endif // AI_SPECIALS_HPP