////////////////////////////////////////////////////////////////////////////
//
//	|>emo$ystem (Build: 02:25:43 Jan 21 2004)
//	by rawhed/faktory^moOjUiCE^pht (c) 2002-2004
//
////////////////////////////////////////////////////////////////////////////
//
//	wednesday 21-01-2004 (Build: 02:25:43 Jan 21 2004)
//
//	+ NEW FEATURES:
//
//		+	engine can now load .PNG!!
//			even 32bit ones with alpha channel
//			
//		+	upgraded to using BASS2.0 from 1.8a
//
//		+	sizing and positioning has been added to ALL
//			effects, so now you have have your effects
//			drawing to only regions of the screen instead
//			of the whole screen always
//
//		+	noisetexture effect
//			writes noise to a texture :)
//
//		+	added positioning example
//		+	added particlebox5 example
//		+	added texturenoise examples
//		
//		+	fixed bug in gif player, crashed on exit
//
////////////////////////////////////////////////////////////////////////////
//
//	monday 05-01-2004 (Build: 00:11:29 Jan  5 2004)
//
//	+	RANT
//
//		+	again another long gap in the updates :(
//		+	the engine was used for our demo for assembly03: 
//			'feed your machine', after that there wasn't much 
//			time/energy for updates.
//		+	rava continues to use it for VJing in moscow, latvia and
//			other places in europe.
//
//	+	API
//
//		+	improved plugin API..better design, more flexible
//		+	DRAMATICALLY reducted size of the main exe and ALL dlls
//			this was done through not using libc.lib but rather
//			using MSVCRT.DLL, MSVCPRT.DLL and also due to the 
//			better API design and use of pure virtual functions
//
//	+ NEW FEATURES:
//
//		+	improved keyboard input
//			now all the special characters like !"$@{}#' should work,
//			as well as holding down SHIFT and having CAPSLOCK on.
//
//		+	buttons
//			added clickable interactive buttons! this idea came
//			from Reverie/Faktory^moOjUiCE.  a demo called 'buttontest' is has
//			been added to the demo section to show it.  Its now possible
//			to create simple mouse-driven apps with demosys!
//
//			the buttons support actions for being clicked, going over,
//			and leaving the buttons.
//
//		+	screengrabber
//			create the effect, bind it to a key and u got a screengrabber =)
//			writes to 32bit .bmp
//
//		+	'wtf' effect
//			by uttumuttu/Faktory
//			a rather old effect now, but still cool!
//
//	+ BUG FIXES, MINOR CHANGES, ODDS & SODS
//		+	documentation updated, corrected and consolidated
//		+	new samples: 'snow_using_include', 'keybanks', 'screengrab'
//			'wtf'
//		+	elimatinated the <create/> tag..it was useless
//		+	all sorts of small optimisations and bugfixes to main engine
//			including a crash bug where if texture wasn't found it would
//			create a new texture but it called the function with the
//			wrong params(i can't understand why the compiler didn't complain)
//		+	XML parser optimised and bug fixed
//			now supports _ and numbers in tag names
//		+	can now add a keylog="0" to the demo param and it won't log the keys
//
////////////////////////////////////////////////////////////////////////////
//
//	friday 11-07-2003
//
//	+	improved xml parser(handles spaces better, faster)
//		can now do <hello/> instead of <hello></hello>
//	+	improved camera parameters, including looping ability
//		pingpong with easein+out.
//	+	added animated gif support :) including transparent gifs
//	+	using a newer version of BASS
//	+	added an AVI writer effect!
//	+	added new examples for the new fx
//
////////////////////////////////////////////////////////////////////////////
//
//	wednesday 04-06-2003
//
//	been AGES since updated this..ARGH ;p lots has happened though
//	here is a summary of what i can remember
//
//	+	added .md2 player effect
//	+	lockflash effect added (flashes your num/caps/scroll lock)
//	+	wavebox effected added
//	+	fogflash effect added
//	+	picture effect tiles now, useful for rotozoom
//	+	added 'camera' element, keyframing
//	+	added 'texture' element, textures can be reused etc..
//	+	now effects hold data about their variables which can
//		be retrieved.
//	+	more examples!
//	+	added gridmap effect
//	+	added skybox effect
//	+	improved vis for musicplay effect
//
////////////////////////////////////////////////////////////////////////////
//
//	wednesday 16-10-2002
//
//	+	added a doc about creating plugins
//	+	name="blah" actually changes the window title now(yay)
//	+	gave the exe an icon :)
//	+	added new effect skybox
//	+	started new "gridmap"
//	+	started a webcam plugin
//	+	added new effects to videoplayer and made it faster and
//		more compatible.
//	+	added examples for videoplay, skycube, particlebox, clear,
//		flash and others
//
//////////////////////////////////////////////////////////////////////////////
//
//	friday 04-10-2002
//
//	+	added videoplayer effect
//	+	put keylogging back in
//	+	added more examples
//
////////////////////////////////////////////////////////////////////////////
//
//	sunday 08-09-2002
//
//	+	removed all effects from main code, making things more modula.
//		It now uses DLL plugins via the new command <loadplugin>!
//		This allows coders to add effects more easily.  Had to 
//		change the directory structure and split libraries, but its
//		much better now.
//
//	+	Made more script examples to help people learn
//
//	+	Made some code example for easily writing new plugins
//
//	+	It used to be that if you didn't specify a texture for an
//		effect it would use white.  Now it uses the last textureset.
//		This allows a texture from effect1 to be used for effect2.
//		You can make some nice effects using this.
//
//
//
////////////////////////////////////////////////////////////////////////////
//
//	monday 26-08-2002
//
//	+	added vhs into the demo tag...setting this to 1 will let you FF 
//		and REW the demo
//
//	+	effect dogtail, has parameters: num and filename
//
//	+	added quicksort back in, so loading is faster
//
//	+	ALL effects now have these values:
//		
//			<fx speed="1.0" active="1"></fx>
//
//		speed will make it go faster/slower ;) and active will just turn 
//		the effect on or off, even if its in the draworder list.
//
//	+	fixed some small bugs
//
//	+	ALL effects now have tweakable opengl values.  But the effect
//		itself can override the ones you set.  Here is how it looks:
//
//		<myeffect>
//			<gl restore="0">
//				<render active="0" flat="1" wire="0" envmap="0" linewidth="1"
//						 color="1,1,1,1"></render>
//				<depth active="0" test="1" write="1"></ztest>
//				<cull active="0" cull="1" mode="0"></cull>
//				<alpha active="0" blend="0" blendsrc="1" blenddst="1"
//						mask="0" maskvalue="0.5"></alpha>
//				<proj active="0" fov="45" near="0.1" far="400"></proj>
//				<fog active="0" fog="0" mode="1" density="0.5"
//						zstart="0.0" zend="1.0" color="0xffff0000"></fog>
//			</gl>
//		</myeffect>
//
//	+	commenting is in there, use <! and --> for comments..however
//		there might be a bug..
//
//	+	<include file="script5.txt"></include> can be used to include
//		extra script files, so you can seperate them if you want.
//
////////////////////////////////////////////////////////////////////////////
//
//	saturday 04-08-2002
//
//	+	made demo LICK_THE_EVERYTHING using demo engine
//
////////////////////////////////////////////////////////////////////////////
//
//	thursday 25-07-2002
//
//	+	added new version of UT's LTREE effect.  Leaves fall off of
//		the tree - very nice :)
//
//	+	when scripting music filenames you no loader need to specify the path
//
//	+	better error handling..much less likely to crash if u don't have the
//		data files.
//
//	+	XML parser tried to report bugs in the script
//
//	+	optimised.  sync is much more accurate.
//
//	+	added sample="1" or "0" to musicplay effect (.wav files only)
//		this will mean you can play the .wav file again and again and it
//		will generate new channels to play it on.
//		So if you bind a musicplay effect to a key that has sample="1"
//		when you press the key before the sample has finished playing it
//		will play it again...up to 16 channels per musisplay effect.
//
//	+	added active="1" or "0" to fontcool text.  So you can specify all
//		your lines of text but switch which are visible
//
//	+	particlebox has new parameters:
//
//			spawndim="10,10,10"	dimension particles can spawn in
//			dirmin="-1,0,0"	particle XYZ movement direction minrange
//			dirmax="1,0,1"	particle XYZ movement direction maxrange
//			lifespan="100"	average particle lifespan
//
////////////////////////////////////////////////////////////////////////////
//
//	wednesday 18-07-2002
//
//
//	+	echo,flange,rotate,flangespeed added to musicplay effect
//
//
//	+	loopframe parameter added to 3dscene.  This is the frame at which 
//		the animation will reset back to zero.  If you don't want the
//		animation to loop you should use 10000 or something super high :)
//
////////////////////////////////////////////////////////////////////////////
//
//	sunday 14-07-2002
//
//
//	+	can pass parameter of the script you want to load
//		eg:
//			demo script2.txt
//
//	+	new effect: fontcool
//
//		fontcool
//			parameters:
//				basefont="arial"	(most windows TTF's)
//				extrude="0.1"		(Z amount to extrude, 0 = flat)
//				italics="0"	
//				quality="0.1"	(0 best,slowest -> 1 worst,fastest)
//			commands:
//				<text
//					num="0"			(which text line this is)
//					string="hello"
//					tra="0,0,0"		(translation)
//					rot="0,0,0"		(rotation)
//					sca="1,1,1"		(scale)
//					trav="0,0,0"	(translation increment)
//					rotv="0,0,0"	(rotation increment)
//					scav="0,0,0"	(scale increment)
//					color="0xffffffff">
//
//	+	new effect: particlebox
//
//		particlebox
//			paramaters:
//				texture="blah.tga"
//				number="500"		(number of particleS)
//				speed="1"		
//				dim="50,50,50"	(dimensions of box)
//				tra="0,0,0"		(translation)
//				rot="0,0,0"		(rotation)
//				sca="1,1,1"		(scale)
//				trainc="0,0,0"	(ammount to increase translation by each frame)
//				rotinc="0,0,0"	(ammount to increase rotation by each frame)
//				scainc="0,0,0"	(cmmount to increase scale by each frame)
//				pdir="0,0,0"	(direction particles move in)
//				prot="0,0,0"	(rotation of particles)
//			command:
//				random			(randomise particles)
//				origin			(bring all the origin)
//
//	+	3dscene effect: added camera parameter to swap current camera
//
//	+	picture effect changed the translatin, rotation, scale
//		to use this smaller format:
//			tra="0,0,0"
//			rot="0,0,0" (degrees)
//			sca="1,1,1"
//
//	+	started work on new effect dogtail
//	+	bugs fixed
//
////////////////////////////////////////////////////////////////////////////
//
//	monday 08-07-2002
//
//
//	+	musicplay now also supports these:
//			filename="*.mtm,*.mo3,*.mp3,*.mp2,*.ogg,*.wav"
//	+	added trailval="1.0" to clear effect
//		this will not clear the screen but just darken it.
//		very useful for blurry additive effects and motion trails
//
////////////////////////////////////////////////////////////////////////////
//
//	friday 05-07-2002
//
//	+	new effects from UT:
//
//		starspace
//			parameters:
//			commands:
//		teddy
//			parameters:
//			commands:
//		ltree
//			parameters:
//			commands:
//
//	+	attack, sustain, decay added to flash(teels idea)
//	+	additive,subtracted, negative flash modes 
//
//	+	picture effect R<->B bug fixed.
//	+	picture effect supports arbitary sized .tga now
//		but they must be bigger then 8 and must an even number
//		so 640x480 will work..it will divide the images up into 
//		segments of 256x256 or smaller.
//
//	+	engine speed has improved so the synchronisation will be more accurate
//
//	+	new effect: 3dscene
//
//		3dscene (no camera control..YET)
//		paramaters:
//			file="blah.zen"
//			speed="0.4"
//			timeoffset="0.0"
//			frame="0.0"
//			visible="1"
//		commands:
//			go
//
//		still very basic..needs camera control added.
//
////////////////////////////////////////////////////////////////////////////



//
//	+	ramble
//	+	tutorial
//	+	todo list
//	+	change log
//
////////////////////////////////////////////////////////////////////////////
//
//	+	TODO LONGTERM
//		+	GUI
//
//	+	TODO SHORTTERM
//
//		+	get mayaplay fx working properly again
//		+	consolidate documentation
//		+	flash(.SWF) player
//			still lacking some features, so it will get improved over
//			time.  Most notibly it lacks filled polygons, audio and 
//			bitmaps.
//
