//////////////////////////////////////////////////////////////////////////////
// HEADERS                                                                  //
//////////////////////////////////////////////////////////////////////////////

Header
	title		= "Jumalauta - Suger så jävla mycket"
	music		= "data/pumpuli.ogg"
	bpm			= 135
	fullscreen  = 1
	tracks		= 2
End

Resources
	halftone1	= image( "data/images/halftone1.jpg" )
	glow		= buffer( 16 )

	feb1		= image( "data/images/february.png" )
	feb2		= image( "data/images/february2.png" )
	feb3		= image( "data/images/february3.png" )
	feb4		= image( "data/images/february4.png" )
	feb5		= image( "data/images/february5.png" )

	title		= image( "data/images/title.png" )
	texts1		= image( "data/images/insult1.png" )
	texts2		= image( "data/images/insult2.png" )
	mask1		= image( "data/images/mask.png" )

	// vehje.3ds
	vehje1.bmp		= reference( glow )
	vehje2.bmp		= reference( glow )
	vehje3.bmp		= reference( glow )
	
	// babe.3ds
	loller.bmp		= image( "data/images/matti1.jpg" )
End

Objects
	cam			= camera()
	layer1		= layer( halftone1 )
	scene1		= 3ds( "data/3ds/vehje.3ds" )
	scene2		= 3ds( "data/3ds/babe.3ds" )
	feedback	= layer( glow )
	glow		= layer( glow )
	glow2		= layer( glow )
	feb			= layer( feb1, feb2, feb3, feb4, feb5, feb4, feb3, feb2 )
	texts		= layer( title, texts1, texts2 )
	mask		= layer( mask1 )
End

//////////////////////////////////////////////////////////////////////////////
// MAIN SCRIPT                                                              //
//////////////////////////////////////////////////////////////////////////////
Script
	#0.0 run( initGlow )
	#0.0 run( intro )

	#8.0 run( enableMask, 0 )
	#8.0 run( initPipes )
	#8.0 run( pipes )
	#16.0 run( pipes )
	#16.0 run( februaryLayer )
	#20.0 run( showTexts, 0 )

	#24.0 disable( 0, scene1 )
	#24.0 disable( 1, scene1 )

	#24.0 run( pipes )
	#24.0 run( rotoZoomer )

	#32.0 layer1.r = 1.0
	#32.0 run( initPipes )
	#32.0 run( pipes )

	#40.0 run( showTexts, 1 )
	#44.0 run( showTexts, 2 )

	#48.0 run( initPipes )
	#48.0 run( pipes2, 100 )
	#56.0 run( pipes2, 150 )

	#64.0 disable( 0, scene1 )
	#64.0 disable( 1, scene1 )
	#64.0 run( mohkale )

	#72.0 run( mohkale )

	#80.0 disable( mask )
	#80.0 run( rotoZoomer )
	#80.0 enable( 0, texts )
	#80.0 texts.frame = 1
	#80.0 texts.zoom = 100 to 130 in #8.0
	#80.0 texts.alpha = 1 to 0 in #8.0

	#89.0 end
End


//////////////////////////////////////////////////////////////////////////////
// INIT GLOW                                                                //
//////////////////////////////////////////////////////////////////////////////
Sub:initGlow
	#0.0 track 1 to buffer( 16 )
	#0.0 enable( 1, feedback, glow )
	#0.0 enable( 0, glow, glow2 )

	#0.0 glow.renderToBuffer = 1
	#0.0 glow.blending = 2			// screen
	#0.0 glow.effect = 2
	#0.0 glow.effect.amount = 2
	#0.0 glow.bufferComponents = 1
	#0.0 glow2.blending = 2			// screen
	#0.0 glow2.g = 0

	#0.0 feedback.blending = 2
	#0.0 feedback.zoom = 99
End



Sub:setCamera
	#0.0 cam.pos.x = %0
	#0.0 cam.pos.y = %1
	#0.0 cam.pos.z = %2
	#0.0 cam.lookat.x = %3
	#0.0 cam.lookat.y = %4
	#0.0 cam.lookat.z = %5
End

Sub:setRandomCamera
	#0.0 cam.pos.x = 0
	#0.0 cam.pos.y = 0
	#0.0 cam.pos.z = 0
	#0.0 cam.lookat.x = ( rand( -1, 1, 0.01 ) )
	#0.0 cam.lookat.y = ( rand( -1, 1, 0.01 ) )
	#0.0 cam.lookat.z = ( rand( -1, 1, 0.01 ) )
	#0.0 glow2.g = 1.0 to 0.0 in #0.0.25
	#0.0 glow2.b = 1.0 to 0.5 in #0.0.25
	#0.0 feedback.brightness = 1.0 to 0.75 in #0.0.25
