function SaveWeapPossess()
{
	var file = OpenFile("tr.sav");
	for (swp = 0;swp < 12; swp++)
	{
		if (weap_possess[swp] == 1)
			file.write("w"+swp, 1);
	}
	file.flush();
	file.close();
	
}

function TrainingMonsterSave(level)
{
	var file = OpenFile("tr.sav");
	var tvar = file.read("l", 2)
	if (tvar < level)
		file.write("l", level);
	file.flush();
	file.close();

}


var g_chaingun_gotten = 0;
var g_sword_gotten = 0;
var g_wave_wait = false;
var g_training_stage = 0;
var g_wave_num = 51;
var g_max_level = 2;

var g_chaingun_stocked = 0;

function StartTraining()
{

	//reset the player's info
	g_kills = 0;
	g_total_time = 0;
	gore_score = 0;
	
	//armour, ammo
	//adren.
		
	for (sts = 0; sts < max_ammos;sts++)
	{
		ammo_array[sts].curammo=0;
		ammo_array[sts].curclip=0;
	}
		
	for (sts=0;sts<16;sts++)
	{ 
		weap_possess[sts]=0;
	}

	weap_possess[0] = 1;
	ammo_array[0].curclip = 12;
	ammo_array[0].curammo = 120;
	ammo_array[1].curclip = 1;
	ammo_array[1].curammo = 6;

	cur_weap = 0;



	//ok, now on to training stuffs:


	g_wave_wait = false;
	g_wave_num = 0;//51;
	g_training_stage=0;
	
	var filey = OpenFile("tr.sav")
	g_max_level = filey.read("l", 2);
	filey.close();
	
	var list = new Array();
	var file = OpenFile("tr.sav");
	for (swp = 0;swp < 12; swp++)
	{
		list[swp] = file.read("w"+swp, 0);
	}
	list[0] = 1;
	file.close();

	g_chaingun_gotten = 1;
	g_sword_gotten=1;
	g_chaingun_stocked = 1;

	
	var mt = 0;
	
	if (list[1] == 0|| mt)
		MoveLocker("locker1_3|023");
	if (list[2] == 0|| mt)
		MoveLocker("locker1_4|024");
	if (list[3] == 0|| mt)
		MoveLocker("locker1_5|025");
	if (list[4] == 0|| mt)
		MoveLocker("locker1_6|026");
	if (list[5] == 0|| mt)
		MoveLocker("locker1_7|027");
	if (list[6] == 0|| mt)
		MoveLocker("locker1_8|028");
	if (list[7] == 0|| mt)
		MoveLocker("locker1_9|029");

	if (list[10] == 0|| mt)
	{
		SetTile(130,75, 2,0);
		SetTile(131,75, 2,0);
		SetTile(130,76,2, 575);
		SetTile(131,76,2,576);
		g_chaingun_gotten = 0;
	
	}
	

	SetTile(127,75,2, 1357);
	SetTile(128,75,2, 1358);
	SetTile(127,76,2, 1362);
	SetTile(128,76,2, 1363);
	
	if (list[11] == 0|| mt)
	{
		g_sword_gotten=0;
	}
	
}

function MoveLocker(name)
{
	for (ml=0;ml<max_doors;ml++)
	{
		if (doors[ml].name == name)
		{
			doors[ml].x = blood_dx;
			SetPersonX(doors[ml].name, blood_dx);
		}
	
	}
}




//setup monster stages here:

/*
level 2: just enemy 1
	-three miniwaves
level 3: enemy 1 & 2
	-three miniwaves
level 7: enemy1,2, eyes
level 10: enemy1,2, eyes, mantis
	-five miniwaves
level 11: enemy1,2, eyes, mantis, drone
	-five miniwaves
level 14: enemy1,2, eyes, mantis, drone, umberdogs, jellies
	-2 miniwaves
level 15: enemy1,2, eyes, mantis, drone, umberdogs, jellies, guards
	-five miniwaves
*/

//these battle zones taken from tower

var possamb = new Array()
var ps12 = 0;
for (j=0;j<3;j++)
{
	for (i=0;i<3;i++)
	{
		possamb[ps12] = new Object();
		possamb[ps12].x = 170+i;
		possamb[ps12].y = 69+2*j;
		ps12++;
	}
	for (i=0;i<3;i++)
	{
		possamb[ps12] = new Object();
		possamb[ps12].x = 189+i;
		possamb[ps12].y = 69+2*j;
		ps12++;
	}
}

