###############################################################################
#
# intro.txt
# original intro scene for XR7: EarthStrike developed by Drake Analytics, Inc.
# www.xandis.com
#
# This is the data for the intro sequence of the game:
#	A simple background with a rotating earth in the distance.
#	Then a series of 4 spaceships fly by and then head towards
#	earth shooting at it. Massive explosions follow and the display
#	flashes until the title screen is shown along with some irritating
#	fast moving green and red particles. A textured sphere moves about 
#	the screen as as well.
#
#	At any time, the user may press a key to skip the brief intro sequence.
#
#  -----------------------------------------------------------------
#
#  This data file has more comments than usual because, as a simple data file,
#  it is a good place to investigate how level data files are built. More
#  extensive documentation comes with the support and source package. This though
#  should be enough for experimentation. Read through notes in the other data
#  files as well. 
#
#  ****
#  **** TO SAVE A LOT OF HAIR PULLING, ENSURE THAT LOGGING IS ON. EDIT THE
#  **** CONFIG.TXT FILE TO ENSURE LOGGING IS SET. WITH LOGGING YOU CAN VIEW
#  **** THE LOG.TXT FILE TO SEE IF THE REPORT REPORTED ANY ERRORS OR WARNINGS.
#  **** FURTHERMORE, USE THE XR7-DEBUG.EXE FOR MORE COMPREHENSIVE ERROR/WARNING
#  **** LOGGING.
#  ****
#
#  def/end blocks start with:
#		def type name
#  where name is up to you (and is case-sensitive) and type is from one of 
#  the pre-defined structure types used by the game.
#
# The parser of the game isn't particularly intelligent or meant to be anything
# special. So, put spaces around each "token" so that the system doesn't get
# confused. Equal signs (=) can usually be left out. Be careful with putting
# comments on the same line as a command or variable definition since it may
# get gobbled up into the command or variable. This is especially the case
# where commands take an array of flexible size.
#
# If the system crashes or just isn't responding as expected, review the log.txt
# file to see if any errors were reported during the parsing and compiling of 
# the level data. 
#
###############################################################################

def lighting MainAmbientLight
	color = 255 255 255 255		# R G B A 
end

#
# 'bounds' should be large enough such that those objects that die when they
# drift _out_of_bounds_ should be completely off the screen before they
# are removed from gameplay. But of course you don't want too large a number
# since that means keeping track of objects that are no longer useful. So,
# the minimum bounds that ensures nothing abruptly disappears from the screen
# is the goal.
#
def bounds MainBounds
	min = -10.0 -10.0 -10.0
	max = 10.0 10.0 100.0		# large Z bounds since earth object in distance
end

def projection NormalProjection
	nearplane	= 1.0
	farplane	= 100.0
	fov		= 0.7850
	aspect		= 1.0
end

def camera NormalCamera
	lookat	= 0.0 0.0 0.0		# where the camera is looking
	pos	= 0.0 0.0 -10.0		# where the camera is located
	up	= 0.0 1.0 0.0		# direction that is UP
end

################## RENDER STATES ######################
#
# Renderstates are the means by which one can have transparency 
# and other blending effects. 
#
# To indicate true, use 't' or 1
# To indicate false, use 'f' or 0
#
# If different items have the same render state requirements then
# make them all use the same render state structure to avoid
# needless checking to see if a particular state needs to change.
#
# The lighting value is not implemented.
#
def renderstate ShipModelRenderState
	id		= 4
	zenable		= t		# update the z-buffer or not
	specularenable	= f		
	fogenable	= f		# rendering with fog or not
	alphaenable	= f		# alpha blending or not
	lightenable	= t		# lighting or not (requires normals if on)
	fillmode	= WIRE		# SOLID | POINT | WIRE  
	shading		= GOURAUD	# GOURAUD | FLAT
	lighting	= 255 255 255	# R G B  (not used; should have an A too!)
#	alphasrc	= ZERO | ONE | SRCCOL | SRCALPHA | INVSRCCOL | INVSRCALPHA | DESTCOL | DESTALPHA
#			  INVDESTCOL | INVDESTALPHA | SRCALPHASAT
##	alphadest	= as above
	alphasrc	= SRCCOL
	alphadest	= DESTCOL
