#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"

// 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 SUBWINDOW_OPTION_Y_START
#define MOVE_H SUBWINDOW_OPTION_COMPUTE_H(11)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, MOVE_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, MOVE_H, _("MOVE"))
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Forward:"), .2, 8, "+forward", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Back:"), .2, 8, "+back", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Move Left:"), .2, 8, "+moveleft", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Move Right:"), .2, 8, "+moveright", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Lean Left:"), .2, 8, "+leanleft", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 6), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Lean Right:"), .2, 8, "+leanright", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Jump:"), .2, 8, "+moveup", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Crouch:"), .2, 8, "+movedown", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 9), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Prone:"), .2, 8, "+prone", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 10), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Walk:"), .2, 8, "+speed", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SUBWINDOW_OPTION_Y_START, 11), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Sprint:"), .2, 8, "+sprint", "")

// Use Weapons //
#define USEWEAPONS_Y (MOVE_Y + MOVE_H + SUBWINDOW_OPTION_Y_PADDING)
#define USEWEAPONS_H SUBWINDOW_OPTION_COMPUTE_H(8)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, USEWEAPONS_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, USEWEAPONS_H, _("USE WEAPONS"))
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Attack:"), .2, 8, "+attack", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Zoom:"), .2, 8, "+weapzoom", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Switch to Alternate:"), .2, 8, "weapalt", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Reload Weapon:"), .2, 8, "+reload", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Binoculars Zoom:"), .2, 8, "+zoom", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 6), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Use (Activate):"), .2, 8, "+activate", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Drop Objective"), .2, 8, "dropobj", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(USEWEAPONS_Y, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Selfkill:"), .2, 8, "kill", "")

// Pop-Ups //
#define POPUPS_Y (USEWEAPONS_Y + USEWEAPONS_H + SUBWINDOW_OPTION_Y_PADDING)
#define POPUPS_H SUBWINDOW_OPTION_COMPUTE_H(9)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, POPUPS_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, POPUPS_H, _("POP-UPS"))
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Show Scores:"), .2, 8, "+scores", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Show Limbo Menu:"), .2, 8, "OpenLimboMenu", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Show Command Map:"), .2, 8, "+mapexpand", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Compass Map Zoom In:"), .2, 8, "MapZoomIn", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Compass Map Zoom Out:"), .2, 8, "MapZoomOut", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 6), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Player Stats:"), .2, 8, "+stats", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Top Shots:"), .2, 8, "+topshots", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Objectives:"), .2, 8, "+objectives", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(POPUPS_Y, 9), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Multiview:"), .2, 8, "mvactivate", "")

// Select Weapons //
#define SELECTWEAPONS_Y SUBWINDOW_OPTION_Y_START
#define SELECTWEAPONS_H SUBWINDOW_OPTION_COMPUTE_H(10)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, SELECTWEAPONS_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, SELECTWEAPONS_H, _("SELECT CLASS AND WEAPONS"))
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Next Weapon:"), .2, 8, "weapnext", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Previous Weapon:"), .2, 8, "weapprev", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 1 - Melee:"), .2, 8, "weaponbank 1", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 2 - One Handed:"), .2, 8, "weaponbank 2", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 3 - Two Handed:"), .2, 8, "weaponbank 3", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 6), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 4 - Grenade:"), .2, 8, "weaponbank 4", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 7), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 5 - Special 1:"), .2, 8, "weaponbank 5", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 8), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 6 - Special 2:"), .2, 8, "weaponbank 6", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 9), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 7 - Special 3:"), .2, 8, "weaponbank 7", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTWEAPONS_Y, 10), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Slot 8 - Binoculars:"), .2, 8, "weaponbank 8", "")

