#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_advanced"
	visible     0
	fullscreen  0
	rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style WINDOW_STYLE_FILLED

	onESC {
		close options_controls_advanced ;
		open  options_controls
	}

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

// Selection //
#define SELECTION_Y SUBWINDOW_OPTION_Y_START
#define SELECTION_H SUBWINDOW_OPTION_COMPUTE_H(3)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, SELECTION_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, SELECTION_H, _("SELECTION MENUS"))
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTION_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Team selection:"), .2, 8, "teammenu", "Open team selection menu")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTION_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Class selection:"), .2, 8, "classmenu", "Open class selection menu")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(SELECTION_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Spawn selection:"), .2, 8, "spawnmenu", "Open spawn selection menu")

// Fire-Teams //
#define FIRETEAM_Y (SELECTION_Y + SELECTION_H + SUBWINDOW_OPTION_Y_PADDING)
#define FIRETEAM_H SUBWINDOW_OPTION_COMPUTE_H(11)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, FIRETEAM_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, FIRETEAM_H, _("FIRE-TEAMS"))
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Fire-Team Admin:"), .2, 8, "mp_fireteamadmin", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select All Members:"), .2, 8, "selectbuddy -2", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Deselect All Members:"), .2, 8, "selectbuddy -1", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #1:"), .2, 8, "selectbuddy 0", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #2:"), .2, 8, "selectbuddy 1", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 6), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #3:"), .2, 8, "selectbuddy 2", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #4:"), .2, 8, "selectbuddy 3", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #5:"), .2, 8, "selectbuddy 4", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 9), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #6:"), .2, 8, "selectbuddy 5", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 10), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #7:"), .2, 8, "selectbuddy 6", "")
	BIND(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(FIRETEAM_Y, 11), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Select Member #8:"), .2, 8, "selectbuddy 7", "")

// Joystick //
#define JOYSTICK_Y (FIRETEAM_Y + FIRETEAM_H + SUBWINDOW_OPTION_Y_PADDING)
#define JOYSTICK_H SUBWINDOW_OPTION_COMPUTE_H(8)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, JOYSTICK_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, JOYSTICK_H, _("JOYSTICK"))
	MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Enable Joysticks:"), .2, 8, "in_joystick", cvarFloatList { "No" 0 "Yes" 1 }, _("Toggle joystick initialization (requires vid_restart)"))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Use Joystick #:"), .2, 8, "in_joystickNo", 64, 18, _("Specify active joystick"))
	MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Analog Joystick:"), .2, 8, "in_joystickUseAnalog", cvarFloatList { "No" 0 "Yes" 1 }, _("Toggle analog joystick"))
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Forward-Back Sensitivity:"), .2, 8, "j_forward" 5 - 15 15, _("Set joystick forward-back sensitivity"))
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Left-Right Sensitivity:"), .2, 8, "j_side" 5 - 15 15, _("Set joystick left-right sensitivity"))
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 6), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Up-Down Sensitivity:"), .2, 8, "j_up" 5 - 15 15, _("Set joystick up-down sensitivity"))
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Pitch:"), .2, 8, "j_pitch" 5 - 15 15, _("Set pitch sensitivity"))
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(JOYSTICK_Y, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Yaw:"), .2, 8, "j_yaw" 5 - 15 15, _("Set yaw sensitivity"))

#define MISC_Y SUBWINDOW_OPTION_Y_START
#define MISC_H SUBWINDOW_OPTION_COMPUTE_H(8)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, MISC_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, MISC_H, _("MISC"))
	MULTI(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Activate lean:"), .2, 8, "cg_activateLean", cvarFloatList { "No" 0 "Yes" 1 }, _("Lean while using the activate button"))
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Enemy spawntimer reset:"), .2, 8, "timerReset", "Resets enemy spawntimer")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Sharetimer:"), .2, 8, "sharetimer", "Share the next time the enemy spawns with your team according to your spawntimer")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Sharetimer fireteam:"), .2, 8, "sharetimer_buddy", "Share the next time the enemy spawns with your fireteam according to your spawntimer")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Shift timer backward:"), .2, 8, "cycle cg_spawntimer_set 0 2147483647 1000", "Shifts enemy spawn timer 1 second backward")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 6), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Shift timer forward:"), .2, 8, "cycle cg_spawntimer_set 2147483647 0 1000", "Shifts enemy spawn timer 1 second forward")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 7), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Request artillery:"), .2, 8, "+zoom;+attack;-attack;-zoom", "Request artillery with single button press.")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MISC_Y, 8), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Toggle HUD Editor:"), .2, 8, "edithud", "Toggle open/close the HUD Editor.")

#define SHOUTCASTER_Y (MISC_Y + MISC_H + SUBWINDOW_OPTION_Y_PADDING)
#define SHOUTCASTER_H SUBWINDOW_OPTION_COMPUTE_H(7)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, SHOUTCASTER_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, SHOUTCASTER_H, _("SHOUTCASTER"))
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Increase red score:"), .2, 8, "scPlusRedScore", "Increase by 1 the score in the shoutcaster red team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Decrease red score:"), .2, 8, "scMinusRedScore", "Decrease by 1 the score in the shoutcaster red team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Reset red score:"), .2, 8, "scResetRedScore", "Reset to 0 the score in the shoutcaster red team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Increase blue score:"), .2, 8, "scPlusBlueScore", "Increase by 1 the score in the shoutcaster blue team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Decrease blue score:"), .2, 8, "scMinusBlueScore", "Decrease by 1 the score in the shoutcaster blue team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 6), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Reset blue score:"), .2, 8, "scResetBlueScore", "Reset to 0 the score in the shoutcaster blue team name banner")
	BIND(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(SHOUTCASTER_Y, 7), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Swap teams name & score:"), .2, 8, "scSwapTeamLabels", "Swap the shoutcaster red <-> blue team banner name and score. Helpful on teams swap")

// Buttons //
	BUTTON(SUBWINDOW_OPTION_HEADER_X1_START, WINDOW_HEIGHT - 22, WINDOW_WIDTH - 12, 18, _("MSGID_MENU_BACK"), .3, 14, close options_controls_advanced ; open options_controls)
}
