// **** DEFINES ****

Define _IMG_DIR = data/png/
Define _MUSIC_DIR = data/

Define S_Initial = scene.0
Define S_Camera = scene.1
Define S_Background = scene.2
Define S_Scene1 = scene.3
Define S_Scene2 = scene.4
Define S_Scene3 = scene.5
Define S_CubeBalls = scene.6
Define S_Tunnel = scene.7
Define S_Torque = scene.8
Define S_Font = scene.9
Define S_Radiosity = scene.10
Define S_Scene4 = scene.11
Define S_LightThings = scene.12
Define S_Noise = scene.13
Define S_PostProcess = scene.14

Define P_Fovy = S_Initial.dbl.0
Define P_BgColor = S_Initial.dbl.1
Define P_CameraPosX = S_Camera.dbl.0
Define P_CameraPosY = S_Camera.dbl.1
Define P_CameraPosZ = S_Camera.dbl.2	
Define P_CameraScripted = S_Camera.bool.1
Define P_CameraReset = S_Camera.bool.2

Define P_CubeBallsLighting = S_CubeBalls.bool.1

Define P_ShowImage = S_Noise.lng.0
Define P_ShowBg = S_Background.lng.0
Define P_BgScroll = S_Background.dbl.0
Define P_BgImageColor = S_Background.dbl.1
Define P_NoiseAlpha = S_Noise.dbl.0
Define P_OverlayAlpha = S_Noise.dbl.1
Define V_NoImage = 666

Define P_DrawToBuffer = S_Initial.bool.1
Define P_ManualGlow = S_PostProcess.bool.1
Define P_GlowAmount = S_PostProcess.dbl.0
Define P_Brightness = S_PostProcess.dbl.1
Define P_PostProcess = S_PostProcess.lng.0
Define V_NoProcess = 0
Define V_VideoTape = 1
Define V_VertVideoTape = 2
Define P_ScreenRun = S_PostProcess.dbl.2

Define P_TorqueScale = S_Torque.dbl.0
Define P_TorqueBlend = S_Torque.bool.1

Define P_FontMode = S_Font.lng.0
Define P_FontReset = S_Font.bool.1
Define P_FontMove = S_Font.dbl.0

Define P_Scene3Reset = S_Scene3.bool.1
Define P_Scene3SphereColor = S_Scene3.dbl.0
Define P_SpringGrowth = S_Scene3.dbl.1
Define P_TunnelDrawSphere = S_Tunnel.bool.1
Define P_ShowSpring2 = S_Radiosity.bool.1
Define P_RadioSpringGrowth = S_Radiosity.dbl.0

// **** DEFINE SYNC PATTERNS ****

DefinePattern 0 *.....#.*.....#...#...#.*...#...#.....#.*.....#...#...#.*...#...
DefinePattern 1 #...*..#..*.....
DefinePattern 2 *...............................
DefinePattern 3 *.....*...*.................*.*.
DefinePattern 4 *...............
DefinePattern 5 #.....#.*.....#...#...#.*...#...#.....#.*.....#...#...#.*...#...

// **** FILE LOADS ****

LoadMusic dem0.ogg 176 4

LoadImage envmap envmap.png mipmap
LoadImage envmap2 envmap2.png mipmap
LoadImage envmap3 metal.png mipmap
LoadImage grid1 grid1.png mipmap
LoadImage noise noise.png repeat linear
LoadImage sphere foo.png mipmap

LoadImage overlay0 overlay1.png
LoadImage overlay1 overlay2.png
LoadImage overlay2 overlay3.png
LoadImage overlay3 overlay4.png
LoadImage overlay4 overlay5.png
LoadImage overlay5 credits.png
LoadImage overlay6 overlay6.png
LoadImage overlay7 overlay7.png
LoadImage overlay8 overlay8.png

LoadImage bg0 bg1.png
LoadImage bg1 bg2.png
LoadImage bg2 bg3.png
LoadImage bg3 bg4.png

// **** MAIN SCRIPT ****


// These are running all the time
#0.0 Set S_Initial.RUN
#0.0 Set S_Camera.RUN
#0.0 Set S_PostProcess.RUN
#0.0 Set S_Noise.RUN
#0.0 Set P_OverlayAlpha 1.0
#0.0 Set S_Background.RUN