for (j=0;j<3;j++)
{
	for (i=0;i<4;i++)
	{
		possamb[ps12] = new Object();
		possamb[ps12].x = 179+i;
		possamb[ps12].y = 65+2*j;
		ps12++;
	}
}


for (i=0;i<possamb.length;i++)
{
	possamb[i].used = false;
}

battle_zones[51][0].stages = 5;
battle_zones[51][0].stimer = 60;
battle_zones[51][0].timer = 200;
battle_zones[51][0].number = 3;
battle_zones[51][0].target1 = "door1_1o";
battle_zones[51][0].wait = 1;

battle_zones[51][1].x = 48;
battle_zones[51][1].y = 307;
battle_zones[51][1].type = 2;
battle_zones[51][1].name = "enemy1_legs_1a";

battle_zones[51][2].x = 49;
battle_zones[51][2].y = 309;
battle_zones[51][2].type = 2;
battle_zones[51][2].name = "enemy1_legs_2a";

battle_zones[51][3].x = 54;
battle_zones[51][3].y = 307;
battle_zones[51][3].type = 2;
battle_zones[51][3].name = "enemy1_legs_3a";

battle_zones[51][4].x = 57;
battle_zones[51][4].y = 309;
battle_zones[51][4].type = 2;
battle_zones[51][4].name = "enemy1_legs_4a";

battle_zones[51][5].x = 58;
battle_zones[51][5].y = 311;
battle_zones[51][5].type = 2;
battle_zones[51][5].name = "enemy1_legs_5a";


battle_zones[52][0].stages = 5;
battle_zones[52][0].stimer = 50;
battle_zones[52][0].timer = 150;
battle_zones[52][0].number = 4;
battle_zones[52][0].target1 = "door1_1o";
battle_zones[52][0].wait = 1;

battle_zones[52][1].x = 48;
battle_zones[52][1].y = 307;
battle_zones[52][1].type = 2;
battle_zones[52][1].name = "enemy2_legs_1a";

battle_zones[52][2].x = 49;
battle_zones[52][2].y = 309;
battle_zones[52][2].type = 2;
battle_zones[52][2].name = "enemy2_legs_2a";

battle_zones[52][3].x = 54;
battle_zones[52][3].y = 307;
battle_zones[52][3].type = 2;
battle_zones[52][3].name = "enemy1_legs_3a";

battle_zones[52][4].x = 57;
battle_zones[52][4].y = 309;
battle_zones[52][4].type = 2;
battle_zones[52][4].name = "enemy1_legs_4a";

battle_zones[52][5].x = 58;
battle_zones[52][5].y = 311;
battle_zones[52][5].type = 2;
battle_zones[52][5].name = "enemy1_legs_5a";




battle_zones[53][0].stages = 5;
battle_zones[53][0].stimer = 45;
battle_zones[53][0].timer = 140;
battle_zones[53][0].number = 5;
battle_zones[53][0].target1 = "door1_1o";
battle_zones[53][0].wait = 1;

battle_zones[53][1].x = 48;
battle_zones[53][1].y = 307;
battle_zones[53][1].type = 2;
battle_zones[53][1].name = "enemy2_legs_1a";

battle_zones[53][2].x = 49;
battle_zones[53][2].y = 309;
battle_zones[53][2].type = 2;
battle_zones[53][2].name = "enemy2_legs_2a";

battle_zones[53][3].x = 54;
battle_zones[53][3].y = 307;
battle_zones[53][3].type = 2;
battle_zones[53][3].name = "enemy2_legs_3a";

battle_zones[53][4].x = 57;
battle_zones[53][4].y = 309;
battle_zones[53][4].type = 2;
battle_zones[53][4].name = "enemy2_legs_4a";

battle_zones[53][5].x = 58;
battle_zones[53][5].y = 311;
battle_zones[53][5].type = 2;
battle_zones[53][5].name = "enemy2_legs_5a";





battle_zones[54][0].stages = 5;
battle_zones[54][0].stimer = 45;
battle_zones[54][0].timer = 150;
battle_zones[54][0].number = 5;
battle_zones[54][0].target1 = "door1_1o";
battle_zones[54][0].wait = 1;

battle_zones[54][1].x = 48;
battle_zones[54][1].y = 307;
battle_zones[54][1].type = 2;
battle_zones[54][1].name = "mantis_legs_1a";

battle_zones[54][2].x = 49;
battle_zones[54][2].y = 309;
battle_zones[54][2].type = 2;
battle_zones[54][2].name = "mantis_legs_2a";

