
void Q2_NewGame()
{
}

void Q2_PreBeginLevel()
{
	// Turok+ hand grenade finagling
	// we're not just spawning TurokPlus_Disable_HandGrenades, because we DO still want T+ to drop grenades on Hard and Hardcore before we get the GL, for throwing

	// make Turok+ think we have no grenades, so it won't give us GL when it tries to give us hand grenade
	if ( GameVariables.HasKey("GrenadeDebt") )
		GameVariables.SetValue( "GrenadeDebt", ""+ 30 );
	// tell Turok+ that whatever may be in the GL's slot isn't a hand grenade, so enemies won't drop grenades on Hard and Hardcore once we get the GL
	int bits;
	if ( GameVariables.GetInt("Smoke39Flags",bits) )
	{
		bits |= 1 << 2;
		GameVariables.SetValue( "Smoke39Flags", ""+ bits );
	}

	// prevent blaster from triggering hyperblaster drops from sergeants
	kActor@ a = ActorFactory.Spawn( "TurokPlus_Disable_ProtoPulse", 0,0,0, 0 );
	if ( a !is null ) a.Remove();
}

void Q2_PostBeginLevel()
{
	QuadInit();
	// spawn WeaponSound if Turok+ isn't installed to've spawned it already
	if ( WeaponSound is null )
		@WeaponSound = ActorFactory.Spawn( -1, Player.Actor().Origin().x, Player.Actor().Origin().y, Player.Actor().Origin().z, 0, Player.Actor().SectorIndex() );

	// raycast dummies
	@Dummy1 = ActorFactory.Spawn( -1, Player.Actor().Origin().x, Player.Actor().Origin().y, Player.Actor().Origin().z, 0, Player.Actor().SectorIndex() );
	@Dummy2 = ActorFactory.Spawn( -1, Player.Actor().Origin().x, Player.Actor().Origin().y, Player.Actor().Origin().z, 0, Player.Actor().SectorIndex() );
	Dummy1.Height() = Dummy1.Radius() = Dummy2.Height() = Dummy2.Radius() = 0;

	// pre-load rail trail models
	for ( int len = 1000; len > 32; len /= len > 100 ? 10 : 3 )
	{
		kStr str = "RailSpiral_";
		kActor @a = ActorFactory.Spawn( str + len, 0,0,0, 0, -1 );
		if ( a !is null ) a.Remove();
		str = "RailBeam_";
		@a = ActorFactory.Spawn( str + len, 0,0,0, 0, -1 );
		if ( a !is null ) a.Remove();
	}
}

void Q2_EndLevel()
{
	// make sure this gets cleared in case Turok+ isn't installed to do it
	@WeaponSound = null;
}
