#include "ui/menudef.h"
#define FADEIN_TIME	125
#define ANGLES -1 -91
#define ITEM_HEIGHT	14
#define DEVMODE_OPTION(COMMAND, CMD_TEXT, CMD_SHORTCUT, CMD_ALIGN, ITEM_WIDTH )	\
	itemDef {	\
	name "cmd_"COMMAND	\
	text CMD_TEXT	\
	shortcutKey CMD_SHORTCUT	\
	type ITEM_TYPE_BUTTON	\
	style WINDOW_STYLE_EMPTY	\
	textstyle ITEM_TEXTSTYLE_NORMAL	\
	alignrect CMD_ALIGN ITEM_ALIGN_LEFT 0 16 ITEM_WIDTH ITEM_HEIGHT	\
	textalign ITEM_ALIGN_LEFT	\
	textalignx 8	\
	textaligny 12	\
	textscale .225	\
	forecolor 0 0 0 1	\
	visible 1	\
	action { play "sound/ui/whoosh3.wav" ; exec COMMAND }	\
	}

#define DEVMODE_YESNO(COMMAND, CMD_TEXT, CMD_SHORTCUT, CMD_ALIGN)	\
	itemdef {	\
	name "cmd_"COMMAND	\
	type ITEM_TYPE_YESNO	\
	text CMD_TEXT":"	\
	cvar COMMAND	\
	shortcutKey CMD_SHORTCUT	\
	kind YESNO_ICON_RIGHT	\
	alignrect CMD_ALIGN ITEM_ALIGN_LEFT 0 16 64 ITEM_HEIGHT	\
	textalign ITEM_ALIGN_RIGHT	\
	textalignx 0	\
	textaligny 14	\
	textscale .225	\
	forecolor 0 0 0 1	\
	visible 1	\
	}

{
	menuDef {
		name "ingame_devmode"
		visible 0
		fullscreen 0
		rect UI_MINX 44 232 272
		anglevectors ANGLES
		focusColor RQ3_MAIN_FOCUSCOLOR
		popup
		style WINDOW_STYLE_EMPTY
		//style WINDOW_STYLE_FILLED
		//backcolor 0 0 0 .5
		onOpen {
			play "sound/ui/whoosh3.wav" ;
			setitemcolor window forecolor 5 5 5 0 ;
			timefade window forecolor 5 5 5 1 0 FADEIN_TIME ;
			close "ingame" ;
		}
		onESC { play "sound/ui/whoosh3.wav" ; close _self }
		onOOBClick { play "sound/ui/whoosh3.wav" ; close _self }
		
		itemDef {
			renderpoint
			name "paper"
			menuAnchor
			group window
			style WINDOW_STYLE_SHADER
			background UI_ASSETS"/paper_1"
			forecolor .92 .97 1 1
			rect -4 -12 256 320
			anglevectors ANGLES
			visible 1
			decoration
		}
		
		// TITLE //
		
		itemDef {
			renderpoint
			name "title"
			text "Developer Mode:"
			forecolor .6 .0 .0 1
			style WINDOW_STYLE_EMPTY
			textalign ITEM_ALIGN_LEFT
			textalignx 0
			textaligny 12
			textscale RQ3_MAIN_TEXTSIZE
			alignrect "paper" ITEM_ALIGN_LEFT 28 36 240 36 
			visible 1
			autowrapped
			decoration
		}
		
		itemDef {
			renderpoint
			name "spacer"
			style WINDOW_STYLE_SHADER
			alignrect "title" ITEM_ALIGN_LEFT 128 12 112 14
			visible 0
			decoration
		}
		
		// BUTTONS //
		
		//DEVMODE_YESNO("noclip", "^_n^_oclip", "N", "spacer")
		DEVMODE_YESNO("r_drawentities", "r_drawentities", "E", "spacer")
		DEVMODE_YESNO("r_fastsky", "r_fastsky", "F", "cmd_r_drawentities")
		DEVMODE_YESNO("r_lightmap", "r_lightmap", "L", "cmd_r_fastsky")
		DEVMODE_YESNO("r_lockpvs", "r_lockpvs", "P", "cmd_r_lightmap")
		DEVMODE_YESNO("r_showtris", "r_showtris", "T", "cmd_r_lockpvs")
		DEVMODE_YESNO("r_speeds", "r_speeds", "S", "cmd_r_showtris")
		DEVMODE_YESNO("cg_draw2D", "cg_draw2D", "C", "cmd_r_speeds")
		DEVMODE_YESNO("cg_drawGun", "cg_drawGun", "D", "cmd_cg_draw2D")
		DEVMODE_YESNO("cg_thirdPerson", "cg_thirdPerson", "D", "cmd_cg_drawGun")
		//DEVMODE_OPTION("give all", "give ^_a^_ll", "A", "cmd_cg_drawgun", 48 )
		//DEVMODE_OPTION("god", "^_g^_od", "G", "cmd_give all", 48 )
		
		//3rd Person Angle
		itemDef {
			type ITEM_TYPE_SLIDER
			name "3rda"
			text "Angle:"
			cvarfloat "cg_thirdPersonAngle" 180 0 360
			alignrect "spacer" ITEM_ALIGN_LEFT -104 167 144 20
			textalign ITEM_ALIGN_RIGHT
			textalignx 24
			textaligny 14
			textscale .225
			forecolor 0 0 0 1
			visible 1
			cvartest "cg_thirdPerson"
			hideCvar { "0" }
		}
		
		//3rd Person Range
		itemDef {
			type ITEM_TYPE_SLIDER
			text "Range:"
			cvarfloat "cg_thirdPersonRange" 200 40 840
			alignrect "3rda" ITEM_ALIGN_LEFT 0 20 144 20
			textalign ITEM_ALIGN_RIGHT
			textalignx 24
			textaligny 14
			textscale .225
			forecolor 0 0 0 1
			visible 1
			cvartest "cg_thirdPerson"
			hideCvar { "0" }
		}
		
	}
}

