// Copyright (C) 1999-2000 Id Software, Inc.
//
/*
=============================================================================
 
START SERVER MENU HEADER (Q3 UI INTERFACE SPECIFIC) *****
 
=============================================================================
*/


/*
	This file should only contain info and data that is used
	to draw/update or interact with the Q3 user interface.
 
	Put UI INDEPENDENT stuff into ui_startserver.h
*/



#include "ui_startserver.h"



#define GAMESERVER_BACK0		"menu/art/back_0"
#define GAMESERVER_BACK1		"menu/art/back_1"
#define GAMESERVER_FIGHT0		"menu/art/fight_0"
#define GAMESERVER_FIGHT1		"menu/art/fight_1"
#define GAMESERVER_SERVER0		"menu/art/server_0"
#define GAMESERVER_SERVER1		"menu/art/server_1"

#define GAMESERVER_BATTLE0		"menu/art/battle_0"//INCIN -- need icons
#define GAMESERVER_BATTLE1		"menu/art/battle_1"//INCIN -- need icons

#define GAMESERVER_ITEMS0		"menu/art/items_0"
#define GAMESERVER_ITEMS1		"menu/art/items_1"
#define GAMESERVER_BOTS0		"menu/art/bots_0"
#define GAMESERVER_BOTS1		"menu/art/bots_1"
#define GAMESERVER_MAPS0		"menu/art/maps_0"
#define GAMESERVER_MAPS1		"menu/art/maps_1"
#define GAMESERVER_VARROWS		"menu/art/arrows_vert_0"
#define GAMESERVER_UP			"menu/art/arrows_vert_top"
#define GAMESERVER_DOWN			"menu/art/arrows_vert_bot"
#define GAMESERVER_DEL0			"menu/art/del_0"
#define GAMESERVER_DEL1			"menu/art/del_1"
#define GAMESERVER_SELECTED0	"menu/art/switch_off"
#define GAMESERVER_SELECTED1	"menu/art/switch_on"
#define GAMESERVER_ACTION0		"menu/art/action0"
#define GAMESERVER_ACTION1		"menu/art/action1"



#define FRAME_LEFT				"menu/art/frame2_l"
#define FRAME_RIGHT				"menu/art/frame1_r"
#define FRAME_SPLASH			"menu/art/cut_frame"
#define FRAME_EXCLUDED			"menu/art/excluded"


// control id's are grouped for ease of allocation
// < 100 are common to all pages
#define ID_SERVERCOMMON_BACK 		10
#define ID_SERVERCOMMON_FIGHT 		11

#define ID_SERVERCOMMON_MAPS 		12		//15
#define ID_SERVERCOMMON_BOTS 		13		//14
#define ID_SERVERCOMMON_ITEMS 		14		//13
#define ID_SERVERCOMMON_BATTLEMODE 	15		//16
#define ID_SERVERCOMMON_SERVER 		16		//12


#define COLUMN_LEFT (SMALLCHAR_WIDTH * 18)
#define COLUMN_RIGHT (320 + (SMALLCHAR_WIDTH * 20))

#define LINE_HEIGHT (SMALLCHAR_HEIGHT + 2)

#define GAMETYPECOLUMN_X 320
#define GAMETYPEICON_X (GAMETYPECOLUMN_X - (20 * SMALLCHAR_WIDTH))
#define GAMETYPEROW_Y (64 + (LINE_HEIGHT/2))


#define MAPPAGE_TEXT 16


#define MAPSELECT_SELECT	"menu/art/mapfocus"
#define MAP_FADETIME 1000


#define TABCONTROLCENTER_Y (240 + LINE_HEIGHT)



typedef void (*CtrlCallback_t)(void * self, int event);


// all the controls common to menus
typedef struct commoncontrols_s {
    menubitmap_s back;
    menubitmap_s fight;
    menubitmap_s server;
    menubitmap_s items;
    menubitmap_s maps;
    menubitmap_s bots;
    menubitmap_s battle;//INCIN added battle icons

    menutext_s servertext;
    menutext_s itemtext;
    menutext_s maptext;
    menutext_s bottext;
    menutext_s battlemode;//INCIN added battlemode page text header

} commoncontrols_t;



//enum { COMMONCTRL_BOTS, COMMONCTRL_MAPS, COMMONCTRL_SERVER, COMMONCTRL_ITEMS };//INCIN added battlemode main menu
enum { COMMONCTRL_MAPS, COMMONCTRL_BOTS, COMMONCTRL_ITEMS , COMMONCTRL_BATTLEMODE,  COMMONCTRL_SERVER };


// global data

extern vec4_t pulsecolor;
extern vec4_t fading_red;





//
// declarations
//

// ui_startserver_botsel.c
void UI_BotSelect_Index( char *bot , int index);

// ui_startserver_mapsel.c
void UI_StartMapMenu( int gametype, int index, const char* mapname);


// ui_startserver_common.c
qboolean StartServer_CheckFightReady(commoncontrols_t* c);
void StartServer_CommonControls_Init(menuframework_s* ,commoncontrols_t* ,CtrlCallback_t ,int );
void StartServer_BackgroundDraw(qboolean excluded);
void StartServer_SelectionDraw(void* self );



// ui_startserver_map.c
void StartServer_MapPage_MenuInit(void);
void StartServer_MapPage_Cache( void );
void StartServer_MapPage_CopyCustomLimitsToControls(void);

// ui_startserver_bot.c
void StartServer_BotPage_MenuInit(void);
void StartServer_BotPage_Cache( void );

// ui_startserver_server.c
void StartServer_ServerPage_MenuInit(void);
void StartServer_ServerPage_Cache( void );

// ui_startserver_item.c
void StartServer_BothItemMenus_Cache( void );
void StartServer_ItemPage_MenuInit(void);

//ui_startserver_battle.c
void StartServer_BattlePage_MenuInit(void);


// ui_startserver_item_old.c
void StartServer_ItemPage_MenuInit_OldMenu(qboolean ingame);

/*
#define NUM_ITEM_COUNT ITEM_COUNT
#define NUM_ITEMGROUP_COUNT ITEMGROUP_COUNT
 
// and finally the page controls themselves
typedef struct itemcontrols_s {
    menuframework_s 	menu;
    commoncontrols_t 	common;
    ingame_controls_s	ingame;
 
    menulist_s 		gameType;
    menubitmap_s 	gameTypeIcon;
	
	//menulist_s		gamemode;//INCIN added for gamemode
	
    menulist_s 		groupMaster[NUM_ITEMGROUP_COUNT];	// don't use ITEMGROUP_* to index
 
    itemradiobutton_t itemCtrl[NUM_ITEM_COUNT]; // don't use ITEM_* to index
 
    menubitmap_s	reset;
 
    qboolean ingame_menu;	// menu display format
 
    int nummasters;
    int numitems;
 
    int base_master_y;	// height of master controls
 
    // state of the controls
    // this abstraction "aliases" or "hides" where the data is stored,
    // and helps us separate data associated with the script from
    // data associated with the in-game version of this menu
 
    // array size assumed as ITEM_COUNT
    // indexed by ITEM_*
    qboolean* enabled;
 
    // array size assumed as ITEMGROUP_COUNT
    // indexed by ITEMGROUP_*
    int* grouptype;
}
itemcontrols_t;
 
static itemcontrols_t s_itemcontrols;
*/
