#!/usr/bin/perl
#	 License: GPLv2
#	--MikeeUSA--
$reverse_fan_roll_speed_asthetics_obj_from_mc = 1; #Reverse roll speed for fans as exported models are inverse 
$CONVERT_SOME_NOISES_TO_SIMPLER_STRING = 1;
$REVERSE_Z_ANGLE_ON_SOME_MODELS = 1; #added at time of g arena
$REVERSE_X_ANGLE_ON_SOME_MODELS = 1; #added at time of avitar arena
#
$STEELBOXBARRELNOSUBSTITUTION = 1; #Don't substitute steel box with construct or the steel barrel with one
$TARYDIUMBARRELNOSUBSTITUTION = 0; #unknown as of now
$SEAWEEDNOSUBSTITUTION = 1;	#use the regular model, not substitution
#
$SETSOLIDPHYSICSTRIMESHIFDSCALEONSOMEMODELS = 1; 
#
$output = STDOUT; #Set to standard output, keep this as this, this is for when switching from standard output to internal file so some things can be printed at the end instead of as found
#
$mode = 0; #1= lights
$DEBUGPRINTS = 0;
$TESTLIGHTPRINTS = 0;
$TESTUNKNOWNPRINTS = 1;
$IGNOREPATHNODES = 1;
$IGNORELEVELINFO = 1;
$IGNOREZONEINFO = 1; #note: doesn't ignore hurt/heal zones if DOZONEINFOHURT is set
$PRINTORIGINALSOUNDINFOASCOMMENTIFCONVERTED = 1;
$PRINTORIGINALROTATIONINFOASCOMMENTIFCONVERTED = 1;
$PRINTMINSMAXSASCOMMENTIFFOUND_FORMOVER = 1;
$PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER = 1;
$PRINTREVERSEZMODELINFOASCOMMENTIFREVERSED = 1;
$COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS = 1;
$NEWLINEBETWEENSECTIONS = 2;
$comment_oldclassname_for_all = 1;
$ENABLE_ADD_Z_TOPLAYERSTART = 1;
#
#Some ammos
$PAMMOUSESREGULAR = 0; #1 means use cells instead of custom
$SHOCKCOREUSESREGULAR = 0; #1 means use cells instead of custom
$PICKUP_UT_SniperRifle_OPTIONS = 1; #0 use lrr, 1 use t17mm
#
$add_z_toplayerstart = 64; #helps keep out of solid
$PRINTINFOREGARDINGADDINGZTOPLAYERSTART = 1; #print the info regarding adding Z to player start, ie print the original as a comment
$PRINTORIGINALHUESATURATIONBRIGHTNESSINFOASCOMMENTIFCONVERTED = 1;
$rtlight_radius_scale = 10; #for some 10 seems good, for other maps 5...
$rtlight_allow_corona = 0; #allow coronas?
$rtlight_independent_corona_scale = 0; #set to independent scale from lightscale?
$SET_UNSET_CORONA_COLOR = 0;
$SET_UNSET_CORONA_COLOR_R = 0;
$SET_UNSET_CORONA_COLOR_G = 0;
$SET_UNSET_CORONA_COLOR_B = 0;
$SET_UNSET_CORONA_COLOR_BY_TEXTURE = 0;
$SET_UNSET_LIGHT_COLOR = 1;
$SET_UNSET_LIGHT_RADIUS = 1;
$comment_mover_information = 1;
$ALLOW_DESTRUCTABLES_MOVERS = 0; #evaluate destructable like glass, difficult as they are just movers that move in 0 seconds and point to a trigger event
$OMIT_NEWER_MOVERS = 0; #omit the newer movers after the destructables?
$OMIT_NEWER_MOVERS2 = 0; #omit the even newer movers after ElevatorE?
$OMITNAMELINECONTAININGACTIVELINE_FIX = 1; #ignore lines like '     Name="AmbientSound2"'
$DOWATERLAVASLIMEZONES = 1;
$WATERLAVASLIMEZONESAREPRINTEDATEND = 1; #Also prints ZoneInfo Hurt at end if applicable
$DOZONEINFOHURT = 1;
$REQUIREHUGEMOVEMENT_FOR_DESTRUCTABLES_MOVERS = 1;
#
#
$Set_Default_HSV_and_Radius_At_Begining_Instead = 1;
#
#
$ignore_unset_lights = 0;
#
#
$use_curve = 1;
#
$PRINTCOMMANDARGUMENTSFORRTLIGHTS = 1; #end of file
$PRINTDEBUGINFOASCOMMENTFORRTLIGHTS = 0; #for each one
#$originalerrorsethuetosaturation = 0; #original error was to set hue to saturation and was used for tundra rtlight originall
#
$ORIGINFORUNKNOWNSIFTESTUNKNOWNPRINTS = 1; #can be 1 or 2
#
$STRICTFILECONTROL = 1;

sub newlinebetweensections {
		if ($comment_oldclassname_for_all) {
			if ($originalclassname) {
				print $output ('//'); print $output ('#'); print $output ("$originalclassname"); print $output ("\n");
			}
		}
		if ($NEWLINEBETWEENSECTIONS) {
			if ($NEWLINEBETWEENSECTIONS > 10) {
				print $output ("\n");
			} else {
				print $output ("\n" x $NEWLINEBETWEENSECTIONS);
			}
		}
}
#It happens that when one exports an obj file as a static mesh
#and decides to use it as an obj_from_mc with basescale1 (ie no scaling)
#this all works out if you have made sure you centred your brush on 0,0,0
#wouldn't think it would because in darkplaces quake1 engine the obj seems to be flipped left to right or something
#but I guess this just worked out it seemed
#it did when I did it by hand
#
#so when you want to export a map to obj in unreal editor 2.1 for old unreal
#what you do is you make a box brush, then center it on 0,0,0 as it's location
#then make it bigger than your level
#then press the intersect button
#it's a box from the bottom going into another box, cyan on top but in bottom corner atop a dark blue one
#    ////////////
#    ..        //
#/////////// B //
#//       // L //
#//       // U //
#// cyan  // E //
#//       //...//
#//       //
#///////////
#then you will have a red outline of the whole map
#save your .unr map to intersectedbrushmap.unr or so
#then open it up again
#now "wrong click" (right click) on the red brush, like a line of it
#then in unreal ed 2.1 you will have a menu pop up
#it will have an option to convert the brush to static mesh
#somewhere in there
#do that, then export it to obj
#then rename the obj somemap.basescale1.obj_from_mc
#now, go back to your original .unr map
#export that as a t3d from the file menu
#that's what this reads
# later alongside the somemap.basescale1.obj_from_mc
# you can have a      somemap.basescale1.ent
# the engine will load that
#
$dostuff = 0;
$endnow = 0;
$classname = "";
$islocationline = 0;
$isrotationline = 0;
$isrotationrateline = 0;
$isambientsoundline = 0;
$islight_hueline = 0;
$islight_saturationline = 0;
$islight_brightnessline = 0;
$islightradiusline = 0;
$isbaseposline_formover = 0; #Seems to be same as location
$iskeyrotline_formover = 0;  #where to rotate
$iskeyposline_formover = 0; 
$iskeypos2line_formover = 0; 
$issavedposline_formover = 0; #is by default: (X=-12345.000000,Y=-12345.000000,Z=-12345.000000)
$issavedrotline_formover = 0;  #is by default: (Pitch=123,Yaw=456,Roll=789)
$isencroachdamageline_formover = 0; 
$isdrawscaleline = 0;
$isencroachtypeline_formover = 0; 
$istagline_formover = 0; 
$isbumpeventline_formover = 0;
$isopeningsoundline_formover = 0;
$isclosingsoundline_formover = 0;
$isclosingingsoundline_formover = 0;
$ismoveambientsoundline_formover = 0;
$isbumptypeline_formover = 0; 
$ismovetimeline_formover = 0; 
$isvertexline_a_formover = 0; #one of many
$isinitialstateline_formover = 0; 
$ismoverglidetypeline_formover = 0; 
$iseventline_formover = 0;  
$isbdamagetriggeredline_formover = 0; 
$isdamagethresholdline_formover = 0;
$isstayopentimeline_formover = 0; 
$isbpainzoneline = 0;
$is_Skin_line = 0; #forcorona
$isdamagepersecondline = 0;
$isanimsequenceline = 0;
$isurlline = 0;
#
$moverkey_rotation_pitch = 0;
$moverkey_rotation_yaw = 0;
$moverkey_rotation_roll = 0; #set on door trap rotating down (Roll=16384)
$moverkey_pos_origin_x = 0; #dejavu (key_pos)
$moverkey_pos_origin_y = 0; 
$moverkey_pos_origin_z = 0; 
$moverkey_pos2_origin_x = 0;
$moverkey_pos2_origin_y = 0; 
$moverkey_pos2_origin_z = 0; 
$mover_basepos_origin_x = 0; #Seems to be same as location
$mover_basepos_origin_y = 0;
$mover_basepos_origin_z = 0;
$saved_moverkey_rotation_pitch = 0;   #is by default: (Pitch=123,Yaw=456,Roll=789)
$saved_moverkey_rotation_yaw = 0; 
$saved_moverkey_rotation_roll = 0; 
$saved_mover_basepos_origin_x = 0; #is by default: (X=-12345.000000,Y=-12345.000000,Z=-12345.000000)
$saved_mover_basepos_origin_y = 0;
$saved_mover_basepos_origin_z = 0;
$mover_encroachdamage = 0;
$drawscale = 0;
$pre_drawscale = 0; #for models, set to something if the default scale isnt 1
$mover_encroachtype = 0; #1 crush
$mover_tag = '';
$mover_bumpevent = '';
$mover_event = '';
$animsequence = '';
$url = '';
$force_angles_rather_than_angle = 0; #for mover
$no_angle_conversion_allready_done = 0; #for mover
$targetname = '';
$target = '';
$mover_bumptype = 0; #1 = Any
$mover_movetime = 0;
$mover_movetimewasset = 0; #used to denote the line was set to something in the file, even if 0
$mover_moverglidetype = 0;
$mover_bdamagetriggered = 0;
$mover_damagethreshold = 0;
$mover_stayopentime = 0;
$bpainzone_true_or_false = 0;
$bcorona_true_or_false = 0;
$lineset_capital_Skin = ''; #for corona
$damagepersecond = 0;
$mover_stayopentimewasset = 0; #used to denote the line was set to something in the file, even if 0 #added because pattern
$speed = 0;
$formover_maximum_seen_vertex_x = 0;
$formover_maximum_seen_vertex_y = 0;
$formover_maximum_seen_vertex_z = 0;
$formover_littlest_seen_vertex_x = 0;
$formover_littlest_seen_vertex_y = 0;
$formover_littlest_seen_vertex_z = 0;
#
$origin_x = 0;
$origin_y = 0;
$origin_z = 0;
$rotation_pitch = 0; #X looking up down (.angles_x)  (up-down)
$rotation_yaw = 0;  #Y yaw, what way looking side to side (.angles_y), also alone can be .angle (side-side, regular rotation, like a pole rotating)
$rotation_roll = 0; #Z roll, like a barrel (.angles_z)  (like a plane spinning while going forward via changing the flaps on it's wings)
$rotationrate_pitch = 0;
$rotationrate_yaw = 0;
$rotationrate_roll = 0;
$noise = '';
$originalnoisecomment = '';
$model = '';
$count = '';
$originalclassname = '';
$ignoreingalllinesinbrush = 0;
$hue = 0;
$saturation = 0;
$brightness = 0;
$light_radius = 0;
$color_r = 0;
$color_g = 0;
$color_b = 0;
$spawnflags = 0;
$cubemap = '';
$corona = 0;
$coronasize = 0; # 0.25; #default 0.25 but corona is off by default
$ambient = 0;
$diffuse = 1; #default 1
$specular= 1; #default 1
$specialextrastuffname = '';
$specialextrastuffamnt = '';
$specialextrastuffname0 = '';
$specialextrastuffamnt0 = '';
$specialextrastuffname1 = '';
$specialextrastuffamnt1 = '';
$specialextrastuffname2 = '';
$specialextrastuffamnt2 = '';
$specialextrastuffname3 = '';
$specialextrastuffamnt3 = '';
$specialextrastuffname4 = '';
$specialextrastuffamnt4 = '';
$specialextrastuffname5 = '';
$specialextrastuffamnt5 = '';
$specialextrasetscalefromdrawscaleamnt = 0;
$no_color_set_by_map = 1; #for SET_UNSET_LIGHT_COLOR = 1; and ignore
$no_radius_set_by_map = 1; #for SET_UNSET_LIGHT_RADIUS = 1;; and ignore
$is_light_entity = 0; #so we may ignore if need be
$is_mover = 0; #so we may ignore if need be
$is_allowed_even_if_not_mover = 0; #so we may allow if need be some tags
$is_fan = 0; #so we may ignore if need be
$is_rotating_mover = 0;
$is_zoneinfo_maybehurt = 0;
$is_model_maybereversez = 0;
$setsolidkeepdefaultevenifdscale = 0;
$moveambientnoise_formover = '';
$openingnoise_formover = '';
$closingnoise_formover = '';
$closingingnoise_formover = '';
$originalnoisecomment_m = '';
$originalnoisecomment_o = '';
$originalnoisecomment_c = '';
$originalnoisecomment_cc = '';
$infooriginal_mover_rotation_pitch = 0; #Just for info
$infooriginal_mover_rotation_yaw = 0; #Just for info
$infooriginal_mover_rotation_roll = 0; #Just for info
$name = '';
$did_mover_name_allready = 0;
$mover_initialstate = 0;
$omitangles_allready_set_angle = 0; #for movers
$recorded_actual_from_file__brightness = 0;  #for corona
$recorded_actual_from_file__hue = 0; 	   #for corona
$recorded_actual_from_file__saturation = 0; #for corona
$recorded_actual_from_file__light_radius = 0; #for corona

$default_mover_speed = 300;

$fallbackdatafile = "data2.t3d";
$datafile = '';
$rtlights_add_an_exclaimation_point = 0;
$hsvalgo = 0;
$hsvalgousedstring = '';
$printmode_testhsv_sa_br_hue = 0;

#Accept as input a value for what file to parse
	if (@ARGV[0]) {
		$datafile = @ARGV[0]; #normal
		
		if (@ARGV[0]  eq '--testhsv' || @ARGV[0]  eq '--test_hsv_to_rgb' || @ARGV[0]  eq '--sa_br_hue' ) {
			if (@ARGV[1] eq '--algo' && @ARGV[2]) {
				$hsvalgo = @ARGV[2];
			} elsif (@ARGV[0] eq '--sa_br_hue'  && @ARGV[3]) {
				$saturation	= @ARGV[1];;
				$brightness	= @ARGV[2];
				$hue 		= @ARGV[3];
				$printmode_testhsv_sa_br_hue = 1;
			}
			test_hsv_to_rgb();
			exit; # allready has an exit
		} elsif (@ARGV[0]  eq '-l') {
			$mode = 1; #lights
			if (@ARGV[1]) {
				$datafile = @ARGV[1];
			} else {
				$datafile = $fallbackdatafile;
			}
		} elsif ((@ARGV[0]  eq '-rt')
			|| (@ARGV[0]  eq '-rt1') 
			|| (@ARGV[0]  eq '-rt2')
			|| (@ARGV[0]  eq '-rt3')
			|| (@ARGV[0]  eq '-rt4')
			|| (@ARGV[0]  eq '-rt5')
			|| (@ARGV[0]  eq '-rt7')
			|| (@ARGV[0]  eq '-rt8')
			|| (@ARGV[0]  eq '-rt9')
			|| (@ARGV[0]  eq '-rt10')
			|| (@ARGV[0]  eq '-rt15')
			|| (@ARGV[0]  eq '-rt20')
			|| (@ARGV[0]  eq '-rt25')
			|| (@ARGV[0]  eq '-rt30')
			|| (@ARGV[0]  eq '-rt35')
			|| (@ARGV[0]  eq '-rt40')
			|| (@ARGV[0]  eq '-rt45')
			|| (@ARGV[0]  eq '-rt50')
			|| (@ARGV[0]  eq '-rt55')
			|| (@ARGV[0]  eq '-rt60')
			|| (@ARGV[0]  eq '-rt65')
			|| (@ARGV[0]  eq '-rt70')
			|| (@ARGV[0]  eq '-rt75')
			|| (@ARGV[0]  eq '-rt80')
			|| (@ARGV[0]  eq '-rt85')
			|| (@ARGV[0]  eq '-rt90')
			|| (@ARGV[0]  eq '-rt95')
			|| (@ARGV[0]  eq '-rt100')
			|| (@ARGV[0]  eq '-rt200')
			|| (@ARGV[0]  eq '-rt300'))
		{
			#Yes this could be done a cleverer way, 10 is good for most maps, 
			#but some maps are too much for using realtime light
			#When using curves (default now) 30 is better
			
			$mode = 2; #rtlights
			if (@ARGV[0]  eq '-rt') {
				#default scale is 10
			} elsif (@ARGV[0]  eq '-rt9') {
				$rtlight_radius_scale = 9;
			} elsif (@ARGV[0]  eq '-rt8') {
				$rtlight_radius_scale = 8;
			} elsif (@ARGV[0]  eq '-rt7') {
				$rtlight_radius_scale = 7;
			} elsif (@ARGV[0]  eq '-rt5') {
				$rtlight_radius_scale = 5;
			} elsif (@ARGV[0]  eq '-rt4') {
				$rtlight_radius_scale = 4;
			} elsif (@ARGV[0]  eq '-rt3') {
				$rtlight_radius_scale = 3;
			} elsif (@ARGV[0]  eq '-rt2') {
				$rtlight_radius_scale = 2;
			} elsif (@ARGV[0]  eq '-rt1') {
				$rtlight_radius_scale = 1;
			} elsif (@ARGV[0]  eq '-rt10') {
				$rtlight_radius_scale = 10;
			} elsif (@ARGV[0]  eq '-rt15') {
				$rtlight_radius_scale = 15;
			} elsif (@ARGV[0]  eq '-rt20') {
				$rtlight_radius_scale = 20;
			} elsif (@ARGV[0]  eq '-rt25') {
				$rtlight_radius_scale = 25;
			} elsif (@ARGV[0]  eq '-rt30') {
				$rtlight_radius_scale = 30;
			} elsif (@ARGV[0]  eq '-rt35') {
				$rtlight_radius_scale = 35;
			} elsif (@ARGV[0]  eq '-rt40') {
				$rtlight_radius_scale = 40;
			} elsif (@ARGV[0]  eq '-rt45') {
				$rtlight_radius_scale = 45;
			} elsif (@ARGV[0]  eq '-rt50') {
				$rtlight_radius_scale = 50;
			} elsif (@ARGV[0]  eq '-rt55') {
				$rtlight_radius_scale = 55;
			} elsif (@ARGV[0]  eq '-rt60') {
				$rtlight_radius_scale = 60;
			} elsif (@ARGV[0]  eq '-rt65') {
				$rtlight_radius_scale = 65;
			} elsif (@ARGV[0]  eq '-rt70') {
				$rtlight_radius_scale = 70;
			} elsif (@ARGV[0]  eq '-rt75') {
				$rtlight_radius_scale = 75;
			} elsif (@ARGV[0]  eq '-rt80') {
				$rtlight_radius_scale = 80;
			} elsif (@ARGV[0]  eq '-rt85') {
				$rtlight_radius_scale = 85;
			} elsif (@ARGV[0]  eq '-rt90') {
				$rtlight_radius_scale = 90;
			} elsif (@ARGV[0]  eq '-rt95') {
				$rtlight_radius_scale = 95;
			} elsif (@ARGV[0]  eq '-rt100') {
				$rtlight_radius_scale = 100;
			} elsif (@ARGV[0]  eq '-rt200') {
				$rtlight_radius_scale = 200;
			} elsif (@ARGV[0]  eq '-rt300') {
				$rtlight_radius_scale = 300;
			}
			
			
			if (@ARGV[1]) {
				$datafile = @ARGV[1];
			} else {
				$datafile = $fallbackdatafile;
			}
			
			if (@ARGV[2] || @ARGV[3] || @ARGV[4]) {
				if (@ARGV[2]  eq '--nc' || @ARGV[3]  eq '--nc' || @ARGV[4]  eq '--nc') {
					$use_curve = 0; #no curve
				}
				if (@ARGV[2]  eq '--ex' || @ARGV[3]  eq '--ex' || @ARGV[4]  eq '--ex') {
					$rtlights_add_an_exclaimation_point = 1;
				}
				if (@ARGV[2]  eq '--ac' || @ARGV[3]  eq '--ac' || @ARGV[4]  eq '--ac') {
					$rtlight_allow_corona = 1; #allow corona
				} elsif (@ARGV[2]  eq '--ac_tex' || @ARGV[3]  eq '--ac_tex' || @ARGV[4]  eq '--ac_tex') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR_BY_TEXTURE = 1;
				} elsif (@ARGV[2]  eq '--ac_r' || @ARGV[3]  eq '--ac_r' || @ARGV[4]  eq '--ac_r') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 0;
				} elsif (@ARGV[2]  eq '--ac_g' || @ARGV[3]  eq '--ac_g' || @ARGV[4]  eq '--ac_g') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 0;
					$SET_UNSET_CORONA_COLOR_G = 1;
					$SET_UNSET_CORONA_COLOR_B = 0;
				} elsif (@ARGV[2]  eq '--ac_b' || @ARGV[3]  eq '--ac_b' || @ARGV[4]  eq '--ac_b') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 0;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 1;
				} elsif (@ARGV[2]  eq '--ac_c' || @ARGV[3]  eq '--ac_c' || @ARGV[4]  eq '--ac_c') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 0;
					$SET_UNSET_CORONA_COLOR_G = 1;
					$SET_UNSET_CORONA_COLOR_B = 1;
				} elsif (@ARGV[2]  eq '--ac_m' || @ARGV[3]  eq '--ac_m' || @ARGV[4]  eq '--ac_m') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 1; #magenta
				} elsif (@ARGV[2]  eq '--ac_p' || @ARGV[3]  eq '--ac_p' || @ARGV[4]  eq '--ac_p') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 0.5;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 1; #purple
				} elsif (@ARGV[2]  eq '--ac_ros' || @ARGV[3]  eq '--ac_ros' || @ARGV[4]  eq '--ac_ros') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 0.5; #rose
				} elsif (@ARGV[2]  eq '--ac_o' || @ARGV[3]  eq '--ac_o' || @ARGV[4]  eq '--ac_o') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 0.5; #orange
					$SET_UNSET_CORONA_COLOR_B = 0;
				} elsif (@ARGV[2]  eq '--ac_y' || @ARGV[3]  eq '--ac_y' || @ARGV[4]  eq '--ac_y') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 1;
					$SET_UNSET_CORONA_COLOR_B = 0; #yellow
				} elsif (@ARGV[2]  eq '--ac_w' || @ARGV[3]  eq '--ac_w' || @ARGV[4]  eq '--ac_w') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 1;
					$SET_UNSET_CORONA_COLOR_G = 1;
					$SET_UNSET_CORONA_COLOR_B = 1; #white
				} elsif (@ARGV[2]  eq '--ac_blk' || @ARGV[3]  eq '--ac_blk' || @ARGV[4]  eq '--ac_blk') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					$SET_UNSET_CORONA_COLOR_R = 0;
					$SET_UNSET_CORONA_COLOR_G = 0;
					$SET_UNSET_CORONA_COLOR_B = 0; #does this do much, set a corona to black?
				} elsif (@ARGV[2]  eq '--ac_custom' || @ARGV[3]  eq '--ac_custom' || @ARGV[4]  eq '--ac_custom') {
					$rtlight_allow_corona = 1; #allow corona
					$SET_UNSET_CORONA_COLOR = 1;
					#set at top
				} elsif (@ARGV[2]  eq '--nac' || @ARGV[3]  eq '--nac' || @ARGV[4]  eq '--nac') {
					$rtlight_allow_corona = 0; #do not allow corona #default
				}
				if (@ARGV[2]  eq '--ics' || @ARGV[3]  eq '--ics' || @ARGV[4]  eq '--ics') {
					$rtlight_independent_corona_scale = 5; #
				} elsif (@ARGV[2]  eq '--ics1' || @ARGV[3]  eq '--ics1' || @ARGV[4]  eq '--ics1') {
					$rtlight_independent_corona_scale = 1; #
				} elsif (@ARGV[2]  eq '--ics3' || @ARGV[3]  eq '--ics3' || @ARGV[4]  eq '--ics3') {
					$rtlight_independent_corona_scale =3; #
				} elsif (@ARGV[2]  eq '--ics5' || @ARGV[3]  eq '--ics5' || @ARGV[4]  eq '--ics5') {
					$rtlight_independent_corona_scale = 5; #
				} elsif (@ARGV[2]  eq '--ics10' || @ARGV[3]  eq '--ics10' || @ARGV[4]  eq '--ics10') {
					$rtlight_independent_corona_scale = 10; #
				} elsif (@ARGV[2]  eq '--ics20' || @ARGV[3]  eq '--ics20' || @ARGV[4]  eq '--ics20') {
					$rtlight_independent_corona_scale = 20; #
				} elsif (@ARGV[2]  eq '--ics30' || @ARGV[3]  eq '--ics30' || @ARGV[4]  eq '--ics30') {
					$rtlight_independent_corona_scale = 30; #
				}
				
				if (@ARGV[2]  eq '--ig' || @ARGV[3]  eq '--ig' || @ARGV[4]  eq '--ig') {
					#ignore unset
					#can strip out lazy mapping lights and give darker better atmosphere to some maps
					$SET_UNSET_LIGHT_COLOR = 0;
					$SET_UNSET_LIGHT_RADIUS = 0;
					$Set_Default_HSV_and_Radius_At_Begining_Instead = 1; #new default added
					$ignore_unset_lights = 1; #added
				 
				  } elsif (@ARGV[2]  eq '--dontsetunset' || @ARGV[3]  eq '--dontsetunset' || @ARGV[4]  eq '--dontsetunset') {
						#PREVIOUS, ONLY SET THE CAPITALS
					#Setting
					#ignore unset
					#can strip out lazy mapping lights and give darker better atmosphere to some maps
					$SET_UNSET_LIGHT_COLOR = 0;
					$SET_UNSET_LIGHT_RADIUS = 0;
					$ignore_unset_lights = 0; #added as that more strictcode wasn't in
					$Set_Default_HSV_and_Radius_At_Begining_Instead = 0; #this didn't used to exist
					#!!!!this used to be the ig setting before set default hsv 
					
				#Alternative to above
				} elsif (@ARGV[2]  eq '--setunset' || @ARGV[3]  eq '--setunset' || @ARGV[4]  eq '--setunset') {
					#mutually exclusive to above
					#this is the default, but if you change it above, you can reset it
					#Doesn't set defaults so has an effect
					$SET_UNSET_LIGHT_COLOR = 1;
					$SET_UNSET_LIGHT_RADIUS = 1;
					$ignore_unset_lights = 0; 
					$Set_Default_HSV_and_Radius_At_Begining_Instead = 0;
				
				  #Other versions of above
				  } elsif (@ARGV[2]  eq '--setunsetdefault' || @ARGV[3]  eq '--setunsetdefault' || @ARGV[4]  eq '--setunsetdefault') {
					#mutually exclusive to above
					#this is the default, but if you change it above, you can reset it
					$SET_UNSET_LIGHT_COLOR = 1;
					$SET_UNSET_LIGHT_RADIUS = 1;
					#!!!!this used to be the setunset setting
					$ignore_unset_lights = 0; 
					$Set_Default_HSV_and_Radius_At_Begining_Instead = 1;
					
				  } elsif (@ARGV[2]  eq '--setunsetonly' || @ARGV[3]  eq '--setunsetonly' || @ARGV[4]  eq '--setunsetonly') {
					#mutually exclusive to above
					#this is the default, but if you change it above, you can reset it
					$SET_UNSET_LIGHT_COLOR = 1;
					$SET_UNSET_LIGHT_RADIUS = 1;
					#!!!!this used to be the setunset setting
				}
			}
		} elsif (@ARGV[0]  eq '-m') {
			$mode = 4; #mover
			if (@ARGV[1]) {
				$datafile = @ARGV[1];
				
				if (@ARGV[2]  eq '--du' || @ARGV[3]  eq '--du') {
					$ALLOW_DESTRUCTABLES_MOVERS = 1;
				} elsif (@ARGV[2]  eq '--ndu' || @ARGV[3]  eq '--ndu') {
					$ALLOW_DESTRUCTABLES_MOVERS = 0;
				}
				
				if (@ARGV[2]  eq '--rhm' || @ARGV[3]  eq '--rhm') {
					$REQUIREHUGEMOVEMENT_FOR_DESTRUCTABLES_MOVERS = 1;
				} elsif (@ARGV[2]  eq '--nrhm' || @ARGV[3]  eq '--nrhm') {
					$REQUIREHUGEMOVEMENT_FOR_DESTRUCTABLES_MOVERS = 0;
				}
				
				if (@ARGV[2]  eq '--omn' || @ARGV[3]  eq '--omn') {
					$OMIT_NEWER_MOVERS = 1;
					$OMIT_NEWER_MOVERS2 = 1;
				} elsif (@ARGV[2]  eq '--nomn' || @ARGV[3]  eq '--nomn') {
					$OMIT_NEWER_MOVERS = 0;
					$OMIT_NEWER_MOVERS2 = 0;
					
				} elsif (@ARGV[2]  eq '--omn1' || @ARGV[3]  eq '--omn1') {
					$OMIT_NEWER_MOVERS = 1;
				} elsif (@ARGV[2]  eq '--nomn1' || @ARGV[3]  eq '--nomn1') {
					$OMIT_NEWER_MOVERS = 0;
					
				} elsif (@ARGV[2]  eq '--omn2' || @ARGV[3]  eq '--omn2') {
					$OMIT_NEWER_MOVERS2 = 1;
				} elsif (@ARGV[2]  eq '--nomn2' || @ARGV[3]  eq '--nomn2') {
					$OMIT_NEWER_MOVERS2 = 0;
				} 
			} else {
				$datafile = $fallbackdatafile;
			}
		#the below argv1 are for regular entities
		} elsif (@ARGV[1]  eq '--owlsz') {
			#Omit Water Lava Slime ZoneInfoHurt
			#(Old default before these were implemented)
			$DOWATERLAVASLIMEZONES = 0;
			$WATERLAVASLIMEZONESAREPRINTEDATEND = 0;
			$DOZONEINFOHURT = 0;
		} elsif (@ARGV[1]  eq '--nowlsz') {
			#Do Not Omit Water Lava Slime ZoneInfoHurt
			#(default after these were implemented)
			$DOWATERLAVASLIMEZONES = 1;
			$WATERLAVASLIMEZONESAREPRINTEDATEND = 1;
			$DOZONEINFOHURT = 1;
		}
		
		#normal
		if ($STRICTFILECONTROL) {
			if (index(lc($datafile), lc('.t3d')) != -1) {
				##Happy
			} else {
				die "not .t3d file and strict file control is on";
			}
		}
	} else {
		$datafile = $fallbackdatafile;
	}