#if 0
#include "ui/menudef.h"

{

    menuDef {
	name "ingame_devmode"
	visible 0
	fullscreen 0
	//outOfBoundsClick			// this closes the window if it gets a click out of the rectangle
	onOOBClick { close _self ; open _prev }
	rect 368 64 256 192
	focusColor 1 .75 0 1			// Menu focus color for text and items
	style WINDOW_STYLE_EMPTY
	shadowStyle 1
	border 0
	onOpen { play "sound/misc/menu1.wav" }

//Window

    itemDef {
	rect 0 0 256 120
	style WINDOW_STYLE_FILLED
	backcolor Ig_Window_Color
	visible 1
	border 1
	bordersize 1
	bordercolor Ig_Window_BorderColor
	decoration
    }

    itemDef {
	rect 0 119 256 73
	style WINDOW_STYLE_FILLED
	backcolor Ig_Window_Color
	visible 1
	border 1
	bordersize 1
	bordercolor Ig_Window_BorderColor
	decoration
    }

    //

    itemDef {
	rect 137 1 120 24
	style WINDOW_STYLE_SHADER
	background "ui/assets/rq3-ingame-title"
	visible 1
	decoration
    }

    itemDef {
	rect 137 1 120 24
	style WINDOW_STYLE_EMPTY
	forecolor Ig_Window_TitleColor
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_LEFT
	textalignx 24
	textaligny 16
	text "Developer mode"
	visible 1
	decoration
    }

//Options

//3rd Person

    itemDef {
	type ITEM_TYPE_YESNO
	text "3rd Person:"
	cvar "cg_thirdPerson"
	rect 32 36 144 20
	textalign ITEM_ALIGN_RIGHT
	textalignx 96
	textaligny 14
	textscale .225
	forecolor Ig_Sub_TextColor
	visible 1
    }

//3rd Person Angle

    itemDef {
	type ITEM_TYPE_SLIDER
	text "Angle:"
	cvarfloat "cg_thirdPersonAngle" 180 0 360
	rect 32 60 144 20
	textalign ITEM_ALIGN_RIGHT
	textalignx 24
	textaligny 14
	textscale .225
	forecolor Ig_Sub_TextColor
	visible 1
    }

//3rd Person Range

    itemDef {
	type ITEM_TYPE_SLIDER
	text "Range:"
	cvarfloat "cg_thirdPersonRange" 200 40 840
	rect 32 84 144 20
	textalign ITEM_ALIGN_RIGHT
	textalignx 24
	textaligny 14
	textscale .225
	forecolor Ig_Sub_TextColor
	visible 1
    }

//God mode

    itemDef {
	rect 176 40 60 16
	style WINDOW_STYLE_FILLED
	type ITEM_TYPE_BUTTON
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_CENTER
	textalignx 30
	textaligny 12
	text "God"
	shortcutKey "G"
	border 1
	bordersize 1
	backcolor Ig_Sub_Color1
	forecolor Ig_Sub_TextColor
	bordercolor Ig_Sub_BorderColor1
	visible 1
	action { play "sound/misc/menu1.wav" ; exec "god" ; uiScript closeingame }
	onFocus { setcolor backcolor Ig_Sub_Color2 ; setcolor bordercolor Ig_Sub_BorderColor2 }
	leaveFocus { setcolor backcolor Ig_Sub_Color1 ; setcolor bordercolor Ig_Sub_BorderColor1 }
    }

//Give all

    itemDef {
	rect 176 64 60 16
	style WINDOW_STYLE_FILLED
	type ITEM_TYPE_BUTTON
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_CENTER
	textalignx 30
	textaligny 12
	text "Give All"
	shortcutKey "A"
	border 1
	bordersize 1
	backcolor Ig_Sub_Color1
	forecolor Ig_Sub_TextColor
	bordercolor Ig_Sub_BorderColor1
	visible 1
	action { play "sound/misc/menu1.wav" ; exec "give all" ; uiScript closeingame }
	onFocus { setcolor backcolor Ig_Sub_Color2 ; setcolor bordercolor Ig_Sub_BorderColor2 }
	leaveFocus { setcolor backcolor Ig_Sub_Color1 ; setcolor bordercolor Ig_Sub_BorderColor1 }
    }

//Noclip mode

    itemDef {
	rect 176 88 60 16
	style WINDOW_STYLE_FILLED
	type ITEM_TYPE_BUTTON
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_CENTER
	textalignx 30
	textaligny 12
	text "Noclip"
	shortcutKey "N"
	border 1
	bordersize 1
	backcolor Ig_Sub_Color1
	forecolor Ig_Sub_TextColor
	bordercolor Ig_Sub_BorderColor1
	visible 1
	action { play "sound/misc/menu1.wav" ; exec "noclip" ; uiScript closeingame }
	onFocus { setcolor backcolor Ig_Sub_Color2 ; setcolor bordercolor Ig_Sub_BorderColor2 }
	leaveFocus { setcolor backcolor Ig_Sub_Color1 ; setcolor bordercolor Ig_Sub_BorderColor1 }
    }

    // DEMO RECORDING OPTIONS //

    // Demo name //

    itemDef {
	name demo
	text "Demo:"
	style 0
	textscale .225
	rect 32 132 144 20
	textalign ITEM_ALIGN_RIGHT
	textalignx 24
	textaligny 14
	textscale .225
	forecolor Ig_Sub_TextColor
	decoration
	visible 1
    }

    itemDef {
	name demoEntry
	style WINDOW_STYLE_FILLED
	rect 20 152 148 16
	text ""
	textalign ITEM_ALIGN_LEFT
	textalignx 4
	textaligny 12
	maxchars 20
	maxPaintChars 8
	textscale .225
	type ITEM_TYPE_EDITFIELD
	cvar "ui_RQ3_demoName"
	border 1
	bordersize 1
	bordercolor .25 .25 .25 1
	forecolor 1 1 1 1
	backcolor 1 1 1 .1
	visible 1
	onfocus { setcolor backcolor 1 1 1 .2 ; }
	leavefocus { setcolor backcolor 1 1 1 .1 ; }
    }

/*
    // Game speed

    itemDef {
	type ITEM_TYPE_MULTI
	text "Speed:"
	cvar "timescale"
	cvarFloatList { "25%" 0.25 "50%" 0.5 "75%" 0.75 "100%" 1 "125%" 1.25 "150%" 1.5 "200%" 2 "250%" 2.5 "300%" 3 "400%" 4 "500%" 5 }
	rect 80 132 88 20
	textalign ITEM_ALIGN_RIGHT
	textalignx 64
	textaligny 14
	textscale .225
	forecolor Ig_Sub_TextColor
	visible 1
    }
*/

    // Stop recording //

    itemDef {
	rect 176 132 60 16
	style WINDOW_STYLE_FILLED
	type ITEM_TYPE_BUTTON
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_CENTER
	textalignx 30
	textaligny 12
	text "Stop"
	shortcutKey "S"
	border 1
	bordersize 1
	backcolor Ig_Sub_Color1
	forecolor Ig_Sub_TextColor
	bordercolor Ig_Sub_BorderColor1
	visible 1
	action { play "sound/misc/menu1.wav" ; uiScript closeingame ; exec "stoprecord"}
	onFocus { setcolor backcolor Ig_Sub_Color2 ; setcolor bordercolor Ig_Sub_BorderColor2 }
	leaveFocus { setcolor backcolor Ig_Sub_Color1 ; setcolor bordercolor Ig_Sub_BorderColor1 }
    }

    // Record //

    itemDef {
	rect 176 152 60 16
	style WINDOW_STYLE_FILLED
	type ITEM_TYPE_BUTTON
	textstyle ITEM_TEXTSTYLE_NORMAL
	textscale .225
	textalign ITEM_ALIGN_CENTER
	textalignx 30
	textaligny 12
	text "Record"
	shortcutKey "R"
	border 1
	bordersize 1
	backcolor Ig_Sub_Color1
	forecolor Ig_Sub_TextColor
	bordercolor Ig_Sub_BorderColor1
	visible 1
	action { play "sound/misc/menu1.wav" ; uiScript closeingame ; uiScript recordDemo }
	onFocus { setcolor backcolor Ig_Sub_Color2 ; setcolor bordercolor Ig_Sub_BorderColor2 }
	leaveFocus { setcolor backcolor Ig_Sub_Color1 ; setcolor bordercolor Ig_Sub_BorderColor1 }
    }

}
}
#endif