EvaluateScript("menu_options.js");

var window2 = LoadWindowStyle("window2.rws");

var term_save = LoadImage("term_hack1.png");
var term_weap = LoadImage("term_weap1.png");
var term_map = LoadImage("term_map1.png");
var term_info = LoadImage("term_info1.png");
var term_exit = LoadImage("term_exit.png");

var term_save2 = LoadImage("term_hack2.png");
var term_weap2 = LoadImage("term_weap2.png");
var term_map2 = LoadImage("term_map2.png");
var term_info2 = LoadImage("term_info2.png");
var term_exit2 = LoadImage("term_exit2.png");

var tp_davis = new Array(6);

tp_davis[0] = LoadImage("tp_davis_eye1.png");
tp_davis[1] = LoadImage("tp_davis_eye2.png");
tp_davis[2] = LoadImage("tp_davis_1.png");
tp_davis[3] = LoadImage("tp_davis_2.png");
tp_davis[4] = LoadImage("tp_davis_3.png");
tp_davis[5] = LoadImage("tp_davis_4.png");
tp_davis[6] = LoadImage("tp_davis_7.png");
tp_davis[7] = LoadImage("tp_davis_5.png");
tp_davis[8] = LoadImage("tp_davis_6.png");

var tp_static = new Array(6);

tp_static[0] = LoadImage("tp_static1.png");
tp_static[1] = LoadImage("tp_static2.png");
tp_static[2] = LoadImage("tp_static3.png");
tp_static[3] = LoadImage("tp_static4.png");
tp_static[4] = LoadImage("tp_static5.png");
tp_static[5] = LoadImage("tp_static6.png");
tp_static[6] = LoadImage("tp_static7.png");
tp_static[7] = LoadImage("tp_static8.png");

var term_arrowup = LoadImage("term_arrowup.png");
var term_bar = LoadImage("term_bar1.png");
var term_slider = LoadImage("term_slider.png");


var g_first_scene = 0;
var g_terminal_furthest = 0;
var g_terminal_hacked = 0;

