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

// Defines //
#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	296
#define WINDOW_HEIGHT	274
#define GROUP_NAME		"grpIngameVoteMisc"

// Misc Vote Menu //
menuDef {
	name		"ingame_vote_misc"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onOpen {
		conditionalScript g_gametype 3	// 3: cvartest
			( "hide bttn_nextmap ; show bttn_nextcampaign" )
			( "show bttn_nextmap ; hide bttn_nextcampaign" ) "4" ;

	conditionalScript g_gametype 3
			( "hide bttn_restmap ; show bttn_restcampaign" )
			( "show bttn_restmap ; hide bttn_restcampaign" ) "4" ;

		copyCvar g_gametype ui_voteGameType ;

		conditionalScript ui_voteGameType 3	// 3: cvartest
			( "setcvar ui_voteGameType 2" )
			( "clearFocus" ) "4" ;

	}

	onEsc {
		close ingame_vote_misc ;
		open ingame_vote
	}

// Window //
	WINDOW( _("MISC"), 50)

// Buttons //
	BUTTON( 6, 32, .5*(WINDOW_WIDTH-18), 14, _("START MATCH"), .24, 11, exec "cmd callvote startmatch"; uiScript closeingame )
	BUTTONEXT( 6, 50, .5*(WINDOW_WIDTH-18), 14, _("RESET MATCH"), .24, 11, exec "cmd callvote matchreset"; uiScript closeingame, voteFlag CV_SVF_MATCHRESET )
	NAMEDBUTTONEXT( bttn_restmap, 6, 68, .5*(WINDOW_WIDTH-18), 14, _("RESTART MAP"), .24, 11, exec "cmd callvote maprestart"; uiScript closeingame, voteFlag CV_SVF_MAPRESTART )
	NAMEDBUTTONEXT( bttn_restcampaign, 6, 68, .5*(WINDOW_WIDTH-18), 14, _("RESTART CAMPAIGN"), .24, 11, exec "cmd callvote restartcampaign"; uiScript closeingame, voteFlag CV_SVF_RESTARTCAMPAIGN )
	NAMEDBUTTONEXT( bttn_nextmap, 6, 86, .5*(WINDOW_WIDTH-18), 14, _("NEXT MAP"), .24, 11, exec "cmd callvote nextmap"; uiScript closeingame, settingEnabled CV_SVS_NEXTMAP voteFlag CV_SVF_NEXTMAP )
	NAMEDBUTTONEXT( bttn_nextcampaign, 6, 86, .5*(WINDOW_WIDTH-18), 14, _("NEXT CAMPAIGN"), .24, 11, exec "cmd callvote nextmap"; uiScript closeingame, settingEnabled CV_SVS_NEXTMAP voteFlag CV_SVF_NEXTMAP )  //Replace CV_SVF_NEXTMAP with CV_SVF_NEXTCAMPAIGN //
	BUTTONEXT( 6, 104, .5*(WINDOW_WIDTH-18), 14, _("ANTI-LAG ON"), .24, 11, exec "cmd callvote antilag 1"; uiScript closeingame, settingDisabled CV_SVS_ANTILAG voteFlag CV_SVF_ANTILAG )
	BUTTONEXT( 6, 104, .5*(WINDOW_WIDTH-18), 14, _("ANTI-LAG OFF"), .24, 11, exec "cmd callvote antilag 0"; uiScript closeingame, settingEnabled CV_SVS_ANTILAG voteFlag CV_SVF_ANTILAG )
	BUTTONEXT( 6, 122, .5*(WINDOW_WIDTH-18), 14, _("SURRENDER"), .24, 11, exec "cmd callvote surrender"; uiScript closeingame, voteFlag CV_SVF_SURRENDER )

	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 32, .5*(WINDOW_WIDTH-18), 14, _("SHUFFLE"), .24, 11, exec "cmd callvote shuffleteams"; uiScript closeingame, voteFlag CV_SVF_SHUFFLETEAMS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 50, .5*(WINDOW_WIDTH-18), 14, _("NO RESTART SHUFFLE"), .24, 11, exec "cmd callvote shuffleteams_norestart"; uiScript closeingame, voteFlag CV_SVF_SHUFFLETEAMS_NORESTART )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 68, .5*(WINDOW_WIDTH-18), 14, _("SWAP TEAMS"), .24, 11, exec "cmd callvote swapteams"; uiScript closeingame, voteFlag CV_SVF_SWAPTEAMS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 86, .5*(WINDOW_WIDTH-18), 14, _("MUTE SPECS"), .24, 11, exec "cmd callvote mutespecs 1"; uiScript closeingame, settingDisabled CV_SVS_MUTESPECS voteFlag CV_SVF_MUTESPECS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 86, .5*(WINDOW_WIDTH-18), 14, _("UNMUTE SPECS"), .24, 11, exec "cmd callvote mutespecs 0"; uiScript closeingame, settingEnabled CV_SVS_MUTESPECS voteFlag CV_SVF_MUTESPECS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 104, .5*(WINDOW_WIDTH-18), 14, _("FRIENDLY FIRE ON"), .24, 11, exec "cmd callvote friendlyfire 1"; uiScript closeingame, settingDisabled CV_SVS_FRIENDLYFIRE voteFlag CV_SVF_FRIENDLYFIRE )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 104, .5*(WINDOW_WIDTH-18), 14, _("FRIENDLY FIRE OFF"), .24, 11, exec "cmd callvote friendlyfire 0"; uiScript closeingame, settingEnabled CV_SVS_FRIENDLYFIRE voteFlag CV_SVF_FRIENDLYFIRE )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 122, .5*(WINDOW_WIDTH-18), 14, _("BALANCED TEAMS ON"), .24, 11, exec "cmd callvote balancedteams 1"; uiScript closeingame, settingDisabled CV_SVS_BALANCEDTEAMS voteFlag CV_SVF_BALANCEDTEAMS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 122, .5*(WINDOW_WIDTH-18), 14, _("BALANCED TEAMS OFF"), .24, 11, exec "cmd callvote balancedteams 0"; uiScript closeingame, settingEnabled CV_SVS_BALANCEDTEAMS voteFlag CV_SVF_BALANCEDTEAMS )
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 140, .5*(WINDOW_WIDTH-18), 14, _("COINTOSS"), .24, 11, exec "cmd callvote cointoss"; uiScript closeingame, voteFlag CV_SVF_COINTOSS )

	LABEL( 6, 158, .25*(WINDOW_WIDTH-18), 10, _("Config:"), .24, ITEM_ALIGN_LEFT, 0, 10 )
	BUTTONEXT( 6+.25*(WINDOW_WIDTH-18), 158, .25*(WINDOW_WIDTH-18), 14, _("PUBLIC"), .24, 11, exec "cmd callvote config defaultpublic"; uiScript closeingame, voteFlag CV_SVF_CONFIG)
	BUTTONEXT( 6+.5*(WINDOW_WIDTH-18)+6, 158, .125*(WINDOW_WIDTH-18), 14, _("1ON1"), .24, 11, exec "cmd callvote config legacy1"; uiScript closeingame, voteFlag CV_SVF_CONFIG)
	BUTTONEXT( 6+.625*(WINDOW_WIDTH-18)+6, 158, .125*(WINDOW_WIDTH-18), 14, _("3ON3"), .24, 11, exec "cmd callvote config legacy3"; uiScript closeingame, voteFlag CV_SVF_CONFIG)
	BUTTONEXT( 6+.75*(WINDOW_WIDTH-18)+6, 158, .125*(WINDOW_WIDTH-18), 14, _("5ON5"), .24, 11, exec "cmd callvote config legacy5"; uiScript closeingame, voteFlag CV_SVF_CONFIG)
	BUTTONEXT( 6+.875*(WINDOW_WIDTH-18)+6, 158, .125*(WINDOW_WIDTH-18), 14, _("6ON6"), .24, 11, exec "cmd callvote config legacy6"; uiScript closeingame, voteFlag CV_SVF_CONFIG)

	MULTILEFT( 8, 176+2, .66*(WINDOW_WIDTH-18), 10, _("Warmup Damage:"), .2, 8, "ui_voteWarmupDamage", cvarFloatList { "None" 0 "Enemies" 1 "Everyone" 2 } voteFlag CV_SVF_WARMUPDAMAGE, _("Select the warm-up damage mode to vote on") )
	NAMEDBUTTONEXT( "bttnextWarmupDamage", 6+.80*(WINDOW_WIDTH-18)+6, 176, .20*(WINDOW_WIDTH-18), 14, _("MSGID_MENU_OK"), .24, 11, uiScript voteWarmupDamage; uiScript closeingame, voteFlag CV_SVF_WARMUPDAMAGE )

