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

menuDef {
	name        "options_system_extended"
	visible     0
	fullscreen  0
	rect WINDOW_X WINDOW_Y WINDOW_WIDTH WINDOW_HEIGHT
	style WINDOW_STYLE_FILLED

	onESC {
		close options_system_extended ;
		open  options_system
	}

	WINDOW(_("SYSTEM EXTENDED"), 150)

// Simple graphics //
#ifdef ETLEGACY
// IRC //
#define IRC_Y (SUBWINDOW_OPTION_Y_START)
#define IRC_H SUBWINDOW_OPTION_COMPUTE_H(7)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, IRC_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, IRC_H, _("IRC CLIENT"))
	MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 1), SUBWINDOW_OPTION_WIDTH_R, 10, _("Mode:"), .2, 8, "irc_mode", cvarFloatList { "Disabled" 0 "Direct connect" 1 "Override nickname" 2 "Mute channel" 4 "Direct + Override" 3 "Direct + Mute" 5 "Override + Mute" 6 "Direct + Over. + Mute" 7 }, _("Specify IRC client behavior"))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 2), SUBWINDOW_OPTION_WIDTH_R, 10, _("Server:"), .2, 8, "irc_server", 25, 18, _("Set IRC server name"))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 3), SUBWINDOW_OPTION_WIDTH_R, 10, _("Channel #:"), .2, 8, "irc_channel", 25, 18, _("Set IRC channel name (no '#' required)"))
	NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 4), SUBWINDOW_OPTION_WIDTH_R, 10, _("Port:"), .2, 8, "irc_port", 5, _("Set IRC server port"))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 5), SUBWINDOW_OPTION_WIDTH_R, 10, _("Nickname:"), .2, 8, "irc_nickname", 25, 18, _("Set IRC nickame"))
	NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 6), SUBWINDOW_OPTION_WIDTH_R, 10, _("Kick rejoin time ms:"), .2, 8, "irc_kick_rejoin", 5, _("Set auto rejoin time after kick in ms"))
	NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(IRC_Y, 7), SUBWINDOW_OPTION_WIDTH_R, 10, _("Reconnect time ms:"), .2, 8, "irc_reconnect_delay", 5, _("Set auto reconnect time in ms"))

#define CONSOLE_Y (IRC_Y + IRC_H + SUBWINDOW_OPTION_Y_PADDING)
#define CONSOLE_H SUBWINDOW_OPTION_COMPUTE_H(5)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, CONSOLE_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, CONSOLE_H, _("CONSOLE"))
	YESNO(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Auto Clear:"), .2, 8, "con_autoclear", _("Toggle persistent console input."))
	CVARFLOATLABEL(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, "con_defaultHeight", .2, ITEM_ALIGN_RIGHT, $evalfloat(SUBWINDOW_OPTION_WIDTH_L), 8)
	SLIDER(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Default Height:"), .2, 8, "con_defaultHeight" 0.5 0 1, _("Specify custom console height ratio (0.0 to 1.0)."))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 3), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Font Name:"), .2, 8, "con_fontName", 25, 18, _("Set the font console. Use listfonts commands in console to check available fonts."))
	MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 4), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Open Speed:"), .2, 8, "con_openspeed", cvarFloatList { "Slow" 1 "Default" 3 "Fast" 6 "Instant" 200 }, _("Specify the console open speed."))
	EDITFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 5), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Background Color:"), .2, 8, "con_background", 25, 18, _("Specify the console background color. Accepted Format RRGGBB[AA] as hex value (00 to FF)\nor R G B [A] as float value (0.0 to 1.0) or colorName as string."))
