dofile("scripts/entities/entityinclude.lua")

function init()
--[[
	if isFlag(FLAG_VISION_ENERGYTEMPLE, 0) then
		debugLog("PLAYING LIGHT!!!")
		playMusic("light")
	end
	]]--
	--fadeIn(1)
	--watch(1)
	
	if isFlag(FLAG_ENDING, ENDING_MAINAREA) then
		overrideZoom(1)
		overrideZoom(0.6, 15)
		
		
		dummy = createEntity("Empty")
		
		na1 = getNode("endpana1")
		nb1 = getNode("endpanb1")
		na2 = getNode("endpana2")
		nb2 = getNode("endpanb2")
		
		setCameraLerpDelay(0)
		cam_toEntity(dummy)
		entity_setPosition(dummy, node_x(na1), node_y(na2))
		watch(0.4)
		
		entity_setPosition(dummy, node_x(nb1), node_y(nb1), 15, 0, 0, 1)
	
		fade2(0, 1, 1, 1, 1)
		fadeIn(1)
		watch(1)
		
		playVoice("naija_endingpart1b")
		
		watch(7)
		
		fade2(1, 0.5, 1, 1, 1)
		watch(0.5)
		
		-- do stuff
		entity_warpToNode(dummy, na2)
		watch(1)
		
		
		entity_setPosition(dummy, node_x(nb2), node_y(nb2), 13, 0, 0, 1)
	
		
		overrideZoom(0.6)
		overrideZoom(1, 15)
		
		fade2(0, 1, 1, 1, 1)
		watch(2)
		
		playVoice("naija_endingpart1c")
		
		watchForVoice()
		
		fade2(1, 0.5, 1, 1, 1)
		watch(0.5)
		
		setFlag(FLAG_ENDING, ENDING_SECRETCAVE)
		loadMap("NaijaCave")
		
		--fade2(0, 0.5, 1, 1, 1)
	end
end

