#include "ui/menudef.h"
#include "ui_mp/common_macro.inc"

#define CHOICE_GROUP			"select_difficulty"

#include "ui_mp/menustyle.inc"
#include "ui/choices_setup_common.menu"

#undef CHOICE_HORIZONTAL_ALIGN
#define CHOICE_HORIZONTAL_ALIGN	HORIZONTAL_ALIGN_CENTER
#undef CHOICE_VERTICAL_ALIGN
#define CHOICE_VERTICAL_ALIGN	VERTICAL_ALIGN_CENTER

#include "ui_mp/popupstyle.inc"	
#include "ui/choices_setup_popmenu.menu"

#undef CHOICE_SIZE_Y
#define CHOICE_SIZE_Y				22

#undef A_BUTTON_SIZE
#define A_BUTTON_SIZE				0.33

#undef CHOICE_POPUP_BORDER_X
#define CHOICE_POPUP_BORDER_X 		130

#undef CHOICE_POPUP_TITLE_HEIGHT
#define CHOICE_POPUP_TITLE_HEIGHT	16

#undef CHOICE_X_START
#define CHOICE_X_START				0

#undef CHOICE_TEXTSIZE
#define CHOICE_TEXTSIZE				TEXTSIZE_DEFAULT

#undef CHOICE_POPUP_TITLE_TEXTSIZE
#define CHOICE_POPUP_TITLE_TEXTSIZE		TEXTSIZE_TITLE

#undef CHOICE_POPUP_SUBTITLE_TEXTSIZE
#define CHOICE_POPUP_SUBTITLE_TEXTSIZE 	TEXTSIZE_DEFAULT

#ifdef CONSOLE
#define UPDATE_GAMER_PROFILE	execnow "updategamerprofile";
#else
#define UPDATE_GAMER_PROFILE	;
#endif

#ifdef PC
	#undef CHOICE_SIZE_X
	#define CHOICE_SIZE_X			160
#else
	#undef CHOICE_SIZE_X
	#define CHOICE_SIZE_X			140