#sub rotation_for_obj_from_mc ($x)
#{
#	return (((65536 - $x) / 65536) * 360);
#}

sub unr_rotation_to_deg #($x)
{	my $x = $_[0]; #had to add
	return (($x) * (360 / 65535));
}

sub rotation_convert #($unrnum) 
{	my $unrnum = $_[0]; #had to add
	my $v;
	$v = &unr_rotation_to_deg ($unrnum);
	if ($v > 180) { $v -= 360; }
	if ($v < -180) { $v += 360; }
	return $v;
}


#test_hsv_to_rgb();
sub test_hsv_to_rgb {
	#$hue 		= 28;
	#$saturation	= 32;
	#$brightness	= 96;
	if (!$hue ) { $hue 		= 28;
		$saturation	= 255;
		$brightness	= 128;
	}
	print("H $hue  S $saturation  B $brightness\n");
	print("Algo: $hsvalgo ");
		setstringhsvinfo();
		print("$hsvalgousedstring\n");
	hsv_to_rgb();
	print("$color_r $color_g $color_b\n");
	print($color_r*255,' ', $color_g*255,' ',  $color_b*255,' ',  "\n");
	if ($printmode_testhsv_sa_br_hue) {
		print("\t",'"','color','"',' '); print('"',"$color_r $color_g $color_b",'"'); print("\n");
		print("\t",'"','b_Rgb','"',' '); print('"',"$b_Red $b_Green $b_Blue",'"'); print("\n");
	}
	print("saturation(0..255) brightness(0..255) hue(0..255)\n");
	print("$saturation $brightness $hue\n");
	exit;
}

sub hsv_to_rgb
{
	if ($hsvalgo == 1 || !$hsvalgo) {
		myhsv_to_rgb();
	} elsif ($hsvalgo == 2) {
		hsv_to_rgb___std_win(); #240 version
	} elsif ($hsvalgo == 3) {
		hsv_to_rgbprev();	#Used this for a time
	} elsif ($hsvalgo == 4) {
		hsv_to_rgbanothertry();	#Algo that combines 
	} elsif ($hsvalgo == 5) {
		althsv_to_rgb();
	} 
}
#information to print regarding which algo was used
#done here so as not to waste time
sub setstringhsvinfo
{
	if ($hsvalgo == 1 || !$hsvalgo) {
		$hsvalgousedstring = 'myhsv_to_rgb';
	} elsif ($hsvalgo == 2) {
		$hsvalgousedstring = 'hsv_to_rgb___std_win';
	} elsif ($hsvalgo == 3) {
		$hsvalgousedstring = 'hsv_to_rgbprev';
	} elsif ($hsvalgo == 4) {
		$hsvalgousedstring = 'hsv_to_rgbanothertry';
	} elsif ($hsvalgo == 5) {
		$hsvalgousedstring = 'althsv_to_rgb';
	} 
}

##########################################################################################
##########################################################################################
sub myhsv_to_rgb
{
	hueapply();
	betweenhues(); #deals with hues not in the 16 table
	saturationapply();
	brightnessapply();
}

#These are the subroutines that do the work
#apply them in succession to get the rgb 0..1 color:
#set: $hue $saturation $brightness
#	hueapply();
#	saturationapply();
#	brightnessapply();
#get: $color_r $color_b $color_g
sub formatforrgb
{
	$red = $b_Red/255;
	$green = $b_Green/255;
	$blue = $b_Blue/255;
}
sub betweenhues
{
	$oldhue = $hue; #save
	betweenhues_interior();
	formatforrgb();
	$hue = $oldhue; #restore
}
sub setbColor0
{
	$b_Red0 = $b_Red;
	$b_Green0 = $b_Green;
	$b_Blue0 = $b_Blue;
}
sub setbColor1
{
	$b_Red1 = $b_Red;
	$b_Green1 = $b_Green;
	$b_Blue1 = $b_Blue;
}
#sub betweenhues_interior
#{
#	if ($oldhue > 240 && $oldhue < 255) {
#		print("hello!\n");
#		$hue = 240; hueapply(); setbColor0();
#		$hue = 255; hueapply(); setbColor1();
#		$myrange = 255 - 240; #15
#		$myfrombottom = $oldhue - 240; #ex: 241 - 240 = 1
#		$myfromtop   =  255 - $oldhue; #ex: 255 - 241 = 14
#		
#		$bottomweight = $myfromtop/$myrange;
#		$topweight = $myfrombottom/$myrange;
#		
#		$b_Red = ($b_Red0 * $bottomweight) + ($b_Red1 * $topweight);
#		$b_Green = ($b_Green0 * $bottomweight) + ($b_Green1 * $topweight);
#		$b_Blue = ($b_Blue0 * $bottomweight) + ($b_Blue1 * $topweight);
#	}
#}
sub betweenhues_interior
{
	$lownum = 0;
	$highnum = 0;
	#(0,  16,  32,  48,  64,  80,  96, 112, 128, 144, 160, 176, 192, 208, 224, 240, 255);
	     if ($oldhue > 240 && $oldhue < 255) {
		$lownum = 240;
		$highnum = 255;
		
	} elsif ($oldhue > 224 && $oldhue < 240) {
		$lownum = 224;
		$highnum = 240;
		
	} elsif ($oldhue > 208 && $oldhue < 224) {
		$lownum = 208;
		$highnum = 224;
			
	} elsif ($oldhue > 192 && $oldhue < 208) {
		$lownum = 192;
		$highnum = 208;
			
	} elsif ($oldhue > 176 && $oldhue < 192) {
		$lownum = 176;
		$highnum = 192;
			
	} elsif ($oldhue > 144 && $oldhue < 176) {
		$lownum = 144;
		$highnum = 176;
			
	} elsif ($oldhue > 128 && $oldhue < 144) {
		$lownum = 128;
		$highnum = 144;
			
	} elsif ($oldhue > 112 && $oldhue < 128) {
		$lownum = 112;
		$highnum = 128;
			
	} elsif ($oldhue > 96 && $oldhue < 112) {
		$lownum = 96;
		$highnum = 112;
			
	} elsif ($oldhue > 80 && $oldhue < 96) {
		$lownum = 80;
		$highnum = 96;
			
	} elsif ($oldhue > 64 && $oldhue < 80) {
		$lownum = 64;
		$highnum = 80;
			
	} elsif ($oldhue > 48 && $oldhue < 64) {
		$lownum = 48;
		$highnum = 64;
			
	} elsif ($oldhue > 32 && $oldhue < 48) {
		$lownum = 32;
		$highnum = 48;
			
	} elsif ($oldhue > 16 && $oldhue < 32) {
		$lownum = 16;
		$highnum = 32;
			
	} elsif ($oldhue > 0 && $oldhue < 16) {
		$lownum = 0;
		$highnum = 16;
			
	}
	
	
	if ($lownum || $highnum) {
		betweenhues_interior_interior();
	} else {
		#Do nothing as we are spot on one of the table values
	}
	
}
sub betweenhues_interior_interior
{
	if ($oldhue > $lownum && $oldhue < $highnum) {
		#print("hello!\n");
		$hue = $lownum; hueapply(); setbColor0();
		$hue = $highnum; hueapply(); setbColor1();
		$myrange = $highnum - $lownum; #15
		$myfrombottom = $oldhue - $lownum; #ex: 241 - $lownum = 1
		$myfromtop   =  $highnum - $oldhue; #ex: $highnum - 241 = 14
		
		$bottomweight = $myfromtop/$myrange;
		$topweight = $myfrombottom/$myrange;
		
		$b_Red = ($b_Red0 * $bottomweight) + ($b_Red1 * $topweight);
		$b_Green = ($b_Green0 * $bottomweight) + ($b_Green1 * $topweight);
		$b_Blue = ($b_Blue0 * $bottomweight) + ($b_Blue1 * $topweight);
		
		#format removing decimals
		$b_Red = int($b_Red);
		$b_Green = int($b_Green);
		$b_Blue = int($b_Blue);
	}
}

##test
#$hue = 241; $hue=$originalhuefromcommandline; hueapply();
#betweenhues();
#print("\t",'"','b_Rgb','"',' '); print('"',"$b_Red $b_Green $b_Blue",'"'); print("\n");


sub hueapply
{
	$b_Red		= 0;
	$b_Green	= 0;
	$b_Blue		= 0;
	
	if ($hue >= 255) { #FF0000 Below
		$b_Red		= 255;
		$b_Green	= 0;
		$b_Blue		= 0;
	}  elsif ($hue >= 240) {#E50030 Below
		$b_Red		= 229;
		$b_Green	= 0;
		$b_Blue		= 48;
	}  elsif ($hue >= 224) {#B20061 Below
		$b_Red		= 178;
		$b_Green	= 0;
		$b_Blue		= 97;
	}  elsif ($hue >= 208) {#8300A3 Below
		$b_Red		= 131;
		$b_Green	= 0;
		$b_Blue		= 163;
	}  elsif ($hue >= 192) {#4200D5 Below
		$b_Red		= 66;
		$b_Green	= 0;
		$b_Blue		= 213;
	}  elsif ($hue >= 176) {#1000FE Below
		$b_Red		= 16;
		$b_Green	= 0;
		$b_Blue		= 254;
	}  elsif ($hue >= 160) {#001EEA Below
		$b_Red		= 0;
		$b_Green	= 30;
		$b_Blue		= 234;
	} elsif ($hue >= 144) {#0052BA Below
		$b_Red		= 0;
		$b_Green	= 82;
		$b_Blue		= 186;
	} elsif ($hue >= 128) {#008388  Below
		$b_Red		= 0;
		$b_Green	= 131;
		$b_Blue		= 136;
	} elsif ($hue >= 112) { #00B255  Below
		$b_Red		= 0;
		$b_Green	= 178;
		$b_Blue		= 85;
	} elsif ($hue >= 96) { #00E820  Below
		$b_Red		= 0;
		$b_Green	= 232;
		$b_Blue		= 32;
	} elsif ($hue >= 80) { #10F600  Below
		$b_Red		= 16;
		$b_Green	= 246;
		$b_Blue		= 0;
	} elsif ($hue >= 64) { #42CA00  Below
		$b_Red		= 66;
		$b_Green	= 202;
		$b_Blue		= 0;
	} elsif ($hue >= 48) { #84A500  Below
		$b_Red		= 132;
		$b_Green	= 165;
		$b_Blue		= 0;
	} elsif ($hue >= 32) { #B16700  Below
		$b_Red		= 177;
		$b_Green	= 103;
		$b_Blue		= 0;
	} elsif ($hue >= 16) {#CF2E00  Below
		$b_Red		= 207;
		$b_Green	= 46;
		$b_Blue		= 0;
	} elsif ($hue >= 0) { #FF0000  Below
		$b_Red		= 255;
		$b_Green	= 0;
		$b_Blue		= 0;
	}
	
	$red = $b_Red/255;
	$green = $b_Green/255;
	$blue = $b_Blue/255;
}


sub saturationapply
{
	$whiteamnt = $saturation/255;
	$coloramnt = 1 - $whiteamnt;
		$pre_color_r = $red * $coloramnt;
		$pre_color_g = $green * $coloramnt;
		$pre_color_b = $blue * $coloramnt;
		
	$color_r = $pre_color_r + $whiteamnt;
	$color_g = $pre_color_g + $whiteamnt;
	$color_b = $pre_color_b + $whiteamnt;
}

sub brightnessapply
{
	$color_r = $color_r * ($brightness/255);
	$color_g = $color_g * ($brightness/255);
	$color_b = $color_b * ($brightness/255);
}

#above are needed
############################################################





##########################################################################################
##########################################################################################
# Various other hsv algos
#sub max ($$) { $_[$_[0] < $_[1]] }
sub min ($$) { $_[$_[0] > $_[1]] }

sub hsv_to_rgb___std_win #trying with 240 value #this was the standard for awhile
{	my $offset_saturation = 0;
	$color_r = 0; $color_g = 0; $color_b = 0;
	#$hue 		#H
	#$saturation	#S
	#$brightness	#L
	
	#added
	if ($hue < 0) { $hue = (240 - $hue) % 240; }
	else { $hue = $hue % 240; }
	#added

	#Different way
	if ($hue < 80) {
		$color_r = min(255, 255 * (80 - $hue) / 40);
	} elsif ($hue > 160) {
		$color_r = min(255, 255 * ($hue - 160) / 40);
	}
	
	if ($hue < 160) {
		$color_g = min(255, 255 * (80 - abs($hue - 80)) / 40);
	}
	
	if ($hue > 80) {
		$color_b = min(255, 255 * (80 - abs($hue - 160)) / 40);
	}
	#Different way
			
	if ($saturation < 240) {
		$color_r = $color_r * ($saturation / 240);
		$color_g = $color_g * ($saturation / 240);
		$color_b = $color_b * ($saturation / 240);
		$offset_saturation = 128 * (240 - $saturation) / 240;
		$color_r += $offset_saturation;
		$color_g += $offset_saturation;
		$color_b += $offset_saturation;
	}
	
	#Different way
	$brightness = min(255, $brightness);
	$color_r = $color_r * ((120 - abs($brightness - 120)) / 120);
	$color_g = $color_g * ((120 - abs($brightness - 120)) / 120);
	$color_b = $color_b * ((120 - abs($brightness - 120)) / 120);
	

	if ($brightness > 120) {
		$offset_brightness = 256 * ($brightness - 120) / 120;
		$color_r += $offset_brightness;
		$color_g += $offset_brightness;
		$color_b += $offset_brightness;
	}
	#Different way
	
	$color_r = $color_r / 256;
	$color_g = $color_g / 256;
	$color_b = $color_b / 256;
	
	#format
	$color_r = eval sprintf('%.6f', $color_r);
	$color_g = eval sprintf('%.6f', $color_g);
	$color_b = eval sprintf('%.6f', $color_b);	
}


sub hsv_to_rgbanothertry #too green
{	my $offset_saturation = 0;
	$color_r = 0; $color_g = 0; $color_b = 0;
	#$hue 		#H
	#$saturation	#S
	#$brightness	#L
	
	#Different way
	if ($hue < 85) {
		$color_r = min(255, 255 * (85 - $hue) / 42.5);
	} elsif ($hue > 170) {
		$color_r = min(255, 255 * ($hue - 170) / 42.5);
	}
	
	if ($hue < 170) {
		$color_g = min(255, 255 * (85 - abs($hue - 85)) / 42.5);
	}
	
	if ($hue > 85) {
		$color_b = min(255, 255 * (85 - abs($hue - 170)) / 42.5);
	}
	#Different way
			
	if ($saturation < 255) {
		$color_r = $color_r * ($saturation / 255);
		$color_g = $color_g * ($saturation / 255);
		$color_b = $color_b * ($saturation / 255);
		$offset_saturation = 128 * (255 - $saturation) / 255;
		$color_r += $offset_saturation;
		$color_g += $offset_saturation;
		$color_b += $offset_saturation;
	}
	
	#Different way
	$brightness = min(255, $brightness);
	$color_r = $color_r * ((120 - abs($brightness - 120)) / 120);
	$color_g = $color_g * ((120 - abs($brightness - 120)) / 120);
	$color_b = $color_b * ((120 - abs($brightness - 120)) / 120);
	

	if ($brightness > 120) {
		$offset_brightness = 256 * ($brightness - 120) / 120;
		$color_r += $offset_brightness;
		$color_g += $offset_brightness;
		$color_b += $offset_brightness;
	}
	#Different way
	
	$color_r = $color_r / 256;
	$color_g = $color_g / 256;
	$color_b = $color_b / 256;
	
	#format
	$color_r = eval sprintf('%.6f', $color_r);
	$color_g = eval sprintf('%.6f', $color_g);
	$color_b = eval sprintf('%.6f', $color_b);	
}
sub hsv_to_rgbprev #ok, not as blue as supposed to
{	my $offset_saturation = 0;
	$color_r = 0; $color_g = 0; $color_b = 0;
	#$hue 		#H
	#$saturation	#S
	#$brightness	#L
	
	#Different way
	if ($hue < 80) {
		$color_r = min(255, 255 * (80 - $hue) / 40);
	} elsif ($hue > 160) {
		$color_r = min(255, 255 * ($hue - 160) / 40);
	}
	
	if ($hue < 160) {
		$color_g = min(255, 255 * (80 - abs($hue - 80)) / 40);
	}
	
	if ($hue > 80) {
		$color_b = min(255, 255 * (80 - abs($hue - 160)) / 40);
	}
	#Different way
			
	if ($saturation < 255) {
		$color_r = $color_r * ($saturation / 255);
		$color_g = $color_g * ($saturation / 255);
		$color_b = $color_b * ($saturation / 255);
		$offset_saturation = 128 * (255 - $saturation) / 255;
		$color_r += $offset_saturation;
		$color_g += $offset_saturation;
		$color_b += $offset_saturation;
	}
	
	#Different way
	$brightness = min(255, $brightness);
	$color_r = $color_r * ((120 - abs($brightness - 120)) / 120);
	$color_g = $color_g * ((120 - abs($brightness - 120)) / 120);
	$color_b = $color_b * ((120 - abs($brightness - 120)) / 120);
	

	if ($brightness > 120) {
		$offset_brightness = 256 * ($brightness - 120) / 120;
		$color_r += $offset_brightness;
		$color_g += $offset_brightness;
		$color_b += $offset_brightness;
	}
	#Different way
	
	$color_r = $color_r / 256;
	$color_g = $color_g / 256;
	$color_b = $color_b / 256;
	
	#format
	$color_r = eval sprintf('%.6f', $color_r);
	$color_g = eval sprintf('%.6f', $color_g);
	$color_b = eval sprintf('%.6f', $color_b);	
}


