#include "scripts/common.txt"
#include "scripts/BP_common.txt"
#include "scripts/BP_MapCommon.txt"

//Tag IDs
//1000: Start Warp
//2013: Save Point
//1001: Adon and Josh cinematic played
//1002: 
//1003: 
//1004: Monkeys
//1005: 

kActor@ cinPlayed;
//------------------------------------------------------------------------------------------------------------------------
// Start Map
//------------------------------------------------------------------------------------------------------------------------
$script 0
{
	StartMap();
	@cinPlayed = World.GetActorByTID(1001);
	Game.CallDelayedMapScript(1, instigator, 0); //Update Map
}
//------------------------------------------------------------------------------------------------------------------------
// Update Map
//------------------------------------------------------------------------------------------------------------------------
$script 1
{
	TickMap();
	$restart;
}
//------------------------------------------------------------------------------------------------------------------------
// Update Adon and Josh cinematic
//------------------------------------------------------------------------------------------------------------------------
$script 2
{
    if (Camera.UserInterrupted())
    {
		Game.HaltMapScript(10000);
		EndCinematic();
        return;
    }
    
    $restart;
}
//------------------------------------------------------------------------------------------------------------------------
void EndCinematic()
{
	Camera.StopCinematic();
	while (Camera.CinematicState() != 5) { delay(0.000001f); } //wait until fading in from cinema to player
	ClearHUDMessages();
}
//------------------------------------------------------------------------------------------------------------------------
// Adon and Josh cinematic
//------------------------------------------------------------------------------------------------------------------------
$script 10000
{
	if (!cinPlayed.IsPersistentMarked())
	{
		cinPlayed.MarkPersistentBit(false);
		
		// Camera.StartCinematic(CMF_NO_LETTERBOX | CMF_LOCK_PLAYER | CMF_UNLOCK_PLAYER_ON_FINISH);
		// Camera.ClearLookAtActor();
		// Camera.ClearFinalView();
		// Camera.ClearViewTracks();
		// Camera.origin = Math::vecZero;
		// Camera.yaw = 0.0f;
		// Camera.pitch = 0.0f;
		// Camera.roll = 0.0f;
		// Camera.fov = 70.0f;
		// Camera.lookZOffset = 0.0f;
		// while (Camera.CinematicState() != 2) { delay(0.000001f); } //wait until cinema has started to fade in
		// Game.CallDelayedMapScript(2, instigator, 0); //Update Cinematic
		// delay(0.5f);
		// int msgTime = 360;
		// Game.PrintLine("If only I'd remember my sunblock.", 0, msgTime);
		// Game.PrintLine("Jeez, it's hot out here.", 1, msgTime);
		// Game.PrintLine("------", 2, msgTime);
		// Game.PrintLine("Joshua", 3, msgTime);
		// delay(7.0f);
		// Game.PrintLine("the energy of the chronoscepter is released.", 0, msgTime);
		// Game.PrintLine("Hurry Joshua. We must stop Tal'Set before", 1, msgTime);
		// Game.PrintLine("----", 2, msgTime);
		// Game.PrintLine("Adon", 3, msgTime);
		// delay(7.0f);
		// Game.PrintLine("to be my best day.", 0, msgTime);
		// Game.PrintLine("I can tell this is not going", 1, msgTime);
		// Game.PrintLine("------", 2, msgTime);
		// Game.PrintLine("Joshua", 3, msgTime);
		// delay(7.0f);
		// Game.HaltMapScript(2);
		// EndCinematic();
	}
}
//------------------------------------------------------------------------------------------------------------------------
