
/******************************************************************************
*******************************************************************************

	Space Impakto DS
	relminator
	http://rel.betterwebber.com


	barrage patterns


*******************************************************************************
******************************************************************************/


#include "barrage.h"

void barrage_dummy(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 10;					// non-fp
	tp.y_radius				= 9;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/4;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 0;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 4;					// non-fp
	

	tp.wavemode				= EWM_SINGLE;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 0;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 0;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= 0;
	tp.bp.speed_delta		= 0;					// floattof32(-0.950) if the bullet speed per wave is variable
	tp.bp.offset			= 0;		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_NORMAL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 102;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp

	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}


void barrage_4way_normal(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 10;					// non-fp
	tp.y_radius				= 9;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/4;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 4;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 4;					// non-fp
	

	tp.wavemode				= EWM_SPRAY_NORMAL;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 0;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 0;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/8;
	tp.bp.speed_delta		= 0;					// floattof32(-0.950) if the bullet speed per wave is variable
	tp.bp.offset			= 1<<12;		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 1;					// non-fp
	tp.bp.state				= EB_ACCEL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 102;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp

	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}

void barrage_4way(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 10;					// non-fp
	tp.y_radius				= 9;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/4;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 4;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 10;					// non-fp
	

	tp.wavemode				= EWM_SPRAY_NORMAL;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 2;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 4;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/4;
	tp.bp.speed_delta		= 0;					// floattof32(-0.950) if the bullet speed per wave is variable
	tp.bp.offset			= 0;		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_ACCEL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 70;					// non-fp
	tp.bp.num_frames		= 3;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp

	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}

void barrage_spray(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= true;					// if targeting or not
	tp.x_radius				= 5;					// non-fp
	tp.y_radius				= 4;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/32;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 8;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 500;					// non-fp
	
	tp.wavemode				= EWM_SPREAD_OFFSET;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 7;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 4;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/2;
	tp.bp.speed_delta		= floattof32(0.10950); //if the bullet speed per wave is variable
	tp.bp.offset			= floattof32(0.5);		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_NORMAL;			// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	
	tp.bp.start_frame		= 76;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp


	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}

void barrage_spray_delta(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= true;					// if targeting or not
	tp.x_radius				= 5;					// non-fp
	tp.y_radius				= 4;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/8;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 8;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 40;					// non-fp
	
	tp.wavemode				= EWM_SPRAY_NORMAL;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 2;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 8;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/32;
	tp.bp.speed_delta		= floattof32(0.0); 		//if the bullet speed per wave is variable
	tp.bp.offset			= floattof32(1);		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= 20;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_ACCEL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;					// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 54;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp
	
	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}

void barrage_wasak_centered(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= true;					// if targeting or not
	tp.x_radius				= 5;					// non-fp
	tp.y_radius				= 4;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/32;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 5;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 80;					// non-fp
	
	tp.wavemode				= EWM_SPRAY_CENTERED;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 3;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 8;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/8;
	tp.bp.speed_delta		= floattof32(-0.05105); 		//if the bullet speed per wave is variable
	tp.bp.offset			= floattof32(1);		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_ACCEL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;					// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 73;					// non-fp
	tp.bp.num_frames		= 3;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp
	
	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}


void barrage_spray_reverse(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 5;					// non-fp
	tp.y_radius				= 4;					// non-fp
	tp.angle				= 0;
	tp.min_angle			= 0;
	tp.max_angle			= 32767/1;
	tp.angle_speed			= 32768/16;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/32;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 8;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 100;					// non-fp
	
	tp.wavemode				= EWM_SPREAD_OFFSET;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 4;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 4;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED;
	tp.bp.speed_delta		= floattof32(0.3); //if the bullet speed per wave is variable
	tp.bp.offset			= floattof32(0.7);		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= cosLerp(tp.angle + BRAD_PI)/16;
	tp.bp.gy				= sinLerp(tp.angle + BRAD_PI)/16;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_NORMAL;			// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	
	tp.bp.start_frame		= 58;					// non-fp
	tp.bp.num_frames		= 8;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp


	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}