sub althsv_to_rgb
{	my $offset_saturation = 0;
	$color_r = 0; $color_g = 0; $color_b = 0;
	#$hue 		#H
	#$saturation	#S
	#$brightness	#L
	$saturation = 255 - $saturation; #Tried
	
	if ($hue < 85) {
		$color_r = min(1, (85 - $hue) / 42.5);
	} elsif ($hue > 170) {
		$color_r = min(1, ($hue - 170) / 42.5);
	}
				
	if ($hue < 170) {
		$color_g = min(1, (85 - abs($hue - 85)) / 42.5);
	}
					
	if ($hue > 85) {
		$color_b = min(1, (85 - abs($hue - 170)) / 42.5);
	}

	
	if ($saturation < 255) {
		$color_r = $color_r * ($saturation / 255);
		$color_g = $color_g * ($saturation / 255);
		$color_b = $color_b * ($saturation / 255);
		$offset_saturation = 128 * (255 - $saturation) / 255;
		$color_r += $offset_saturation;
		$color_g += $offset_saturation;
		$color_b += $offset_saturation;
	}
	
	#Tried
	$color_r = ((255 - abs($brightness - 255)) / 255);
	$color_g = ((255 - abs($brightness - 255)) / 255);
	$color_b = ((255 - abs($brightness - 255)) / 255);
	
	#format
	$color_r = eval sprintf('%.6f', $color_r);
	$color_g = eval sprintf('%.6f', $color_g);
	$color_b = eval sprintf('%.6f', $color_b);	
}










setdefault_light_and_radius_maybe();
sub prc #printcommentifunknownmover
{
	if ($dostuff == 2001 && $is_mover) {
			print $output ('//'); 
			print $output ('#');
	}
}
sub soundguessfornoiseofsecretdoormovers
{
		if ($openingnoise_formover) { 
			$specialextrastuffname = 'noise3';
			$specialextrastuffamnt = "$openingnoise_formover".'.wav';
			#note can also do it: #$specialextrastuffamnt = $openingnoise_formover;
			#                     #$specialextrastuffamnt .= '.wav';
		}
		
		if ($moveambientnoise_formover) { 
			$specialextrastuffname0 = 'noise2';
			$specialextrastuffamnt0 = "$moveambientnoise_formover".'.wav';
		}
		
		if ($closingingnoise_formover) { 
			$specialextrastuffname1 = 'noise1';
			$specialextrastuffamnt1 = "$closingingnoise_formover".'.wav';
		}
}
sub soundguessfornoiseofliftmovers
{
		if ($openingnoise_formover) { 
			$specialextrastuffname = 'noise1';
			$specialextrastuffamnt = "$openingnoise_formover".'.wav';
			#note can also do it: #$specialextrastuffamnt = $openingnoise_formover;
			#                     #$specialextrastuffamnt .= '.wav';
		}
		
		if ($moveambientnoise_formover) { 
			$specialextrastuffname0 = 'noise2';
			$specialextrastuffamnt0 = "$moveambientnoise_formover".'.wav';
		}
}
sub soundguessfornoiseofrotatingdoortrapmovers
{
		if ($openingnoise_formover) { 
			$specialextrastuffname = 'noise1';
			$specialextrastuffamnt = "$openingnoise_formover".'.wav';
		}
		
		if ($closingnoise_formover) { 
			$specialextrastuffname0 = 'noise2';
			$specialextrastuffamnt0 = "$closingnoise_formover".'.wav';
		}
}
sub othergeneralstuffformovers
{
		if ($mover_encroachtype = 1) { #crush
			if ($mover_encroachdamage) {
				$specialextrastuffname1 = 'dmg';
				$specialextrastuffamnt1 = $mover_encroachdamage;
			}
		}
}
sub setmovetimeifnotset
{
	if ($mover_movetime) {
		#do nothing
	} else {
		$mover_movetime = 1; #one second
	}
}
sub speedguessformovers
{
		if ($mover_movetime) {
			if ($mover_movetime != 0) { #had to add extra check for things like "00.000000"
			$speed = $default_mover_speed / $mover_movetime;
			}
		}
}

if ($WATERLAVASLIMEZONESAREPRINTEDATEND && $DOWATERLAVASLIMEZONES) {
	$var = "";
	open $fh, '>', \$var;
	#print $fh "////asdf";
}

