//////////////////////////////////////////////////////////////////
//demo for animated logo
//By Alain Brégeon August 2001
//after the first dislay :
//click on 1 for diffusion animated
//click on 2 for blurred animation
//click on 3 for puzzle animation

// free use

////////////////////////////////////////////////////////////////////////////
// The engine starts in the resolution given by the follwing vars.
var video_mode = 6;	 // screen size 640x480
var video_depth = 16; // 16 bit colour D3D mode



/////////////////////////////////////////////////////////////////
// define a splash screen with the required A4/A5 logo
bmap logo1 = <diffusion.bmp>;
bmap logo2 = <flou.bmp>;
bmap logo3 = <puzzle.bmp>;
var vary = 0;
var choice_screen = 1;
sound logo1_s = <1.wav>;
sound logo2_s = <2.wav>;
sound logo3_s = <3.wav>;
panel logoaviscreen1
{
	pos_x = 0;pos_y = 0;
	layer = 2;
	window = 0,0,640,480,logo1,0,vary;
	//flags = refresh,d3d;
}
panel logoaviscreen2
{
	pos_x = 0;pos_y = 0;
	layer = 2;
	window = 0,0,640,480,logo2,0,vary;
	//flags = refresh,d3d;
}
panel logoaviscreen3
{
	pos_x = 0;pos_y = 0;
	layer = 2;
	window = 0,0,640,480,logo3,0,vary;
	//flags = refresh,d3d;
}

/////////////////////////////////////////////////////////////////
// The main() function is started at game start
function main()
{
// set some common flags and variables
//	warn_level = 2;	// announce bad texture sizes and bad wdl code
	tex_share = on;	// map entities share their textures

	play_logo();
}


function play_logo
{
// center the splash screen for non-640x480 resolutions, and display it
	vary = 0;
	
	logoaviscreen1.visible = off;
	logoaviscreen2.visible = off;
	logoaviscreen3.visible = off;

	if (choice_screen == 1){logoaviscreen1.visible = on;play_sound(logo1_s,100);}
	if (choice_screen == 2){logoaviscreen2.visible = on;play_sound(logo2_s,100);}
	if (choice_screen == 3){logoaviscreen3.visible = on;play_sound(logo3_s,100);}

// wait 3 frames (for triple buffering) until it is flipped to the foreground
	wait(3);
while (vary < 7680)
{
	waitt(5);
	vary += 480;
}


// wait the required second, then switch the splashscreen off.
	waitt(16);
	// remove splashscreen from video memory
	//if (choice_screen == 1){logoaviscreen1.visible = off;//bmap_purge(logo1);}
	//if (choice_screen == 2){logoaviscreen2.visible = off;//bmap_purge(logo2);}
	//if (choice_screen == 3){logoaviscreen3.visible = off;//bmap_purge(logo3);}

}

function choice_1
{
	choice_screen = 1;
	play_logo();
}
function choice_2
{
	choice_screen = 2;
	play_logo();
}
function choice_3
{
	choice_screen = 3;
	play_logo();
}

on_1 choice_1;
on_2 choice_2;
on_3 choice_3;
