require( "scripts/style.lua" );
require( "scripts/cinematic_variables_define.lua" )

function ButtonReturnEndCinematic()
	if( IsGameFinishedCinematic() )	then
		t = {};
		table.insert( t, SetStyle( OptionsButtonStyleCinematic ) );
		table.insert( t,
			Button
			{
				name = "skip",
				x = kMax - 280,
				y = GetScreenHeight() - 100,
				label = "back",
				close = true,
				type = kPush,
				command=
					function()
						-- Switch to the appropriate screen
						KillMusic();
						MuteSoundType( FXSound, false )
						MuteSoundType( MusicSound, false )
						DisableInput( false );
						SetFaeryWait( false )
						--end
					end
			}
		);
		return Group(t);
	end	
end

MakeDialog
{
	CinematicWindow
	{
	    x = 0,
		y = 0,
		w = GetScreenWidth(),
		h = GetScreenHeight(),
     
		Bitmap
		{
			name = "Animatic_2",
			image = "backgrounds/animatic/animatic_end_002_1024",
			
			x = kCenter,
			y = kCenter,
			
			Bitmap
			{			
				name = "background_top",
				image = "backgrounds/animatic/animatic_background_top_64",
				
				x = kCenter,
				y = kCenter - 352,
			},
			
			Bitmap
			{			
				name = "background_bottom",
				image = "backgrounds/animatic/animatic_background_top_64",
				vflip = true, 
				
				x = kCenter,
				y = kCenter + 352,
			},	
			
			
			
			
			Bitmap
			{
				x=kCenter ,
				y=kCenter + 180 ,
			 
				name = "animatic_dialogue",
			 
				image = "backgrounds/animatic/animatic_dialogue" ,
				
				Text
				{
					font = DialogCinematicFont,
					name = "cinematic_end_dial_2",
					x = G_cinematic_dialog_x,
					y = 11,
					w = G_cinematic_dialog_w,
					h = G_cinematic_dialog_h,
					flags = kHAlignCenter + kVAlignCenter,
					label = "animaticend2",
				},	
				
			
			},
			
			
			
			--SetStyle( MenuAnimaticStyle ),
			
			Button
			{
				x=kCenter + 424,
				y=kCenter + 300,
				name="next",
				--MenuButtonLabel("play"),
				---label = "play",
					
				type = kPush,
				command=
					function()
						SwapToModal("scripts/cinematic_end_3.lua");						
					end
			},	
			
		},
		
		Bitmap
		{
		  name = "animatic_2_left",
		  image = "backgrounds/animatic/animatic_end_002_left_168",
		  
		  x = kCenter - 594,
		  y = kCenter,
		},
		
		Bitmap
		{
		  name = "animatic_2_right",
		  image = "backgrounds/animatic/animatic_end_002_right_168",
		  
		  x = kCenter + 594,
		  y = kCenter - 1,
		},
		
		Bitmap
			{			
				name = "background_top",
				image = "backgrounds/animatic/animatic_background_top_64",
				
				x = kCenter,
				y = kCenter - 352,
			},
			
		Bitmap
			{			
				name = "background_bottom",
				image = "backgrounds/animatic/animatic_background_top_64",
				vflip = 1, 
				
				x = kCenter,
				y = kCenter + 352,
			},	
		
		Bitmap
		{			
			name = "background_left",
			image = "backgrounds/animatic/animatic_background_left_64",
			
			x = kCenter - 596,
			y = kCenter,

		},

		Bitmap
		{			
			name = "background_right",
			image = "backgrounds/animatic/animatic_background_left_64",
			
			hflip = 1,
			x = kCenter + 596,
			y = kCenter,

		},
		
		Text
        {
            font = DialogCinematicFont,
            name = "continue",
            x = kCenter,
            y = GetScreenHeight() - 80,
            w = 300,
			h = 60,
            label = "animatic_continue", 
			flags = kHAlignCenter,
        },
		
		ButtonReturnEndCinematic();	
	}	

}