#	blendop		= ADD | SUBTRACT | REVSUBTRACT | MIN | MAX
	blendop		= ADD
	cull		= CCW		# CCW | CW | NONE
	clipping	= y
end

def renderstate ModelRenderState
	id		= 1
	zenable		= t		# update the z-buffer or not
	specularenable	= f		
	fogenable	= f		# rendering with fog or not
	alphaenable	= f		# alpha blending or not
	lightenable	= t		# lighting or not (requires normals if on)
	fillmode	= SOLID		# SOLID | POINT | WIRE  
	shading		= GOURAUD	# GOURAUD | FLAT
	lighting	= 255 255 255	# R G B  (not used; should have an A too!)
#	alphasrc	= ZERO | ONE | SRCCOL | SRCALPHA | INVSRCCOL | INVSRCALPHA | DESTCOL | DESTALPHA
#			  INVDESTCOL | INVDESTALPHA | SRCALPHASAT
##	alphadest	= as above
	alphasrc	= SRCCOL
	alphadest	= DESTCOL
#	blendop		= ADD | SUBTRACT | REVSUBTRACT | MIN | MAX
	blendop		= ADD
	cull		= CCW		# CCW | CW | NONE
	clipping	= y
end

def renderstate ParticleRenderState
	id		= 2
	zenable		= f
	specularenable	= f
	fogenable	= f
	alphaenable	= t
	lightenable	= f
	fillmode	= SOLID
	shading		= GOURAUD
	lighting	= 255 255 255
#	alphasrc	= ZERO | ONE | SRCCOL | SRCALPHA | INVSRCCOL | INVSRCALPHA | DESTCOL | DESTALPHA
#			  INVDESTCOL | INVDESTALPHA | SRCALPHASAT
##	alphadest	= as above
	alphasrc	= ONE
	alphadest	= ONE
#	blendop		= ADD | SUBTRACT | REVSUBTRACT | MIN | MAX
	blendop		= ADD
	cull		= NONE
	clipping	= y
end

def renderstate SpriteRenderState
	id		= 3
	zenable		= f
	specularenable	= f
	fogenable	= f
	alphaenable	= t
	lightenable	= f
	fillmode	= SOLID
	shading		= GOURAUD
	lighting	= 255 255 255
#	alphasrc	= ZERO | ONE | SRCCOL | SRCALPHA | INVSRCCOL | INVSRCALPHA | DESTCOL | DESTALPHA
#			  INVDESTCOL | INVDESTALPHA | SRCALPHASAT
##	alphadest	= as above
	alphasrc	= SRCALPHA
	alphadest	= DESTALPHA
#	blendop		= ADD | SUBTRACT | REVSUBTRACT | MIN | MAX
	blendop		= ADD
	cull		= NONE
	clipping	= y
end

################## .X MODELS #############################
#
# Models have to be .X files that the DirectX function 'D3DXLoadMeshFromX(...)' can handle.
# Note the path -- every path is in relation to where the application file is.
#
def model Earth
  source	= models\earth.X		
  renderstate	= ModelRenderState
end

def model AttackShip
	source		= models\3DCAFE-attack.X
	renderstate	= ShipModelRenderState
end

def model CircuitBallModel
	source		= models\circuitball-2.X
	renderstate	= ModelRenderState
end

def model Laser
	source		= models\intro-laser.X
	renderstate 	= ModelRenderState
end

############## WAVE FORMS AND MIDI MUSIC##################
#
# Just raw wave and music files.
#
def music IntroMusic
	source	= audio\music\ALEX-spain2se.mid
	repeats	= 1000
end

def wave Laugh
	source	= audio\waves\laugh1.wav
	repeats	= 4
end

def wave FlyBy
	source	= audio\waves\flyby.wav
	repeats	= 0
end

def wave BigExplosion
	source	= audio\waves\big-explosion.wav
	repeats = 0
end

def wave LaserSound
	source	= audio\waves\laser2.wav
	repeats = 4
end