open (FILE, "$datafile") || die "can't open file because $!";
while (my $line = <FILE>)
{
	if ($DEBUGPRINTS > 1) {print ("!!!!! $line");}
$thing = $line;
# #The point of this is to iterate through a t3d file and look for things to print in the entity format
# open (FILE, 'data.t3d'); #for data mode
# #while (<FILE>) {         #for data mode
# while (<>) {  #attempt for data mode
# #while (1) {             #for pasting mode

$beforeequals = "";
$afterequals = "";
$islocationline = 0;
$isrotationline = 0;
$isrotationrateline = 0;
$islight_hueline = 0;
$islight_saturationline = 0;
$islight_brightnessline = 0;
$islightradiusline = 0;
$isambientsoundline = 0;
#
$isbaseposline_formover = 0; #Seems to be same as location
$iskeyrotline_formover = 0;  #where to rotate
$iskeyposline_formover = 0; 
$iskeypos2line_formover = 0; 
$issavedposline_formover = 0; #is by default: (X=-12345.000000,Y=-12345.000000,Z=-12345.000000)
$issavedrotline_formover = 0;  #is by default: (Pitch=123,Yaw=456,Roll=789)
$isencroachdamageline_formover = 0; 
$isdrawscaleline = 0; 
$isencroachtypeline_formover = 0; 
$istagline_formover = 0;  
$isbumpeventline_formover = 0; 
$isopeningsoundline_formover = 0;
$isclosingsoundline_formover = 0;
$isclosingingsoundline_formover = 0;
$ismoveambientsoundline_formover = 0;
$isbumptypeline_formover = 0; 
$ismovetimeline_formover = 0;
$isvertexline_a_formover = 0; #one of many 
$isinitialstateline_formover = 0;
$ismoverglidetypeline_formover = 0;
$iseventline_formover = 0;  
$isbdamagetriggeredline_formover = 0; 
$isdamagethresholdline_formover = 0;
$isstayopentimeline_formover = 0;
$isbpainzoneline = 0;
$is_Skin_line = 0; #forcorona
$isdamagepersecondline = 0;
$isanimsequenceline = 0;
$isurlline = 0;
$iscoronaline = 0;

# ##$thing = <STDIN>; #for pasting mode
# ##chomp($thing); #for pasting mode
# #$thing = chomp($_); #for data mode
# $thing = <FILE>; #attempt for data mode
# chomp($thing); #attempt for data mode
# #$thing = chomp; #attempt for data mode2
chomp($thing);

	if ($thing eq 'End Actor') {
				if ($DEBUGPRINTS) { print("    **** Says End Actor\n"); }
		$endnow = 1;
		$ignoreingalllinesinbrush = 0;
	} elsif (index(lc($thing), lc('End Actor')) != -1) {
			if ($DEBUGPRINTS) {  print "contains end actor\n"; }
		$endnow = 1;
		$ignoreingalllinesinbrush = 0;
	} elsif ($ignoreingalllinesinbrush == 1) {
			if ($DEBUGPRINTS) {  print("    _____I\n"); }
	} elsif (index(lc($thing), lc('Begin Actor Class=Brush')) != -1) {
			if ($DEBUGPRINTS) {  print "actor class brush wait till past maybe\n"; }
		$ignoreingalllinesinbrush = 1;
	} elsif (index(lc($thing), lc('Begin Actor')) != -1) {
			if ($DEBUGPRINTS) {  print "ignoring begin actor line so does not conflict with ambient sound\n"; }
	} elsif ((index(lc($thing), lc('     Name="')) != -1) && ($OMITNAMELINECONTAININGACTIVELINE_FIX)) {
		#//Ignore this line, has a name of something that breaks our script
		#//Saw in a map so adding this fix,
		#//We don't use the name line for anything right now
		#//Included the "tab" (really blank spaces) as that's how the files put this out and want to avoid others
		#//Added for (talltowa)
		#//That is: the name line, which is not yet used, has one of the following in it for some reason"
	} elsif (index(lc($thing), lc('Location')) != -1) {
   				if ($DEBUGPRINTS) {  print "$thing contains Location\n"; }
		$islocationline = 1;
	} elsif (index(lc($thing), lc('RotationRate')) != -1) {
   				if ($DEBUGPRINTS) {  print "$thing contains Rotation\n"; }
		$isrotationrateline = 1; #had to do before rotation so wont conflict
	} elsif (index(lc($thing), lc('Rotation')) != -1) {
   				if ($DEBUGPRINTS) {  print "$thing contains Rotation\n"; }
		$isrotationline = 1;
	} elsif (index(lc($thing), lc('LightHue')) != -1) {
		$islight_hueline = 1;
	} elsif (index(lc($thing), lc('LightSaturation')) != -1) {
		$islight_saturationline = 1;
	} elsif (index(lc($thing), lc('LightBrightness')) != -1) {
		$islight_brightnessline = 1;
	} elsif (index(lc($thing), lc('LightRadius')) != -1) {
		$islightradiusline = 1;
	} elsif (index(lc($thing), lc('MoveAmbientSound')) != -1) {
		$ismoveambientsoundline_formover = 1;
	} elsif (index(lc($thing), lc('OpenedSound')) != -1) {
		$isopeningsoundline_formover = 1;
	} elsif (index(lc($thing), lc('ClosedSound')) != -1) {
		$isclosingsoundline_formover = 1;
	} elsif (index(lc($thing), lc('ClosingSound')) != -1) {
		$isclosingingsoundline_formover = 1;
	} elsif (index(lc($thing), lc('AmbientSound')) != -1) {
   				if ($DEBUGPRINTS) {  print "$thing contains AmbientSound\n"; }
		$isambientsoundline = 1;
	#Mover stuff, omitted if not mover
	} elsif ( (index(lc($thing), lc('BasePos')) != -1) && ($is_mover) ) {
		$isbaseposline_formover = 1;
		#seems to be same as origin for the movers we're interested in so far
	} elsif ( (index(lc($thing), lc('KeyRot')) != -1) && ($is_mover) ) { #really KeyRot(1)
		$iskeyrotline_formover = 1;
		#when only the Y is set it is a rotating down floor trap
	} elsif ( (index(lc($thing), lc('SavedPos')) != -1) && ($is_mover) ) {
		$issavedposline_formover = 1;
		#set to (X=-12345.000000,Y=-12345.000000,Z=-12345.000000)
		#for the movers we are interested so far
	} elsif ( (index(lc($thing), lc('SavedRot')) != -1) && ($is_mover) ) {
		$issavedrotline_formover = 1;
		#Set to (Pitch=123,Yaw=456,Roll=789) for the movers we are interested in so far
	} elsif ( (index(lc($thing), lc('EncroachDamage')) != -1) && ($is_mover) ) {
		$isencroachdamageline_formover = 1;
		#Examples we've seen so far are EncroachDamage=1000000 for crusher and trap floors
	} elsif ( (index(lc($thing), lc('MoverEncroachType')) != -1) && ($is_mover) ) {
		$isencroachtypeline_formover = 1;
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('Tag')) != -1) && ($is_mover || $is_allowed_even_if_not_mover) ) {
		$istagline_formover = 1; 
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('BumpEvent')) != -1) && ($is_mover) ) {
		$isbumpeventline_formover = 1; 
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('BumpType')) != -1) && ($is_mover) ) {
		$isbumptypeline_formover = 1; 
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('MoverGlideType')) != -1) && ($is_mover) ) {
		$ismoverglidetypeline_formover = 1; 
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('MoveTime')) != -1) && ($is_mover) ) {
		$ismovetimeline_formover = 1; 
		#MoverEncroachType=ME_CrushWhenEncroach is what we've seen so far
	} elsif ( (index(lc($thing), lc('KeyPos(2)')) != -1) && ($is_mover) ) { #really KeyPos(2)
		$iskeypos2line_formover = 1; #was an error had as 0
	} elsif ( (index(lc($thing), lc('KeyPos')) != -1) && ($is_mover) ) { #really KeyPos(1)
		$iskeyposline_formover = 1; #was an error had as 0
	} elsif ( (index(lc($thing), lc('Vertex')) != -1) && ($is_mover) ) { #Vertex   -00008.000000,+00016.000000,-00016.000000
		$isvertexline_a_formover = 1; #one of many
	} elsif ( (index(lc($thing), lc('Drawscale')) != -1)) {
		$isdrawscaleline = 1;
		#Examples we've seen so far are DrawScale=6.250000 for fan
	} elsif ( (index(lc($thing), lc('InitialState')) != -1) && ($is_mover) ) {
		$isinitialstateline_formover = 1; 
	} elsif ( (index(lc($thing), lc('Event')) != -1) && ($is_mover || $is_allowed_even_if_not_mover) ) {
		$iseventline_formover = 1;  
	} elsif ( (index(lc($thing), lc('bDamageTriggered')) != -1) && ($is_mover) ) {
		$isbdamagetriggeredline_formover = 1;   
	} elsif ( (index(lc($thing), lc('DamageThreshold')) != -1) && ($is_mover) ) {
		$isdamagethresholdline_formover = 1;    
	} elsif ( (index(lc($thing), lc('StayOpenTime')) != -1) && ($is_mover) ) {
		$isstayopentimeline_formover = 1;     
	} elsif ( (index(lc($thing), lc('bPainZone')) != -1) ) {
		$isbpainzoneline = 1;      
	} elsif ( (index(lc($thing), lc('DamagePerSec')) != -1) ) {
		$isdamagepersecondline = 1;      
	} elsif ( (index(lc($thing), lc('AnimSequence')) != -1) ) {
		$isanimsequenceline = 1;      
	} elsif ( (index($thing, 'URL') != -1) ) {
		$isurlline = 1;     
	} elsif ( (index(lc($thing), lc('bCorona')) != -1) ) {
		$iscoronaline = 1;     
	} elsif ( (index(lc($thing), lc('Skin')) != -1) ) {
		$is_Skin_line = 1; #forcorona
	} else {
				if ($DEBUGPRINTS) {  print("    _____Nothing\n"); }
		#$dostuff = 0;
	}

	if ($ignoreingalllinesinbrush == 1) {
		if ($DEBUGPRINTS) {  print("    _____IgnoringBrush\n"); }
	###############
	#Actual origin
	} elsif ($islocationline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSLOCATIONLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$origin_x = 0;
		$origin_y = 0;
		$origin_z = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'X') {
		    	$origin_x = $afterequals;
		    } elsif ($beforeequals eq 'Y') {
		    	$origin_y = $afterequals;
		    } elsif ($beforeequals eq 'Z') {
		    	$origin_z = $afterequals;
		    }
		}
	#BELOW: FOR MOVER, but seems to be same as location
	} elsif ($isbaseposline_formover) { #origin type
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSBASEPOSLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$mover_basepos_origin_x = 0;
		$mover_basepos_origin_y = 0;
		$mover_basepos_origin_z = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'X') {
		    	$mover_basepos_origin_x = $afterequals;
		    } elsif ($beforeequals eq 'Y') {
		    	$mover_basepos_origin_y = $afterequals;
		    } elsif ($beforeequals eq 'Z') {
		    	$mover_basepos_origin_z = $afterequals;
		    }
		}
	#BELOW: FOR MOVER
	} elsif ($issavedposline_formover) { #origin type
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSBASEPOSLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$saved_mover_basepos_origin_x = 0;
		$saved_mover_basepos_origin_y = 0;
		$saved_mover_basepos_origin_z = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'X') {
		    	$saved_mover_basepos_origin_x = $afterequals;
		    } elsif ($beforeequals eq 'Y') {
		    	$saved_mover_basepos_origin_y = $afterequals;
		    } elsif ($beforeequals eq 'Z') {
		    	$saved_mover_basepos_origin_z = $afterequals;
		    }
		}
	} elsif ($iskeyposline_formover) { #origin type
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSBASEPOSLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$moverkey_pos_origin_x = 0;
		$moverkey_pos_origin_y = 0;
		$moverkey_pos_origin_z = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'X') {
		    	$moverkey_pos_origin_x = $afterequals;
		    } elsif ($beforeequals eq 'Y') {
		    	$moverkey_pos_origin_y = $afterequals;
		    } elsif ($beforeequals eq 'Z') {
		    	$moverkey_pos_origin_z = $afterequals;
		    }
		}
	} elsif ($iskeypos2line_formover) { #origin type
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSBASEPOSLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$moverkey_pos2_origin_x = 0;
		$moverkey_pos2_origin_y = 0;
		$moverkey_pos2_origin_z = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'X') {
		    	$moverkey_pos2_origin_x = $afterequals;
		    } elsif ($beforeequals eq 'Y') {
		    	$moverkey_pos2_origin_y = $afterequals;
		    } elsif ($beforeequals eq 'Z') {
		    	$moverkey_pos2_origin_z = $afterequals;
		    }
		}
	} elsif ($isvertexline_a_formover) { #origin type
		my $temp_vertex_x;
		my $temp_vertex_y;
		my $temp_vertex_z;
		my $temp_num;
		#print("try1111\n");
		($beforeequals, $afterequals) = split("Vertex",$thing,2);
		#		if (1 || $DEBUGPRINTS) {  print("AFTEREQUALSVERTEXLINE   ***$afterequals\n"); }
		#$afterequals =~ s/\(//;
		#$afterequals =~ s/\)//;
		#		if (1 || $DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$temp_vertex_x = 0;
		$temp_vertex_y = 0;
		$temp_vertex_z = 0;
		
		$temp_num = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
			$temp_num++; #Increase it first
			#	if (1 || $DEBUGPRINTS) {  print("$token\n"); }	
			#	#Getrid of whitespaces etc to get rid of carraigertrn ##
				$token =~ s/\A\s+//s;                           ##
    				$token =~ s/\s+\Z//s;                           ##
			#	#Getrid of whitespaces etc to get rid of carraigertrn ##
		
		    if ($temp_num == 1) {
		    	$temp_vertex_x = 0 + $token; #Adding the 0 gets it into number format
		    } elsif ($temp_num == 2) {
		    	$temp_vertex_y = 0 + $token; 
		    } elsif ($temp_num == 3) {
		    	$temp_vertex_z = 0 + $token; 
		    }
		}
		
		#if (1 || $DEBUGPRINTS) {  print("$temp_vertex_x $temp_vertex_y $temp_vertex_z\n\n"); }
		
		if ($temp_vertex_z > $formover_maximum_seen_vertex_z) {
			$formover_maximum_seen_vertex_z = $temp_vertex_z;
		}
		if ($temp_vertex_x > $formover_maximum_seen_vertex_x) {
			$formover_maximum_seen_vertex_x = $temp_vertex_x;
		}
		if ($temp_vertex_y > $formover_maximum_seen_vertex_y) {
			$formover_maximum_seen_vertex_y = $temp_vertex_y;
		}
		
		if ($temp_vertex_z < $formover_littlest_seen_vertex_z) {
			$formover_littlest_seen_vertex_z = $temp_vertex_z;
		}
		if ($temp_vertex_x < $formover_littlest_seen_vertex_x) {
			$formover_littlest_seen_vertex_x = $temp_vertex_x;
		}
		if ($temp_vertex_y < $formover_littlest_seen_vertex_y) {
			$formover_littlest_seen_vertex_y = $temp_vertex_y;
		}
		
	###############
	#Rotation lines
	} elsif ($isrotationline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSROTATIONLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$rotation_pitch = 0;
		$rotation_yaw = 0;
		$rotation_roll = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'Pitch') {
		    	$rotation_pitch = $afterequals;
		    } elsif ($beforeequals eq 'Yaw') {
		    	$rotation_yaw = $afterequals;
		    } elsif ($beforeequals eq 'Roll') {
		    	$rotation_roll = $afterequals;
		    }
		}
	#speed of rotation for movers and fans
	} elsif ($isrotationrateline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSROTATIONRATELINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$rotationrate_pitch = 0;
		$rotationrate_yaw = 0;
		$rotationrate_roll = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'Pitch') {
		    	$rotationrate_pitch = $afterequals;
		    } elsif ($beforeequals eq 'Yaw') {
		    	$rotationrate_yaw = $afterequals;
		    } elsif ($beforeequals eq 'Roll') {
		    	$rotationrate_roll = $afterequals;
		    }
		}
	#BELOW: FOR MOVER
	} elsif ($iskeyrotline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSKEYROTATIONLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$moverkey_rotation_pitch = 0;
		$moverkey_rotation_yaw = 0;
		$moverkey_rotation_roll = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'Pitch') {
		    	$moverkey_rotation_pitch = $afterequals;
		    } elsif ($beforeequals eq 'Yaw') {
		    	$moverkey_rotation_yaw = $afterequals;
		    } elsif ($beforeequals eq 'Roll') {
		    	$moverkey_rotation_roll = $afterequals;
		    }
		}
	#BELOW: FOR MOVER
	} elsif ($issavedrotline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS) {  print("AFTEREQUALSSAVEDKEYROTATIONLINE   ***$afterequals\n"); }
		$afterequals =~ s/\(//;
		$afterequals =~ s/\)//;
				if ($DEBUGPRINTS) {  print("                      2   ***$afterequals\n\n\n"); }
			
		
		$saved_moverkey_rotation_pitch = 0;
		$saved_moverkey_rotation_yaw = 0;
		$saved_moverkey_rotation_roll = 0;
		
		@tokens = split(/,/, $afterequals);
		foreach my $token (@tokens) {
		    		if ($DEBUGPRINTS) {  print("$token\n"); }
		    ($beforeequals, $afterequals) = split("=",$token,2);
		   		if ($DEBUGPRINTS) {   print("	$beforeequals\n"); }
		   		if ($DEBUGPRINTS) {   print("	$afterequals\n"); }
				
				#Getrid of whitespaces etc to get rid of carraigertrn ##
				$afterequals =~ s/\A\s+//s;                           ##
    				$afterequals =~ s/\s+\Z//s;                           ##
				#Getrid of whitespaces etc to get rid of carraigertrn ##
			
		    if ($beforeequals eq 'Pitch') {
		    	$saved_moverkey_rotation_pitch = $afterequals;
		    } elsif ($beforeequals eq 'Yaw') {
		    	$saved_moverkey_rotation_yaw = $afterequals;
		    } elsif ($beforeequals eq 'Roll') {
		    	$saved_moverkey_rotation_roll = $afterequals;
		    }
		}
	###############
	#
	} elsif ($isencroachdamageline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSENCROACHDMG  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_encroachdamage = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_encroachdamage = $afterequals;
	#
	} elsif ($isdrawscaleline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSDRAWSCALE  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$drawscale = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$drawscale = $afterequals;
	#
	} elsif ($isencroachtypeline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSENCROACHTYPE  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_encroachtype = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		if ($afterequals eq 'ME_CrushWhenEncroach') {
			$mover_encroachtype = 1;
		} elsif ($afterequals eq 'ME_IgnoreWhenEncroach') {
			$mover_encroachtype = 2;
		}
	} elsif ($isbumptypeline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPTYPE  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_bumptype = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		if ($afterequals eq 'BT_AnyBump') {
			$mover_bumptype = 1;
		} elsif ($afterequals eq 'BT_PawnBump') {
			$mover_bumptype = 2;
		}
	} elsif ($ismoverglidetypeline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPTYPE  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_bumptype = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		if ($afterequals eq 'MV_MoveByTime') {
			$mover_moverglidetype = 1;
		}
	} elsif ($ismovetimeline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_movetime = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_movetime = $afterequals;
		$mover_movetimewasset = 1; #sometimes it's 0, so make sure we let know it was read for some movers who have intentionally set it to 0
	} elsif ($isstayopentimeline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_stayopentime = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_stayopentime = $afterequals;
		$mover_stayopentimewasset = 1; #sometimes it's 0, so make sure we let know it was read for some movers who have intentionally set it to 0
	} elsif ($isbpainzoneline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$bpainzone_true_or_false = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$bpainzone_true_or_false = $afterequals;	
	} elsif ($iscoronaline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$bcorona_true_or_false = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$bcorona_true_or_false = $afterequals;
	} elsif ($is_Skin_line) { #for corona
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$lineset_capital_Skin = ''; #for corona
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$lineset_capital_Skin = $afterequals; #for corona
	} elsif ($isdamagepersecondline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$damagepersecond = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$damagepersecond = $afterequals;
		
	
	} elsif ($isanimsequenceline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPEVENT  ***$afterequals\n"); }
				$afterequals =~ s/\"//g; #get rid of " globally in string
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$animsequence = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$animsequence = $afterequals;
		
	} elsif ($isurlline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPEVENT  ***$afterequals\n"); }
				$afterequals =~ s/\"//g; #get rid of " globally in string
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$url = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$url = $afterequals;
		
	} elsif ($isbdamagetriggeredline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_bdamagetriggered = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_bdamagetriggered = $afterequals;
	} elsif ($isdamagethresholdline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSMOVETIME  ***$afterequals\n"); }
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_damagethreshold = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_damagethreshold = $afterequals;
	} elsif ($istagline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSTAG  ***$afterequals\n"); }
				$afterequals =~ s/\"//g;# used g for global #get rid of "  #since set to s///g this gets rid of all "'s in string, not just first
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_tag = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			######$afterequals =~ s/\"//; #Alternate if the above wasnt set to s///g (global) : have to do it again for the back one
		$mover_tag = $afterequals;
	} elsif ($isbumpeventline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPEVENT  ***$afterequals\n"); }
				$afterequals =~ s/\"//g; #get rid of " globally in string
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_bumpevent = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_bumpevent = $afterequals;
	} elsif ($iseventline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPEVENT  ***$afterequals\n"); }
				$afterequals =~ s/\"//g; #get rid of " globally in string
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_event = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$mover_event = $afterequals;
	} elsif ($isinitialstateline_formover) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBUMPEVENT  ***$afterequals\n"); }
				$afterequals =~ s/\"//g; #get rid of " globally in string
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$mover_initialstate = 0;
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		if ($afterequals eq 'BumpButton') {
			$mover_initialstate = 1;
		} elsif ($afterequals eq 'TriggerControl') {
			$mover_initialstate = 2;
		} elsif ($afterequals eq 'StandOpenTimed') {
			$mover_initialstate = 3;
		} elsif ($afterequals eq 'TriggerOpenTimed') {
			$mover_initialstate = 4;
		} elsif ($afterequals eq 'DamageInstigator') {
			$mover_initialstate = 5;
		} elsif ($afterequals eq 'PlaySoundEffect') {
			$mover_initialstate = 6;
		}
	###############
	#Mover sound 
	} elsif ($isopeningsoundline_formover || $isclosingsoundline_formover || $ismoveambientsoundline_formover
	                                      || $isclosingingsoundline_formover ) {
		local $myintermediaryinternoise;
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSAMBIENTSOUNDMOVER  ***$afterequals\n"); }
		$afterequals =~ s/Sound\'//;
		$afterequals =~ s/\'//;
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$myintermediaryinternoise = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$myintermediarynoise = $afterequals;
		
		
			if ($CONVERT_SOME_NOISES_TO_SIMPLER_STRING) {
				if ($PRINTORIGINALSOUNDINFOASCOMMENTIFCONVERTED) {
					if ($isopeningsoundline_formover) { $originalnoisecomment_o = $afterequals; }
					elsif ($isclosingsoundline_formover) {$originalnoisecomment_c = $afterequals; }
					elsif ($ismoveambientsoundline_formover) {$originalnoisecomment_m = $afterequals; }
					elsif ($isclosingingsoundline_formover) {$originalnoisecomment_cc = $afterequals; }
				}
				$afterequals =~ s/Ambancient\.Looping\.//;
				$afterequals =~ s/Ambmodern\.Looping\.//;
				$afterequals =~ s/Amboutside\.Looping\.//;
				$afterequals =~ s/AmbModern\.Looping\.//;
				$afterequals =~ s/ambientmusic\.Package0\.//;
				$afterequals =~ s/urbansnds\.\(All\)\.//;
				
				$afterequals =~ s/AmbAncient\.Looping\.//;
				$afterequals =~ s/AmbOutside\.Looping\.//;
				
				$afterequals =~ s/DoorsAnc\.Other\.//;
				$afterequals =~ s/Doorsanc\.GenericThumps\.//;
				$afterequals =~ s/Doorsanc\.Stone\.//;
				$afterequals =~ s/DoorsAnc\.Wood\.//;
				$afterequals =~ s/Activates\.ClicksSmall\.//;
				
				$afterequals =~ s/Doorsmod\.General\.//;
				$afterequals =~ s/Activates\.ClicksBig\.//;
				
				$afterequals =~ s/DoorsAnc\.GenericThumps\.//;
				$afterequals =~ s/DoorsAnc\.Stone\.//;
				
				$myintermediarynoise = 'sound/UNR_'."$afterequals";
			}
		
		if ($isopeningsoundline_formover) {
			$openingnoise_formover = $myintermediarynoise;
		} elsif ($isclosingsoundline_formover) {
			$closingnoise_formover = $myintermediarynoise;
		} elsif ($ismoveambientsoundline_formover) {
			$moveambientnoise_formover = $myintermediarynoise;
		} elsif ($isclosingingsoundline_formover) {
			$closingingnoise_formover = $myintermediarynoise;
		}
		$myintermediaryinternoise = ''; #reset the local
	###############
	#Sound etc lines
	} elsif ($isambientsoundline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSAMBIENTSOUND  ***$afterequals\n"); }
		$afterequals =~ s/Sound\'//;
		$afterequals =~ s/\'//;
				if ($DEBUGPRINTS)  { print("                      2   ***$afterequals\n\n\n"); }
		
		
		$noise = '';
		#$noise = chomp($afterequals);
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$noise = $afterequals;
		
		
			if ($CONVERT_SOME_NOISES_TO_SIMPLER_STRING) {
				if ($PRINTORIGINALSOUNDINFOASCOMMENTIFCONVERTED) {
					$originalnoisecomment = $afterequals;
				}
				$afterequals =~ s/Ambancient\.Looping\.//;
				$afterequals =~ s/Ambmodern\.Looping\.//;
				$afterequals =~ s/Amboutside\.Looping\.//;
				$afterequals =~ s/AmbModern\.Looping\.//;
				$afterequals =~ s/ambientmusic\.Package0\.//;
				$afterequals =~ s/urbansnds\.\(All\)\.//;
				
				$afterequals =~ s/AmbAncient\.Looping\.//;
				$afterequals =~ s/AmbOutside\.Looping\.//;
				$afterequals =~ s/AmbCity\.Looping\.//;
				$afterequals =~ s/AmbCity\.OneShot\.//;
				
				$noise = 'sound/UNR_'."$afterequals";
			}
		
		if ($dostuff == 4) { 
			$dostuff = 7; 
			$classname = 'target_speaker'; 
		} #Change to ambient sound part instead
	} elsif ($islight_hueline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSHUE  ***$afterequals\n"); }
		$hue = 0;
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			if ($DEBUGPRINTS)  { print("Afterwhitespaceremoval **: $afterequals\n"); }
		$hue = $afterequals;
			if ($DEBUGPRINTS)  { print("huenowequals: $hue\n"); }
			
		$no_color_set_by_map = 0; #colorhasbeenset for light by the map, not defaults
		$recorded_actual_from_file__hue = $afterequals; #for corona
	} elsif ($islight_saturationline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSSATURATION  ***$afterequals\n"); }
		$saturation = 0;
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$saturation = $afterequals;
		#hue was erronously set to afterequals here before # if ($originalerrorsethuetosaturation) { $hue = $afterequals; } #
		#which was used on the tundra rtlights, with the old pre algo
		
		$no_color_set_by_map = 0; #colorhasbeenset for light by the map, not defaults
		$recorded_actual_from_file__saturation = $afterequals; #for corona
	} elsif ($islight_brightnessline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSBRIGHTNESS  ***$afterequals\n"); }
		$brightness = 0;
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$brightness = $afterequals;
		
		$no_color_set_by_map = 0; #colorhasbeenset for light by the map, not defaults
		$recorded_actual_from_file__brightness = $afterequals; #for corona
	} elsif ($islightradiusline) {
		($beforeequals, $afterequals) = split("=",$thing,2);
				if ($DEBUGPRINTS)  { print("ESASAFTEREQUALSLIGHTRADIUS  ***$afterequals\n"); }
		$light_radius = 0;
			#Getrid of whitespaces etc to get rid of carraigertrn ##
			$afterequals =~ s/\A\s+//s;                           ##
    			$afterequals =~ s/\s+\Z//s;                           ##
			#Getrid of whitespaces etc to get rid of carraigertrn ##
		$light_radius = $afterequals;
		
		$no_radius_set_by_map = 0; #radiushasbeenset for light by the map, not defaults
		$recorded_actual_from_file__light_radius = $afterequals; #for corona
	} else {
		#($beforeequals, $afterequals) = split("=",$thing,2);
		($beforeequals, $afterequals) = split("=",$thing);
		#print("   ***$beforeequals\n\n\n");
						if ($DEBUGPRINTS)  { print("   ***$afterequals\n\n\n"); }
		
		if ($beforeequals eq 'Begin Actor Class') {
			$classname = "";
						if ($DEBUGPRINTS)  { print("    **** Eays Begin Actor Class\n"); }
			$TWObeforespace = "";
			$TWOafterspace = "";
			
			#($TWObeforespace, $TWOafterspace) = split("\s+",$afterequals,2);
			#($TWObeforespace, $TWOafterspace) = split("/x",$afterequals,2);
			($TWObeforespace, $TWOafterspace) = split(" Name",$afterequals,2); #hack
			$classname = $TWObeforespace;
				$originalclassname = $classname; #record
				
				##############
					if ($mode == 4) {
						#set name for movers
						my $temp_namebefore;
						my $temp_nameafter;
						$temp_nameafter = '';
						($temp_namebefore, $temp_nameafter) = split(" Name",$thing,2); #hack
		
						$name = $TWOafterspace; #record but not needed
						#print("$thing\n");
						#Getrid of whitespaces etc to get rid of carraigertrn ##
						$temp_nameafter=~ s/\A\s+//s;                           ##
    						$temp_nameafter =~ s/\s+\Z//s;                           ##
						#Getrid of whitespaces etc to get rid of carraigertrn ##
						$temp_nameafter =~ s/\=//s; #get rid of equals sign
						#print("$temp_nameafter\n");
						if ($temp_nameafter eq '') {
							#do nothing
						} elsif ($temp_nameafter) {
							$name = $temp_nameafter
						}
					}
				##############
				
				
				#Light mode
				if (($mode == 1 || $mode == 2) && $classname eq 'Light')  {
					#$classname = 'fullydynamic';
					$classname = 'item_cells';$spawnflags= 1;
					$classname = 'lightsabre_spawnlight';
					#$classname = 'not_null'; #doesn't work with not null
					#$classname = 'info_notnull';  #doesn't work either
					   #some tests	
						#$cubemap = 'somecubemapsomewhere';
						#$corona = 10;
					$dostuff = 1000; #special generic
					$is_light_entity = 1;
				} elsif ($mode == 1 || $mode == 2) {
					#ignore everything else 
				
				} 
				#mover mode
				elsif (($mode == 4) && $classname eq 'Mover')  {
					#$classname = 'fullydynamic';
					#$classname = 'item_cells';$spawnflags= 1;
					#$classname = 'lightsabre_spawnlight';
					#$dostuff = 1004; #special generic
					$is_mover  = 1;
				} elsif (($mode == 4) && $classname eq 'Fan2')  {
					$is_fan  = 1;
				} elsif (($mode == 4) && $classname eq 'RotatingMover')  {
					$is_rotating_mover = 1;
				} elsif ($mode == 4) {
					#ignore everything else 
				
				} 
				#Normal mode
				elsif ($classname eq 'Light')
					{
						$dostuff = 4;
						$is_light_entity = 1;
					}
				elsif ($classname eq 'RocketCan')
					{
						$classname = 'item_rockets';
						$dostuff = 5;
					}
				elsif ($classname eq 'Eightball')
					{
						$classname = 'weapon_ballrktlauncher';
						$dostuff = 5;
					}
				elsif (($classname eq 'Sludge')
				|| ($classname eq 'bioammo') #UT
				|| ($classname eq 'BioAmmo')) #UT Actual
					{
						$classname = 'item_toxic';
						$dostuff = 5;
					}
				elsif ($classname eq 'GESBioRifle')
					{
						$classname = 'weapon_gbserifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'Minigun')
					{
						$classname = 'weapon_cmbn9mgun';
						$dostuff = 5;
					}
				elsif ($classname eq 'AutoMag')
					{
						$classname = 'weapon_pistol';
						$dostuff = 5;
					}
				elsif ($classname eq 'Shellbox')
					{
						$classname = 'item_bullets';
						$dostuff = 5;
					}
				elsif ($classname eq 'BulletBox') #UT 
					{
						$classname = 'item_bullets'; #guess
						$dostuff = 5;
					}
				elsif ($classname eq 'Miniammo') #actual UT
					{
						$classname = 'item_bullets';
						$dostuff = 5;
					}
				elsif ($classname eq 'Rifle')
					{
						$classname = 'weapon_t17mmrifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'RifleRound')
					{
						$classname = 'item_bullets';
						$dostuff = 6; #special case, more information printed
					}
				elsif ($classname eq 'RifleShell') #UT
					{
						$classname = 'item_bullets';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '3';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '1.46';
						$model = 'models/items/casingriflebullet.iqm';
					}
				elsif ($classname eq 'ChainSaw') #UT
					{
						$classname = 'weapon_chainsaw';
						$dostuff = 1001; #special case, more information printed
					}
				#elsif ($classname eq 'Razorjack') #not tested
				elsif ($classname eq 'RazorJack') #It's uppercase
					{
						$classname = 'weapon_razorprjctr';
						$dostuff = 5;
					}
				elsif ($classname eq 'DispersionPistol') #not tested
					{
						$classname = 'weapon_dsprsnpstl';
						$dostuff = 5;
					}
				elsif ($classname eq 'ASMD')
					{
						$classname = 'weapon_asdwrifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'ASMDAmmo')
					{
						$classname = 'item_cells';
						$dostuff = 5;
					}
				elsif ($classname eq 'PAmmo') #green #UT 
					{
						if ($PAMMOUSESREGULAR) {
						$classname = 'item_cells';
						$dostuff = 5;
						} else {
							$dostuff = 1001; #special case, more information printed
							$classname = 'item_cells';
							$specialextrastuffname = 'colormap'; $specialextrastuffamnt = '1139'; #green
							$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '1.3';
							$model = 'models/items/item_cells_electricrifle.iqm';
						}
					}
				elsif ($classname eq 'ShockCore') #purple #UT
					{
						if ($SHOCKCOREUSESREGULAR) {
						$classname = 'item_cells';
						$dostuff = 5;
						} else {
							$dostuff = 1001; #special case, more information printed
							$classname = 'item_cells';
							$specialextrastuffname = 'colormap'; $specialextrastuffamnt = '1029'; #light blue for contrast with the rest which is purple
							$model = 'models/items/item_cells_xonlong.iqm';
						}
					}
				elsif ($classname eq 'Armor')
					{
						$classname = 'item_armor';
						$dostuff = 5;
					}
				elsif ($classname eq 'ThighPads')
					{
						$classname = 'item_armor_small';
						$dostuff = 5;
					}
				elsif ($classname eq 'NaliFruit')
					{
						$classname = 'item_health_small';
						$dostuff = 5;
					}
				elsif ($classname eq 'SuperHealth')
					{
						$classname = 'item_health_mega';
						$dostuff = 5;
					}
				elsif ($classname eq 'HealthPack') #UT
					{
						$classname = 'item_health_mega';
						$dostuff = 5;
					}
				elsif ($classname eq 'HealthVial') #UT
					{
						$classname = 'item_health_small';
						$dostuff = 5;
					}
				elsif (($classname eq 'Health')
				|| ($classname eq 'MedBox')) #UT
					{
						$classname = 'item_health';
						$dostuff = 5;
					}
				elsif (($classname eq 'ShieldBelt')
				|| ($classname eq 'ut_shieldbelt')) #UT
					{
						$classname = 'item_invincible';
						$dostuff = 5;
					}
				elsif ($classname eq 'armor2') #UT
					{
						$classname = 'item_armor_large'; #guess
						$dostuff = 5;
					}
				elsif (($classname eq 'Amplifier')
				|| ($classname eq 'UDamage')) #UT
					{
						$classname = 'item_strength';
						$dostuff = 5;
					}
				elsif ($classname eq 'FlakCannon')
					{
						$classname = 'weapon_fragmentationcannon';
						$dostuff = 5;
					}
				elsif ($classname eq 'Stinger')
					{
						$classname = 'weapon_strkr';
						$dostuff = 5;
					}
				elsif ($classname eq 'PlayerStart')
					{
						$classname = 'info_player_start';
						$dostuff = 5;
						if ($ENABLE_ADD_Z_TOPLAYERSTART) {
							if ($add_z_toplayerstart) {
								$dostuff = 500;
							}
						}
					}
				elsif ($classname eq 'AmbientSound')
					{
						$classname = 'target_speaker';
						$dostuff = 7;	#needs more info pasted
					}
				elsif ($classname eq 'PulseGun') #not tested
					{
						$classname = 'weapon_electricrifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'UT_Eightball') #not tested
					{
						$classname = 'weapon_nineballlauncher';
						$dostuff = 5;
					}
				elsif ($classname eq 'RocketPack') #UT
					{
						$classname = 'item_rockets';
						$dostuff = 5;
					}
				#ammo substitutions
				elsif (($classname eq 'FlakBox') #ammo substitutions
					|| ($classname eq 'flakammo')) #UT
					{
						$classname = 'item_rockets';
						$dostuff = 5;
					}
				#Done below now
				#elsif ($classname eq 'StingerAmmo') #ammo substitutions
				#	{
				#		$classname = 'item_cells';
				#		$dostuff = 5;
				#	}
				elsif ($classname eq 'RifleAmmo') #ammo substitutions
					{
						$classname = 'item_bullets';
						$dostuff = 5;
					}
				#substitutions
				elsif ($classname eq 'UT_FlakCannon') #not tested #substitutions
					{
						$classname = 'weapon_fragmentationcannon';
						$dostuff = 5;
					}
				elsif (($classname eq 'Ripper') #not tested #substitutions
					|| ($classname eq 'ripper')) #actual UT
					{
						$classname = 'weapon_razorprjctr';
						$dostuff = 5;
					}
				elsif ($classname eq 'ShockRifle') #not tested #substitutions
					{
						$classname = 'weapon_asdwrifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'Enforcer') #not tested #substitution... sort of
					{
						$classname = 'weapon_pistol';
						$dostuff = 5;
					}
				elsif (($classname eq 'UT_BioRifle') #not tested #substitutions
				|| ($classname eq 'ut_biorifle')) #actual UT
					{
						$classname = 'weapon_gbserifle';
						$dostuff = 5;
					}
				elsif ($classname eq 'SniperRifle') #not tested #substitutions
					{
						$classname = 'weapon_lrr';
						$dostuff = 5;
						if ($PICKUP_UT_SniperRifle_OPTIONS == 1) {
							$classname = 'weapon_t17mmrifle';
							$dostuff = 5;
						}
					}
				elsif (($classname eq 'Minigun2')   #not tested 
				 ||  ($classname eq 'minigun2')) #actual UT
					{
						$classname = 'weapon_minigunii';
						$dostuff = 5;
					}
				elsif ($classname eq 'WarheadLauncher') #not tested 
					{
						$classname = 'weapon_rdmrrocket';
						$dostuff = 5;
					}
				#Others
				elsif ($classname eq 'SU_1911')
					{
						$classname = 'weapon_bigpistol';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_MP5')
					{
						$classname = 'weapon_pdw';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Aug')
					{
						$classname = 'weapon_styeraug';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Ithaca')
					{
						$classname = 'weapon_ithacastakeout';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Glock')
					{
						$classname = 'weapon_lightpistol';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_RPG7') 
					{
						$classname = 'weapon_rpg7launcher';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Rem308') #substitution
					{
						$classname = 'weapon_m1903';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Grenade') 
					{
						$classname = 'item_fragnades';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Vest') #substitution
					{
						$classname = 'item_armor_large';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Jacket') #substitution
					{
						$classname = 'item_health_small';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_Can') #substitution #guess
					{
						$classname = 'item_rockets';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_AmmoCan9mm') #substitution
					{
						$classname = 'item_bullets';
						$dostuff = 5;
					}
				elsif ($classname eq 'SU_AmmoSingle308')
					{
						$classname = 'item_bullets';
						$dostuff = 7; #special case, more information printed
					}
				elsif ($classname eq 'SU_AmmoLooseShells')
					{
						$classname = 'item_shells';
						$dostuff = 8; #special case, more information printed
					}
				elsif ($classname eq 'SU_AmmoClips223')
					{
						$classname = 'item_bullets';
						$dostuff = 9; #special case, more information printed
					}
				elsif ($classname eq 'SU_AmmoBox9mm')
					{
						$classname = 'item_bullets';
						$dostuff = 10; #special case, more information printed
					}
				elsif ($classname eq 'SU_AmmoClips45') #substitution
					{
						$classname = 'item_bullets';
						$dostuff = 11; #special case, more information printed
					}
				elsif ($classname eq 'EClip') #substitution #enforcer clip
					{
						$classname = 'item_bullets';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '12';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '2';
						$model = 'models/misc/extendedmags/uzimag20.iqm';
					}
				elsif ($classname eq 'SU_AmmoLoose308') #substitution
					{
						$classname = 'item_bullets';
						$dostuff = 12; #special case, more information printed
					}
				
				elsif ($classname eq 'SU_AmmoBox45')
					{
						$classname = 'item_bullets';
						$dostuff = 15; #special case, more information printed
					}
				elsif ($classname eq 'SU_AmmoBoxShells') #substitution
					{
						$classname = 'item_shells';
						$dostuff = 5; 
					}
				elsif ($classname eq 'INFIL_UTMP5')
					{
						$classname = 'weapon_submachinegun';
						$dostuff = 5;
					}
				elsif ($classname eq 'INFIL_UTM16')
					{
						$classname = 'weapon_m16a2';
						$dostuff = 5;
					}
				elsif ($classname eq 'INFIL_UTShotgun')
					{
						$classname = 'weapon_m3shotgun';
						$dostuff = 5;
					}
				elsif ($classname eq 'INFIL_UTM16Clips')
					{
						$classname = 'item_bullets';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '30';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '2';
						$model = 'models/misc/extendedmags/m16mag30.iqm';
					}
				elsif ($classname eq 'INFIL_UTMP5Clips') #substitution
					{
						$classname = 'item_bullets';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '30';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '2';
						$model = 'models/misc/extendedmags/pdwstdmag.iqm';
					}
				elsif ($classname eq 'SmallSteelBox') #substitution
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/SteelBoxM.basescale1.obj_from_mc';
						$dostuff = 1001; #special generic
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5;
					}
				elsif ($classname eq 'SteelBox') #substitution
					{
						if ($STEELBOXBARRELNOSUBSTITUTION == 1) {
						$classname = 'func_wall';
						$model = 'models/fromunreal/SteelBoxM.basescale1.obj_from_mc';
						$dostuff = 1001; #special generic
						$is_model_maybereversez = 2;
						} else {
						$classname = 'building_buildable_by_count';
						$dostuff = 200; 
						$count = 1772; #MTB64U_METAL
						}
						
					}
				elsif ($classname eq 'SteelBarrel') #guess 
					{
						if ($STEELBOXBARRELNOSUBSTITUTION == 1) {
						$classname = 'func_wall';
						$model = 'models/fromunreal/steelbarrelM.basescale1.obj_from_mc';
						$dostuff = 1001; #special generic
						$is_model_maybereversez = 2;
						} else {
						$classname = 'building_buildable_by_count';
						$dostuff = 200; 
						$count = 1819; #MTB64U_INACT_OIL
						}
					}
				elsif ($classname eq 'TarydiumBarrel') #substitution
					{
						if ($TARYDIUMBARRELNOSUBSTITUTION == 1) {
							$classname = 'func_wall';
							#what model is it?
							$model = 'models/fromunrealedits/steelbarrelM_trvrsn.basescale1.obj_from_mc';
							$dostuff = 1001; #special generic
							$is_model_maybereversez = 2;
						} else {
						$classname = 'building_buildable_by_count';
						$dostuff = 200; 
						$count = 1820; #MTB64U_ACT_OIL
						}
					}
				#Some accomadations
				elsif (($classname eq 'RazorAmmo')
				 || ($classname eq 'BladeHopper')) #UT
					{
						$classname = 'item_bullets';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '10';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '3';
						$model = 'models/razor_projectile_side.iqm';
					}
				elsif ($classname eq 'StingerAmmo')
					{
						$classname = 'item_cells';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'ammo_nails'; $specialextrastuffamnt = '10';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '0.75';
						$model = 'models/bluespike.iqm';
					}
				#elsif ($classname eq 'ImpactHammer') #not tested 
				elsif ($classname eq 'NaliStatue')
					{
						$classname = 'func_wall';
						$dostuff = 100; #special case for models, more information printed
						$model = 'models/fromunreal/NaliStatueM_fortundra.basescale1.obj_from_mc';
					
						$dostuff = 1000; #special generic
						$is_model_maybereversez = 2;
					} 
				elsif ($classname eq 'Tapestry1')
					{
						$classname = 'func_wall';
						$dostuff = 100; #special case for models, more information printed
						$model = 'models/fromunreal/Tap_fortundra.basescale1.obj_from_mc';
					
						$dostuff = 1000; #special generic
						$is_model_maybereversez = 2;
					} 
				elsif ($classname eq 'Candle')
					{
						$classname = 'func_wall';
						$dostuff = 100; #special case for models, more information printed
						$model = 'models/fromunreal/CandleM_fortundra.basescale1.obj_from_mc';
					
						$dostuff = 1000; #special generic
						$is_model_maybereversez = 2;
					}  
				#NEWER STUFF FROM UT ETC
				elsif ($classname eq 'Candle2') #guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Candl2.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}   
				elsif ($classname eq 'pipebend') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/pipebendM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5; #Default of entity (UT)
					}       
				elsif ($classname eq 'pipe') #UT #guess #maybe used in a arena
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/pipeM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5; #Default of entity (UT) #GUESS
					}  
				elsif ($classname eq 'lightbox') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/lightboxM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on lightbox
					}   
				elsif ($classname eq 'LightCone') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/lightcone1.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on lightcone
					}     
				elsif ($classname eq 'barrel1') #UT
					{
						$classname = 'func_wall';
						#$model = 'models/fromunrealedits/barrel2M_biows.basescale1.obj_from_mc';
						$model = 'models/fromunreal/barrel1M.basescale1.obj_from_mc';
						
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.25; #Default of entity (UT)
					}       
				elsif ($classname eq 'barrel2') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/barrel2M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.25; #Default of entity (UT)
					}     
				elsif ($classname eq 'barrel3') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/barrel3M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.25; #Default of entity (UT)
					}         
				elsif ($classname eq 'SludgeBarrel') #Unreal, Used in UT too
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/sbarrel.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}           
				elsif ($classname eq 'DevilFish') #Unreal, Used in UT too #substitution
					{
						$classname = 'monster_fish'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}             
				elsif ($classname eq 'BiterFishSchool') #Unreal, Used in UT too #substitution
					{
						$classname = 'monster_fish'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}            
				elsif ($classname eq 'Tentacle') #Unreal, #substitution
					{
						$classname = 'monster_vore'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}             
				elsif ($classname eq 'Krall') #Unreal, #substitution
					{
						$classname = 'monster_goblin_archer'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                
				elsif ($classname eq 'KrallElite') #Unreal, #substitution
					{
						$classname = 'monster_goblin_archer'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}            
				elsif ($classname eq 'Mercenary') #Unreal, #substitution
					{
						#$classname = 'monster_fighter'; #substitution
						$classname = 'monster_solider'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}             
				elsif ($classname eq 'MercenaryElite') #Unreal, #substitution
					{
						#$classname = 'monster_fighter'; #substitution
						$classname = 'monster_solider'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}             
				elsif ($classname eq 'SkaarjGunner') #Unreal, #substitution
					{
						#$classname = 'monster_fighter'; #substitution
						$classname = 'monster_solider'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}             
				elsif ($classname eq 'SkaarjTrooper') #Unreal, #substitution
					{
						#$classname = 'monster_fighter'; #substitution
						$classname = 'monster_solider'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                       
				elsif ($classname eq 'SkaarjWarrior') #Unreal, #substitution
					{
						$classname = 'monster_shinrae'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                           
				elsif ($classname eq 'SkaarjBerserker') #Unreal, #substitution
					{
						$classname = 'monster_shinrae'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                      
				elsif ($classname eq 'SkaarjScout') #Unreal, #substitution
					{
						$classname = 'monster_shinrae'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                        
				elsif ($classname eq 'SkaarjOfficer') #Unreal, #substitution
					{
						$classname = 'monster_shinrae'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}                       
				elsif ($classname eq 'WarLord') #Unreal, #substitution
					{
						$classname = 'monster_wyvern_fire'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}        
				elsif ($classname eq 'LesserBrute') #Unreal, #substitution
					{
						#$classname = 'monster_minotaur'; #substitution
						$classname = 'monster_enforcer'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}         
				elsif ($classname eq 'Brute') #Unreal, #substitution
					{
						#$classname = 'monster_minotaur'; #substitution
						$classname = 'monster_enforcer'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
						#prob redundant as we aren't using dscale here
						$specialextrastuffname = 'scale'; 
						$specialextrastuffamnt = '2';
					}         
				elsif ($classname eq 'Behemoth') #Unreal, #substitution
					{
						#$classname = 'monster_minotaur'; #substitution
						#$classname = 'monster_enforcer'; #substitution
						$classname = 'monster_biledemon'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						#$specialextrastuffname = 'scale'; 
						#$specialextrastuffamnt = '2';
						$pre_drawscale = 1.3; #Default of entity (Unreal)
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}         
				elsif ($classname eq 'Gasbag') #Unreal, #substitution
					{
						#$classname = 'monster_minotaur'; #substitution
						#$classname = 'monster_enforcer'; #substitution
						$classname = 'monster_ogre'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}            
				elsif ($classname eq 'GiantGasbag') #Unreal, #substitution
					{
						#$classname = 'monster_minotaur'; #substitution
						#$classname = 'monster_enforcer'; #substitution
						$classname = 'monster_ogre'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$pre_drawscale = 3; #Default of entity (Unreal)
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}         
				elsif ($classname eq 'StoneTitan') #Unreal, #substitution
					{
						$classname = 'monster_golem'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$specialextrastuffname = 'stoned'; 
						$specialextrastuffamnt = '1';
						$specialextrastuffname0 = 'scale'; 
						$specialextrastuffamnt0 = '2';
						$specialextrastuffname1 = 'skin'; 
						$specialextrastuffamnt1 = '3';
						$specialextrastuffname2 = 'stoneskin'; 
						$specialextrastuffamnt2 = '3';
						$specialextrastuffname3 = 'strevive_speed'; 
						$specialextrastuffamnt3 = '100';
						#prob redundant as we aren't using dscale here
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}         
				elsif ($classname eq 'Titan') #Unreal, #substitution
					{
						$classname = 'monster_golem'; #substitution
						$dostuff = 1001; #special case, more information printed #substitution
						$setsolidkeepdefaultevenifdscale = 1; #Don't change solid type on monster
					}
				elsif ($classname eq 'brick') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/brickM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.15; #Default of entity (UT)
					}     
				elsif ($classname eq 'pylon') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/PylonM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'U') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/U.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'Challenge') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/challengeM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.2; #Default of entity (UT)
					}     
				elsif ($classname eq 'deathmatchtrophy') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/deathmatchtrophyM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.2; #Default of entity (UT)
					}     
				elsif ($classname eq 'car03') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/car03M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'CrucifiedNali') #Unreal
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/CrossNali.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'Book') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/BookM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}         
				elsif ($classname eq 'YellowBook') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunrealedits/BookM_Y.basescale1.obj_from_mc'; 
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}           
				elsif ($classname eq 'BlueBook') #Unreal #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunrealedits/BookM_B.basescale1.obj_from_mc'; 
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}             
				elsif ($classname eq 'GreenBook') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunrealedits/BookM_G.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}             
				elsif ($classname eq 'RedBook') #Unreal #Guess #Guess #Guess #does it exist, incase it does here
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/BookM.basescale1.obj_from_mc'; #same as normal book
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}         
				elsif ($classname eq 'WoodenBox') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/WoodenBoxM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}          
				elsif ($classname eq 'MedWoodBox') #Unreal #Guess #GUESS  #GUESS  #GUESS 
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/WoodenBoxM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.7; #Default of entity (Unreal)
					}           
				elsif ($classname eq 'SmallWoodBox') #Unreal #Guess #GUESS  #GUESS  #GUESS 
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/WoodenBoxM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5; #Default of entity (Unreal)
					}            
				elsif ($classname eq 'Chest') #Unreal #Guess 
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/ChestM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Table') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Table1.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'Chair') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Chair1.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Barrel') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/BarrelM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}      
				elsif ($classname eq 'Sign1') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Sign1M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}    
				elsif ($classname eq 'redtapestry') #Unreal UT #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunrealedits/Tap_fortundra_R.basescale1.obj_from_mc'; #seems to be the same but different texture
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'shieldd') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/shieldM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'Sconce') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/sconceM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}       
				elsif ($classname eq 'Vase') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/vaseM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}            
				elsif ($classname eq 'Pottery0') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Pottery0M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Pottery1') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Pottery1M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Pottery2') #Unreal #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Pottery2M.basescale1.obj_from_mc'; #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Urn') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/UrnM.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree1') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree1M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree2') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree2M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree3') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree3M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree4') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree4M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree5') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree5M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree6') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree6M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree7') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree7M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree8') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree8M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree9') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree9M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree10') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree10M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree11') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree11M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Tree12') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Tree12M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}               
				elsif ($classname eq 'Plant1') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant1M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                 
				elsif ($classname eq 'Plant2') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant2M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                
				elsif ($classname eq 'Plant3') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant3M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                 
				elsif ($classname eq 'Plant4') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant4M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                       
				elsif ($classname eq 'Plant5') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant5M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                   
				elsif ($classname eq 'Plant6') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant6M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}                  
				elsif ($classname eq 'Plant7') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Plant7M.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'TorchFlame') #Unreal #Guess #Guess #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/TFlameM.basescale1.obj_from_mc'; #Guess #Guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}
				elsif ($classname eq 'brazier') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/brazierM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5;
					}     
				elsif ($classname eq 'Diamond') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Diamond.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}          
				elsif ($classname eq 'Moon') #Unreal
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Moon1.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 2;
					}             
				elsif ($classname eq 'Moon2') #UT #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunrealedits/Moon1_2.basescale1.obj_from_mc'; #usesskin moontwo
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}        
				elsif ($classname eq 'Moon3') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Moon3M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.15;
					}             
				elsif ($classname eq 'tubelight') #UT
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/tubelightM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5;
					}              
				elsif ($classname eq 'tubelight2') #UT #guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/tubelight2M.basescale1.obj_from_mc'; #guess
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
						$pre_drawscale = 0.5;
					} 
				elsif ($classname eq 'OctGem') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/OctGem.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}  
				elsif ($classname eq 'Crystal') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Crystal.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'CubeGem') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/CubeGem.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}     
				elsif ($classname eq 'DiscStud') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/DiscStud.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}        
				elsif ($classname eq 'OctStud') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/OctStud.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}  
				elsif ($classname eq 'Arrow') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/ArrowM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}  
				elsif ($classname eq 'Lamp4') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Lamp4M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}   
				elsif ($classname eq 'Lantern2') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Lantern2M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'ICBM') #UT #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/icbmM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Flag1') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Flag1M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Flag2') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Flag2M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Flag3') #Unreal #Guess
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/Flag3M.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					} 
				elsif ($classname eq 'Shell') #UT #Guess #Decorative big shell, not a pickup WWII
					{
						$classname = 'func_wall';
						$model = 'models/fromunreal/shellM.basescale1.obj_from_mc';
					
						$dostuff = 1001; #special case, more information printed
						$is_model_maybereversez = 1;
					}
				#END NEWER STUFF FROM UT ETC
				elsif ($classname eq 'MinigunCannon') #substitution
					{
						$classname = 'turret_machinegun';
						$dostuff = 1001; #special case, more information printed
					}  
				elsif ($classname eq 'INFIL_UTM2_50') #substitution
					{
						$classname = 'mountedgun_browning50';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'spawnflags'; 
						$specialextrastuffamnt = '32'; #pintel mount
						#$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '2';
						#$model = 'models/misc/extendedmags/pdwstdmag.iqm';
					}
				elsif ($classname eq 'SeaWeed')
					{
						if ($SEAWEEDNOSUBSTITUTION) {
							$classname = 'func_clientillusionary'; #nonsolid
							$model = 'models/fromunreal/SeaWeedM.basescale1.obj_from_mc';
							$dostuff = 1001; #special case, more information printed
							$is_model_maybereversez = 2;
						} else {
						$classname = 'foliage_dypbush'; #substitution
						$dostuff = 1001; #special generic
						$specialextrastuffname = 'scale'; $specialextrastuffamnt = '0.99';
						$specialextrastuffname0 = 'scale'; $specialextrastuffamnt0 = '0.99';
						}
					}  
				elsif ($classname eq 'WaterZone' && $DOWATERLAVASLIMEZONES) #substitution
					{
						$classname = 'xyz_autofill';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'xyz_autofill_spawn'; 
						$specialextrastuffamnt = 'func_servercontents_water';
						if ($WATERLAVASLIMEZONESAREPRINTEDATEND) {
							$change_standard_output = 1; #so we will print to an in memory file handle
						}
					}  
				elsif ($classname eq 'LavaZone' && $DOWATERLAVASLIMEZONES) #substitution
					{
						$classname = 'xyz_autofill';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'xyz_autofill_spawn'; 
						$specialextrastuffamnt = 'func_servercontents_lava';
						if ($WATERLAVASLIMEZONESAREPRINTEDATEND) {
							$change_standard_output = 1; #so we will print to an in memory file handle
						}
					}  
				elsif ($classname eq 'SlimeZone' && $DOWATERLAVASLIMEZONES) #substitution
					{
						$classname = 'xyz_autofill';
						$dostuff = 1001; #special case, more information printed
						$specialextrastuffname = 'xyz_autofill_spawn'; 
						$specialextrastuffamnt = 'func_servercontents_slime';
						if ($WATERLAVASLIMEZONESAREPRINTEDATEND) {
							$change_standard_output = 1; #so we will print to an in memory file handle
						}
					}  
				elsif ($classname eq 'ZoneInfo' && $DOZONEINFOHURT)
				#//&& ($bpainzone_true_or_false))# != 0 && $bpainzone_true_or_false eq 'True')) #substitution
					{
						$is_zoneinfo_maybehurt = 1; #special case, more information printed
					}
				else 
					{
						if ($IGNOREPATHNODES && ($classname eq 'PathNode')) {
							#nothing
						} elsif ($IGNORELEVELINFO && ($classname eq 'LevelInfo')) {
							#nothing
						} elsif ($IGNOREZONEINFO && ($classname eq 'ZoneInfo')) {
							#nothing
						} else {
					$dostuff = 3;
							if ($classname eq 'Teleporter' || $classname eq 'VisualTeleporter')
							{
								$is_allowed_even_if_not_mover = 1; #So we may record event, tag, etc
							}
						}
						$originalclassname = ''; #reset it
				}
		}
	}
	
	