battle_zones[54][3].x = 54;
battle_zones[54][3].y = 307;
battle_zones[54][3].type = 2;
battle_zones[54][3].name = "mantis_legs_3a";

battle_zones[54][4].x = 57;
battle_zones[54][4].y = 309;
battle_zones[54][4].type = 2;
battle_zones[54][4].name = "enemy2_legs_4a";

battle_zones[54][5].x = 58;
battle_zones[54][5].y = 311;
battle_zones[54][5].type = 2;
battle_zones[54][5].name = "enemy2_legs_5a";


battle_zones[55][0].stages = 5;
battle_zones[55][0].stimer = 40;
battle_zones[55][0].timer = 140;
battle_zones[55][0].number = 5;
battle_zones[55][0].target1 = "door1_1o";
battle_zones[55][0].wait = 1;

battle_zones[55][1].x = 48;
battle_zones[55][1].y = 307;
battle_zones[55][1].type = 2;
battle_zones[55][1].name = "mantis_legs_1a";

battle_zones[55][2].x = 49;
battle_zones[55][2].y = 309;
battle_zones[55][2].type = 2;
battle_zones[55][2].name = "mantis_legs_2a";

battle_zones[55][3].x = 54;
battle_zones[55][3].y = 307;
battle_zones[55][3].type = 2;
battle_zones[55][3].name = "mantis_legs_3a";

battle_zones[55][4].x = 57;
battle_zones[55][4].y = 309;
battle_zones[55][4].type = 2;
battle_zones[55][4].name = "mantis_legs_4a";

battle_zones[55][5].x = 58;
battle_zones[55][5].y = 311;
battle_zones[55][5].type = 2;
battle_zones[55][5].name = "mantis_legs_5a";




battle_zones[56][0].stages = 3;
battle_zones[56][0].stimer = 40;
battle_zones[56][0].timer = 140;
battle_zones[56][0].number = 7;
battle_zones[56][0].target1 = "door1_1o";
battle_zones[56][0].wait = 1;

battle_zones[56][1].x = 48;
battle_zones[56][1].y = 307;
battle_zones[56][1].type = 4;
battle_zones[56][1].name = "drone1_legs_1d";

battle_zones[56][2].x = 49;
battle_zones[56][2].y = 309;
battle_zones[56][2].type = 4;
battle_zones[56][2].name = "drone1_legs_2d";

battle_zones[56][3].x = 54;
battle_zones[56][3].y = 307;
battle_zones[56][3].type = 4;
battle_zones[56][3].name = "drone1_legs_3d";

battle_zones[56][4].x = 57;
battle_zones[56][4].y = 309;
battle_zones[56][4].type = 4;
battle_zones[56][4].name = "drone1_legs_4d";

battle_zones[56][5].x = 58;
battle_zones[56][5].y = 311;
battle_zones[56][5].type = 4;
battle_zones[56][5].name = "drone1_legs_5d";

battle_zones[56][6].x = 58;
battle_zones[56][6].y = 311;
battle_zones[56][6].type = 4;
battle_zones[56][6].name = "drone1_legs_6d";

battle_zones[56][7].x = 58;
battle_zones[56][7].y = 311;
battle_zones[56][7].type = 4;
battle_zones[56][7].name = "drone1_legs_7d";



battle_zones[57][0].stages = 3;
battle_zones[57][0].stimer = 40;
battle_zones[57][0].timer = 140;
battle_zones[57][0].number = 3;
battle_zones[57][0].target1 = "door1_1o";
battle_zones[57][0].wait = 1;

battle_zones[57][1].x = 48;
battle_zones[57][1].y = 307;
battle_zones[57][1].type = 2;
battle_zones[57][1].name = "umberdog_1a";

battle_zones[57][2].x = 49;
battle_zones[57][2].y = 309;
battle_zones[57][2].type = 2;
battle_zones[57][2].name = "umberdog_2a";

battle_zones[57][3].x = 54;
battle_zones[57][3].y = 307;
battle_zones[57][3].type = 2;
battle_zones[57][3].name = "umberdog_3a";

battle_zones[57][4].x = 57;
battle_zones[57][4].y = 309;
battle_zones[57][4].type = 2;
battle_zones[57][4].name = "umberdog_4a";

battle_zones[57][5].x = 58;
battle_zones[57][5].y = 311;
battle_zones[57][5].type = 2;
battle_zones[57][5].name = "umberdog_5a";