################### PARTICLE SYSTEMS #####################
#
# The particle system used in the game is VERY SIMPLE and is a good candidate
# for young bucks to enhance. Right now, the system simply allows for the 
# desired number of particles to each last a particular number of frames (life)
# and have their color change (from startcolor) each frame by an amount that is
# somewhere between coloradjmin and coloradjmax. Likewise, each particle starts
# at a particular point (determined by the gaming envrionment) and moves, each
# frame, by anywhere between posadjmin and posadjmax. To speed things up, while
# also limiting variety, the adjustment values are pre-computed for each particle.
#
# To get a variety of effects use multiple particle systems. In this intro sequence
# more than one particle system is used to get the desired effect.
#
def particle ParticleExplosion
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 64
	life		= 128
	startcolor	= 1.0 0.2 0.0 1.0
	coloradjmin	= 0.00  0.00 0.0 -0.1
	coloradjmax	= 0.00  0.00 0.0  0.0
	repeat		= 0
	maxonscreen	= 24		# max of these systems on screen not max particles on screen
	size		= 32.0
	posadjmin	= -0.55 -0.55 -0.65
	posadjmax	=  0.55  0.55  0.65
end

def particle LargeParticleExplosion
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 64
	life		= 128
	startcolor	= 1.0 0.2 0.0 1.0
	coloradjmin	= -0.25 -0.25 0.0 -0.25
	coloradjmax	= 0.00	0.00  0.0   0.0
	repeat		= 0
	maxonscreen	= 24		# max of these systems not max particles
	size		= 48.0
	posadjmin	= -0.25 -0.25  0.25
	posadjmax	=  0.25  0.25  1.25
end

def particle GiganticParticleExplosion
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 128
	life		= 1024
	startcolor	=  1.0	   0.25	  0.0  1.0
	coloradjmin	= -0.002   -0.002 0.0  -0.01
	coloradjmax	= -0.001   -0.001 0.0  0.0
	repeat		= 0
	maxonscreen	= 12		# max of these systems not max particles
	size		= 64.0
	posadjmin	= -0.25 -0.25 -0.25
	posadjmax	=  0.25  0.25  0.55
end


def particle GreenSpreader
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 48
	life		= 48
	startcolor	=  0.10	   1.0   0.10	1.0
	coloradjmin	= -0.01  -0.01  -0.1	-0.1
	coloradjmax	= 0.00    0.00   0.0	0.0
	repeat		= y
	maxonscreen	= 4
	size		= 24.0
	posadjmin	= -0.4 -0.15  0.0
	posadjmax	= 0.4  -0.30  0.0
end

def particle RedSpreader
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 48
	life		= 128
	startcolor	=  1.0	  0.25  0.0  1.0
	coloradjmin	= -0.01  -0.01  0.0  -0.1
	coloradjmax	= 0.00    0.00  0.0  0.0
	repeat		= y
	maxonscreen	= 4
	size		= 24.0
	posadjmin	=  -0.1  0.05  0.0
	posadjmax	=   0.1  0.1   0.0
end

def particle LaserShot
	texture		= sprites\particle-intro.dds
	renderstate	= ParticleRenderState
	numparticles	= 8
	life		= 64
	startcolor	=  1.0	0.0  0.0  1.0
	coloradjmin	= 0.00  0.00 0.0 -0.1
	coloradjmax	= 0.00  0.00 0.0  0.0
	repeat		= 0
	maxonscreen	= 256		# max of these systems not max particles
	size		= 16.0
	posadjmin	=  0.2  -0.02  1.25
	posadjmax	=  0.4  -0.05  5.25
end

############### SPRITES ######################
#
# Sprites are nothing more than raw bitmaps. I keep them within
# 256x256 to ensure the broadest compatability with video cards 
# and always make sure they are square (NxN) and that N is a 
# power of 2 (i.e. 2, 4, 8, 16, 32, 64, 128, 256).
#
# Sprites may be transformed (such as most background images) or
# untransformed. In this intro, only transformed are used.
#
def sprite Stars1
	source		= sprites\stars-1.jpg
	transformed 	= y
	maxonscreen 	= 3		# per frame limit
	size		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Stars2
	source		= sprites\stars-2.jpg
	transformed 	= y
	maxonscreen 	= 3
	size		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Stars3
	source 		= sprites\stars-3.jpg
	transformed 	= y
	maxonscreen 	= 3
	size 		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Stars4
	source		= sprites\stars-4.jpg
	transformed 	= y
	maxonscreen 	= 3
	size		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Stars5
	source		= sprites\stars-5.jpg
	transformed 	= y
	maxonscreen 	= 3
	size		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Stars6
	source		= sprites\stars-6.jpg
	transformed 	= y
	maxonscreen 	= 3
	size		= 1.0
	renderstate	= SpriteRenderState