function AccessTerminal(numy)
{

	if (g_current_level == 4 && g_terminal_hacked == 1)
		return;
	if (numy > g_terminal_furthest)
	  g_terminal_furthest = numy;
	if (g_first_scene == 0 && g_current_level == 1)
	{
		PauseHeart();
		DoFirstConsoleScene();
		g_first_scene = 1;
		PlaySound(39);
		StartHeart();
		return;
	}
	PauseHeart();

	while(AreKeysLeft())
		GetKey();
		
	var delay_sound = -1;

	var a_frames = 0;
	var starttimey = GetTime();
	var frate = 25;

	var davis_x = 15;
	var davis_y = 11;
	
	var liegh_x = 250;
	var liegh_y = 170;

	var menux = 19;
	var menuy = 85;
	var menuw = 56;
	var menuh = 34*3;//*4;

	var twindx = 97;
	var twindy = 16;
	var twindw = 205;
	var twindh = 130;

	var mwindx = 97;
	var mwindy = 166;
	var mwindw = 205;
	var mwindh = 51;

	var exitx = 280;
	var exity = 220;
	var exitw = 32;
	var exith = 16;

	var nodavis = 0;
	var coffeecount = 0;
	
	var delay_script = 0;

	function DrawDavis()
	{
		if (nodavis == 0)
		{
			if (speakstring != "")
			{
				coffeecount = 0;
				if (speakstring.charAt(speakcount) == "1")
				{
					if (Math.floor(a_frames/3)%4 == 0)
						tp_davis[2].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 1)
						tp_davis[3].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 2)
						tp_davis[5].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 3)
					{
						tp_davis[4].blit(davis_x, davis_y);
						if (Math.floor((a_frames+1)/3)%4 == 0)
							UpdateTalk();
					}
				}
				else if (speakstring.charAt(speakcount) == "2")
				{
					if (Math.floor(a_frames/3)%4 == 0)
						tp_davis[2].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 1)
						tp_davis[3].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 2)
						tp_davis[3].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 3)
					{
						tp_davis[4].blit(davis_x, davis_y);
						if (Math.floor((a_frames+1)/3)%4 == 0)
							UpdateTalk();
					}
				}
				else if (speakstring.charAt(speakcount) == " ")
				{
					if (Math.floor(a_frames/3)%4 == 0)
						tp_davis[4].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 1)
						tp_davis[4].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 2)
						tp_davis[4].blit(davis_x, davis_y);
					else if (Math.floor(a_frames/3)%4 == 3)
					{
						tp_davis[4].blit(davis_x, davis_y);
	//					if (Math.floor((a_frames+1)/3)%4 == 0)
						a_frames+=2;
						starttimey-=frate*2;
	
						UpdateTalk();
					}
				}
				else
				{
					tp_davis[4].blit(davis_x, davis_y);
					if (Math.floor(a_frames/3)%4 == 3)
					{
						if (Math.floor((a_frames+1)/3)%4 == 0)
							UpdateTalk();
					}
				}
			}
			else
			{
				coffeecount++;
				UpdateTalk();
				if (coffeecount <200)
					tp_davis[4].blit(davis_x, davis_y);
				else if (coffeecount < 203)
					tp_davis[6].blit(davis_x, davis_y);
				else if (coffeecount < 209)
					tp_davis[7].blit(davis_x, davis_y);
				else if (coffeecount < 224+6)
					tp_davis[8].blit(davis_x, davis_y);
				else if (coffeecount < 230+6)
					tp_davis[7].blit(davis_x, davis_y);
				else if (coffeecount < 233+6)
					tp_davis[6].blit(davis_x, davis_y);
				else if (coffeecount < 400)
					tp_davis[4].blit(davis_x, davis_y);
				else
				{
					coffeecount=0;
					tp_davis[4].blit(davis_x, davis_y);
				}
			}

			if (Math.floor(a_frames/3)%50 == 0)
				tp_davis[1].blit(davis_x, davis_y);
			else
				tp_davis[0].blit(davis_x, davis_y);
		}
		tp_static[Math.floor(Math.random()*8)].blitMask(davis_x, davis_y, CreateColor(255,255,255,64+Math.floor(Math.random()*48)));
	}

	var speakstring = "";
	var speakcount = 0;

	function UpdateTalk()
	{
		speakcount++;
		if (speakcount > speakstring.length)
		{
			speakcount = 0;
			speakstring = "";
		}
	}

	var tstrings = new Array();
	var scount = 0;
	var sstart = 0;

	var barx = 299;
	var bary = 17;
	var barh = 128;
	var tlimit = 14;
	
	var terminal_quit = false;
	var terminal_text_latest = 0;
	var newtext = true;
	var text_im = GrabImage(0,0,1,1);

	function DrawTerminalText()
	{
		term_arrowup.blit(barx,bary-term_arrowup.height);
		term_bar.transformBlit(barx,bary, barx+term_bar.width, bary,
		barx+term_bar.width,bary+barh, barx, bary+barh);

		term_arrowup.transformBlit(barx+term_arrowup.width,bary+term_arrowup.height+barh,barx,bary+term_arrowup.height+barh,barx,bary+barh,barx+term_arrowup.width,bary+barh-1);

		if (scount-tlimit-1 > 0)
			term_slider.blit(barx,bary+Math.round((barh-term_slider.height)*sstart/(scount-tlimit-1)));
		else
			term_slider.blit(barx,bary);
		
		if (newtext == true)
		{
			for (dt=sstart;dt<scount &&dt<sstart+tlimit;dt++)
			{
				font2.drawText(twindx, twindy-2+(dt-sstart)*9,tstrings[dt]);

				if (dt >= terminal_text_latest)
					font2gl.drawText(twindx, twindy-2+(dt-sstart)*9,tstrings[dt]);
			}
			text_im = GrabImage(twindx, twindy, twindw, twindh);
			newtext = false;
		}
		else
		{
			text_im.blit(twindx, twindy);
		}
	}
	
	function AddText(str,str2)
	{
		newtext = true;
		if (str2 != undefined)
		{
			terminal_text_latest = scount;
			speakcount = 0;
			speakstring=str2;
		}
	
		if (str.length > 27)
		{
			var cc = 27;

			while(cc> 0 && str.charAt(cc) != " ")
				cc--;
			AddText(str.substr(0,cc));

			while(cc> 0 && str.charAt(cc) == " ")
				cc++;
				
			if (str.length-cc <= 27)
			{
				AddText(str.substr(cc,str.length));
				AddText("");
			
			}
			else
				AddText(str.substr(cc,str.length));
		}
		else
		{
			tstrings[scount] = str;
			scount++;
			
			if (str2 != undefined)
				AddText("");
		}
		
		if (scount-tlimit-1 > 0)
			sstart = scount-tlimit-1;
		else
			sstart = 0;
	}
	
	var gx,gy;

	var MouseClick = false;
	function UpdateTermInput()
	{
		if (IsMouseButtonPressed(MOUSE_LEFT))
		{
			gx = GetMouseX();
			gy = GetMouseY();
			
			if (gx >= barx && gx <= barx+term_bar.width &&
					gy >= bary && gy <= bary+barh)
			{
				if (Math.round((scount-tlimit-1)*(gy-bary)/barh) >=0)
				{
					sstart = Math.round((scount-tlimit-1)*(gy-bary)/barh);
					newtext = true;
				}
			}
		}
		
		while(AreKeysLeft())
		{
			if (GetKey() == KEY_ESCAPE)
				terminal_quit = true;
		}
		
		if (IsMouseButtonPressed(MOUSE_LEFT) == false)
			MouseClick = false;
		else if (IsMouseButtonPressed(MOUSE_LEFT) && MouseClick == false)
		{
			MouseClick = true;
			//check bounds for click areas.

			gx = GetMouseX();
			gy = GetMouseY();
			
			//check for slider clicks
			if (gx >= barx && gx <= barx+term_bar.width)
			{
				if (gy >= bary-term_arrowup.height && gy<bary)
				{
					if (sstart > 0)
						sstart--;
				
					newtext = true;
				}
				else if	(gy <= bary+term_arrowup.height+barh && gy >=bary+barh)
				{
					if (sstart < scount-tlimit-1)
						sstart++;
				
					newtext = true;
				}
			}
			//check for exit
			if (gx >= exitx && gx < exitx+exitw &&
			    gy >= exity && gy < exity+exith)
			{
				terminal_quit = true;
			}
			
			
			if (gx > menux && gx < menux+term_info.width)
			{
				if (gy > menuy && gy < menuy+term_info.height)
				{
					PlaySound(4);
					//check for hack query:
					if (g_current_level == 3 && g_terminal_hacked == 0)
					{
						g_terminal_hacked = 1;
						AddText(" Davis:  Hmm... I have some access to the power grid.  I should be able to open the door ahead of you, but not much else until you get to the control center just ahead.", "     11121121  11111211211 1111211112212");

						//open the door...
						for (f=0;f<max_doors;f++)
						{
							if (doors[f].name == "door1_2c")
							{
								doors[f].dir = "closed1";
								doors[f].frame = 0;
								doors[f].active = 1;
					
								SetPersonIDDirection(doors[f].id1, doors[f].dir);
								SetPersonIDFrame(doors[f].id1, doors[f].frame);
							}
						}	
						delay_sound = 39;					
					}
					else if (g_current_level == 4 && g_terminal_hacked == 0)
					{
						g_terminal_hacked = 1;
						AddText(" Davis:  Looks like that did it.  The door to the lower level should be open now.",  "11211   1211212111              11121");
						AddText(" Leigh:  Ok, so where is this door?");
						AddText(" Davis:  Back in the hangar area...");
						AddText(" Leigh:  ...");

						delay_script = 1;					
					}
					else if (g_current_level == 8 && g_terminal_hacked == 0)
					{
						g_terminal_hacked = 1;

						for (f=0;f<max_doors;f++)
						{
							if (doors[f].name == "door3_1c" || doors[f].name == "door3_2c" || doors[f].name == "door3_3c" || doors[f].name == "door3_4c" || doors[f].name == "door3_5c")
							{
								doors[f].dir = "closed1";
								doors[f].frame = 0;
								doors[f].active = 1;
					
								SetPersonIDDirection(doors[f].id1, doors[f].dir);
								SetPersonIDFrame(doors[f].id1, doors[f].frame);
							}
						}	
						Queue_Command("PlaySound(116);", 2);

						AddText(" Davis:  What?  Got a problem with a bunch of electric fields above you?  Got it covered - a simple rerouting of power, and they're all shut off... I guess.",  "1  112111121   111   11211 1212     12112   11");
					}
					else if (g_current_level == 3)
					{
						AddText(" Davis:  Sorry, not much more I can do right now.", "2 11111111");
					}
					else if (g_current_level == 4)
					{
						AddText(" Davis:  The door's open man, let me read all this new stuff.", "1112  11211112");
					}
					else if (g_current_level == 8)
					{
						AddText(" Davis:  The power to the fields is off, so they should be open.  Should be good to go.", "1211111 11211  21111");
					}
					else if (g_current_level == -2)
					{
						AddText(" Davis:  What?  There's nothing here to hack dumbass...", "2  2211121");
					}
					else
					{
						AddText(" Davis:  Sorry, I can't find anything useful I can help with right now.", "2 11122111111");
					}
				}
				else if (gy > menuy+34 && gy < menuy+34+term_info.height)
				{
					//check for weap query:
					PlaySound(4);

					AddText(" Davis: What weapon you got?", "1211");
					ClearMenu();

					GoWeapMenu(0);

				}
				else if (gy > menuy+68 && gy < menuy+68+term_info.height)
				{
					//check for info query:
					PlaySound(4);

					AddText(" Davis: What do you want to know?", "211121");
					ClearMenu();
					
					for (amo=0;amo<max_menu_options;amo++)
					{
						if (menu_options[g_current_level][amo][0] != "")
						{
							AddMenuOption(menu_options[g_current_level][amo][0], menu_options[g_current_level][amo][1]);
						}
					}
				}
				else if (gy > menuy+102 && gy < menuy+102+term_info.height)
				{
					//check for map query:
				}
			} 
			
			for (am=0;am<max_options;am++)
			{
				if (options[am].text != "" && options[am].script != "")
				{
	//				GetKey();
					if (gx >= twindx && gx < twindx+twindw &&
							gy >= mwindy-2+am*9+2 && gy <mwindy-2+(am+1)*9+2)
							{
								PlaySound(5);
								DoScripty(options[am].script);
							}
				}
			}
/*			
			term_save.blit(menux,menuy);
			term_weap.blit(menux,menuy+34);
			 term_map.blit(menux,menuy+68);
			term_info.blit(menux,menuy+102);
*/		
		}
		/*
		if (AreKeysLeft())
		{
			if (GetKey() == KEY_ENTER)
			{
			  speakcount = 0;
			  speakstring = "";
				AddText("Davis: This is some sample text.", "11221212   1");
			}
		}*/
	}


	function DoScripty(text)
	{
		DoScripty2(text);
	}	
	
	function DoScripty2(text)
	{
		eval(text);
	}	

	var max_options = 5;
	var options = new Array(max_options);
	for (am=0;am<max_options;am++)
		options[am] = new Object();

	function ClearMenu()
	{
		for (am=0;am<max_options;am++)
		{
			options[am].text = "";
			options[am].script = "";
		}
	}

	ClearMenu();
	
	function AddMenuOption(text, script)
	{
		for (am=0;am<max_options;am++)
		{
			if (options[am].text == "")
			{
				options[am].text = text;
				options[am].script = script;
				break;
			}
		}
	}

	function DrawMenuOptions()
	{
		gx = GetMouseX();
		gy = GetMouseY();
		for (am=0;am<max_options;am++)
		{
			if (options[am].text != "")
			{
//				GetKey();
				font2.drawText(twindx, mwindy-2+am*9,options[am].text);
				if (gx >= twindx && gx < twindx+twindw &&
				    gy >= mwindy-2+am*9+2 && gy <mwindy-2+(am+1)*9+2)
				font2gl.drawText(twindx, mwindy-2+am*9,options[am].text);
			}
		}
	}
	
	function DrawTerminal(num)
	{
		if (num == undefined)
		{
				RenderBackground();
				//backg.blit(0,0);
				window2.drawWindow(davis_x, davis_y, 60,60);
				DrawDavis();
		
		//		window2.drawWindow(liegh_x, liegh_y, 60,60);
		//		tp_davis[4].blit(liegh_x, liegh_y);
				window2.drawWindow(menux, menuy, menuw,menuh);
				
				term_save.blit(menux,menuy);
				term_weap.blit(menux,menuy+34);
				//term_map.blit(menux,menuy+68);
				term_info.blit(menux,menuy+68);
	
	
		
				gx=GetMouseX();
				gy=GetMouseY();
				
				if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy && gy < menuy+34)
					term_save2.blit(menux,menuy);
				else if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy+34 && gy < menuy+68)
					term_weap2.blit(menux,menuy+34);
				else if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy+68 && gy < menuy+102)
					term_info2.blit(menux,menuy+68);
	//			else if (gx>=menux && gx <=menux+term_save.width &&
						//gy>=menuy+102 && gy < menuy+136)
					//term_map2.blit(menux,menuy+102);
		
				text_window.drawWindow(twindx, twindy, twindw, twindh);
				text_window.drawWindow(mwindx, mwindy, mwindw, mwindh);
		
				DrawTerminalText();
				DrawMenuOptions();
	
				window2.drawWindow(exitx, exity, exitw, exith);
				term_exit.blit(exitx,exity);
				if (gx>=exitx && gx <=exitx+exitw &&
						gy>=exity && gy <=exity+exith)
					term_exit2.blit(exitx,exity);
		
				crosshair.blit(GetMouseX()-crosshair.width/2, GetMouseY()-crosshair.height/2);
		}
		else if (num == 1)
		{
				RenderBackground();
				//backg.blit(0,0);
				window2.drawWindow(davis_x, davis_y, 60,60);
		
		//		window2.drawWindow(liegh_x, liegh_y, 60,60);
		//		tp_davis[4].blit(liegh_x, liegh_y);
				window2.drawWindow(menux, menuy, menuw,menuh);
				
		
				text_window.drawWindow(twindx, twindy, twindw, twindh);
				text_window.drawWindow(mwindx, mwindy, mwindw, mwindh);
		
				window2.drawWindow(exitx, exity, exitw, exith);
		}
		else if (num == 2)
		{
				backg.blit(0,0);
				DrawDavis();
		
		//		window2.drawWindow(liegh_x, liegh_y, 60,60);
		//		tp_davis[4].blit(liegh_x, liegh_y);
			
				term_save.blit(menux,menuy);
				term_weap.blit(menux,menuy+34);
				//term_map.blit(menux,menuy+68);
				term_info.blit(menux,menuy+68);
	
	
		
				gx=GetMouseX();
				gy=GetMouseY();
				
				if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy && gy < menuy+34)
					term_save2.blit(menux,menuy);
				else if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy+34 && gy < menuy+68)
					term_weap2.blit(menux,menuy+34);
				else if (gx>=menux && gx <=menux+term_save.width &&
						gy>=menuy+68 && gy < menuy+102)
					term_info2.blit(menux,menuy+68);
	//			else if (gx>=menux && gx <=menux+term_save.width &&
						//gy>=menuy+102 && gy < menuy+136)
					//term_map2.blit(menux,menuy+102);
		
	
				DrawTerminalText();
				DrawMenuOptions();
				term_exit.blit(exitx,exity);
				if (gx>=exitx && gx <=exitx+exitw &&
						gy>=exity && gy <=exity+exith)
					term_exit2.blit(exitx,exity);
		
				crosshair.blit(gx-crosshair.width/2, gy-crosshair.height/2);
		}
	}

	function TerminalStart()
	{
		while (!terminal_quit)
		{
			DrawTerminal(2);
			FlipScreen();
			UpdateTermInput();
			a_frames++;
			while(GetTime()-starttimey<a_frames*frate);
		}

		
		PlaySound(6);

		for (ai=0;ai<4.5;ai+=0.25)
		{

			davis_x-=ai*ai;// = 15;
			davis_y-=ai*ai;// = 11;
			
			liegh_x;// = 250;
			liegh_y;// = 170;
		
			menux-=ai*ai;// = 19;
			menuy;// = 85;
		
			twindx+=ai*ai;// = 97;
			twindy;// = 16;
		
			mwindx;// = 97;
			mwindy+=ai*ai;// = 166;
			exitx+=ai*ai;// = 280;
			exity+=ai*ai;// = 220;

			barx+=ai*ai;// = 299;
			bary;// = 17;
		
			DrawTerminal();
			FlipScreen();
			a_frames++;
			while(GetTime()-starttimey<a_frames*frate);
		}
		RenderBackground();
		FlipScreen();
	}
	


	function GoWeapMenu(num)
	{
		ClearMenu();
		var count =0;
		var sswitchy1 = 0;
		var sswitchy2 = 0;
		var tester;

		for (gw=0;gw<10;gw++)
		{
			tester = gw;
			if (gw >= 8)
				tester = gw+2;

			if (weap_possess[tester] == 1)
			{
				count++;
				if (count <= 4)
				{
					sswitchy1=gw;
				}
				if (count <= 8)
					sswitchy2=gw;
			}
			
		}
	


		if (num <= sswitchy1)
		{
			//first menu
			for (gwm=0;gwm<=sswitchy1;gwm++)
			{
				tester = gwm;
				if (gwm >= 8)
					tester = gwm+2;
			
				if (weap_possess[tester] == 1)
				{
					AddMenuOption(weap_texts[gwm].name,  "AddText(weap_texts["+gwm+"].text, \"121121221211221\"); GoWeapMenu("+gwm+");");
				}
			}
			if (count-1 > sswitchy1)
			{
				//more
				AddMenuOption("More", "GoWeapMenu("+(sswitchy1+1)+");");
			}
		}
		else if (num <= sswitchy2)
		{
			//second menu
			for (gwm=sswitchy1+1;gwm<=sswitchy2;gwm++)
			{
				tester = gwm;
				if (gwm >= 8)
					tester = gwm+2;

				if (weap_possess[tester] == 1)
					AddMenuOption(weap_texts[gwm].name,  "AddText(weap_texts["+gwm+"].text, \"121121221211221\"); GoWeapMenu("+gwm+");");
			}
			//more
			if (count-1 > sswitchy2)
			{
				AddMenuOption("Next", "GoWeapMenu("+sswitchy2+1+");");
			}
			else
				AddMenuOption("Back", "GoWeapMenu("+0+");");
		}
		else
		{
			//third menu
			for (gwm=sswitchy2+1;gwm<10;gwm++)
			{
				tester = gwm;
				if (gwm>= 8)
					tester = gwm+2;

				if (weap_possess[tester] == 1)
					AddMenuOption(weap_texts[gwm].name,  "AddText(weap_texts["+gwm+"].text, \"121121221211221\"); GoWeapMenu("+gwm+");");
			}
			//more
			AddMenuOption("Back", "GoWeapMenu("+0+");");
		}
	
	}










	if (numy == "11")
	{
	  nodavis = 0;
		AddText(" Davis: Heya.", "12");
	}
	if (numy == "13")
	{
	  nodavis = 0;
		AddText(" Davis: What's up?", "11");
	}
	
	if (numy == "14")
	{
	  nodavis = 0;
		AddText(" Davis: 'Bout time you got here.", "11");
	}
	if (numy == "17")
	{
	  nodavis = 0;
		AddText(" Davis: Made it through alright?", "11");
	}

	if (numy == "18")
	{
	  nodavis = 0;
		AddText(" Davis: Yo, Davis here.", "11");
	}

	if (numy == "19")
	{
	  nodavis = 0;
		AddText(" Davis: Ready for some combat Leigh?", "11");
	}

	
	Rectangle(0,0,GetScreenWidth(), GetScreenHeight(), CreateColor(0,0,0,255));
//	RenderBackground();
	DrawTerminal(1);
	var backg = GrabImage(0,0,GetScreenWidth(), GetScreenHeight());
	
	TerminalStart();
	StartHeart();
	
	if (delay_sound > -1)
		PlaySound(delay_sound);
	if (delay_script == 1)
	{
		WipeIntro();
		WipeStart();
	}
}