--====================== SET UP ============================
--Things that need to be set up before the rest of the Lua can function.
--I'mma order these freeslots a little more sensibly for 2.2.11...
--==========================================================

local function SingleFreeSlot(...)
	for _,slot in ipairs({...})
		if not rawget(_G, slot) freeslot(slot) end
	end
end

--Projectiles and related objects.
SingleFreeSlot("MT_PBSHOT", "MT_PBCHARGESHOT", "MT_PBCHARGESHOTT", "MT_PBEXPLOSION", "MT_SAMMISSILE", "MT_SAMSUPERMISSILE", "MT_SAMSHATTERFOF", 
"MT_SAMMISSILESMOKE", "MT_SAMEXPLODE1", "MT_SAMEXPLODE2", "MT_SAMEXPLODE3",
"MT_SPSHOT", "MT_SPCHARGESHOT", "MT_WVSHOT", "MT_WVCHARGESHOT", "MT_ICSHOT",
"MT_ICCHARGESHOT", "MT_PLSHOT", "MT_PLCHARGESHOT", "MT_HBSHOT", "MT_SAMMONBREAKER", 
"MT_SPAZERSHOCK", "MT_SPCHARGECOMBO", "MT_ICCHARGECOMBO", "MT_MINIEXP", "MT_MINIFIRE",
"MT_FREEZETRACKER", "MT_ICBLOCK", "MT_ICBRSOUND", "MT_WAVESTUNNER", 
"MT_SAMUSTHOK", "MT_SAMTRACKER3", "MT_SAMUSFLUNG")

--Powerup and ammo Pickups
freeslot("MT_AUTOTANK", "MT_AMMODIGITIZER", "MT_SCANVISOR",  "MT_BONUSHOLOGRAM",
"MT_SAMMORPHBOMB", "MT_SAMMORPHPBOMB", "MT_SAMMBOP", "MT_SAMPOWERBOMB", "MT_SAMSPAWNITEM", "MT_SAMSPAWNITEMSONIC",

"MT_MPKU", "MT_BMPKU", "MT_SPKU", "MT_PBOM", "MT_NRGA", "MT_NRGB", "MT_NRGD", "MT_NRGH", 

"MT_MTNK", "MT_STNK", "MT_PTNK", "MT_MHBM", "MT_SPBS", "MT_GVST", "MT_VRST", "MT_BSBL", "MT_SPBL", "MT_SJMP", "MT_CHBM",
"MT_SPDRBL", "MT_PWGRP", "MT_SPBM", "MT_WVBM", "MT_ICBM", "MT_PLBM", "MT_ENGTNK", "MT_SATK")


--Effect dedicated objects, then misc.
SingleFreeSlot("MT_MPR1", "MT_MPR2", "MT_MPR3", "MT_MPR4", "MT_MPR5", "MT_MPR6", "MT_MPR7", "MT_MPR8", "MT_PBEXPAND", "MT_PBEXPANDI",
"MT_PBEXPANDW", "MT_SPACEJUMPWAVE", "MT_SAMUSZAP", "MT_SAMCHARGEGFX", "MT_SAMMISSILELIGHT", "MT_SAMUSEPARTICLE", 
"MT_SAMWINDLINE", "MT_SAMLIGHTLINE", "MT_SAMUSSHIP", "MT_SAMUSLIGHTS", "MT_FAKESAMUSTHOK", "MT_SAMWALLJUMP", "MT_SAMAUTOFRAME", 
"MT_PWGRPLD", "MT_SMONTRACKER", "MT_SFOETRACKER", "MT_SAMUSLOCKSEEK", "MT_SAMUSLOCKGFX", "MT_SAMDUMMYTRACKER", "MT_DUSTTRACKER")


--Metroids and Custom Bosses.
freeslot("MT_METROIDLARVAEGG", "MT_METROIDLARVA", "MT_METROID", "MT_SUPERMETROID", "MT_METROIDSHELL",
"MT_METROIDBOSS", "MT_METROIDPART", "MT_METROIDDROOL", "MT_METROIDSLASH", 
"MT_DARKPZSHADOW", "MT_DARKPZREMAINS", "MT_PZBOSS", "MT_PZTARGET", "MT_PZBARRIER", "MT_PZWAVEHOMER"
)