end

def sprite Title1
	source		= sprites\title-1.jpg
	transformed	= y
	maxonscreen	= 1
	renderstate	= SpriteRenderState
	size		= 1.0
end

def sprite Title2
	source		= sprites\title-2.jpg
	transformed	= y
	maxonscreen	= 1
	renderstate	= SpriteRenderState
	size		= 1.0
end

def sprite Title3
	source		= sprites\title-3.jpg
	transformed	= y
	maxonscreen	= 1
	renderstate	= SpriteRenderState
	size		= 1.0
end

def sprite Title4
	source		= sprites\title-4.jpg
	maxonscreen	= 1
	transformed	= y
	renderstate	= SpriteRenderState
	size		= 1.0
end

def sprite Title5
	source		= sprites\title-5.jpg
	transformed	= y
	maxonscreen	= 1
	renderstate	= SpriteRenderState
	size		= 1.0
end

def sprite Title6
	source		= sprites\title-6.jpg
	transformed	= y
	maxonscreen	= 1
	renderstate	= SpriteRenderState
	size		= 1.0
end

################# BACK IMAGES #################
#
# The back image is a series of sprites that are drawn _each_frame.
# In this case, the backimage is being used to draw sprites of stars in the
# background.
#
def backimage Stars
	numimages	= 14
	image1		= Stars6
	image2		= Stars5
	image3		= Stars4
	image4		= Stars3
	image5		= Stars2
	image6		= Stars1
	image7		= Stars1
	image8		= Stars1
	image9		= Stars4
	image10		= Stars3
	image11		= Stars2
	image12		= Stars5
	image13		= Stars4
	image14		= Stars3
	pos1		= 15.5		42.5	0.0
	pos2		= 271.5		42.5	0.0
	pos3		= 527.5		42.5	0.0
	pos4		= 15.5		298.5	0.0
	pos5		= 271.5		298.5	0.0
	pos6		= 527.5		298.5	0.0
	pos7		= 543.0		0.0	0.0
	pos8		= 543.0		256.0	0.0
	pos9		= 543.0		343.0	0.0
	pos10		= 0.0		343.0	0.0
	pos11		= 256.0		343.0	0.0
	pos12		= 512.0		343.0	0.0
	pos13		= 0.0		0.0	0.0
	pos14		= 256.0		0.0	0.0
end

def backimage TitleScreen
	numimages = 14
	image1	= Title1
	image2	= Title2
	image3	= Title3
	image4	= Title4
	image5	= Title5
	image6	= Title6
	image7	= Stars6
	image8	= Stars5
	image9	= Stars4
	image10	= Stars3
	image11	= Stars2
	image12	= Stars1
	image13	= Stars1
	image14	= Stars1
	pos1	= 15.5		42.5	0.0
	pos2	= 271.5		42.5	0.0
	pos3	= 527.5		42.5	0.0
	pos4	= 15.5		298.5	0.0
	pos5	= 271.5		298.5	0.0
	pos6	= 527.5		298.5	0.0
	pos7	= 543.0		0.0	0.0
	pos8	= 543.0		256.0	0.0
	pos9	= 543.0		343.0	0.0
	pos10	= 0.0		343.0	0.0
	pos11	= 256.0		343.0	0.0
	pos12	= 512.0		343.0	0.0
	pos13	= 0.0		0.0	0.0
	pos14	= 256.0		0.0	0.0
end

