#include "ui/menudef.h"
#include "ui_mp/main.inc"
#include "ui_mp/logo.inc"

#define HIDE_MOD

#undef LOGO_X
#define LOGO_X														-256

#undef LOGO_Y
#define LOGO_Y														-220

#undef LOGO_WIDTH
#define LOGO_WIDTH													512

#undef LOGO_HEIGHT
#define LOGO_HEIGHT													128

#undef LOGO_RECT
#define LOGO_RECT													LOGO_X LOGO_Y LOGO_WIDTH LOGO_HEIGHT HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER

#define MENU_NAME													"menu_first_launch"
#define MENU_MUSIC													"music_opening"

#define WELCOME_TITLE												"Welcome to IW4x"
#define WELCOME_MESSAGE												"Thank you for participating in the IW4x Beta!\n\nThis mod is in Beta, and will be so for some time. This means you will experience bugs, unfinished features, problematic design decision, and many more things that disrupt your game experience. We will be working with the community to fix these, to help us please visit ^2xlabs.dev ^7for development information.\n\nAbove all, please remember this mod is not finished, and is a work in progress."

#define MENU_ITEM_WELCOME_BOX(titleArg, messageArg) \
	itemDef \
	{ \
		name														"box_background" \
		rect														0 -100 600 220 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER \
		decoration													\
		visible														1 \
		style														WINDOW_STYLE_SHADER \
		foreColor													0.3 0.3 0.3 0.5 \
		background													"white" \
		textScale													0.55 \
		exp															rect x (0 - 300) \
	} \
	itemDef \
	{ \
		name														"welcome_box" \
		rect														0 -100 600 220 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER \
		decoration													\
		visible														1 \
		style														WINDOW_STYLE_FILLED \
		foreColor													CHOICE_TEXTCOLOR \
		backColor													0 0 0 0.375 \
		background													"white" \
		textFont													9 \
		textAlign													ITEM_ALIGN_TOP_CENTER \
		textAlignY													5 \
		textScale													0.45 \
		text														titleArg \
		exp															rect x (0 - 300) \
	} \
	itemDef \
	{ \
		name														"welcome_message" \
		rect														0 -60 500 180 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_CENTER \
		autoWrapped													\
		decoration													\
		visible														1 \
		style														WINDOW_STYLE_FILLED \
		foreColor													CHOICE_TEXTCOLOR \
		textfont													7 \
		textalign													ITEM_ALIGN_TOP_CENTER \
		textScale													CHOICE_TEXTSIZE \
		exp															rect x (0 - 250) \
		text														messageArg \
	}

#define MENU_ITEM_BUTTON(xPos, yPos, width, buttonName, textArg, actionArg) \
		MENU_ITEM_BUTTON_VIS(xPos, yPos, width, buttonName, textArg, actionArg, 1)

#define MENU_ITEM_BUTTON_VIS(xPos, yPos, width, buttonName, textArg, actionArg, visArg) \
	itemDef \
	{ \
		name														buttonName \
		rect														xPos yPos width 20 HORIZONTAL_ALIGN_CENTER VERTICAL_ALIGN_TOP \
		style														WINDOW_STYLE_FILLED \
		foreColor													CHOICE_TEXTCOLOR \
		disableColor												0.55 0.55 0.55 1 \
		background													"white" \
		type														ITEM_TYPE_BUTTON \
		textFont													9 \
		textAlign													ITEM_ALIGN_MIDDLE_CENTER \
		textScale													CHOICE_TEXTSIZE \
		text														textArg \
		visible														visArg \
		onFocus \
		{ \
			play													CHOICE_FOCUS_SOUND; \
			setItemColor											self backColor 0 0 0 1; \
		} \
		leaveFocus \
		{ \
			setItemColor											self backColor 0 0 0 0; \
		} \
		action \
		{ \
			play													CHOICE_CLICK_SOUND; \
			actionArg												\
		} \
	}

#define ON_MENU_ESC \
	open															"quit_popmenu";

#define ACTION_ACCEPT \
	setDvar															"g_firstLaunch" 0; \
	open															"popup_playername"; \
	close															self;

{
	menuDef
	{
		name														MENU_NAME
		fullscreen													1
		rect														0 0 640 480
		foreColor													CHOICE_TEXTCOLOR
		focusColor													CHOICE_TEXTCOLOR
		soundLoop													MENU_MUSIC
		fadeCycle													1
		fadeClamp													1
		fadeAmount													0.1

		MENU_ON_ESC(ON_MENU_ESC)

		#define DISABLE_SIDEBAR
		#define BACKGROUND_SP
		#include "ui_mp/bg.inc"

		LOGO_GAME

		MENU_ITEM_WELCOME_BOX(WELCOME_TITLE, WELCOME_MESSAGE)

		MENU_ITEM_BUTTON(-300, 326, 106.667, "website", "WEBSITE", uiScript "visitWebsite";)
		MENU_ITEM_BUTTON(-70, 326, 146.667, "ok", "I UNDERSTAND", ACTION_ACCEPT)
		MENU_ITEM_BUTTON(193.3333, 326, 106.667, "wiki", "WIKI", uiScript "visitWiki";)
		MENU_ITEM_BUTTON(-70, 400, 146.667, "quit", "@MENU_QUIT_CAPS", ON_MENU_ESC)
	}
}
