//
// Copyright(C) 2014-2015 Samuel Villarreal
//
// This program is free software; you can redistribute it and/or
// modify it under the terms of the GNU General Public License
// as published by the Free Software Foundation; either version 2
// of the License, or (at your option) any later version.
//
// This program is distributed in the hope that it will be useful,
// but WITHOUT ANY WARRANTY; without even the implied warranty of
// MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
// GNU General Public License for more details.
//
// DESCRIPTION:
//      Level Script For Level45.map
//

#include "scripts/common.txt"

/*
==============================================================
Script 0
==============================================================
*/

$script 0
{
    Camera.StartCinematic(CMF_LOCK_PLAYER|CMF_NO_LETTERBOX|CMF_NO_INITIAL_FADEOUT);
    Camera.SetFinalView(0);
    
    Camera.fov = 47.5f;
    
    Camera.SetPositionTrack(1, 
                                       kVec3(-25*GAME_SCALE, -10*GAME_SCALE, -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE, -26*GAME_SCALE, -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE,   0,            -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE,   0,            -2*GAME_SCALE));
                                       
    Camera.SetPositionTrack(2, 
                                       kVec3(-25*GAME_SCALE, -10*GAME_SCALE, -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE, -26*GAME_SCALE, -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE,   0,            -2*GAME_SCALE),
                                       kVec3( -1*GAME_SCALE,   0,            -2*GAME_SCALE));
                                       
    Camera.AutoPlayPositionTrack(1, 2.8f, CMLT_COSINE);
    Camera.AutoPlayPositionTrack(2, 2.8f, CMLT_COSINE);
    
    Camera.AutoPlayBlendTrack(0, 1, 2, 2.8f, CMLT_COSINE_POW);
    
    Game.CallDelayedMapScript(1, instigator, 0);
    
    delay(7.0f);
    PlayLoop.ChangeMap("levels/level46.map");
}

/*
==============================================================
Script 1
==============================================================
*/

$script 1
{
    if(Camera.UserInterrupted())
    {
        PlayLoop.ChangeMap("levels/level46.map");
        return;
    }
    
    $restart;
}