battle_zones[58][0].stages = 3;
battle_zones[58][0].stimer = 40;
battle_zones[58][0].timer = 140;
battle_zones[58][0].number = 4;
battle_zones[58][0].target1 = "door1_1o";
battle_zones[58][0].wait = 1;

battle_zones[58][1].x = 48;
battle_zones[58][1].y = 307;
battle_zones[58][1].type = 2;
battle_zones[58][1].name = "umberdog_1a";

battle_zones[58][2].x = 49;
battle_zones[58][2].y = 309;
battle_zones[58][2].type = 2;
battle_zones[58][2].name = "umberdog_2a";

battle_zones[58][3].x = 54;
battle_zones[58][3].y = 307;
battle_zones[58][3].type = 2;
battle_zones[58][3].name = "guard_legs_3a";

battle_zones[58][4].x = 57;
battle_zones[58][4].y = 309;
battle_zones[58][4].type = 2;
battle_zones[58][4].name = "guard_legs_4a";

battle_zones[58][5].x = 58;
battle_zones[58][5].y = 311;
battle_zones[58][5].type = 2;
battle_zones[58][5].name = "guard_legs_5a";


battle_zones[59][0].stages = 4;
battle_zones[59][0].stimer = 40;
battle_zones[59][0].timer = 140;
battle_zones[59][0].number = 4;
battle_zones[59][0].target1 = "door1_1o";
battle_zones[59][0].wait = 1;

battle_zones[59][1].x = 48;
battle_zones[59][1].y = 307;
battle_zones[59][1].type = 2;
battle_zones[59][1].name = "guard_legs_1a";

battle_zones[59][2].x = 49;
battle_zones[59][2].y = 309;
battle_zones[59][2].type = 2;
battle_zones[59][2].name = "guard_legs_2a";

battle_zones[59][3].x = 54;
battle_zones[59][3].y = 307;
battle_zones[59][3].type = 2;
battle_zones[59][3].name = "guard_legs_3a";

battle_zones[59][4].x = 57;
battle_zones[59][4].y = 309;
battle_zones[59][4].type = 2;
battle_zones[59][4].name = "guard_legs_4a";

battle_zones[59][5].x = 58;
battle_zones[59][5].y = 311;
battle_zones[59][5].type = 2;
battle_zones[59][5].name = "guard_legs_5a";



function ResetPossAmb()
{
	for (i=0;i<possamb.length;i++)
	{
		possamb[i].used = false;
	}
}

function SelectPossAmb()
{
	var select = Math.floor(Math.random()*possamb.length);
	if (possamb[select].used == true)
	{
		for (ll=0;ll<possamb.length;ll++)
		{
			if (possamb[(select+ll)%possamb.length].used == false)
				return (select+ll)%possamb.length;
		}
	}
	return select;
}

var g_training_end = 0;

function CommenceTraining(num)
{
	if (g_training_end ==1)
	{

		return;
	
	}

	num+=51;

	g_training_end = 0;

	if (battle_zones[num][0].target1 != -1)
		CloseNameDoor(battle_zones[num][0].target1, false);

	var entt = 0;
	//reset stage info in case of reset
	var randomy = 0;
	
	ResetPossAmb();

	for (aia=0;aia<battle_zones[num][0].number;aia++)
	{	
		battle_zones[num][aia+1].stage = 1;
		battle_zones[num][aia+1].waity = 0;
		battle_zones[num][aia+1].ent = ReturnEnt(battle_zones[num][aia+1].name);
		entt=battle_zones[num][aia+1].ent;

		if ((battle_zones[num][aia+1].name).substr(0,5)=="drone" && 1==2)
		{
			entities[entt].x = (178+Math.floor(6*Math.random()))*16+8;
			entities[entt].y = (58+Math.floor(6*Math.random()))*16+8;
		}
		else
		{
			randomy = SelectPossAmb();
			entities[entt].x = possamb[randomy].x*16+8;
			entities[entt].y = possamb[randomy].y*16+8;
		}
		
		EnemyAmbush(battle_zones[num][aia+1].name, battle_zones[num][aia+1].ent,battle_zones[num][aia+1].type,true);
	}

	Queue_Command("TrainingCheck("+num+");", battle_zones[num][0].stimer);
}

