#include "ui/menudef.h"
#include "ui_mp/common_macro.inc"
#include "ui_mp/stats_info.inc"
#include "ui/framestyle.inc"
#include "ui_mp/newframe.inc"


#undef  CHOICE_X_START
#define CHOICE_X_START				30
#undef  CHOICE_Y_START
#define CHOICE_Y_START				-105

#ifdef PC
	#define	PC_INGAME //for background in overlaybg.inc
#endif

#define CHOICE_SEP_OFFSET_Y			-2
#define CHOICE_SEP_1				5

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

#define HIGH_BOUND					"1000"

#undef	BUTTON_BG_X_START
#define BUTTON_BG_X_START			30
#undef	BUTTON_BG_Y_START
#define	BUTTON_BG_Y_START			42

#undef	CHOICE_TEXTSTYLE
#define	CHOICE_TEXTSTYLE			ITEM_TEXTSTYLE_NORMAL

#undef	CHOICE_SIZE_X
#define CHOICE_SIZE_X				200

#undef	CHOICE_HORIZONTAL_ALIGN
#define CHOICE_HORIZONTAL_ALIGN		HORIZONTAL_ALIGN_LEFT

#undef	CHOICE_VERTICAL_ALIGN
#define CHOICE_VERTICAL_ALIGN		VERTICAL_ALIGN_CENTER

// ------

#undef ON_ESC
#define ON_ESC		scriptMenuResponse "back";	