#0.0 Set S_Torque.RUN
#0.0 Set P_TorqueScale 2
#0.0 Set P_TorqueBlend true
#0.0 Set P_ShowImage 4
#0.0 Set P_ManualGlow true
#0.0 Set P_PostProcess 3
#0.0 Set P_DrawToBuffer true
#0.0 Set P_CameraScripted true
#0.0 Set P_CameraPosX 0.0
#0.0 Set P_CameraPosY 0.0
#0.0 Set P_CameraPosZ 0.1
#0.0 Set P_Fovy 170.0
#0.0 Fade P_Brightness from 0.0 to 1.0 in #4.0
#0.0 Fade P_BgColor from 1.0 to 0.5 in #8.0
#0.0 Set P_ShowBg V_NoImage

//Goto #8.0

#7.2 Fade P_GlowAmount from 0.0 to 5.0 in #0.2

#8.0 UsePattern 0
#8.0 Fade P_NoiseAlpha from 0.6 to 0.4 in #2.0
#8.0 Set P_BgColor 0.0
#8.0 Set P_PostProcess V_VideoTape

#8.0 Set S_Torque.RUN
#8.0 Set P_ShowImage 0
#8.0 Set P_ShowBg 3
#8.0 Fade P_BgImageColor from 0.0 to 1.0 in #2.0
#8.0 Fade P_BgScroll from 0.0 to 1.0 in #16.0
#8.0 Fade P_CameraPosX from 5 to 0 in #16.0
#8.0 Fade P_CameraPosZ from 5 to -1 in #16.0
#8.0 Fade P_CameraPosY from -3 to 0 in #16.0
#8.0 Fade P_Fovy from 90 to 170 in #16.0
#8.0 Set P_ManualGlow false

#10.0 Fade P_BgImageColor from 1.0 to 0.0 in #14.0

#16.1 Set S_LightThings.RUN

#24.0 Set P_ShowImage 1
#24.0 Set S_Torque.STOP
#24.0 Set S_Scene1.RUN
#24.0 Set P_CameraScripted false
#24.0 Fade P_NoiseAlpha from 1.0 to 0.4 in #1.0
#24.0 Fade P_Fovy from 150 to 10 in #16.0
#25.0 Fade P_NoiseAlpha from 0.4 to 0.7 in #15.0

//Goto #40.0

#40.0 Set P_ShowBg 0
#40.0 Fade P_BgScroll from 0.0 to 1.0 in #16.0
#40.0 Fade P_BgImageColor from 0.0 to 1.0 in #4.0
#40.0 Set P_ShowImage 2
#40.0 Set S_Scene1.STOP
#40.0 Set S_LightThings.STOP
#40.0 Set S_Torque.STOP
#40.0 Set S_CubeBalls.RUN
#40.0 Set P_CameraScripted true
#40.0 Set P_CameraPosY 0
#40.0 Set P_CameraPosZ 30
#40.0 Fade P_CameraPosX from -20 to 20 in #16.0
#40.0 Fade P_NoiseAlpha from 0.6 to 0.2 in #8.0
#40.0 Fade P_Fovy from 45 to 10 in #14.0
#40.0 UsePattern 5

#48.2 Set P_CubeBallsLighting true

#54.0 UsePattern 3
#54.0 Fade P_NoiseAlpha from 0.6 to 1.0 in #2.0
#54.0 Set P_Fovy 50.0

#55.2 Fade P_ScreenRun from 0.0 to 3.0 in #0.2

//Goto #56.0

#56.0 Set P_ShowBg V_NoImage
#56.0 Set P_ShowImage V_NoImage
#56.0 Set S_CubeBalls.STOP
#56.0 Set S_Scene2.STOP
#56.0 Set S_Scene3.RUN
#56.0 Set S_Torque.RUN
#56.0 Set P_TorqueBlend false
#56.0 Set S_Camera.STOP
#56.0 UsePattern 1
#56.0 Set P_PostProcess V_NoProcess
#56.0 Set P_DrawToBuffer false
#56.0 Set P_TorqueScale 1.1
#56.0 Fade P_NoiseAlpha from 1.0 to 0.2 in #1.0
#56.0 Set P_Fovy 90.0
#56.0 Fade P_BgColor from 0.6 to 0.0 in #14.0
#56.0 Fade P_Scene3SphereColor from 0.5 to 0.0 in #14.0
#56.0 Fade P_SpringGrowth from 0.0 to 1.0 in #16.0