################### SCRIPTS ##################
#
# Scripts provide a series of position adjustments and shoot percentages
# that indicate how a scripted actor will behave.
#
# Scripts are ugly but not difficult to understand. Note, that the sequence
# ROT and SCALE parameters are not implemented and the sequence POS parameters are
# _offsets_. Sequences are just a series of commands...that can do do anything 
# including start new actors, start particle systems, etc. Sequences are the
# heart of the system.
#
# Repeats is how many times the script will repeat itself; for no repeating
# set the value to 0.
#
# Token 2 is the times to repeat the line. If you just want something to sit for
# a while spinning then use a large n. Note, time is in FRAMES. 
#
# Token 3 is a boolean (t|f) which indicates whether the next line should be
# also executed in the current frame. Rarely used and little tested this is for
# cases where you want the actor to shoot more than once during a single frame.
# 
# px,py,pz are position adjustments
# rx,rx,rz are rotation adjustments
# sx,sy,sz are scale adjustments
# s% is shoot percentage; token 14 is the # of the weapon to use
# seq% is percentage to start the sequence defined by token 16 (seq)
# spx,spy,spz are offsets to the current actor position to start the sequence
# srx..., ssx... are not implemented but the variables are there for coders to easily implement
#
def script AttackEarth
	repeats = 0
#	0	  1		2	3	4	5	6	7	8	9	10	11	12	13	14	15	16	17	18	19	20	21	22	23	24	25
# 	lineN	= action	n	b	px	py	pz	rx	ry	rz	sx	sy	sz	s%	n	seq%	seq	spx	spy	spz	srx	sry	srz	ssx	ssy	ssz
	line1	= init		0	f	12.0	0.0	10.0	0.0 	-1.2	1.2	1.0	1.0	1.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line2	= adj		24	f	-1.5	0.0	0.0	0.0  	0.0	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 	
	line3	= adj		0	f	0.0	0.0	0.0	0.0	-1.9	1.9	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line4	= adj		5	f	0.2	-0.02	1.0	0.0  	0.0	0.0	0.0	0.0	0.0	0.0	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line5	= adj		65	f	0.2	-0.02	1.0	0.0  	0.0	0.0	0.0	0.0	0.0	0.0	0	0.1	EnemyLaserShot 0.0 0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line6	= adj		0	f	0.0	0.0	0.0	0.7	 0.0	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line7	= adj		15	f	1.0	1.0	0.0	0.0	 0.0	0.0	0.0	0.0	0.0	0.0	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line8	= adj		40	f	-0.2	-0.6	-5.75	0.0	 0.0	0.0	0.0	0.0	0.0	0.0	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
end

def script BallMoveAround
	repeat = 1000
#	0	  1		2	3	4	5	6	7	8	9	10	11	12	13	14	15	16	17	18	19	20	21	22	23	24	25
# 	lineN	= action	n	b	px	py	pz	rx	ry	rz	sx	sy	sz	s%	n	seq%	seq	spx	spy	spz	srx	sry	srz	ssx	ssy	ssz
	line1	= init		0	f	0.0	0.0	100.0	0.0	0.0	0.0	2.0	2.0	2.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0
	line2	= adj		120	f	0.0	0.0	-1.0	0.0  	-0.2	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line3	= adj		20	f	0.0	0.0	1.0	0.0  	-0.1	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line4	= adj		30	f	-0.05	0.05	0.0	0.0  	-0.1	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line5	= adj		50	f	0.05	0.0	0.0	0.0  	-0.1	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line6	= adj		50	f	0.0	-0.05	0.0	0.0  	-0.1	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line7	= adj		50	f	-0.05	0.0	0.0	0.0  	-0.1	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
	line8	= adj		100	f	0.0	0.05	0.0	0.0  	-0.2	0.0	0.0	0.0	0.0	0.00	0	0.0	0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0	0.0 
end

################## ACTORS ####################
#
# Actors are the tangible agents within the game...sprites and particle systems
# are only effects and cannot be touched. Actors, in XR7 at least, have substance!
#
# An actor is defined by a single model and bunch of qualifiers.
#
# Note the '0' indicates a null reference.
#
def actor TheEarth
	model			= Earth
	numweapons		= 0		# number of weapons at start
	weaponcapacity		= 0		# total number of weapons actor can have
	deathseq		= 0		# sequence that is started when actor dies
	collisionseq		= 0		# sequence that is started when collision occurs w/o shield
	shieldcollisionseq	= 0		# sequence that is started when collision occurs with shieled
	shieldgoneseq		= 0		# sequence that is started when the shield first goes
	shieldcollisioneffect	= 0		# Effect to other actor when it collides with shield
	collisioneffect		= 0		# Effect to other actor when it collides with actor
	deathcollisioneffect	= 0		# Effect on other actor when it dies
	maxonscreen		= 1		# The max number of these particular actors that can be on the screen at ONCE
	type			= NEUTRAL	# NEUTRAL | NEUTRALFIRE | PLAYER | PLAYERFIRE | ENEMY | ENEMYFIRE
