 
// general definitions

#define CHOICE_X_START			0
#define CHOICE_Y_START			34

#include "ui/menudef.h"
#include "ui_mp/common_macro.inc"
#include "ui_mp/menustyle.inc"
#include "ui/choices_setup_common.menu"


#define CHOICE_SEP_1			3

#define ORIGIN_STATUS			390 64
#define MENU_FONT_COLOR2		1 1 1 0.5

#include "ui_mp/stats_info.inc"

	menuDef	
	{
		name			"character_stuff"
		rect			0 0 640 480
		focuscolor		COLOR_FOCUSED
		style			WINDOW_STYLE_EMPTY
		blurWorld		7.0
		onOpen 
		{			
			//setfocus primary_weapon_selection;
		}
		onEsc 
		{
			scriptMenuResponse "back";
		}

		itemDef
		{
			style			WINDOW_STYLE_SHADER
			rect			FULLSCREEN_WIDE
			background		"animbg_blur_back"
			backcolor		1 1 1 0.75
			visible			1
			decoration
		}

		// ------------------  statics ------------------------

		CHOICE_MENU_TITLE( "Character Setup" )				
		// ------------------------- buttons ------------------------------
		#define BACK_OPEN ;
		#include "ui_mp/navcontrols.inc"
		
		//=========================================================
		//===================== MENU SELECTION ====================
		//=========================================================

		CHOICE_BUTTON_BG_RAW( 3, "gradient_fadein", 0.5 0.15 0 0.5, 1 )
		CHOICE_BUTTON( 3, "Select Character", play "mouse_click"; open "popup_stuff1"; )
			

		CHOICE_SEPARATOR( CHOICE_SEP_1 )


		CHOICE_BUTTON( 4, "@MENU_ACCEPT", play "mouse_click"; scriptMenuResponse "go"; )
				
		/* ================================================================================= */
		/* ================================ LOADOUT DISPLAY ================================ */
		/* ================================================================================= */


		#define STAT_CAC_SPECIALTY_EQUIPMENT	tableLookup("mp/statstable.csv", 4, dvarString( loadout_perk1 ), 0)
		#define STAT_CAC_SPECIALTY_WEAPON		tableLookup("mp/statstable.csv", 4, dvarString( loadout_perk2 ), 0)
		#define STAT_CAC_SPECIALTY_ABILITY		tableLookup("mp/statstable.csv", 4, dvarString( loadout_perk3 ), 0)
		#define STAT_CAC_SPECIALTY_STUFF		tableLookup("mp/statstable.csv", 4, dvarString( loadout_perk4 ), 0)	
		//#include "ui_mp/cac_loadout_ingame.inc"

		#include "ui/safearea.menu"
	}

	
// including weapon data
#include "ui_mp/weaponinfo.menu"
	
#include "ui_mp/popupstyle.inc"	
#include "ui/choices_setup_popmenu.menu"

#undef CHOICE_SIZE_X
#define CHOICE_SIZE_X			216

#undef NEW_X_OFFSET			
#define NEW_X_OFFSET	(0-CHOICE_SIZE_X)