#70.0 Fade P_Scene3SphereColor from 0.0 to 1.0 in #1.0
#70.0 Fade P_NoiseAlpha from 0.2 to 0.5 in #2.0
#71.0 Fade P_Scene3SphereColor from 1.0 to 0.0 in #1.0
#71.0 Set P_TorqueBlend true
#71.0 Fade P_TorqueScale from 3 to 10 in #1.0

#72.0 Set S_Scene3.STOP
#72.0 Set S_Scene2.RUN
#72.0 Set S_Camera.RUN
#72.0 Set P_TorqueScale 5
#72.0 Set P_CameraScripted true
#72.0 Set P_CameraPosX 0
#72.0 Fade P_CameraPosZ from 50 to -50 in #1.0
#72.0 Fade P_NoiseAlpha from 1.0 to 0.5 in #1.0
#72.0 Set P_Fovy 45.0
#72.0 Set P_BgColor 0.0

#73.0 Set P_CameraScripted false

#80.0 Set S_Scene3.RUN

#86.0 Set P_CameraScripted true
#86.0 Fade P_CameraPosZ from 12 to -18 in #2.0
#86.0 Set S_Scene3.STOP
#86.0 Fade P_Fovy from 170.0 to 90.0 in #2.0

//Goto #87.3.9

#88.0 Set S_Font.RUN
#88.0 Set S_Scene2.STOP
#88.0 Set S_Torque.RUN
#88.0 Set P_CameraPosZ 0.5
#88.0 Set P_CameraPosY 0.0
#88.0 Set P_ManualGlow true
#88.0 Fade P_GlowAmount from 2.0 to 0.6 in #1.0
#88.0 Set P_Fovy 150.0
#88.0 Trig P_CameraReset
#88.0 Fade P_CameraPosX from -1.0 to 1.0 in #4.0
#92.0 Fade P_CameraPosX from 1.0 to -1.0 in #4.0
#96.0 Fade P_CameraPosX from -1.0 to 1.0 in #4.0
#100.0 Fade P_CameraPosX from 1.0 to 0.0 in #4.0
#103.0 Fade P_GlowAmount from 0.5 to 5.0 in #1.0

//Goto #103.3.9

#104.0 Set P_ScreenRun 0.0
#104.0 Set P_ShowBg 1
#104.0 Fade P_BgScroll from 1.0 to 0.0 in #16.0
#104.0 Fade P_BgImageColor from 0.0 to 1.0 in #4.0
#104.0 Fade P_GlowAmount from 1.5 to 0.3 in #6.0
#104.0 Set S_Font.STOP
#104.0 Set S_Torque.STOP
#104.0 Set S_Radiosity.RUN
#104.0 Set P_PostProcess V_VertVideoTape
#104.0 Set P_DrawToBuffer true
#104.0 Set P_NoiseAlpha 0.4
#104.0 Fade P_CameraPosX from -5.0 to 5.0 in #8.0
#104.0 Fade P_CameraPosY from 0.5 to 1.5 in #8.0
#104.0 Set P_CameraPosZ 5.0
#104.0 Fade P_Fovy from 120.0 to 60.0 in #8.0

#112.0 Fade P_GlowAmount from 0.3 to 0.2 in #8.0
#112.0 Fade P_CameraPosX from 5.0 to -4.0 in #8.0
#112.0 Fade P_CameraPosY from 1.5 to 3.5 in #4.0
#112.0 Fade P_CameraPosZ from 5.0 to -3.0 in #8.0
#112.0 Fade P_Fovy from 60.0 to 90.0 in #4.0

//Goto #119.3.9

#120.0 Fade P_BgScroll from 0.0 to 0.66 in #16.0
#120.0 Fade P_BgImageColor from 0.0 to 1.0 in #8.0
#120.0 DisablePattern
#120.0 Set S_Font.RUN
#120.0 Set P_FontMode 1
#120.0 Trig P_FontReset
#120.0 Set P_CameraPosX 0
#120.0 Set P_CameraPosZ 1.5
#120.0 Set P_Fovy 100.0
#120.0 Fade P_BgColor from 1.0 to 0.0 in #1.0
#120.0 Fade P_GlowAmount from 2.0 to 0.5 in #1.0