# collidewith			= NETURAL NEUTRALFIRE PLAYER PLAYERFIRE ENEMY ENEMYFIRE
	collidewith		= ENEMYFIRE		
	partnerseq		= 0		# (not implemented?)
	bounds			= 0		# Used for 'player' only
	drift			= 0.00 0.0 0.0	# Automatic position drift; often weaponfire is not scripted and just drifts
	rotation		= 0.0 0.1 0.0	# Automatic rotation
	script			= 0		# Script that the actor follows
	input			= DRIFT		# SCRIPT | DRIFT | USER | AI0 | AI1 | DRIFTDIE
	copy			= 0		# (not implemented?)
	bounding		= 0		# 0 for no bounding volumes; -1 for all; 1 for just main sphere
	shield			= 0		# Starting strength of shield
	energy			= 100000	# Starting Life; when zero you die
	maxshield		= 100		# Max strength of shield
	maxenergy		= 100		# Max energy
	rot			= 0.0 0.0 0.0	# Starting rotation 
	scale			= 3.0 3.0 3.0	# Starting scale    (starting vals can be superseded by script)
end

def actor EnemyLaser
	model			= Laser
	numweapons		= 0		# number of weapons at start
	weaponcapacity		= 0		# total number of weapons actor can have
	deathseq		= 0		# sequence that is started when actor dies
	collisionseq		= 0		# sequence that is started when collision occurs w/o shield
	shieldcollisionseq	= 0		# sequence that is started when collision occurs with shieled
	shieldgoneseq		= 0		# sequence that is started when the shield first goes
	shieldcollisioneffect	= 0		# Effect to other actor when it collides with shield
	collisioneffect		= 0		# Effect to other actor when it collides with actor
	maxonscreen		= 256		# The max number of these particular actors that can be on the screen at ONCE
	type			= ENEMYFIRE	# NEUTRAL | NEUTRALFIRE | PLAYER | PLAYERFIRE | ENEMY | ENEMYFIRE
# collidewith			= NETURAL NEUTRALFIRE PLAYER PLAYERFIRE ENEMY ENEMYFIRE
	collidewith		= NEUTRAL
	partnerseq		= 0		# (not implemented?)
	bounds			= 0		# Used for 'player' only
	drift			= 0.5 0.0 5.0	# Automatic position drift; often weaponfire is not scripted and just drifts
	rotation		= 0.0 0.0 0.0	# Automatic rotation
	script			= 0		# Script that the actor follows
	input			= DRIFT		# SCRIPT | DRIFT | USER
	copy			= 0		# (not implemented?)
	bounding		= 0		# 0 for no bounding volumes; -1 for all; 1 for just main sphere
	shield			= 0		# Starting strength of shield
	energy			= 100000	# Starting Life; when zero you die
	maxshield		= 100		# Max strength of shield
	maxenergy		= 100		# Max energy
	rot			= 0.0 0.0 0.0	# Starting rotation 
	scale			= 3.0 3.0 3.0	# Starting scale    (starting vals can be superseded by script)
end

def actor Attack1
	model			= AttackShip
	numweapons		= 0		# number of weapons at start
	weaponcapacity		= 0		# total number of weapons actor can have
	deathseq		= 0		# sequence that is started when actor dies
	collisionseq		= 0		# sequence that is started when collision occurs w/o shield
	shieldcollisionseq	= 0		# sequence that is started when collision occurs with shieled
	shieldgoneseq		= 0		# sequence that is started when the shield first goes
	shieldcollisioneffect	= 0		# Effect to other actor when it collides with shield
	collisioneffect		= 0		# Effect to other actor when it collides with actor
	maxonscreen		= 4		# The max number of this particular actor that can be on the screen at ONCE
	type			= ENEMY		# NEUTRAL | NEUTRALFIRE | PLAYER | PLAYERFIRE | ENEMY | ENEMYFIRE