--Now for SFX. Check the bottom for sound captions that do a better job explaining what these are.
freeslot(
"sfx_h1pain", "sfx_h2pain", "sfx_h3pain", "sfx_eggahh",

"sfx_pbsh", "sfx_pbxp", "sfx_pbcha", "sfx_pbchao", "sfx_pbchaf", "sfx_pbchae", "sfx_sdenid", "sfx_smorph", "sfx_morphb",
"sfx_mssh", "sfx_mssh2", "sfx_misexp", "sfx_misxp2", "sfx_mread", "sfx_smsh", "sfx_smexp", "sfx_plxpz", "sfx_wvxpz", "sfx_msfrsz", 
"sfx_mlrv1", "sfx_mlrv2", "sfx_mlrvd", "sfx_mlrvh", "sfx_mlrvh", "sfx_mtrds", "sfx_mtrdd", "sfx_mtrdod", "sfx_mtrdof", "sfx_mtrdol",
"sfx_pbshsh", "sfx_samht5", "sfx_samht6",

"sfx_satkc", "sfx_satkf", "sfx_satkh", "sfx_sameme", "sfx_ssmenm", "sfx_ssmenc", "sfx_ssmenb", "sfx_samjin", "sfx_sballf", "sfx_sballr", "sfx_sballj", "sfx_ssuitu", "sfx_pbpku",

"sfx_spcm", "sfx_wvcm", "sfx_wvcm2", "sfx_iccm", "sfx_iccm2", "sfx_plcm", "sfx_cmol", "sfx_cmcha", "sfx_spdrbl", "sfx_samspa",

"sfx_mpku", "sfx_mbop", "sfx_nrga", "sfx_mtnk", "sfx_spwup", "sfx_spbsc", "sfx_sjmp", "sfx_swljp", "sfx_besw", "sfx_sprna", 
"sfx_sprnsp", "sfx_sprnh", "sfx_sprnc", "sfx_sprnp", "sfx_ssmens", "sfx_ssmeno", "sfx_bcrs", "sfx_spsh", "sfx_spchsh", 
"sfx_wvsh", "sfx_wvbc", "sfx_wvchsh", "sfx_icsh", "sfx_icfr", "sfx_icbf", "sfx_icbr", "sfx_icchsh", "sfx_plsh", "sfx_plchsh", 
"sfx_pldisi", "sfx_hbsh", "sfx_smcrit", "sfx_bmrefl", "sfx_samusp", "sfx_smobo", "sfx_shnuke", "sfx_pwbmb", "sfx_mbbmb",
"sfx_mbbmbx",

"sfx_mtrdor", "sfx_mtrdop", "sfx_mtrdow", "sfx_mtrdos", "sfx_mtrds1", "sfx_mtrdsd", "sfx_mtrdsp", "sfx_mtrdb", "sfx_mtrd1",
"sfx_mtrd2", "sfx_mtrdf", "sfx_mtrdl", "sfx_mtrdp", "sfx_cblade", "sfx_cbloc", "sfx_meggd", "sfx_sscan1", "sfx_sscan2", "sfx_samfld", 
"sfx_samlnd", "sfx_samllp", "sfx_samclb", "sfx_pzpain", "sfx_pzdead", "sfx_pzlaug", "sfx_pztele", "sfx_pzouch", 
"sfx_samtm1", "sfx_samtm2", "sfx_samtm3", "sfx_samtm4", "sfx_samtm5", "sfx_samtm6", "sfx_samtm7", "sfx_samtm8", 
"sfx_satkrl", "sfx_satklh"
)