#else
#define CONSOLE_Y SUBWINDOW_OPTION_Y_START
#define CONSOLE_H SUBWINDOW_OPTION_COMPUTE_H(2)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, CONSOLE_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, CONSOLE_H, _("CONSOLE"))
	YESNO(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Auto Clear:"), .2, 8, "con_autoclear", _("Toggle persistent console input."))
	MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(CONSOLE_Y, 2), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Open Speed:"), .2, 8, "scr_conspeed", cvarFloatList { "Slow" 1 "Default" 3 "Fast" 6 "Instant" 200 }, _("Specify the console open speed."))
#endif

#define DEMO_Y (CONSOLE_Y + CONSOLE_H + SUBWINDOW_OPTION_Y_PADDING)
#define DEMO_H SUBWINDOW_OPTION_COMPUTE_H(8)
    SUBWINDOW(SUBWINDOW_OPTION_HEADER_X1_START, DEMO_Y, SUBWINDOW_OPTION_HEADER_WIDTH_L, DEMO_H, _("DEMO"))
    MULTI(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 1), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Auto-Action:"), .2, 8, "cg_autoAction", cvarFloatList { "None" 0 "Demo" 1 "Screenshot" 2 "Stats Dump" 4 "Demo + SS" 3 "Demo + Stats" 5 "SS + Stats" 6 "Demo + SS + Stats" 7 }, _("Perform automatic actions at the start or end of a round"))
    NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 2), SUBWINDOW_OPTION_WIDTH_L, 10, _("AVI FPS F1:"), .2, 8, "demo_avifpsF1", 5, _("Set the demo AVI rate bind to F1 key in demo recording"))
    NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 3), SUBWINDOW_OPTION_WIDTH_L, 10, _("AVI FPS F2:"), .2, 8, "demo_avifpsF2", 5, _("Set the demo AVI rate bind to F2 key in demo recording"))
    NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 4), SUBWINDOW_OPTION_WIDTH_L, 10, _("AVI FPS F3:"), .2, 8, "demo_avifpsF3", 5, _("Set the demo AVI rate bind to F3 key in demo recording"))
    NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 5), SUBWINDOW_OPTION_WIDTH_L, 10, _("AVI FPS F4:"), .2, 8, "demo_avifpsF4", 5, _("Set the demo AVI rate bind to F4 key in demo recording"))
    NUMERICFIELD(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 6), SUBWINDOW_OPTION_WIDTH_L, 10, _("AVI FPS F5:"), .2, 8, "demo_avifpsF5", 5, _("Set the demo AVI rate bind to F5 key in demo recording"))
    YESNO(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 7), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Draw Time Scale:"), .2, 8, "demo_drawTimeScale", _("Toggle time Scale window draw."))
    YESNO(SUBWINDOW_OPTION_X1_START, SUBWINDOW_OPTION_COMPUTE_Y(DEMO_Y, 8), SUBWINDOW_OPTION_WIDTH_L, SUBWINDOW_OPTION_HEIGHT, _("Draw Help:"), .2, 8, "demo_infoWindow", _("Toggle help window draw."))

#ifdef FEATURE_EDV
#define EDV_Y (SUBWINDOW_OPTION_Y_START)
#define EDV_H SUBWINDOW_OPTION_COMPUTE_H(9)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, EDV_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, EDV_H, _("EDV"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Weapon Camera:"), .2, 8, "demo_weaponcam", _("Toggle weapon camera window draw"))
	EDITFIELD(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Follow Distance:"), .2, 8, "demo_followDistance", 25, 18, _("Set follow distance by X Y Z corrdinate. Format: X Y Z"))
	EDITFIELD(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 3), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Axis Speed:"), .2, 8, "demo_yawPitchRollSpeed", 25, 18, _("Set yaw Pitch Roll Speed. Format: X Y Z"))
	CVARFLOATLABEL(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, "demo_freecamspeed", .2, ITEM_ALIGN_RIGHT, $evalfloat(SUBWINDOW_OPTION_WIDTH_L), 8)
	SLIDER(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 4), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Free Cam Speed:"), .2, 8, "demo_freecamspeed" 800 0 5000, _("Set the free camaera speed movement"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 5), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("No Pitch:"), .2, 8, "demo_nopitch", _("Toggle no pitch for missile"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 6), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("PVS Hint:"), .2, 8, "demo_pvshint", _("Toggle draws tracer from the demo-player to the camera"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 7), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Auto Time Scale Weapons:"), .2, 8, "demo_autotimescaleweapons", _("Toggle auto time scale when following missile weapon"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 8), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Auto Time Scale:"), .2, 8, "demo_autotimescale", _("Toggle auto time scale for missile"))
	YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(EDV_Y, 9), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Team Only Missile Cam:"), .2, 8, "demo_teamonlymissilecam", _("Toggle draw missile cam only for the followed team"))
#endif

#ifdef FEATURE_MULTIVIEW
#ifdef FEATURE_EDV
#define MULTIVIEW_Y (EDV_Y + EDV_H + SUBWINDOW_OPTION_Y_PADDING)
#else
#define MULTIVIEW_Y (SUBWINDOW_OPTION_Y_START)
#endif
#define MULTIVIEW_H SUBWINDOW_OPTION_COMPUTE_H(2)
	SUBWINDOW(SUBWINDOW_OPTION_HEADER_X2_START, MULTIVIEW_Y, SUBWINDOW_OPTION_HEADER_WIDTH_R, MULTIVIEW_H, _("EDV"))
    YESNO(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MULTIVIEW_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Show Help:"), .2, 8, "cg_specHelp", _("Toggle help windows in multiview mod"))
    CVARFLOATLABEL(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MULTIVIEW_Y, 1), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, "mv_sensitivity", .2, ITEM_ALIGN_RIGHT, $evalfloat(SUBWINDOW_OPTION_WIDTH_L), 8)
	SLIDER(SUBWINDOW_OPTION_X2_START, SUBWINDOW_OPTION_COMPUTE_Y(MULTIVIEW_Y, 2), SUBWINDOW_OPTION_WIDTH_R, SUBWINDOW_OPTION_HEIGHT, _("Sensitivity:"), .2, 8, "mv_sensitivity" 20 0 100, _("Set multiview mouse sensitivity"))
#endif

// Buttons //
	BUTTON(6, WINDOW_HEIGHT - 24, WINDOW_WIDTH - 12, 18, _("MSGID_MENU_BACK"), .3, 14, close options_system_extended ; open options_system)
}