if ($mode == 0 && $classname eq 'Light' && $endnow == 1) {
	#Do nothing
} elsif (($mode == 4 && $endnow == 1 && ($is_mover || $is_fan || $is_rotating_mover)) 
|| ($mode == 0 && $endnow == 1)) {
	#Strip out the default lightinfo etc 
	$brightness = 0;  #LightBrightness 64
	$hue = 0; 	   #LightHue	0
	$saturation = 0; #LightSaturation 255
	$light_radius = 0; #LightRadius 64
}

if ($mode == 4 && $endnow == 1 && ($is_mover || $is_fan || $is_rotating_mover)) {
	my $temp_mover_prefix;
	$temp_mover_prefix = '';
	$infooriginal_mover_rotation_pitch = $rotation_pitch ;
	$infooriginal_mover_rotation_yaw = $rotation_yaw;
	$infooriginal_mover_rotation_roll = $rotation_roll;
	
	#determine if we are a type of mover we know of
	#first a fan, the movers are below this block
	if ($is_fan) {
		#these are somewhat guesses
		my $tempprefixforfan = '';
		print("//#isfan, NOTE: perhaps comment out angles line and scale line if you exported from map\n");
		$classname = 'func_rotating';
		soundguessfornoiseofrotatingdoortrapmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		#less normal
		if ($rotationrate_pitch && $rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess2
			$speed += &unr_rotation_to_deg ($rotationrate_yaw);  #guess2
			$speed += &unr_rotation_to_deg ($rotationrate_roll);  #guess2
			$spawnflags = 12; #x+y axis			     #guess2
			$tempprefixforfan = 'pitchyawroll1';
		} elsif ($rotationrate_pitch && $rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess
			$speed += &unr_rotation_to_deg ($rotationrate_yaw);  #guess
			$spawnflags = 12; #x+y axis			     #guess
			$tempprefixforfan = 'pitchyaw1';
		#more normal
		} elsif ($rotationrate_pitch) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess
			$spawnflags = 4; #x axis? 			   #guess
			$tempprefixforfan = 'pitch1';			     #guess
		} elsif ($rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_yaw); #guess
			$spawnflags = 8; #y axis? 			   #guess
			$tempprefixforfan = 'yaw1';
		} elsif ($rotationrate_roll) {
			$speed = &unr_rotation_to_deg ($rotationrate_roll);
			$tempprefixforfan = 'roll1';
			
			if ($reverse_fan_roll_speed_asthetics_obj_from_mc) {
				#Multip by -1 because models are reversed in obj_from_mc because quake vs regular is reversed?
				$speed *= -1; #note: asthetic choice
			}
		}
		$model = "$tempprefixforfan".'fanexport'."$name".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		if ($drawscale) {
			$specialextrastuffname2 = 'scale';
			$specialextrastuffamnt2 = $drawscale; 
		}
		#speedguessformovers();
	} elsif ($is_rotating_mover) {
		#these are huge guesses and copied from the above
		#needs work for axis and everything
		my $tempprefixforfan = '';
		print("//#ROTATING MOVER\n");
		$classname = 'func_rotating';
		soundguessfornoiseofrotatingdoortrapmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		#less normal
		if ($rotationrate_pitch && $rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess2
			$speed += &unr_rotation_to_deg ($rotationrate_yaw);  #guess2
			$speed += &unr_rotation_to_deg ($rotationrate_roll);  #guess2
			$spawnflags = 12; #x+y axis			     #guess2
			$tempprefixforfan = 'pitchyawroll1';
		} elsif ($rotationrate_pitch && $rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess
			$speed += &unr_rotation_to_deg ($rotationrate_yaw);  #guess
			$spawnflags = 12; #x+y axis			     #guess
			$tempprefixforfan = 'pitchyaw1';
		#more normal
		} elsif ($rotationrate_pitch) {
			$speed = &unr_rotation_to_deg ($rotationrate_pitch); #guess
			$spawnflags = 4; #x axis? 			   #guess
			$tempprefixforfan = 'pitch1';			     #guess
		} elsif ($rotationrate_yaw) {
			$speed = &unr_rotation_to_deg ($rotationrate_yaw); #guess
			#$spawnflags = 8; #y axis? 	#setting spawnflags for this (yaw) was not correct for rotating_mover
			#spawnflags is 0 (zero) for this for rotating_mover it seems
			$tempprefixforfan = 'yaw1';
		} elsif ($rotationrate_roll) {
			$speed = &unr_rotation_to_deg ($rotationrate_roll);
			$tempprefixforfan = 'roll1';
			
			if ($reverse_fan_roll_speed_asthetics_obj_from_mc) {
				#Multip by -1 because models are reversed in obj_from_mc because quake vs regular is reversed?
				$speed *= -1; #note: asthetic choice
			}
		}
		#$model = "$tempprefixforfan".'rotatingmoverexport'."$name".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		#$model = 'RotatingMover'."$name".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		print("//#"."$tempprefixforfan".' name: '."$name\n");
		$model = 'RotatingMover'.'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		if ($drawscale) {
			$specialextrastuffname2 = 'scale';
			$specialextrastuffamnt2 = $drawscale; 
		}
		#speedguessformovers();
	#determine if we are a type of mover we know of
	} elsif ( (!($moverkey_rotation_pitch) && #not set
	!($moverkey_rotation_yaw) &&	     #not set
	$moverkey_rotation_roll)	     #set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(($moverkey_pos_origin_x == 0) && #notset sliding 
	($moverkey_pos_origin_y == 0)   && #notset sliding 
	($moverkey_pos_origin_z == 0)) #notset sliding 
	) {
		#seems to be a trap floor rotating
		if ($comment_mover_information ) {
		print('//#');
		print("XXXX $mover_tag");
			if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
				if ($name eq '') { 
					# do nothing
				} else {
					print(' ');
					print('name: '."$name");
				}
				$did_mover_name_allready = 1;
			}
		print("\n");
		}
		
		#sets the prefix of the model to mover_tag by default, or name if there is none
		if ($mover_tag eq '') {
			if ($name eq '') {
			} else {
				#second choice
				$temp_mover_prefix = $name;
			}
		} else {	
			#first choice
			$temp_mover_prefix = $mover_tag;
		}
		
		$classname = 'func_door_rotating';
		$rotation_yaw = &rotation_convert($moverkey_rotation_roll); #angles x y z
		$rotation_yaw *= -1;
		$spawnflags = 64;
		$force_angles_rather_than_angle = 1;
		$no_angle_conversion_allready_done = 1;
		$targetname = $mover_tag;
		$model = "$temp_mover_prefix".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofrotatingdoortrapmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
	}
	
	elsif ( ( $moverkey_rotation_pitch &&  #set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(($moverkey_pos_origin_x == 0) && #notset sliding 
	($moverkey_pos_origin_y == 0)   && #notset sliding 
	($moverkey_pos_origin_z == 0)) #notset sliding 
	) {
		#seems to be a trap floor rotating
		if ($comment_mover_information ) {
		print('//#');
		print("YYYY $mover_tag");
			if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
				if ($name eq '') { 
					# do nothing
				} else {
					print(' ');
					print('name: '."$name");
				}
				$did_mover_name_allready = 1;
			}
		print("\n");
		}
		
		#sets the prefix of the model to mover_tag by default, or name if there is none
		if ($mover_tag eq '') {
			if ($name eq '') {
			} else {
				#second choice
				$temp_mover_prefix = $name;
			}
		} else {	
			#first choice
			$temp_mover_prefix = $mover_tag;
		}
		
		$classname = 'func_door_rotating';
		$rotation_yaw = &rotation_convert($moverkey_rotation_pitch); #angles x y z
		$rotation_yaw *= -1;
		$spawnflags = 128;
		$force_angles_rather_than_angle = 1;
		$no_angle_conversion_allready_done = 1;
		$targetname = $mover_tag;
		$model = "$temp_mover_prefix".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofrotatingdoortrapmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
	}
	
	#button (twilight)
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 2) #ME_IgnoreWhenEncroach
	&&
	($mover_bumptype == 1) #BT_AnyBump
	&&
	($mover_initialstate == 1) #BumpButton
	&&
	(($moverkey_pos_origin_x) || #one of these set sliding 
	($moverkey_pos_origin_y)   || #one of these set sliding 
	($moverkey_pos_origin_z)) #one of these set sliding 
	) {
		$classname = 'func_button';
		$target = $mover_bumpevent;
		
		#Some info
			if ($comment_mover_information ) {
			print('//#');
			if ($mover_bumpevent eq '') {
				print("BBBB button");
			} else {
				print("BBBB Button for $mover_bumpevent");
			}
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
			}
		#end info
		
		if ($mover_bumpevent eq '') {
			if ($name eq '') {
				$temp_mover_prefix = 'button';
			} else {
				#second choice
				$temp_mover_prefix = $name;
				$temp_mover_prefix = ('Button'."$name");
			}
		} else {	
			#first choice
			$temp_mover_prefix = ('Button'.'_for'.'_'."$mover_bumpevent");
		}
		
		$model = "$temp_mover_prefix".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		soundguessfornoiseofrotatingdoortrapmovers();
		setmovetimeifnotset();
		speedguessformovers();
		$dostuff=1001;
		
		if (($moverkey_pos_origin_x) &&   #set
		!($moverkey_pos_origin_y) &&	     #not set
		!($moverkey_pos_origin_z)) {	     #not set
			# X
			if ($moverkey_pos_origin_x < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 180;
			}elsif ($moverkey_pos_origin_x > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 0;
			}
		} elsif (!($moverkey_pos_origin_x) &&   #not set
		($moverkey_pos_origin_y) &&	     #set
		!($moverkey_pos_origin_z)) {	     #not set
			#Y
			if ($moverkey_pos_origin_y < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -90;
			}elsif ($moverkey_pos_origin_y > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 90;
			}
		#ADDED, not in the map, not tested
		} elsif (!($moverkey_pos_origin_x) &&   #not set
		!($moverkey_pos_origin_y) &&	     #not set
		($moverkey_pos_origin_z)) {	     #not set
			#Z
			if ($moverkey_pos_origin_z < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -2; #Down
			}elsif ($moverkey_pos_origin_z > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -1; #up
			}
		}
		#} elsif (!($moverkey_pos_origin_x) &&   #not set
		#!($moverkey_pos_origin_y) &&	     #not set
		#!($moverkey_pos_origin_z)) {	     #not set
		#
		#} elsif (!($moverkey_pos_origin_x) &&   #not set
		#!($moverkey_pos_origin_y) &&	     #not set
		#!($moverkey_pos_origin_z)) {	     #not set
		#
		#}
	}
	#crusher (twilight)
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 1)
	&&
	($mover_initialstate == 4) #Trigger open timed
	&&
	(!($mover_bumptype))
	&&
	($mover_encroachdamage)
	&&
	($mover_tag)
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos_origin_z < 0) #is negative
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) {	
		#though this really goes down
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		#$specialextrastuffamnt3 = $moverkey_pos_origin_z + $tempamnt;
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z + $tempamnt)*-1;
		
		$classname = 'func_door';
		$targetname = $mover_tag;
		$model = "$mover_tag".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("CCCC Crusher ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	}
	#lift (twilight)
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(!($mover_encroachtype)) #none set
	&&
	#(!($mover_bumptype)) #none set #added #edit commented out to be useable by more lifts
	#&&                                    #edit commented out to be useable by more lifts
	(!($mover_encroachdamage)) #none set
	#//&&
	#//($mover_tag)
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos_origin_z > 0) #is positive
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) {
		my $templiftaddedinfo = '';
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		$omitangles_allready_set_angle = 1; #for movers
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher
		
		$classname = 'func_door';
		#$targetname = $mover_tag;
		if ( (!($mover_bumptype)) ) {
			$templiftaddedinfo = '';
		} else {
			$templiftaddedinfo = $mover_bumptype.$model;
		}
		$model = "Lift"."$templiftaddedinfo".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("LLLL Lift$templiftaddedinfo ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	}
	#door (sliding, 90 degrees) (dmelsnore)
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	#&&							#edit commented out to be useable by more doors
	#($mover_encroachtype == 2) #ME_IgnoreWhenEncroach	#edit commented out to be useable by more doors
	&&
	(!($mover_bumptype)) #none set #added
	&&
	(!($mover_encroachdamage)) #none set
	&&
	(  ( ($moverkey_pos_origin_x && (!($moverkey_pos_origin_y)) )  || #one of these set sliding 
	   ($moverkey_pos_origin_y && (!($moverkey_pos_origin_x)) ) )  && #one of these set sliding 
	   (!($moverkey_pos_origin_z) )) #notset
	&&
	($formover_maximum_seen_vertex_x || $formover_littlest_seen_vertex_x
	|| $formover_maximum_seen_vertex_y || $formover_littlest_seen_vertex_y) #has a size
	#doesn't have other keys after
	&& (!($moverkey_pos2_origin_x))
	&& (!($moverkey_pos2_origin_y))
	&& (!($moverkey_pos2_origin_z))
	) {
		if ($moverkey_pos_origin_y) {
			if ($moverkey_pos_origin_y < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -90;
			} elsif ($moverkey_pos_origin_y > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 90;
			}
		} elsif ($moverkey_pos_origin_x) { #guess
			if ($moverkey_pos_origin_x < 0) { #negative #guess
				$specialextrastuffname2 = 'angle'; #guess
				$specialextrastuffamnt2 = 180; #guess2 #guess2 #previously was 0 and was wrong
			} elsif ($moverkey_pos_origin_x > 0) { #positive #guess
				$specialextrastuffname2 = 'angle'; #guess
				$specialextrastuffamnt2 = 0; #guess2 #previously was 180 and was wrong
			}
		}
		$omitangles_allready_set_angle = 1; #for movers
		
		$classname = 'func_door';
		$model = "Door".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("DDDD Door ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	}
	#secretdoor (sliding, 90 degrees) (dmelsnore)
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(!($mover_encroachtype)) #none set
	&&
	($mover_initialstate == 4) #Trigger open timed
	&&
	(!($mover_bumptype)) #none set #added
	&&
	(!($mover_encroachdamage)) #none set
	&&
	#first part
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos_origin_z < 0) #is negative
	&&
	#second part
	((!($moverkey_pos2_origin_x)) && #notset
	($moverkey_pos2_origin_y)  && #one of these set sliding
	($moverkey_pos2_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos2_origin_z < 0) #is negative same as before really
	&&
	($moverkey_pos2_origin_y > 0) #is positive sliding
	&&
	($formover_maximum_seen_vertex_x || $formover_littlest_seen_vertex_x
	|| $formover_maximum_seen_vertex_y || $formover_littlest_seen_vertex_y
	|| $formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) {
		$spawnflags = 4;
		
		$classname = 'func_door_secret';
		$model = "SecretDoor".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		soundguessfornoiseofsecretdoormovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("SSSS SecretDoor ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	}
	#secretdoor2 (sliding, should be back and up, but...) ()
	elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(!($mover_encroachtype)) #none set
	&&
	($mover_initialstate == 4) #Trigger open timed
	&&
	(!($mover_bumptype)) #none set #added
	&&
	(!($mover_encroachdamage)) #none set
	&&
	#first part
	((($moverkey_pos_origin_x)) && #set
	(!($moverkey_pos_origin_y))  && #notset
	(!($moverkey_pos_origin_z))) #notset
	&&
	($moverkey_pos_origin_x > 0) #is positive
	&&
	#second part
	((($moverkey_pos2_origin_x)) && #set
	(!($moverkey_pos2_origin_y))  && #notset
	($moverkey_pos2_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos2_origin_z > 0) #is positive
	&&
	($moverkey_pos2_origin_x> 0) #is positive sliding
	&&
	($formover_maximum_seen_vertex_x || $formover_littlest_seen_vertex_x
	|| $formover_maximum_seen_vertex_y || $formover_littlest_seen_vertex_y
	|| $formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) {
		$spawnflags = 0;
		
		$classname = 'func_door_secret';
		$model = "SecretDoor2".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		soundguessfornoiseofsecretdoormovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		$omitangles_allready_set_angle = 1; #for movers
		#$force_angles_rather_than_angle = 1;
		#$no_angle_conversion_allready_done = 1;
		$specialextrastuffname2 = 'angles';
		$specialextrastuffamnt2 = "-90 90 0";
		
		if ($comment_mover_information ) {
			print('//#');
			print("SSSS SecretDoor2 ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	#button (letting)
	} elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_moverglidetype == 1) #MV_MoveByTime 
	&&
	#($mover_encroachtype == 2) #ME_IgnoreWhenEncroach 	#omitted for letting
	#&& 							#omitted for letting
	($mover_bumptype == 1 || #BT_AnyBump
	$mover_bumptype == 2) #BT_PawnBump
	&&
	#($mover_initialstate == 1) #BumpButton	#omitted for letting
	#&&					#omitted for letting
	(($moverkey_pos_origin_x) || #one of these set sliding 
	($moverkey_pos_origin_y)   || #one of these set sliding 
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	($mover_event) #for letting
	) {
		$classname = 'func_button';
		$target = $mover_event;
		
		#Some info
			if ($comment_mover_information ) {
			print('//#');
			if ($mover_bumpevent eq '') {
				print("BBBB2 button");
			} else {
				print("BBBB2 Button for $mover_bumpevent");
			}
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
			}
		#end info
		
		if ($mover_bumpevent eq '') {
			if ($name eq '') {
				$temp_mover_prefix = 'button';
			} else {
				#second choice
				$temp_mover_prefix = $name;
				$temp_mover_prefix = ('Button'."$name");
			}
		} else {	
			#first choice
			$temp_mover_prefix = ('Button'.'_for'.'_'."$mover_bumpevent");
		}
		
		$model = "$temp_mover_prefix".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		soundguessfornoiseofrotatingdoortrapmovers();
		setmovetimeifnotset();
		speedguessformovers();
		$dostuff=1001;
		
		if (($moverkey_pos_origin_x) &&   #set
		!($moverkey_pos_origin_y) &&	     #not set
		!($moverkey_pos_origin_z)) {	     #not set
			# X
			if ($moverkey_pos_origin_x < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 180;
			}elsif ($moverkey_pos_origin_x > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 0;
			}
			$omitangles_allready_set_angle = 1; #for movers #not tested here
		} elsif (!($moverkey_pos_origin_x) &&   #not set
		($moverkey_pos_origin_y) &&	     #set
		!($moverkey_pos_origin_z)) {	     #not set
			#Y
			if ($moverkey_pos_origin_y < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -90;
			}elsif ($moverkey_pos_origin_y > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 90;
			}
			$omitangles_allready_set_angle = 1; #for movers #not tested here
		} elsif (!($moverkey_pos_origin_x) &&   #not set
		!($moverkey_pos_origin_y) &&	     #not set
		($moverkey_pos_origin_z)) {	     #not set
			#Z
			if ($moverkey_pos_origin_z < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -2; #Down
			}elsif ($moverkey_pos_origin_z > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -1; #up
			}
			$omitangles_allready_set_angle = 1; #for movers
		} #elsif (!($moverkey_pos_origin_x) &&   #not set
		#!($moverkey_pos_origin_y) &&	     #not set
		#!($moverkey_pos_origin_z)) {	     #not set
		#
		#}
	#crusher (sliding, 90 degrees) (letting)
	} elsif ( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 1)
	&&
	($mover_initialstate == 4) #Trigger open timed
	&&
	($mover_moverglidetype == 1) #MV_MoveByTime
	&&
	($mover_encroachdamage)
	&&
	($mover_encroachdamage)
	&&
	($mover_tag)
	&&
	(  ( ($moverkey_pos_origin_x && (!($moverkey_pos_origin_y)) )  || #one of these set sliding 
	   ($moverkey_pos_origin_y && (!($moverkey_pos_origin_x)) ) )  && #one of these set sliding 
	   (!($moverkey_pos_origin_z) )) #notset
	&&
	($formover_maximum_seen_vertex_x || $formover_littlest_seen_vertex_x
	|| $formover_maximum_seen_vertex_y || $formover_littlest_seen_vertex_y) #has a size
	#doesn't have other keys after
	&& (!($moverkey_pos2_origin_x))
	&& (!($moverkey_pos2_origin_y))
	&& (!($moverkey_pos2_origin_z))
	) {
		if ($moverkey_pos_origin_y) {
			if ($moverkey_pos_origin_y < 0) { #negative
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = -90;
			} elsif ($moverkey_pos_origin_y > 0) { #positive
				$specialextrastuffname2 = 'angle';
				$specialextrastuffamnt2 = 90;
			}
			
			#Nolip for some reason...
			#my $tempamnt;
			#$tempamnt = $formover_littlest_seen_vertex_y - $formover_maximum_seen_vertex_y;
			#$specialextrastuffname3 = 'lip';
			#$specialextrastuffamnt3 = $moverkey_pos_origin_y + $tempamnt;
			##$specialextrastuffamnt3 = ($moverkey_pos_origin_y + $tempamnt)*-1;
			
		} elsif ($moverkey_pos_origin_x) { #guess
			if ($moverkey_pos_origin_x < 0) { #negative #guess
				$specialextrastuffname2 = 'angle'; #guess
				$specialextrastuffamnt2 = 180; #guess2 #guess2 #previously was 0 and was wrong
			} elsif ($moverkey_pos_origin_x > 0) { #positive #guess
				$specialextrastuffname2 = 'angle'; #guess
				$specialextrastuffamnt2 = 0; #guess2 #previously was 180 and was wrong
			}
			
			#Nolip for some reason...
			#my $tempamnt;
			#$tempamnt = $formover_littlest_seen_vertex_x - $formover_maximum_seen_vertex_x;
			#$specialextrastuffname3 = 'lip';
			#$specialextrastuffamnt3 = $moverkey_pos_origin_x + $tempamnt;
			##$specialextrastuffamnt3 = ($moverkey_pos_origin_x + $tempamnt)*-1;
		}
		$omitangles_allready_set_angle = 1; #for movers
		
		$classname = 'func_door';
		$targetname = $mover_tag;
		$model = "CrusherS".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("CCCC2 Crusher Sliding ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	### (tall towa)
	} elsif (($ALLOW_DESTRUCTABLES_MOVERS == 1) && #we know there are destructables and have enabled searching for them
		(
		(($mover_basepos_origin_x) || #these always seem to be set, adding just in case for this mover type
		($mover_basepos_origin_y)  || #these always seem to be set, adding just in case for this mover type
		($mover_basepos_origin_z))    #these always seem to be set, adding just in case for this mover type
		&& ($moveambientnoise_formover eq '') #not set
		&& ($openingnoise_formover eq '') #not set
		&& ($closingnoise_formover eq '') #not set
		&& ($closingingnoise_formover eq '') #not set
		&&
		(!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 2) #ME_IgnoreWhenEncroach
	&&
	($mover_initialstate == 4) #Trigger open timed
	&&
	#($mover_moverglidetype == 1) #MV_MoveByTime #set #commented out to allow ones that don't have this (a second error)
	#&& 					     #set #commented out to allow ones that don't have this (a second error)
	(!($mover_encroachdamage)) #not set
	&&
	#(!($mover_tag)) #not set #commented out after to allow tags (an error but...)
	#&&
	(((!($mover_movetime)) || ($mover_movetime == 0) || ($mover_movetime eq '0.000000'))  #set to 0
	&& ($mover_movetimewasset == 1))  #but was read from file
	&&
	($mover_bdamagetriggered) #set
	&&
	#($mover_damagethreshold) #set #commented out to allow ones that don't have this (a second error)
	#&&                       #set #commented out to allow ones that don't have this (a second error)
	($mover_stayopentime  		#set to something
	&& $mover_stayopentimewasset) #set (this is redundant tho as we are only looking for ones that are set
	&&
	($mover_event) #has an event set (for making the glass etc)
	&&
	(  ( ($moverkey_pos_origin_x)  ||  #one of these is set
	   ($moverkey_pos_origin_y ) ||    #one of these is set
	   ($moverkey_pos_origin_z) ))   #one of these is set
	&&
	#Either require huge movements for destructables, or not but atleast some movement
	(
	( $REQUIREHUGEMOVEMENT_FOR_DESTRUCTABLES_MOVERS &&
	(  ( ($moverkey_pos_origin_x - $mover_basepos_origin_x > 1000 || $moverkey_pos_origin_x - $mover_basepos_origin_x < -1000)  ||  #one of these is set to alot or a little
	   ($moverkey_pos_origin_y - $mover_basepos_origin_y > 1000 || $moverkey_pos_origin_y - $mover_basepos_origin_y < -1000) ||    #one of these is set to alot or a little
	   ($moverkey_pos_origin_z - $mover_basepos_origin_z > 1000|| $moverkey_pos_origin_y - $mover_basepos_origin_z < -1000) ))   #one of these is set to alot or a little
	)
	||
	( !($REQUIREHUGEMOVEMENT_FOR_DESTRUCTABLES_MOVERS) &&
	(  ( ($moverkey_pos_origin_x - $mover_basepos_origin_x > 1 || $moverkey_pos_origin_x - $mover_basepos_origin_x < -1)  ||  #set to something atleast
	   ($moverkey_pos_origin_y - $mover_basepos_origin_y > 1 || $moverkey_pos_origin_y - $mover_basepos_origin_y < -1) ||    #set to something atleast
	   ($moverkey_pos_origin_z - $mover_basepos_origin_z > 1 || $moverkey_pos_origin_y - $mover_basepos_origin_z < -1) ))   #set to something atleast
	)
	)
	&&
	($formover_maximum_seen_vertex_x || $formover_littlest_seen_vertex_x
	|| $formover_maximum_seen_vertex_y || $formover_littlest_seen_vertex_y
	|| $formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	#doesn't have other keys after
	&& (!($moverkey_pos2_origin_x))
	&& (!($moverkey_pos2_origin_y))
	&& (!($moverkey_pos2_origin_z))
		
		)
	){
	###
		$classname = 'func_breakable';
		$targetname = $mover_tag;
		$model = "Mover".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		$dostuff=1001; #since using special
		$omitangles_allready_set_angle = 1; #no angles to be set
		$specialextrastuffname0 = 'debris';
		$specialextrastuffamnt0 = 'models/glass/brokenglass1.md3 models/glass/brokenglass2.md3';
		$specialextrastuffname1 = 'debrismovetype';
		$specialextrastuffamnt1 = 'MOVETYPE_NONE';
		$specialextrastuffname2 = 'respawntime';
		$specialextrastuffamnt2 = "$mover_stayopentime";
		$specialextrastuffname3 = 'health';
		$specialextrastuffamnt3 = $mover_damagethreshold;
				
		if ($comment_mover_information ) {
			print('//#');
			print("XXXX2 Breakable ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_event) { print(' event: '."$mover_event"); } #set to make the glass etc in the file
						if ($mover_tag) { print(' tag: '."$mover_tag"); } #shouldn't really be set but...
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	###
	#lift crushing (tall towa)
	} elsif (($OMIT_NEWER_MOVERS == 0) && #allow newer movers after destructables
		( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 1) #crushing lift
	&&
	#(!($mover_bumptype)) #none set #added #edit commented out to be useable by more lifts
	#&&                                    #edit commented out to be useable by more lifts
	(!($mover_encroachdamage)) #none set
	#//&&
	#//($mover_tag)
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	#this one was set only to positive in twilight, as those movers only went up from down
	#here these go down from up often, so it might be negative
	($moverkey_pos_origin_z-$mover_basepos_origin_z > 0 || $moverkey_pos_origin_z-$mover_basepos_origin_z < 0 ) #is ... something
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) 
	) {
		my $templiftaddedinfo = '';
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		$omitangles_allready_set_angle = 1; #for movers
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher
		
		$classname = 'func_door';
		#$targetname = $mover_tag;
		if ( (!($mover_bumptype)) ) {
			$templiftaddedinfo = '';
		} else {
			$templiftaddedinfo = $mover_bumptype.$model;
		}
		$model = "LiftCrushing"."$templiftaddedinfo".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("LCLC LiftCrushing$templiftaddedinfo ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	###
	#lift (twilight (reverse) (speculative))
	} elsif (($OMIT_NEWER_MOVERS == 0) && #allow newer movers after destructables
		( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(!($mover_encroachtype)) #none set
	&&
	#(!($mover_bumptype)) #none set #added #edit commented out to be useable by more lifts
	#&&                                    #edit commented out to be useable by more lifts
	(!($mover_encroachdamage)) #none set
	#//&&
	#//($mover_tag)
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	($moverkey_pos_origin_z < 0) #is negative, goes down (#not tested for lip note)
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) 
	) {
		my $templiftaddedinfo = '';
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		$omitangles_allready_set_angle = 1; #for movers
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher #(not tested for lip note)
		
		$classname = 'func_door';
		#$targetname = $mover_tag;
		if ( (!($mover_bumptype)) ) {
			$templiftaddedinfo = '';
		} else {
			$templiftaddedinfo = $mover_bumptype.$model;
		}
		$model = "LiftReverse"."$templiftaddedinfo".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("LLLR LiftReverse$templiftaddedinfo ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	### Door rotating (tall towa) (attempt)
	} elsif (($OMIT_NEWER_MOVERS == 0) && #allow newer movers after destructables
	( ( !($moverkey_rotation_pitch) &&  #not set
	($moverkey_rotation_yaw) &&	     # set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	(($moverkey_pos_origin_x == 0) && #notset sliding 
	($moverkey_pos_origin_y == 0)   && #notset sliding 
	($moverkey_pos_origin_z == 0)) #notset sliding 
	) 
	) {
		#rotating door it seems
		if ($comment_mover_information ) {
		print('//#');
		print("RDRD RotatingDoor $mover_tag");
			if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
				if ($name eq '') { 
					# do nothing
				} else {
					print(' ');
					print('name: '."$name");
				}
				$did_mover_name_allready = 1;
			}
		print("\n");
		}
		
		#sets the prefix of the model to mover_tag by default, or name if there is none
		if ($mover_tag eq '') {
			if ($name eq '') {
			} else {
				#second choice
				$temp_mover_prefix = $name;
			}
		} else {	
			#first choice
			$temp_mover_prefix = $mover_tag;
		}
		
		$classname = 'func_door_rotating';
		#$rotation_yaw = &rotation_convert($moverkey_rotation_yaw); #angles x y z #this made the angles too small for this rotating door
		$rotation_yaw *= -1; #not sure
		#$spawnflags = 128;
		#$force_angles_rather_than_angle = 1; #for this type we want just angle
		$no_angle_conversion_allready_done = 1;
		#$targetname = $mover_tag;
		#$model = "RotatingDoor"."$temp_mover_prefix".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$model = "RotatingDoor".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofrotatingdoortrapmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
	###
	
	###
	#button (heal pod) #this was made after newer models1
	} elsif (($OMIT_NEWER_MOVERS == 0) && #allow newer movers after destructables
		($OMIT_NEWER_MOVERS2 == 0)  && #allow even newer models after Elevator E
		( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 2) #ignore when encroached
	&&
	($mover_initialstate == 3) #Stand Open Timed
	&&
	($mover_moverglidetype == 1) #MV_MoveByTime
	&&
	(!($mover_bumptype)) #none set #added #edit commented out to be useable by more lifts
	&&                                    #edit commented out to be useable by more lifts
	(!($mover_encroachdamage)) #none set
	&&
	(!($mover_tag)) #doesn't have this set
	&&
	($mover_event) #this used for trigger here
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	#this one was set only to positive in twilight, as those movers only went up from down
	#here these go down from up often, so it might be negative
	($moverkey_pos_origin_z-$mover_basepos_origin_z > 0 || $moverkey_pos_origin_z-$mover_basepos_origin_z < 0 ) #is ... something
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) 
	) {
		my $templiftaddedinfo = '';
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		$omitangles_allready_set_angle = 1; #for movers
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher
		
		$classname = 'func_button';
		$target = $mover_event;
		if ( (!($mover_bumptype)) ) {
			$templiftaddedinfo = '';
		} else {
			$templiftaddedinfo = $mover_bumptype.$model;
		}
		$model = "ButtonE"."$templiftaddedinfo".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("ButtonE$templiftaddedinfo ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_event) { print(' event: '."$mover_event"); } #set to make the glass etc in the file
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	###
	#lift elevator glass outside (tall towa)
	} elsif (($OMIT_NEWER_MOVERS == 0) && #allow newer movers after destructables
		( (!($moverkey_rotation_pitch) &&   #not set
	!($moverkey_rotation_yaw) &&	     #not set
	!($moverkey_rotation_roll))	     #not set
	&&
	(($saved_moverkey_rotation_pitch == 123) &&
	($saved_moverkey_rotation_yaw == 456)   &&
	($saved_moverkey_rotation_roll == 789))
	&&
	(($saved_mover_basepos_origin_x == -12345.000000) &&
	($saved_mover_basepos_origin_y == -12345.000000) &&
	($saved_mover_basepos_origin_z == -12345.000000))
	&&
	($mover_encroachtype == 2) #ignore when encroached
	&&
	#(!($mover_bumptype)) #none set #added #edit commented out to be useable by more lifts
	#&&                                    #edit commented out to be useable by more lifts
	(!($mover_encroachdamage)) #none set
	#//&&
	#//($mover_tag)
	&&
	((!($moverkey_pos_origin_x)) && #notset
	(!($moverkey_pos_origin_y))  && #notset
	($moverkey_pos_origin_z)) #one of these set sliding 
	&&
	#this one was set only to positive in twilight, as those movers only went up from down
	#here these go down from up often, so it might be negative
	($moverkey_pos_origin_z-$mover_basepos_origin_z > 0 || $moverkey_pos_origin_z-$mover_basepos_origin_z < 0 ) #is ... something
	&&
	($formover_maximum_seen_vertex_z || $formover_littlest_seen_vertex_z) #has a size
	) 
	) {
		my $templiftaddedinfo = '';
		$specialextrastuffname2 = 'angle';
		$specialextrastuffamnt2 = -1; #-1 up, -2 down
		$omitangles_allready_set_angle = 1; #for movers
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher
		
		$classname = 'func_door';
		#$targetname = $mover_tag;
		if ( (!($mover_bumptype)) ) {
			$templiftaddedinfo = '';
		} else {
			$templiftaddedinfo = $mover_bumptype.$model;
		}
		$model = "LiftE"."$templiftaddedinfo".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=1000;
		#guess
		soundguessfornoiseofliftmovers();$dostuff=1001; #since using special
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		
		if ($comment_mover_information ) {
			print('//#');
			print("LELE LiftE$templiftaddedinfo ");
				if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
					if ($name eq '') { 
						# do nothing
					} else {
						print(' ');
						print('name: '."$name");
						if ($mover_tag) { print(' tag: '."$mover_tag"); }
						print("\n//minz - maxz =\t$tempamnt");
						print("\n//key_z =\t".(0 + $moverkey_pos_origin_z)." ");
					}
					$did_mover_name_allready = 1;
				}
			print("\n");
		}
	###
	
	###
	} else {
		print("//#UNKNOWN MOVER\n");
		if ($mover_tag) { print('//# tag: '."$mover_tag"); }
		my $tempamnt;
		$tempamnt = $formover_littlest_seen_vertex_z - $formover_maximum_seen_vertex_z;
		$specialextrastuffname3 = 'lip';
		$specialextrastuffamnt3 = ($moverkey_pos_origin_z*-1) - $tempamnt; #note: opposite to crusher
		#$specialextrastuffname4 = 'altlip';
		#$specialextrastuffamnt4 = ($moverkey_pos_origin_z + $tempamnt)*-1;
		soundguessfornoiseofliftmovers();
		othergeneralstuffformovers();
		setmovetimeifnotset();
		speedguessformovers();
		$classname = 'func_door';
		$model = "Mover".'_'.int($origin_x).'_'.int($origin_y).'_'.int($origin_z).'_.basescale1.obj_from_mc';
		$dostuff=2001;
	}
	
	#if ($mover_bumpevent eq '') { } else { 
	#$target = $mover_bumpevent = '';
	#}
	
	
}	

if ($is_zoneinfo_maybehurt && $mode == 0) {
	if (($bpainzone_true_or_false) && ($bpainzone_true_or_false eq 'True')) #substitution
	{
		if ($damagepersecond) {
			$classname = 'xyz_autofill';
			$dostuff = 1001; #special case, more information printed
			$specialextrastuffname = 'xyz_autofill_spawn'; 
			if ($damagepersecond > 0) {
				$specialextrastuffamnt = 'trigger_hurt';
				$specialextrastuffname0 = 'dmg'; 
				$specialextrastuffamnt0 = $damagepersecond;
			} elsif ($damagepersecond < 0) {
				$specialextrastuffamnt = 'trigger_heal';
				$specialextrastuffname0 = 'dmg'; 
				$specialextrastuffamnt0 = ($damagepersecond * -1);
			}
			
			if ($WATERLAVASLIMEZONESAREPRINTEDATEND) {
						$change_standard_output = 1; #so we will print to an in memory file handle
			}
		}
	}
}

#This deals with models that show different things based on animsequence perhaps
if ($is_model_maybereversez && $endnow == 1 && $mode == 0) {
		if ($is_model_maybereversez) {
			if ($animsequence) {
				if ($animsequence ne '') {
					if ($originalclassname eq 'CrucifiedNali') {
						if ($animsequence eq 'HangFeet') {
							$model = 'models/fromunreal/CrossNali_HangFeet.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Hang1') {
							$model = 'models/fromunreal/CrossNali_Hang1.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Hang2') {
							$model = 'models/fromunreal/CrossNali_Hang2.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Hang3') {
							$model = 'models/fromunreal/CrossNali_Hang3.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Impaled') {
							$model = 'models/fromunreal/CrossNali_Impaled.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Stocks') {
							$model = 'models/fromunreal/CrossNali_Stocks.basescale1.obj_from_mc';
						} elsif ($animsequence eq 'Stretch') {
							$model = 'models/fromunreal/CrossNali_Stretch.basescale1.obj_from_mc';
						}
					}
				}
			}
		}
		#maybe
		if ($drawscale) {
			#$specialextrasetscalefromdrawscale = 'scale'; #just using below, if it's set it prints the scale
			$specialextrasetscalefromdrawscaleamnt = $drawscale; 
		} elsif ($pre_drawscale) {
			#$specialextrasetscalefromdrawscale = 'scale'; #just using below, if it's set it prints the scale
			$specialextrasetscalefromdrawscaleamnt = $pre_drawscale; 
		}
}		
if ($dostuff == 3 && $endnow == 1 && $mode == 0 && $is_allowed_even_if_not_mover == 1) { #is allowed... is for teleporters etc
	if ($url || $mover_tag || $mover_event) {
		#Written this way incase to add non printing functions
		if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
			print('//'); print('#'); print('ee');
		}
		if ($url ne '') {
			if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
			print('	URL "'); print("$url"); 
			}
		}
		if ($mover_tag ne '') {
			if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
			print('	Tag "'); print("$mover_tag"); 
			}
		}
		if ($mover_event ne '') {
			if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
			print('	Event "'); print("$mover_event"); 
			}
		}
		if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
		       print("\n");
		}
	}
}
#Resume regular below

#Ignore if in brush
if ($ignoreingalllinesinbrush == 1) {
#First a test massage
} elsif ($dostuff == 3 && $endnow == 1 && $TESTUNKNOWNPRINTS) {
	if ($COMMENTOUTUNKNOWNSIFTESTUNKNOWNPRINTS) {
print('//'); print('#'); print('ee'); print('{'); print("\n");
print('//'); print('#'); print('ee'); print('	classname "'); print("$classname"); print('"');print(' xxxxxx'); 
		if ($ORIGINFORUNKNOWNSIFTESTUNKNOWNPRINTS == 1) {
		print("\t\t"); print('//'); print('#');  print(int($origin_x), ' ',  int($origin_y), ' ', int($origin_z));
		}print("\n");
print('//'); print('#'); print('ee'); print('}'); print("\n");
		if ($ORIGINFORUNKNOWNSIFTESTUNKNOWNPRINTS == 2) {
		print('//'); print('#'); print('Above Location:'); print(($origin_x), ' ',  ($origin_y), ' ', ($origin_z)); print("\n");
		}
	} else {
my $message = <<"END_MESSAGE";
ee{
ee	classname "$classname" xxxxxx
ee}
END_MESSAGE
print $message;
	}

 newlinebetweensections();
$classname = "";
#then another test message
} elsif ($dostuff == 4 && $endnow == 1 && $TESTLIGHTPRINTS) {
my $message = <<"ENX_MESSAGE";
**{
**	"classname" "$classname" xxxxxx
**	"origin" "$origin_x $origin_y $origin_z"
**	"spawnflags" "1" wonder what that does to a light
**}
ENX_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";
#this is the real deal below
} elsif ($dostuff == 5 && $endnow == 1) {
my $message = <<"ENY_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
}
ENY_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";
#this is for ambientsounds below
} elsif ($dostuff == 7 && $endnow == 1) {
my $message = <<"ENZ_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"noise" "$noise.wav"
}
ENZ_MESSAGE
 
print $message;
	if ($CONVERT_SOME_NOISES_TO_SIMPLER_STRING) {
		if ($PRINTORIGINALSOUNDINFOASCOMMENTIFCONVERTED) {
		print('//');
		print('#');
		print('  Above:');
		print("$originalnoisecomment");
		print("\n");
		}
	}
	 newlinebetweensections();
$classname = "";
#this is the real deal below but a special case for playerstarts if you want to add more Z 
} elsif ($dostuff == 500 && $endnow == 1) {
	if ($PRINTINFOREGARDINGADDINGZTOPLAYERSTART) {
	print('//'); print('#'); print('NOTE Added to Z Below: Original X Y Z:'); print("$origin_x $origin_y $origin_z"); print("\n");
	}
$origin_z = $origin_z + $add_z_toplayerstart;
my $message = <<"ENY_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
}
ENY_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";
#This is a special case for a rifle round for the t17mmrifle
} elsif ($dostuff == 6 && $endnow == 1) {
my $message = <<"ENX2_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/items/casingriflebullet.iqm"
	"scale" "1.46"
	"ammo_nails" "3"
}
ENX2_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";