G_AddGametype({
name = "HUNTERS",
identifier = "HUNTERS",
typeoflevel = TOL_MATCH|TOL_CTF,
rules = GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_DEATHPENALTY|GTR_DEATHMATCHSTARTS|GTR_HURTMESSAGES|GTR_POWERSTONES|GTR_FIRSTPERSON|GTR_RINGSLINGER,
intermissiontype = int_match,
defaultpointlimit = 5000,
defaulttimelimit = 10,
headerleftcolor = 59,
headerrightcolor = 58,	
description = "Power up and overwhelm all other hunters! Gain points from the amount of damage dealt. Balance fighting for points with powering up to determine who's the\x82 ultimate bounty hunter!"
})
G_AddGametype({
name = "TEAMHUNTERS",
identifier = "TEAMHUNTERS",
typeoflevel = TOL_MATCH|TOL_CTF,
rules = GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_DEATHMATCHSTARTS|GTR_HURTMESSAGES|GTR_POWERSTONES|GTR_FIRSTPERSON|GTR_RINGSLINGER|GTR_TEAMS,
intermissiontype = int_match,
defaultpointlimit = 5000,
defaulttimelimit = 10,
headerleftcolor = 38,
headerrightcolor = 152,
description = "Play the\x82 HUNTERS\x80 gametype, except in teams of\x85 RED\x80 and\x84 BLUE\x80"+"!"
})

if not MetroidVanguard
	rawset(_G,"MetroidVanguard",{})
end
rawset(_G,"SAMUSNETSAVES",true) --Going to use these as my settings now!
rawset(_G,"SAMUSCAMPAIGN",true)
rawset(_G,"SAMUSDIFFICULTY",1)
rawset(_G,"METROIDSKINS",true)

--Picks a player to be host. "s" is filler BS, ignore it.
MetroidVanguard.PickHost = function(s)
	for i = 1,2
		for z in players.iterate
			if z and z.valid
				if i==2 or (z == server or (IsPlayerAdmin(z)))
					return z --
				end
			end
		end
	end
end
--Function to check if we're in Hunters!
MetroidVanguard.HUNTERS = function(_)
	if (gametype == GT_HUNTERS) or (gametype == GT_TEAMHUNTERS)
		return true --
	end
end

