//	TankYouGlobalData.cpp - Tank You!'s global data.
//  ----------------------------------------------------------------------------
//	This file is part of 'NiallsAVLib', base code for any kind of audiovisual
//	apps.
//	Copyright (C) 2012  Niall Moody
//	
//	This program is free software: you can redistribute it and/or modify
//	it under the terms of the GNU General Public License as published by
//	the Free Software Foundation, either version 3 of the License, or
//	(at your option) any later version.
//
//	This program is distributed in the hope that it will be useful,
//	but WITHOUT ANY WARRANTY; without even the implied warranty of
//	MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
//	GNU General Public License for more details.
//
//	You should have received a copy of the GNU General Public License
//	along with this program.  If not, see <http://www.gnu.org/licenses/>.
//	----------------------------------------------------------------------------

#include "TankYouGlobalData.h"

#include "Modifiers/Dispensers/ThreeWayDispenser.h"
#include "Modifiers/Dispensers/CardinalDispenser.h"
#include "Modifiers/Dispensers/EightWayDispenser.h"

#include "Modifiers/BulletCollision/RetaliatingWalls.h"
#include "Modifiers/BulletCollision/BouncingBullet.h"

#include "Modifiers/BulletDeath/BulletShockwaveDeath.h"
#include "Modifiers/BulletDeath/BulletExplodeDeath.h"
#include "Modifiers/BulletDeath/BulletZombieDeath.h"
#include "Modifiers/BulletDeath/BulletMineDeath.h"

#include "Modifiers/BulletDirection/SpiralBullet.h"
#include "Modifiers/BulletDirection/HomingBullet.h"
#include "Modifiers/BulletDirection/SineBullet.h"

#include "Modifiers/Game/RecursiveShotProperties.h"
#include "Modifiers/Game/BulletsCollectPickups.h"
#include "Modifiers/Game/BulletsTriggerMines.h"
#include "Modifiers/Game/TurnBasedMode.h"

#include "Modifiers/Tank/IncreaseSecondaryFireRate.h"
#include "Modifiers/Tank/IncreasePrimaryFireRate.h"
#include "Modifiers/Tank/RegeneratingHealth.h"
#include "Modifiers/Tank/IncreaseSpeed.h"
#include "Modifiers/Tank/KamikazeTanks.h"
#include "Modifiers/Tank/DiarrheaMines.h"
#include "Modifiers/Tank/BulletsHeal.h"
#include "Modifiers/Tank/GiantTanks.h"
#include "Modifiers/Tank/NoRecoil.h"

#include "Modifiers/TankCollision/PinballMode.h"

#include "Modifiers/Mines/ZombieSpawnerMines.h"
#include "Modifiers/Mines/CamouflageMines.h"
#include "Modifiers/Mines/TurretMines.h"
#include "Modifiers/Mines/WallMines.h"
#include "Modifiers/Mines/BeeMines.h"

#include "Modifiers/SecondaryTriggers/SwapTankPositions.h"
#include "Modifiers/SecondaryTriggers/TurboSecondary.h"

#include "Modifiers/PuddleCollision/IncendiaryField.h"
#include "Modifiers/PuddleCollision/ColourBarrier.h"
#include "Modifiers/PuddleCollision/HealingField.h"
#include "Modifiers/PuddleCollision/SpeedField.h"
#include "Modifiers/PuddleCollision/NullField.h"
#include "Modifiers/PuddleCollision/SlowField.h"

#include "PickupGenerators/OriginalGenerator.h"
#include "PickupGenerators/GradedGenerator.h"
#include "PickupGenerators/NullGenerator.h"
#include "PickupGenerators/MADGenerator.h"

//------------------------------------------------------------------------------
TankYouGlobalData::TankYouGlobalData():
screenShake(0.1f),
backgroundFlash(0.0f),
borderFlash(0.5f),
snowflakes(256.0f/2048.0f),
generator(L"OriginalGenerator"),
maxPickups(2),
numPlayers(4),
music(true),
oscOutput(false)
{
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new ThreeWayDispenserCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new CardinalDispenserCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new EightWayDispenserCreator()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new RetaliatingWallsCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BouncingBulletCreator()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletShockwaveDeathCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletExplodeDeathCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletZombieDeathCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletMineDeathCreator()));
	
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new SpiralBulletCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new HomingBulletCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new SineBulletCreator()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new RecursiveShotProperties()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletsCollectPickups()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletsTriggerMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new TurnBasedMode()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new IncreaseSecondaryFireRate()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new IncreasePrimaryFireRate()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new RegeneratingHealth()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new IncreaseSpeed()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new KamikazeTanks()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new DiarrheaMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BulletsHeal()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new GiantTanks()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new NoRecoil()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new PinballModeCreator()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new ZombieSpawnerMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new CamouflageMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new TurretMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new WallMines()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new BeeMines()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new SwapTankPositions()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new TurboSecondary()));

	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new IncendiaryFieldCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new ColourBarrierCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new HealingFieldCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new SpeedFieldCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new NullFieldCreator()));
	modifierFactory.registerCreator(shared_ptr<ModifierCreator>(new SlowFieldCreator()));
}

//------------------------------------------------------------------------------
TankYouGlobalData::~TankYouGlobalData()
{

}

//------------------------------------------------------------------------------
void TankYouGlobalData::setScreenShake(float val)
{
	screenShake = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setBackgroundFlash(float val)
{
	backgroundFlash = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setBorderFlash(float val)
{
	borderFlash = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setSnowflakes(float val)
{
	snowflakes = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setPickupGenerator(const std::wstring& val)
{
	generator = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setMaxPickups(int val)
{
	maxPickups = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setNumPlayers(int val)
{
	numPlayers = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setMusic(bool val)
{
	music = val;
}

//------------------------------------------------------------------------------
void TankYouGlobalData::setOSCOutput(bool val)
{
	oscOutput = val;
}

//------------------------------------------------------------------------------
shared_ptr<PickupGenerator> TankYouGlobalData::getPickupGenerator()
{
	if(generator == L"NullGenerator")
		return shared_ptr<PickupGenerator>(new NullGenerator(modifierFactory));
	else if(generator == L"OriginalGenerator")
		return shared_ptr<PickupGenerator>(new OriginalGenerator(modifierFactory));
	else if(generator == L"GradedGenerator")
		return shared_ptr<PickupGenerator>(new GradedGenerator(modifierFactory));
	else if(generator == L"MADGenerator")
		return shared_ptr<PickupGenerator>(new MADGenerator(modifierFactory));
	else
		return shared_ptr<PickupGenerator>(new OriginalGenerator(modifierFactory));
}