End


Sub:initPipes
	#0.0 enable( 0, cam, scene1 )
	#0.0 enable( 1, cam, scene1 )

	#0.0 scene1.meshes.0.rotate.z = 0 to 360 in #16.0
	#0.0 scene1.meshes.1.rotate.y = 0 to 360 in #16.0
	#0.0 scene1.meshes.2.rotate.x = 0 to 360 in #16.0
	#0.0 scene1.materials.0.sphereMap = 1
	#0.0 scene1.materials.1.sphereMap = 1
	#0.0 scene1.materials.2.sphereMap = 1
	#0.0 mask.zoom = 200 to 100 in #16.0
	#0.0 layer1.zoom = 100 to 300 in #16.0
	#0.0 layer1.rotate = 0 to 30 in #16.0
End


Sub:intro
	#0.0 enable( 0, layer1 )
	#0.0 enable( 1, layer1 )
	#0.0 layer1.zoom = 1000 to 100 in #8.0
	#0.0 layer1.r = 0 to 1 in #4.0
	#0.0 layer1.g = 0 to 1 in #8.0
	#0.0 layer1.rotate = 20 to 0 in #8.0
	#0.0 run( syncSnares )
	#1.0 run( syncSnares )
	#2.0 run( syncSnares )
	#3.0 run( syncSnares )
	#4.0 run( syncSnares )
	#5.0 run( syncSnares )
	#6.0 run( syncSnares )
	#7.0.0 run( setRandomCamera )
	#7.0.5 run( setRandomCamera )
	#7.1.0 run( setRandomCamera )
	#7.1.5 run( setRandomCamera )
	#7.2.0 run( setRandomCamera )
	#7.2.5 run( setRandomCamera )
	#7.3.5 run( setRandomCamera )
End

Sub:syncSnares
	#0.1 run( setRandomCamera )
	#0.3 run( setRandomCamera )
End

Sub:pipes
	#0.0 run( syncKicks )
	#4.0 run( syncKicks )
End

Sub:syncKicks
	#0.0 run( setRandomCamera )
	#0.1 run( setRandomCamera )
	#0.2 run( setRandomCamera )
	#0.3 run( setRandomCamera )
	#1.0 run( setRandomCamera )
	#1.1 run( setRandomCamera )
	#1.2 run( setRandomCamera )
	#1.3 run( setRandomCamera )
	#1.3.75 run( setRandomCamera )
	#2.0.5 run( setRandomCamera )
	#2.1 run( setRandomCamera )
	#2.2 run( setRandomCamera )
	#2.3 run( setRandomCamera )
	#3.0 run( setRandomCamera )
	#3.1 run( setRandomCamera )
	#3.2 run( setRandomCamera )
	#3.3 run( setRandomCamera )
	#3.3.5 run( setRandomCamera )
End

Sub:februaryLayer
	#0.0 enable( 0, feb )
	#0.0 enable( 1, feb )
	#4.0 disable( 0, feb )
	#4.0 disable( 1, feb )

	#0.0 feb.blending = 1
	#0.0 feb.frame = 0
	#0.0 feb.zoom = 0 to 100 in #0.0.5
	#0.1 feb.frame = 1
	#0.2 feb.frame = 2
	#0.3 feb.frame = 3
	#1.0 feb.frame = 4
	#1.1 feb.frame = 5
	#1.2 feb.frame = 6
	#1.3 feb.frame = 7
	#1.3.75 feb.frame = 8
	#2.0.5 feb.frame = 9
	#2.1 feb.frame = 10
	#2.2 feb.frame = 11
	#2.3 feb.frame = 12
	#3.0 feb.frame = 13
	#3.1 feb.frame = 14
	#3.2 feb.frame = 15
	#3.3 feb.frame = 16
	#3.3.5 feb.zoom = 100 to 0 in #0.0.5
End

Sub:rotoZoomer
	#0.0 feedback.alpha = 0.999
	#0.0 layer1.rotate = 0 to 1440 in #8.0
	#0.0 layer1.b = 1 to 0 in #4.0
	#4.0 layer1.r = 1 to 0 in #4.0

	#0.0 layer1.zoom = 100 to 400 in #1.0
	#1.0 layer1.zoom = 400 to 100 in #1.0
	#2.0 layer1.zoom = 100 to 400 in #1.0
	#3.0 layer1.zoom = 400 to 100 in #1.0
	#4.0 layer1.zoom = 100 to 400 in #1.0
	#5.0 layer1.zoom = 400 to 100 in #1.0
	#6.0 layer1.zoom = 100 to 400 in #1.0
	#7.0 layer1.zoom = 400 to 100 in #1.0