--Setup Samus' variables so we can safely refer to them, without being bitched at for calculating with nil stuff.
rawset(_G, "SamusSetUp", function(p)
	p.samitemcolor = SKINCOLOR_GREY
	p.sambeamdrop = 0
	p.samitemgetname = "Unknown Item"
	p.samitemscale = FRACUNIT
	p.visorclosein = 0
	p.samhudmessageoffset = 0
	p.sams_completiontime = 0
	p.sams_beamanim = 0
	p.sam_energyflash = 0
	p.samxbeam = -109000
	p.samxbeamleft = true
	p.samybeam = 199900
	p.samybeamdown = false
	p.samybeamup = true
	p.sams_chargetimecd = 0
	p.sams_chargetime = 0
	p.sams_mshotcd = 0
	p.sams_morphcd = 0
	p.sams_morphbombcd = 0
	p.sams_jumpcd = 0
	p.sams_usecd = 0
	p.sams_firecd = 0
	p.sams_firecdjlg = 0
	p.sams_c1cd = 0
	p.sams_c1cdjlg = 0
	p.sams_c2cdjlg = 0
	p.crystalflashchance = 0
	p.sam_direct = 0
	p.sam_turnang = 0		
	p.samadrain = 1
	p.samvisorbob = 0
	p.samvisordropdist = 0
	p.samvisordropdist2 = 0
	p.sam_framejump = 5
	p.sam_spbsgrace = 0
	if p.sam_lockonpower == nil
		p.sam_lockonpower = 1
	end
	if p.sam_lockontoggle == nil
		p.sam_lockontoggle = true
	end
	if p.nosamustutorials == nil
		p.nosamustutorials = false
	end
	if not p.sam_respawnboxer
		p.sam_respawnboxer = 30
	end
	if p.tokensrb2style == nil
		p.tokensrb2style = 0
	end			
	if not p.sam_ammodigitizer
		p.sam_ammodigitizer = 1 --This is the ammo multiplier. 1 by default, 3 when you got the Ammo Digitizer!
	end	
	if (netgame or multiplayer)
		if not p.coopboxrespawn
			p.coopboxrespawn = 2
		end
		p.customsuitc1 = nil
		p.customsuitc2 = nil
		p.customsuitc3 = nil
	else
		p.customsuitc1 = SKINCOLOR_POWERSUIT
		p.customsuitc2 = SKINCOLOR_VARIASUIT
		p.customsuitc3 = SKINCOLOR_GRAVITYSUIT
	end
	
	p.sams_normfcdjlg = 0
	p.sammissiles = 5
	p.micatchup = 5
	if G_GametypeHasSpectators()
		p.sam_chargebeam = true
		p.sammissilesmax = 5
	else
		p.sam_chargebeam = false
		p.sammissilesmax = 0
	end
	p.samsupermissiles = 0
	p.smcatchup = 0
	p.samsupermissilesmax = 0
	p.sampw = 0
	p.pbcatchup = 0
	p.sampwmax = 0
	p.sams_supermissileready = 0
	p.sams_powerbombready = 0
	p.sams_c2cd = 0
	p.sams_normfcd = 0
	p.samspbs = false
	p.sam_power_grip = false
	local HOST = MetroidVanguard.HOST
	if not (HOST and HOST.valid)
		HOST = (MetroidVanguard.PickHost(0))
	end
	if (HOST and HOST.autospeedbooster == nil) --The first time, do...
		for m in mobjs.iterate(mobjs)
			if m.flags != nil
				if (m.flags & (MF_ENEMY|MF_BOSS))
				or (m.type == MT_DETON)
				or (m.type == MT_EGGSHIELD)
				or (m.type == MT_EGGGUARD)
				or (m.type == MT_MINUS)
					A_SAMUSMOBHP(m, HOST)
				end
			end
		end
	end
	p.autospeedbooster = 0
	
	p.samspbscharge = 0
	p.sam_shinespark = 0
	p.sam_shinesparkfly = 0
	p.sambsbl = false
	p.sam_spiderball = false
	p.sam_gravitysuit = 0
	p.gravityrd = 7
	p.sam_screwattack = false
	p.sam_highjump = false
	p.sam_spacejump = false
	p.sam_spacejumpedboost = 0
	p.sam_spazerbeam = false
	p.sam_wavebeam = false
	p.sam_icebeam = false
	p.sam_bombs = false
	p.sam_plasmabeam = false
	p.sam_hyperbeam = false
	p.sam_powerbeamcombo = false
	p.sam_spazerbeamcombo = false
	p.sam_wavebeamcombo = false
	p.sam_icebeamcombo = false
	p.sam_plasmabeamcombo = false
	SamResetBeam(p)
	p.sam_beamcolor = SKINCOLOR_POWERBEAM
	p.morphanim = false
	p.sammorphanimcd = 0
	p.sams_notyet = 0
	p.sammorphed = false
	p.sams_shotcd = 0
	p.sams_beamcombocharge = 0
	p.sam_energy = 99
	p.sam_energylimit = 99
	p.sam_hudenergy = 99
	p.sam_energytanksmax = 0
	p.sam_energytanks = 0
	p.sam_energytanksstart = (p.sam_energytanksstart) or 2
	p.sam_hyperbeamammo = 0
	p.sam_shinesparkdirect = 0
	p.sam_shinesparkdirectx = 85<<16
	p.sam_shinesparkdirectz = 0
	p.sampers = 1
	p.samhands = 0
	p.samexc = 0
	p.samvisoraimy = 0
	p.samvisoraimy2 = 0
	p.samvisoraimy3 = 0
	p.samangshift = 0
	p.mobjscan3 = 11
	p.mobjscan2 = 7
	p.mobjscan1 = 4
	p.mobjscan1weak = "WEAPSPBM"
	p.mobjscan2weak = "WEAPWVBM"
	p.mobjscan3weak = "WEAPPLBM"
	p.mobjscan2resist = "WEAPSPBM"
	p.mobjscan3resist = "WEAPWVBM"
	p.samvisorcolor = SKINCOLOR_CYAN
	p.sam_fpsmsg = 0
	p.sam_fullypoweredsuit = false
	
	p.sam_firstperson = true
	p.visorclosein = 15
--	SamCam(p, false)
	
	if p.sam_saveselect == nil
		p.sam_saveselected = 0
	end
	if p.samusloadconfig == nil
		p.samusloadconfig = 20 --Personal settings can load a few tics later.
	end
	if not p.samusloadconfig2 --Kind of important to load ASAP....
		AdminSamusSave(p, false, true)
		p.samusloadconfig2 = true
		if p.mo
			SetSamusColor(p.mo, p)
			p.mo.missiletrns = 0
			p.mo.supermissiletrns = 0
			p.mo.pwbtrns = 0
		end
	end
	if not p.samusmusicadded
		p.samusmusicadd2 = 3 --Space everything out carefully...the game WILL crash.
	end
	--Color failsafe.
	local MAXCOLOR = #skincolors-1
	if p.customsuitc1 and (p.customsuitc1 > MAXCOLOR)
		p.customsuitc1 = SKINCOLOR_POWERSUIT
	end
	if p.customsuitc2 and (p.customsuitc2 > MAXCOLOR)
		p.customsuitc2 = SKINCOLOR_VARIASUIT
	end
	if p.customsuitc3 and (p.customsuitc3 > MAXCOLOR)
		p.customsuitc3 = SKINCOLOR_GRAVITYSUIT
	end
	if p.samvisorcolor and (p.samvisorcolor > MAXCOLOR)
		p.samvisorcolor = SKINCOLOR_CYAN
	end
	return true --We did it!
end)