#This is a special case for a rifle round for the rem308
} elsif ($dostuff == 7 && $endnow == 1) {
my $message = <<"ENX3_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/items/casingriflebullet.iqm"
	"scale" "0.66"
	"ammo_nails" "3"
}
ENX3_MESSAGE
print $message; newlinebetweensections();
$classname = "";


#This is a special case for shells for ithaca, should be 12 ga, but scale set to 8ga for now since it's a bunch of them
} elsif ($dostuff == 8 && $endnow == 1) {
my $message = <<"ENX5_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/casing_shell.mdl"
	"scale" "1.145"
	"ammo_shells" "3"
}
ENX5_MESSAGE
print $message; newlinebetweensections();
$classname = "";

#This is a special case for a clip of 223 //Scale big to distinguish from the pickup
} elsif ($dostuff == 9 && $endnow == 1) {
my $message = <<"ENX7_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/misc/extendedmags/styeraugmag30.iqm"
	"scale" "2"
	"ammo_nails" "30"
}
ENX7_MESSAGE
print $message; newlinebetweensections();
$classname = "";



#This is a special case for a box of 9mm //Scale down ammo can?
} elsif ($dostuff == 10 && $endnow == 1) {
my $message = <<"ENX10_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"scale" "0.66"
	"ammo_nails" "60"
}
ENX10_MESSAGE
print $message; newlinebetweensections();
$classname = "";