//	itemDef {
//		name		"poll"
//		group		GROUP_NAME
//		rect		$evalfloat(40+8) $evalfloat(194+2) $evalfloat(.80*(WINDOW_WIDTH-18)-40) 10
//		style		WINDOW_STYLE_FILLED
//		backcolor	.5 .5 .5 .2
//		visible		1
//		voteFlag	CV_SVF_POLL
//		decoration
//	}

	itemDef {
		name		"nfleftbackTimelimit:"
		group		GROUP_NAME
		rect		$evalfloat(70+6) $evalfloat(212+2) $evalfloat(.66*(WINDOW_WIDTH-18)-70-8) 10
		style		WINDOW_STYLE_FILLED
		backcolor	.5 .5 .5 .2
		visible		1
		voteFlag	CV_SVF_TIMELIMIT
		decoration
	}
// Do we need it ?
//	NUMERICFIELDLEFTEXT( 8, 194+2, .66*(WINDOW_WIDTH-18), 10, _("Poll:"), .2, 8, 6, "ui_poll", voteFlag CV_SVF_POLL, _("Enter the text for your poll") )
//	NAMEDBUTTONEXT( "bttnextTimelimit", 6+.80*(WINDOW_WIDTH-18)+6, 194, .20*(WINDOW_WIDTH-18), 14, _("OK"), .24, 11, uiScript votePoll; uiScript closeingame, voteFlag CV_SVF_POLL )

	NUMERICFIELDLEFTEXT( 8, 212+2, .66*(WINDOW_WIDTH-18), 10, _("Time Limit:"), .2, 8, "ui_voteTimelimit", 6, voteFlag CV_SVF_TIMELIMIT, _("Specify a time limit to vote on") )
	NAMEDBUTTONEXT( "bttnextTimelimit", 6+.80*(WINDOW_WIDTH-18)+6, 212, .20*(WINDOW_WIDTH-18), 14, _("MSGID_MENU_OK"), .24, 11, uiScript voteTimelimit; uiScript closeingame, voteFlag CV_SVF_TIMELIMIT )

	MULTILEFT( 8, 230+2, .66*(WINDOW_WIDTH-18), 10, _("Game Type:"), .2, 8, "ui_voteGameType", cvarFloatList { "Single-Map Objective" 2 "Stopwatch" 3 "Last Man Standing" 5 "Map Voting" 6 } voteflag CV_SVF_GAMETYPE, _("Select the game type to vote on") )
	NAMEDBUTTONEXT( "bttnextGameType", 6+.80*(WINDOW_WIDTH-18)+6, 230, .20*(WINDOW_WIDTH-18), 14, _("MSGID_MENU_OK"), .24, 11, uiScript voteGame; uiScript closeingame, voteflag CV_SVF_GAMETYPE )

	BUTTON( 6, WINDOW_HEIGHT-24, WINDOW_WIDTH-12, 18, _("MSGID_MENU_BACK"), .3, 14, close ingame_vote_misc ; open ingame_vote )
}
