#include "ui/menudef.h"
#define ANGLES 5 -85
#define LINE_ALPHA			0.2
#define VSPACE				16
#define VSIZE				16

#define MM_OPTION(ITEM_NAME, ITEM_TEXT, ITEM_CVAR, ITEM_TYPE)\
	itemdef {	\
	name ITEM_NAME	\
	group "fade_fore_alpha"\
	type ITEM_TYPE	\
	text ITEM_TEXT":"	\
	cvar ITEM_CVAR

#define ALIGN_MM(TARGET, X_POS, Y_POS)	\
	alignrect TARGET ITEM_ALIGN_LEFT X_POS Y_POS 112 VSIZE

#define END_MM\
	textalign ITEM_ALIGN_RIGHT	\
	textalignx 0	\
	textaligny 14	\
	textscale .225	\
	forecolor 0 0 0 1	\
	visible 1	\
    }

{
	menuDef {
		renderpoint
		name "ingame_matchmode_settings"
		visible MENU_FALSE				// Visible on open
		fullscreen 0
		rect 192 64 288 264
		focusColor RQ3_MAIN_FOCUSCOLOR			// Menu focus color for text and items
		anglevectors ANGLES
		style WINDOW_STYLE_EMPTY
		popup
		
		onOOBClick { close _self }
		onOpen { play "sound/ui/whoosh3.wav" ; uiScript "readMMsettings" }
		onClose { open _prev }
		onESC { close _self }
		
		onOpenSpecial {
			//normal items
			ALPHA_FADE_FORE(fade_fore_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"
			group "fade_fore_alpha"
			menuAnchor
			style WINDOW_STYLE_SHADER
			background UI_ASSETS"/paper_1"
			forecolor 0.969 0.961 0.922 1
			rect -8 -16 320 320
			anglevectors ANGLES
			visible 1
			decoration
		}
		
		//Title
		
		itemdef {
			renderpoint
			name "title"
			text "Match Settings:"
			group "fade_fore_alpha"
			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
		}
		
		MM_OPTION("time", "Time Limit", "ui_RQ3_timelimit", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("paper", 160, 80)
			maxChars 4
		END_MM
		
		MM_OPTION("rounds", "Round Limit", "ui_RQ3_roundlimit", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("time", 0, VSPACE)
			maxChars 4
		END_MM
		
		MM_OPTION("roundtime", "Round Time Limit", "ui_RQ3_roundtimelimit", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("rounds", 0, VSPACE)
			maxChars 4
		END_MM
		
		MM_OPTION("frags", "Frag Limit", "ui_RQ3_fraglimit", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("roundtime", 0, VSPACE)
			maxChars 4
		END_MM
		
		MM_OPTION("players", "Maximum Players", "ui_RQ3_maxplayers", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("frags", 0, VSPACE)
			maxChars 4
		END_MM
		
		MM_OPTION("teamtalk", "Force Team Talk", "ui_RQ3_forceteamtalk", ITEM_TYPE_MULTI)
			ALIGN_MM("players", 0, VSPACE)
			cvarFloatList {
				"Off"		0
				"Match only"		1
				"Always"		2
			}
		END_MM
		
		MM_OPTION("camera", "Limit Chase Camera", "ui_RQ3_limchasecam", ITEM_TYPE_MULTI)
			ALIGN_MM("teamtalk", 0, VSPACE)
			cvarFloatList {
				"No"		0
				"Team only"		1
				"Eyes only"		2
			}
		END_MM
		
		MM_OPTION("grenades", "Bandolier Grenades", "ui_RQ3_tgren", ITEM_TYPE_NUMERICFIELD)
			ALIGN_MM("camera", 0, VSPACE)
			maxChars 4
		END_MM
		
		MM_OPTION("friendly", "Friendly Fire", "ui_RQ3_friendlyFire", ITEM_TYPE_MULTI)
			ALIGN_MM("grenades", 0, VSPACE)
			cvarFloatList {
				"Off"		0
				"Off/knockback"		2
				"On"		1
			}
		END_MM
		
		itemDef	{
			name "submit"
			group "fade_fore_alpha"
			alignrect "paper" ITEM_ALIGN_LEFT 224 224 36 14
			text "> ^_O^_K <"
			shortcutKey "O"
			style WINDOW_STYLE_EMPTY
			forecolor .5 0 0 1
			textalignx 0
			textaligny 12
			textscale .225
			visible 1
			type ITEM_TYPE_BUTTON
			action {
				play "sound/ui/whoosh3.wav" ;
				uiScript "sendMMsettings" ;
				close _self ;
			}
		}
	}
}