#124.0 Fade P_RadioSpringGrowth from 0.0 to 1.0 in #12.0
#124.0 Set P_ShowSpring2 true
#124.0 Fade P_FontMove from 0.0 to 300.0 in #12.0


#120.0 Fade P_CameraPosY from 50.0 to 0.25 in #16.0
#135.0 Fade P_CameraPosX from 0.0 to 1.5 in #1.0
#135.0 Fade P_GlowAmount from 0.5 to 1.5 in #1.0

//Goto #136.0

#136.0 Set P_PostProcess V_VertVideoTape
#136.0 Set P_DrawToBuffer true
#136.0 UsePattern 4
#136.0 Set S_Camera.STOP
#136.0 Set S_Font.STOP
#136.0 Set S_Radiosity.STOP
#136.0 Set S_Scene4.RUN
#136.0 Set P_CameraScripted false
#136.0 Set P_BgColor 0.0
#136.0 Fade P_GlowAmount from 0.5 to 2.5 in #16.0
#136.0 Set P_Fovy 90
#136.0 Set P_ShowImage 8
#136.0 Fade P_OverlayAlpha from 1.0 to 0.0 in #2.0
#138.0 Fade P_OverlayAlpha from 0.0 to 0.5 in #4.0

#151.0 Fade P_OverlayAlpha from 0.5 to 1.0 in #1.0
#151.2 Fade P_ScreenRun from 0.0 to 3.0 in #0.2

//Goto #152.0

#152.0 Set P_ShowBg 2
#152.0 Fade P_BgScroll from 0.0 to 1.0 in #32.0
#152.0 Set P_ScreenRun 0.0
#152.0 Set P_Fovy 70
#152.0 UsePattern 1
#152.0 Set S_Scene4.STOP
#152.0 Set P_PostProcess V_VideoTape
#152.0 Set S_Tunnel.RUN
#152.0 Set P_CameraScripted false
#152.0 Fade P_NoiseAlpha from 1.0 to 0.1 in #1.0
#152.0 Fade P_GlowAmount from 1.0 to 0.33 in #8.0
#152.0 Set P_ShowImage 6

#153.0 Fade P_TorqueScale from 15.0 to 30.0 in #8.0
#154.0 Fade P_NoiseAlpha from 0.75 to 0.1 in #1.0
#156.0 Fade P_NoiseAlpha from 0.5 to 0.1 in #1.0
#158.0 Fade P_NoiseAlpha from 0.25 to 0.1 in #1.0

//Goto #160.0

#160.0 Set S_Tunnel.STOP
#160.0 UsePattern 1
#160.0 Set S_Camera.RUN
#160.0 Set P_ShowImage 7

#160.0 Set S_Torque.RUN
#160.0 Set P_ManualGlow false
#160.0 Set P_CameraScripted true
#160.0 Set P_CameraPosX 5
#160.0 Set P_CameraPosZ 5
#160.0 Set P_CameraPosY -3
#160.0 Fade P_Fovy from 170 to 90 in #1.0

#161.0 Set S_Torque.STOP
#161.0 Set S_Scene1.RUN
#161.0 Set S_LightThings.RUN
//#169.0 Set P_CameraScripted false
#161.0 Set P_CameraPosX 0.0
#161.0 Set P_CameraPosY 0.0
#161.0 Fade P_CameraPosZ from -30.0 to 0.0 in #1.0
#161.0 Fade P_Fovy from 20 to 170 in #1.0

#162.0 Set S_Scene1.STOP
#162.0 Set S_Torque.STOP
#162.0 Set S_CubeBalls.RUN
#162.0 Set P_CameraScripted true
#162.0 Set P_CameraPosY 0
#162.0 Set P_CameraPosZ 15
#162.0 Fade P_CameraPosX from -20 to 20 in #2.0
#162.0 Set P_Fovy 45
#162.0 Set P_CubeBallsLighting false
#162.0 Set P_ShowImage 0