#This is a special case for a clips of 45 //Scale up to distinguish from the pickup
} elsif ($dostuff == 11 && $endnow == 1) {
my $message = <<"ENX11_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/misc/extendedmags/uzimag20.iqm"
	"scale" "2"
	"ammo_nails" "12"
}
ENX11_MESSAGE
print $message; newlinebetweensections();
$classname = "";


#This is a special case for loose 203 //Scale up to distinguish from the pickup
} elsif ($dostuff == 12 && $endnow == 1) {
my $message = <<"ENX12_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"model" "models/casing_steel.mdl"
	"scale" "2"
	"ammo_nails" "3"
}
ENX12_MESSAGE
print $message; newlinebetweensections();
$classname = "";


#This is a special case for a box of 45 //Scale down ammo can?
} elsif ($dostuff == 15 && $endnow == 1) {
my $message = <<"ENX15_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"spawnflags" "1"
	"scale" "0.75"
	"ammo_nails" "70"
}
ENX15_MESSAGE
print $message; newlinebetweensections();
$classname = "";


#This is a special case for a buildablebuildingnumber by count
} elsif ($dostuff == 200 && $endnow == 1) {
my $message = <<"COUNT0_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"count" "$count"
}
COUNT0_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";

#This is a special case for a model
} elsif ($dostuff == 100 && $endnow == 1) {
my $message = <<"MODEL0_MESSAGE";
{
	"classname" "$classname"
	"origin" "$origin_x $origin_y $origin_z"
	"model" "$model"
}
MODEL0_MESSAGE
 
print $message; newlinebetweensections();
$classname = "";
#This is a special generic case
} elsif (($dostuff == 1000 || $dostuff == 1001 || $dostuff == 2001) && $endnow == 1) {
	if ($mode == 2) { #rtlight
		if ($ignore_unset_lights == 1 && ($is_light_entity && $no_color_set_by_map && $no_radius_set_by_map)) {
			#ignore this light completely
		} else {
			rtlightprint();
		}
	#normal entity and or light mode below
	} elsif ($classname && ($ignore_unset_lights == 1 && ($is_light_entity && $no_color_set_by_map && $no_radius_set_by_map))) {
		#ignore this light completely
	} elsif ($classname) {
		if ($change_standard_output) {
			if ($WATERLAVASLIMEZONESAREPRINTEDATEND && $DOWATERLAVASLIMEZONES) {
			$output = $fh;
			}
		}
		$comment_out_noise = 0;
		if ($is_mover) {
			if ($PRINTMOVERNAMEASCOMMENTIFFOUND_FORMOVER) {
				if ($did_mover_name_allready) {
					# do nothing
				} elsif ($name eq '') { 
					# do nothing
				} else {
					print $output ('//'); 
					print $output ('#');
					print $output ('name: '."$name");
					print $output ("\n");
				}
			}
		}
		if ($is_mover && (
		$formover_maximum_seen_vertex_x ||
		$formover_maximum_seen_vertex_y ||
		$formover_maximum_seen_vertex_z ||
		$formover_littlest_seen_vertex_x ||
		$formover_littlest_seen_vertex_y ||
		$formover_littlest_seen_vertex_z)) {
			if ($PRINTMINSMAXSASCOMMENTIFFOUND_FORMOVER) {
			print $output ('//'); 
			print $output ('#');
			print $output ('Maxs: '."$formover_maximum_seen_vertex_x $formover_maximum_seen_vertex_y $formover_maximum_seen_vertex_z");
			print $output ("\n");
			print $output ('//'); 
			print $output ('#');
			print $output ('mins: '."$formover_littlest_seen_vertex_x $formover_littlest_seen_vertex_y $formover_littlest_seen_vertex_z");
			print $output ("\n");
			}
		}
		if ($rotation_pitch || $rotation_yaw || $rotation_roll) {
			if ($PRINTORIGINALROTATIONINFOASCOMMENTIFCONVERTED) {
				if ($is_mover && $force_angles_rather_than_angle && $no_angle_conversion_allready_done) { #for mover
				print $output ('//');
				print $output ('#');
				print $output ('  Below: Rotation PRE CONVERTED ');
				print $output ("Pitch $infooriginal_mover_rotation_pitch  Yaw $infooriginal_mover_rotation_yaw  Roll$infooriginal_mover_rotation_roll");
				print $output ("\n");
				} else {
				print $output ('//');
				print $output ('#');
				print $output ('  Below: Rotation Pre Conversions ');
				print $output ("Pitch $rotation_pitch  Yaw $rotation_yaw  Roll$rotation_roll");
				print $output ("\n");
				}
			}
			if ($is_mover && $force_angles_rather_than_angle && $no_angle_conversion_allready_done) { #for mover
				#do nothing
			} else {
				if ($rotation_pitch) { $rotation_pitch = &rotation_convert($rotation_pitch); }
				if ($rotation_yaw) { $rotation_yaw = &rotation_convert($rotation_yaw); }
				if ($rotation_roll) { $rotation_roll = &rotation_convert($rotation_roll); }
			}
			if ($is_model_maybereversez && $mode == 0) {
				if ($REVERSE_Z_ANGLE_ON_SOME_MODELS) {
					if ($rotation_roll) {
						if ($rotation_roll > 0 || $rotation_roll < 0) {
							if ($PRINTREVERSEZMODELINFOASCOMMENTIFREVERSED) {
							print('//'); print('#');  print(" Z angle has been reversed for this model (was $rotation_roll");
							}
							$rotation_roll = $rotation_roll * -1;
							if ($PRINTREVERSEZMODELINFOASCOMMENTIFREVERSED) {
							print(" is now: $rotation_roll)\n");
							}
						}
					}
				}
				if ($REVERSE_X_ANGLE_ON_SOME_MODELS) {
					if ($rotation_pitch) {
						if ($rotation_pitch > 0 || $rotation_pitch < 0) {
							if ($PRINTREVERSEZMODELINFOASCOMMENTIFREVERSED) {
							print('//'); print('#');  print(" X angle has been reversed for this model (was $rotation_pitch");
							}
							$rotation_pitch = $rotation_pitch * -1;
							if ($PRINTREVERSEZMODELINFOASCOMMENTIFREVERSED) {
							print(" is now: $rotation_pitch)\n");
							}
						}
					}
				}
			}
		}
		
		if ($hue || $saturation || $brightness) {
			$comment_out_noise = 1;
			if ($PRINTORIGINALHUESATURATIONBRIGHTNESSINFOASCOMMENTIFCONVERTED) {
			print $output ('//');
			print $output ('#');
			print $output ('  Below: HSV Pre Conversions ');
			print $output ("Hue $hue  Saturation $saturation  Brightness $brightness\n");
			}
		}
		
		
	prc(); print $output ('{'); print $output ("\n");
		#print our classname, which will be the subroutine that is called or so in game
			prc(); print $output ("\t",'"','classname','"',' '); print $output ('"',"$classname",'"'); print $output ("\n");
		#origin
		if ($origin_x || $origin_y || $origin_z) {
			prc(); print $output ("\t",'"','origin','"',' '); print $output ('"',"$origin_x $origin_y $origin_z",'"'); print $output ("\n");
		}
		if ($model) {
			prc(); print $output ("\t",'"','model','"',' '); print $output ('"',"$model",'"'); print $output ("\n");
		}
		#rotation if only around then just angle, otherwise use vector angles
				if ($is_mover && $omitangles_allready_set_angle) { #for mover
				} elsif ($is_mover && $force_angles_rather_than_angle) { #for mover
				prc(); print $output ("\t",'"','angles','"',' '); print $output ('"',"$rotation_pitch $rotation_yaw $rotation_roll",'"'); print $output ("\n"); #for mover
		} elsif ($rotation_yaw && !($rotation_pitch) && !($rotation_roll)) {
			prc(); print $output ("\t",'"','angle','"',' '); print $output ('"',"$rotation_yaw",'"'); print $output ("\n");
		} elsif ($rotation_pitch || $rotation_yaw || $rotation_roll) {
			prc(); print $output ("\t",'"','angles','"',' '); print $output ('"',"$rotation_pitch $rotation_yaw $rotation_roll",'"'); print $output ("\n");
		}
		if ($speed) {
			prc(); print $output ("\t",'"','speed','"',' '); print $output ('"',"$speed",'"'); print $output ("\n");
		}
		if ($noise) {
			prc(); 
			if ($comment_out_noise) {
			print $output ("\t");
			print $output ('//');
			print $output ('#');
			}
			print $output ("\t",'"','noise','"',' '); print $output ('"',"$noise.wav",'"'); print $output ("\n");
		}
		if ($light_radius) {
			prc(); print $output ("\t",'"','light_lev','"',' '); print $output ('"',"$light_radius",'"'); print $output ("\n");
		}
		if ($spawnflags) {
			prc(); print $output ("\t",'"','spawnflags','"',' '); print $output ('"',"$spawnflags",'"'); print $output ("\n");
		}
		#target/targetname just for movers now
		if ($is_mover) {
			if ($targetname eq '') { } else {
			prc(); print $output ("\t",'"','targetname','"',' '); print $output ('"',"$targetname",'"'); print $output ("\n");
			}
			if ($target eq '') { } else {
			prc(); print $output ("\t",'"','target','"',' '); print $output ('"',"$target",'"'); print $output ("\n");
			}
		}
		#other added stuff
		if ($dostuff == 1001 || $dostuff == 2001) {
			if ($specialextrastuffname) { 
				prc(); print $output ("\t",'"',"$specialextrastuffname",'"',' '); print $output ('"',"$specialextrastuffamnt",'"'); print $output ("\n");
			}
			if ($specialextrastuffname0) {
				prc(); print $output ("\t",'"',"$specialextrastuffname0",'"',' '); print $output ('"',"$specialextrastuffamnt0",'"'); print $output ("\n");
			}
			if ($specialextrastuffname1) {
				prc(); print $output ("\t",'"',"$specialextrastuffname1",'"',' '); print $output ('"',"$specialextrastuffamnt1",'"'); print $output ("\n");
			}
			if ($specialextrastuffname2) {
				prc(); print $output ("\t",'"',"$specialextrastuffname2",'"',' '); print $output ('"',"$specialextrastuffamnt2",'"'); print $output ("\n");
			}
			if ($specialextrastuffname3) {
				prc(); print $output ("\t",'"',"$specialextrastuffname3",'"',' '); print $output ('"',"$specialextrastuffamnt3",'"'); print $output ("\n");
			}
			if ($specialextrastuffname4) {
				prc(); print $output ("\t",'"',"$specialextrastuffname4",'"',' '); print $output ('"',"$specialextrastuffamnt4",'"'); print $output ("\n");
			}
			if ($specialextrastuffname5) {
				prc(); print $output ("\t",'"',"$specialextrastuffname5",'"',' '); print $output ('"',"$specialextrastuffamnt5",'"'); print $output ("\n");
			}
			if ($specialextrasetscalefromdrawscaleamnt) {
				if ($specialextrasetscalefromdrawscaleamnt > 0) {
				prc(); print $output ("\t",'"','scale','"',' '); print $output ('"',"$specialextrasetscalefromdrawscaleamnt",'"'); print $output ("\n");
					if ($SETSOLIDPHYSICSTRIMESHIFDSCALEONSOMEMODELS) {
						if ($setsolidkeepdefaultevenifdscale) {
							#do nothing
						} else {
							prc(); print $output ("\t",'"','solid','"',' '); print $output ('"','35','"'); print $output ("\n"); #set to solid physics trimesh (35) for these, as solid_bsp scaled doesn't work correctly when scaled
						}
					}
				}
			}
		}
		###set defaults 
		##if ($mode == 1) { #lm mode
		##	if (!($hue)) { $hue = 64 }		#set defaults if not set
		##	if (!($saturation)) { $saturation = 255}#set defaults if not set
		##} #will be in time for next part
		if (($hue || $saturation || $brightness) || ($mode == 1)) {
			hsv_to_rgb();
			if ((!($color_r)) && (!($color_b)) && (!($color_g))) 
			{
				if ($Set_Default_HSV_and_Radius_At_Begining_Instead) {
					#do nothing
				} elsif ($SET_UNSET_LIGHT_COLOR) {
				$color_r = 1;
				$color_g = 1;
				$color_b = 1;
				}
			}
			prc(); print $output ("\t",'"','color','"',' '); print $output ('"',"$color_r $color_g $color_b",'"'); print $output ("\n");
			prc(); print $output ("\t",'"','pflags','"',' '); print $output ('"','128','"'); print $output ("\n"); #PFLAGS_FULLDYNAMIC
			prc(); print $output ("\t",'"','style','"',' '); print $output ('"','0','"'); print $output ("\n");
			
			#set default light radius if none as above in the rt code
			if (!($light_radius)) { 
				if ($Set_Default_HSV_and_Radius_At_Begining_Instead) {
					#do nothing
				} elsif ($SET_UNSET_LIGHT_RADIUS) {
				$light_radius = 64;
				prc(); print $output ("\t",'"','light_lev','"',' '); print $output ('"',"$light_radius",'"'); print $output ("\n");	
				}
			} #default
		}
	prc(); print $output ('}'); print $output ("\n");
	
		if ($PRINTORIGINALHUESATURATIONBRIGHTNESSINFOASCOMMENTIFCONVERTED) {
			if ($hue || $saturation || $brightness) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above: Color ');
			print $output (int($color_r*256),' ', int($color_g*256),' ',  int($color_b*256),' ');
			print $output ("\n");
			}
		}
		
		if ($CONVERT_SOME_NOISES_TO_SIMPLER_STRING) {
			if ($PRINTORIGINALSOUNDINFOASCOMMENTIFCONVERTED) {
			if ($noise) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above:');
			print $output ("$originalnoisecomment");
			print $output ("\n");
			}
			if ($is_mover && $openingnoise_formover) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above Opening:');
			print $output ("$originalnoisecomment_o");
			print $output ("\n");
			}
			if ($is_mover && $closingnoise_formover) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above Closing:');
			print $output ("$originalnoisecomment_c");
			print $output ("\n");
			}
			if ($is_mover && $moveambientnoise_formover) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above MovingAmbient:');
			print $output ("$originalnoisecomment_m");
			print $output ("\n");
			}
			if ($is_mover && $closingingnoise_formover) {
			print $output ('//');
			print $output ('#');
			print $output ('  Above Closinging:');
			print $output ("$originalnoisecomment_cc");
			print $output ("\n");
			}
			}
		}
		newlinebetweensections();
		
		if ($change_standard_output) {
			$output = STDOUT; #Restore
			$change_standard_output = 0;
		}
	}
