-----------------------------------------------------------------------------------------------
-- makeClut : Function to set up all the required game colors from a particular bitmap
-----------------------------------------------------------------------------------------------

-- function AllInOnePaletteEntry(offsetX, offsetY, i, j)
	-- return Palette(offsetX * 32 + i, offsetY * 32 + j)
-- end

function makeClutAllInOne(timeId, clutName)

	x = timeId
	y = GetSeason()

	makeClutAllInOne2(x, y, clutName)
end
	
function makeClutAllInOne2(x, y, clutName)

	clut = Clut(clutName) 

	clut:AddEntry("cloud_above", AllInOnePaletteEntry(x,y,0,0), "Clouds", 0)
	clut:AddEntry("cloud_below", AllInOnePaletteEntry(x,y,1,0), "Clouds", 0)
	clut:AddEntry("atmos_fogSky", AllInOnePaletteEntry(x,y,2,0), "Fog;Sky", 0)
	clut:AddEntry("atmos_fogGround", AllInOnePaletteEntry(x,y,3,0), "Fog", 0)
	clut:AddEntry("atmos_sky", AllInOnePaletteEntry(x,y,4,0), "Sky", 0)

	clut:AddEntry("cel_sun", AllInOnePaletteEntry(x,y,5,0), "Celestial", 0)
	clut:AddEntry("cel_moon", AllInOnePaletteEntry(x,y,6,0), "Celestial", 0)
	clut:AddEntry("cel_star1", AllInOnePaletteEntry(x,y,7,0), "Celestial", 0)
	clut:AddEntry("cel_star2", AllInOnePaletteEntry(x,y,8,0), "Celestial", 0)
	
	clut:AddEntry("gen_tint", AllInOnePaletteEntry(x,y,15,0), "Lighting", 0)

	clut:AddEntry("trunk_MidBrown", AllInOnePaletteEntry(x,y,0,2), "Objects", 1)
	clut:AddEntry("trunk_DarkGrey", AllInOnePaletteEntry(x,y,1,2), "Objects", 1)
	clut:AddEntry("trunk_MidGrey", AllInOnePaletteEntry(x,y,2,2), "Objects", 1)

	clut:AddEntry("fol_Oak1", AllInOnePaletteEntry(x,y,3,2), "Objects", 0.999)
	clut:AddEntry("fol_Oak2", AllInOnePaletteEntry(x,y,4,2), "Objects", 0.999)
	clut:AddEntry("fol_Oak3", AllInOnePaletteEntry(x,y,5,2), "Objects", 0.999)

	clut:AddEntry("fol_DarkPine1", AllInOnePaletteEntry(x,y,6,2), "Objects", 0.999)
	clut:AddEntry("fol_DarkPine2", AllInOnePaletteEntry(x,y,7,2), "Objects", 0.999)
	clut:AddEntry("fol_DarkPine3", AllInOnePaletteEntry(x,y,8,2), "Objects", 0.999)

	clut:AddEntry("fol_Yellowish", AllInOnePaletteEntry(x,y,9,2), "Objects", 0.999)
	clut:AddEntry("fol_Spruce", AllInOnePaletteEntry(x,y,10,2), "Objects", 0.999)
	clut:AddEntry("fol_Blossom2", AllInOnePaletteEntry(x,y,11,2), "Objects", 0.999)
	clut:AddEntry("fol_Blossom3", AllInOnePaletteEntry(x,y,12,2), "Objects", 0.999)
	
	clut:AddEntry("trunk_Fruit", AllInOnePaletteEntry(x,y,13,2), "Objects", 1)

	clut:AddEntry("built_Tower", AllInOnePaletteEntry(x,y,14,2), "Objects", 1)
	clut:AddEntry("built_Menhir", AllInOnePaletteEntry(x,y,15,2), "Objects", 1)

	clut:AddEntry("terr_ocean", AllInOnePaletteEntry(x,y,0,3), "Terrain", 1)
	clut:AddEntry("terr_beach", AllInOnePaletteEntry(x,y,1,3), "Terrain", 1)
	clut:AddEntry("terr_grass1", AllInOnePaletteEntry(x,y,2,3), "Terrain", 1)
	clut:AddEntry("terr_grass2", AllInOnePaletteEntry(x,y,3,3), "Terrain", 1)
	clut:AddEntry("terr_high1", AllInOnePaletteEntry(x,y,4,3), "Terrain", 1)
	clut:AddEntry("terr_high2", AllInOnePaletteEntry(x,y,5,3), "Terrain", 1)
	clut:AddEntry("terr_snow1", AllInOnePaletteEntry(x,y,6,3), "Terrain", 1)
	clut:AddEntry("terr_snow2", AllInOnePaletteEntry(x,y,7,3), "Terrain", 1)
	clut:AddEntry("terr_bare1", AllInOnePaletteEntry(x,y,8,3), "Terrain", 1)
	clut:AddEntry("terr_bare2", AllInOnePaletteEntry(x,y,9,3), "Terrain", 1)
	clut:AddEntry("terr_path", AllInOnePaletteEntry(x,y,10,3), "Terrain", 1)

	clut:AddEntry("plant_yellowflower", AllInOnePaletteEntry(x,y,0,4), "Objects", 1)
	clut:AddEntry("plant_blueflower", AllInOnePaletteEntry(x,y,1,4), "Objects", 1)
	clut:AddEntry("plant_moss", AllInOnePaletteEntry(x,y,2,4), "Objects", 1)
	clut:AddEntry("plant_bracken", AllInOnePaletteEntry(x,y,3,4), "Objects", 1)
	clut:AddEntry("plant_willowherb", AllInOnePaletteEntry(x,y,6,4), "Objects", 1)
	clut:AddEntry("plant_seaweed", AllInOnePaletteEntry(x,y,7,4), "Objects", 1)
	clut:AddEntry("plant_cranberry", AllInOnePaletteEntry(x,y,8,4), "Objects", 0.999)
	clut:AddEntry("plant_chanterelle", AllInOnePaletteEntry(x,y,9,4), "Objects", 1)
	clut:AddEntry("plant_bullrush", AllInOnePaletteEntry(x,y,10,4), "Objects", 1)
	clut:AddEntry("plant_pimpernel", AllInOnePaletteEntry(x,y,11,4), "Objects", 1)

	-- special cols in the "not affected by tints" row
	clut:AddEntry("plant_magicred", AllInOnePaletteEntry(x,y,0,5), "Objects", 0)
	clut:AddEntry("plant_greennoctilucent", AllInOnePaletteEntry(x,y,1,5), "Objects", 0)
	clut:AddEntry("cel_aurora1", AllInOnePaletteEntry(x,y,2,5), "Celestial", 0)
	clut:AddEntry("cel_aurora2", AllInOnePaletteEntry(x,y,3,5), "Celestial", 0)
	
	clut:AddEntry("creature_worm1", AllInOnePaletteEntry(x,y,0,6), "Objects", 1)
	clut:AddEntry("creature_worm2", AllInOnePaletteEntry(x,y,1,6), "Objects", 1)
	clut:AddEntry("creature_worm3", AllInOnePaletteEntry(x,y,2,6), "Objects", 1)
	clut:AddEntry("creature_worm4", AllInOnePaletteEntry(x,y,3,6), "Objects", 1)
	clut:AddEntry("creature_flashbug", AllInOnePaletteEntry(x,y,4,6), "Objects", 0)
	clut:AddEntry("creature_crab", AllInOnePaletteEntry(x,y,5,6), "Objects", 1)
	clut:AddEntry("creature_owl", AllInOnePaletteEntry(x,y,6,6), "Objects", 0.75)
	clut:AddEntry("creature_bee", AllInOnePaletteEntry(x,y,7,6), "Objects", 1)
	clut:AddEntry("creature_mayfly", AllInOnePaletteEntry(x,y,8,6), "Objects", 1)
	clut:AddEntry("creature_frogA", AllInOnePaletteEntry(x,y,9,6), "Objects", 0.999)
	clut:AddEntry("creature_frogB", AllInOnePaletteEntry(x,y,10,6), "Objects", 0.999)
	clut:AddEntry("creature_frogC", AllInOnePaletteEntry(x,y,11,6), "Objects", 0)
	clut:AddEntry("creature_lovebird", AllInOnePaletteEntry(x,y,12,6), "Objects", 0.5)
	clut:AddEntry("creature_bat", AllInOnePaletteEntry(x,y,13,6), "Objects", 1)
	clut:AddEntry("creature_guide", AllInOnePaletteEntry(x,y,14,6), "Objects", 0)
	clut:AddEntry("creature_foxspirit", AllInOnePaletteEntry(x,y,15,6), "Objects", 0)
	clut:AddEntry("creature_squirrel", AllInOnePaletteEntry(x,y,0,7), "Objects", 1)
	clut:AddEntry("creature_quail", AllInOnePaletteEntry(x,y,1,7), "Objects", 0.999)
	clut:AddEntry("creature_frogD", AllInOnePaletteEntry(x,y,2,7), "Objects", 1)
	clut:AddEntry("creature_frogE", AllInOnePaletteEntry(x,y,3,7), "Objects", 1)
	clut:AddEntry("fol_Xmas", AllInOnePaletteEntry(x,y,4,7), "Objects", 0.9)
	clut:AddEntry("creature_quail2", AllInOnePaletteEntry(x,y,5,7), "Objects", 1)

	AddClut(clut)