function TrainingCheck(num)
{
	var flag = false;
	var number = Math.random();
	for (aia=0;aia<battle_zones[num][0].number;aia++)
	{
		if (battle_zones[num][aia+1].stage < battle_zones[num][0].stages)
		{
			flag = true;
			if (entities[battle_zones[num][aia+1].ent].hp <= 0 && battle_zones[num][aia+1].waity == 0)
			{
				number = Math.random();
				if (num == 50)
					number = 0.5;
				battle_zones[num][aia+1].waity = 1;
				Queue_Command("TrainAmbush("+num+", "+aia+");", Math.floor(battle_zones[num][0].timer*number))

			}
		}
		else if (battle_zones[num][0].wait == 1)
		{
			if (entities[battle_zones[num][aia+1].ent].hp > 0)
			{
				flag = true;
			}
		}
	}
	if (flag == true)
		Queue_Command("TrainingCheck("+num+");", battle_zones[num][0].stimer);
	else
	{
		if (battle_zones[num][0].target3 != undefined)
		{
			Queue_Command(battle_zones[num][0].target3, 40);
		}
		else
		{
			if (battle_zones[num][0].target2 != -1)
				OpenNameDoor(battle_zones[num][0].target2, false);
			if (battle_zones[num][0].target1 != -1)
				OpenNameDoor(battle_zones[num][0].target1, false);
		}
		UpdateTrainingWaves();
		
		if (g_training_end == 1)
		{
			if (num >= 59)
				ShowTutorial(40);
			else
				ShowTutorial(41);
		}
		else
			SetupWaveFont(33);

		g_wave_wait = true;
	}
	
	if (g_wave_wait == false)
	{
		if (IsCommandQueueEmpty())
		{
			if (battle_zones[num][0].target3 != undefined)
			{
				Queue_Command(battle_zones[num][0].target3, 40);
			}
			else
			{
				if (battle_zones[num][0].target2 != -1)
					OpenNameDoor(battle_zones[num][0].target2, false);
				if (battle_zones[num][0].target1 != -1)
					OpenNameDoor(battle_zones[num][0].target1, false);
			}



			UpdateTrainingWaves();
			if (g_training_end == 1)
			{
				if (num >= 59)
					SetupWaveFont(40);
				else
					SetupWaveFont(41);
			}
			else
				ShowTutorial(33);
			g_wave_wait = true;	
		}
	}
}


var g_wt_counter = -1;
var g_wt_counter_max = 300;

function SetupWaveFont(num)
{
	g_wt_counter = g_wt_counter_max;
}

function DrawWaveFont()
{
	var string = "WAVE COMPLETED!";
	var wx = 160-fonty2.getStringWidth(string)/2;
	var wy = 100;
	var rad = 4;
	var frq = 4;
	
	var amtt = 2;
	
	if (g_wt_counter < g_wt_counter_max/2)
	{
		DrawWaveFont2();
		return;
	}
	
	
	if (g_wt_counter_max-g_wt_counter < 30)
	{
		fonty2.setColorMask(CreateColor(160,16,0,255*(g_wt_counter_max-g_wt_counter)/30));
	}
	else if (g_wt_counter < g_wt_counter_max/2+30 && g_wt_counter >= g_wt_counter_max/2)
	{
		fonty2.setColorMask(CreateColor(160,16,0,255*(g_wt_counter-150)/30));
	}
	else if (g_wt_counter < g_wt_counter_max/2)
	{
		return;
	}
	else
	{
		fonty2.setColorMask(CreateColor(160,16,0,255));
	}
	
	for (l=0;l<string.length;l++)
	{
		fonty2.drawText(wx+l*fonty2.getStringWidth("A"), wy+Math.sin((g_wt_counter+l*amtt)/frq)*rad, string.charAt(l)); 
	}

}

function DrawWaveFont2()
{
	var string = "RESTOCK AMMO!";
	var wx = 160-fonty2.getStringWidth(string)/2;
	var wy = 100;
	var rad = 4;
	var frq = 4;
	
	var amtt = 2;
	
	if (g_wt_counter_max/2-g_wt_counter < 30)
	{
		fonty2.setColorMask(CreateColor(160,16,0,255*(g_wt_counter_max/2-g_wt_counter)/30));
	}
	else if (g_wt_counter < 30 && g_wt_counter >= 0)
	{
		fonty2.setColorMask(CreateColor(160,16,0,255*(g_wt_counter)/30));
	}
	else if (g_wt_counter < 0)
	{
		return;
	}
	else
	{
		fonty2.setColorMask(CreateColor(160,16,0,255));
	}
	
	for (l=0;l<string.length;l++)
	{
		fonty2.drawText(wx+l*fonty2.getStringWidth("A"), wy+Math.sin((g_wt_counter+l*amtt)/frq)*rad, string.charAt(l)); 
	}

}