addHook("MobjSpawn", function(s)
	s.sam_sprst = true
	s.sam_sprstship = true	
end, MT_PLAYER)

G_AddGametype({
    name = "HUNTERS",
    identifier = "HUNTERS",
    typeoflevel = TOL_MATCH,
    rules = GTR_SPECTATORS|GTR_POINTLIMIT|GTR_TIMELIMIT|GTR_SPAWNINVUL|GTR_DEATHPENALTY|GTR_DEATHMATCHSTARTS|GTR_HURTMESSAGES|GTR_POWERSTONES|GTR_FIRSTPERSON|GTR_RINGSLINGER,
    rankingtype = GT_MATCH,
	intermissiontype = int_match,
	defaultpointlimit = 0,
	defaulttimelimit = 10,
    headerleftcolor = 59,
    headerrightcolor = 58,
    description = "Power up and overwhelm all other hunters! Gain points from the amount of damage dealt. Balance fighting for points with powering up to determine who's the\x82 ultimate bounty hunter!"
})

--P_Sam_FlashPal"
rawset(_G, "P_SamFP", function(p, PAL, TICS)
	if not p.sam_sensitive
		P_FlashPal(p, PAL, TICS)
	end
end) 

rawset(_G, "SAM_map", function(p)
	for z in players.iterate
		if z and z.sam_lastlvl != nil
			return z.sam_lastlvl 
		end
	end
	return gamemap --
end)

--Sound Settings. Captions are below.
sfxinfo[sfx_spwup] = {singular = true}
sfxinfo[sfx_h1pain] = {priority = 500000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_h2pain] = {priority = 500000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_h3pain] = {priority = 500000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_samht5] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_samht6] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_eggahh] = {priority = 500000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_plchsh] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_icsh] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_icbr] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_spchsh] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_wvchsh] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_smexp] = {priority = 700000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_pbchae] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_pbshsh] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_pbchaf] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mread] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_hbsh] = {priority = 880000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_spcm] = {priority = 900000,flags = SF_X8AWAYSOUND}
sfxinfo[sfx_wvcm] = {priority = 900000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_iccm] = {priority = 900000,flags = SF_X8AWAYSOUND}
sfxinfo[sfx_iccm2] = {priority = 900000,flags = SF_X8AWAYSOUND}
sfxinfo[sfx_plcm] = {priority = 800000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_smcrit] = {priority = 300000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_bmrefl] = {singular = true, priority = 600000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_pldisi] = {priority = 300000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_smobo] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_pwbmb] = {priority = 910000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_cmcha] = {priority = 910000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_satkrl] = {singular = true,priority = 99,flags = SF_NOMULTIPLESOUND|SF_X2AWAYSOUND}
sfxinfo[sfx_samusp] = {priority = 950000,flags = SF_NOMULTIPLESOUND}
sfxinfo[sfx_cmol] = {singular = true,priority = 1,flags = SF_NOMULTIPLESOUND|SF_X4AWAYSOUND}
sfxinfo[sfx_wvbc] = {singular = true,priority = 1,flags = SF_NOMULTIPLESOUND}
sfxinfo[sfx_pbpku] = {singular = true,priority = 1,flags = SF_NOMULTIPLESOUND|SF_X2AWAYSOUND}
sfxinfo[sfx_samllp] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_ssuitu] = {priority = 700001,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_mbbmbx] = {singular = true,}