{
	menuDef
	{
		name			"changeclass"
		rect			0 0 640 480 HORIZONTAL_ALIGN_FULLSCREEN VERTICAL_ALIGN_FULLSCREEN
		focuscolor		COLOR_FOCUSED
		style			WINDOW_STYLE_EMPTY
#ifdef CONSOLE
		blurWorld		7.0
#endif
		onOpen
		{
			if ( IsSplitscreen() )
			{
				close self;
				if ( IsViewportLarge() )
				{
					open "changeclass_splitscreen";
				}
				else
				{
					open "changeclass_splitscreen_small";
				}
			}
			else
			{
				// update player's XP
				execNow "statGetByNameInDvar RANKXP ui_stat_rankxp";
				
				if ( dvarString( ui_custom_name ) == "" )
				{
					execnow set ui_custom_name customclass1;
				}
				
				if( dvarString( ui_class ) == "" )
				{
					execnow set ui_class class_smg; 
				}
				/*set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0";*/
				
				setfocusbydvar "ui_customclass_selected";
				//focusFirst
			}
			if (IsInGame())
			{
				showMenu "pausedbkgnd";
			}		
			
#ifdef PC
			setLocalVarBool ui_hide_cac_item_info_highlights 1;
#endif // #ifdef PC
		}
		onClose
		{
			if (IsInGame())
			{
				hideMenu "pausedbkgnd";
			}
			
#ifdef PC
			setLocalVarBool ui_hide_cac_item_info_highlights 0;
#endif // #ifdef PC			
		}
		onEsc 
		{
			ON_ESC
		}
		
		execkeyint BUTTON_START
		{
			close self;
		}
		
		
#ifndef PC // background overlay
		#include "ui_mp/ingamebg.inc"
#endif		// background overlay

		// ------------------ TREE TITLE ------------------
		
		CHOICE_MENU_TITLE_ALIGN_VIS( "@MPUI_CHOOSE_CLASS_CAPS",  HORIZONTAL_ALIGN_LEFT VERTICAL_ALIGN_TOP, ITEM_ALIGN_MIDDLE_LEFT, 1 )
		
		//=========================================================================
		//================ MENU SELECTION FOR ONLINE/OFFLINE GAME =================
		//=========================================================================

		#define IS_ONLINE_GAME			( dvarInt( splitscreen ) == 0 && dvarInt( systemlink ) == 0 )
		#define IS_BASICTRAINING_GAME	( dvarInt( xblive_basictraining ) > 0 )

		#define FOCUS_CHECK( pnum ) \
				dvartest "ui_customclass_selected" focusdvar { pnum }

		#define ACTION_COMMON( pnum ) \
				setDvar ui_customclass_selected pnum; 

		#define SHOW_ONLINE_CLASS_NAME		( IS_ONLINE_GAME && !IS_BASICTRAINING_GAME )
		#define CUSTOM_CLASS_TEXT( online, offline )	\
				Select( SHOW_ONLINE_CLASS_NAME, dvarString( online ), dvarString( offline ) )
				
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	1, CUSTOM_CLASS_TEXT( customclass1, offline_customclass1 ), 
											scriptMenuResponse "custom1,0"; ACTION_COMMON( 6 ), 
											exec "set ui_custom_name customclass1; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											!IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), FOCUS_CHECK( 6 ) )	
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	1, CUSTOM_CLASS_TEXT( customclass1, offline_customclass1 ), 
											;, 
											;, 
											IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), decoration )

											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	2, CUSTOM_CLASS_TEXT( customclass2, offline_customclass2 ), 
											scriptMenuResponse "custom2,0"; ACTION_COMMON( 7 ), 
											exec "set ui_custom_name customclass2; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											!IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), FOCUS_CHECK( 7 ) )	
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	2, CUSTOM_CLASS_TEXT( customclass2, offline_customclass2 ), 
											;, 
											;, 
											IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), decoration )
								
											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	3, CUSTOM_CLASS_TEXT( customclass3, offline_customclass3 ), 
											scriptMenuResponse "custom3,0"; ACTION_COMMON( 8 ), 
											exec "set ui_custom_name customclass3; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											!IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), FOCUS_CHECK( 8 ) )	
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	3, CUSTOM_CLASS_TEXT( customclass3, offline_customclass3 ), 
											;, 
											;, 
											IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), decoration )

											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	4, CUSTOM_CLASS_TEXT( customclass4, offline_customclass4 ), 
											scriptMenuResponse "custom4,0"; ACTION_COMMON( 9 ), 
											exec "set ui_custom_name customclass4; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											!IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), FOCUS_CHECK( 9 ) )	
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	4, CUSTOM_CLASS_TEXT( customclass4, offline_customclass4 ), 
											;, 
											;, 
											IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), decoration )

											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	5, CUSTOM_CLASS_TEXT( customclass5, offline_customclass5 ), 
											scriptMenuResponse "custom5,0"; ACTION_COMMON( 10 ), 
											exec "set ui_custom_name customclass5; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											!IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), FOCUS_CHECK( 10 ) )	
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	5, CUSTOM_CLASS_TEXT( customclass5, offline_customclass5 ), 
											;, 
											;, 
											IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ), decoration )

											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	6, "@CLASS_CLASS1", 
											scriptMenuResponse "smg_mp,0"; ACTION_COMMON( 1 ), 
											exec "set ui_class class_smg; set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0";, 
											;, 
											( IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) || IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_1 ) || !IS_ONLINE_GAME ), FOCUS_CHECK( 1 ) )	
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	6, dvarString( prestigeclass1 ), 
											scriptMenuResponse "prestige1,0"; ACTION_COMMON( 11 ),
											exec "set ui_custom_name prestigeclass1; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											( !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_1 ) && ( !IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) ) && IS_ONLINE_GAME ), FOCUS_CHECK( 1 ) )
		
											
											
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	7, "@CLASS_CLASS2", 
											scriptMenuResponse "cqb_mp,0"; ACTION_COMMON( 2 ), 
											exec" set ui_class class_cqb; set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0";, 
											;, 
											( IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) || IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_2 ) || !IS_ONLINE_GAME ), FOCUS_CHECK( 2 ) )	
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	7, dvarString( prestigeclass2 ), 
											scriptMenuResponse "prestige2,0"; ACTION_COMMON( 12 ),
											exec "set ui_custom_name prestigeclass2; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											( !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_2 ) && ( !IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) ) && IS_ONLINE_GAME ), FOCUS_CHECK( 2 ) )
		
											

		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	8, "@CLASS_CLASS3", 
											scriptMenuResponse "assault_mp,0"; ACTION_COMMON( 3 ), 
											exec "set ui_class class_assault; set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0";, 
											;, 
											( IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) || IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_3 ) || !IS_ONLINE_GAME ), FOCUS_CHECK( 3 ) )	
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	8, dvarString( prestigeclass3 ), 
											scriptMenuResponse "prestige3,0"; ACTION_COMMON( 13 ),
											exec "set ui_custom_name prestigeclass3; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND;, 
											;, 
											( !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_3 ) && ( !IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) ) && IS_ONLINE_GAME ), FOCUS_CHECK( 3 ) )
		

		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	9, "@CLASS_CLASS4", 
											scriptMenuResponse "lmg_mp,0"; ACTION_COMMON( 4 ), 
											exec "set ui_class class_lmg; set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0"; CLEAR_ITEM_NEW( FEATURE_CLOSEASSAULT ), 
											;, 
											( ( !IS_ITEM_LOCKED( FEATURE_CLOSEASSAULT ) && ( IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_4 ) || ( IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) && !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_4 ) ) ) ) || !IS_ONLINE_GAME ), FOCUS_CHECK( 4 ) )	
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	9, dvarString( prestigeclass4 ), 
											scriptMenuResponse "prestige4,0";ACTION_COMMON( 14 ),
											exec "set ui_custom_name prestigeclass4; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND; CLEAR_ITEM_NEW( FEATURE_CLOSEASSAULT ), 
											;, 
											( !IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) && !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_4 ) && IS_ONLINE_GAME ), FOCUS_CHECK( 4 ) )
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	9, "@CLASS_CLASS4", 
											;, 
											;, 
											( IS_ITEM_LOCKED( FEATURE_CLOSEASSAULT ) && IS_ONLINE_GAME ), decoration FOCUS_CHECK( 4 ) )
		CHOICE_NEWICON_VIS( 9, "menu_mp_lobby_new", when( ( IS_ITEM_NEW( FEATURE_CLOSEASSAULT ) ) && IS_ONLINE_GAME ) )



		
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	10, "@CLASS_CLASS5", 
											scriptMenuResponse "sniper_mp,0"; ACTION_COMMON( 5 ), 
											exec" set ui_class class_sniper; set ui_multi_s "HIGH_BOUND"; set ui_multi_dt 0"; CLEAR_ITEM_NEW( FEATURE_SNIPER ), 
											;, 
											( ( !IS_ITEM_LOCKED( FEATURE_SNIPER ) && ( IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_5 ) || ( IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) && !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_5 ) ) ) ) || !IS_ONLINE_GAME ), FOCUS_CHECK( 5 ) )	
		FRAME_CHOICE_BUTTON_FOCUS_VIS_EX(	10, dvarString( prestigeclass5 ), 
											scriptMenuResponse "prestige5,0"; ACTION_COMMON( 15 ),
											exec "set ui_custom_name prestigeclass5; set ui_multi_s 0; set ui_multi_dt "HIGH_BOUND; CLEAR_ITEM_NEW( FEATURE_SNIPER ), 
											;, 
											( !IS_ITEM_LOCKED( FEATURE_CREATE_A_CLASS ) && !IS_ITEM_LOCKED( FEATURE_PRESTIGE_CLASS_5 ) && IS_ONLINE_GAME ), FOCUS_CHECK( 5 ) )
		FRAME_CHOICE_DBUTTON_FOCUS_VIS_EX(	10, "@CLASS_CLASS5", 
											;, 
											;, 
											( IS_ITEM_LOCKED( FEATURE_SNIPER ) && IS_ONLINE_GAME ), decoration FOCUS_CHECK( 5 ) )
		CHOICE_NEWICON_VIS( 10, "menu_mp_lobby_new", when( ( IS_ITEM_NEW( FEATURE_SNIPER ) ) && IS_ONLINE_GAME ) )

		
		#define DATA_TABLE_PRIMARY_GRENADE			GetDefaultClassSlot( dvarstring( ui_class ), "primarygrenade" )
		#define DATA_TABLE_PRIMARY					GetDefaultClassSlot( dvarstring( ui_class ), "primary" )
		// no default attachments or camo for now
		#define DATA_TABLE_PRIMARY_ATTACHMENT		0
		#define DATA_TABLE_PRIMARY_CAMO				0
		#define DATA_TABLE_SECONDARY				GetDefaultClassSlot( dvarstring( ui_class ), "secondary" )
		// no default attachments or camo for now
		#define DATA_TABLE_SECONDARY_ATTACHMENT		0
		#define DATA_TABLE_SECONDARY_CAMO			0
		#define DATA_TABLE_SPECIALTY1				GetDefaultClassSlot( dvarstring( ui_class ), "specialty1" )
		#define DATA_TABLE_SPECIALTY2				GetDefaultClassSlot( dvarstring( ui_class ), "specialty2" )
		#define DATA_TABLE_SPECIALTY3				GetDefaultClassSlot( dvarstring( ui_class ), "specialty3" )		
		#define DATA_TABLE_EQUIPMENT				GetDefaultClassSlot( dvarstring( ui_class ), "equipment" )
		#define DATA_TABLE_SPECIAL_GRENADE			GetDefaultClassSlot( dvarstring( ui_class ), "specialgrenade" )
		#define DATA_TABLE_BODY						GetDefaultClassSlot( dvarstring( ui_class ), "body" )
		#define DATA_TABLE_DEATHSTREAK				GetDefaultClassSlot( dvarstring( ui_class ), "deathstreak" )
		#define DATA_TABLE_KILLSTREAK_TIER1			GetDefaultClassSlot( dvarstring( ui_class ), "killstreak1" )
		#define DATA_TABLE_KILLSTREAK_TIER2			GetDefaultClassSlot( dvarstring( ui_class ), "killstreak2" )
		#define DATA_TABLE_KILLSTREAK_TIER3			GetDefaultClassSlot( dvarstring( ui_class ), "killstreak3" )

		/* ==================================== custom classes ============================================= */

		#define STATS_PRIMARY					getCACItemIndex( ( dvarString( ui_custom_name ) ),  "primary" )
		#define STATS_PRIMARY_ATTACHMENT		getCACItemIndex( ( dvarString( ui_custom_name ) ),  "primaryattachment" )
		#define STATS_PRIMARY_CAMO				getCACItemIndex( ( dvarString( ui_custom_name ) ),  "primarycamo" )
		#define STATS_SECONDARY					getCACItemIndex( ( dvarString( ui_custom_name ) ),  "secondary" )
		#define STATS_SECONDARY_ATTACHMENT		getCACItemIndex( ( dvarString( ui_custom_name ) ),  "secondaryattachment" )
		#define STATS_SECONDARY_CAMO			getCACItemIndex( ( dvarString( ui_custom_name ) ),  "secondarycamo" )
		#define STATS_PRIMARY_GRENADE			getCACItemIndex( ( dvarString( ui_custom_name ) ),  "primarygrenade" )               
		#define STATS_SPECIALTY1				getCACItemIndex( ( dvarString( ui_custom_name ) ),  "specialty1" )                    
		#define STATS_SPECIALTY2				getCACItemIndex( ( dvarString( ui_custom_name ) ),  "specialty2" )                   
		#define STATS_SPECIALTY3				getCACItemIndex( ( dvarString( ui_custom_name ) ),  "specialty3" )                   		
		#define STATS_EQUIPMENT					getCACItemIndex( ( dvarString( ui_custom_name ) ),  "equipment" )                   
		#define STATS_SPECIAL_GRENADE			getCACItemIndex( ( dvarString( ui_custom_name ) ),  "specialgrenade" ) 
		#define STATS_BODY						getCACItemIndex( ( dvarString( ui_custom_name ) ),  "body" )              
		#define STATS_DEATHSTREAK				getCACItemIndex( "cacLoadouts", "deathstreak" )                  
		#define STATS_KILLSTREAK_TIER1			getCACItemIndex( "cacLoadouts", "killstreak1" )                  
		#define STATS_KILLSTREAK_TIER2			getCACItemIndex( "cacLoadouts", "killstreak2" )                  
		#define STATS_KILLSTREAK_TIER3			getCACItemIndex( "cacLoadouts", "killstreak3" )                  

		#include "ui/safearea.menu"
		
		/* ================================================================================= */
		/* ================================ LOADOUT DISPLAY ================================ */
		/* ================================================================================= */

		
		#define STAT_CAC_PRIMARY_GRENADE		int(min( STATS_PRIMARY_GRENADE		+ dvarInt(ui_multi_s), DATA_TABLE_PRIMARY_GRENADE		+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_PRIMARY				int(min( STATS_PRIMARY				+ dvarInt(ui_multi_s), DATA_TABLE_PRIMARY				+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_PRIMARY_ATTACHMENT		int(min( STATS_PRIMARY_ATTACHMENT	+ dvarInt(ui_multi_s), DATA_TABLE_PRIMARY_ATTACHMENT	+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_PRIMARY_CAMO			int(min( STATS_PRIMARY_CAMO			+ dvarInt(ui_multi_s), DATA_TABLE_PRIMARY_CAMO			+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SECONDARY				int(min( STATS_SECONDARY			+ dvarInt(ui_multi_s), DATA_TABLE_SECONDARY				+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SECONDARY_ATTACHMENT	int(min( STATS_SECONDARY_ATTACHMENT	+ dvarInt(ui_multi_s), DATA_TABLE_SECONDARY_ATTACHMENT	+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SECONDARY_CAMO			int(min( STATS_SECONDARY_CAMO		+ dvarInt(ui_multi_s), DATA_TABLE_SECONDARY_CAMO		+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SPECIALTY1				int(min( STATS_SPECIALTY1			+ dvarInt(ui_multi_s), DATA_TABLE_SPECIALTY1			+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SPECIALTY2				int(min( STATS_SPECIALTY2			+ dvarInt(ui_multi_s), DATA_TABLE_SPECIALTY2			+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SPECIALTY3				int(min( STATS_SPECIALTY3			+ dvarInt(ui_multi_s), DATA_TABLE_SPECIALTY3			+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_EQUIPMENT				int(min( STATS_EQUIPMENT			+ dvarInt(ui_multi_s), DATA_TABLE_EQUIPMENT				+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_SPECIAL_GRENADE		int(min( STATS_SPECIAL_GRENADE		+ dvarInt(ui_multi_s), DATA_TABLE_SPECIAL_GRENADE		+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_BODY					int(min( STATS_BODY					+ dvarInt(ui_multi_s), DATA_TABLE_BODY					+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_DEATHSTREAK			int(min( STATS_DEATHSTREAK			+ dvarInt(ui_multi_s), DATA_TABLE_DEATHSTREAK			+ dvarInt(ui_multi_dt) ))
		#define STAT_CAC_KILLSTREAK_TIER1		STATS_KILLSTREAK_TIER1
		#define STAT_CAC_KILLSTREAK_TIER2		STATS_KILLSTREAK_TIER2
		#define STAT_CAC_KILLSTREAK_TIER3		STATS_KILLSTREAK_TIER3
		#define FIRST_ATTACHMENT_PRIMARY_WEAPON \
				Select( dvarInt( ui_multi_s ) == 0, GetItemEquippedAttachment( dvarString( ui_custom_name ), STAT_CAC_PRIMARY, 0 ), -1 )
		#define SECOND_ATTACHMENT_PRIMARY_WEAPON \
				Select( dvarInt( ui_multi_s ) == 0, GetItemEquippedAttachment( dvarString( ui_custom_name ), STAT_CAC_PRIMARY, 1 ), -1 )
		#define FIRST_ATTACHMENT_SECONDARY_WEAPON \
				Select( dvarInt( ui_multi_s ) == 0, GetItemEquippedAttachment( dvarString( ui_custom_name ), STAT_CAC_SECONDARY, 0 ), -1 )
		#define SECOND_ATTACHMENT_SECONDARY_WEAPON \
				Select( dvarInt( ui_multi_s ) == 0, GetItemEquippedAttachment( dvarString( ui_custom_name ), STAT_CAC_SECONDARY, 1 ), -1 )
			
		// Frame setup
		#define	CAC_HEIGHT							NEW_FRAME_DEFAULT_HEIGHT
		#define CAC_WIDTH							( CAC_HEIGHT * FRAME_ASPECT_RATIO )
		#define COMMON_ITEM_INFO_X					( -(NEW_FRAME_BUTTON_WIDTH+20) - 30 )
		#define COMMON_ITEM_INFO_Y					( -CAC_HEIGHT/2 + NEW_FRAME_BG_Y_OFFSET( CAC_HEIGHT ) )
		#define COMMON_ITEM_HORIZONTAL_ALIGN		HORIZONTAL_ALIGN_RIGHT

		#include "ui_mp/cac_item_info.inc"

		// Back button
#ifdef PC
		NEW_FRAME_BACK_BUTTON_ACTION( 640, 480, ON_ESC )
#else //#ifdef PC
		PREPROC_TEXT_DRAW_VIS( CHOICE_X_START -17 50 17 CHOICE_HORIZONTAL_ALIGN VERTICAL_ALIGN_BOTTOM, 0 0, "@PLATFORM_BACK", TEXTSIZE_DEFAULT, 0, 0, ITEM_ALIGN_BOTTOM_LEFT, 1 1 1 1, 1 )
#endif //#ifdef PC
	}
}
