addHook("MobjThinker", function(mobj)
	if gamemap == 256 or gamemap == 257
		mobj.state = S_ROCKCRUMBLEG
	end
end, MT_ROCKCRUMBLE1)

addHook("MapLoad", do
	if cv_altlevels.value == 1
		if gamemap == 246
			sectors[172].floorpic = "BLUEFLR"
			sectors[173].floorheight = 192*FRACUNIT
		elseif gamemap == 249
			sectors[104].ceilingheight = 0
		elseif gamemap == 252
			sectors[393].ceilingheight = -692*FRACUNIT
			sectors[386].ceilingheight = -692*FRACUNIT
			sectors[389].floorpic = "BLUEFLR"
			sectors[389].ceilingpic = "BLUEFLR"
		elseif gamemap == 255
			sectors[82].floorheight = 1996*FRACUNIT
		elseif gamemap == 264
			sectors[103].floorpic = "REDFLR"
			sectors[65].floorheight = 2746*FRACUNIT
		elseif gamemap == 267
			sectors[81].floorpic = "REDFLR"
			sectors[82].ceilingheight = 256*FRACUNIT
		elseif gamemap == 270
			sectors[74].floorheight = 2500*FRACUNIT
		end
	end
	if gamemap == 245
		if multiplayer
			P_SpawnMobj(-13760*FRACUNIT, 4080*FRACUNIT, 1164*FRACUNIT, MT_SIGN)
			P_SpawnMobj(-13760*FRACUNIT, 2800*FRACUNIT, 1164*FRACUNIT, MT_SIGN)
		end
	elseif gamemap == 260
		for sector in sectors.iterate
			sector.lightlevel = $ + 32
		end
	end
end)

rawset(_G, "cv_altlevels", CV_RegisterVar({
	name = "tei_altlevels",
	defaultvalue = 0,
	flags = CV_NETVAR|CV_CALL|CV_NOINIT,
	PossibleValue = CV_OnOff,
	func = function()
		print("Changes will be applied in the next levels.")
	end,
}))