void barrage_volcano(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 10;					// non-fp
	tp.y_radius				= 9;					// non-fp
	tp.angle				= angle;
	tp.min_angle			= angle - (32768/16);
	tp.max_angle			= angle + (32768/16);
	tp.angle_speed			= 32768/32;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/32;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 1;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 12;					// non-fp
	

	tp.wavemode				= EWM_SPRAY_NORMAL;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 0;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 0;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED*8;
	tp.bp.speed_delta		= 0;					// floattof32(-0.950) if the bullet speed per wave is variable
	tp.bp.offset			= 1 << 12;		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= cosLerp(tp.angle + BRAD_PI)/8;
	tp.bp.gy				= sinLerp(tp.angle + BRAD_PI)/8;
	tp.bp.delay				= -1;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_NORMAL;				// normal, accelerator or inv accelerator
	tp.bp.smart				= false;				// targeting or not (after counter == delay); 			
	
	tp.bp.start_frame		= 66;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp

	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	if ((unsigned int)tp.max_angle < (unsigned int)tp.min_angle)
	{
		s32 tmp = tp.max_angle;
		tp.max_angle = tp.min_angle;
		tp.min_angle = tmp;
	}
	turret.parameters.push_back(tp);
	
}

void barrage_rings_smart(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;
	
	// turret
	tp.active_time			= active_time; 
	tp.active				= true;					// non-fp
	tp.smart				= false;					// if targeting or not
	tp.x_radius				= 10;					// non-fp
	tp.y_radius				= 9;					// non-fp
	tp.angle				= angle;
	tp.min_angle			= 0;
	tp.max_angle			= 32767;
	tp.angle_speed			= 0;				// + rotation speed
	tp.angle_dir			= 1;					// -1 or +1  determines rotation direction
	tp.spread_angle			= 32768/8;				// distance of each bullet on a spread
	tp.bullets_per_shot		= 8;
	tp.rotation_type		= 2;					// non-fp, whether back anf forth or not
	tp.spawn_delay			= delay;					// non-fp
	tp.max_spawn_delay		= 60;					// non-fp
	
	tp.wavemode				= EWM_SPRAY_TARGET;
	
	tp.wave_counter			= 0;					// non-fp
	tp.max_wave				= 1;					// non-fp maximum bullets per wave
	tp.max_wave_delay		= 20;					// non-fp maximum delay for next shot in a wave
	
	// bullets
	tp.bp.speed				= BULLET_SPEED/4;
	tp.bp.speed_delta		= floattof32(0); //if the bullet speed per wave is variable
	tp.bp.offset			= floattof32(1);		//floattof32(1) // 1 << 12 for normal; Angle offset of each alternate bullet wave
	tp.bp.gx				= 0;
	tp.bp.gy				= 0;
	tp.bp.delay				= 20;					// for changing behavior. ie: normal to target (note that EB_NORMAL can be targeting at start via turret)
	tp.bp.energy			= 0;					// non-fp
	tp.bp.state				= EB_ACCEL;			// normal, accelerator or inv accelerator
	tp.bp.smart				= true;				// targeting or not (after counter == delay); 			
	
	
	tp.bp.start_frame		= 80;					// non-fp
	tp.bp.num_frames		= 4;					// non-fp
	tp.bp.anim_delay		= 3;
	tp.bp.death_ID			= 0;					// non-fp


	tp.bp.width				= sprites[tp.bp.start_frame].width;
	tp.bp.height			= sprites[tp.bp.start_frame].height;
	
	turret.parameters.push_back(tp);
	
}


void barrage_test(Cturret &turret, int active_time, int delay, s32 angle, const Cglsprite *sprites)
{

	Tturret_params tp;  

	tp.active_time         = 10000; 
	tp.active              = 1; 
	tp.smart               = 0; 
	tp.x_radius            = 10; 
	tp.y_radius            = 9; 
	tp.angle               = 0; 
	tp.min_angle           = 0; 
	tp.max_angle           = 32768; 
	tp.angle_speed         = 3776; 
	tp.angle_dir           = 1; 
	tp.spread_angle        = 6656; 
	tp.bullets_per_shot    = 24; 
	tp.rotation_type       = 2; 
	tp.spawn_delay         = 0; 
	tp.max_spawn_delay     = 30; 
	tp.wavemode            = (E_WAVE_MODE) 1; 
	tp.wave_counter        = 0; 
	tp.max_wave            = 2; 
	tp.max_wave_delay      = 3; 
	tp.bp.speed            = 384; 
	tp.bp.speed_delta      = 320; 
	tp.bp.offset           = 4096; 
	tp.bp.gx               = 0; 
	tp.bp.gy               = 0; 
	tp.bp.delay            = -1; 
	tp.bp.energy           = 1; 
	tp.bp.state            = (E_BULLET_TYPE) 2; 
	tp.bp.smart            = 0; 
	tp.bp.start_frame      = 84; 
	tp.bp.num_frames       = 8; 
	tp.bp.anim_delay       = 3; 
	tp.bp.death_ID         = 0; 

	tp.bp.width           = sprites[tp.bp.start_frame].width; 
	tp.bp.height          = sprites[tp.bp.start_frame].height; 

	turret.parameters.push_back(tp); 

}