End

Sub:showTexts
	#0.0 enable( 0, texts )
	#0.0 texts.blending = 1
	#0.0 texts.frame = %0
	#4.0 disable( 0, texts )

	#0.0 texts.zoom = 0 to 100 in #0.1
	#0.1 texts.zoom = 80 to 100 in #0.0.5
	#0.3 texts.zoom = 80 to 100 in #0.0.5
	#1.1 texts.zoom = 80 to 100 in #0.0.5
	#1.3 texts.zoom = 80 to 100 in #0.0.5
	#2.1 texts.zoom = 80 to 100 in #0.0.5
	#2.3 texts.zoom = 80 to 100 in #0.0.5
	#3.1 texts.zoom = 80 to 100 in #0.0.5
	#3.3 texts.zoom = 100 to 0 in #0.1
End

Sub:enableMask
	#0.0 enable( 0, mask )
	#0.0 mask.frame = %0
	#0.0 mask.blending = 1
End

Sub:pipes2
	#0.0 cam.fovy = %0
	#0.0 run( syncKicks2 )
	#4.0 run( syncKicks2 )
End

Sub:syncKicks2
	#0.0 run( setRandomCamera2 )
	#0.1 run( setRandomCamera2 )
	#0.2 run( setRandomCamera2 )
	#0.3 run( setRandomCamera2 )
	#1.0 run( setRandomCamera2 )
	#1.1 run( setRandomCamera2 )
	#1.2 run( setRandomCamera2 )
	#1.3 run( setRandomCamera2 )
	#2.0 run( setRandomCamera2 )
	#2.1 run( setRandomCamera2 )
	#2.2 run( setRandomCamera2 )
	#2.3 run( setRandomCamera2 )
	#3.0 run( setRandomCamera2 )
	#3.1 run( setRandomCamera2 )
	#3.2 run( setRandomCamera2 )
	#3.3 run( setRandomCamera2 )
End

Sub:setRandomCamera2
	#0.0 cam.pos.x = -0.5 to 0.5 in #0.1
	#0.0 cam.pos.y = 0
	#0.0 cam.pos.z = 0
	#0.0 cam.lookat.x = ( rand( -1, 1, 0.01 ) )
	#0.0 cam.lookat.y = ( rand( -1, 1, 0.01 ) )
	#0.0 cam.lookat.z = ( rand( -1, 1, 0.01 ) )
	#0.0 glow2.g = 1.0 to 0.0 in #0.0.5
	#0.0 glow2.b = 1.0 to 0.5 in #0.0.5
	#0.0 feedback.brightness = 1.0 to 0.0 in #0.1
End

Sub:mohkale
	#0.0 disable( 0, layer1, glow, glow2 )
	#0.0 enable( 0 scene2 )
	#8.0 disable( 0, scene2 )
	#8.0 enable( 0, layer1, glow, glow2 )

	#0.0 cam.lookat.x = 0
	#0.0 cam.lookat.y = 0
	#0.0 cam.lookat.z = 0
	#0.0 scene2.materials.0.sphereMap = 1
	#0.0 scene2.materials.0.translucent = 1
	#0.0 cam.fovy = 30 to 170 in #8.0

	#0.0 cam.pos.z = 50 to -50 in #7.3
	#0.0 run( mohkaleCam_beat )
	#1.0 run( mohkaleCam_beat )
	#2.0 run( mohkaleCam_beat )
	#3.0 run( mohkaleCam_beat )
	#4.0 run( mohkaleCam_beat )
	#5.0 run( mohkaleCam_beat )
	#6.0 run( mohkaleCam_beat )
	#7.0 run( mohkaleCam_beat )
	#7.3 cam.pos.z = -50 to 50 in #0.1
End

Sub:mohkaleCam_beat
	#0.0 run( setRandomCamera3 )
	#0.1 run( setRandomCamera3 )
	#0.2 run( setRandomCamera3 )
	#0.3 run( setRandomCamera3 )
End

Sub:setRandomCamera3
	#0.0 cam.pos.x = ( rand( -50, 50 ) )
	#0.0 cam.pos.y = ( rand( -50, 50 ) )
End

// end of file
