-- freeslot just a sound
freeslot("sfx_rdfail")
sfxinfo[sfx_rdfail].caption = "You won nothing!"

--now for the things i had to recreate from FUCKING SOURCE (spaghetti)
--[[
local function P_SpectatorJoinGame(p)
	if not p and p.valid then return false end
    if not G_CoopGametype() and not CV_FindVar(allowteamchange).value then
        if P_IsLocalPlayer(p) then
            CONS_Printf(p, "Server does not allow team change.")
        end
        p.powers[pw_flashing] = p.powers[pw_flashing] + 2 * TICRATE -- to prevent message spam.
    elseif G_GametypeHasTeams() then
        local changeto = 0
        local numplayersred, numplayersblue = 0, 0

        for sp in players.iterate do
            if sp and sp.valid then
                if sp.ctfteam == 1 then
                    numplayersred = $+1
                elseif sp.ctfteam == 2 then
                    numplayersblue = $+1
                end
            end
        end

        if numplayersblue > numplayersred then
            changeto = 1
        elseif numplayersred > numplayersblue then
            changeto = 2
        elseif bluescore > redscore then
            changeto = 1
        elseif redscore > bluescore then
            changeto = 2
        else
            changeto = (P_RandomFixed() % 2) + 1
        end

        if p.mo then
            P_RemoveMobj(p.mo)
            p.mo = nil
        end
        p.spectator = false
        p.ctfteam = changeto
        p.playerstate = PST_REBORN

        if P_IsLocalPlayer(p) and displayplayer ~= consoleplayer then
            displayplayer = consoleplayer
        end

        if changeto == 1 then
            print(p.name.." switched to the\x85 Red team\x80.")
        elseif changeto == 2 then
            print(p.name.." switched to the\x84 Blue team\x80.")
        end

        return true
    else
        if not ((gametyperules & GTR_HIDEFROZEN) ~= 0 and leveltime > (hidetime * TICRATE)) then
            if p.mo then
                P_RemoveMobj(p.mo)
                p.mo = nil
            end
            p.spectator = false
            p.outofcoop = false
            p.playerstate = PST_REBORN

            if (gametyperules & (GTR_TAG | GTR_HIDEFROZEN)) == GTR_TAG then
                if leveltime > (hidetime * TICRATE) then
                    print(p.name.." is now IT!")
                    p.pflags = $|PF_TAGIT
                end
            end

            if P_IsLocalPlayer(p) and displayplayer ~= consoleplayer then
                displayplayer = consoleplayer
            end

            if not G_CoopGametype() then
                print(p.name.." entered the game.")
            end
            return true
        else
            if P_IsLocalPlayer(p) then
                print("You must wait until next round to enter the game.")
            end
            p.powers[pw_flashing] = p.powers[pw_flashing] + 2 * TICRATE -- to prevent message spam.
        end
    end
    return false
end
local function P_RTDPlayerLives(p, lives)
	local prevlives = p.lives
	if not p then
		return
	end
	if p.bot then
		p = players[consoleplayer]
	end
	if (gamestate == GS_LEVEL) then
		if (p.lives == INFLIVES or not (gametyperules & GTR_LIVES)) then
			if p.rtdsuper then
				p.mo.stored_rings = $+(100*lives)
			else
				P_GivePlayerRings(p, 100*lives)
			end
			return
		end
		if (netgame or multiplayer) and G_GametypeUsesCoopLives() and not (CV_FindVar(cooplives) and CV_FindVar(cooplives).value) then
			P_GivePlayerRings(p, 100*lives)
			if (p.lives - prevlives >= lives) then
				if (CV_FindVar(coopstarposts) and CV_FindVar(coopstarposts).value) or (prevlives > 0) or not p.spectator then
					return
				end
				P_SpectatorJoinGame(p)
			end
			lives = lives + prevlives - p.lives
		end
	elseif (p.lives == INFLIVES) then
		return
	end
	p.lives = $+lives
	if (p.lives > 99) then
		p.lives = 99
	elseif (p.lives < 1) then
		p.lives = 1
	end
end
local function P_RTDCoopLives(p, lives, sound)
	if not (netgame or multiplayer) and G_GametypeUsesCoopLives() then
		P_RTDPlayerLives(p, lives)
		if sound then
			P_PlayLivesJingle(p)
		end
	else
		for sp in players.iterate do
			P_RTDPlayerLives(sp, lives)
			if sound then
				P_PlayLivesJingle(sp)
			end
		end
	end
end
local function validPlayer(m)
	return (m and m.valid and m.player and m.player.valid)
end
function A_RingBox(actor)
	local p = (validPlayer(actor.target) and actor.target.player or nil)
	if p == nil then return true end
	if p.rtdsuper then
		p.mo.stored_rings = $+actor.info.reactiontime
	else
		P_GivePlayerRings(p, actor.info.reactiontime)
	end
	if (actor.info.seesound) then
		S_StartSound(p.mo, actor.info.seesound)
	end
	return true
end
function A_ExtraLife(actor)
	if (actor.type == MT_1UP_ICON and actor.tracer) then
		actor.sprite = SPR_TV1P
	end
	if ultimatemode then
		S_StartSound(p.mo, sfx_lose)
		return true
	end
	local p = (validPlayer(actor.target) and actor.target.player or nil)
	if p == nil then return true end
	P_RTDCoopLives(p, 1, true)
end
--]]

do
	local namespace = "CDRTD"
	if type(rawget(_G, namespace)) ~= "table" then
		rawset(_G, namespace, {})
	end
end
CDRTD.functions = {}
CDRTD.SuperList = {}