#164.0 Set S_CubeBalls.STOP
#164.0 Set S_Scene2.STOP
#164.0 Set S_Scene3.RUN
#164.0 Trig P_Scene3Reset
#164.0 Set S_Torque.RUN
#164.0 Set P_TorqueBlend false
#164.0 Set S_Camera.STOP
#164.0 Set P_TorqueScale 1.1
#164.0 Fade P_NoiseAlpha from 1.0 to 0.2 in #1.0
#164.0 Set P_Fovy 90.0
#164.0 Fade P_BgColor from 0.6 to 0.0 in #14.0
#164.0 Set P_ShowImage 1

#166.0 Set S_LightThings.STOP
#166.0 Set S_Tunnel.STOP
#166.0 Set S_Scene3.STOP
#166.0 Set S_Scene2.RUN
#166.0 Set S_Camera.RUN
#166.0 Set P_TorqueScale 5
#166.0 Set P_CameraScripted true
#166.0 Set P_CameraPosX 0
#166.0 Fade P_CameraPosZ from 50 to -50 in #1.0
#166.0 Fade P_NoiseAlpha from 1.0 to 0.5 in #1.0
#166.0 Set P_Fovy 45.0
#166.0 Set P_BgColor 0.0
#166.0 Set P_ShowImage 2
#167.0 Fade P_CameraPosZ from -50 to -5 in #1.0

//Goto #168.0

#168.0 Set P_CameraScripted false
#168.0 Set P_ShowImage 7

#172.0 Set P_ShowImage V_NoImage
#172.0 Set S_Font.RUN
#172.0 Set P_FontMode 0
#172.0 Trig P_FontReset
#172.0 Set S_Scene2.STOP
#172.0 Set S_Torque.RUN
#172.0 Set P_TorqueScale 10
#172.0 Fade P_CameraPosZ from 0.8 to -0.8 in #4.0
#172.0 Set P_CameraPosY 0.0
#172.0 Set P_ManualGlow true
#172.0 Fade P_GlowAmount from 2.0 to 0.6 in #1.0
#172.0 Set P_Fovy 150.0
#172.0 Trig P_CameraReset
#172.0 Set P_CameraScripted true
#172.0 Fade P_CameraPosX from 5.0 to -1.0 in #2.0
#174.0 Fade P_CameraPosX from -1.0 to 0.0 in #2.0

#176.0 Set P_ShowImage 1
#176.0 Fade P_GlowAmount from 0.5 to 0.2 in #4.0
#176.0 Set S_Font.STOP
#176.0 Set S_Torque.STOP
#176.0 Set S_Radiosity.RUN
#176.0 Set P_PostProcess V_VertVideoTape
#176.0 Set P_DrawToBuffer true
#176.0 Set P_NoiseAlpha 0.4
#176.0 Fade P_CameraPosX from -5.0 to 5.0 in #2.0
#176.0 Set P_CameraPosZ 1.5
#176.0 Fade P_CameraPosY from 4.0 to 0.25 in #2.0
#176.0 Fade P_Fovy from 120.0 to 60.0 in #4.0
#178.0 Fade P_CameraPosX from -5.0 to 5.0 in #2.0
#178.0 Set P_CameraPosY 0.25

#180.0 Set P_ShowImage V_NoImage
#180.0 Set S_Radiosity.STOP
#180.0 Set S_Scene2.RUN
#180.0 Set P_CameraScripted false

//Goto #184.0

#184.0 Set S_LightThings.RUN
#184.0 Set P_ShowBg 1
#184.0 Fade P_BgScroll from 0.66 to 0.4 in #16.0
#184.0 Set P_PostProcess V_NoProcess
#184.0 Set P_DrawToBuffer false
#184.0 Set S_Scene2.STOP
#184.0 Set S_Torque.STOP
#184.0 Set P_ShowImage 5
#184.0 Set P_ManualGlow true
#184.0 Fade P_GlowAmount from 1.0 to 0.4 in #8.0
#184.0 DisablePattern
#184.0 Fade P_NoiseAlpha from 0.0 to 1.0 in #16.0
#184.0 Fade P_BgColor from 1.0 to 0.0 in #8.0
#198.0 Fade P_OverlayAlpha from 1.0 to 0.0 in #2.0
#200.0 Fade P_GlowAmount from 0.4 to 0.0 in #4.0
#200.0 Set P_BgImageColor 0.0

End #206.0