function TrainAmbush(num,aia)
{
	battle_zones[num][aia+1].waity = 0;
	var randomy = SelectPossAmb();
	entities[battle_zones[num][aia+1].ent].x = possamb[randomy].x*16+8;
	entities[battle_zones[num][aia+1].ent].y = possamb[randomy].y*16+8;
	EnemyAmbush(battle_zones[num][aia+1].name,battle_zones[num][aia+1].ent,battle_zones[num][aia+1].type, true);
	battle_zones[num][aia+1].stage++;
}

var g_wave_zone = 0;


function TrainingNewCheck()
{
	if (g_wave_wait == true)
	{
		//clean up the guts
		TrainingCleanGuts();
		//setup a new training wave:
		map_zones[g_wave_zone] = 0;
		g_wave_wait = false;
	}
}

function UpdateTrainingWaves()
{
		g_training_stage++;
		if (g_wave_num == 0 && g_max_level >2 && g_training_stage > 2)
			g_wave_num++;
		else if (g_wave_num == 1 && g_max_level >6&& g_training_stage > 4)
			g_wave_num++;
		else if (g_wave_num == 2 && g_max_level >9&& g_training_stage > 6)
			g_wave_num++;
		else if (g_wave_num == 3 && g_max_level >10&& g_training_stage > 8)
			g_wave_num++;
		else if (g_wave_num == 4 && g_max_level >10&& g_training_stage > 10)
			g_wave_num++;
		else if (g_wave_num == 5 && g_max_level >13&& g_training_stage > 12)
			g_wave_num++;
		else if (g_wave_num == 6 && g_max_level >14&& g_training_stage > 14)
			g_wave_num++;
		else if (g_wave_num == 7 && g_max_level >14&& g_training_stage > 16)
			g_wave_num++;
		else if (g_training_stage > (g_wave_num+1)*2)
			g_training_end = 1;
		ResetPossAmb();
}
//clean up the guts:

function TrainingCleanGuts()
{
	for (sh=0;sh<max_guts;sh++)
	{
		if (guts[sh].x < 195*16+8 && guts[sh].x > 157*16+8)
		{
			guts[sh].x = -100;
			SetPersonIDX(guts[sh].id1, guts[sh].x);
		}
	}
	
	
	//restock the lockers too:
	RestockLocker("locker1_1|031");
	RestockLocker("locker1_2|022");
	RestockLocker("locker1_3|023");
	RestockLocker("locker1_4|024");
	RestockLocker("locker1_5|025");
	RestockLocker("locker1_6|026");
	RestockLocker("locker1_7|027");
	RestockLocker("locker1_8|028");
	RestockLocker("locker1_9|029");
	
	//restock the chaingun:
	if (g_chaingun_gotten == 1)
	{
		g_chaingun_stocked = 1;
		SetTile(130,75, 2,1235);
		SetTile(131,75, 2,1236);
		SetTile(130,76,2, 1240);
		SetTile(131,76,2,1241);	
	}
	
	//restock the sword:
	if (g_wave_num >= 7 && g_sword_gotten == 1 && weap_possess[11] == 0)
	{
		SetTile(127,75,2, 1355);
		SetTile(128,75,2, 1356);
		SetTile(127,76,2, 1360);
		SetTile(128,76,2, 1361);
	}
	
	
}

function RestockLocker(name)
{
	for (ml=0;ml<max_doors;ml++)
	{
		if (doors[ml].name == name)
		{
			doors[ml].active = 0;
			doors[ml].dir = "closed1";
			doors[ml].frame = 0;
			SetPersonIDDirection(doors[ml].id1, doors[ml].dir);
			SetPersonIDFrame(doors[ml].id1, doors[ml].frame);
		}
	}
}


/*
level 2: just enemy 1
	-three miniwaves
level 3: enemy 1 & 2
	-three miniwaves
level 7: enemy1,2, eyes
level 10: enemy1,2, eyes, mantis
	-doubled!
	-five miniwaves
level 11: enemy1,2, eyes, mantis, drone
	-five miniwaves
level 14: enemy1,2, eyes, mantis, drone, umberdogs, jellies
	-2 miniwaves
level 15: enemy1,2, eyes, mantis, drone, umberdogs, jellies, guards
	-five miniwaves
*/