end


-----------------------------------------------------------------------------------------------
-- main code
-----------------------------------------------------------------------------------------------

makeClutAllInOne(0,"midnight")
makeClutAllInOne(1,"predawn")
makeClutAllInOne(2,"dawn")
makeClutAllInOne(3,"am")
makeClutAllInOne(4,"noon")
makeClutAllInOne(5,"pm")
makeClutAllInOne(6,"dusk")
makeClutAllInOne(7,"evening")

makeClutAllInOne2(0,4,"vigTree")
makeClutAllInOne2(1,4,"vigIcy")
makeClutAllInOne2(2,4,"vigWood")
makeClutAllInOne2(3,4,"vigStars")
makeClutAllInOne2(4,4,"vigStarsB")
makeClutAllInOne2(5,4,"vigSepia")
makeClutAllInOne2(6,4,"vigWeirdSummerNeg")
makeClutAllInOne2(7,4,"vigWeirdAutumnNeg")

makeClutAllInOne2(0,5,"vigBrightFlowersAdd")
makeClutAllInOne2(1,5,"vigFirelightAdd")
makeClutAllInOne2(2,5,"vigSaturationAdd")
makeClutAllInOne2(3,5,"vigWhite")
makeClutAllInOne2(4,5,"vigPinklightAdd")

makeClutAllInOne2(0,6,"vigMagic1")
makeClutAllInOne2(1,6,"vigMagic2")
makeClutAllInOne2(2,6,"vigMagic3")

SetClut("vigTree")