#undef NEW_Y_OFFSET			
#define NEW_Y_OFFSET	(0-2)

	// ====================================================================================================
	// character selection ================================================================================
	// ====================================================================================================

	#define LOCAL_ITEM_INFO_WINDOW( item_dvar ) \
		/* perk information side frame*/ \
		PREPROC_SHADER_DRAW_ALIGNED( (CHOICE_POPUP_WIDTH-6) -4 280 CHOICE_POPUP_HEIGHT( 7 ) CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0 0, "white", CHOICE_POPUP_BORDER_COLOR, 1, 2, CHOICE_POPUP_BORDER_COLOR ) \
		LOADOUT_PLATING_RAW( CHOICE_POPUP_WIDTH 8, -2, 0, 280, (CHOICE_POPUP_HEIGHT( 7 )-4), CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0, 0 )\
		/* perk image*/ \
		PREPROC_SHADER_DRAW_ALIGNED( (CHOICE_POPUP_WIDTH+6) 30 256 48 CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0 0, "gradient_bottom", 1 1 1 0.3, 0, 2, CHOICE_POPUP_BORDER_COLOR ) \
		PREPROC_SHADER_DRAW_ALIGNED( (CHOICE_POPUP_WIDTH+188) -2 64 64 CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0 0, dvarString(item_dvar), 1 1 1 0.75, 0, 0, 0.2 0.2 0.225 1 ) \
		/* perk title*/\
		PREPROC_TEXT_DRAW_ALIGNED_EXP( (CHOICE_POPUP_WIDTH+10) 58 256 20 CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0 0, dvarString(item_dvar_txt), TEXTSIZE_DEFAULT, 0, 0, ITEM_ALIGN_MIDDLE_LEFT, COLOR_TITLE ) \
		/* perk desc unlocked*/\
		PREPROC_TEXT_DRAW_ALIGNED_EXP( (CHOICE_POPUP_WIDTH+10) 80 256 20 CHOICE_HORIZONTAL_ALIGN CHOICE_VERTICAL_ALIGN, 0 0,  "@MENU_DISABLED", TEXTSIZE_SMALL, 0, 0, ITEM_ALIGN_MIDDLE_LEFT, COLOR_TITLE \visible 1 );  ) \

	/*#define LOCAL_PERK_ACTION( perkDvar, perkRef, paction ) \
			play "mouse_click"; \
			close self \
			exec "set "perkDvar" "perkRef;\
			scriptMenuResponse perkDvar":"perkRef;\
			paction*/
		

	#define PI_FOCUS_ACTION( perkRef ) \
		exec "set ui_perk_highlighted "perkRef;
		

	// hackaround to work for PC's floating mouse unfocusing
	#undef  UI_FOCUSFIRST
	#define UI_FOCUSFIRST "ui_perk_highlighted"
	#define rank stat(2350)

	// perk1 selection for primary weapon popup menu
	menuDef	
	{
		IMPROVED_POPUP_SETUP_ONOPEN( "popup_stuff1", 10, (CHOICE_X( 4 )-2), (CHOICE_Y( 4 )+18), ;, execnow "set "UI_FOCUSFIRST" "REF_C4_X2"; set ui_inside_popup perk1";, 1 )
		onClose{ execnow "set ui_inside_popup 0"; }
		LOCAL_ITEM_INFO_WINDOW( "ui_perk_highlighted" )
		
		itemDef
		{
			name			"test2"
			style			WINDOW_STYLE_FILLED
			visible			1		
			backcolor		1 1 1 1
			background		"logo_brax"
			rect			90 0 200 110
		}
		//2354
		CHOICE_BUTTON_FOCUS_VIS_EX( 1, "test", exec "statset 2354 2";, show "test2";, hide "test2";, 1, ; )
		CHOICE_BUTTON_VIS( 2, "Free Spray", play "mouse_click"; scriptMenuResponse "s0";, 1 )
		/*CHOICE_BUTTON_VIS( 2, "Spray 1", play "mouse_click"; scriptMenuResponse "s1";, when( stat(2350) >= 1 ) )
		CHOICE_BUTTON_VIS( 3, "Spray 2", play "mouse_click"; scriptMenuResponse "s2";, when( stat(2350) >= 3 ) )
		CHOICE_BUTTON_VIS( 4, "Spray 3", play "mouse_click"; scriptMenuResponse "s3";, when( stat(2350) >= 5 ) )
		CHOICE_BUTTON_VIS( 5, "Spray 4", play "mouse_click"; scriptMenuResponse "s4";, when( rank >= 7 ) )
		CHOICE_BUTTON_VIS( 6, "Spray 5", play "mouse_click"; scriptMenuResponse "s5";, when( rank >= 9 ) )
		CHOICE_BUTTON_VIS( 7, "Spray 6", play "mouse_click"; scriptMenuResponse "s6";, when( rank >= 11 ) )
		CHOICE_BUTTON_VIS( 8, "Spray 7", play "mouse_click"; scriptMenuResponse "s7";, when( rank >= 13 ) )
		CHOICE_BUTTON_VIS( 9, "Spray 8", play "mouse_click"; scriptMenuResponse "s8";, when( rank >= 15 ) )
		CHOICE_BUTTON_VIS( 10, "Spray 9", play "mouse_click"; scriptMenuResponse "s9";, when( rank >= 17 ) )*/
	}