// Chat //
#define CHAT_Y (SELECTWEAPONS_Y + SELECTWEAPONS_H + SUBWINDOW_OPTION_Y_PADDING)
#define CHAT_H SUBWINDOW_OPTION_COMPUTE_H(5)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, CHAT_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, CHAT_H, _("CHAT"))
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(CHAT_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Chat:"), .2, 8, "messagemode", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(CHAT_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Team Chat:"), .2, 8, "messagemode2", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(CHAT_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Fireteam Chat:"), .2, 8, "messagemode3", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(CHAT_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Quick Chat:"), .2, 8, "mp_QuickMessage", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(CHAT_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Fireteam Quick Chat:"), .2, 8, "mp_fireteammsg", "")

// Input //
#define INPUT_Y (CHAT_Y + CHAT_H + SUBWINDOW_OPTION_Y_PADDING)
#define INPUT_H SUBWINDOW_OPTION_COMPUTE_H(4)
#define INPUT_CHECKBOX_WIDTH (.5 * (SUBWINDOW_OPTION_WIDTH_R - 6))
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, INPUT_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, INPUT_H, _("INPUT"))
	CHECKBOXALIGNXACTION(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 1), INPUT_CHECKBOX_WIDTH, SUBWINDOW_OPTION_HEIGHT, _("Invert Mouse:"), .2, 24, 8, "ui_mousePitch", uiScript update ui_mousePitch, _("Invert mouse pitch"))
	CHECKBOXALIGNX(SUBWINDOW_OPTION_X2_START + (INPUT_CHECKBOX_WIDTH)+2, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 1), INPUT_CHECKBOX_WIDTH, SUBWINDOW_OPTION_HEIGHT, _("Smooth Mouse:"), .2, 24, 8, "m_filter", _("Smooth out the mouse using interpolation"))
	CVARFLOATLABEL(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, "sensitivity", .2, ITEM_ALIGN_RIGHT, $evalfloat(SUBWINDOW_OPTION_WIDTH_R), 8)
	SLIDER(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Mouse Sensitivity:"), .2, 8, "sensitivity" 5 1 30, _("Set mouse sensitivity"))
	MULTI(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("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 }, _("Set crosshair up-down motion while moving"))
	CVARFLOATLABEL(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, "cg_scopedSensitivityScaler", .2, ITEM_ALIGN_RIGHT, $evalfloat(SUBWINDOW_OPTION_WIDTH_R), 8)
	SLIDER(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(INPUT_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Scoped Sensitivity:"), .2, 8, "cg_scopedSensitivityScaler" 5 0 30, _("Set scoped mouse sensitivity. The value is a scalar used to calculate the sensitivity\ndepending on field of view when scoped(zoom value)"))

// Miscellaneous //
#define MISC_Y (INPUT_Y + INPUT_H + SUBWINDOW_OPTION_Y_PADDING)
#define MISC_H SUBWINDOW_OPTION_COMPUTE_H(6)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, MISC_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, MISC_H, _("MISCELLANEOUS"))
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Vote Yes:"), .2, 8, "vote yes", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Vote No:"), .2, 8, "vote no", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Ready:"), .2, 8, "ready", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Not Ready:"), .2, 8, "notready", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Take Screenshot:"), .2, 8, "autoScreenshot", "")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 6), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Record Replay:"), .2, 8, "toggleRecord", "")


// Buttons //
	BUTTON(SUBWINDOW_OPTION_HEADER_X1_START, WINDOW_HEIGHT - 22, .33 * (WINDOW_WIDTH - 24), 18, _("MSGID_MENU_BACK"), .3, 14, close options_controls ; open options)
	BUTTON(SUBWINDOW_OPTION_HEADER_X1_START + .33 * (WINDOW_WIDTH - 24) + 6, WINDOW_HEIGHT - 22, .34 * (WINDOW_WIDTH - 24), 18, _("MSGID_MENU_ADVANCED"), .3, 14, close options_controls ; open options_controls_advanced)
	BUTTON(SUBWINDOW_OPTION_HEADER_X1_START + .33 * (WINDOW_WIDTH - 24) + 6 + .34 * (WINDOW_WIDTH - 24) + 6, WINDOW_HEIGHT - 22, .33 * (WINDOW_WIDTH - 24), 18, _("MSGID_MENU_DEFAULT"), .3, 14, open options_controls_default)
}