# collidewith			= NETURAL NEUTRALFIRE PLAYER PLAYERFIRE ENEMY ENEMYFIRE
	collidewith		= 0		# No collisions needed in this introduction	
	partnerseq		= 0		# (not implemented?)
	bounds			= 0		# Used for 'player' only
	drift			= 0.00 0.0 0.0	# Automatic position drift; often weaponfire is not scripted and just drifts
	rotation		= 0.0 0.0 0.0	# Automatic rotation
	script			= AttackEarth	# Script that the actor follows
	input			= SCRIPT	# SCRIPT | DRIFT | USER
	copy			= 0		# (not implemented?)
	bounding		= 0		# 0 for no bounding volumes; -1 for all; 1 for just main sphere
	shield			= 0		# Starting strength of shield
	energy			= 100000	# Starting Life; when zero you die
	maxshield		= 100		# Max strength of shield
	maxenergy		= 100		# Max energy
	pos			= 0.0 0.0 10.0	# Initial position (not used; superseded by seq pos or script)
	rot			= 0.0 -1.2 1.2	# Starting rotation ("   "  "           "  ")
	scale			= 1.0 1.0 1.0	# Starting scale    ("   "  "           "  ")
end

def actor CircuitBall
	model			= CircuitBallModel
	numweapons		= 0		# number of weapons at start
	weaponcapacity		= 0		# total number of weapons actor can have
	deathseq		= 0		# sequence that is started when actor dies
	collisionseq		= 0		# sequence that is started when collision occurs w/o shield
	shieldcollisionseq	= 0		# sequence that is started when collision occurs with shieled
	shieldgoneseq		= 0		# sequence that is started when the shield first goes
	shieldcollisioneffect	= 0		# Effect to other actor when it collides with shield
	collisioneffect		= 0		# Effect to other actor when it collides with actor
	maxonscreen 		= 1		# The max number of this particular actor that can be on the screen at ONCE
	type			= NEUTRAL	# NEUTRAL | NEUTRALFIRE | PLAYER | PLAYERFIRE | ENEMY | ENEMYFIRE
	collidewith 		= 0		# No collisions needed in this introduction	
	partnerseq		= 0		# (not implemented?)
	bounds			= 0		# Used for 'player' only
	drift			= 0.00 0.0 0.0	# Automatic position drift; often weaponfire is not scripted and just drifts
	rotation		= 0.0 0.0 0.0	# Automatic rotation
	script			= BallMoveAround	# Script that the actor follows
	input			= SCRIPT	# SCRIPT | DRIFT | USER | DRIFTDIE 
	copy			= 0		# (not implemented?)
	bounding		= 0		# 0 for no bounding volumes; -1 for all; 1 for just main sphere
	shield			= 0		# Starting strength of shield
	energy			= 100000	# Starting Life; when zero you die
	maxshield		= 100		# Max strength of shield
	maxenergy		= 100		# Max energy
	pos			= 0.0 0.0 0.0	# Initial position (not used; superseded by seq pos or script)
	rot			= 0.0 0.0 0.0	# Starting rotation ("   "  "           "  ")
	scale			= 2.5 2.5 2.5	# Starting scale    ("   "  "           "  ")
end

################ SEQUENCES #################
#
# Sequences are subroutines that contain the commands that
# dictate actions like particle systems starting, actors starting,
# music and sounds being played, etc.
#
def sequence GiganticExplosion
	startparticlehere	= -8.0	-1.0	60.0	GiganticParticleExplosion
	startparticlehere	= -6.5	0.0	50.0	GiganticParticleExplosion
	startparticlehere	= -5.5	0.0	40.0	GiganticParticleExplosion
	startparticlehere	= -4.5	0.0	30.0	GiganticParticleExplosion
 	startparticlehere	= -3.5	0.0	20.0	GiganticParticleExplosion
	startparticlehere	= -2.5	0.0	10.0	GiganticParticleExplosion
	startparticlehere	= -1.5	0.0	 0.0	GiganticParticleExplosion
	startparticlehere	= -0.5	0.0	-5.0	GiganticParticleExplosion
	startparticlehere	=  0.0	0.0	-10.0	GiganticParticleExplosion
	playwave		= BigExplosion
end

def sequence LoudExplosion
	startparticle	= ParticleExplosion
	playwave	= BigExplosion
end

def sequence EnemyLaserShot
	playwave	= LaserSound
	startactor	= EnemyLaser
	startparticle	= LaserShot