sfxinfo[sfx_pzpain] = {singular = true,priority = 99,flags = SF_NOMULTIPLESOUND|SF_X2AWAYSOUND}
sfxinfo[sfx_sameme] = {singular = true, priority = 900000}
sfxinfo[sfx_pzlaug] = {priority = 500000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_pzdead] = {priority = 500000,flags = SF_X8AWAYSOUND}
sfxinfo[sfx_pzouch] = {priority = 480000,flags = SF_X4AWAYSOUND}
sfxinfo[sfx_pztele] = {singular = true, flags = SF_X2AWAYSOUND}
sfxinfo[sfx_plxpz] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_wvxpz] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_sprnsp] = {priority = 600000,flags = SF_X2AWAYSOUND}
sfxinfo[sfx_shnuke] = {flags = SF_X2AWAYSOUND}

sfxinfo[sfx_mlrvd] = {flags = SF_X4AWAYSOUND}
sfxinfo[sfx_mlrv1] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mlrv2] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mtrdb] = {flags = SF_X4AWAYSOUND}

sfxinfo[sfx_mtrd1] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mtrd2] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mtrdf] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mtrdp] = {flags = SF_X2AWAYSOUND}
sfxinfo[sfx_mtrdl] = {flags = SF_X4AWAYSOUND}
sfxinfo[sfx_mtrdd] = {flags = SF_X8AWAYSOUND}

sfxinfo[sfx_mtrdod] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdop] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdof] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdol] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdor] = {flags = SF_X8AWAYSOUND|SF_X4AWAYSOUND, priority = 910000}
sfxinfo[sfx_mtrdow] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdos] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_cblade] = {flags = SF_X8AWAYSOUND}

sfxinfo[sfx_mtrdsp] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrds1] = {flags = SF_X8AWAYSOUND}
sfxinfo[sfx_mtrdsd] = {flags = SF_X8AWAYSOUND}


--Sound Captions!

