{
	debug_spam [0]
	debug_godmode [0]
	debug_SkipToCine [0]

	// Level variables
	//
	saved_GoFlak1 [0]
	saved_GotDocs1 [0]
	saved_GotDocs2 [0]
	saved_Flak3Called [0]
	saved_InTooQuick [0]
	saved_InZone_firstGun [0]
	saved_InZone_cineRescue [0]
	saved_InZone_bunker1_2_enter [0]
	saved_InZone_bunker1_exit [0]
	saved_InZone_bunker2_1b_enter [0]
	saved_InZone_way3 [0]
	saved_InZone_way4 [0]
	saved_InZone_way12 [0]
	saved_anim_walkCrouch [1]

	saved_gunsDestroyed [0]
	saved_yourFlaksDestroyed [0]
	saved_curFlakObj[6]
	saved_f4dead [0]
	saved_f5dead [0]
	saved_f6dead [0]

	saved_firsttime [1]
	saved_onload [1]

	Init[ (s)
	{
		SetVis_Default();

		// The below settings are tuned so that it takes 8 shots to kill a man on regular settings.
		// the value 96 sets it at 8 shots.

		// LevelDifficulty(256, 96, 32, 16);
		// StanceDifficulty(160, 128, 96);

		if(saved_firsttime = 1)
		{
			saved_firsttime = 0;

			// Cover Moody
			AddObjective( 34, 20805, 5118 );
			SetObjectiveActive(0, true);

			// Cover Moody
			AddObjective( 34, 13319, 10221 );
			SetObjectiveActive(1, false);

			// Retrieve Documents
			AddObjective( 35, 3617, 15130 );
			SetObjectiveActive(2, false);

			// Cover Moody
			AddObjective( 34, 9984, 29696 );
			SetObjectiveActive(3, false);

			// Retrieve Documents
			AddObjective( 35, 6558, 42511 );
			SetObjectiveActive(4, false);

			// Cover Moody
			AddObjective( 34, 15601, 42752 );
			SetObjectiveActive(5, false);

			// Destroy Flaks 1/3
			AddObjective( 36, 24704,41216);
			SetObjectiveActive(6,false);

			// Destroy Flaks 2/3
			AddObjective( 37,22144,28956);
			SetObjectiveActive(7, false);

			// Destroy Flaks 3/3
			AddObjective( 326,21589,16241);
			SetObjectiveActive(8, false);

			// Destroy Flaks
			AddObjective( 327, 26225,19441);
			SetObjectiveActive(9, false);

			// Return to camp
			AddObjective( 328, 26225,19441);
			SetObjectiveActive(10, false);

			Flak3 = GetEntity("Flak_3");
			Flak3.SetRadius(256);
			Flak3.SetRadius(512);

			Self = GetPlayer();
			Self.SetNationality(0); // You are American
			Self.GiveWeapon(41, 5); // M1 Garand
			Self.GiveWeapon(43, 5); // Thompson
			Self.GiveWeapon(40, 5); // Colt45
			Self.GiveWeapon(42, 8); // M2 Frag Grenade
			Self.SetRunning();

			if( debug_godmode = 1 )
			{
				Self.SetInvulnerable( true );
			} else {
				Self.SetInvulnerable( false );
			}

			if( debug_SkipToCine = 1 )
			{
				Spew("CHEAT --> Skip to cinematic");

				sarge = GetEntity("moody");
				Player = GetPlayer();

				sarge.SetPosition(11084,44044,-448);
				sarge.TurnToLocation(11801,42880);
				Player.SetPosition(11520,43942,-448);
				Player.TurnToEntity(GetEntity("enemy14"));

				ObjectiveComplete(0); SetObjectiveActive(0, false);
				ObjectiveComplete(1); SetObjectiveActive(1, false);
				ObjectiveComplete(2); SetObjectiveActive(2, false);
				ObjectiveComplete(3); SetObjectiveActive(3, false);
				ObjectiveComplete(4); SetObjectiveActive(4, false);
				SetObjectiveActive(5, true);

				Spew("CHEAT <-- Skip to cinematic");
			}
			else
			{
				GetPlayer().SetFrozen( true );
			}

			AutoSave();
		}
	} ]

	OnLevelLoad[ ()
	{
		PlayAmbient(23);
		f1 = GetEntity("fake1");
		f1.ShowWeapon(false);

		if(saved_onload = 1)
		{
			saved_onload = 0;

			if( debug_SkipToCine = 0 )
			{
				sarge = GetEntity("moody");

				sarge.PlayAnimation(7,8,1);
				sarge.Delay(5,1);
				GetPlayer().PlaySound(8);

				SetMessage("Brecourt Manor, France",75,35);
				SetMessage2(533,75,50);
				SetMessage3(488,75,65);
			}
		}
	}]

	GoPath[ (pathName, speed)
	{
		Spew(" ");
		Spew("--> GoPath(" # pathName # ")");
		Moody = GetEntity("moody");
		switch(speed)
		{
			case 0
			{
				Moody.SetRunning();
				Moody.PlayAnimation(0);
			}
			case 1
			{
				Moody.SetCrouching();
				Moody.PlayAnimation(1);
			}
		}
		Moody.FollowPath(pathName);
		Spew("<-- GoPath()");
	}]



	EnterZone[ (whichZone)
	{
		Spew(" ");
		Spew("@@@ zone:  " # whichZone # " @@@");

		if( whichZone = "GameOver" )
		{
			if( saved_yourFlaksDestroyed > 2 )
			{
				ObjectiveComplete(10); // Return to Camp
				//GetPlayer().OpenMenu("VictoryMenu");
				Victory();
				Moody = GetEntity("moody");
				Moody.Delay(8, 100);
			}
		}

		if( whichZone = "first_gun" )
		{
			if( saved_InZone_firstGun = 0 )
			{
				saved_InZone_firstGun = 1;

				if( saved_GoFlak1 = 0 )
				{
					saved_GoFlak1 = 1;

					Moody = GetEntity("moody");
					Squad3 = GetEntity("squad3");
					Squad1 = GetEntity("squad1");

					Moody.SetRunning();
					Moody.PlayAnimation(0);
					Moody.WalkTo(21618,2879,5,2);

					Squad1.Delay(3,15);

					Squad3.SetCrouching();
					Squad3.PlayAnimation(1);
					Squad3.WalkTo(19425,1802,10,2);
				}
			}
		}
		if( whichZone = "bunker1_2_enter" )
		{
			if( saved_InZone_bunker1_2_enter = 0 )
			{
				saved_InZone_bunker1_2_enter = 1;
				GoPath("Bunker1_2",0);
			}
		}
		if( whichZone = "bunker1_exit" )
		{
			if( saved_InZone_bunker1_exit = 0 )
			{
				saved_InZone_bunker1_exit = 1;
				sarge = GetEntity("moody");

				// Stropa Fix: wait 5 seconds before leaving 1st bunker
				GoPath("WestTrenchA",0);
				sarge.PauseFollowingPath();
				sarge.Delay(5,60);
			}
		}
		if( whichZone = "cineRescue")
		{
			if( saved_InZone_cineRescue = 0 )
			{
				saved_InZone_cineRescue = 1;

				med = GetEntity("medic");

				Player = GetPlayer();
				Player.SetInvulnerable(true);

				f1 = GetEntity("fake1");
				f1.ShowWeapon(false);
				f1.SetCrouching();
				f1.DropWeaponOnDeath(false);
				f1.SetInvulnerable(true);
				f1.ShowEntity(false);
				f1.Attack(med);

				f2 = GetEntity("fake2");
				f2.ShowWeapon(false);
				f2.SetCrouching();
				f2.DropWeaponOnDeath(false);
				f2.SetInvulnerable(true);
				f2.ShowEntity(false);
				f2.Attack(med);

				GoPath("GotoMedic",0);

				Medic = GetEntity("medic");
				Medic.Delay(3,10);
			}
		}
		if(whichZone = "way3" )
		{
			if( saved_InZone_way3 = 0 )
			{
				saved_InZone_way3 = 1;
				GoPath("WestTrenchB",0);
			}
		}
		if(whichZone = "way4")
		{
			if( saved_InZone_way4 = 0 )
			{
				saved_InZone_way4 = 1;
				GoPath("WestTrenchC",0);
			}
		}
		if(whichZone = "way12")
		{
			if( saved_InZone_way12 = 0 )
			{
				saved_InZone_way12 = 1;
			}
		}
		if(whichZone = "bunker2_1b_enter")
		{
			if( saved_InZone_bunker2_1b_enter = 0 )
			{
				saved_InZone_bunker2_1b_enter = 1;
			 	GoPath("Bunker2_1b",0);
			 	GetPlayer().PlaySound(19);

			}
		}
		if(whichZone = "TooQuick" )
		{
			if( saved_InTooQuick = 0 )
			{
				saved_InTooQuick = 1;

				e4 = GetEntity("enemy4");
				e3 = GetEntity("enemy3");

				if( not e3.IsDead() )
				{
					e3.Kill();
				}
				if( not e4.IsDead() )
				{
					e4.Kill();
				}
			}
		}
	} ]

	CheckObjectives[ ()
	{
		if( not IsObjectiveComplete(0) )
		{
			Enemy3 = GetEntity("enemy3");
			Enemy4 = GetEntity("enemy4");
			if( Enemy3.IsDead() and Enemy4.IsDead() )
			{
				saved_GoFlak1 = 1;

				// Walk to first Flak
				Moody = GetEntity("moody");
				Moody.SetRunning();
				Moody.PlayAnimation(1);
				Moody.WalkTo( 21000, 5081, 1, 1 );

				ObjectiveComplete(0);
				SetObjectiveActive(1,true);
				SetObjectiveActive(0,false);
			}
			return;
		}
		if( not IsObjectiveComplete(1) )
		{
			Enemy6 = GetEntity("enemy6");
			Enemy7 = GetEntity("enemy7");
			if( Enemy6.IsDead() and Enemy7.IsDead() )
			{
				Moody = GetEntity("moody");
				Moody.SetRunning();
				Moody.PlayAnimation(0);
				Moody.FollowPath("GotoFlak2");

				ObjectiveComplete(1);
				SetObjectiveActive(2,true);
			}
			return;
		}
		if( not IsObjectiveComplete(2) )
		{
			Enemy9 = GetEntity("enemy9");
			Enemy17 = GetEntity("enemy17");
			if( Enemy9.IsDead() and Enemy17.IsDead() )
			{
				if( saved_GotDocs1 = 0 )
				{
					Moody = GetEntity("moody");
					Docs = GetEntity("Docs_1");
					Moody.TurnToEntity( Docs );
					Moody.PlayAnimation(6,2,13);
					Moody.PlaySound(19,100,true);
				}
			}
			return;
		}

		if( not IsObjectiveComplete(3) )
		{
			Enemy11 = GetEntity("enemy11");
			Enemy12 = GetEntity("enemy12");
			if( Enemy11.IsDead() and Enemy12.IsDead() )
			{
				if( saved_Flak3Called = 0 )
				{
					saved_Flak3Called = 1;

					Spew("---[ Flak3 cleared ]---");
					GoPath("GotoFlak3",0);
				}
			}
			return;
		}
	} ]

	ActorKilled[ (whichActor)
	{
		CheckObjectives();

		if(whichActor = "npc1")
		{
			npc1 = GetEntity("npc1");
			npc3 = GetEntity("npc3");
			if( npc1.IsDead() and npc3.IsDead() )
			{
				docs = GetEntity("Docs_2");
				Moody = GetEntity("moody");
				Moody.TurnToEntity( docs );
				Moody.PlayAnimation(6,2,13);
				Moody.PlaySound(19);
			}
			return;
		}
		if(whichActor = "npc3")
		{
			npc1 = GetEntity("npc1");
			npc3 = GetEntity("npc3");
			if( npc1.IsDead() and npc3.IsDead() )
			{
				docs = GetEntity("Docs_2");
				Moody = GetEntity("moody");
				Moody.TurnToEntity( docs );
				Moody.PlayAnimation(6,2,13);
				Moody.PlaySound(19);
			}
			return;
		}
		if(whichActor = "enemy3" )
		{
			dude=GetEntity("enemy4");
			if( not dude.IsDead() )
			{
				dude.SetAttackDistance(20,8);
				dude.FollowPath("RevealFlak1");
			}
		}
	}]

	Spew[ (message)
	{
		if( debug_spam = 1 )
		{
			Log(message);
		}
	}]
}