#include "ui/menudef.h"
#include "ui/tabs.h"

////////////////////////////////////
//
// CONSTANTS
//
//


#define OPTION_COLOR		0 0 .1 1
#define Tab_Color1			0 0 0 1
#define Tab_Color2			0 0 .5 1
#define VSPACE				16
#define VSIZE				16
#define ICON_ALPHA			0.5
#define LINE_ALPHA			0.2
#define FADEIN_TIME			125
#define HINT_COLOR			.25 .25 .25
#define HINT_FADE_TIME		125
#define TAB_HEIGHT			20
#define LINE_WIDTH			300


////////////////////////////////////
//
// MENU DEFINITION
//
//

{
    menuDef {
	name "options_menu"
	visible MENU_FALSE				// Visible on open
	//fullScreen MENU_FALSE
	focusColor RQ3_MAIN_FOCUSCOLOR			// Menu focus color for text and items
	rect 120 112 344 264
	anglevectors 3 -87
	style WINDOW_STYLE_EMPTY
	popup
	
	onOOBClick { close _self }
	onOpen { play "sound/ui/whoosh3.wav" ; 
		setitemcolor hints forecolor HINT_COLOR 1 ; hide hints ;
		ACTIVATE_TAB(1) ;
	}
	onClose { open _prev }
	onEsc { close _self }

	onOpenSpecial {
		//normal items
		ALPHA_FADE_FORE(fade_alpha, 1) ;

		//icon - special alpha
		ALPHA_FADE_FORE(icon, ICON_ALPHA) ;

		//line - special alpha; using backcolor
		ALPHA_FADE_BACK(line, LINE_ALPHA) ;
	}



	itemDef {
	renderpoint
	name "paper,fade_alpha"
	style WINDOW_STYLE_SHADER
	background UI_ASSETS"/paper_1"
	forecolor MENUCOLOR_OPTIONS 1
	rect -8 -16 380 320
	anglevectors 3 -87
	visible 1
	menuAnchor
	decoration
    }

	itemdef {
	renderpoint
	name "title,fade_alpha"
	text "Game options:"
	forecolor .6 .0 .0 1
	style WINDOW_STYLE_EMPTY
	textalign ITEM_ALIGN_LEFT
	textalignx 4
	textaligny 24
	textscale RQ3_MAIN_TEXTSIZE
	alignrect paper ITEM_ALIGN_LEFT 32 32 240 36 
	visible 1
	autowrapped
	decoration
    }

	//Line

    itemDef {
	name "line,fade_alpha"
	style WINDOW_STYLE_FILLED
	backcolor .25 .25 .25 LINE_ALPHA
	alignrect "title" ITEM_ALIGN_LEFT 0 48 LINE_WIDTH 2
	visible 1
	decoration
	}

    ///////////////////////////////////////////////////////////
    //
    // Sub-options
    //
    //

	// Gameplay
	ADD_TAB(
		"^_G^_ameplay.",
		"G", 1, "group2,group3",
		alignrect "title" ITEM_ALIGN_LEFT 2 28 52 TAB_HEIGHT
	)
    ADD_HINT("hint_tab1", "Change gameplay options", "group2,group3")

//---------------------------------------------------------

	// Crosshair

	ADD_TAB(
		"^_C^_rosshair.",
		"C", 2, "group1,group3",
		alignrect "tab1" ITEM_ALIGN_RIGHT -52 0 52 TAB_HEIGHT
	)
    ADD_HINT("hint_tab2", "Change crosshair shape, size and color", "group1,group3")

//---------------------------------------------------------

	// SSG Crosshair

	ADD_TAB(
		"^_S^_SG Crosshair.",
		"S", 3, "group1,group2",
		alignrect "tab2" ITEM_ALIGN_RIGHT -76 0 76 TAB_HEIGHT
	)
    ADD_HINT("hint_tab3", "Change the shape, size and color of the sniper rifle crosshair", "group1,group2")

/*
==========================================================

Group # 1 - Gameplay

==========================================================
*/

    //Icon

    itemdef {
	name "icon,allgroups,group1"
	background UI_ASSETS"/icons/rq3-setup-options"
	forecolor 1 1 1 ICON_ALPHA
	alignrect "line" ITEM_ALIGN_RIGHT 0 -36 32 32
	style WINDOW_STYLE_SHADER
	visible 1
	decoration
	}

    // Simple items //

	BEGIN_OPTION("Simple items", "cg_simpleitems", ITEM_TYPE_YESNO, 1, 1)
		kind YESNO_ICON_RIGHT
		alignrect "line" ITEM_ALIGN_LEFT 112 32 32 VSIZE
		ASSIGN_HINT("hint_simpleitems")
	END_OPTION
    ADD_HINT("hint_simpleitems", "Display weapons, items and ammo as 2D sprites", "group1")


	// Low quality sky //

	BEGIN_OPTION("Low quality sky", "r_fastsky", ITEM_TYPE_YESNO, 2, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl1")
		ASSIGN_HINT("hint_fastsky")
	END_OPTION
	ADD_HINT("hint_fastsky", "Use a solid color sky (better performance, lower quality)", "group1")


    // Ejecting brass //

	BEGIN_OPTION("Ejecting Brass", "cg_brassTime", ITEM_TYPE_MULTI, 3, 1)
		cvarFloatList {
				"High"		20000
				"Med"		7500
				"Off"		0
		}
		OPTION_BELOW("gr1_ctrl2")
		action { uiScript glCustom }
		ASSIGN_HINT("hint_brasstime")
	END_OPTION
    ADD_HINT("hint_brasstime", "Change the amount of ejecting brass", "group1")


    // Glass fragments //

	BEGIN_OPTION("Glass Fragments", "cg_RQ3_glasstime", ITEM_TYPE_MULTI, 4, 1)
		cvarFloatList {
				"High"		20000
				"Med"		7500
				"Off"		0
		}
		OPTION_BELOW("gr1_ctrl3")
		action { uiScript glCustom }
		ASSIGN_HINT("hint_glasstime")
	END_OPTION
    ADD_HINT("hint_glasstime", "Change the amount of glass fragments", "group1")

    
	// Wall marks //

	BEGIN_OPTION("Wall marks", "cg_marks", ITEM_TYPE_YESNO, 5, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl4")
		ASSIGN_HINT("hint_wallmarks")
	END_OPTION
    ADD_HINT("hint_wallmarks", "Enable wall marks", "group1")


    // Dynamic lights //

	BEGIN_OPTION("Dynamic lights", "r_dynamiclight", ITEM_TYPE_YESNO, 6, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl5")
		ASSIGN_HINT("hint_dlights")
	END_OPTION
    ADD_HINT("hint_dlights", "Enable dynamic lighting", "group1")


    // Identify target //

	BEGIN_OPTION("Identify Target", "cg_drawCrosshairNames", ITEM_TYPE_YESNO, 7, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl6")
		ASSIGN_HINT("hint_idtarget")
	END_OPTION
    ADD_HINT("hint_idtarget", "Enable crosshair target identification", "group1")


    // Force player models //

	BEGIN_OPTION("Force Player Models", "cg_forceModel", ITEM_TYPE_YESNO, 8, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl7")
		ASSIGN_HINT("hint_forcemodel")
	END_OPTION
    ADD_HINT("hint_forcemodel", "Force player models to your own", "group1")

	
	//
	//
	// RIGHT COLUMN //
	//
	//


    // Draw Team Overlay //

	BEGIN_OPTION("Draw Team Overlay", "cg_drawTeamOverlay", ITEM_TYPE_YESNO, 9, 1)
		kind YESNO_ICON_RIGHT
		alignrect "line" ITEM_ALIGN_CENTER 128 32 32 VSIZE
		ASSIGN_HINT("hint_teamoverlay")
	END_OPTION
    ADD_HINT("hint_teamoverlay", "Choose team overlay position", "group1")


    // Allow download from server //

	BEGIN_OPTION("Allow Download", "cl_allowDownload", ITEM_TYPE_YESNO, 10, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl9")
		ASSIGN_HINT("hint_allowdl")
	END_OPTION
    ADD_HINT("hint_allowdl", "Allow automatic downloads from server", "group1")


    // Muzzle flash //

	BEGIN_OPTION("Muzzle Flash", "cg_RQ3_flash", ITEM_TYPE_YESNO, 11, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl10")
		ASSIGN_HINT("hint_muzzle")
	END_OPTION
    ADD_HINT("hint_muzzle", "Enable weapon muzzle flashes", "group1")


    // Pain blends //

	BEGIN_OPTION("Pain Blends", "cg_RQ3_painBlend", ITEM_TYPE_YESNO, 12, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl11")
		ASSIGN_HINT("hint_painblend")
	END_OPTION
    ADD_HINT("hint_painblend", "Enable screen pain blends", "group1")


    // Announcer //

	BEGIN_OPTION("Announcer", "cg_RQ3_announcer", ITEM_TYPE_YESNO, 13, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl12")
		ASSIGN_HINT("hint_announcer")
	END_OPTION
    ADD_HINT("hint_announcer", "Enable Quake 3 announcer", "group1")


    // Impact effects //

 	BEGIN_OPTION("Impact Effects", "cg_RQ3_impactEffects", ITEM_TYPE_YESNO, 14, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl13")
		ASSIGN_HINT("hint_impactfx")
	END_OPTION
    ADD_HINT("hint_impactfx", "Enable visual projectile impact effects", "group1")


    // Blood //

 	BEGIN_OPTION("Blood Effects", "com_blood", ITEM_TYPE_YESNO, 15, 1)
		kind YESNO_ICON_RIGHT
		OPTION_BELOW("gr1_ctrl14")
		ASSIGN_HINT("hint_bloodfx")
	END_OPTION
    ADD_HINT("hint_bloodfx", "Enable blood effects", "group1")


/*
==========================================================

Group # 2 - Crosshair

==========================================================
*/

	//Icon

	itemdef {
		name "icon,allgroups,group2"
		background UI_ASSETS"/icons/rq3-setup-crosshair"
		forecolor 1 1 1 ICON_ALPHA
		alignrect "line" ITEM_ALIGN_RIGHT 0 -36 32 32
		style WINDOW_STYLE_SHADER
		visible 1
		decoration
	}


	itemDef {
		name "preview"
		subgroup "fade_fore_alpha,group2,allgroups"
		alignrect "line" ITEM_ALIGN_LEFT 120 24 56 56
		style WINDOW_STYLE_SHADER
		background UI_ASSETS"/crosshair_back"
		decoration
	}

	// Crosshair //

	itemdef {
		name "crosshair_caption"
		subgroup "fade_fore_alpha,group2,allgroups"
		text "Crosshair:"
		textalignx 4
		textaligny -4
		textscale .225
		forecolor OPTION_COLOR
		alignrect "line" ITEM_ALIGN_LEFT 52 60 96 VSIZE
		decoration
		visible 1
	}

	itemdef {
		renderpoint
		name "allgroups,group2,gr2_ctrl3,fade_alpha"
		alignrect "line" ITEM_ALIGN_LEFT 120 24 56 56
		ownerdraw UI_CROSSHAIR
		ASSIGN_HINT("hint_crosshair")
		visible 1
	}


	ADD_HINT("hint_crosshair", "Change regular crosshair style", "group2")


	// Crosshair size //

	BEGIN_OPTION("Crosshair Size", "cg_crosshairSize", ITEM_TYPE_MULTI, 4, 2)
		alignrect "line" ITEM_ALIGN_LEFT 112 80 112 VSIZE
		ASSIGN_HINT("hint_crosshairsize")
		cvarFloatList {
				"Small"		16
				"Medium"		24
				"Large"		32
		}
	END_OPTION
	ADD_HINT("hint_crosshairsize", "Change the size of the regular crosshair", "group2")

	// Crosshair color //

	BEGIN_SLIDER("Red", "cg_RQ3_crosshairColorR", 1, 0, 1, 5, 2)
		OPTION_BELOW("gr2_ctrl4")
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Green", "cg_RQ3_crosshairColorG", 1, 0, 1, 6, 2)
		OPTION_BELOW("gr2_ctrl5")
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Blue", "cg_RQ3_crosshairColorB", 1, 0, 1, 7, 2)
		OPTION_BELOW("gr2_ctrl6")
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Alpha", "cg_RQ3_crosshairColorA", 1, 0, 1, 8, 2)
		OPTION_BELOW("gr2_ctrl7")
		ASSIGN_HINT("hint_alpha")
	END_OPTION


	ADD_HINT("hint_color", "Drag the slider to alter the color of the crosshair", "group2")
	ADD_HINT("hint_alpha", "Drag the slider to alter the transparency of the crosshair", "group2")




/*
==========================================================

Group # 3 - SSG Crosshair

==========================================================
*/

	//Icon

	itemdef {
	name "icon,allgroups,group3"
	background UI_ASSETS"/icons/rq3-setup-crosshair"
	forecolor 1 1 1 ICON_ALPHA
	alignrect "line" ITEM_ALIGN_RIGHT 0 -36 32 32
	style WINDOW_STYLE_SHADER
	visible 1
	decoration
	}


	// SSG color //

	BEGIN_SLIDER("Red", "cg_RQ3_ssgColorR", 1, 0, 1, 1, 3)
		alignrect "line" ITEM_ALIGN_LEFT 40 32 112 VSIZE
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Green", "cg_RQ3_ssgColorG", 1, 0, 1, 2, 3)
		OPTION_BELOW("gr3_ctrl1")
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Blue", "cg_RQ3_ssgColorB", 1, 0, 1, 3, 3)
		OPTION_BELOW("gr3_ctrl2")
		ASSIGN_HINT("hint_color")
	END_OPTION

	BEGIN_SLIDER("Alpha", "cg_RQ3_ssgColorA", 1, 0, 1, 4, 3)
		OPTION_BELOW("gr3_ctrl3")
		ASSIGN_HINT("hint_alpha")
	END_OPTION

	// Preview //
/*
	itemDef {
		name "allgroups,group3,gr3_ctrl5,fade_alpha"
		alignrect "gr3_ctrl1" ITEM_ALIGN_LEFT 112 0 136 136
		style WINDOW_STYLE_SHADER
		background UI_ASSETS"/crosshair_back"
		decoration
	}*/

	itemdef {
		name "allgroups,group3,gr3_ctrl6,fade_alpha"
		alignrect "gr3_ctrl1" ITEM_ALIGN_LEFT 116 4 128 128
		ownerdraw UI_SSG_CROSSHAIR
		ASSIGN_HINT("hint_ssg")
		visible 1
	}
	
	ADD_HINT("hint_ssg", "Change SSG crosshair style", "group3")

	// Next //

/*

	BEGIN_OPTION(3, 7, "^_N^_ext",)
		OPTION_BELOW("gr3_ctrl4")
		action { uiScript nextSSGCrosshair 1 instant }
		shortcutKey "N"
		ASSIGN_HINT("hint_ssgnext")
	}
	ADD_HINT("hint_ssgnext", "Select the next SSG crosshair", "group3")

*/
}
}