end

def sequence DoExplosions
 	startsequencehere	= -8.0 -1.0 60.0 LoudExplosion
	waitframes		= 10
	startsequencehere	= -8.0 -0.0 60.0 LoudExplosion
	waitframes		= 12
	startparticlehere	= -8.5 -1.0 60.0 ParticleExplosion
	waitframes		= 6
	startparticlehere	= -7.5 1.0  60.0 ParticleExplosion
	waitframes		= 6
	startparticlehere	= -8.0 -1.0 60.0 ParticleExplosion
	waitframes		= 6
	startsequencehere	= -8.0 1.0  60.0 LoudExplosion
	waitframes		= 6
	startparticlehere	= -8.5 -1.0 60.0 ParticleExplosion
	waitframes		= 6
	startparticlehere	= -7.5 0.0  60.0 ParticleExplosion
	waitframes		= 6
	startsequencehere	= -8.0 -1.0 60.0 GiganticExplosion
end

def sequence DoFlashing
	playwave	= Laugh
	setbackcolor	= 255 255 0 
	waitframes	= 2
	setbackcolor	= 0 0 0 
	waitframes	= 2
	setbackcolor	= 255 255 0
	waitframes	= 2
	setbackcolor	= 0 0 0 
	waitframes	= 2
	setbackcolor	= 255 255 0
	stopactor	= TheEarth
	waitframes	= 2
	setbackcolor	= 0 0 0 
	setbackimage	= TitleScreen
	waitframes	= 32
	startparticlehere = -1.0  4.0 0.0 GreenSpreader
	startparticlehere =  0.0  4.0 0.0 GreenSpreader
	startparticlehere =  1.0  4.0 0.0 GreenSpreader
	startparticlehere = -1.0 -4.0 0.0 RedSpreader
	startparticlehere = 0.0 -4.0 0.0 RedSpreader
	startparticlehere = 1.0 -4.0 0.0 RedSpreader
	playmusic	= IntroMusic
	startactor	= CircuitBall
end

def sequence IntroSequence
	startactorhere	= -8.0 -1.0 60.0 TheEarth				
	waitframes	= 33
	playwave	= FlyBy
	waitframes	= 20
	startactor	= Attack1 
	waitframes	= 10
	startactor	= Attack1
	waitframes	= 10
	startactor	= Attack1
	waitframes	= 10
	startactor	= Attack1
	waitframes	= 50
	startsequence	= DoExplosions
	waitframes	= 50
	startsequence	= DoFlashing
end

################ SCENE #################
#
# Only the scene with the name 'main' (all lower case) is used by the game.
# This just makes life easier. Note though that if there are other scene
# definitions that's OK and they will be compiled...just not used!
#
# The scene is where things start and is the main routine for the level.
#
def scene main
	setcamera	= NormalCamera
	setprojection	= NormalProjection
	setambientlight = MainAmbientLight
	setbackcolor	= 0 0 0				# R G B
	setrenderstate	= ModelRenderState  # start off with any old render state
	setbounds	= MainBounds
	setbackimage	= Stars
	startsequence	= IntroSequence
	
	waituntilinput
#
# KILL OFF AND CLEAR EVERYTHING AND THEN SHOW THE LOADING MESSAGE
# (allow music, if any, to keep playing)
#
	setbackimage	= 0
	setbackcolor	= 0 0 0
	killactors	= Attack1 TheEarth CircuitBall
	killparticles	= LaserShot ParticleExplosion LargeParticleExplosion GiganticParticleExplosion
	killparticles	= RedSpreader GreenSpreader
	eos				
end

#
# The application knows what to do when it comes to the end of scene. Basically, the order
# is fixed: 
#				intro --> \________main menu________/
#						|	|	|
#						play  setup  high scores		
#						|
#						level1
#						|
#						level2
#						|
#						level3
#						|
#						level4
#						|
#						level5
#						|
#						lame finale
#						|
#						high scores
#
# To increase the number of levels before getting to the finale, edit the config.txt file.
# After the setup and high scores the scene reverts back to the main menu.
#
# After the finale, or death of a player, it is also possible that a scene is 
# displayed which permits entering in a name for the high scores log.
#
# To add additional scene links to the main menu requires minor modifications to the source code.
#

### End of Scene