#endif
{
		
	#define LOCAL_START_LEVEL \
		exec "set arcademode_lives 2; set arcademode_combined_score 0";\
		execondvarstringvalue ui_load_level cargoship "devmap cargoship";\
		execondvarstringvalue ui_load_level coup "devmap coup";\
		execondvarstringvalue ui_load_level blackout "devmap blackout";\
		execondvarstringvalue ui_load_level killhouse "devmap killhouse";\
		execondvarstringvalue ui_load_level armada "devmap armada";\
		execondvarstringvalue ui_load_level bog_a "devmap bog_a";\
		execondvarstringvalue ui_load_level hunted "devmap hunted";\
		execondvarstringvalue ui_load_level ac130 "devmap ac130";\
		execondvarstringvalue ui_load_level bog_b "devmap bog_b";\
		execondvarstringvalue ui_load_level airlift "devmap airlift";\
		execondvarstringvalue ui_load_level aftermath "devmap aftermath";\
		execondvarstringvalue ui_load_level village_assault "devmap village_assault";\
		execondvarstringvalue ui_load_level scoutsniper "devmap scoutsniper";\
		execondvarstringvalue ui_load_level sniperescape "devmap sniperescape";\
		execondvarstringvalue ui_load_level village_defend "devmap village_defend";\
		execondvarstringvalue ui_load_level ambush "devmap ambush";\
		execondvarstringvalue ui_load_level icbm "devmap icbm";\
		execondvarstringvalue ui_load_level launchfacility_a "devmap launchfacility_a";\
		execondvarstringvalue ui_load_level launchfacility_b "devmap launchfacility_b";\
		execondvarstringvalue ui_load_level jeepride "devmap jeepride";\
		execondvarstringvalue ui_load_level airplane "devmap airplane"

	/*	#define LOCAL_DIFFICULTY_BUTTONS\
		CHOICE_CAPTION_VIS( 1, "@MENU_REGULAR_DESC_3", when( localVarInt( ui_highlight ) == 3 ) )\
		CHOICE_CAPTION_VIS( 2, "@MENU_REGULAR_DESC_4", when( localVarInt( ui_highlight ) == 3 ) )\
		CHOICE_CAPTION_VIS( 1, "@MENU_SKILLED_DESC", when( localVarInt( ui_highlight ) == 4 ) )\
		CHOICE_CAPTION_VIS( 2, "@MENU_SKILLED_DESC_2", when( localVarInt( ui_highlight ) == 4 ) )\
		CHOICE_CAPTION_VIS( 1, "@MENU_HARDENED_DESC", when( localVarInt( ui_highlight ) == 5 ) )\
		CHOICE_CAPTION_VIS( 1, "@MENU_VETERAN_DESC", when( localVarInt( ui_highlight ) == 6 ) )		*/
		
	#define LOCAL_DIFF_DESC_X	 exp rect X( CHOICE_SIZE_X+16 ); autowrapped exp rect Y( 46 ) exp rect W(216)
	
	#define LOCAL_DIFFICULTY_DESC\
		CHOICE_POPMENU_SUBTITLE_VIS( locString( "@MENU_REGULAR_DESC_3" ) + " " + locString( "@MENU_REGULAR_DESC_4" ), when( localVarInt( ui_highlight ) == 2 ); LOCAL_DIFF_DESC_X )\
		CHOICE_POPMENU_SUBTITLE_VIS( locString( "@MENU_SKILLED_DESC" ) + " " + locString( "@MENU_SKILLED_DESC_2" ), when( localVarInt( ui_highlight ) == 3 ); LOCAL_DIFF_DESC_X )\
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_HARDENED_DESC", when( localVarInt( ui_highlight ) == 4 ); LOCAL_DIFF_DESC_X )\
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_VETERAN_DESC", when( localVarInt( ui_highlight ) == 5 ); LOCAL_DIFF_DESC_X )

	menuDef
	{
		CENTER_POPUP_SETUP_ONOPEN( popmenu_difficulty, 7, ;, setfocus "newgame_regular"; setfocusbydvar "g_gameskill"; hide warning_checkpoint_reset; savegameshow warning_checkpoint_reset, 1 )

		CHOICE_POPMENU_TITLE( "@MENU_SELECT_DIFFICULTY" )
		LOCAL_DIFFICULTY_DESC
		
		CHOICE_BUTTON_EX( 2, "@MENU_RECRUIT", execnow "difficultyeasy"; UPDATE_GAMER_PROFILE close self; LOCAL_START_LEVEL, name newgame_easy; dvartest "g_gameskill"; focusdvar { "0" } )
		CHOICE_BUTTON_EX( 3, "@MENU_REGULAR", execnow "difficultymedium"; UPDATE_GAMER_PROFILE close self; LOCAL_START_LEVEL, name newgame_regular; dvartest "g_gameskill"; focusdvar { "1" } )
		CHOICE_BUTTON_EX( 4, "@MENU_HARDENED", execnow "difficultyhard"; UPDATE_GAMER_PROFILE close self; LOCAL_START_LEVEL, name newgame_regular; dvartest "g_gameskill"; focusdvar { "2" } )
		CHOICE_BUTTON_EX( 5, "@MENU_VETERAN", execnow "difficultyfu"; UPDATE_GAMER_PROFILE close self; LOCAL_START_LEVEL, name newgame_regular; dvartest "g_gameskill"; focusdvar { "3" } )
		
		#undef CHOICE_POPUP_SUBTITLE_TEXTSIZE
		#define CHOICE_POPUP_SUBTITLE_TEXTSIZE 	TEXTSIZE_SMALL
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_WARNING_CHECKPOINT_RESET2", when( !dvarBool( arcademode ) ); exp rect X(10); exp rect Y(146); exp rect W(376); autowrapped name warning_checkpoint_reset )	
		#undef CHOICE_POPUP_SUBTITLE_TEXTSIZE
		#define CHOICE_POPUP_SUBTITLE_TEXTSIZE 	TEXTSIZE_DEFAULT
	}
	
	menuDef
	{
		CENTER_POPUP_SETUP_ONOPEN( popmenu_arcade_difficulty, 5, ;, exec "set arcademode_lives 2; set arcademode_combined_score 0"; setfocus "newgame_regular"; setfocusbydvar "g_gameskill", 1 )

		CHOICE_POPMENU_TITLE( "@MENU_SELECT_DIFFICULTY" )
		LOCAL_DIFFICULTY_DESC

		CHOICE_BUTTON_EX( 2, "@MENU_RECRUIT", execnow "difficultyeasy"; UPDATE_GAMER_PROFILE close self; exec "devmap cargoship";, name newgame_easy; dvartest "g_gameskill"; focusdvar { "0" } )
		CHOICE_BUTTON_EX( 3, "@MENU_REGULAR", execnow "difficultymedium"; UPDATE_GAMER_PROFILE close self; exec "devmap cargoship";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "1" } )
		CHOICE_BUTTON_EX( 4, "@MENU_HARDENED", execnow "difficultyhard"; UPDATE_GAMER_PROFILE close self; exec "devmap cargoship";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "2" } )
		CHOICE_BUTTON_EX( 5, "@MENU_VETERAN", execnow "difficultyfu"; UPDATE_GAMER_PROFILE close self; exec "devmap cargoship";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "3" } )
	}	
	
	menuDef
	{
		CENTER_POPUP_SETUP_ONOPEN( popmenu_newgame, 5, ;, setfocus "newgame_regular"; setfocusbydvar "g_gameskill", 1 )

		CHOICE_POPMENU_TITLE( "@MENU_SELECT_DIFFICULTY" )
		LOCAL_DIFFICULTY_DESC

		CHOICE_BUTTON_EX( 2, "@MENU_RECRUIT", execnow "difficultyeasy"; UPDATE_GAMER_PROFILE close self; exec "devmap killhouse";, name newgame_easy; dvartest "g_gameskill"; focusdvar { "0" } )
		CHOICE_BUTTON_EX( 3, "@MENU_REGULAR", execnow "difficultymedium"; UPDATE_GAMER_PROFILE close self; exec "devmap killhouse";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "1" } )
		CHOICE_BUTTON_EX( 4, "@MENU_HARDENED", execnow "difficultyhard"; UPDATE_GAMER_PROFILE close self; exec "devmap killhouse";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "2" } )
		CHOICE_BUTTON_EX( 5, "@MENU_VETERAN", execnow "difficultyfu"; UPDATE_GAMER_PROFILE close self; exec "devmap killhouse";, name newgame_regular; dvartest "g_gameskill"; focusdvar { "3" } )
	}
	
	#undef CHOICE_SIZE_X
	#define CHOICE_SIZE_X			320
	
	// Removed 08.04.2023 (9:19 PM)
	/*
	menuDef
	{
		CENTER_POPUP_SETUP_ONOPEN( ingame_difficulty, 5, ;, setfocus "no";, 1 )

		CHOICE_POPMENU_TITLE( "@MENU_LOWER_DIFFICULTY" )
		
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_LOWER_DIFFICULTY_1_0", when( dvarInt(g_gameskill) == 1 ); )
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_LOWER_DIFFICULTY_2_1", when( dvarInt(g_gameskill) == 2 ); )
		CHOICE_POPMENU_SUBTITLE_VIS( "@MENU_LOWER_DIFFICULTY_3_2", when( dvarInt(g_gameskill) == 3 ); )
			
		CHOICE_BUTTON_VIS( 4, "@MENU_YES", close self; setdvar g_gameskill "0", when( dvarInt(g_gameskill) == 1 ); )
		CHOICE_BUTTON_VIS( 4, "@MENU_YES", close self; setdvar g_gameskill "1", when( dvarInt(g_gameskill) == 2 ); )
		CHOICE_BUTTON_VIS( 4, "@MENU_YES", close self; setdvar g_gameskill "2", when( dvarInt(g_gameskill) == 3 ); )
		CHOICE_BUTTON_EX( 5, "@MENU_NO", close self;, name "no" )
	}
	*/
}