$classname = "";
}
#completed

	#reset variables for the next block
	if ($endnow == 1) {
		$classname = "";
		$beforeequals = "";
		$afterequals = "";
		$endnow = 0;
		$dostuff = 0;
		$origin_x = 0;
		$origin_y = 0;
		$origin_z = 0;
		$rotation_pitch = 0;
		$rotation_yaw = 0; 
		$rotation_roll = 0; 
		$rotationrate_pitch = 0;
		$rotationrate_yaw = 0;
		$rotationrate_roll = 0;
		$noise = '';
		$model = '';
		$count = '';
		$originalnoisecomment = '';
		$originalclassname = '';
		$hue = 0;
		$saturation = 0;
		$brightness = 0;
		$light_radius = 0;
		$color_r = 0;
		$color_g = 0;
		$color_b = 0;
		$spawnflags = 0;
		$cubemap = '';
		$corona = 0;
		$coronasize = 0; #0.25; #default 0.25 but corona is off by default
		$ambient = 0;
		$diffuse = 1; #default 1
		$specular= 1; #default 1
		$specialextrastuffname = '';
		$specialextrastuffamnt = '';
		$specialextrastuffname0 = '';
		$specialextrastuffamnt0 = '';
		$specialextrastuffname1 = '';
		$specialextrastuffamnt1 = '';
		$specialextrastuffname2 = '';
		$specialextrastuffamnt2 = '';
		$specialextrastuffname3 = '';
		$specialextrastuffamnt3 = '';
		$specialextrastuffname4 = '';
		$specialextrastuffamnt4 = '';
		$specialextrastuffname5 = '';
		$specialextrastuffamnt5 = '';
		$specialextrasetscalefromdrawscaleamnt = 0;
		$no_color_set_by_map = 1; #for SET_UNSET_LIGHT_COLOR = 1; and ignore
		$no_radius_set_by_map = 1; #for SET_UNSET_LIGHT_RADIUS = 1;; and ignore
		$is_light_entity = 0; #so we may ignore if need be
		$is_mover = 0;
		$is_allowed_even_if_not_mover = 0;
		$is_fan = 0;
		$is_rotating_mover = 0;
		$is_zoneinfo_maybehurt = 0;
		$is_model_maybereversez = 0;
		$setsolidkeepdefaultevenifdscale = 0;
		#
		$moverkey_rotation_pitch = 0;
		$moverkey_rotation_yaw = 0; 
		$moverkey_rotation_roll = 0; 
		$moverkey_pos_origin_x = 0; #dejavu (key_pos)
		$moverkey_pos_origin_y = 0; 
		$moverkey_pos_origin_z = 0;  
		$moverkey_pos2_origin_x = 0;
		$moverkey_pos2_origin_y = 0; 
		$moverkey_pos2_origin_z = 0; 
		$mover_basepos_origin_x = 0;
		$mover_basepos_origin_y = 0;
		$mover_basepos_origin_z = 0;
		$saved_moverkey_rotation_pitch = 0;
		$saved_moverkey_rotation_yaw = 0; 
		$saved_moverkey_rotation_roll = 0; 
		$saved_mover_basepos_origin_x = 0;
		$saved_mover_basepos_origin_y = 0;
		$saved_mover_basepos_origin_z = 0;
		$mover_encroachdamage = 0;
		$drawscale = 0;
		$pre_drawscale = 0; #for models, set to something if the default scale isnt 1
		$mover_encroachtype = 0; #1 = crush
		$mover_tag = '';
		$targetname = '';
		$target = '';
		$mover_bumpevent = '';
		$mover_event = '';
		$animsequence = '';
		$url = '';
		$force_angles_rather_than_angle = 0; #for movers
		$no_angle_conversion_allready_done = 0; #for movers
		$moveambientnoise_formover = '';
		$openingnoise_formover = '';
		$closingnoise_formover = '';
		$closingingnoise_formover = '';
		$originalnoisecomment_m = '';
		$originalnoisecomment_o = '';
		$originalnoisecomment_c = '';
		$originalnoisecomment_cc = '';
		$infooriginal_mover_rotation_pitch = 0; #Just for info
		$infooriginal_mover_rotation_yaw = 0; #Just for info
		$infooriginal_mover_rotation_roll = 0; #Just for info
		$mover_bumptype = 0; #1 = Any
		$mover_movetime = 0;
		$mover_movetimewasset = 0; #used to denote the line was set to something in the file, even if 0
		$mover_moverglidetype = 0;
		$mover_bdamagetriggered = 0;
		$mover_damagethreshold = 0;
		$mover_stayopentime = 0;
		$bpainzone_true_or_false = 0;
		$bcorona_true_or_false = 0;
		$lineset_capital_Skin = ''; #for corona
		$damagepersecond = 0;
		$mover_stayopentimewasset = 0; #used to denote the line was set to something in the file, even if 0 #added for effect
		$speed = 0;
		$formover_maximum_seen_vertex_x = 0;
		$formover_maximum_seen_vertex_y = 0;
		$formover_maximum_seen_vertex_z = 0;
		$formover_littlest_seen_vertex_x = 0;
		$formover_littlest_seen_vertex_y = 0;
		$formover_littlest_seen_vertex_z = 0;
		$name = '';
		$did_mover_name_allready = 0;
		$mover_initialstate = 0;
		$omitangles_allready_set_angle = 0; #for movers
		if ($change_standard_output) {
			if ($output != STDOUT) {
				$output = STDOUT; #Restore
				$change_standard_output = 0;
			}
		}
		$change_standard_output = 0; #just in case
		#
		setdefault_light_and_radius_maybe();
		$recorded_actual_from_file__brightness = 0;  #for corona
		$recorded_actual_from_file__hue = 0; 	   #for corona
		$recorded_actual_from_file__saturation = 0; #for corona
		$recorded_actual_from_file__light_radius = 0; #for corona
	}

}

sub printcomment {
	print('//'); print('#');
}

sub printrtdebug0_maybe {
	if ($PRINTDEBUGINFOASCOMMENTFORRTLIGHTS) {
		printcomment(); print(" origin: $origin_x $origin_y $origin_z \n");
		printcomment(); print(" hue: $hue \n");
		printcomment(); print("      saturation: $saturation \n");
		printcomment(); print("      brightness: $brightness \n");
	}
}
sub printrtdebug1_maybe {
	if ($PRINTDEBUGINFOASCOMMENTFORRTLIGHTS) {
		printcomment(); print("\t",'"','color','"',' '); print('"',"$color_r $color_g $color_b",'"'); print("\n");
		printcomment(); print("\t",'"','b_Rgb','"',' '); print('"',"$b_Red $b_Green $b_Blue",'"'); print("\n");
	}
}
sub printrtdebug2_maybe {
	if ($PRINTDEBUGINFOASCOMMENTFORRTLIGHTS) {
		printcomment(); print(" saturation(0..255) brightness(0..255) hue(0..255)\n");
		printcomment(); print(" $saturation $brightness $hue\n");
	}
}
sub printrtdebug3_maybe {
	if ($PRINTDEBUGINFOASCOMMENTFORRTLIGHTS) {
		print("\n");
	}
}

#We have our color, now fit it to the map
sub setdefault_light_and_radius_maybe() {
	if ($Set_Default_HSV_and_Radius_At_Begining_Instead) {
	$brightness = 64;  #LightBrightness 64
	$hue = 0; 	   #LightHue	0
	$saturation = 255; #LightSaturation 255
	#radius
	$light_radius = 64; #LightRadius 64
	}
}
#these are for fitting to a curve
sub lightradius_affected_by_brightness() {
	$light_radius = $light_radius * ($brightness/255);
}
sub ambient_affected_by_saturation() {
	if ($saturation > 128) {
		#Do nothing, too low saturation (0 is "most saturation")
	} else {
		$ambient = 1 - ($saturation/128); #our space is 0 ... 128; 0 is the most intense light, and 128 is less so
	}
}

sub fittomycurve
{
	if ($use_curve) {
	lightradius_affected_by_brightness();
	ambient_affected_by_saturation();
	}
}

sub rtlightprint {
								printrtdebug0_maybe();
		#origin 20, -36, -240 .... radius 200 , red (1 0 0)
		#20.000000 -36.000000 -240.000000 200.000000 1.000000 0.000000 0.000000 0
		#angles 10, 90, 20
		#20.000000 -36.000000 -240.000000 200.000000 1.000000 1.000000 1.000000 0 "" 0.000000 10.000000 90.000000 20.000000
		#style 3
		#20.000000 -36.000000 -240.000000 200.000000 1.000000 1.000000 1.000000 3
		##if (!($hue)) { $hue = 64 }		#set defaults if not set
		##if (!($saturation)) { $saturation = 255}#set defaults if not set
		#0.000000 0.000000 ###-252.000000 200.000000 1.000000 1.000000 1.000000 0 "" 0.000000 270.000000 90.000000 180.000000 0.250000 0.500000 1.000000 1.000000 2
		hsv_to_rgb();
		fittomycurve();
								printrtdebug1_maybe();
								printrtdebug2_maybe();
		if ($rtlight_allow_corona) { #Here we search for bCorona=True was set and if DrawScale= was set, and set corona if so
			if ($bcorona_true_or_false) {
			if ($bcorona_true_or_false eq 'True') {
			if ($drawscale) {
				$corona = 1;
				$coronasize = $drawscale;
					if ($rtlight_independent_corona_scale) {
					$coronasize = $coronasize * $rtlight_independent_corona_scale;
					} elsif ($rtlight_radius_scale) {
					$coronasize = $coronasize * $rtlight_radius_scale;
					}
				#$coronasize = 1;
				if ((!($color_r)) && (!($color_b)) && (!($color_g))) {
					#Force coronas to a certain color
					if ($SET_UNSET_CORONA_COLOR) {
					$color_r = $SET_UNSET_CORONA_COLOR_R;
					$color_g = $SET_UNSET_CORONA_COLOR_G;
					$color_b = $SET_UNSET_CORONA_COLOR_B;
						if (!($light_radius)) { 
							$light_radius = 1;
						#$light_radius  = $drawscale;
							}
					#Try to determine by texture name (ie: guess)
					} elsif ($SET_UNSET_CORONA_COLOR_BY_TEXTURE) {
						if ($lineset_capital_Skin eq '') {
						} elsif  ($lineset_capital_Skin eq 'Texture\'GenFX.LensFlar.3\'') {
							$color_r = 1;
							$color_g = 0;
							$color_b = 0;
						} elsif  ($lineset_capital_Skin eq 'Texture\'GenFX.LensFlar.1\'') {
							$color_r = 1;
							$color_g = 1;
							$color_b = 1;
						}
						
					
						if (!($light_radius)) { 
							$light_radius = 1;
						#$light_radius  = $drawscale;
							}
					#Try by color information
					} else {
						hsv_to_rgb(); #avoid curve I guess
							##ALT that was tried from the myhue: (but above works fine too)
							##hueapply();
							##betweenhues(); #deals with hues not in the 16 table
							##ALT Above that was tried from the myhue:
						if ((!($red)) && (!($green)) && (!($blue))) {
							#unlikely
						} else {	
							#set the colors
							$color_r = $red;
							$color_g = $green;
							$color_b = $blue;
						}
						
						#0 or 255 saturation hack eq white
						if ($recorded_actual_from_file__saturation == 255
						|| $recorded_actual_from_file__saturation == 0) {
							$color_r = 1;
							$color_g = 1;
							$color_b = 1;
						}
						
						if (!($light_radius)) { 
							$light_radius = 1;
						#$light_radius  = $drawscale;
							}
					}
				}
			}
			}
			}
		}
		
		if ((!($color_r)) && (!($color_b)) && (!($color_g))) 
		{
			if ($Set_Default_HSV_and_Radius_At_Begining_Instead) {
					#do nothing
			} elsif ($SET_UNSET_LIGHT_COLOR) {
			$color_r = 1;
			$color_g = 1;
			$color_b = 1;
			}
		}
		if ($rtlights_add_an_exclaimation_point) {print '!';}
		print(sprintf('%.6f', $origin_x)); print ' ';
		print(sprintf('%.6f', $origin_y)); print ' ';
		print(sprintf('%.6f', $origin_z)); print ' ';
				if (!($light_radius)) { 
					if ($Set_Default_HSV_and_Radius_At_Begining_Instead) {
						#do nothing
					} elsif ($SET_UNSET_LIGHT_RADIUS) { 
						$light_radius = 64; 
					} 
				} #default
			if ($rtlight_radius_scale) { 
				print(sprintf('%.6f', $light_radius*$rtlight_radius_scale)); 
			} else { 
				print(sprintf('%.6f', $light_radius)); 
			} print ' ';
		print(sprintf('%.6f', $color_r)); print ' ';
		print(sprintf('%.6f', $color_g)); print ' ';
		print(sprintf('%.6f', $color_b)); print ' '; #$ambient = 1; #$ambient = 0.5555; #test
		print '0'; print ' '; #style
		
		
		
		if ($rotation_pitch || $rotation_yaw || $rotation_roll || $cubemap || $corona || $coronasize || $ambient) {
			print ('"'); print("$cubemap"); print('"'); print ' '; #cubemap
			
			if ($rotation_pitch || $rotation_yaw || $rotation_roll || $corona || $coronasize || $ambient) {
				print(sprintf('%.6f', $corona)); print ' '; #?corona
			
				if ($rotation_pitch || $rotation_yaw || $rotation_roll || $coronasize || $ambient) {
					if ($rotation_pitch) { $rotation_pitch = &rotation_convert($rotation_pitch); }
					if ($rotation_yaw) { $rotation_yaw = &rotation_convert($rotation_yaw); }
					if ($rotation_roll) { $rotation_roll = &rotation_convert($rotation_roll); }
					print(sprintf('%.6f', $rotation_pitch)); print ' ';
					print(sprintf('%.6f', $rotation_yaw)); print ' ';
					print(sprintf('%.6f', $rotation_roll)); print ' ';
					
					if ($coronasize || $ambient) {
					print(sprintf('%.6f', $coronasize)); print ' ';
						if ($ambient) {
							print(sprintf('%.6f', $ambient)); print ' '; #defualt 0
							print(sprintf('%.6f', $diffuse)); print ' '; #default 1 #diffuse
							print(sprintf('%.6f', $specular)); print ' '; #default 1 #specular (can be 0...1...more, and -1)
							print '2'; print ' '; #
						}
					}
				}
			}
		}
		print "\n";
		
		printrtdebug3_maybe();
}


if ($mode == 2) {
	#leave blank
	if ($PRINTCOMMANDARGUMENTSFORRTLIGHTS) {
	print('//');
	print('#');
	print(' Command arguments used: ');
	print("@ARGV");
	#	print(" ");
	print("\n");
	print('//');
	print('#');
	print(' HSV Algo used: ');
	print("$hsvalgo");
	print(" ");
	setstringhsvinfo();
	print("$hsvalgousedstring");
	print("\n");
	print('//');
	print('#');
	print(' Settings used: ');
	if (!($use_curve)) { print(' (did not)'); }
		print(' use_curve: ');
		print("$use_curve"); print(',');
		
	if (!($ignore_unset_lights)) { print(' (did not)'); }
		print(' ignore_unset_lights: ');
		print("$ignore_unset_lights"); print(',');
		
	if (!($rtlight_allow_corona)) { print(' (did not)'); }
		print(' rtlight_allow_corona: ');
		print("$rtlight_allow_corona"); print(',');
	
	if (!($Set_Default_HSV_and_Radius_At_Begining_Instead)) { print(' (did not)'); }
		print(' set default colors: ');
		print("$Set_Default_HSV_and_Radius_At_Begining_Instead");
	print("\n");
	}
} else {
print("//#FINISHED FILE\n");
	if ($mode == 0) {
		if ($var eq '') {
			if ($DOWATERLAVASLIMEZONES && $WATERLAVASLIMEZONESAREPRINTEDATEND) {
				close $fh;
			}
		} else {
			if ($DOWATERLAVASLIMEZONES && $WATERLAVASLIMEZONESAREPRINTEDATEND) {
			print("\n");
			print("//#WATER, SLIME, LAVA ZONES PRINTED AT END\n");
			print("\n");
			close $fh;
			print $var;          # asdf
			print("//#WATER, SLIME, LAVA ZONES PRINTED AT END\n");
			}
		}
	}
	
	if ($mode == 4) {
		if ($ALLOW_DESTRUCTABLES_MOVERS == 0 && $OMIT_NEWER_MOVERS == 0 && $OMIT_NEWER_MOVERS2 == 0) {
			#nothing, default
		} else {
		print('//');
		print('#');
		print(' Mover Command arguments used: ');
		print("@ARGV");
		print("\n");
		}
	}
}

close (FILE); #for data mode
exit;	      #for data mode
