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

// Defines //
#define WINDOW_X		16
#define WINDOW_Y		16
#define WINDOW_WIDTH	608
#define WINDOW_HEIGHT	448
#define GROUP_NAME		"grpOptionsControls"

// Subwindows //
#define SUBWINDOW_WIDTH		.5*(WINDOW_WIDTH-18)

// Controls Menu //
menuDef {
	name		"options_controls"
	visible		0
	fullscreen	0
	rect		WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style		WINDOW_STYLE_FILLED

	onESC {
		close options_controls ;
		open options
	}

// Window //
	WINDOW( _("CONTROLS"), 90 )

// Move //
#define MOVE_Y 32
	SUBWINDOW( 6, MOVE_Y, (SUBWINDOW_WIDTH), 148, _("MOVE") )
	BIND( 8, MOVE_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Forward:"), .2, 8, "+forward", "" )
	BIND( 8, MOVE_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Back:"), .2, 8, "+back", "" )
	BIND( 8, MOVE_Y+40, (SUBWINDOW_WIDTH)-4, 10,_( "Move Left:"), .2, 8, "+moveleft", "" )
	BIND( 8, MOVE_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Move Right:"), .2, 8, "+moveright", "" )
	BIND( 8, MOVE_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Lean Left:"), .2, 8, "+leanleft", "" )
	BIND( 8, MOVE_Y+76, (SUBWINDOW_WIDTH)-4, 10, _("Lean Right:"), .2, 8, "+leanright", "" )
	BIND( 8, MOVE_Y+88, (SUBWINDOW_WIDTH)-4, 10, _("Jump:"), .2, 8, "+moveup", "" )
	BIND( 8, MOVE_Y+100, (SUBWINDOW_WIDTH)-4, 10, _("Crouch:"), .2, 8, "+movedown", "" )
	BIND( 8, MOVE_Y+112, (SUBWINDOW_WIDTH)-4, 10, _("Prone:"), .2, 8, "+prone", "" )
	BIND( 8, MOVE_Y+124, (SUBWINDOW_WIDTH)-4, 10, _("Walk:"), .2, 8, "+speed", "" )
	BIND( 8, MOVE_Y+136, (SUBWINDOW_WIDTH)-4, 10, _("Sprint:"), .2, 8, "+sprint", "" )

// Use Weapons //
#define USEWEAPONS_Y 186
	SUBWINDOW( 6, USEWEAPONS_Y, (SUBWINDOW_WIDTH), 100, _("USE WEAPONS") )
	BIND( 8, USEWEAPONS_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Attack:"), .2, 8, "+attack", "" )
	BIND( 8, USEWEAPONS_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Switch to Alternate:"), .2, 8, "weapalt", "" )
	BIND( 8, USEWEAPONS_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Reload Weapon:"), .2, 8, "+reload", "" )
	BIND( 8, USEWEAPONS_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Binoculars Zoom:"), .2, 8, "+zoom", "" )
	BIND( 8, USEWEAPONS_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Use (Activate):"), .2, 8, "+activate", "" )
	BIND( 8, USEWEAPONS_Y+76, (SUBWINDOW_WIDTH)-4, 10, _("Drop Objective"), .2, 8, "dropobj", "" )
	BIND( 8, USEWEAPONS_Y+88, (SUBWINDOW_WIDTH)-4, 10, _("Selfkill:"), .2, 8, "kill", "" )

// Pop-Ups //
#define POPUPS_Y 292
	SUBWINDOW( 6, POPUPS_Y, (SUBWINDOW_WIDTH), 124, _("POP-UPS") )
	BIND( 8, POPUPS_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Show Scores:"), .2, 8, "+scores", "" )
	BIND( 8, POPUPS_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Show Limbo Menu:"), .2, 8, "OpenLimboMenu", "" )
	BIND( 8, POPUPS_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Show Command Map:"), .2, 8, "+mapexpand", "" )
	BIND( 8, POPUPS_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Compass Map Zoom In:"), .2, 8, "MapZoomIn", "" )
	BIND( 8, POPUPS_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Compass Map Zoom Out:"), .2, 8, "MapZoomOut", "" )
	BIND( 8, POPUPS_Y+76, (SUBWINDOW_WIDTH)-4, 10, _("Player Stats:"), .2, 8, "+stats", "" )
	BIND( 8, POPUPS_Y+88, (SUBWINDOW_WIDTH)-4, 10, _("Top Shots:"), .2, 8, "+topshots", "" )
	BIND( 8, POPUPS_Y+100, (SUBWINDOW_WIDTH)-4, 10, _("Objectives:"), .2, 8, "+objectives", "" )
	BIND( 8, POPUPS_Y+112, (SUBWINDOW_WIDTH)-4, 10, _("Multiview:"), .2, 8, "mvactivate", "" )

// Select Weapons //
#define SELECTWEAPONS_Y 32
	SUBWINDOW( 6+(SUBWINDOW_WIDTH)+6, SELECTWEAPONS_Y, (SUBWINDOW_WIDTH), 136, _("SELECT CLASS AND WEAPONS") )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Next Weapon:"), .2, 8, "weapnext", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Previous Weapon:"), .2, 8, "weapprev", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Slot 1 - Melee:"), .2, 8, "weaponbank 1", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Slot 2 - One Handed:"), .2, 8, "weaponbank 2", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Slot 3 - Two Handed:"), .2, 8, "weaponbank 3", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+76, (SUBWINDOW_WIDTH)-4, 10, _("Slot 4 - Grenade:"), .2, 8, "weaponbank 4", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+88, (SUBWINDOW_WIDTH)-4, 10, _("Slot 5 - Special 1:"), .2, 8, "weaponbank 5", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+100, (SUBWINDOW_WIDTH)-4, 10, _("Slot 6 - Special 2:"), .2, 8, "weaponbank 6", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+112, (SUBWINDOW_WIDTH)-4, 10, _("Slot 7 - Special 3:"), .2, 8, "weaponbank 7", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, SELECTWEAPONS_Y+124, (SUBWINDOW_WIDTH)-4, 10, _("Slot 8 - Binoculars:"), .2, 8, "weaponbank 8", "" )

// Chat //
#define CHAT_Y 174
	SUBWINDOW( 6+(SUBWINDOW_WIDTH)+6, CHAT_Y, (SUBWINDOW_WIDTH), 76, _("CHAT") )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, CHAT_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Chat:"), .2, 8, "messagemode", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, CHAT_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Team Chat:"), .2, 8, "messagemode2", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, CHAT_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Fireteam Chat:"), .2, 8, "messagemode3", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, CHAT_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Quick Chat:"), .2, 8, "mp_QuickMessage", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, CHAT_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Fireteam Quick Chat:"), .2, 8, "mp_fireteammsg", "" )

// Input //
#define INPUT_Y 256
	SUBWINDOW( 6+(SUBWINDOW_WIDTH)+6, INPUT_Y, (SUBWINDOW_WIDTH), 52, _("INPUT") )
	CHECKBOXALIGNXACTION(  6+(SUBWINDOW_WIDTH)+6+2, INPUT_Y+16, .5*((SUBWINDOW_WIDTH)-6), 10,_("Invert Mouse:"), .2, 24, 8, "ui_mousePitch", uiScript update ui_mousePitch, _("Inverts mouse pitch") )
	CHECKBOXALIGNX( 6+(SUBWINDOW_WIDTH)+6+2+(.5*((SUBWINDOW_WIDTH)-6))+2, INPUT_Y+16, .5*((SUBWINDOW_WIDTH)-6), 10, _("Smooth Mouse:"), .2, 24, 8, "m_filter", _("Smooths out the mouse using interpolation") )
	CVARFLOATLABEL( 6+(SUBWINDOW_WIDTH)+6+2, INPUT_Y+28, (SUBWINDOW_WIDTH)-4, 10, "sensitivity", .2, ITEM_ALIGN_RIGHT, $evalfloat((SUBWINDOW_WIDTH)-6), 8 )
	SLIDER( 6+(SUBWINDOW_WIDTH)+6+2, INPUT_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Mouse Sensitivity:"), .2, 8, "sensitivity" 5 1 30, _("Use the slider to increase or decrease mouse sensitivity") )
	MULTI( 6+(SUBWINDOW_WIDTH)+6+2, INPUT_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Mouse Pitch:"), .2, 8, "m_pitch", cvarFloatList { "0.015 (lowest allowed)" 0.0151 "0.016" 0.016 "0.017" 0.017 "0.018" 0.018 "0.019" 0.019 "0.020" 0.020 "0.021" 0.021 "0.022 (default)" 0.022 }, _("Up-Down Motion Of The Crosshair While Moving.") )

// Miscellaneous //
#define MISC_Y 314
	SUBWINDOW( 6+(SUBWINDOW_WIDTH)+6, MISC_Y, (SUBWINDOW_WIDTH), 88, _("MISCELLANEOUS") )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+16, (SUBWINDOW_WIDTH)-4, 10, _("Vote Yes:"), .2, 8, "vote yes", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+28, (SUBWINDOW_WIDTH)-4, 10, _("Vote No:"), .2, 8, "vote no", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+40, (SUBWINDOW_WIDTH)-4, 10, _("Ready:"), .2, 8, "ready", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+52, (SUBWINDOW_WIDTH)-4, 10, _("Not Ready:"), .2, 8, "notready", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+64, (SUBWINDOW_WIDTH)-4, 10, _("Take Screenshot:"), .2, 8, "autoScreenshot", "" )
	BIND( 6+(SUBWINDOW_WIDTH)+6+2, MISC_Y+76, (SUBWINDOW_WIDTH)-4, 10, _("Record Replay:"), .2, 8, "autoRecord", "" )


// Buttons //
	BUTTON( 6, WINDOW_HEIGHT-24, .33*(WINDOW_WIDTH-24), 18, _("BACK"), .3, 14, close options_controls ; open options )
	BUTTON( 6+.33*(WINDOW_WIDTH-24)+6, WINDOW_HEIGHT-24, .34*(WINDOW_WIDTH-24), 18, _("ADVANCED"), .3, 14, close options_controls ; open options_controls_advanced )
	BUTTON( 6+.33*(WINDOW_WIDTH-24)+6+.34*(WINDOW_WIDTH-24)+6, WINDOW_HEIGHT-24, .33*(WINDOW_WIDTH-24), 18, _("DEFAULT"), .3, 14, open options_controls_default )
}