sfxinfo[sfx_samjin].caption = "Samus Appearance Fanfare"
sfxinfo[sfx_samspa].caption = "Samus Spawn"
sfxinfo[sfx_spdrbl].caption = "Spiderballin'"
sfxinfo[sfx_sballf].caption = "Morph Ball Thud"
sfxinfo[sfx_samfld].caption = "Tough Landing"
sfxinfo[sfx_samlnd].caption = "Samus Landing"
sfxinfo[sfx_samllp].caption = "Ledge Leap"
sfxinfo[sfx_samclb].caption = "Power Grip Grab"
sfxinfo[sfx_sballj].caption = "Spring Ball"
sfxinfo[sfx_sballr].caption = "Rollin'"
sfxinfo[sfx_ssuitu].caption = "Power Suit upgrade"
sfxinfo[sfx_ssmenc].caption = "Menu Confirm"
sfxinfo[sfx_ssmenb].caption = "Menu Back"
sfxinfo[sfx_ssmenm].caption = "Menu Move"
sfxinfo[sfx_ssmeno].caption = "Menu 4"
sfxinfo[sfx_ssmens].caption = "Menu 5"
sfxinfo[sfx_pbsh].caption = "Power Beam"
sfxinfo[sfx_mssh].caption = "Missile Launch"
sfxinfo[sfx_mssh2].caption = "Missile Fired"
sfxinfo[sfx_spsh].caption = "Spazer Beam"
sfxinfo[sfx_spchsh].caption = "Spazer ChargeShot"
sfxinfo[sfx_wvsh].caption = "Wave Beam"
sfxinfo[sfx_wvxpz].caption = "Wave Impact"
sfxinfo[sfx_wvbc].caption = "Electric Discharge"
sfxinfo[sfx_wvchsh].caption = "Wave ChargeShot"
sfxinfo[sfx_icsh].caption = "Ice Beam"
sfxinfo[sfx_icfr].caption = "Freeze Effect"
sfxinfo[sfx_icchsh].caption = "Ice ChargeShot"
sfxinfo[sfx_icbr].caption = "Ice Break"
sfxinfo[sfx_icbf].caption = "Ice Impact"
sfxinfo[sfx_satkc].caption = "Screw Attack Charge"
sfxinfo[sfx_satkf].caption = "Screw Attack Launch"
sfxinfo[sfx_satklh].caption = "Screw Attack Walljump"
sfxinfo[sfx_satkrl].caption = "Screw Attacking"
sfxinfo[sfx_satkh].caption = "Screw Attack Impact"
sfxinfo[sfx_plsh].caption = "Plasma Beam"
sfxinfo[sfx_plxpz].caption = "Plasma Impact"
sfxinfo[sfx_plchsh].caption = "Plasma ChargeShot"
sfxinfo[sfx_hbsh].caption = "Hyper Beam"
sfxinfo[sfx_spcm].caption = "Spazer Combo"
sfxinfo[sfx_wvcm].caption = "Wave Combo 1"
sfxinfo[sfx_wvcm2].caption = "Wave Combo 2"
sfxinfo[sfx_iccm].caption = "Ice Combo 1"
sfxinfo[sfx_iccm2].caption = "Ice Combo 2"
sfxinfo[sfx_plcm].caption = "Plasma Combo"
sfxinfo[sfx_cmol].caption = "Death Ball"
sfxinfo[sfx_cmcha].caption = "Combo Charging!"
sfxinfo[sfx_mread].caption = "Weapon Primed"
sfxinfo[sfx_smsh].caption = "Super Missile Launch"
sfxinfo[sfx_smexp].caption = "Super Explosion"
sfxinfo[sfx_misexp].caption = "Missile Explosion"
sfxinfo[sfx_misxp2].caption = "Missile Explosion"
sfxinfo[sfx_sdenid].caption = "Inaccessible!"
sfxinfo[sfx_smorph].caption = "Morphing"
sfxinfo[sfx_morphb].caption = "Unmorphing"
sfxinfo[sfx_pbxp].caption = "Power Beam impact"
sfxinfo[sfx_pbcha].caption = "Beam Charge"
sfxinfo[sfx_pbchaf].caption = "Powerbeam ChargeShot"
sfxinfo[sfx_pbchae].caption = "Chargeshot Explode"
sfxinfo[sfx_pbchao].caption = "Beam Charging..."
sfxinfo[sfx_sameme].caption = "Low Energy!"
sfxinfo[sfx_h1pain].caption = "Samus in Pain"
sfxinfo[sfx_h2pain].caption = "Samus in alot of Pain"
sfxinfo[sfx_h3pain].caption = "Samus in much Pain"
sfxinfo[sfx_mbop].caption = "Mass Destruction Incoming"
sfxinfo[sfx_pwbmb].caption = "Power Bomb Explosion"
sfxinfo[sfx_mbbmb].caption = "Bomb Drop"
sfxinfo[sfx_mbbmbx].caption = "Morph Bomb"
sfxinfo[sfx_smobo].caption = "Multi-Bombs"
sfxinfo[sfx_mpku].caption = "Ammo Pickup"
sfxinfo[sfx_nrga].caption = "Energy Pickup"
sfxinfo[sfx_spwup].caption = "Item Obtained!"
sfxinfo[sfx_mtnk].caption = "Capacity Upgrade"
sfxinfo[sfx_spbsc].caption = "BoostBall Charge"
sfxinfo[sfx_sprnc].caption = "Thrusters Activating"
sfxinfo[sfx_sprna].caption = "Speedbooster Activate!"
sfxinfo[sfx_sprnsp].caption = "Shinespark Activate!"
sfxinfo[sfx_sprnh].caption = "Wall Crash"
sfxinfo[sfx_sprnp].caption = "Shinespark Ready"
sfxinfo[sfx_sjmp].caption = "Space Jump"
sfxinfo[sfx_swljp].caption = "Wall-jump"
sfxinfo[sfx_besw].caption = "Beam Switch"
sfxinfo[sfx_bcrs].caption = "Beam Cooled!"
sfxinfo[sfx_samusp].caption = "Full Power Suit"
sfxinfo[sfx_pbpku].caption = "Rare pickup nearby..."
sfxinfo[sfx_eggahh].caption = "AAAAAAAAAAAAAAAAAAAAAAAAAAH!!!!!"
sfxinfo[sfx_mtrds1].caption = "Metroid"
sfxinfo[sfx_mtrdsd].caption = "Super Metroid pain"
sfxinfo[sfx_mtrdb].caption = "Explosion"
sfxinfo[sfx_mtrdos].caption = "Flame Wave"
sfxinfo[sfx_mtrdop].caption = "Hard Stomp"
sfxinfo[sfx_mtrdor].caption = "Omega Roar"
sfxinfo[sfx_mtrdol].caption = "Giant Leap"
sfxinfo[sfx_mtrdof].caption = "Footstep"
sfxinfo[sfx_mtrdod].caption = "Omega Death"
sfxinfo[sfx_mtrdow].caption = "Metroid Warning"
sfxinfo[sfx_mtrdd].caption = "Metroid Death"
sfxinfo[sfx_cblade].caption = "Sonic Slash"
sfxinfo[sfx_cbloc].caption = "Interrupted"
sfxinfo[sfx_meggd].caption = "Discovery"
sfxinfo[sfx_mtrds].caption = "Health Drain"
sfxinfo[sfx_mtrdp].caption = "Preparing Attack"
sfxinfo[sfx_mtrdl].caption = "Metroid Lunge"
sfxinfo[sfx_mtrdf].caption = "Metroid Float"
sfxinfo[sfx_mtrdsp].caption = "Metroid's dying cry"
sfxinfo[sfx_mtrd1].caption = "Metroid"
sfxinfo[sfx_mtrd2].caption = "Agitated Metroid"
sfxinfo[sfx_mlrvh].caption = "Egg hatching..."
sfxinfo[sfx_mlrv1].caption = "Larva Metroid"
sfxinfo[sfx_mlrv2].caption = "Larva Metroid"
sfxinfo[sfx_mlrvd].caption = "Larva Metroid's dying cry"
sfxinfo[sfx_pzpain].caption = "Phazon Damage"
sfxinfo[sfx_pzlaug].caption = "\x85 GET OUT OF THERE!! \x80"
sfxinfo[sfx_pzouch].caption = "PZ Pain grunt"
sfxinfo[sfx_pzdead].caption = "PZ Dying scream"
sfxinfo[sfx_smcrit].caption = "\x83 CRITICAL HIT! \x80"
sfxinfo[sfx_bmrefl].caption = "Reflection!"
sfxinfo[sfx_pldisi].caption = "Disintegration"
sfxinfo[sfx_samtm1].caption = "Transmission"
sfxinfo[sfx_samtm2].caption = "Navigator System"
sfxinfo[sfx_samtm3].caption = "Samus Aran"
sfxinfo[sfx_samtm4].caption = "transceiving info"
sfxinfo[sfx_samtm5].caption = "transceiving info"
sfxinfo[sfx_samtm6].caption = "transceiving info"
sfxinfo[sfx_samtm7].caption = "transmission off"
sfxinfo[sfx_samtm8].caption = "Target Acquired"