From 22f826eabdbac5e0badb76bbf805deed5bea7f74 Mon Sep 17 00:00:00 2001 From: Walter Julius Hennecke Date: Sun, 9 Nov 2014 14:08:34 +0100 Subject: [PATCH] more ui updates --- code/ui/ui.vcxproj | 16 - code/ui/ui.vcxproj.filters | 6 - code/ui/ui_transporter.c | 509 ++-- code/ui/ui_turbolift.c | 572 ++--- code/ui/ui_video.c | 4870 ++++++++++++++++++------------------ 5 files changed, 2978 insertions(+), 2995 deletions(-) diff --git a/code/ui/ui.vcxproj b/code/ui/ui.vcxproj index 89ae65e..a99047b 100644 --- a/code/ui/ui.vcxproj +++ b/code/ui/ui.vcxproj @@ -416,22 +416,6 @@ MaxSpeed WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;UI_EXPORTS - - Disabled - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;UI_EXPORTS - EnableFastChecks - true - MaxSpeed - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;UI_EXPORTS - - - Disabled - WIN32;_DEBUG;_WINDOWS;_MBCS;_USRDLL;UI_EXPORTS - EnableFastChecks - true - MaxSpeed - WIN32;NDEBUG;_WINDOWS;_MBCS;_USRDLL;UI_EXPORTS - diff --git a/code/ui/ui.vcxproj.filters b/code/ui/ui.vcxproj.filters index 196dc87..27ef7bb 100644 --- a/code/ui/ui.vcxproj.filters +++ b/code/ui/ui.vcxproj.filters @@ -113,12 +113,6 @@ Source Files - - Source Files - - - Source Files - Source Files diff --git a/code/ui/ui_transporter.c b/code/ui/ui_transporter.c index 0b09a85..8d635c0 100644 --- a/code/ui/ui_transporter.c +++ b/code/ui/ui_transporter.c @@ -2,45 +2,46 @@ UI_TRANSPORTER.C User interface trigger from within game -**********************************************************************/ + **********************************************************************/ #include "ui_local.h" #include "ui_logger.h" -char *delayList[20] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", - "11", "12", "13", "14", "15", "20", "30", "60", 0 }; +static const char* delayList[20] = { "0", "1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12", "13", "14", "15", "20", "30", "60", 0 }; -char srvList[6][MAX_QPATH]; -int32_t srvCount; +char srvList[6][MAX_QPATH]; +int32_t srvCount; typedef struct //static { menuframework_s menu; - sfxHandle_t openingVoice; - menubitmap_s quitmenu; - menubitmap_s engage; - menubitmap_s engage2; - menulist_s locButton; - menulist_s srvButton; - menulist_s delButton; + sfxHandle_t openingVoice; + menubitmap_s quitmenu; + menubitmap_s engage; + menubitmap_s engage2; + menulist_s locButton; + menulist_s srvButton; + menulist_s delButton; - char *srvListPtr[7]; - char *mlist[MAX_QPATH]; - - int32_t targetEntID; + char* srvListPtr[7]; + char* mlist[MAX_QPATH]; + + int32_t targetEntID; } transporter_t; -transporter_t s_transporter; +transporter_t s_transporter; -#define ID_COMPUTERVOICE 6 +enum ui_transporterIDs_e { + ID_COMPUTERVOICE = 6, -#define ID_QUIT 10 -#define ID_ENGAGE 100 -#define ID_ENGAGE2 101 + ID_QUIT = 10, + ID_ENGAGE = 100, + ID_ENGAGE2 +}; extern adminGeneric_t s_adminGeneric; -extern void AdminGeneric_InitLists( void ); +extern void AdminGeneric_InitLists(void); -void UI_TransporterMenu_Cache (void); +void UI_TransporterMenu_Cache(void); /*static void TransCreateMaplist(void) { @@ -58,9 +59,9 @@ void TransDataReceived(const char *data) { UI_LogFuncBegin(); - for(i = 0; i < 6; i++) { + for (i = 0; i < 6; i++) { temp = Info_ValueForKey(data, va("d%i", i)); - if(!temp[0]) break; + if (!temp[0]) break; Q_strncpyz(srvList[i], temp, sizeof(srvList[i])); srvCount++; } @@ -72,7 +73,7 @@ void TransDataReceived(const char *data) { M_Transporter_Event ================= */ -static void M_Transporter_Event (void* ptr, int32_t notification) +static void M_Transporter_Event(void* ptr, int32_t notification) { int32_t id; //menubitmap_s *holdLocation; @@ -84,57 +85,57 @@ static void M_Transporter_Event (void* ptr, int32_t notification) /*if ( notification != QM_ACTIVATED ) { - return; + return; }*/ switch (id) { - case ID_QUIT: - if ( notification == QM_ACTIVATED ) - UI_PopMenu(); - break; - case ID_ENGAGE: // Active only if a deck has been chosen - if ( notification == QM_ACTIVATED ) { - if(s_transporter.delButton.curvalue <= 16) - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, s_transporter.delButton.curvalue)); + case ID_QUIT: + if (notification == QM_ACTIVATED) + UI_PopMenu(); + break; + case ID_ENGAGE: // Active only if a deck has been chosen + if (notification == QM_ACTIVATED) { + if (s_transporter.delButton.curvalue <= 16) + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, s_transporter.delButton.curvalue)); + else { + switch (s_transporter.delButton.curvalue) { + case 17: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 20)); + break; + case 18: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 30)); + break; + case 19: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 60)); + break; + } + } + UI_ForceMenuOff(); + } + break; + case ID_ENGAGE2: // Active only if a deck has been chosen + if (notification == QM_ACTIVATED) { + if (srvCount > 0) { + if (s_transporter.delButton.curvalue <= 16) + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, s_transporter.delButton.curvalue)); else { - switch(s_transporter.delButton.curvalue) { - case 17: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 20)); - break; - case 18: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 30)); - break; - case 19: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterLoc %i %i %i", s_transporter.targetEntID, s_transporter.locButton.curvalue + 1, 60)); - break; + switch (s_transporter.delButton.curvalue) { + case 17: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 20)); + break; + case 18: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 30)); + break; + case 19: + trap_Cmd_ExecuteText(EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 60)); + break; } } UI_ForceMenuOff(); } - break; - case ID_ENGAGE2: // Active only if a deck has been chosen - if ( notification == QM_ACTIVATED ) { - if(srvCount > 0) { - if(s_transporter.delButton.curvalue <= 16) - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue , s_transporter.delButton.curvalue)); - else { - switch(s_transporter.delButton.curvalue) { - case 17: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 20)); - break; - case 18: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 30)); - break; - case 19: - trap_Cmd_ExecuteText( EXEC_APPEND, va("ui_transporterExt %i %i %i", s_transporter.targetEntID, s_transporter.srvButton.curvalue, 60)); - break; - } - } - UI_ForceMenuOff(); - } - } - break; + } + break; } UI_LogFuncEnd(); } @@ -144,9 +145,9 @@ static void M_Transporter_Event (void* ptr, int32_t notification) TransporterMenu_Key ================= */ -sfxHandle_t TransporterMenu_Key (int32_t key) +sfxHandle_t TransporterMenu_Key(int32_t key) { - return ( Menu_DefaultKey( &s_transporter.menu, key ) ); + return (Menu_DefaultKey(&s_transporter.menu, key)); } extern qhandle_t leftRound; @@ -164,11 +165,11 @@ qhandle_t loading5; M_TransporterMenu_Graphics ================= */ -static void M_TransporterMenu_Graphics (void) +static void M_TransporterMenu_Graphics(void) { //menubitmap_s *holdDeck; //int32_t i; - int32_t length,xTurboStart; + int32_t length, xTurboStart; //int32_t numColor, roundColor; UI_LogFuncBegin(); @@ -176,82 +177,82 @@ static void M_TransporterMenu_Graphics (void) // Draw the basic screen frame // Upper corners - trap_R_SetColor( colorTable[CT_DKPURPLE1]); - UI_DrawHandlePic( 20, 24, 64, 32, corner_ul_24_60); // Upper corner - trap_R_SetColor( colorTable[CT_LTPURPLE1] ); //colorTable[CT_LTBLUE1] //[CT_DKGOLD1] //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 70, 56, 128, 128, transporter_sym); // Transporter graphic + trap_R_SetColor(colorTable[CT_DKPURPLE1]); + UI_DrawHandlePic(20, 24, 64, 32, corner_ul_24_60); // Upper corner + trap_R_SetColor(colorTable[CT_LTPURPLE1]); //colorTable[CT_LTBLUE1] //[CT_DKGOLD1] //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(70, 56, 128, 128, transporter_sym); // Transporter graphic // Lower corners - trap_R_SetColor( colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 20, 440, 64, 16, corner_ll_12_60); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(20, 440, 64, 16, corner_ll_12_60); // xTurboStart = 604; - length = UI_ProportionalStringWidth( menu_normal_text[MNT_TRANSPORTER],UI_BIGFONT); + length = UI_ProportionalStringWidth(menu_normal_text[MNT_TRANSPORTER], UI_BIGFONT); length += 4; // Upper half - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 79, 24, xTurboStart - (79 + length), PROP_BIG_HEIGHT, uis.whiteShader); // Top left line - UI_DrawHandlePic( 20, 60, 60, 40, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE3]); - UI_DrawHandlePic( 20, 106, 60, 11, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 20, 123, 60, 250, uis.whiteShader); // Left hand column + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(79, 24, xTurboStart - (79 + length), PROP_BIG_HEIGHT, uis.whiteShader); // Top left line + UI_DrawHandlePic(20, 60, 60, 40, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); + UI_DrawHandlePic(20, 106, 60, 11, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(20, 123, 60, 250, uis.whiteShader); // Left hand column // Lower half - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 20, 380, 60, 70, uis.whiteShader); // Left Column + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(20, 380, 60, 70, uis.whiteShader); // Left Column // Bottom line - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 69, 443, 287, 12, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] - UI_DrawHandlePic(364, 443, 260, 12, uis.whiteShader); // Bottom line + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(69, 443, 287, 12, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] + UI_DrawHandlePic(364, 443, 260, 12, uis.whiteShader); // Bottom line - UI_DrawProportionalString( xTurboStart, 24, - menu_normal_text[MNT_TRANSPORTER], UI_BIGFONT | UI_RIGHT, colorTable[CT_WHITE]); + UI_DrawProportionalString(xTurboStart, 24, + menu_normal_text[MNT_TRANSPORTER], UI_BIGFONT | UI_RIGHT, colorTable[CT_WHITE]); - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 607, 24,-16, 32, leftRound); + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(607, 24, -16, 32, leftRound); - trap_R_SetColor( colorTable[CT_LTGOLD1] ); - UI_DrawHandlePic( 86, 240, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 86, 290, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 86, 340, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 86, 390, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 164, 240, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 164, 290, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 164, 340, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 164, 390, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 242, 240, 74, 46, uis.whiteShader); - UI_DrawHandlePic( 242, 290, 76, 46, uis.whiteShader); - UI_DrawHandlePic( 242, 340, 76, 46, uis.whiteShader); - UI_DrawHandlePic( 242, 390, 76, 46, uis.whiteShader); + trap_R_SetColor(colorTable[CT_LTGOLD1]); + UI_DrawHandlePic(86, 240, 74, 46, uis.whiteShader); + UI_DrawHandlePic(86, 290, 74, 46, uis.whiteShader); + UI_DrawHandlePic(86, 340, 74, 46, uis.whiteShader); + UI_DrawHandlePic(86, 390, 74, 46, uis.whiteShader); + UI_DrawHandlePic(164, 240, 74, 46, uis.whiteShader); + UI_DrawHandlePic(164, 290, 74, 46, uis.whiteShader); + UI_DrawHandlePic(164, 340, 74, 46, uis.whiteShader); + UI_DrawHandlePic(164, 390, 74, 46, uis.whiteShader); + UI_DrawHandlePic(242, 240, 74, 46, uis.whiteShader); + UI_DrawHandlePic(242, 290, 76, 46, uis.whiteShader); + UI_DrawHandlePic(242, 340, 76, 46, uis.whiteShader); + UI_DrawHandlePic(242, 390, 76, 46, uis.whiteShader); - trap_R_SetColor( colorTable[CT_LTPURPLE1] ); - UI_DrawHandlePic( 84, 192, 2, 243, uis.whiteShader); - UI_DrawHandlePic( 158, 192, 2, 243, uis.whiteShader); - UI_DrawHandlePic( 162, 192, 2, 243, uis.whiteShader); - UI_DrawHandlePic( 236, 192, 2, 243, uis.whiteShader); - UI_DrawHandlePic( 240, 192, 2, 243, uis.whiteShader); - UI_DrawHandlePic( 316, 192, -2, 243, uis.whiteShader); - UI_DrawHandlePic( 84, 192, 74, 2, uis.whiteShader); - UI_DrawHandlePic( 162, 192, 74, 2, uis.whiteShader); - UI_DrawHandlePic( 240, 192, 76, 2, uis.whiteShader); - UI_DrawHandlePic( 84, 435, 76, -2, uis.whiteShader); - UI_DrawHandlePic( 162, 435, 76, -2, uis.whiteShader); - UI_DrawHandlePic( 240, 435, 78, -2, uis.whiteShader); + trap_R_SetColor(colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(84, 192, 2, 243, uis.whiteShader); + UI_DrawHandlePic(158, 192, 2, 243, uis.whiteShader); + UI_DrawHandlePic(162, 192, 2, 243, uis.whiteShader); + UI_DrawHandlePic(236, 192, 2, 243, uis.whiteShader); + UI_DrawHandlePic(240, 192, 2, 243, uis.whiteShader); + UI_DrawHandlePic(316, 192, -2, 243, uis.whiteShader); + UI_DrawHandlePic(84, 192, 74, 2, uis.whiteShader); + UI_DrawHandlePic(162, 192, 74, 2, uis.whiteShader); + UI_DrawHandlePic(240, 192, 76, 2, uis.whiteShader); + UI_DrawHandlePic(84, 435, 76, -2, uis.whiteShader); + UI_DrawHandlePic(162, 435, 76, -2, uis.whiteShader); + UI_DrawHandlePic(240, 435, 78, -2, uis.whiteShader); - trap_R_SetColor( colorTable[CT_LTBLUE1] ); - UI_DrawHandlePic( 366, 208, 243, 212, loading2 ); - trap_R_SetColor( colorTable[CT_LTGOLD1] ); - UI_DrawHandlePic( 366, 208, 243, 212, loading3 ); - UI_DrawHandlePic( 366, 208, 243, 212, loading1 ); - trap_R_SetColor( colorTable[CT_DKBLUE1] ); - UI_DrawHandlePic( 366, 208, 243, 212, loading4 ); - trap_R_SetColor( colorTable[CT_DKORANGE] ); - UI_DrawHandlePic( 366, 208, 243, 212, loading5 ); + trap_R_SetColor(colorTable[CT_LTBLUE1]); + UI_DrawHandlePic(366, 208, 243, 212, loading2); + trap_R_SetColor(colorTable[CT_LTGOLD1]); + UI_DrawHandlePic(366, 208, 243, 212, loading3); + UI_DrawHandlePic(366, 208, 243, 212, loading1); + trap_R_SetColor(colorTable[CT_DKBLUE1]); + UI_DrawHandlePic(366, 208, 243, 212, loading4); + trap_R_SetColor(colorTable[CT_DKORANGE]); + UI_DrawHandlePic(366, 208, 243, 212, loading5); UI_DrawProportionalString(487, 297, "1", UI_TINYFONT, colorTable[CT_BLACK]); UI_DrawProportionalString(508, 297, "2", UI_TINYFONT, colorTable[CT_BLACK]); @@ -279,8 +280,8 @@ static void TransporterMenu_Draw(void) // Draw graphics particular to Main Menu M_TransporterMenu_Graphics(); - - Menu_Draw( &s_transporter.menu ); + + Menu_Draw(&s_transporter.menu); UI_LogFuncEnd(); } @@ -289,8 +290,8 @@ static void TransporterMenu_Draw(void) UI_TransporterMenu_Cache =============== */ -void UI_TransporterMenu_Cache (void) -{ +void UI_TransporterMenu_Cache(void) +{ UI_LogFuncBegin(); leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga"); corner_ul_24_60 = trap_R_RegisterShaderNoMip("menu/common/corner_ul_24_60.tga"); @@ -311,7 +312,7 @@ TransporterMenu_Init */ void TransporterMenu_Init(void) { - int32_t y,pad,x; + int32_t y, pad, x; //int32_t i; int32_t width; @@ -319,136 +320,136 @@ void TransporterMenu_Init(void) AdminGeneric_InitLists(); - s_transporter.menu.nitems = 0; - s_transporter.menu.draw = TransporterMenu_Draw; - s_transporter.menu.key = TransporterMenu_Key; - s_transporter.menu.wrapAround = qtrue; - s_transporter.menu.descX = MENU_DESC_X; - s_transporter.menu.descY = MENU_DESC_Y; - s_transporter.menu.titleX = MENU_TITLE_X; - s_transporter.menu.titleY = MENU_TITLE_Y; + s_transporter.menu.nitems = 0; + s_transporter.menu.draw = TransporterMenu_Draw; + s_transporter.menu.key = TransporterMenu_Key; + s_transporter.menu.wrapAround = qtrue; + s_transporter.menu.descX = MENU_DESC_X; + s_transporter.menu.descY = MENU_DESC_Y; + s_transporter.menu.titleX = MENU_TITLE_X; + s_transporter.menu.titleY = MENU_TITLE_Y; pad = PROP_BIG_HEIGHT + 10; - width = MENU_BUTTON_MED_WIDTH-20; + width = MENU_BUTTON_MED_WIDTH - 20; y = 72; x = 208; - s_transporter.engage.generic.type = MTYPE_BITMAP; - s_transporter.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_transporter.engage.generic.x = x; - s_transporter.engage.generic.y = y; - s_transporter.engage.generic.name = GRAPHIC_BUTTONLEFT; - s_transporter.engage.generic.id = ID_ENGAGE; - s_transporter.engage.generic.callback = M_Transporter_Event; - s_transporter.engage.width = width; - s_transporter.engage.height = PROP_BIG_HEIGHT; - s_transporter.engage.color = CT_DKPURPLE1; - s_transporter.engage.color2 = CT_LTPURPLE1; - s_transporter.engage.textX = MENU_BUTTON_TEXT_X; - s_transporter.engage.textY = 12; - s_transporter.engage.textEnum = MBT_ENGAGE; - s_transporter.engage.textcolor = CT_BLACK; - s_transporter.engage.textcolor2 = CT_WHITE; - s_transporter.engage.textStyle = UI_TINYFONT; + s_transporter.engage.generic.type = MTYPE_BITMAP; + s_transporter.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_transporter.engage.generic.x = x; + s_transporter.engage.generic.y = y; + s_transporter.engage.generic.name = GRAPHIC_BUTTONLEFT; + s_transporter.engage.generic.id = ID_ENGAGE; + s_transporter.engage.generic.callback = M_Transporter_Event; + s_transporter.engage.width = width; + s_transporter.engage.height = PROP_BIG_HEIGHT; + s_transporter.engage.color = CT_DKPURPLE1; + s_transporter.engage.color2 = CT_LTPURPLE1; + s_transporter.engage.textX = MENU_BUTTON_TEXT_X; + s_transporter.engage.textY = 12; + s_transporter.engage.textEnum = MBT_ENGAGE; + s_transporter.engage.textcolor = CT_BLACK; + s_transporter.engage.textcolor2 = CT_WHITE; + s_transporter.engage.textStyle = UI_TINYFONT; y += pad; - s_transporter.engage2.generic.type = MTYPE_BITMAP; - s_transporter.engage2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_transporter.engage2.generic.x = x; - s_transporter.engage2.generic.y = y; - s_transporter.engage2.generic.name = GRAPHIC_BUTTONLEFT; - s_transporter.engage2.generic.id = ID_ENGAGE2; - s_transporter.engage2.generic.callback = M_Transporter_Event; - s_transporter.engage2.width = width; - s_transporter.engage2.height = PROP_BIG_HEIGHT; - s_transporter.engage2.color = CT_DKPURPLE1; - s_transporter.engage2.color2 = CT_LTPURPLE1; - s_transporter.engage2.textX = MENU_BUTTON_TEXT_X; - s_transporter.engage2.textY = 12; - s_transporter.engage2.textEnum = MBT_ENGAGE; - s_transporter.engage2.textcolor = CT_BLACK; - s_transporter.engage2.textcolor2 = CT_WHITE; - s_transporter.engage2.textStyle = UI_TINYFONT; + s_transporter.engage2.generic.type = MTYPE_BITMAP; + s_transporter.engage2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_transporter.engage2.generic.x = x; + s_transporter.engage2.generic.y = y; + s_transporter.engage2.generic.name = GRAPHIC_BUTTONLEFT; + s_transporter.engage2.generic.id = ID_ENGAGE2; + s_transporter.engage2.generic.callback = M_Transporter_Event; + s_transporter.engage2.width = width; + s_transporter.engage2.height = PROP_BIG_HEIGHT; + s_transporter.engage2.color = CT_DKPURPLE1; + s_transporter.engage2.color2 = CT_LTPURPLE1; + s_transporter.engage2.textX = MENU_BUTTON_TEXT_X; + s_transporter.engage2.textY = 12; + s_transporter.engage2.textEnum = MBT_ENGAGE; + s_transporter.engage2.textcolor = CT_BLACK; + s_transporter.engage2.textcolor2 = CT_WHITE; + s_transporter.engage2.textStyle = UI_TINYFONT; y += pad; - s_transporter.quitmenu.generic.type = MTYPE_BITMAP; - s_transporter.quitmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_transporter.quitmenu.generic.x = x; - s_transporter.quitmenu.generic.y = y; - s_transporter.quitmenu.generic.name = GRAPHIC_BUTTONLEFT; - s_transporter.quitmenu.generic.id = ID_QUIT; - s_transporter.quitmenu.generic.callback = M_Transporter_Event; - s_transporter.quitmenu.width = width; - s_transporter.quitmenu.height = PROP_BIG_HEIGHT; - s_transporter.quitmenu.color = CT_DKPURPLE1; - s_transporter.quitmenu.color2 = CT_LTPURPLE1; - s_transporter.quitmenu.textX = MENU_BUTTON_TEXT_X; - s_transporter.quitmenu.textY = 12; - s_transporter.quitmenu.textEnum = MBT_RETURNMENU; - s_transporter.quitmenu.textcolor = CT_BLACK; - s_transporter.quitmenu.textcolor2 = CT_WHITE; - s_transporter.quitmenu.textStyle = UI_TINYFONT; + s_transporter.quitmenu.generic.type = MTYPE_BITMAP; + s_transporter.quitmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_transporter.quitmenu.generic.x = x; + s_transporter.quitmenu.generic.y = y; + s_transporter.quitmenu.generic.name = GRAPHIC_BUTTONLEFT; + s_transporter.quitmenu.generic.id = ID_QUIT; + s_transporter.quitmenu.generic.callback = M_Transporter_Event; + s_transporter.quitmenu.width = width; + s_transporter.quitmenu.height = PROP_BIG_HEIGHT; + s_transporter.quitmenu.color = CT_DKPURPLE1; + s_transporter.quitmenu.color2 = CT_LTPURPLE1; + s_transporter.quitmenu.textX = MENU_BUTTON_TEXT_X; + s_transporter.quitmenu.textY = 12; + s_transporter.quitmenu.textEnum = MBT_RETURNMENU; + s_transporter.quitmenu.textcolor = CT_BLACK; + s_transporter.quitmenu.textcolor2 = CT_WHITE; + s_transporter.quitmenu.textStyle = UI_TINYFONT; - y -= (2*pad); + y -= (2 * pad); x += width + 8; - s_transporter.locButton.generic.type = MTYPE_SPINCONTROL; - s_transporter.locButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; - s_transporter.locButton.generic.x = x; - s_transporter.locButton.generic.y = y; - s_transporter.locButton.width = width; - s_transporter.locButton.height = PROP_BIG_HEIGHT; - s_transporter.locButton.itemnames = (const char**)s_adminGeneric.locListPtr; - s_transporter.locButton.color = CT_DKPURPLE1; - s_transporter.locButton.color2 = CT_LTPURPLE1; - s_transporter.locButton.textX = MENU_BUTTON_TEXT_X; - s_transporter.locButton.textY = 12; - s_transporter.locButton.textEnum = MBT_ADMIN_BEAMLOC; - s_transporter.locButton.textcolor = CT_BLACK; - s_transporter.locButton.textcolor2 = CT_WHITE; + s_transporter.locButton.generic.type = MTYPE_SPINCONTROL; + s_transporter.locButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; + s_transporter.locButton.generic.x = x; + s_transporter.locButton.generic.y = y; + s_transporter.locButton.width = width; + s_transporter.locButton.height = PROP_BIG_HEIGHT; + s_transporter.locButton.itemnames = (const char**)s_adminGeneric.locListPtr; + s_transporter.locButton.color = CT_DKPURPLE1; + s_transporter.locButton.color2 = CT_LTPURPLE1; + s_transporter.locButton.textX = MENU_BUTTON_TEXT_X; + s_transporter.locButton.textY = 12; + s_transporter.locButton.textEnum = MBT_ADMIN_BEAMLOC; + s_transporter.locButton.textcolor = CT_BLACK; + s_transporter.locButton.textcolor2 = CT_WHITE; y += pad; - s_transporter.srvButton.generic.type = MTYPE_SPINCONTROL; - s_transporter.srvButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; - s_transporter.srvButton.generic.x = x; - s_transporter.srvButton.generic.y = y; - s_transporter.srvButton.width = width; - s_transporter.srvButton.height = PROP_BIG_HEIGHT; - s_transporter.srvButton.itemnames = (const char**)s_transporter.srvListPtr; - s_transporter.srvButton.color = CT_DKPURPLE1; - s_transporter.srvButton.color2 = CT_LTPURPLE1; - s_transporter.srvButton.textX = MENU_BUTTON_TEXT_X; - s_transporter.srvButton.textY = 12; - s_transporter.srvButton.textEnum = MBT_TRANS_EXTERN; - s_transporter.srvButton.textcolor = CT_BLACK; - s_transporter.srvButton.textcolor2 = CT_WHITE; + s_transporter.srvButton.generic.type = MTYPE_SPINCONTROL; + s_transporter.srvButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; + s_transporter.srvButton.generic.x = x; + s_transporter.srvButton.generic.y = y; + s_transporter.srvButton.width = width; + s_transporter.srvButton.height = PROP_BIG_HEIGHT; + s_transporter.srvButton.itemnames = (const char**)s_transporter.srvListPtr; + s_transporter.srvButton.color = CT_DKPURPLE1; + s_transporter.srvButton.color2 = CT_LTPURPLE1; + s_transporter.srvButton.textX = MENU_BUTTON_TEXT_X; + s_transporter.srvButton.textY = 12; + s_transporter.srvButton.textEnum = MBT_TRANS_EXTERN; + s_transporter.srvButton.textcolor = CT_BLACK; + s_transporter.srvButton.textcolor2 = CT_WHITE; y += pad; - s_transporter.delButton.generic.type = MTYPE_SPINCONTROL; - s_transporter.delButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; - s_transporter.delButton.generic.x = x; - s_transporter.delButton.generic.y = y; - s_transporter.delButton.width = width; - s_transporter.delButton.height = PROP_BIG_HEIGHT; - s_transporter.delButton.itemnames = (const char**)delayList; - s_transporter.delButton.color = CT_DKPURPLE1; - s_transporter.delButton.color2 = CT_LTPURPLE1; - s_transporter.delButton.textX = MENU_BUTTON_TEXT_X; - s_transporter.delButton.textY = 12; - s_transporter.delButton.textEnum = MBT_TRANS_DELAY; - s_transporter.delButton.textcolor = CT_BLACK; - s_transporter.delButton.textcolor2 = CT_WHITE; + s_transporter.delButton.generic.type = MTYPE_SPINCONTROL; + s_transporter.delButton.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_ALTERNATE; + s_transporter.delButton.generic.x = x; + s_transporter.delButton.generic.y = y; + s_transporter.delButton.width = width; + s_transporter.delButton.height = PROP_BIG_HEIGHT; + s_transporter.delButton.itemnames = (const char**)delayList; + s_transporter.delButton.color = CT_DKPURPLE1; + s_transporter.delButton.color2 = CT_LTPURPLE1; + s_transporter.delButton.textX = MENU_BUTTON_TEXT_X; + s_transporter.delButton.textY = 12; + s_transporter.delButton.textEnum = MBT_TRANS_DELAY; + s_transporter.delButton.textcolor = CT_BLACK; + s_transporter.delButton.textcolor2 = CT_WHITE; - Menu_AddItem( &s_transporter.menu, &s_transporter.delButton ); - Menu_AddItem( &s_transporter.menu, &s_transporter.srvButton ); - Menu_AddItem( &s_transporter.menu, &s_transporter.locButton ); - Menu_AddItem( &s_transporter.menu, &s_transporter.engage ); - Menu_AddItem( &s_transporter.menu, &s_transporter.engage2 ); - Menu_AddItem( &s_transporter.menu, &s_transporter.quitmenu ); + Menu_AddItem(&s_transporter.menu, &s_transporter.delButton); + Menu_AddItem(&s_transporter.menu, &s_transporter.srvButton); + Menu_AddItem(&s_transporter.menu, &s_transporter.locButton); + Menu_AddItem(&s_transporter.menu, &s_transporter.engage); + Menu_AddItem(&s_transporter.menu, &s_transporter.engage2); + Menu_AddItem(&s_transporter.menu, &s_transporter.quitmenu); UI_LogFuncEnd(); } @@ -461,11 +462,11 @@ void SrvData_Init(void) { int32_t i; UI_LogFuncBegin(); - for(i = 0; i < 6; i++) { - if(!srvList[i][0]) break; + for (i = 0; i < 6; i++) { + if (!srvList[i][0]) break; s_transporter.srvListPtr[i] = srvList[i]; } - s_transporter.srvListPtr[i+1] = 0; + s_transporter.srvListPtr[i + 1] = 0; UI_LogFuncEnd(); } @@ -474,16 +475,16 @@ void SrvData_Init(void) { UI_TransporterMenu =============== */ -void UI_TransporterMenu (int32_t trNum) +void UI_TransporterMenu(int32_t trNum) { UI_LogFuncBegin(); - if ( !trNum ){ + if (!trNum){ UI_LogFuncEnd(); return; } - memset( &s_transporter, 0, sizeof( s_transporter ) ); + memset(&s_transporter, 0, sizeof(s_transporter)); s_transporter.targetEntID = trNum; @@ -497,11 +498,11 @@ void UI_TransporterMenu (int32_t trNum) SrvData_Init(); - TransporterMenu_Init(); + TransporterMenu_Init(); - UI_PushMenu( &s_transporter.menu ); + UI_PushMenu(&s_transporter.menu); - Menu_AdjustCursor( &s_transporter.menu, 1 ); + Menu_AdjustCursor(&s_transporter.menu, 1); UI_LogFuncEnd(); } diff --git a/code/ui/ui_turbolift.c b/code/ui/ui_turbolift.c index e1650a9..ef98cf7 100644 --- a/code/ui/ui_turbolift.c +++ b/code/ui/ui_turbolift.c @@ -2,86 +2,88 @@ UI_TURBOLIFT.C User interface trigger from within game -**********************************************************************/ + **********************************************************************/ #include "ui_local.h" #include "ui_logger.h" typedef struct { - int32_t deckNum; - char deckDesc[MAX_QPATH]; + int32_t deckNum; + char deckDesc[MAX_QPATH]; } deckData_t; // Data for Closing Credits Menu typedef struct //static { menuframework_s menu; - int32_t maxDecks; - int32_t chosenDeck; - int32_t highLightedDeck; - sfxHandle_t openingVoice; - menubitmap_s quitmenu; - menubitmap_s engage; - menubitmap_s deck1; - menubitmap_s deck2; - menubitmap_s deck3; - menubitmap_s deck4; - menubitmap_s deck5; - menubitmap_s deck6; - menubitmap_s deck7; - menubitmap_s deck8; - menubitmap_s deck9; - menubitmap_s deck10; - menubitmap_s deck11; - menubitmap_s deck12; - menubitmap_s deck13; - menubitmap_s deck14; - menubitmap_s deck15; - menubitmap_s deck16; + int32_t maxDecks; + int32_t chosenDeck; + int32_t highLightedDeck; + sfxHandle_t openingVoice; + menubitmap_s quitmenu; + menubitmap_s engage; + menubitmap_s deck1; + menubitmap_s deck2; + menubitmap_s deck3; + menubitmap_s deck4; + menubitmap_s deck5; + menubitmap_s deck6; + menubitmap_s deck7; + menubitmap_s deck8; + menubitmap_s deck9; + menubitmap_s deck10; + menubitmap_s deck11; + menubitmap_s deck12; + menubitmap_s deck13; + menubitmap_s deck14; + menubitmap_s deck15; + menubitmap_s deck16; - deckData_t deckData[MAX_DECKS]; - int32_t numDecks; + deckData_t deckData[MAX_DECKS]; + int32_t numDecks; - int32_t liftNum; + int32_t liftNum; } turbolift_t; turbolift_t s_turbolift; -void TurboliftMenu_LoadText (void); +void TurboliftMenu_LoadText(void); -#define ID_ARROW1UP 2 -#define ID_ARROW1DOWN 3 -#define ID_ARROW2UP 4 -#define ID_ARROW2DOWN 5 -#define ID_COMPUTERVOICE 6 +enum ui_turboliftIDs_e { + ID_ARROW1UP = 2, + ID_ARROW1DOWN, + ID_ARROW2UP, + ID_ARROW2DOWN, + ID_COMPUTERVOICE, -#define ID_QUIT 10 -#define ID_DECK1 11 -#define ID_DECK2 12 -#define ID_DECK3 13 -#define ID_DECK4 14 -#define ID_DECK5 15 -#define ID_DECK6 16 -#define ID_DECK7 17 -#define ID_DECK8 18 -#define ID_DECK9 19 -#define ID_DECK10 20 -#define ID_DECK11 21 -#define ID_DECK12 22 -#define ID_DECK13 23 -#define ID_DECK14 24 -#define ID_DECK15 25 -#define ID_DECK16 26 -#define ID_ENGAGE 100 + ID_QUIT = 10, + ID_DECK1, + ID_DECK2, + ID_DECK3, + ID_DECK4, + ID_DECK5, + ID_DECK6, + ID_DECK7, + ID_DECK8, + ID_DECK9, + ID_DECK10, + ID_DECK11, + ID_DECK12, + ID_DECK13, + ID_DECK14, + ID_DECK15, + ID_DECK16, + ID_ENGAGE = 100 +}; -void UI_HolodeckMenu_Cache (void); +void UI_HolodeckMenu_Cache(void); /* ================= M_Turbolift_Event ================= */ -static void M_Turbolift_Event (void* ptr, int32_t notification) +static void M_Turbolift_Event(void* ptr, int32_t notification) { int32_t id; menubitmap_s *holdDeck; @@ -92,59 +94,59 @@ static void M_Turbolift_Event (void* ptr, int32_t notification) /*if ( notification != QM_ACTIVATED ) { - return; + return; }*/ switch (id) { - case ID_QUIT: - if ( notification == QM_ACTIVATED ) - UI_PopMenu(); - break; - case ID_DECK1: - case ID_DECK2: - case ID_DECK3: - case ID_DECK4: - case ID_DECK5: - case ID_DECK6: - case ID_DECK7: - case ID_DECK8: - case ID_DECK9: - case ID_DECK10: - case ID_DECK11: - case ID_DECK12: - case ID_DECK13: - case ID_DECK14: - case ID_DECK15: - case ID_DECK16: + case ID_QUIT: + if (notification == QM_ACTIVATED) + UI_PopMenu(); + break; + case ID_DECK1: + case ID_DECK2: + case ID_DECK3: + case ID_DECK4: + case ID_DECK5: + case ID_DECK6: + case ID_DECK7: + case ID_DECK8: + case ID_DECK9: + case ID_DECK10: + case ID_DECK11: + case ID_DECK12: + case ID_DECK13: + case ID_DECK14: + case ID_DECK15: + case ID_DECK16: - if ( notification == QM_ACTIVATED ) + if (notification == QM_ACTIVATED) + { + if (s_turbolift.chosenDeck >= 0) { - if (s_turbolift.chosenDeck >= 0) - { - holdDeck = &s_turbolift.deck1; - holdDeck += s_turbolift.chosenDeck; - holdDeck->textcolor = CT_BLACK; - } - - s_turbolift.chosenDeck = id - ID_DECK1; - s_turbolift.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - holdDeck = &s_turbolift.deck1; holdDeck += s_turbolift.chosenDeck; - //holdDeck->textcolor = CT_WHITE;//CT_LTGOLD1; + holdDeck->textcolor = CT_BLACK; } - else if ( notification == QM_GOTFOCUS ) - { - s_turbolift.highLightedDeck = id - ID_DECK1; - } - break; - case ID_ENGAGE: // Active only if a deck has been chosen - if ( notification == QM_ACTIVATED ) { - UI_ForceMenuOff(); - trap_Cmd_ExecuteText( EXEC_APPEND, va( "deck %i %i", s_turbolift.liftNum, s_turbolift.deckData[s_turbolift.chosenDeck].deckNum ) ); - } - break; + + s_turbolift.chosenDeck = id - ID_DECK1; + s_turbolift.engage.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + + holdDeck = &s_turbolift.deck1; + holdDeck += s_turbolift.chosenDeck; + //holdDeck->textcolor = CT_WHITE;//CT_LTGOLD1; + } + else if (notification == QM_GOTFOCUS) + { + s_turbolift.highLightedDeck = id - ID_DECK1; + } + break; + case ID_ENGAGE: // Active only if a deck has been chosen + if (notification == QM_ACTIVATED) { + UI_ForceMenuOff(); + trap_Cmd_ExecuteText(EXEC_APPEND, va("deck %i %i", s_turbolift.liftNum, s_turbolift.deckData[s_turbolift.chosenDeck].deckNum)); + } + break; } UI_LogFuncEnd(); } @@ -154,9 +156,9 @@ static void M_Turbolift_Event (void* ptr, int32_t notification) TurboliftMenu_Key ================= */ -sfxHandle_t TurboliftMenu_Key (int32_t key) +sfxHandle_t TurboliftMenu_Key(int32_t key) { - return ( Menu_DefaultKey( &s_turbolift.menu, key ) ); + return (Menu_DefaultKey(&s_turbolift.menu, key)); } qhandle_t leftRound; @@ -169,87 +171,87 @@ qhandle_t turbolift; M_TurboliftMenu_Graphics ================= */ -static void M_TurboliftMenu_Graphics (void) +static void M_TurboliftMenu_Graphics(void) { menubitmap_s *holdDeck; - int32_t i,length,xTurboStart; - int32_t numColor,roundColor; + int32_t i, length, xTurboStart; + int32_t numColor, roundColor; UI_LogFuncBegin(); // Draw the basic screen frame // Upper corners - trap_R_SetColor( colorTable[CT_DKPURPLE1]); - UI_DrawHandlePic( 20, 24, 64, 32, corner_ul_24_60); // Upper corner - UI_DrawHandlePic( 20, 353, 64, 16, corner_ll_12_60); // Lower Corner - trap_R_SetColor( colorTable[CT_LTPURPLE1] ); //colorTable[CT_LTBLUE1] //[CT_DKGOLD1] //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 100, 86, 128, 128, turbolift); // Turbolift graphic + trap_R_SetColor(colorTable[CT_DKPURPLE1]); + UI_DrawHandlePic(20, 24, 64, 32, corner_ul_24_60); // Upper corner + UI_DrawHandlePic(20, 353, 64, 16, corner_ll_12_60); // Lower Corner + trap_R_SetColor(colorTable[CT_LTPURPLE1]); //colorTable[CT_LTBLUE1] //[CT_DKGOLD1] //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(100, 86, 128, 128, turbolift); // Turbolift graphic // Lower corners - trap_R_SetColor( colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 20, 375, 64, -16, corner_ll_12_60); // - UI_DrawHandlePic( 20, 440, 64, 16, corner_ll_12_60); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(20, 375, 64, -16, corner_ll_12_60); // + UI_DrawHandlePic(20, 440, 64, 16, corner_ll_12_60); // xTurboStart = 604; - length = UI_ProportionalStringWidth( menu_normal_text[MNT_TURBOLIFT],UI_BIGFONT); + length = UI_ProportionalStringWidth(menu_normal_text[MNT_TURBOLIFT], UI_BIGFONT); length += 4; // Upper half - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 79, 24, xTurboStart - (79 + length), PROP_BIG_HEIGHT, uis.whiteShader); // Top left line - UI_DrawHandlePic( 20, 60, 60, 40, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE3]); - UI_DrawHandlePic( 20, 106, 60, 11, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 20, 123, 60, 240, uis.whiteShader); // Left hand column - UI_DrawHandlePic( 69, 356, 245, 12, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(79, 24, xTurboStart - (79 + length), PROP_BIG_HEIGHT, uis.whiteShader); // Top left line + UI_DrawHandlePic(20, 60, 60, 40, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); + UI_DrawHandlePic(20, 106, 60, 11, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(20, 123, 60, 240, uis.whiteShader); // Left hand column + UI_DrawHandlePic(69, 356, 245, 12, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_DKPURPLE1] - UI_DrawHandlePic(319, 356, 93, 5, uis.whiteShader); // - UI_DrawHandlePic(319, 360, 31, 8, uis.whiteShader); // - UI_DrawHandlePic(381, 360, 31, 8, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_DKPURPLE1] + UI_DrawHandlePic(319, 356, 93, 5, uis.whiteShader); // + UI_DrawHandlePic(319, 360, 31, 8, uis.whiteShader); // + UI_DrawHandlePic(381, 360, 31, 8, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE1]); - UI_DrawHandlePic(417, 356, 93, 12, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); + UI_DrawHandlePic(417, 356, 93, 12, uis.whiteShader); // - UI_DrawHandlePic(510, 356,114, 12, uis.whiteShader); // + UI_DrawHandlePic(510, 356, 114, 12, uis.whiteShader); // // Lower half - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 20, 380, 60, 70, uis.whiteShader); // Left Column + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(20, 380, 60, 70, uis.whiteShader); // Left Column - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 69, 376, 158, 12, uis.whiteShader); // Top line - UI_DrawHandlePic(232, 376, 82, 12, uis.whiteShader); // Top line - UI_DrawHandlePic(417, 376, 12, 12, uis.whiteShader); // - UI_DrawHandlePic(434, 376, 190, 12, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(69, 376, 158, 12, uis.whiteShader); // Top line + UI_DrawHandlePic(232, 376, 82, 12, uis.whiteShader); // Top line + UI_DrawHandlePic(417, 376, 12, 12, uis.whiteShader); // + UI_DrawHandlePic(434, 376, 190, 12, uis.whiteShader); // // Funky indent - trap_R_SetColor( colorTable[CT_DKPURPLE1] ); //colorTable[CT_DKGOLD1] - UI_DrawHandlePic(319, 383, 93, 5, uis.whiteShader); // - UI_DrawHandlePic(319, 376, 31, 8, uis.whiteShader); // - UI_DrawHandlePic(381, 376, 31, 8, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] + UI_DrawHandlePic(319, 383, 93, 5, uis.whiteShader); // + UI_DrawHandlePic(319, 376, 31, 8, uis.whiteShader); // + UI_DrawHandlePic(381, 376, 31, 8, uis.whiteShader); // // Bottom line - trap_R_SetColor( colorTable[CT_DKPURPLE3] ); //colorTable[CT_VDKPURPLE2] - UI_DrawHandlePic( 69, 443, 287, 12, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] - UI_DrawHandlePic(364, 443, 260, 12, uis.whiteShader); // Bottom line + trap_R_SetColor(colorTable[CT_DKPURPLE3]); //colorTable[CT_VDKPURPLE2] + UI_DrawHandlePic(69, 443, 287, 12, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //colorTable[CT_DKGOLD1] + UI_DrawHandlePic(364, 443, 260, 12, uis.whiteShader); // Bottom line - UI_DrawProportionalString( xTurboStart, 24, - menu_normal_text[MNT_TURBOLIFT], UI_BIGFONT | UI_RIGHT, colorTable[CT_WHITE]); + UI_DrawProportionalString(xTurboStart, 24, + menu_normal_text[MNT_TURBOLIFT], UI_BIGFONT | UI_RIGHT, colorTable[CT_WHITE]); + + trap_R_SetColor(colorTable[CT_DKPURPLE1]); //DKGOLD1 + UI_DrawHandlePic(607, 24, -16, 32, leftRound); - trap_R_SetColor( colorTable[CT_DKPURPLE1]); //DKGOLD1 - UI_DrawHandlePic( 607, 24,-16, 32, leftRound); - holdDeck = &s_turbolift.deck1; // Print deck buttons - for (i=0;igeneric.x - 6, - holdDeck->generic.y, - va("%d",s_turbolift.deckData[i].deckNum), UI_BIGFONT|UI_RIGHT, colorTable[numColor]); //i+1 + UI_DrawProportionalString(holdDeck->generic.x - 6, + holdDeck->generic.y, + va("%d", s_turbolift.deckData[i].deckNum), UI_BIGFONT | UI_RIGHT, colorTable[numColor]); //i+1 - trap_R_SetColor( colorTable[roundColor]); - UI_DrawHandlePic( holdDeck->generic.x - 45, - holdDeck->generic.y, - 16, 32, leftRound); + trap_R_SetColor(colorTable[roundColor]); + UI_DrawHandlePic(holdDeck->generic.x - 45, + holdDeck->generic.y, + 16, 32, leftRound); } holdDeck++; } - - if ( s_turbolift.highLightedDeck >= 0 ) + + if (s_turbolift.highLightedDeck >= 0) { - UI_DrawProportionalString( 353, 409, - s_turbolift.deckData[s_turbolift.highLightedDeck].deckDesc, UI_SMALLFONT|UI_CENTER, colorTable[CT_WHITE]); + UI_DrawProportionalString(353, 409, + s_turbolift.deckData[s_turbolift.highLightedDeck].deckDesc, UI_SMALLFONT | UI_CENTER, colorTable[CT_WHITE]); } else { - UI_DrawProportionalString( 353, 409, menu_normal_text[MNT_SPECFICYDECK], UI_SMALLFONT|UI_CENTER, colorTable[CT_WHITE]); + UI_DrawProportionalString(353, 409, menu_normal_text[MNT_SPECFICYDECK], UI_SMALLFONT | UI_CENTER, colorTable[CT_WHITE]); } // Round graphic on left of engage & quit button - trap_R_SetColor( colorTable[s_turbolift.quitmenu.color]); + trap_R_SetColor(colorTable[s_turbolift.quitmenu.color]); UI_DrawHandlePic(s_turbolift.engage.generic.x - 14, - s_turbolift.engage.generic.y, + s_turbolift.engage.generic.y, MENU_BUTTON_MED_HEIGHT, s_turbolift.engage.height, uis.graphicButtonLeftEnd); UI_DrawHandlePic(s_turbolift.quitmenu.generic.x - 14, - s_turbolift.quitmenu.generic.y, + s_turbolift.quitmenu.generic.y, MENU_BUTTON_MED_HEIGHT, s_turbolift.quitmenu.height, uis.graphicButtonLeftEnd); UI_LogFuncEnd(); @@ -311,8 +313,8 @@ static void TurboliftMenu_Draw(void) // Draw graphics particular to Main Menu M_TurboliftMenu_Graphics(); - - Menu_Draw( &s_turbolift.menu ); + + Menu_Draw(&s_turbolift.menu); UI_LogFuncEnd(); } @@ -322,8 +324,8 @@ static void TurboliftMenu_Draw(void) UI_TurboliftMenu_Cache =============== */ -void UI_TurboliftMenu_Cache (void) -{ +void UI_TurboliftMenu_Cache(void) +{ UI_LogFuncBegin(); leftRound = trap_R_RegisterShaderNoMip("menu/common/halfroundl_24.tga"); @@ -336,37 +338,37 @@ void UI_TurboliftMenu_Cache (void) //Sorts decks in ascending order -static int32_t QDECL SortDecks( const void *arg1, const void *arg2 ) +static int32_t QDECL SortDecks(const void *arg1, const void *arg2) { int32_t deck1; int32_t deck2; UI_LogFuncBegin(); - deck1 = ( (deckData_t *)arg1)->deckNum; - deck2 = ( (deckData_t *)arg2)->deckNum; + deck1 = ((deckData_t *)arg1)->deckNum; + deck2 = ((deckData_t *)arg2)->deckNum; - if ( deck1 < 0 ) + if (deck1 < 0) deck1 = 0; - if ( deck2 < 0 ) + if (deck2 < 0) deck2 = 0; - if ( deck1 > deck2 ){ + if (deck1 > deck2){ UI_LogFuncEnd(); return 1; } - if ( deck1 == deck2 ){ + if (deck1 == deck2){ UI_LogFuncEnd(); return 0; } - + UI_LogFuncEnd(); return -1; } -static void UI_TurboliftMenu_LoadDecks( void ) +static void UI_TurboliftMenu_LoadDecks(void) { char buffer[MAX_TOKEN_CHARS]; int32_t i; @@ -377,37 +379,37 @@ static void UI_TurboliftMenu_LoadDecks( void ) UI_LogFuncBegin(); //load the string - trap_GetConfigString( CS_TURBOLIFT_DATA, buffer, sizeof( buffer ) ); + trap_GetConfigString(CS_TURBOLIFT_DATA, buffer, sizeof(buffer)); - if ( !buffer[0] ){ + if (!buffer[0]){ UI_LogFuncEnd(); return; } - memset( &s_turbolift.deckData, 0, sizeof( s_turbolift.deckData ) ); + memset(&s_turbolift.deckData, 0, sizeof(s_turbolift.deckData)); - for ( i=0; i < MAX_DECKS; i++ ) + for (i = 0; i < MAX_DECKS; i++) { - temp = Info_ValueForKey( buffer, va( "d%i", i ) ); + temp = Info_ValueForKey(buffer, va("d%i", i)); - if ( !temp[0] ) + if (!temp[0]) break; - s_turbolift.deckData[ s_turbolift.numDecks ].deckNum = atoi( temp ); + s_turbolift.deckData[s_turbolift.numDecks].deckNum = atoi(temp); - temp = Info_ValueForKey( buffer, va( "n%i", i ) ); + temp = Info_ValueForKey(buffer, va("n%i", i)); + + Q_strncpyz(s_turbolift.deckData[s_turbolift.numDecks].deckDesc, temp, sizeof(s_turbolift.deckData[s_turbolift.numDecks].deckDesc)); - Q_strncpyz( s_turbolift.deckData[ s_turbolift.numDecks ].deckDesc, temp, sizeof( s_turbolift.deckData[ s_turbolift.numDecks ].deckDesc ) ); - s_turbolift.numDecks++; } //TiM - sort the decks into their sequential order - qsort( s_turbolift.deckData, s_turbolift.numDecks, sizeof( deckData_t ), SortDecks ); + qsort(s_turbolift.deckData, s_turbolift.numDecks, sizeof(deckData_t), SortDecks); UI_LogFuncEnd(); } -static void UI_ManageDeckLoading( void ) +static void UI_ManageDeckLoading(void) { char fileRoute[MAX_QPATH]; char mapRoute[MAX_QPATH]; @@ -421,15 +423,15 @@ static void UI_ManageDeckLoading( void ) UI_LogFuncBegin(); //get the map name - trap_GetConfigString( CS_SERVERINFO, info, sizeof( info ) ); - Com_sprintf( mapRoute, sizeof( fileRoute ), "maps/%s", Info_ValueForKey( info, "mapname" ) ); + trap_GetConfigString(CS_SERVERINFO, info, sizeof(info)); + Com_sprintf(mapRoute, sizeof(fileRoute), "maps/%s", Info_ValueForKey(info, "mapname")); //check for language - UI_LanguageFilename( mapRoute, "turbolift", fileRoute ); + UI_LanguageFilename(mapRoute, "turbolift", fileRoute); - file_len = trap_FS_FOpenFile( fileRoute, &f, FS_READ ); + file_len = trap_FS_FOpenFile(fileRoute, &f, FS_READ); - if ( file_len <= 1 ) + if (file_len <= 1) { //UI_Logger( LL_WARN, "Attempted to load %s, but wasn't found.\n", fileRoute ); UI_TurboliftMenu_LoadDecks(); @@ -437,19 +439,19 @@ static void UI_ManageDeckLoading( void ) return; } - trap_FS_Read( buffer, file_len, f ); - trap_FS_FCloseFile( f ); + trap_FS_Read(buffer, file_len, f); + trap_FS_FCloseFile(f); - if ( !buffer[0] ) + if (!buffer[0]) { - UI_Logger( LL_ERROR, "Attempted to load %s, but no data was read.\n", fileRoute ); + UI_Logger(LL_ERROR, "Attempted to load %s, but no data was read.\n", fileRoute); UI_TurboliftMenu_LoadDecks(); UI_LogFuncEnd(); return; } s_turbolift.numDecks = 0; - memset( &s_turbolift.deckData, 0, sizeof( s_turbolift.deckData ) ); + memset(&s_turbolift.deckData, 0, sizeof(s_turbolift.deckData)); buffer[file_len] = '\0'; COM_BeginParseSession(); @@ -458,39 +460,39 @@ static void UI_ManageDeckLoading( void ) //UI_Logger( LL_DEBUG, "Beginning Parse\n" ); //expected format is 'decknum' 'deck Desc' - while( 1 ) + while (1) { - token = COM_Parse( &textPtr ); - if ( !token[0] ) + token = COM_Parse(&textPtr); + if (!token[0]) break; //UI_Logger( LL_DEBUG, "First Token: %s\n", token ); //in case of Scooter's EF SP style DAT files, which require 'DECK' in front of the number - if ( !Q_strncmp( token, "DECK", 4 ) ) + if (!Q_strncmp(token, "DECK", 4)) token += 4; //grab the deck number - s_turbolift.deckData[s_turbolift.numDecks].deckNum = atoi( token ); + s_turbolift.deckData[s_turbolift.numDecks].deckNum = atoi(token); - token = COM_ParseExt( &textPtr, qfalse ); + token = COM_ParseExt(&textPtr, qfalse); if (!token[0]) continue; //UI_Logger( LL_DEBUG, "Second Token: %s\n", token ); - Q_strncpyz( s_turbolift.deckData[s_turbolift.numDecks].deckDesc, - token, - sizeof( s_turbolift.deckData[s_turbolift.numDecks].deckDesc ) ); + Q_strncpyz(s_turbolift.deckData[s_turbolift.numDecks].deckDesc, + token, + sizeof(s_turbolift.deckData[s_turbolift.numDecks].deckDesc)); s_turbolift.numDecks++; //if this is an EF SP style script, there may be more data after these two. ignore them - if ( COM_ParseExt( &textPtr, qfalse ) == NULL ) - SkipRestOfLine( &textPtr ); + if (COM_ParseExt(&textPtr, qfalse) == NULL) + SkipRestOfLine(&textPtr); } - qsort( s_turbolift.deckData, s_turbolift.numDecks, sizeof( deckData_t ), SortDecks ); + qsort(s_turbolift.deckData, s_turbolift.numDecks, sizeof(deckData_t), SortDecks); UI_LogFuncEnd(); } @@ -501,110 +503,110 @@ TurboliftMenu_Init */ void TurboliftMenu_Init(void) { - int32_t y,pad,x; + int32_t y, pad, x; menubitmap_s *holdDeck; - int32_t i,width; + int32_t i, width; UI_LogFuncBegin(); UI_ManageDeckLoading(); - s_turbolift.menu.nitems = 0; - s_turbolift.menu.draw = TurboliftMenu_Draw; - s_turbolift.menu.key = TurboliftMenu_Key; - s_turbolift.menu.wrapAround = qtrue; - s_turbolift.menu.descX = MENU_DESC_X; - s_turbolift.menu.descY = MENU_DESC_Y; - s_turbolift.menu.titleX = MENU_TITLE_X; - s_turbolift.menu.titleY = MENU_TITLE_Y; + s_turbolift.menu.nitems = 0; + s_turbolift.menu.draw = TurboliftMenu_Draw; + s_turbolift.menu.key = TurboliftMenu_Key; + s_turbolift.menu.wrapAround = qtrue; + s_turbolift.menu.descX = MENU_DESC_X; + s_turbolift.menu.descY = MENU_DESC_Y; + s_turbolift.menu.titleX = MENU_TITLE_X; + s_turbolift.menu.titleY = MENU_TITLE_Y; s_turbolift.chosenDeck = -1; s_turbolift.highLightedDeck = -1; pad = PROP_BIG_HEIGHT + 10; - y = 72; + y = 72; x = 319; - width = MENU_BUTTON_MED_WIDTH-20; + width = MENU_BUTTON_MED_WIDTH - 20; s_turbolift.maxDecks = MAX_DECKS; holdDeck = &s_turbolift.deck1; - for (i=0;igeneric.type = MTYPE_BITMAP; - holdDeck->generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - holdDeck->generic.x = x; - holdDeck->generic.y = y; - holdDeck->generic.name = GRAPHIC_BUTTONRIGHT; - holdDeck->generic.id = ID_DECK1 + i; - holdDeck->generic.callback = M_Turbolift_Event; - holdDeck->width = width; - holdDeck->height = PROP_BIG_HEIGHT; - holdDeck->color = CT_DKPURPLE1;//CT_VDKRED1;//CT_DKGOLD1; - holdDeck->color2 = CT_LTPURPLE1;//CT_DKRED1;//CT_LTGOLD1; - holdDeck->textX = MENU_BUTTON_TEXT_X; - holdDeck->textY = 12; - holdDeck->textEnum = MBT_DECK; - holdDeck->textcolor = CT_BLACK; - holdDeck->textcolor2 = CT_WHITE; - holdDeck->textStyle = UI_TINYFONT; + holdDeck->generic.type = MTYPE_BITMAP; + holdDeck->generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + holdDeck->generic.x = x; + holdDeck->generic.y = y; + holdDeck->generic.name = GRAPHIC_BUTTONRIGHT; + holdDeck->generic.id = ID_DECK1 + i; + holdDeck->generic.callback = M_Turbolift_Event; + holdDeck->width = width; + holdDeck->height = PROP_BIG_HEIGHT; + holdDeck->color = CT_DKPURPLE1;//CT_VDKRED1;//CT_DKGOLD1; + holdDeck->color2 = CT_LTPURPLE1;//CT_DKRED1;//CT_LTGOLD1; + holdDeck->textX = MENU_BUTTON_TEXT_X; + holdDeck->textY = 12; + holdDeck->textEnum = MBT_DECK; + holdDeck->textcolor = CT_BLACK; + holdDeck->textcolor2 = CT_WHITE; + holdDeck->textStyle = UI_TINYFONT; holdDeck++; y += pad; // Start the next column - if (i == ((s_turbolift.maxDecks-1)/2)) + if (i == ((s_turbolift.maxDecks - 1) / 2)) { - x += width + 90; + x += width + 90; y = 80; } } - s_turbolift.engage.generic.type = MTYPE_BITMAP; - s_turbolift.engage.generic.flags = QMF_GRAYED; - s_turbolift.engage.generic.x = 110; - s_turbolift.engage.generic.y = 72 + (pad * 5); - s_turbolift.engage.generic.name = GRAPHIC_BUTTONRIGHT; - s_turbolift.engage.generic.id = ID_ENGAGE; - s_turbolift.engage.generic.callback = M_Turbolift_Event; - s_turbolift.engage.width = width; - s_turbolift.engage.height = PROP_BIG_HEIGHT; - s_turbolift.engage.color = CT_DKORANGE; - s_turbolift.engage.color2 = CT_LTORANGE; - s_turbolift.engage.textX = MENU_BUTTON_TEXT_X; - s_turbolift.engage.textY = 6; - s_turbolift.engage.textEnum = MBT_ENGAGE; - s_turbolift.engage.textcolor = CT_BLACK; - s_turbolift.engage.textcolor2 = CT_WHITE; + s_turbolift.engage.generic.type = MTYPE_BITMAP; + s_turbolift.engage.generic.flags = QMF_GRAYED; + s_turbolift.engage.generic.x = 110; + s_turbolift.engage.generic.y = 72 + (pad * 5); + s_turbolift.engage.generic.name = GRAPHIC_BUTTONRIGHT; + s_turbolift.engage.generic.id = ID_ENGAGE; + s_turbolift.engage.generic.callback = M_Turbolift_Event; + s_turbolift.engage.width = width; + s_turbolift.engage.height = PROP_BIG_HEIGHT; + s_turbolift.engage.color = CT_DKORANGE; + s_turbolift.engage.color2 = CT_LTORANGE; + s_turbolift.engage.textX = MENU_BUTTON_TEXT_X; + s_turbolift.engage.textY = 6; + s_turbolift.engage.textEnum = MBT_ENGAGE; + s_turbolift.engage.textcolor = CT_BLACK; + s_turbolift.engage.textcolor2 = CT_WHITE; //s_turbolift.engage.generic.statusbarfunc = Turbolift_StatusBar; - s_turbolift.quitmenu.generic.type = MTYPE_BITMAP; - s_turbolift.quitmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_turbolift.quitmenu.generic.x = 110; - s_turbolift.quitmenu.generic.y = 72 + (pad * 7); - s_turbolift.quitmenu.generic.name = GRAPHIC_BUTTONRIGHT; - s_turbolift.quitmenu.generic.id = ID_QUIT; - s_turbolift.quitmenu.generic.callback = M_Turbolift_Event; - s_turbolift.quitmenu.width = width; - s_turbolift.quitmenu.height = PROP_BIG_HEIGHT; - s_turbolift.quitmenu.color = CT_DKORANGE; - s_turbolift.quitmenu.color2 = CT_LTORANGE; - s_turbolift.quitmenu.textX = MENU_BUTTON_TEXT_X; - s_turbolift.quitmenu.textY = 6; - s_turbolift.quitmenu.textEnum = MBT_RETURNMENU;//MBT_RETURN; - s_turbolift.quitmenu.textcolor = CT_BLACK; - s_turbolift.quitmenu.textcolor2 = CT_WHITE; + s_turbolift.quitmenu.generic.type = MTYPE_BITMAP; + s_turbolift.quitmenu.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_turbolift.quitmenu.generic.x = 110; + s_turbolift.quitmenu.generic.y = 72 + (pad * 7); + s_turbolift.quitmenu.generic.name = GRAPHIC_BUTTONRIGHT; + s_turbolift.quitmenu.generic.id = ID_QUIT; + s_turbolift.quitmenu.generic.callback = M_Turbolift_Event; + s_turbolift.quitmenu.width = width; + s_turbolift.quitmenu.height = PROP_BIG_HEIGHT; + s_turbolift.quitmenu.color = CT_DKORANGE; + s_turbolift.quitmenu.color2 = CT_LTORANGE; + s_turbolift.quitmenu.textX = MENU_BUTTON_TEXT_X; + s_turbolift.quitmenu.textY = 6; + s_turbolift.quitmenu.textEnum = MBT_RETURNMENU;//MBT_RETURN; + s_turbolift.quitmenu.textcolor = CT_BLACK; + s_turbolift.quitmenu.textcolor2 = CT_WHITE; //s_turbolift.quitmenu.generic.statusbarfunc = Turbolift_StatusBar; - Menu_AddItem( &s_turbolift.menu, &s_turbolift.engage ); - Menu_AddItem( &s_turbolift.menu, &s_turbolift.quitmenu ); + Menu_AddItem(&s_turbolift.menu, &s_turbolift.engage); + Menu_AddItem(&s_turbolift.menu, &s_turbolift.quitmenu); holdDeck = &s_turbolift.deck1; - for (i=0;i 32) { - s_driverinfo.strings[i][len-1] = '>'; - s_driverinfo.strings[i][len] = '\0'; - } - } - - Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.banner ); - Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framel ); - Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.framer ); - Menu_AddItem( &s_driverinfo.menu, &s_driverinfo.back ); - - UI_PushMenu( &s_driverinfo.menu ); - - UI_LogFuncEnd(); -} - -/* -======================================================================= - -GRAPHICS OPTIONS MENU - -======================================================================= -*/ - - -/*static const char *s_drivers[] = -{ - OPENGL_DRIVER_NAME, - _3DFX_DRIVER_NAME, - 0 -};*/ - -#define ID_BACK2 101 -#define ID_FULLSCREEN 102 -#define ID_LIST 103 -#define ID_MODE 104 -#define ID_DRIVERINFO 105 -#define ID_GRAPHICS 106 -#define ID_DISPLAY 107 -//#define ID_SOUND 108 -#define ID_NETWORK 109 - -typedef struct { - menuframework_s menu; - - menutext_s banner; - menubitmap_s framel; - menubitmap_s framer; - - menutext_s graphics; - menutext_s display; - menutext_s sound; - menutext_s network; - - menulist_s aspectRatio; - menulist_s list; - menulist_s mode; - menulist_s tq; - menulist_s fs; - menulist_s lighting; - menulist_s allow_extensions; - menulist_s texturebits; - menulist_s colordepth; - menulist_s geometry; - menulist_s filter; - menutext_s driverinfo; - menulist_s simpleshaders; - menulist_s compresstextures; - - menuaction_s apply; - - menubitmap_s back; - - //TiM - only update the resolution list when need be - int32_t lastRatio; - -} graphicsoptions_t; - -typedef struct -{ - int32_t mode; - qboolean fullscreen; - int32_t aspectRatio; - int32_t tq; - int32_t lighting; - int32_t colordepth; - int32_t texturebits; - int32_t geometry; - int32_t filter; - qboolean extensions; - int32_t simpleshaders; - int32_t compresstextures; -} InitialVideoOptions_s; - -static InitialVideoOptions_s s_ivo; -static graphicsoptions_t s_graphicsoptions; - -static InitialVideoOptions_s s_ivo_templates[] = -{ - { - 2, qtrue, 0, 0, 2, 2, 2, 1, 0, qtrue, 0, 0, // JDC: this was tq 3 - }, - { - 1, qtrue, 0, 0, 0, 0, 2, 0, 0, qtrue, 0, 0, - }, - { - 0, qtrue, 0, 0, 1, 0, 0, 0, 0, qtrue, 0, 0, - }, - { - 0, qtrue, 0, 1, 1, 0, 0, 0, 0, qtrue, 1, 0, - }, - { - 1, qtrue, 0, 0, 0, 0, 1, 0, 0, qtrue, 0, 0, - } -}; - -#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) ) - -/* -================= -GraphicsOptions_GetInitialVideo -================= -*/ -static void GraphicsOptions_GetInitialVideo( void ) -{ - UI_LogFuncBegin(); - - s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue; - s_ivo.mode = s_graphicsoptions.mode.curvalue; - s_ivo.aspectRatio = s_graphicsoptions.aspectRatio.curvalue; - s_ivo.fullscreen = s_graphicsoptions.fs.curvalue; - s_ivo.extensions = s_graphicsoptions.allow_extensions.curvalue; - s_ivo.tq = s_graphicsoptions.tq.curvalue; -// s_ivo.lighting = s_graphicsoptions.lighting.curvalue; - s_ivo.geometry = s_graphicsoptions.geometry.curvalue; - s_ivo.filter = s_graphicsoptions.filter.curvalue; - s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue; - s_ivo.simpleshaders = s_graphicsoptions.simpleshaders.curvalue; - s_ivo.compresstextures = s_graphicsoptions.compresstextures.curvalue; - - UI_LogFuncEnd(); -} - - -/* -================= -GraphicsOptions_CheckConfig -================= -*/ -static void GraphicsOptions_CheckConfig( void ) -{ - int32_t i; - - UI_LogFuncBegin(); - - for ( i = 0; i < NUM_IVO_TEMPLATES; i++ ) - { - if ( s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue ) - continue; - if ( s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue ) - continue; - if ( s_ivo_templates[i].aspectRatio != s_graphicsoptions.aspectRatio.curvalue ) - continue; - if ( s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue ) - continue; - if ( s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue ) - continue; -// if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue ) -// continue; - if ( s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue ) - continue; - if ( s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue ) - continue; - if ( s_ivo_templates[i].simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) - continue; -// if ( s_ivo_templates[i].compresstextures != s_graphicsoptions.compresstextures.curvalue ) -// continue; - -// if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue ) -// continue; - s_graphicsoptions.list.curvalue = i; - UI_LogFuncEnd(); - return; - } - s_graphicsoptions.list.curvalue = 4; - UI_LogFuncEnd(); -} - -/* -================= -GraphicsOptions_UpdateMenuItems -================= -*/ -static void GraphicsOptions_UpdateMenuItems( void ) -{ - UI_LogFuncBegin(); - - if ( s_graphicsoptions.fs.curvalue == 0 ) - { - s_graphicsoptions.colordepth.curvalue = 0; - s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED; - } - else - { - s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED; - } - - if ( s_graphicsoptions.allow_extensions.curvalue == 0 ) - { - if ( s_graphicsoptions.texturebits.curvalue == 0 ) - { - s_graphicsoptions.texturebits.curvalue = 1; - } - } - - s_graphicsoptions.apply.generic.flags |= QMF_GRAYED; - s_graphicsoptions.apply.generic.flags&= ~ QMF_BLINK; - - if ( s_ivo.mode != s_graphicsoptions.mode.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.aspectRatio != s_graphicsoptions.aspectRatio.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.fullscreen != s_graphicsoptions.fs.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - if ( s_ivo.tq != s_graphicsoptions.tq.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - -/* if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } -*/ - if ( s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.simpleshaders != s_graphicsoptions.simpleshaders.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.compresstextures != s_graphicsoptions.compresstextures.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.geometry != s_graphicsoptions.geometry.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - if ( s_ivo.filter != s_graphicsoptions.filter.curvalue ) - { - s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; - s_graphicsoptions.apply.generic.flags |= QMF_BLINK; - } - - //TiM - check for widescreen - if ( s_graphicsoptions.aspectRatio.curvalue != s_graphicsoptions.lastRatio ) - { - if ( s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_4X3 ) - { - s_graphicsoptions.mode.itemnames = NULL; - s_graphicsoptions.mode.listnames = NULL; - s_graphicsoptions.mode.listnames = s_resolutions; - s_graphicsoptions.mode.numitems = s_resolutionNums[ASPECTRATIO_4X3]; - s_graphicsoptions.mode.curvalue = 1; - } - else - { - s_graphicsoptions.mode.listnames = NULL; - s_graphicsoptions.mode.itemnames = NULL; - s_graphicsoptions.mode.itemnames = (const char **)s_widescreenResStrings[s_graphicsoptions.aspectRatio.curvalue-1]; - s_graphicsoptions.mode.numitems = s_resolutionNums[s_graphicsoptions.aspectRatio.curvalue]; - s_graphicsoptions.mode.curvalue = 0; - } - - s_graphicsoptions.lastRatio = s_graphicsoptions.aspectRatio.curvalue; - } - - GraphicsOptions_CheckConfig(); - UI_LogFuncEnd(); -} - -/* -================= -ApplyChanges - Apply the changes from the video data screen -================= -*/ -static void ApplyChanges2( void *unused, int32_t notification ) -{ - UI_LogFuncBegin(); - if (notification != QM_ACTIVATED){ - UI_LogFuncEnd(); - return; - } - - trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); - UI_LogFuncEnd(); -} -/* -================= -GraphicsOptions_ApplyChanges -================= -*/ -static void GraphicsOptions_ApplyChanges( void *unused, int32_t notification ) -{ - UI_LogFuncBegin(); - - if (notification != QM_ACTIVATED){ - UI_LogFuncEnd(); - return; - } - - switch ( s_graphicsoptions.texturebits.curvalue ) - { - case 0: - trap_Cvar_SetValue( "r_texturebits", 0 ); - break; - case 1: - trap_Cvar_SetValue( "r_texturebits", 16 ); - break; - case 2: - trap_Cvar_SetValue( "r_texturebits", 32 ); - break; - } - trap_Cvar_SetValue( "r_picmip", 3 - s_graphicsoptions.tq.curvalue ); - trap_Cvar_SetValue( "r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue ); - trap_Cvar_SetValue( "r_fullscreen", s_graphicsoptions.fs.curvalue ); - //trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] ); - - //TiM - handle the mode coupled with highscreen - if ( s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_4X3 ) - trap_Cvar_SetValue( "r_mode", (s_graphicsoptions.mode.curvalue + 2) ); - else - { - //GSIO - TiM you actually forget that there is r_customPixelAspect/r_customaspect as well - if(s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_16X9) { - trap_Cvar_SetValue("r_customPixelAspect", 1.7); //vEF - trap_Cvar_SetValue("r_customaspect", 1.7); //ioEF - } else { - trap_Cvar_SetValue("r_customPixelAspect", 1.6); - trap_Cvar_SetValue("r_customaspect", 1.6); - } - trap_Cvar_SetValue( "r_mode", -1 ); - trap_Cvar_SetValue( "r_customWidth", (((videoResolutions_t *)s_widescreenResolutions[s_graphicsoptions.aspectRatio.curvalue-1])[s_graphicsoptions.mode.curvalue]).width ); - trap_Cvar_SetValue( "r_customHeight", (((videoResolutions_t *)s_widescreenResolutions[s_graphicsoptions.aspectRatio.curvalue-1])[s_graphicsoptions.mode.curvalue]).height ); - } - - trap_Cvar_SetValue( "r_lowEndVideo", s_graphicsoptions.simpleshaders.curvalue ); - - trap_Cvar_SetValue( "r_ext_compress_textures", s_graphicsoptions.compresstextures.curvalue ); - - switch ( s_graphicsoptions.colordepth.curvalue ) - { - case 0: - trap_Cvar_SetValue( "r_colorbits", 0 ); - trap_Cvar_SetValue( "r_depthbits", 0 ); - trap_Cvar_SetValue( "r_stencilbits", 0 ); - break; - case 1: - trap_Cvar_SetValue( "r_colorbits", 16 ); - trap_Cvar_SetValue( "r_depthbits", 16 ); - trap_Cvar_SetValue( "r_stencilbits", 0 ); - break; - case 2: - trap_Cvar_SetValue( "r_colorbits", 32 ); - trap_Cvar_SetValue( "r_depthbits", 24 ); - break; - } -// trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue ); - - if ( s_graphicsoptions.geometry.curvalue == 2 ) - { - trap_Cvar_SetValue( "r_lodBias", 0 ); - trap_Cvar_SetValue( "r_subdivisions", 4 ); - } - else if ( s_graphicsoptions.geometry.curvalue == 1 ) - { - trap_Cvar_SetValue( "r_lodBias", 1 ); - trap_Cvar_SetValue( "r_subdivisions", 12 ); - } - else - { - trap_Cvar_SetValue( "r_lodBias", 1 ); - trap_Cvar_SetValue( "r_subdivisions", 20 ); - } - - if ( s_graphicsoptions.filter.curvalue ) - { - trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_LINEAR" ); - } - else - { - trap_Cvar_Set( "r_textureMode", "GL_LINEAR_MIPMAP_NEAREST" ); - } - - trap_Cmd_ExecuteText( EXEC_APPEND, "vid_restart\n" ); - UI_LogFuncEnd(); -} - -/* -================= -GraphicsOptions_Event -================= -*/ -static void GraphicsOptions_Event( void* ptr, int32_t event ) -{ - InitialVideoOptions_s *ivo; - - UI_LogFuncBegin(); - - if( event != QM_ACTIVATED ) { - UI_LogFuncEnd(); - return; - } - - switch( ((menucommon_s*)ptr)->id ) { - - case ID_LIST: - ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; - - s_graphicsoptions.tq.curvalue = ivo->tq; -// s_graphicsoptions.lighting.curvalue = ivo->lighting; - s_graphicsoptions.colordepth.curvalue = ivo->colordepth; - s_graphicsoptions.texturebits.curvalue = ivo->texturebits; - s_graphicsoptions.geometry.curvalue = ivo->geometry; - s_graphicsoptions.filter.curvalue = ivo->filter; - s_graphicsoptions.fs.curvalue = ivo->fullscreen; - s_graphicsoptions.simpleshaders.curvalue = ivo->simpleshaders; - s_graphicsoptions.compresstextures.curvalue = ivo->compresstextures; - - //TiM - revert the widescreen settings - if ( s_graphicsoptions.aspectRatio.curvalue != ASPECTRATIO_4X3 ) - { - s_graphicsoptions.aspectRatio.curvalue = s_graphicsoptions.lastRatio = ASPECTRATIO_4X3; - - s_graphicsoptions.mode.itemnames = NULL; - s_graphicsoptions.mode.listnames = s_resolutions; - s_graphicsoptions.mode.numitems = s_resolutionNums[ASPECTRATIO_4X3]; - } - s_graphicsoptions.mode.curvalue = ivo->mode; - - break; - - case ID_DRIVERINFO: - UI_DriverInfo_Menu(); - break; - - case ID_BACK2: - UI_PopMenu(); - break; - - case ID_GRAPHICS: - break; - - case ID_DISPLAY: - UI_PopMenu(); - UI_VideoDataMenu(); // Move to the Video Menu -// UI_DisplayOptionsMenu(); - break; - -// case ID_SOUND: -// UI_PopMenu(); -// UI_SoundOptionsMenu(); -// break; - - case ID_NETWORK: - UI_PopMenu(); - UI_NetworkOptionsMenu(); - break; - } - UI_LogFuncEnd(); -} - - -/* -================ -GraphicsOptions_MenuDraw -================ -*/ -void GraphicsOptions_MenuDraw (void) -{ -//APSFIX - rework this - UI_LogFuncBegin(); - GraphicsOptions_UpdateMenuItems(); - - Menu_Draw( &s_graphicsoptions.menu ); - UI_LogFuncEnd(); -} - -static qboolean GraphicsOptions_CheckWidescreen( void ) -{ - int32_t j, i; - int32_t customWidth = trap_Cvar_VariableValue( "r_customWidth" ); - int32_t customHeight = trap_Cvar_VariableValue( "r_customHeight" ); - videoResolutions_t *v; - - UI_LogFuncBegin(); - - //double check - if ( s_graphicsoptions.mode.curvalue >= 0 ){ - UI_LogFuncEnd(); - return qfalse; - } - - for ( j=0; j < s_wideScreenSets; j++ ) - { - v = (videoResolutions_t *)s_widescreenResolutions[j]; - - //check if it matches the resolution - for ( i = 0; i < s_resolutionNums[j+1]; i++) //offset by 1 to avoid the 4X3 option - { - if ( v[i].width == customWidth && v[i].height == customHeight ) - { - s_graphicsoptions.aspectRatio.curvalue = s_graphicsoptions.lastRatio = j+1; - - //configure the mode list accordingly - s_graphicsoptions.mode.listnames = 0; - s_graphicsoptions.mode.itemnames = 0; - s_graphicsoptions.mode.itemnames = (const char **)s_widescreenResStrings[s_graphicsoptions.aspectRatio.curvalue-1]; - s_graphicsoptions.mode.numitems = s_resolutionNums[s_graphicsoptions.aspectRatio.curvalue]; - - s_graphicsoptions.mode.curvalue = i; - UI_LogFuncEnd(); - return qtrue; - } - } - } - - //ffs... no luck - UI_LogFuncEnd(); - return qfalse; -} - -/* -================= -GraphicsOptions_SetMenuItems -================= -*/ -static void GraphicsOptions_SetMenuItems( void ) -{ - UI_LogFuncBegin(); - - s_graphicsoptions.aspectRatio.curvalue = ASPECTRATIO_4X3; //set aspect to 'Normal' for now - - s_graphicsoptions.mode.curvalue = (trap_Cvar_VariableValue( "r_mode" ) - 2); - - //TiM - adjust for widescreen - if ( s_graphicsoptions.mode.curvalue < 0 && !GraphicsOptions_CheckWidescreen() ) //less than 0 means custom resolution now - s_graphicsoptions.mode.curvalue = 1; - - s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen"); - s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions"); - s_graphicsoptions.simpleshaders.curvalue = trap_Cvar_VariableValue("r_lowEndVideo"); - s_graphicsoptions.compresstextures.curvalue = trap_Cvar_VariableValue("r_ext_compress_textures"); - - s_graphicsoptions.tq.curvalue = 3-trap_Cvar_VariableValue( "r_picmip"); - if ( s_graphicsoptions.tq.curvalue < 0 ) - { - s_graphicsoptions.tq.curvalue = 0; - } - else if ( s_graphicsoptions.tq.curvalue > 3 ) - { - s_graphicsoptions.tq.curvalue = 3; - } - -// s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0; - switch ( ( int32_t ) trap_Cvar_VariableValue( "r_texturebits" ) ) - { - default: - case 0: - s_graphicsoptions.texturebits.curvalue = 0; - break; - case 16: - s_graphicsoptions.texturebits.curvalue = 1; - break; - case 32: - s_graphicsoptions.texturebits.curvalue = 2; - break; - } - - if ( !Q_stricmp( UI_Cvar_VariableString( "r_textureMode" ), "GL_LINEAR_MIPMAP_NEAREST" ) ) - { - s_graphicsoptions.filter.curvalue = 0; - } - else - { - s_graphicsoptions.filter.curvalue = 1; - } - - if ( trap_Cvar_VariableValue( "r_lodBias" ) > 0 ) - { - if ( trap_Cvar_VariableValue( "r_subdivisions" ) >= 20 ) - { - s_graphicsoptions.geometry.curvalue = 0; - } - else - { - s_graphicsoptions.geometry.curvalue = 1; - } - } - else - { - s_graphicsoptions.geometry.curvalue = 2; - } - - switch ( ( int32_t ) trap_Cvar_VariableValue( "r_colorbits" ) ) - { - default: - case 0: - s_graphicsoptions.colordepth.curvalue = 0; - break; - case 16: - s_graphicsoptions.colordepth.curvalue = 1; - break; - case 32: - s_graphicsoptions.colordepth.curvalue = 2; - break; - } - - if ( s_graphicsoptions.fs.curvalue == 0 ) - { - s_graphicsoptions.colordepth.curvalue = 0; - } - UI_LogFuncEnd(); - -} - - - -void VideoSideButtonsAction( qboolean result ) -{ - UI_LogFuncBegin(); - if ( result ) // Yes - do it - { - Video_MenuEvent(holdControlPtr, holdControlEvent); - } - UI_LogFuncEnd(); -} - -/* -================= -VideoSideButtons_MenuEvent -================= -*/ -static void VideoSideButtons_MenuEvent (void* ptr, int32_t event) -{ - UI_LogFuncBegin(); - - if (event != QM_ACTIVATED){ - UI_LogFuncEnd(); - return; - } - - holdControlPtr = ptr; - holdControlEvent = event; - - if (s_graphicsoptions.apply.generic.flags & QMF_BLINK) // Video apply changes button is flashing - { - UI_ConfirmMenu(menu_normal_text[MNT_LOOSEVIDSETTINGS], 0, VideoSideButtonsAction); - } - else // Go ahead, act normal - { - Video_MenuEvent (holdControlPtr, holdControlEvent); - } - UI_LogFuncEnd(); -} - -/* -================= -Video_MenuEvent -================= -*/ -static void Video_MenuEvent (void* ptr, int32_t event) -{ - menuframework_s* m; - - UI_LogFuncBegin(); - - if (event != QM_ACTIVATED){ - UI_LogFuncEnd(); - return; - } - - m = ((menucommon_s*)ptr)->parent; - - switch (((menucommon_s*)ptr)->id) - { - case ID_VIDEO: // You're already in video menus, doofus - break; - - case ID_ARROWDWN: - VideoDriver_Lines(1); - break; - - case ID_ARROWUP: - VideoDriver_Lines(-1); - break; - - case ID_VIDEODRIVERS: - if (m != &s_videodriver.menu) // Not already in menu? - { - UI_PopMenu(); // Get rid of whatever is ontop - UI_VideoDriverMenu(); // Move to the Controls Menu - } - break; - - case ID_VIDEODATA: - if (m != &s_videodata.menu) // Not already in menu? - { - UI_PopMenu(); // Get rid of whatever is ontop - UI_VideoDataMenu(); // Move to the Controls Menu - } - break; - - case ID_VIDEODATA2: - if (m != &s_videodata2.menu) // Not already in menu? - { - UI_PopMenu(); // Get rid of whatever is ontop - UI_VideoData2SettingsMenu(); // Move to the Controls Menu - } - break; - - case ID_CONTROLS: - UI_PopMenu(); // Get rid of whatever is ontop -// UI_SetupWeaponsMenu(); // Move to the Controls Menu - break; - - case ID_SOUND: - UI_PopMenu(); // Get rid of whatever is ontop - UI_SoundMenu(); // Move to the Sound Menu - break; - - case ID_GAMEOPTIONS: - UI_PopMenu(); // Get rid of whatever is ontop - UI_GameOptionsMenu(); // Move to the Game Options Menu - break; - - case ID_CDKEY: - UI_PopMenu(); // Get rid of whatever is ontop - UI_CDKeyMenu(); // Move to the CD Key Menu - break; - - case ID_MAINMENU: - UI_PopMenu(); - break; - - case ID_INGAMEMENU : - UI_PopMenu(); - break; - - } - UI_LogFuncEnd(); -} - -/* -================= -M_VideoDataMenu_Graphics -================= -*/ -void M_VideoDataMenu_Graphics (void) -{ - UI_LogFuncBegin(); - - UI_MenuFrame(&s_videodata.menu); - - UI_DrawProportionalString( 74, 66, "207",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 84, "44909",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 188, "357",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 206, "250624",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 395, "456730-1",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - - UI_Setup_MenuButtons(); - - // Rest of Bottom1_Graphics -// trap_R_SetColor( colorTable[CT_LTORANGE]); -// UI_DrawHandlePic( 30, 203, 47, 69, uis.whiteShader); // Top Left column above two buttons -// UI_DrawHandlePic( 30, 344, 47, 45, uis.whiteShader); // Top Left column below two buttons - - // Brackets around Video Data - trap_R_SetColor( colorTable[CT_LTPURPLE1]); - UI_DrawHandlePic(158,163, 16, 16, uis.graphicBracket1CornerLU); - UI_DrawHandlePic(158,179, 8, 233, uis.whiteShader); - UI_DrawHandlePic(158,412, 16, -16, uis.graphicBracket1CornerLU); //LD - - UI_DrawHandlePic(174,163, 320, 8, uis.whiteShader); // Top line - - UI_DrawHandlePic(494,163, 128, 128, s_videodata.swooshTop); // Top swoosh - - UI_DrawHandlePic(501,188, 110, 54, uis.whiteShader); // Top right column - - UI_DrawHandlePic(501,348, 110, 55, uis.whiteShader); // Bottom right column - - UI_DrawHandlePic(494,406, 128, 128, s_videodata.swooshBottom); // Bottom swoosh - - UI_DrawHandlePic(174,420, 320, 8, uis.whiteShader); // Bottom line - - UI_LogFuncEnd(); -} -/* -================= -VideoData_MenuDraw -================= -*/ -static void VideoData_MenuDraw (void) -{ - UI_LogFuncBegin(); - - GraphicsOptions_UpdateMenuItems(); - - M_VideoDataMenu_Graphics(); - - Menu_Draw( &s_videodata.menu ); - - UI_LogFuncEnd(); -} - -/* -================= -UI_VideoDataMenu_Cache -================= -*/ -void UI_VideoDataMenu_Cache(void) -{ - UI_LogFuncBegin(); - s_videodata.swooshTop = trap_R_RegisterShaderNoMip("menu/common/swoosh_top.tga"); - s_videodata.swooshBottom= trap_R_RegisterShaderNoMip("menu/common/swoosh_bottom.tga"); - s_videodata.swooshTopSmall= trap_R_RegisterShaderNoMip("menu/common/swoosh_topsmall.tga"); - s_videodata.swooshBottomSmall= trap_R_RegisterShaderNoMip("menu/common/swoosh_bottomsmall.tga"); - UI_LogFuncEnd(); -} - - -/* -================= -VideoData_MenuInit -================= -*/ -static void VideoData_MenuInit( void ) -{ - int32_t x,y,width,inc; - - UI_LogFuncBegin(); - - UI_VideoDataMenu_Cache(); - - // Menu Data - s_videodata.menu.nitems = 0; - s_videodata.menu.wrapAround = qtrue; - s_videodata.menu.draw = VideoData_MenuDraw; - s_videodata.menu.fullscreen = qtrue; - s_videodata.menu.descX = MENU_DESC_X; - s_videodata.menu.descY = MENU_DESC_Y; - s_videodata.menu.listX = 230; - s_videodata.menu.listY = 188; - s_videodata.menu.titleX = MENU_TITLE_X; - s_videodata.menu.titleY = MENU_TITLE_Y; - s_videodata.menu.titleI = MNT_CONTROLSMENU_TITLE; - s_videodata.menu.footNoteEnum = MNT_VIDEOSETUP; - - x = 170; - y = 178; - width = 145; - - s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.list.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.list.generic.x = x; - s_graphicsoptions.list.generic.y = y; - s_graphicsoptions.list.generic.callback = GraphicsOptions_Event; - s_graphicsoptions.list.generic.id = ID_LIST; - s_graphicsoptions.list.textEnum = MBT_VIDEOOPTIONS; - s_graphicsoptions.list.textcolor = CT_BLACK; - s_graphicsoptions.list.textcolor2 = CT_WHITE; - s_graphicsoptions.list.color = CT_DKPURPLE1; - s_graphicsoptions.list.color2 = CT_LTPURPLE1; - s_graphicsoptions.list.textX = 5; - s_graphicsoptions.list.textY = 2; - s_graphicsoptions.list.listnames = s_graphics_options_Names; - s_graphicsoptions.list.width = width; - - inc = 20; - y += inc; - s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.allow_extensions.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.allow_extensions.generic.x = x; - s_graphicsoptions.allow_extensions.generic.y = y; - s_graphicsoptions.allow_extensions.textEnum = MBT_VIDEOGLEXTENTIONS; - s_graphicsoptions.allow_extensions.textcolor = CT_BLACK; - s_graphicsoptions.allow_extensions.textcolor2 = CT_WHITE; - s_graphicsoptions.allow_extensions.color = CT_DKPURPLE1; - s_graphicsoptions.allow_extensions.color2 = CT_LTPURPLE1; - s_graphicsoptions.allow_extensions.textX = 5; - s_graphicsoptions.allow_extensions.textY = 2; - s_graphicsoptions.allow_extensions.listnames = s_OffOnNone_Names; - s_graphicsoptions.allow_extensions.width = width; - - y += inc; - s_graphicsoptions.aspectRatio.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.aspectRatio.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.aspectRatio.generic.x = x; - s_graphicsoptions.aspectRatio.generic.y = y; - s_graphicsoptions.aspectRatio.textEnum = MBT_ASPECTRATIO; - s_graphicsoptions.aspectRatio.textcolor = CT_BLACK; - s_graphicsoptions.aspectRatio.textcolor2 = CT_WHITE; - s_graphicsoptions.aspectRatio.color = CT_DKPURPLE1; - s_graphicsoptions.aspectRatio.color2 = CT_LTPURPLE1; - s_graphicsoptions.aspectRatio.textX = 5; - s_graphicsoptions.aspectRatio.textY = 2; - s_graphicsoptions.aspectRatio.listnames = s_aspectRatios; - s_graphicsoptions.aspectRatio.width = width; - - y += inc; - // references/modifies "r_mode" - // TiM: can now be potentially '-1', - // in which case 'r_customeheight' and 'r_customwidth' - // will be used - s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.mode.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.mode.generic.x = x; - s_graphicsoptions.mode.generic.y = y; - s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event; - s_graphicsoptions.mode.textEnum = MBT_VIDEOMODE; - s_graphicsoptions.mode.textcolor = CT_BLACK; - s_graphicsoptions.mode.textcolor2 = CT_WHITE; - s_graphicsoptions.mode.color = CT_DKPURPLE1; - s_graphicsoptions.mode.color2 = CT_LTPURPLE1; - s_graphicsoptions.mode.textX = 5; - s_graphicsoptions.mode.textY = 2; - s_graphicsoptions.mode.listnames = s_resolutions; - s_graphicsoptions.mode.width = width; - - y += inc; - s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.colordepth.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.colordepth.generic.x = x; - s_graphicsoptions.colordepth.generic.y = y; - s_graphicsoptions.colordepth.textEnum = MBT_VIDEOCOLORDEPTH; - s_graphicsoptions.colordepth.textcolor = CT_BLACK; - s_graphicsoptions.colordepth.textcolor2 = CT_WHITE; - s_graphicsoptions.colordepth.color = CT_DKPURPLE1; - s_graphicsoptions.colordepth.color2 = CT_LTPURPLE1; - s_graphicsoptions.colordepth.textX = 5; - s_graphicsoptions.colordepth.textY = 2; - s_graphicsoptions.colordepth.listnames = s_colordepth_Names; - s_graphicsoptions.colordepth.width = width; - - y += inc; - s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.fs.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.fs.generic.x = x; - s_graphicsoptions.fs.generic.y = y; - s_graphicsoptions.fs.textEnum = MBT_VIDEOFULLSCREEN; - s_graphicsoptions.fs.textcolor = CT_BLACK; - s_graphicsoptions.fs.textcolor2 = CT_WHITE; - s_graphicsoptions.fs.color = CT_DKPURPLE1; - s_graphicsoptions.fs.color2 = CT_LTPURPLE1; - s_graphicsoptions.fs.textX = 5; - s_graphicsoptions.fs.textY = 2; - s_graphicsoptions.fs.listnames = s_OffOnNone_Names; - s_graphicsoptions.fs.width = width; -/* - y += inc; - s_graphicsoptions.lighting.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.lighting.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.lighting.generic.x = x; - s_graphicsoptions.lighting.generic.y = y; - s_graphicsoptions.lighting.textEnum = MBT_VIDEOLIGHTING; - s_graphicsoptions.lighting.textcolor = CT_BLACK; - s_graphicsoptions.lighting.textcolor2 = CT_WHITE; - s_graphicsoptions.lighting.color = CT_DKPURPLE1; - s_graphicsoptions.lighting.color2 = CT_LTPURPLE1; - s_graphicsoptions.lighting.textX = 5; - s_graphicsoptions.lighting.textY = 2; - s_graphicsoptions.lighting.listnames = s_lighting_Names; - s_graphicsoptions.lighting.width = width; -*/ - y += inc; - // references/modifies "r_lodBias" & "subdivisions" - s_graphicsoptions.geometry.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.geometry.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.geometry.generic.x = x; - s_graphicsoptions.geometry.generic.y = y; - s_graphicsoptions.geometry.textEnum = MBT_VIDEOGEOMETRY; - s_graphicsoptions.geometry.textcolor = CT_BLACK; - s_graphicsoptions.geometry.textcolor2 = CT_WHITE; - s_graphicsoptions.geometry.color = CT_DKPURPLE1; - s_graphicsoptions.geometry.color2 = CT_LTPURPLE1; - s_graphicsoptions.geometry.textX = 5; - s_graphicsoptions.geometry.textY = 2; - s_graphicsoptions.geometry.listnames = s_quality_Names; - s_graphicsoptions.geometry.width = width; - - y += inc; - s_graphicsoptions.tq.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.tq.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.tq.generic.x = x; - s_graphicsoptions.tq.generic.y = y; - s_graphicsoptions.tq.textEnum = MBT_VIDEOTEXTUREDETAIL; - s_graphicsoptions.tq.textcolor = CT_BLACK; - s_graphicsoptions.tq.textcolor2 = CT_WHITE; - s_graphicsoptions.tq.color = CT_DKPURPLE1; - s_graphicsoptions.tq.color2 = CT_LTPURPLE1; - s_graphicsoptions.tq.textX = 5; - s_graphicsoptions.tq.textY = 2; - s_graphicsoptions.tq.listnames = s_4quality_Names; - s_graphicsoptions.tq.width = width; - - y += inc; - // references/modifies "r_textureBits" - s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.texturebits.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.texturebits.generic.x = x; - s_graphicsoptions.texturebits.generic.y = y; - s_graphicsoptions.texturebits.textEnum = MBT_VIDEOTEXTUREBITS; - s_graphicsoptions.texturebits.textcolor = CT_BLACK; - s_graphicsoptions.texturebits.textcolor2 = CT_WHITE; - s_graphicsoptions.texturebits.color = CT_DKPURPLE1; - s_graphicsoptions.texturebits.color2 = CT_LTPURPLE1; - s_graphicsoptions.texturebits.textX = 5; - s_graphicsoptions.texturebits.textY = 2; - s_graphicsoptions.texturebits.listnames = s_tqbits_Names; - s_graphicsoptions.texturebits.width = width; - - y += inc; - // references/modifies "r_textureMode" - s_graphicsoptions.filter.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.filter.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.filter.generic.x = x; - s_graphicsoptions.filter.generic.y = y; - s_graphicsoptions.filter.textEnum = MBT_VIDEOTEXTUREFILTER; - s_graphicsoptions.filter.textcolor = CT_BLACK; - s_graphicsoptions.filter.textcolor2 = CT_WHITE; - s_graphicsoptions.filter.color = CT_DKPURPLE1; - s_graphicsoptions.filter.color2 = CT_LTPURPLE1; - s_graphicsoptions.filter.textX = 5; - s_graphicsoptions.filter.textY = 2; - s_graphicsoptions.filter.listnames = s_filter_Names; - s_graphicsoptions.filter.width = width; - - y += inc; - // references/modifies "r_lowEndVideo" - s_graphicsoptions.simpleshaders.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.simpleshaders.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.simpleshaders.generic.x = x; - s_graphicsoptions.simpleshaders.generic.y = y; - s_graphicsoptions.simpleshaders.textEnum = MBT_SIMPLESHADER; - s_graphicsoptions.simpleshaders.textcolor = CT_BLACK; - s_graphicsoptions.simpleshaders.textcolor2 = CT_WHITE; - s_graphicsoptions.simpleshaders.color = CT_DKPURPLE1; - s_graphicsoptions.simpleshaders.color2 = CT_LTPURPLE1; - s_graphicsoptions.simpleshaders.textX = 5; - s_graphicsoptions.simpleshaders.textY = 2; - s_graphicsoptions.simpleshaders.listnames = s_OffOnNone_Names; - s_graphicsoptions.simpleshaders.width = width; - - y += inc; - // references/modifies "r_ext_compress_textures" - s_graphicsoptions.compresstextures.generic.type = MTYPE_SPINCONTROL; - s_graphicsoptions.compresstextures.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_graphicsoptions.compresstextures.generic.x = x; - s_graphicsoptions.compresstextures.generic.y = y; - s_graphicsoptions.compresstextures.textEnum = MBT_COMPRESSEDTEXTURES; - s_graphicsoptions.compresstextures.textcolor = CT_BLACK; - s_graphicsoptions.compresstextures.textcolor2 = CT_WHITE; - s_graphicsoptions.compresstextures.color = CT_DKPURPLE1; - s_graphicsoptions.compresstextures.color2 = CT_LTPURPLE1; - s_graphicsoptions.compresstextures.textX = 5; - s_graphicsoptions.compresstextures.textY = 2; - s_graphicsoptions.compresstextures.listnames = s_OffOnNone_Names; - s_graphicsoptions.compresstextures.width = width; - - s_graphicsoptions.apply.generic.type = MTYPE_ACTION; - s_graphicsoptions.apply.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; - s_graphicsoptions.apply.generic.x = 501; - s_graphicsoptions.apply.generic.y = 245; - s_graphicsoptions.apply.generic.callback = GraphicsOptions_ApplyChanges; - s_graphicsoptions.apply.textEnum = MBT_VIDEOAPPLYCHANGES; - s_graphicsoptions.apply.textcolor = CT_BLACK; - s_graphicsoptions.apply.textcolor2 = CT_WHITE; - s_graphicsoptions.apply.textcolor3 = CT_LTGREY; - s_graphicsoptions.apply.color = CT_DKPURPLE1; - s_graphicsoptions.apply.color2 = CT_LTPURPLE1; - s_graphicsoptions.apply.color3 = CT_DKGREY; - s_graphicsoptions.apply.textX = 5; - s_graphicsoptions.apply.textY = 80; - s_graphicsoptions.apply.width = 110; - s_graphicsoptions.apply.height = 100; - - SetupMenu_TopButtons(&s_videodata.menu,MENU_VIDEODATA,&s_graphicsoptions.apply); - - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.list); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.allow_extensions); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.aspectRatio); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.mode); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.colordepth); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.fs); -// Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.lighting); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.geometry); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.tq); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.texturebits); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.filter); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.simpleshaders); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.compresstextures); - Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.apply); - - - Video_SideButtons(&s_videodata.menu,ID_VIDEODATA); - - GraphicsOptions_SetMenuItems(); - GraphicsOptions_GetInitialVideo(); - - /*if ( uis.glconfig.driverType == GLDRV_ICD && - uis.glconfig.hardwareType == GLHW_3DFX_2D3D ) - { - s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE; - }*/ - UI_LogFuncEnd(); -} - - -/* -================= -UI_VideoDataMenu -================= -*/ -void UI_VideoDataMenu( void ) -{ - UI_LogFuncBegin(); - VideoData_MenuInit(); - - UI_PushMenu( &s_videodata.menu ); - UI_LogFuncEnd(); -} - -/* -================= -Video_SideButtons -================= -*/ -void Video_SideButtons(menuframework_s *menu,int32_t menuType) -{ - UI_LogFuncBegin(); - - // Button Data - s_video_data.generic.type = MTYPE_BITMAP; - s_video_data.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_video_data.generic.x = video_sidebuttons[0][0]; - s_video_data.generic.y = video_sidebuttons[0][1]; - s_video_data.generic.name = GRAPHIC_SQUARE; - s_video_data.generic.id = ID_VIDEODATA; - if (menuType == ID_VIDEODATA) - { - s_video_data.generic.callback = VideoSideButtons_MenuEvent; - } - else - { - s_video_data.generic.callback = Video_MenuEvent; - } - s_video_data.width = MENU_BUTTON_MED_WIDTH - 10; - s_video_data.height = MENU_BUTTON_MED_HEIGHT; - s_video_data.color = CT_DKPURPLE1; - s_video_data.color2 = CT_LTPURPLE1; - s_video_data.textX = 5; - s_video_data.textY = 2; - s_video_data.textEnum = MBT_VIDEODATA; - if (menuType == ID_VIDEODATA) - { - s_video_data.textcolor = CT_WHITE; - s_video_data.textcolor2 = CT_WHITE; - s_video_data.generic.flags = QMF_GRAYED; - } - else - { - s_video_data.textcolor = CT_BLACK; - s_video_data.textcolor2 = CT_WHITE; - } - - s_video_data2.generic.type = MTYPE_BITMAP; - s_video_data2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_video_data2.generic.x = video_sidebuttons[1][0]; - s_video_data2.generic.y = video_sidebuttons[1][1]; - s_video_data2.generic.name = GRAPHIC_SQUARE; - s_video_data2.generic.id = ID_VIDEODATA2; - if (menuType == ID_VIDEODATA) - { - s_video_data2.generic.callback = VideoSideButtons_MenuEvent; - } - else - { - s_video_data2.generic.callback = Video_MenuEvent; - } - s_video_data2.width = MENU_BUTTON_MED_WIDTH - 10; - s_video_data2.height = MENU_BUTTON_MED_HEIGHT; - s_video_data2.color = CT_DKPURPLE1; - s_video_data2.color2 = CT_LTPURPLE1; - s_video_data2.textX = 5; - s_video_data2.textY = 2; - s_video_data2.textEnum = MBT_VIDEODATA2; - s_video_data2.textcolor = CT_WHITE; - s_video_data2.textcolor2 = CT_WHITE; - if (menuType == ID_VIDEODATA2) - { - s_video_data2.textcolor = CT_WHITE; - s_video_data2.textcolor2 = CT_WHITE; - s_video_data2.generic.flags = QMF_GRAYED; - } - else - { - s_video_data2.textcolor = CT_BLACK; - s_video_data2.textcolor2 = CT_WHITE; - } - - s_video_drivers.generic.type = MTYPE_BITMAP; - s_video_drivers.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_video_drivers.generic.x = video_sidebuttons[2][0]; - s_video_drivers.generic.y = video_sidebuttons[2][1]; - s_video_drivers.generic.name = GRAPHIC_SQUARE; - s_video_drivers.generic.id = ID_VIDEODRIVERS; - if (menuType == ID_VIDEODATA) - { - s_video_drivers.generic.callback = VideoSideButtons_MenuEvent; - } - else - { - s_video_drivers.generic.callback = Video_MenuEvent; - } - s_video_drivers.width = MENU_BUTTON_MED_WIDTH - 10; - s_video_drivers.height = MENU_BUTTON_MED_HEIGHT; - s_video_drivers.color = CT_DKPURPLE1; - s_video_drivers.color2 = CT_LTPURPLE1; - s_video_drivers.textX = 5; - s_video_drivers.textY = 2; - s_video_drivers.textEnum = MBT_VIDEODRIVERS; - if (menuType == ID_VIDEODRIVERS) - { - s_video_drivers.textcolor = CT_WHITE; - s_video_drivers.textcolor2 = CT_WHITE; - s_video_drivers.generic.flags = QMF_GRAYED; - } - else - { - s_video_drivers.textcolor = CT_BLACK; - s_video_drivers.textcolor2 = CT_WHITE; - } - - Menu_AddItem( menu, ( void * )&s_video_data); - Menu_AddItem( menu, ( void * )&s_video_data2); - Menu_AddItem( menu, ( void * )&s_video_drivers); - - UI_LogFuncEnd(); -} - - -/* -================= -VideoDriver_Lines -================= -*/ -void VideoDriver_Lines(int32_t increment) -{ - int32_t i,i2; - - UI_LogFuncBegin(); - - s_videodriver.currentDriverLine += increment; - - i=0; - i2 = 0; - - i = (s_videodriver.currentDriverLine * 2); - if (i<0) - { - s_videodriver.currentDriverLine = 0; - UI_LogFuncEnd(); - return; - } - - if (i>s_videodriver.driverCnt) - { - s_videodriver.currentDriverLine = (s_videodriver.driverCnt/2); - UI_LogFuncEnd(); - return; - } - else if (i==s_videodriver.driverCnt) - { - s_videodriver.currentDriverLine = (s_videodriver.driverCnt/2) - 1; - UI_LogFuncEnd(); - return; - } - - if (!s_videodriver.drivers[i + 22]) - { - s_videodriver.currentDriverLine -= increment; - s_videodriver.activeArrowDwn = qfalse; - UI_LogFuncEnd(); - return; - } - - for (; i < MAX_VID_DRIVERS; i++) - { - if (s_videodriver.drivers[i]) - { - if (i2<24) - { - ((menutext_s *)g_videolines[i2])->string = s_videodriver.drivers[i]; - i2++; - } - } - else - { - if (i2<24) - { - ((menutext_s *)g_videolines[i2])->string = NULL; - i2++; - } - else - { - break; - } - } - } - - // Set up arrows - - if (increment > 0) - { - s_videodriver.activeArrowUp = qtrue; - } - - if (s_videodriver.currentDriverLine < 1) - { - s_videodriver.activeArrowUp = qfalse; - } - - if (i2>= 24) - { - s_videodriver.activeArrowDwn = qtrue; - } - - i = (s_videodriver.currentDriverLine * 2); - if (!s_videodriver.drivers[i + 24]) - { - s_videodriver.activeArrowDwn = qfalse; - UI_LogFuncEnd(); - return; - } - UI_LogFuncEnd(); - -} - -/* -================= -VideoDriver_LineSetup -================= -*/ -void VideoDriver_LineSetup(void) -{ - UI_LogFuncBegin(); - char *bufhold; - char *eptr; - int32_t i; - - strcpy( s_videodriver.extensionsString, uis.glconfig.extensions_string ); - eptr = s_videodriver.extensionsString; - i=0; - - s_videodriver.driverCnt = 0; - - while ( i < MAX_VID_DRIVERS && *eptr ) - { - while ( *eptr ) - { - bufhold = eptr; - - while(*bufhold != ' ') - { - ++bufhold; - } - *bufhold = 0; - - s_videodriver.drivers[i] = eptr; - - if (i<24) - { - ((menutext_s *)g_videolines[i])->string = eptr; - } - - bufhold++; - eptr = bufhold; - s_videodriver.driverCnt++; - i++; - } - } - - // Set down arrows - if (i> 24) - { - s_videodriver.activeArrowDwn = qtrue; - } - - s_videodriver.currentDriverLine = 0; - UI_LogFuncEnd(); - -} - -/* -================= -VideoDriver_MenuKey -================= -*/ -sfxHandle_t VideoDriver_MenuKey (int32_t key) -{ - return ( Menu_DefaultKey( &s_videodriver.menu, key ) ); -} - -/* -================= -M_VideoDriverMenu_Graphics -================= -*/ -void M_VideoDriverMenu_Graphics (void) -{ - float labelColor[] = { 0, 1.0, 0, 1.0 }; - float textColor[] = { 1, 1, 1, 1 }; - int32_t x,y,x2; - - UI_LogFuncBegin(); - UI_MenuFrame(&s_videodriver.menu); - - UI_DrawProportionalString( 74, 66, "207",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 84, "44909",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 188, "357",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 206, "250624",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 395, "456730-1",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - - UI_Setup_MenuButtons(); - - // Top Frame - UI_DrawHandlePic( 178, 136, 32, -32, s_videodriver.corner_ll_8_16); // UL - UI_DrawHandlePic( 178, 221, 32, 32, s_videodriver.corner_ll_8_16); // LL - UI_DrawHandlePic( 556, 136, -32, -32, s_videodriver.corner_ll_8_16); // UR - UI_DrawHandlePic( 556, 221, -32, 32, s_videodriver.corner_ll_8_16); // LR - UI_DrawHandlePic(194,157, 378, 8, uis.whiteShader); // Top line - UI_DrawHandlePic(178,165, 16, 60, uis.whiteShader); // Left side - UI_DrawHandlePic(572,165, 16, 60, uis.whiteShader); // Right side - UI_DrawHandlePic(194,224, 378, 8, uis.whiteShader); // Bottom line - - - // Lower Frame - UI_DrawHandlePic( 178, 226, 32, -32, s_videodriver.corner_ll_16_16); // UL - UI_DrawHandlePic( 178, 414, 32, 32, s_videodriver.corner_ll_16_16); // LL - UI_DrawHandlePic( 556, 226, -32, -32, s_videodriver.corner_ll_16_16); // UR - UI_DrawHandlePic( 556, 414, -32, 32, s_videodriver.corner_ll_16_16); // LR - - UI_DrawHandlePic( 194, 237, 378, 16, uis.whiteShader); // Top line - UI_DrawHandlePic( 178, 252, 16, 168, uis.whiteShader); // Left side - - UI_DrawHandlePic( 572, 261, 16, 15, uis.whiteShader); // Right side - UI_DrawHandlePic( 572, 279, 16, 114, uis.whiteShader); // Right side - UI_DrawHandlePic( 572, 396, 16, 15, uis.whiteShader); // Right side - - UI_DrawHandlePic( 194, 419, 378, 16, uis.whiteShader); // Bottom line - - trap_R_SetColor( colorTable[CT_LTGOLD1]); - if (s_videodriver.activeArrowUp) - { - UI_DrawHandlePic( 382, 237, 32, -14, s_videodriver.arrow_dn); - } - - if (s_videodriver.activeArrowDwn) - { - UI_DrawHandlePic( 382, 422, 32, 14, s_videodriver.arrow_dn); - } - - x = 204; - x2 = 259; - y = 168; - UI_DrawProportionalString( x, y, menu_normal_text[MNT_VENDOR], UI_LEFT|UI_TINYFONT, labelColor ); - UI_DrawProportionalString( x2, y, uis.glconfig.vendor_string, UI_LEFT|UI_TINYFONT, textColor ); - y += 14; - UI_DrawProportionalString( x, y, menu_normal_text[MNT_VERSION], UI_LEFT|UI_TINYFONT, labelColor ); - UI_DrawProportionalString( x2, y, uis.glconfig.version_string, UI_LEFT|UI_TINYFONT, textColor ); - y += 14; - UI_DrawProportionalString( x, y, menu_normal_text[MNT_RENDERER], UI_LEFT|UI_TINYFONT, labelColor ); - UI_DrawProportionalString( x2, y, uis.glconfig.renderer_string, UI_LEFT|UI_TINYFONT, textColor ); - y += 14; - UI_DrawProportionalString( x, y, menu_normal_text[MNT_PIXELFORMAT], UI_LEFT|UI_TINYFONT, labelColor ); - UI_DrawProportionalString( x2, y, va("color(%d-bits) Z(%d-bit) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_LEFT|UI_TINYFONT, textColor ); - - UI_LogFuncEnd(); -} - -/* -================= -VideoDriver_MenuDraw -================= -*/ -static void VideoDriver_MenuDraw (void) -{ - UI_LogFuncBegin(); - M_VideoDriverMenu_Graphics(); - - Menu_Draw( &s_videodriver.menu ); - UI_LogFuncEnd(); -} - -/* -================= -UI_VideoDriverMenu_Cache -================= -*/ -void UI_VideoDriverMenu_Cache(void) -{ - UI_LogFuncBegin(); - s_videodriver.corner_ll_16_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_16_16.tga"); - s_videodriver.corner_ll_8_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_8_16.tga"); - s_videodriver.arrow_dn = trap_R_RegisterShaderNoMip("menu/common/arrow_dn_16.tga"); - UI_LogFuncEnd(); -} - - -/* -================= -Video_MenuInit -================= -*/ -static void VideoDriver_MenuInit( void ) -{ - int32_t i,x,y,x2; - - UI_LogFuncBegin(); - UI_VideoDriverMenu_Cache(); - - s_videodriver.menu.nitems = 0; - s_videodriver.menu.wrapAround = qtrue; -// s_videodriver.menu.opening = NULL; -// s_videodriver.menu.closing = NULL; - s_videodriver.menu.draw = VideoDriver_MenuDraw; - s_videodriver.menu.key = VideoDriver_MenuKey; - s_videodriver.menu.fullscreen = qtrue; - s_videodriver.menu.descX = MENU_DESC_X; - s_videodriver.menu.descY = MENU_DESC_Y; - s_videodriver.menu.listX = 230; - s_videodriver.menu.listY = 188; - s_videodriver.menu.titleX = MENU_TITLE_X; - s_videodriver.menu.titleY = MENU_TITLE_Y; - s_videodriver.menu.titleI = MNT_CONTROLSMENU_TITLE; - s_videodriver.menu.footNoteEnum = MNT_VIDEODRIVER; - - SetupMenu_TopButtons(&s_videodriver.menu,MENU_VIDEO,NULL); - - Video_SideButtons(&s_videodriver.menu,ID_VIDEODRIVERS); - - s_videodriver.arrowup.generic.type = MTYPE_BITMAP; - s_videodriver.arrowup.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_videodriver.arrowup.generic.x = 572; - s_videodriver.arrowup.generic.y = 262; - s_videodriver.arrowup.generic.name = "menu/common/arrow_up_16.tga"; - s_videodriver.arrowup.generic.id = ID_ARROWUP; - s_videodriver.arrowup.generic.callback = Video_MenuEvent; - s_videodriver.arrowup.width = 16; - s_videodriver.arrowup.height = 16; - s_videodriver.arrowup.color = CT_DKBLUE1; - s_videodriver.arrowup.color2 = CT_LTBLUE1; - s_videodriver.arrowup.textX = 0; - s_videodriver.arrowup.textY = 0; - s_videodriver.arrowup.textEnum = MBT_NONE; - s_videodriver.arrowup.textcolor = CT_BLACK; - s_videodriver.arrowup.textcolor2 = CT_WHITE; - Menu_AddItem( &s_videodriver.menu,( void * ) &s_videodriver.arrowup); - - s_videodriver.arrowdwn.generic.type = MTYPE_BITMAP; - s_videodriver.arrowdwn.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_videodriver.arrowdwn.generic.x = 572; - s_videodriver.arrowdwn.generic.y = 397; - s_videodriver.arrowdwn.generic.name = "menu/common/arrow_dn_16.tga"; - s_videodriver.arrowdwn.generic.id = ID_ARROWDWN; - s_videodriver.arrowdwn.generic.callback = Video_MenuEvent; - s_videodriver.arrowdwn.width = 16; - s_videodriver.arrowdwn.height = 16; - s_videodriver.arrowdwn.color = CT_DKBLUE1; - s_videodriver.arrowdwn.color2 = CT_LTBLUE1; - s_videodriver.arrowdwn.textX = 0; - s_videodriver.arrowdwn.textY = 0; - s_videodriver.arrowdwn.textEnum = MBT_NONE; - s_videodriver.arrowdwn.textcolor = CT_BLACK; - s_videodriver.arrowdwn.textcolor2 = CT_WHITE; - Menu_AddItem( &s_videodriver.menu, ( void * ) &s_videodriver.arrowdwn); - - s_videodriver.activeArrowDwn = qfalse; - s_videodriver.activeArrowUp = qfalse; - - x = 204; - x2 = 404; - y = 260; - - for (i=0;i<24;i++) - { - ((menutext_s *)g_videolines[i])->generic.type = MTYPE_TEXT; - ((menutext_s *)g_videolines[i])->generic.flags = QMF_LEFT_JUSTIFY | QMF_INACTIVE; - ((menutext_s *)g_videolines[i])->generic.y = y; - if ((i % 2 ) == 0) - { - ((menutext_s *)g_videolines[i])->generic.x = x; - } - else - { - ((menutext_s *)g_videolines[i])->generic.x = x2; - y +=13; - } - - - ((menutext_s *)g_videolines[i])->buttontextEnum = MBT_NONE; - ((menutext_s *)g_videolines[i])->style = UI_TINYFONT | UI_LEFT; - ((menutext_s *)g_videolines[i])->color = colorTable[CT_LTPURPLE1]; - Menu_AddItem( &s_videodriver.menu, ( void * )g_videolines[i]); - - } - - // Print extensions - VideoDriver_LineSetup(); - UI_LogFuncEnd(); -} - - -/* -================= -UI_VideoDriverMenu -================= -*/ -void UI_VideoDriverMenu( void ) -{ - UI_LogFuncBegin(); - if (!s_videodriver.menu.initialized) - { - VideoDriver_MenuInit(); - } - - UI_PushMenu( &s_videodriver.menu ); - UI_LogFuncEnd(); -} - -/* -================= -GammaCallback2 -================= -*/ -void GammaCallback2( void *s, int32_t notification ) -{ - UI_LogFuncBegin(); - if (notification != QM_ACTIVATED){ - UI_LogFuncEnd(); - return; - } - - s_videodata2.apply_action2.generic.flags &= ~QMF_GRAYED; - s_videodata2.apply_action2.generic.flags |= QMF_BLINK; - - GammaCallback(s,notification ); - UI_LogFuncEnd(); - -} - - -/* -================= -M_VideoData2Menu_Graphics -================= -*/ -void M_VideoData2Menu_Graphics (void) -{ - int32_t y; - - UI_LogFuncBegin(); - UI_MenuFrame(&s_videodata2.menu); - - UI_DrawProportionalString( 74, 66, "925",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 84, "88PK",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 188, "8125",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 206, "358677",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - UI_DrawProportionalString( 74, 395, "3-679",UI_RIGHT|UI_TINYFONT, colorTable[CT_BLACK]); - - UI_Setup_MenuButtons(); - - y = 191; - if (uis.glconfig.deviceSupportsGamma) - { - trap_R_SetColor( colorTable[CT_DKGREY]); - UI_DrawHandlePic( 178, y, 68, 68, uis.whiteShader); // - trap_R_SetColor( colorTable[CT_WHITE]); - UI_DrawHandlePic( 180, y+2, 64, 64, s_videodata2.gamma); // Starfleet graphic - - UI_DrawProportionalString( 256, y + 5, menu_normal_text[MNT_GAMMA_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 256, y + 25, menu_normal_text[MNT_GAMMA_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 256, y + 45, menu_normal_text[MNT_GAMMA_LINE3],UI_SMALLFONT,colorTable[CT_LTGOLD1]); - } - else - { - UI_DrawProportionalString( 178, y + 5, menu_normal_text[MNT_GAMMA2_LINE1],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - UI_DrawProportionalString( 178, y + 25,menu_normal_text[MNT_GAMMA2_LINE2],UI_SMALLFONT, colorTable[CT_LTGOLD1]); - } - - - // Brackets around Video Data - trap_R_SetColor( colorTable[CT_LTPURPLE1]); - UI_DrawHandlePic(158,163, 16, 16, uis.graphicBracket1CornerLU); - UI_DrawHandlePic(158,179, 8, 233, uis.whiteShader); - UI_DrawHandlePic(158,412, 16, -16, uis.graphicBracket1CornerLU); //LD - - UI_DrawHandlePic(174,163, 408, 8, uis.whiteShader); // Top line - - UI_DrawHandlePic(579,163, 32, 16, s_videodata2.top); // Corner, UR - UI_DrawHandlePic(581,179, 30, 121, uis.whiteShader); // Top right column - UI_DrawHandlePic(581,303, 30, 109, uis.whiteShader); // Bottom right column - UI_DrawHandlePic(579,412, 32, -16, s_videodata2.top); // Corner, LR - - UI_DrawHandlePic(174,420, 408, 8, uis.whiteShader); // Bottom line - UI_LogFuncEnd(); -} - -/* -================= -VideoData2_MenuDraw -================= -*/ -static void VideoData2_MenuDraw (void) -{ - UI_LogFuncBegin(); - M_VideoData2Menu_Graphics(); - - Menu_Draw( &s_videodata2.menu ); - UI_LogFuncEnd(); -} - - -/* -================= -UI_VideoData2Menu_Cache -================= -*/ -void UI_VideoData2Menu_Cache(void) -{ - UI_LogFuncBegin(); - s_videodata2.top = trap_R_RegisterShaderNoMip("menu/common/corner_ur_8_30.tga"); - s_videodata2.gamma = trap_R_RegisterShaderNoMip("menu/special/gamma_test.tga"); - trap_R_RegisterShaderNoMip(PIC_MONBAR2); - trap_R_RegisterShaderNoMip(PIC_SLIDER); - UI_LogFuncEnd(); -} - -/* -================= -VideoData2_MenuInit -================= -*/ -static void VideoData2_MenuInit( void ) -{ - int32_t x,y; - - UI_LogFuncBegin(); - UI_VideoData2Menu_Cache(); - - // Menu Data - s_videodata2.menu.nitems = 0; - s_videodata2.menu.wrapAround = qtrue; -// s_videodata2.menu.opening = NULL; -// s_videodata2.menu.closing = NULL; - s_videodata2.menu.draw = VideoData2_MenuDraw; - s_videodata2.menu.fullscreen = qtrue; - s_videodata2.menu.descX = MENU_DESC_X; - s_videodata2.menu.descY = MENU_DESC_Y; - s_videodata2.menu.listX = 230; - s_videodata2.menu.listY = 188; - s_videodata2.menu.titleX = MENU_TITLE_X; - s_videodata2.menu.titleY = MENU_TITLE_Y; - s_videodata2.menu.titleI = MNT_CONTROLSMENU_TITLE; - s_videodata2.menu.footNoteEnum = MNT_VIDEOSETUP; - - SetupMenu_TopButtons(&s_videodata2.menu,MENU_VIDEO,NULL); - - Video_SideButtons(&s_videodata2.menu,ID_VIDEODATA2); - - x = 180; - y = 269; - s_videodata2.gamma_slider.generic.type = MTYPE_SLIDER; - s_videodata2.gamma_slider.generic.x = x + 162; - s_videodata2.gamma_slider.generic.y = y; - s_videodata2.gamma_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.gamma_slider.generic.callback = GammaCallback2; - s_videodata2.gamma_slider.minvalue = 5; - s_videodata2.gamma_slider.maxvalue = 30; - s_videodata2.gamma_slider.color = CT_DKPURPLE1; - s_videodata2.gamma_slider.color2 = CT_LTPURPLE1; - s_videodata2.gamma_slider.generic.name = PIC_MONBAR2; - s_videodata2.gamma_slider.width = 256; - s_videodata2.gamma_slider.height = 32; - s_videodata2.gamma_slider.focusWidth = 145; - s_videodata2.gamma_slider.focusHeight = 18; - s_videodata2.gamma_slider.picName = (char*)GRAPHIC_SQUARE; - s_videodata2.gamma_slider.picX = x; - s_videodata2.gamma_slider.picY = y; - s_videodata2.gamma_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; - s_videodata2.gamma_slider.picHeight = MENU_BUTTON_MED_HEIGHT; - s_videodata2.gamma_slider.textX = MENU_BUTTON_TEXT_X; - s_videodata2.gamma_slider.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.gamma_slider.textEnum = MBT_BRIGHTNESS; - s_videodata2.gamma_slider.textcolor = CT_BLACK; - s_videodata2.gamma_slider.textcolor2 = CT_WHITE; - s_videodata2.gamma_slider.thumbName = PIC_SLIDER; - s_videodata2.gamma_slider.thumbHeight = 32; - s_videodata2.gamma_slider.thumbWidth = 16; - s_videodata2.gamma_slider.thumbGraphicWidth = 9; - s_videodata2.gamma_slider.thumbColor = CT_DKBLUE1; - s_videodata2.gamma_slider.thumbColor2 = CT_LTBLUE1; - - s_videodata2.apply_action2.generic.type = MTYPE_ACTION; - s_videodata2.apply_action2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS|QMF_GRAYED; - s_videodata2.apply_action2.generic.x = 490; - s_videodata2.apply_action2.generic.y = 191; - s_videodata2.apply_action2.generic.callback = ApplyChanges2; - s_videodata2.apply_action2.textEnum = MBT_ACCEPT; - s_videodata2.apply_action2.textcolor = CT_BLACK; - s_videodata2.apply_action2.textcolor2 = CT_WHITE; - s_videodata2.apply_action2.textcolor3 = CT_LTGREY; - s_videodata2.apply_action2.color = CT_DKPURPLE1; - s_videodata2.apply_action2.color2 = CT_LTPURPLE1; - s_videodata2.apply_action2.color3 = CT_DKGREY; - s_videodata2.apply_action2.textX = 5; - s_videodata2.apply_action2.textY = 30; - s_videodata2.apply_action2.width = 82; - s_videodata2.apply_action2.height = 70; - - y = 330; - s_videodata2.screensize_slider.generic.type = MTYPE_SLIDER; - s_videodata2.screensize_slider.generic.x = x + 162; - s_videodata2.screensize_slider.generic.y = y; - s_videodata2.screensize_slider.generic.flags = QMF_SMALLFONT; - s_videodata2.screensize_slider.generic.callback = ScreensizeCallback; - s_videodata2.screensize_slider.minvalue = 30; - s_videodata2.screensize_slider.maxvalue = 100; - s_videodata2.screensize_slider.color = CT_DKPURPLE1; - s_videodata2.screensize_slider.color2 = CT_LTPURPLE1; - s_videodata2.screensize_slider.generic.name = PIC_MONBAR2; - s_videodata2.screensize_slider.width = 256; - s_videodata2.screensize_slider.height = 32; - s_videodata2.screensize_slider.focusWidth = 145; - s_videodata2.screensize_slider.focusHeight = 18; - s_videodata2.screensize_slider.picName = (char*)GRAPHIC_SQUARE; - s_videodata2.screensize_slider.picX = x; - s_videodata2.screensize_slider.picY = y; - s_videodata2.screensize_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; - s_videodata2.screensize_slider.picHeight = MENU_BUTTON_MED_HEIGHT; - s_videodata2.screensize_slider.textX = MENU_BUTTON_TEXT_X; - s_videodata2.screensize_slider.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.screensize_slider.textEnum = MBT_SCREENSIZE; - s_videodata2.screensize_slider.textcolor = CT_BLACK; - s_videodata2.screensize_slider.textcolor2 = CT_WHITE; - s_videodata2.screensize_slider.thumbName = PIC_SLIDER; - s_videodata2.screensize_slider.thumbHeight = 32; - s_videodata2.screensize_slider.thumbWidth = 16; - s_videodata2.screensize_slider.thumbGraphicWidth= 9; - s_videodata2.screensize_slider.thumbColor = CT_DKBLUE1; - s_videodata2.screensize_slider.thumbColor2 = CT_LTBLUE1; - - y += 34; - s_videodata2.anisotropicfiltering.generic.type = MTYPE_SPINCONTROL; - s_videodata2.anisotropicfiltering.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; - s_videodata2.anisotropicfiltering.generic.x = x; - s_videodata2.anisotropicfiltering.generic.y = y; - s_videodata2.anisotropicfiltering.generic.name = GRAPHIC_BUTTONRIGHT; - s_videodata2.anisotropicfiltering.generic.callback = AnisotropicFilteringCallback; - s_videodata2.anisotropicfiltering.color = CT_DKPURPLE1; - s_videodata2.anisotropicfiltering.color2 = CT_LTPURPLE1; - s_videodata2.anisotropicfiltering.textX = MENU_BUTTON_TEXT_X; - s_videodata2.anisotropicfiltering.textY = MENU_BUTTON_TEXT_Y; - s_videodata2.anisotropicfiltering.textEnum = MBT_ANISOTROPICFILTERING; - s_videodata2.anisotropicfiltering.textcolor = CT_BLACK; - s_videodata2.anisotropicfiltering.textcolor2 = CT_WHITE; - s_videodata2.anisotropicfiltering.listnames = s_OffOnNone_Names; - - - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.gamma_slider); - if (!uis.glconfig.deviceSupportsGamma) - { - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.apply_action2); - } - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.screensize_slider); - Menu_AddItem( &s_videodata2.menu, ( void * )&s_videodata2.anisotropicfiltering); - UI_LogFuncEnd(); - -} - -/* -================= -UI_VideoData2SettingsGetCvars -================= -*/ -static void UI_VideoData2SettingsGetCvars(void) -{ - UI_LogFuncBegin(); - s_videodata2.gamma_slider.curvalue = trap_Cvar_VariableValue( "r_gamma" ) * 10.0f; - s_videodata2.screensize_slider.curvalue = trap_Cvar_VariableValue( "cg_viewsize" ); - s_videodata2.anisotropicfiltering.curvalue = trap_Cvar_VariableValue( "r_ext_texture_filter_anisotropic" ); - UI_LogFuncEnd(); -} - -/* -================= -UI_VideoData2SettingsMenu -================= -*/ -void UI_VideoData2SettingsMenu( void ) -{ - UI_LogFuncBegin(); - UI_VideoData2SettingsGetCvars(); - - if (!s_videodata2.menu.initialized) - { - VideoData2_MenuInit(); - } - - UI_PushMenu( &s_videodata2.menu ); - UI_LogFuncEnd(); -} - +// Copyright (C) 1999-2000 Id Software, Inc. +// +#include "ui_local.h" +#include "ui_logger.h" + +void UI_VideoDriverMenu(void); +void VideoDriver_Lines(int32_t increment); +void UI_VideoData2SettingsMenu(void); + + +extern void* holdControlPtr; +extern int32_t holdControlEvent; +static void Video_MenuEvent(void* ptr, int32_t event); + +static const char PIC_MONBAR2[] = "menu/common/monbar_2.tga"; +static const char PIC_SLIDER[] = "menu/common/slider.tga"; + +// Video Data +typedef struct +{ + menuframework_s menu; + + qhandle_t swooshTop; + qhandle_t swooshBottom; + qhandle_t swooshTopSmall; + qhandle_t swooshBottomSmall; + +} videoddata_t; + +static videoddata_t s_videodata; + + +// Video Drivers +typedef struct +{ + menuframework_s menu; + + qhandle_t swooshTopSmall; + qhandle_t swooshBottomSmall; +} videodriver_t; + + +// Video Data 2 +typedef struct +{ + menuframework_s menu; + + menuslider_s gamma_slider; + menuslider_s screensize_slider; + menulist_s anisotropicfiltering; + menuaction_s apply_action2; + + qhandle_t gamma; + qhandle_t top; +} videodata2_t; + +typedef struct +{ + int32_t width; + int32_t height; +} videoResolutions_t; + +static videodata2_t s_videodata2; + +static int32_t s_graphics_options_Names[] = +{ + MNT_VIDEO_HIGH_QUALITY, + MNT_VIDEO_NORMAL, + MNT_VIDEO_FAST, + MNT_VIDEO_FASTEST, + MNT_VIDEO_CUSTOM, + MNT_NONE +}; + +/*static int32_t s_driver_Names[] = +{ +MNT_VIDEO_DRIVER_DEFAULT, +MNT_VIDEO_DRIVER_VOODOO, +MNT_NONE +};*/ + +extern int32_t s_OffOnNone_Names[]; + +static int32_t s_resolutions[] = +{ + // MNT_320X200, + // MNT_400X300, + MNT_512X384, + MNT_640X480, + MNT_800X600, + MNT_960X720, + MNT_1024X768, + MNT_1152X864, + MNT_1280X960, + MNT_1600X1200, + MNT_2048X1536, + //MNT_856x480WIDE, //this is dumb :P + MNT_NONE +}; + +static int32_t s_aspectRatios[] = +{ + MNT_4X3, + MNT_16X9, + MNT_16X10, + 0 +}; + +static char *s_wideResolutions16x9[] = +{ + "854x480", + "1280x720", + "1366x768", + "1920x1080", + 0 +}; + +static videoResolutions_t videoResolutions16x9[] = +{ + { 854, 480 }, + { 1280, 720 }, + { 1366, 768 }, + { 1920, 1080 } +}; + +static char *s_wideResolutions16x10[] = +{ + "1280x800", + "1440x900", + "1680x1050", + "1920x1200", + "2560x1600", + 0 +}; + +static videoResolutions_t videoResolutions16x10[] = +{ + { 1280, 800 }, + { 1440, 900 }, + { 1680, 1050 }, + { 1920, 1200 }, + { 2560, 1600 } +}; + +static void *s_widescreenResolutions[] = +{ + &videoResolutions16x9, + &videoResolutions16x10, + NULL +}; + +static void *s_widescreenResStrings[] = +{ + &s_wideResolutions16x9, + &s_wideResolutions16x10, + NULL +}; + +//store the number of widescreen arrays +static int32_t s_wideScreenSets = 2; + +//store the number of resolutions in each array. +//This will be necessary when we change the lists over +static int32_t s_resolutionNums[] = { 9, 4, 5 }; + +//finally for reference sake, use an enum +typedef enum +{ + ASPECTRATIO_4X3, + ASPECTRATIO_16X9, + ASPECTRATIO_16X10, + ASPECTRATIO_MAX +} AspectRatios_e; + +static int32_t s_colordepth_Names[] = +{ + MNT_DEFAULT, + MNT_16BIT, + MNT_32BIT, + MNT_NONE +}; + +/*static int32_t s_lighting_Names[] = +{ +MNT_LIGHTMAP, +MNT_VERTEX, +MNT_NONE +};*/ + +static int32_t s_quality_Names[] = +{ + MNT_LOW, + MNT_MEDIUM, + MNT_HIGH, + MNT_NONE +}; + +static int32_t s_4quality_Names[] = +{ + MNT_LOW, + MNT_MEDIUM, + MNT_HIGH, + MNT_VERY_HIGH, + MNT_NONE +}; + +static int32_t s_tqbits_Names[] = +{ + MNT_DEFAULT, + MNT_16BIT, + MNT_32BIT, + MNT_NONE +}; + +static int32_t s_filter_Names[] = +{ + MNT_BILINEAR, + MNT_TRILINEAR, + MNT_NONE +}; + + + +static menubitmap_s s_video_drivers; +static menubitmap_s s_video_data; +static menubitmap_s s_video_data2; + +enum ui_videoIDs_e { + ID_DRIVERINFOBACK = 100, + ID_MAINMENU = 100, + ID_BACK2 = 101, + ID_CONTROLS = 101, + ID_VIDEO = 102, + ID_FULLSCREEN = 102, + ID_LIST = 103, + ID_SOUND = 103, + ID_MODE = 104, + ID_GAMEOPTIONS = 104, + ID_DRIVERINFO = 105, + ID_CDKEY = 105, + ID_GRAPHICS = 106, + ID_DISPLAY = 107, + //ID_SOUND = 108, + ID_NETWORK = 109, + ID_VIDEODATA = 110, + ID_VIDEODATA2, + ID_VIDEODRIVERS, + ID_ARROWDWN, + ID_ARROWUP, + ID_INGAMEMENU +}; + +enum ui_videoLimits_e { + MAX_VID_DRIVERS = 128 +}; + +// Precache stuff for Video Driver +static struct +{ + menuframework_s menu; + + char *drivers[MAX_VID_DRIVERS]; + char extensionsString[2 * MAX_STRING_CHARS]; + + menutext_s line1; + menutext_s line2; + menutext_s line3; + menutext_s line4; + menutext_s line5; + menutext_s line6; + menutext_s line7; + menutext_s line8; + menutext_s line9; + menutext_s line10; + menutext_s line11; + menutext_s line12; + menutext_s line13; + menutext_s line14; + menutext_s line15; + menutext_s line16; + menutext_s line17; + menutext_s line18; + menutext_s line19; + menutext_s line20; + menutext_s line21; + menutext_s line22; + menutext_s line23; + menutext_s line24; + + qhandle_t corner_ll_8_16; + qhandle_t corner_ll_16_16; + qhandle_t arrow_dn; + menubitmap_s arrowdwn; + menubitmap_s arrowup; + int32_t currentDriverLine; + int32_t driverCnt; + + int32_t activeArrowDwn; + int32_t activeArrowUp; +} s_videodriver; + + +static void* g_videolines[] = +{ + &s_videodriver.line1, + &s_videodriver.line2, + &s_videodriver.line3, + &s_videodriver.line4, + &s_videodriver.line5, + &s_videodriver.line6, + &s_videodriver.line7, + &s_videodriver.line8, + &s_videodriver.line9, + &s_videodriver.line10, + &s_videodriver.line11, + &s_videodriver.line12, + &s_videodriver.line13, + &s_videodriver.line14, + &s_videodriver.line15, + &s_videodriver.line16, + &s_videodriver.line17, + &s_videodriver.line18, + &s_videodriver.line19, + &s_videodriver.line20, + &s_videodriver.line21, + &s_videodriver.line22, + &s_videodriver.line23, + &s_videodriver.line24, + NULL, +}; + +int32_t video_sidebuttons[3][2] = +{ + { 30, 250 }, // Video Data Button + { 30, 250 + 6 + (MENU_BUTTON_MED_HEIGHT * 1.5) }, // Video Drivers Button + { 30, 250 + (2 * (6 + (MENU_BUTTON_MED_HEIGHT * 1.5))) }, // Video Drivers Button +}; + + +void Video_SideButtons(menuframework_s *menu, int32_t menuType); +static void GraphicsOptions_ApplyChanges(void *unused, int32_t notification); + +/* +======================================================================= + +DRIVER INFORMATION MENU + +======================================================================= +*/ + +typedef struct +{ + menuframework_s menu; + menutext_s banner; + menubitmap_s back; + menubitmap_s framel; + menubitmap_s framer; + char stringbuff[2 * MAX_STRING_CHARS]; + char* strings[64]; + int32_t numstrings; +} driverinfo_t; + +static driverinfo_t s_driverinfo; + + +/* +================= +DriverInfo_MenuDraw +================= +*/ +static void DriverInfo_MenuDraw(void) +{ + int32_t i; + int32_t y; + + UI_LogFuncBegin(); + + Menu_Draw(&s_driverinfo.menu); + + UI_DrawString(320, 80, "VENDOR", UI_CENTER | UI_SMALLFONT, color_red, qtrue); + UI_DrawString(320, 152, "PIXELFORMAT", UI_CENTER | UI_SMALLFONT, color_red, qtrue); + UI_DrawString(320, 192, "EXTENSIONS", UI_CENTER | UI_SMALLFONT, color_red, qtrue); + + UI_DrawString(320, 80 + 16, uis.glconfig.vendor_string, UI_CENTER | UI_SMALLFONT, text_color_normal, qtrue); + UI_DrawString(320, 96 + 16, uis.glconfig.version_string, UI_CENTER | UI_SMALLFONT, text_color_normal, qtrue); + UI_DrawString(320, 112 + 16, uis.glconfig.renderer_string, UI_CENTER | UI_SMALLFONT, text_color_normal, qtrue); + UI_DrawString(320, 152 + 16, va("color(%d-bits) Z(%d-bits) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_CENTER | UI_SMALLFONT, text_color_normal, qtrue); + + // double column + y = 192 + 16; + for (i = 0; i < s_driverinfo.numstrings / 2; i++) { + UI_DrawString(320 - 4, y, s_driverinfo.strings[i * 2], UI_RIGHT | UI_SMALLFONT, text_color_normal, qtrue); + UI_DrawString(320 + 4, y, s_driverinfo.strings[i * 2 + 1], UI_LEFT | UI_SMALLFONT, text_color_normal, qtrue); + y += SMALLCHAR_HEIGHT; + } + + if (s_driverinfo.numstrings & 1) + UI_DrawString(320, y, s_driverinfo.strings[s_driverinfo.numstrings - 1], UI_CENTER | UI_SMALLFONT, text_color_normal, qtrue); + + UI_LogFuncEnd(); +} + +/* +================= +DriverInfo_Cache +================= +*/ +void DriverInfo_Cache(void) +{ + +} + +/* +================= +UI_DriverInfo_Menu +================= +*/ +static void UI_DriverInfo_Menu(void) +{ + char* eptr; + int32_t i; + int32_t len; + + UI_LogFuncBegin(); + + // zero set all our globals + memset(&s_driverinfo, 0, sizeof(driverinfo_t)); + + DriverInfo_Cache(); + + s_driverinfo.menu.fullscreen = qtrue; + s_driverinfo.menu.draw = DriverInfo_MenuDraw; + /* + s_driverinfo.banner.generic.type = MTYPE_BTEXT; + s_driverinfo.banner.generic.x = 320; + s_driverinfo.banner.generic.y = 16; + s_driverinfo.banner.string = "DRIVER INFO"; + s_driverinfo.banner.color = color_white; + s_driverinfo.banner.style = UI_CENTER; + + s_driverinfo.framel.generic.type = MTYPE_BITMAP; + s_driverinfo.framel.generic.name = DRIVERINFO_FRAMEL; + s_driverinfo.framel.generic.flags = QMF_INACTIVE; + s_driverinfo.framel.generic.x = 0; + s_driverinfo.framel.generic.y = 78; + s_driverinfo.framel.width = 256; + s_driverinfo.framel.height = 329; + + s_driverinfo.framer.generic.type = MTYPE_BITMAP; + s_driverinfo.framer.generic.name = DRIVERINFO_FRAMER; + s_driverinfo.framer.generic.flags = QMF_INACTIVE; + s_driverinfo.framer.generic.x = 376; + s_driverinfo.framer.generic.y = 76; + s_driverinfo.framer.width = 256; + s_driverinfo.framer.height = 334; + + s_driverinfo.back.generic.type = MTYPE_BITMAP; + s_driverinfo.back.generic.name = DRIVERINFO_BACK0; + s_driverinfo.back.generic.flags = QMF_LEFT_JUSTIFY|QMF_PULSEIFFOCUS; + s_driverinfo.back.generic.callback = DriverInfo_Event; + s_driverinfo.back.generic.id = ID_DRIVERINFOBACK; + s_driverinfo.back.generic.x = 0; + s_driverinfo.back.generic.y = 480-64; + s_driverinfo.back.width = 128; + s_driverinfo.back.height = 64; + s_driverinfo.back.focuspic = DRIVERINFO_BACK1; + */ + strcpy(s_driverinfo.stringbuff, uis.glconfig.extensions_string); + + // build null terminated extension strings + eptr = s_driverinfo.stringbuff; + while (s_driverinfo.numstrings < 40 && *eptr) + { + while (*eptr && *eptr == ' ') + *eptr++ = '\0'; + + // track start of valid string + if (*eptr && *eptr != ' ') + s_driverinfo.strings[s_driverinfo.numstrings++] = eptr; + + while (*eptr && *eptr != ' ') + eptr++; + } + + // safety length strings for display + for (i = 0; i 32) { + s_driverinfo.strings[i][len - 1] = '>'; + s_driverinfo.strings[i][len] = '\0'; + } + } + + Menu_AddItem(&s_driverinfo.menu, &s_driverinfo.banner); + Menu_AddItem(&s_driverinfo.menu, &s_driverinfo.framel); + Menu_AddItem(&s_driverinfo.menu, &s_driverinfo.framer); + Menu_AddItem(&s_driverinfo.menu, &s_driverinfo.back); + + UI_PushMenu(&s_driverinfo.menu); + + UI_LogFuncEnd(); +} + +/* +======================================================================= + +GRAPHICS OPTIONS MENU + +======================================================================= +*/ + + +/*static const char *s_drivers[] = +{ +OPENGL_DRIVER_NAME, +_3DFX_DRIVER_NAME, +0 +};*/ + +typedef struct { + menuframework_s menu; + + menutext_s banner; + menubitmap_s framel; + menubitmap_s framer; + + menutext_s graphics; + menutext_s display; + menutext_s sound; + menutext_s network; + + menulist_s aspectRatio; + menulist_s list; + menulist_s mode; + menulist_s tq; + menulist_s fs; + menulist_s lighting; + menulist_s allow_extensions; + menulist_s texturebits; + menulist_s colordepth; + menulist_s geometry; + menulist_s filter; + menutext_s driverinfo; + menulist_s simpleshaders; + menulist_s compresstextures; + + menuaction_s apply; + + menubitmap_s back; + + //TiM - only update the resolution list when need be + int32_t lastRatio; + +} graphicsoptions_t; + +typedef struct +{ + int32_t mode; + qboolean fullscreen; + int32_t aspectRatio; + int32_t tq; + int32_t lighting; + int32_t colordepth; + int32_t texturebits; + int32_t geometry; + int32_t filter; + qboolean extensions; + int32_t simpleshaders; + int32_t compresstextures; +} InitialVideoOptions_s; + +static InitialVideoOptions_s s_ivo; +static graphicsoptions_t s_graphicsoptions; + +static InitialVideoOptions_s s_ivo_templates[] = +{ + { + 2, qtrue, 0, 0, 2, 2, 2, 1, 0, qtrue, 0, 0, // JDC: this was tq 3 + }, + { + 1, qtrue, 0, 0, 0, 0, 2, 0, 0, qtrue, 0, 0, + }, + { + 0, qtrue, 0, 0, 1, 0, 0, 0, 0, qtrue, 0, 0, + }, + { + 0, qtrue, 0, 1, 1, 0, 0, 0, 0, qtrue, 1, 0, + }, + { + 1, qtrue, 0, 0, 0, 0, 1, 0, 0, qtrue, 0, 0, + } +}; + +#define NUM_IVO_TEMPLATES ( sizeof( s_ivo_templates ) / sizeof( s_ivo_templates[0] ) ) + +/* +================= +GraphicsOptions_GetInitialVideo +================= +*/ +static void GraphicsOptions_GetInitialVideo(void) +{ + UI_LogFuncBegin(); + + s_ivo.colordepth = s_graphicsoptions.colordepth.curvalue; + s_ivo.mode = s_graphicsoptions.mode.curvalue; + s_ivo.aspectRatio = s_graphicsoptions.aspectRatio.curvalue; + s_ivo.fullscreen = s_graphicsoptions.fs.curvalue; + s_ivo.extensions = s_graphicsoptions.allow_extensions.curvalue; + s_ivo.tq = s_graphicsoptions.tq.curvalue; + // s_ivo.lighting = s_graphicsoptions.lighting.curvalue; + s_ivo.geometry = s_graphicsoptions.geometry.curvalue; + s_ivo.filter = s_graphicsoptions.filter.curvalue; + s_ivo.texturebits = s_graphicsoptions.texturebits.curvalue; + s_ivo.simpleshaders = s_graphicsoptions.simpleshaders.curvalue; + s_ivo.compresstextures = s_graphicsoptions.compresstextures.curvalue; + + UI_LogFuncEnd(); +} + + +/* +================= +GraphicsOptions_CheckConfig +================= +*/ +static void GraphicsOptions_CheckConfig(void) +{ + int32_t i; + + UI_LogFuncBegin(); + + for (i = 0; i < NUM_IVO_TEMPLATES; i++) + { + if (s_ivo_templates[i].colordepth != s_graphicsoptions.colordepth.curvalue) + continue; + if (s_ivo_templates[i].mode != s_graphicsoptions.mode.curvalue) + continue; + if (s_ivo_templates[i].aspectRatio != s_graphicsoptions.aspectRatio.curvalue) + continue; + if (s_ivo_templates[i].fullscreen != s_graphicsoptions.fs.curvalue) + continue; + if (s_ivo_templates[i].tq != s_graphicsoptions.tq.curvalue) + continue; + // if ( s_ivo_templates[i].lighting != s_graphicsoptions.lighting.curvalue ) + // continue; + if (s_ivo_templates[i].geometry != s_graphicsoptions.geometry.curvalue) + continue; + if (s_ivo_templates[i].filter != s_graphicsoptions.filter.curvalue) + continue; + if (s_ivo_templates[i].simpleshaders != s_graphicsoptions.simpleshaders.curvalue) + continue; + // if ( s_ivo_templates[i].compresstextures != s_graphicsoptions.compresstextures.curvalue ) + // continue; + + // if ( s_ivo_templates[i].texturebits != s_graphicsoptions.texturebits.curvalue ) + // continue; + s_graphicsoptions.list.curvalue = i; + UI_LogFuncEnd(); + return; + } + s_graphicsoptions.list.curvalue = 4; + UI_LogFuncEnd(); +} + +/* +================= +GraphicsOptions_UpdateMenuItems +================= +*/ +static void GraphicsOptions_UpdateMenuItems(void) +{ + UI_LogFuncBegin(); + + if (s_graphicsoptions.fs.curvalue == 0) + { + s_graphicsoptions.colordepth.curvalue = 0; + s_graphicsoptions.colordepth.generic.flags |= QMF_GRAYED; + } + else + { + s_graphicsoptions.colordepth.generic.flags &= ~QMF_GRAYED; + } + + if (s_graphicsoptions.allow_extensions.curvalue == 0) + { + if (s_graphicsoptions.texturebits.curvalue == 0) + { + s_graphicsoptions.texturebits.curvalue = 1; + } + } + + s_graphicsoptions.apply.generic.flags |= QMF_GRAYED; + s_graphicsoptions.apply.generic.flags &= ~QMF_BLINK; + + if (s_ivo.mode != s_graphicsoptions.mode.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.aspectRatio != s_graphicsoptions.aspectRatio.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.fullscreen != s_graphicsoptions.fs.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.extensions != s_graphicsoptions.allow_extensions.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + if (s_ivo.tq != s_graphicsoptions.tq.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + /* if ( s_ivo.lighting != s_graphicsoptions.lighting.curvalue ) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + */ + if (s_ivo.colordepth != s_graphicsoptions.colordepth.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.texturebits != s_graphicsoptions.texturebits.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.simpleshaders != s_graphicsoptions.simpleshaders.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.compresstextures != s_graphicsoptions.compresstextures.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.geometry != s_graphicsoptions.geometry.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + if (s_ivo.filter != s_graphicsoptions.filter.curvalue) + { + s_graphicsoptions.apply.generic.flags &= ~QMF_GRAYED; + s_graphicsoptions.apply.generic.flags |= QMF_BLINK; + } + + //TiM - check for widescreen + if (s_graphicsoptions.aspectRatio.curvalue != s_graphicsoptions.lastRatio) + { + if (s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_4X3) + { + s_graphicsoptions.mode.itemnames = NULL; + s_graphicsoptions.mode.listnames = NULL; + s_graphicsoptions.mode.listnames = s_resolutions; + s_graphicsoptions.mode.numitems = s_resolutionNums[ASPECTRATIO_4X3]; + s_graphicsoptions.mode.curvalue = 1; + } + else + { + s_graphicsoptions.mode.listnames = NULL; + s_graphicsoptions.mode.itemnames = NULL; + s_graphicsoptions.mode.itemnames = (const char **)s_widescreenResStrings[s_graphicsoptions.aspectRatio.curvalue - 1]; + s_graphicsoptions.mode.numitems = s_resolutionNums[s_graphicsoptions.aspectRatio.curvalue]; + s_graphicsoptions.mode.curvalue = 0; + } + + s_graphicsoptions.lastRatio = s_graphicsoptions.aspectRatio.curvalue; + } + + GraphicsOptions_CheckConfig(); + UI_LogFuncEnd(); +} + +/* +================= +ApplyChanges - Apply the changes from the video data screen +================= +*/ +static void ApplyChanges2(void *unused, int32_t notification) +{ + UI_LogFuncBegin(); + if (notification != QM_ACTIVATED){ + UI_LogFuncEnd(); + return; + } + + trap_Cmd_ExecuteText(EXEC_APPEND, "vid_restart\n"); + UI_LogFuncEnd(); +} +/* +================= +GraphicsOptions_ApplyChanges +================= +*/ +static void GraphicsOptions_ApplyChanges(void *unused, int32_t notification) +{ + UI_LogFuncBegin(); + + if (notification != QM_ACTIVATED){ + UI_LogFuncEnd(); + return; + } + + switch (s_graphicsoptions.texturebits.curvalue) + { + case 0: + trap_Cvar_SetValue("r_texturebits", 0); + break; + case 1: + trap_Cvar_SetValue("r_texturebits", 16); + break; + case 2: + trap_Cvar_SetValue("r_texturebits", 32); + break; + } + trap_Cvar_SetValue("r_picmip", 3 - s_graphicsoptions.tq.curvalue); + trap_Cvar_SetValue("r_allowExtensions", s_graphicsoptions.allow_extensions.curvalue); + trap_Cvar_SetValue("r_fullscreen", s_graphicsoptions.fs.curvalue); + //trap_Cvar_Set( "r_glDriver", ( char * ) s_drivers[s_graphicsoptions.driver.curvalue] ); + + //TiM - handle the mode coupled with highscreen + if (s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_4X3) + trap_Cvar_SetValue("r_mode", (s_graphicsoptions.mode.curvalue + 2)); + else + { + //GSIO - TiM you actually forget that there is r_customPixelAspect/r_customaspect as well + if (s_graphicsoptions.aspectRatio.curvalue == ASPECTRATIO_16X9) { + trap_Cvar_SetValue("r_customPixelAspect", 1.7); //vEF + trap_Cvar_SetValue("r_customaspect", 1.7); //ioEF + } + else { + trap_Cvar_SetValue("r_customPixelAspect", 1.6); + trap_Cvar_SetValue("r_customaspect", 1.6); + } + trap_Cvar_SetValue("r_mode", -1); + trap_Cvar_SetValue("r_customWidth", (((videoResolutions_t *)s_widescreenResolutions[s_graphicsoptions.aspectRatio.curvalue - 1])[s_graphicsoptions.mode.curvalue]).width); + trap_Cvar_SetValue("r_customHeight", (((videoResolutions_t *)s_widescreenResolutions[s_graphicsoptions.aspectRatio.curvalue - 1])[s_graphicsoptions.mode.curvalue]).height); + } + + trap_Cvar_SetValue("r_lowEndVideo", s_graphicsoptions.simpleshaders.curvalue); + + trap_Cvar_SetValue("r_ext_compress_textures", s_graphicsoptions.compresstextures.curvalue); + + switch (s_graphicsoptions.colordepth.curvalue) + { + case 0: + trap_Cvar_SetValue("r_colorbits", 0); + trap_Cvar_SetValue("r_depthbits", 0); + trap_Cvar_SetValue("r_stencilbits", 0); + break; + case 1: + trap_Cvar_SetValue("r_colorbits", 16); + trap_Cvar_SetValue("r_depthbits", 16); + trap_Cvar_SetValue("r_stencilbits", 0); + break; + case 2: + trap_Cvar_SetValue("r_colorbits", 32); + trap_Cvar_SetValue("r_depthbits", 24); + break; + } + // trap_Cvar_SetValue( "r_vertexLight", s_graphicsoptions.lighting.curvalue ); + + if (s_graphicsoptions.geometry.curvalue == 2) + { + trap_Cvar_SetValue("r_lodBias", 0); + trap_Cvar_SetValue("r_subdivisions", 4); + } + else if (s_graphicsoptions.geometry.curvalue == 1) + { + trap_Cvar_SetValue("r_lodBias", 1); + trap_Cvar_SetValue("r_subdivisions", 12); + } + else + { + trap_Cvar_SetValue("r_lodBias", 1); + trap_Cvar_SetValue("r_subdivisions", 20); + } + + if (s_graphicsoptions.filter.curvalue) + { + trap_Cvar_Set("r_textureMode", "GL_LINEAR_MIPMAP_LINEAR"); + } + else + { + trap_Cvar_Set("r_textureMode", "GL_LINEAR_MIPMAP_NEAREST"); + } + + trap_Cmd_ExecuteText(EXEC_APPEND, "vid_restart\n"); + UI_LogFuncEnd(); +} + +/* +================= +GraphicsOptions_Event +================= +*/ +static void GraphicsOptions_Event(void* ptr, int32_t event) +{ + InitialVideoOptions_s *ivo; + + UI_LogFuncBegin(); + + if (event != QM_ACTIVATED) { + UI_LogFuncEnd(); + return; + } + + switch (((menucommon_s*)ptr)->id) { + + case ID_LIST: + ivo = &s_ivo_templates[s_graphicsoptions.list.curvalue]; + + s_graphicsoptions.tq.curvalue = ivo->tq; + // s_graphicsoptions.lighting.curvalue = ivo->lighting; + s_graphicsoptions.colordepth.curvalue = ivo->colordepth; + s_graphicsoptions.texturebits.curvalue = ivo->texturebits; + s_graphicsoptions.geometry.curvalue = ivo->geometry; + s_graphicsoptions.filter.curvalue = ivo->filter; + s_graphicsoptions.fs.curvalue = ivo->fullscreen; + s_graphicsoptions.simpleshaders.curvalue = ivo->simpleshaders; + s_graphicsoptions.compresstextures.curvalue = ivo->compresstextures; + + //TiM - revert the widescreen settings + if (s_graphicsoptions.aspectRatio.curvalue != ASPECTRATIO_4X3) + { + s_graphicsoptions.aspectRatio.curvalue = s_graphicsoptions.lastRatio = ASPECTRATIO_4X3; + + s_graphicsoptions.mode.itemnames = NULL; + s_graphicsoptions.mode.listnames = s_resolutions; + s_graphicsoptions.mode.numitems = s_resolutionNums[ASPECTRATIO_4X3]; + } + s_graphicsoptions.mode.curvalue = ivo->mode; + + break; + + case ID_DRIVERINFO: + UI_DriverInfo_Menu(); + break; + + case ID_BACK2: + UI_PopMenu(); + break; + + case ID_GRAPHICS: + break; + + case ID_DISPLAY: + UI_PopMenu(); + UI_VideoDataMenu(); // Move to the Video Menu + // UI_DisplayOptionsMenu(); + break; + + // case ID_SOUND: + // UI_PopMenu(); + // UI_SoundOptionsMenu(); + // break; + + case ID_NETWORK: + UI_PopMenu(); + UI_NetworkOptionsMenu(); + break; + } + UI_LogFuncEnd(); +} + + +/* +================ +GraphicsOptions_MenuDraw +================ +*/ +void GraphicsOptions_MenuDraw(void) +{ + //APSFIX - rework this + UI_LogFuncBegin(); + GraphicsOptions_UpdateMenuItems(); + + Menu_Draw(&s_graphicsoptions.menu); + UI_LogFuncEnd(); +} + +static qboolean GraphicsOptions_CheckWidescreen(void) +{ + int32_t j, i; + int32_t customWidth = trap_Cvar_VariableValue("r_customWidth"); + int32_t customHeight = trap_Cvar_VariableValue("r_customHeight"); + videoResolutions_t *v; + + UI_LogFuncBegin(); + + //double check + if (s_graphicsoptions.mode.curvalue >= 0){ + UI_LogFuncEnd(); + return qfalse; + } + + for (j = 0; j < s_wideScreenSets; j++) + { + v = (videoResolutions_t *)s_widescreenResolutions[j]; + + //check if it matches the resolution + for (i = 0; i < s_resolutionNums[j + 1]; i++) //offset by 1 to avoid the 4X3 option + { + if (v[i].width == customWidth && v[i].height == customHeight) + { + s_graphicsoptions.aspectRatio.curvalue = s_graphicsoptions.lastRatio = j + 1; + + //configure the mode list accordingly + s_graphicsoptions.mode.listnames = 0; + s_graphicsoptions.mode.itemnames = 0; + s_graphicsoptions.mode.itemnames = (const char **)s_widescreenResStrings[s_graphicsoptions.aspectRatio.curvalue - 1]; + s_graphicsoptions.mode.numitems = s_resolutionNums[s_graphicsoptions.aspectRatio.curvalue]; + + s_graphicsoptions.mode.curvalue = i; + UI_LogFuncEnd(); + return qtrue; + } + } + } + + //ffs... no luck + UI_LogFuncEnd(); + return qfalse; +} + +/* +================= +GraphicsOptions_SetMenuItems +================= +*/ +static void GraphicsOptions_SetMenuItems(void) +{ + UI_LogFuncBegin(); + + s_graphicsoptions.aspectRatio.curvalue = ASPECTRATIO_4X3; //set aspect to 'Normal' for now + + s_graphicsoptions.mode.curvalue = (trap_Cvar_VariableValue("r_mode") - 2); + + //TiM - adjust for widescreen + if (s_graphicsoptions.mode.curvalue < 0 && !GraphicsOptions_CheckWidescreen()) //less than 0 means custom resolution now + s_graphicsoptions.mode.curvalue = 1; + + s_graphicsoptions.fs.curvalue = trap_Cvar_VariableValue("r_fullscreen"); + s_graphicsoptions.allow_extensions.curvalue = trap_Cvar_VariableValue("r_allowExtensions"); + s_graphicsoptions.simpleshaders.curvalue = trap_Cvar_VariableValue("r_lowEndVideo"); + s_graphicsoptions.compresstextures.curvalue = trap_Cvar_VariableValue("r_ext_compress_textures"); + + s_graphicsoptions.tq.curvalue = 3 - trap_Cvar_VariableValue("r_picmip"); + if (s_graphicsoptions.tq.curvalue < 0) + { + s_graphicsoptions.tq.curvalue = 0; + } + else if (s_graphicsoptions.tq.curvalue > 3) + { + s_graphicsoptions.tq.curvalue = 3; + } + + // s_graphicsoptions.lighting.curvalue = trap_Cvar_VariableValue( "r_vertexLight" ) != 0; + switch ((int32_t)trap_Cvar_VariableValue("r_texturebits")) + { + default: + case 0: + s_graphicsoptions.texturebits.curvalue = 0; + break; + case 16: + s_graphicsoptions.texturebits.curvalue = 1; + break; + case 32: + s_graphicsoptions.texturebits.curvalue = 2; + break; + } + + if (!Q_stricmp(UI_Cvar_VariableString("r_textureMode"), "GL_LINEAR_MIPMAP_NEAREST")) + { + s_graphicsoptions.filter.curvalue = 0; + } + else + { + s_graphicsoptions.filter.curvalue = 1; + } + + if (trap_Cvar_VariableValue("r_lodBias") > 0) + { + if (trap_Cvar_VariableValue("r_subdivisions") >= 20) + { + s_graphicsoptions.geometry.curvalue = 0; + } + else + { + s_graphicsoptions.geometry.curvalue = 1; + } + } + else + { + s_graphicsoptions.geometry.curvalue = 2; + } + + switch ((int32_t)trap_Cvar_VariableValue("r_colorbits")) + { + default: + case 0: + s_graphicsoptions.colordepth.curvalue = 0; + break; + case 16: + s_graphicsoptions.colordepth.curvalue = 1; + break; + case 32: + s_graphicsoptions.colordepth.curvalue = 2; + break; + } + + if (s_graphicsoptions.fs.curvalue == 0) + { + s_graphicsoptions.colordepth.curvalue = 0; + } + UI_LogFuncEnd(); + +} + + + +void VideoSideButtonsAction(qboolean result) +{ + UI_LogFuncBegin(); + if (result) // Yes - do it + { + Video_MenuEvent(holdControlPtr, holdControlEvent); + } + UI_LogFuncEnd(); +} + +/* +================= +VideoSideButtons_MenuEvent +================= +*/ +static void VideoSideButtons_MenuEvent(void* ptr, int32_t event) +{ + UI_LogFuncBegin(); + + if (event != QM_ACTIVATED){ + UI_LogFuncEnd(); + return; + } + + holdControlPtr = ptr; + holdControlEvent = event; + + if (s_graphicsoptions.apply.generic.flags & QMF_BLINK) // Video apply changes button is flashing + { + UI_ConfirmMenu(menu_normal_text[MNT_LOOSEVIDSETTINGS], 0, VideoSideButtonsAction); + } + else // Go ahead, act normal + { + Video_MenuEvent(holdControlPtr, holdControlEvent); + } + UI_LogFuncEnd(); +} + +/* +================= +Video_MenuEvent +================= +*/ +static void Video_MenuEvent(void* ptr, int32_t event) +{ + menuframework_s* m; + + UI_LogFuncBegin(); + + if (event != QM_ACTIVATED){ + UI_LogFuncEnd(); + return; + } + + m = ((menucommon_s*)ptr)->parent; + + switch (((menucommon_s*)ptr)->id) + { + case ID_VIDEO: // You're already in video menus, doofus + break; + + case ID_ARROWDWN: + VideoDriver_Lines(1); + break; + + case ID_ARROWUP: + VideoDriver_Lines(-1); + break; + + case ID_VIDEODRIVERS: + if (m != &s_videodriver.menu) // Not already in menu? + { + UI_PopMenu(); // Get rid of whatever is ontop + UI_VideoDriverMenu(); // Move to the Controls Menu + } + break; + + case ID_VIDEODATA: + if (m != &s_videodata.menu) // Not already in menu? + { + UI_PopMenu(); // Get rid of whatever is ontop + UI_VideoDataMenu(); // Move to the Controls Menu + } + break; + + case ID_VIDEODATA2: + if (m != &s_videodata2.menu) // Not already in menu? + { + UI_PopMenu(); // Get rid of whatever is ontop + UI_VideoData2SettingsMenu(); // Move to the Controls Menu + } + break; + + case ID_CONTROLS: + UI_PopMenu(); // Get rid of whatever is ontop + // UI_SetupWeaponsMenu(); // Move to the Controls Menu + break; + + case ID_SOUND: + UI_PopMenu(); // Get rid of whatever is ontop + UI_SoundMenu(); // Move to the Sound Menu + break; + + case ID_GAMEOPTIONS: + UI_PopMenu(); // Get rid of whatever is ontop + UI_GameOptionsMenu(); // Move to the Game Options Menu + break; + + case ID_CDKEY: + UI_PopMenu(); // Get rid of whatever is ontop + UI_CDKeyMenu(); // Move to the CD Key Menu + break; + + case ID_MAINMENU: + UI_PopMenu(); + break; + + case ID_INGAMEMENU: + UI_PopMenu(); + break; + + } + UI_LogFuncEnd(); +} + +/* +================= +M_VideoDataMenu_Graphics +================= +*/ +void M_VideoDataMenu_Graphics(void) +{ + UI_LogFuncBegin(); + + UI_MenuFrame(&s_videodata.menu); + + UI_DrawProportionalString(74, 66, "207", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 84, "44909", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 188, "357", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 206, "250624", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 395, "456730-1", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + + UI_Setup_MenuButtons(); + + // Rest of Bottom1_Graphics + // trap_R_SetColor( colorTable[CT_LTORANGE]); + // UI_DrawHandlePic( 30, 203, 47, 69, uis.whiteShader); // Top Left column above two buttons + // UI_DrawHandlePic( 30, 344, 47, 45, uis.whiteShader); // Top Left column below two buttons + + // Brackets around Video Data + trap_R_SetColor(colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(158, 163, 16, 16, uis.graphicBracket1CornerLU); + UI_DrawHandlePic(158, 179, 8, 233, uis.whiteShader); + UI_DrawHandlePic(158, 412, 16, -16, uis.graphicBracket1CornerLU); //LD + + UI_DrawHandlePic(174, 163, 320, 8, uis.whiteShader); // Top line + + UI_DrawHandlePic(494, 163, 128, 128, s_videodata.swooshTop); // Top swoosh + + UI_DrawHandlePic(501, 188, 110, 54, uis.whiteShader); // Top right column + + UI_DrawHandlePic(501, 348, 110, 55, uis.whiteShader); // Bottom right column + + UI_DrawHandlePic(494, 406, 128, 128, s_videodata.swooshBottom); // Bottom swoosh + + UI_DrawHandlePic(174, 420, 320, 8, uis.whiteShader); // Bottom line + + UI_LogFuncEnd(); +} +/* +================= +VideoData_MenuDraw +================= +*/ +static void VideoData_MenuDraw(void) +{ + UI_LogFuncBegin(); + + GraphicsOptions_UpdateMenuItems(); + + M_VideoDataMenu_Graphics(); + + Menu_Draw(&s_videodata.menu); + + UI_LogFuncEnd(); +} + +/* +================= +UI_VideoDataMenu_Cache +================= +*/ +void UI_VideoDataMenu_Cache(void) +{ + UI_LogFuncBegin(); + s_videodata.swooshTop = trap_R_RegisterShaderNoMip("menu/common/swoosh_top.tga"); + s_videodata.swooshBottom = trap_R_RegisterShaderNoMip("menu/common/swoosh_bottom.tga"); + s_videodata.swooshTopSmall = trap_R_RegisterShaderNoMip("menu/common/swoosh_topsmall.tga"); + s_videodata.swooshBottomSmall = trap_R_RegisterShaderNoMip("menu/common/swoosh_bottomsmall.tga"); + UI_LogFuncEnd(); +} + + +/* +================= +VideoData_MenuInit +================= +*/ +static void VideoData_MenuInit(void) +{ + int32_t x, y, width, inc; + + UI_LogFuncBegin(); + + UI_VideoDataMenu_Cache(); + + // Menu Data + s_videodata.menu.nitems = 0; + s_videodata.menu.wrapAround = qtrue; + s_videodata.menu.draw = VideoData_MenuDraw; + s_videodata.menu.fullscreen = qtrue; + s_videodata.menu.descX = MENU_DESC_X; + s_videodata.menu.descY = MENU_DESC_Y; + s_videodata.menu.listX = 230; + s_videodata.menu.listY = 188; + s_videodata.menu.titleX = MENU_TITLE_X; + s_videodata.menu.titleY = MENU_TITLE_Y; + s_videodata.menu.titleI = MNT_CONTROLSMENU_TITLE; + s_videodata.menu.footNoteEnum = MNT_VIDEOSETUP; + + x = 170; + y = 178; + width = 145; + + s_graphicsoptions.list.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.list.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.list.generic.x = x; + s_graphicsoptions.list.generic.y = y; + s_graphicsoptions.list.generic.callback = GraphicsOptions_Event; + s_graphicsoptions.list.generic.id = ID_LIST; + s_graphicsoptions.list.textEnum = MBT_VIDEOOPTIONS; + s_graphicsoptions.list.textcolor = CT_BLACK; + s_graphicsoptions.list.textcolor2 = CT_WHITE; + s_graphicsoptions.list.color = CT_DKPURPLE1; + s_graphicsoptions.list.color2 = CT_LTPURPLE1; + s_graphicsoptions.list.textX = 5; + s_graphicsoptions.list.textY = 2; + s_graphicsoptions.list.listnames = s_graphics_options_Names; + s_graphicsoptions.list.width = width; + + inc = 20; + y += inc; + s_graphicsoptions.allow_extensions.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.allow_extensions.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.allow_extensions.generic.x = x; + s_graphicsoptions.allow_extensions.generic.y = y; + s_graphicsoptions.allow_extensions.textEnum = MBT_VIDEOGLEXTENTIONS; + s_graphicsoptions.allow_extensions.textcolor = CT_BLACK; + s_graphicsoptions.allow_extensions.textcolor2 = CT_WHITE; + s_graphicsoptions.allow_extensions.color = CT_DKPURPLE1; + s_graphicsoptions.allow_extensions.color2 = CT_LTPURPLE1; + s_graphicsoptions.allow_extensions.textX = 5; + s_graphicsoptions.allow_extensions.textY = 2; + s_graphicsoptions.allow_extensions.listnames = s_OffOnNone_Names; + s_graphicsoptions.allow_extensions.width = width; + + y += inc; + s_graphicsoptions.aspectRatio.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.aspectRatio.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.aspectRatio.generic.x = x; + s_graphicsoptions.aspectRatio.generic.y = y; + s_graphicsoptions.aspectRatio.textEnum = MBT_ASPECTRATIO; + s_graphicsoptions.aspectRatio.textcolor = CT_BLACK; + s_graphicsoptions.aspectRatio.textcolor2 = CT_WHITE; + s_graphicsoptions.aspectRatio.color = CT_DKPURPLE1; + s_graphicsoptions.aspectRatio.color2 = CT_LTPURPLE1; + s_graphicsoptions.aspectRatio.textX = 5; + s_graphicsoptions.aspectRatio.textY = 2; + s_graphicsoptions.aspectRatio.listnames = s_aspectRatios; + s_graphicsoptions.aspectRatio.width = width; + + y += inc; + // references/modifies "r_mode" + // TiM: can now be potentially '-1', + // in which case 'r_customeheight' and 'r_customwidth' + // will be used + s_graphicsoptions.mode.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.mode.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.mode.generic.x = x; + s_graphicsoptions.mode.generic.y = y; + s_graphicsoptions.mode.generic.callback = GraphicsOptions_Event; + s_graphicsoptions.mode.textEnum = MBT_VIDEOMODE; + s_graphicsoptions.mode.textcolor = CT_BLACK; + s_graphicsoptions.mode.textcolor2 = CT_WHITE; + s_graphicsoptions.mode.color = CT_DKPURPLE1; + s_graphicsoptions.mode.color2 = CT_LTPURPLE1; + s_graphicsoptions.mode.textX = 5; + s_graphicsoptions.mode.textY = 2; + s_graphicsoptions.mode.listnames = s_resolutions; + s_graphicsoptions.mode.width = width; + + y += inc; + s_graphicsoptions.colordepth.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.colordepth.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.colordepth.generic.x = x; + s_graphicsoptions.colordepth.generic.y = y; + s_graphicsoptions.colordepth.textEnum = MBT_VIDEOCOLORDEPTH; + s_graphicsoptions.colordepth.textcolor = CT_BLACK; + s_graphicsoptions.colordepth.textcolor2 = CT_WHITE; + s_graphicsoptions.colordepth.color = CT_DKPURPLE1; + s_graphicsoptions.colordepth.color2 = CT_LTPURPLE1; + s_graphicsoptions.colordepth.textX = 5; + s_graphicsoptions.colordepth.textY = 2; + s_graphicsoptions.colordepth.listnames = s_colordepth_Names; + s_graphicsoptions.colordepth.width = width; + + y += inc; + s_graphicsoptions.fs.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.fs.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.fs.generic.x = x; + s_graphicsoptions.fs.generic.y = y; + s_graphicsoptions.fs.textEnum = MBT_VIDEOFULLSCREEN; + s_graphicsoptions.fs.textcolor = CT_BLACK; + s_graphicsoptions.fs.textcolor2 = CT_WHITE; + s_graphicsoptions.fs.color = CT_DKPURPLE1; + s_graphicsoptions.fs.color2 = CT_LTPURPLE1; + s_graphicsoptions.fs.textX = 5; + s_graphicsoptions.fs.textY = 2; + s_graphicsoptions.fs.listnames = s_OffOnNone_Names; + s_graphicsoptions.fs.width = width; + /* + y += inc; + s_graphicsoptions.lighting.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.lighting.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.lighting.generic.x = x; + s_graphicsoptions.lighting.generic.y = y; + s_graphicsoptions.lighting.textEnum = MBT_VIDEOLIGHTING; + s_graphicsoptions.lighting.textcolor = CT_BLACK; + s_graphicsoptions.lighting.textcolor2 = CT_WHITE; + s_graphicsoptions.lighting.color = CT_DKPURPLE1; + s_graphicsoptions.lighting.color2 = CT_LTPURPLE1; + s_graphicsoptions.lighting.textX = 5; + s_graphicsoptions.lighting.textY = 2; + s_graphicsoptions.lighting.listnames = s_lighting_Names; + s_graphicsoptions.lighting.width = width; + */ + y += inc; + // references/modifies "r_lodBias" & "subdivisions" + s_graphicsoptions.geometry.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.geometry.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.geometry.generic.x = x; + s_graphicsoptions.geometry.generic.y = y; + s_graphicsoptions.geometry.textEnum = MBT_VIDEOGEOMETRY; + s_graphicsoptions.geometry.textcolor = CT_BLACK; + s_graphicsoptions.geometry.textcolor2 = CT_WHITE; + s_graphicsoptions.geometry.color = CT_DKPURPLE1; + s_graphicsoptions.geometry.color2 = CT_LTPURPLE1; + s_graphicsoptions.geometry.textX = 5; + s_graphicsoptions.geometry.textY = 2; + s_graphicsoptions.geometry.listnames = s_quality_Names; + s_graphicsoptions.geometry.width = width; + + y += inc; + s_graphicsoptions.tq.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.tq.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.tq.generic.x = x; + s_graphicsoptions.tq.generic.y = y; + s_graphicsoptions.tq.textEnum = MBT_VIDEOTEXTUREDETAIL; + s_graphicsoptions.tq.textcolor = CT_BLACK; + s_graphicsoptions.tq.textcolor2 = CT_WHITE; + s_graphicsoptions.tq.color = CT_DKPURPLE1; + s_graphicsoptions.tq.color2 = CT_LTPURPLE1; + s_graphicsoptions.tq.textX = 5; + s_graphicsoptions.tq.textY = 2; + s_graphicsoptions.tq.listnames = s_4quality_Names; + s_graphicsoptions.tq.width = width; + + y += inc; + // references/modifies "r_textureBits" + s_graphicsoptions.texturebits.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.texturebits.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.texturebits.generic.x = x; + s_graphicsoptions.texturebits.generic.y = y; + s_graphicsoptions.texturebits.textEnum = MBT_VIDEOTEXTUREBITS; + s_graphicsoptions.texturebits.textcolor = CT_BLACK; + s_graphicsoptions.texturebits.textcolor2 = CT_WHITE; + s_graphicsoptions.texturebits.color = CT_DKPURPLE1; + s_graphicsoptions.texturebits.color2 = CT_LTPURPLE1; + s_graphicsoptions.texturebits.textX = 5; + s_graphicsoptions.texturebits.textY = 2; + s_graphicsoptions.texturebits.listnames = s_tqbits_Names; + s_graphicsoptions.texturebits.width = width; + + y += inc; + // references/modifies "r_textureMode" + s_graphicsoptions.filter.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.filter.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.filter.generic.x = x; + s_graphicsoptions.filter.generic.y = y; + s_graphicsoptions.filter.textEnum = MBT_VIDEOTEXTUREFILTER; + s_graphicsoptions.filter.textcolor = CT_BLACK; + s_graphicsoptions.filter.textcolor2 = CT_WHITE; + s_graphicsoptions.filter.color = CT_DKPURPLE1; + s_graphicsoptions.filter.color2 = CT_LTPURPLE1; + s_graphicsoptions.filter.textX = 5; + s_graphicsoptions.filter.textY = 2; + s_graphicsoptions.filter.listnames = s_filter_Names; + s_graphicsoptions.filter.width = width; + + y += inc; + // references/modifies "r_lowEndVideo" + s_graphicsoptions.simpleshaders.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.simpleshaders.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.simpleshaders.generic.x = x; + s_graphicsoptions.simpleshaders.generic.y = y; + s_graphicsoptions.simpleshaders.textEnum = MBT_SIMPLESHADER; + s_graphicsoptions.simpleshaders.textcolor = CT_BLACK; + s_graphicsoptions.simpleshaders.textcolor2 = CT_WHITE; + s_graphicsoptions.simpleshaders.color = CT_DKPURPLE1; + s_graphicsoptions.simpleshaders.color2 = CT_LTPURPLE1; + s_graphicsoptions.simpleshaders.textX = 5; + s_graphicsoptions.simpleshaders.textY = 2; + s_graphicsoptions.simpleshaders.listnames = s_OffOnNone_Names; + s_graphicsoptions.simpleshaders.width = width; + + y += inc; + // references/modifies "r_ext_compress_textures" + s_graphicsoptions.compresstextures.generic.type = MTYPE_SPINCONTROL; + s_graphicsoptions.compresstextures.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_graphicsoptions.compresstextures.generic.x = x; + s_graphicsoptions.compresstextures.generic.y = y; + s_graphicsoptions.compresstextures.textEnum = MBT_COMPRESSEDTEXTURES; + s_graphicsoptions.compresstextures.textcolor = CT_BLACK; + s_graphicsoptions.compresstextures.textcolor2 = CT_WHITE; + s_graphicsoptions.compresstextures.color = CT_DKPURPLE1; + s_graphicsoptions.compresstextures.color2 = CT_LTPURPLE1; + s_graphicsoptions.compresstextures.textX = 5; + s_graphicsoptions.compresstextures.textY = 2; + s_graphicsoptions.compresstextures.listnames = s_OffOnNone_Names; + s_graphicsoptions.compresstextures.width = width; + + s_graphicsoptions.apply.generic.type = MTYPE_ACTION; + s_graphicsoptions.apply.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_GRAYED; + s_graphicsoptions.apply.generic.x = 501; + s_graphicsoptions.apply.generic.y = 245; + s_graphicsoptions.apply.generic.callback = GraphicsOptions_ApplyChanges; + s_graphicsoptions.apply.textEnum = MBT_VIDEOAPPLYCHANGES; + s_graphicsoptions.apply.textcolor = CT_BLACK; + s_graphicsoptions.apply.textcolor2 = CT_WHITE; + s_graphicsoptions.apply.textcolor3 = CT_LTGREY; + s_graphicsoptions.apply.color = CT_DKPURPLE1; + s_graphicsoptions.apply.color2 = CT_LTPURPLE1; + s_graphicsoptions.apply.color3 = CT_DKGREY; + s_graphicsoptions.apply.textX = 5; + s_graphicsoptions.apply.textY = 80; + s_graphicsoptions.apply.width = 110; + s_graphicsoptions.apply.height = 100; + + SetupMenu_TopButtons(&s_videodata.menu, MENU_VIDEODATA, &s_graphicsoptions.apply); + + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.list); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.allow_extensions); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.aspectRatio); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.mode); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.colordepth); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.fs); + // Menu_AddItem( &s_videodata.menu, ( void * )&s_graphicsoptions.lighting); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.geometry); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.tq); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.texturebits); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.filter); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.simpleshaders); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.compresstextures); + Menu_AddItem(&s_videodata.menu, (void *)&s_graphicsoptions.apply); + + + Video_SideButtons(&s_videodata.menu, ID_VIDEODATA); + + GraphicsOptions_SetMenuItems(); + GraphicsOptions_GetInitialVideo(); + + /*if ( uis.glconfig.driverType == GLDRV_ICD && + uis.glconfig.hardwareType == GLHW_3DFX_2D3D ) + { + s_graphicsoptions.driver.generic.flags |= QMF_HIDDEN|QMF_INACTIVE; + }*/ + UI_LogFuncEnd(); +} + + +/* +================= +UI_VideoDataMenu +================= +*/ +void UI_VideoDataMenu(void) +{ + UI_LogFuncBegin(); + VideoData_MenuInit(); + + UI_PushMenu(&s_videodata.menu); + UI_LogFuncEnd(); +} + +/* +================= +Video_SideButtons +================= +*/ +void Video_SideButtons(menuframework_s *menu, int32_t menuType) +{ + UI_LogFuncBegin(); + + // Button Data + s_video_data.generic.type = MTYPE_BITMAP; + s_video_data.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_video_data.generic.x = video_sidebuttons[0][0]; + s_video_data.generic.y = video_sidebuttons[0][1]; + s_video_data.generic.name = GRAPHIC_SQUARE; + s_video_data.generic.id = ID_VIDEODATA; + if (menuType == ID_VIDEODATA) + { + s_video_data.generic.callback = VideoSideButtons_MenuEvent; + } + else + { + s_video_data.generic.callback = Video_MenuEvent; + } + s_video_data.width = MENU_BUTTON_MED_WIDTH - 10; + s_video_data.height = MENU_BUTTON_MED_HEIGHT; + s_video_data.color = CT_DKPURPLE1; + s_video_data.color2 = CT_LTPURPLE1; + s_video_data.textX = 5; + s_video_data.textY = 2; + s_video_data.textEnum = MBT_VIDEODATA; + if (menuType == ID_VIDEODATA) + { + s_video_data.textcolor = CT_WHITE; + s_video_data.textcolor2 = CT_WHITE; + s_video_data.generic.flags = QMF_GRAYED; + } + else + { + s_video_data.textcolor = CT_BLACK; + s_video_data.textcolor2 = CT_WHITE; + } + + s_video_data2.generic.type = MTYPE_BITMAP; + s_video_data2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_video_data2.generic.x = video_sidebuttons[1][0]; + s_video_data2.generic.y = video_sidebuttons[1][1]; + s_video_data2.generic.name = GRAPHIC_SQUARE; + s_video_data2.generic.id = ID_VIDEODATA2; + if (menuType == ID_VIDEODATA) + { + s_video_data2.generic.callback = VideoSideButtons_MenuEvent; + } + else + { + s_video_data2.generic.callback = Video_MenuEvent; + } + s_video_data2.width = MENU_BUTTON_MED_WIDTH - 10; + s_video_data2.height = MENU_BUTTON_MED_HEIGHT; + s_video_data2.color = CT_DKPURPLE1; + s_video_data2.color2 = CT_LTPURPLE1; + s_video_data2.textX = 5; + s_video_data2.textY = 2; + s_video_data2.textEnum = MBT_VIDEODATA2; + s_video_data2.textcolor = CT_WHITE; + s_video_data2.textcolor2 = CT_WHITE; + if (menuType == ID_VIDEODATA2) + { + s_video_data2.textcolor = CT_WHITE; + s_video_data2.textcolor2 = CT_WHITE; + s_video_data2.generic.flags = QMF_GRAYED; + } + else + { + s_video_data2.textcolor = CT_BLACK; + s_video_data2.textcolor2 = CT_WHITE; + } + + s_video_drivers.generic.type = MTYPE_BITMAP; + s_video_drivers.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_video_drivers.generic.x = video_sidebuttons[2][0]; + s_video_drivers.generic.y = video_sidebuttons[2][1]; + s_video_drivers.generic.name = GRAPHIC_SQUARE; + s_video_drivers.generic.id = ID_VIDEODRIVERS; + if (menuType == ID_VIDEODATA) + { + s_video_drivers.generic.callback = VideoSideButtons_MenuEvent; + } + else + { + s_video_drivers.generic.callback = Video_MenuEvent; + } + s_video_drivers.width = MENU_BUTTON_MED_WIDTH - 10; + s_video_drivers.height = MENU_BUTTON_MED_HEIGHT; + s_video_drivers.color = CT_DKPURPLE1; + s_video_drivers.color2 = CT_LTPURPLE1; + s_video_drivers.textX = 5; + s_video_drivers.textY = 2; + s_video_drivers.textEnum = MBT_VIDEODRIVERS; + if (menuType == ID_VIDEODRIVERS) + { + s_video_drivers.textcolor = CT_WHITE; + s_video_drivers.textcolor2 = CT_WHITE; + s_video_drivers.generic.flags = QMF_GRAYED; + } + else + { + s_video_drivers.textcolor = CT_BLACK; + s_video_drivers.textcolor2 = CT_WHITE; + } + + Menu_AddItem(menu, (void *)&s_video_data); + Menu_AddItem(menu, (void *)&s_video_data2); + Menu_AddItem(menu, (void *)&s_video_drivers); + + UI_LogFuncEnd(); +} + + +/* +================= +VideoDriver_Lines +================= +*/ +void VideoDriver_Lines(int32_t increment) +{ + int32_t i, i2; + + UI_LogFuncBegin(); + + s_videodriver.currentDriverLine += increment; + + i = 0; + i2 = 0; + + i = (s_videodriver.currentDriverLine * 2); + if (i<0) + { + s_videodriver.currentDriverLine = 0; + UI_LogFuncEnd(); + return; + } + + if (i>s_videodriver.driverCnt) + { + s_videodriver.currentDriverLine = (s_videodriver.driverCnt / 2); + UI_LogFuncEnd(); + return; + } + else if (i == s_videodriver.driverCnt) + { + s_videodriver.currentDriverLine = (s_videodriver.driverCnt / 2) - 1; + UI_LogFuncEnd(); + return; + } + + if (!s_videodriver.drivers[i + 22]) + { + s_videodriver.currentDriverLine -= increment; + s_videodriver.activeArrowDwn = qfalse; + UI_LogFuncEnd(); + return; + } + + for (; i < MAX_VID_DRIVERS; i++) + { + if (s_videodriver.drivers[i]) + { + if (i2 < 24) + { + ((menutext_s *)g_videolines[i2])->string = s_videodriver.drivers[i]; + i2++; + } + } + else + { + if (i2 < 24) + { + ((menutext_s *)g_videolines[i2])->string = NULL; + i2++; + } + else + { + break; + } + } + } + + // Set up arrows + + if (increment > 0) + { + s_videodriver.activeArrowUp = qtrue; + } + + if (s_videodriver.currentDriverLine < 1) + { + s_videodriver.activeArrowUp = qfalse; + } + + if (i2 >= 24) + { + s_videodriver.activeArrowDwn = qtrue; + } + + i = (s_videodriver.currentDriverLine * 2); + if (!s_videodriver.drivers[i + 24]) + { + s_videodriver.activeArrowDwn = qfalse; + UI_LogFuncEnd(); + return; + } + UI_LogFuncEnd(); + +} + +/* +================= +VideoDriver_LineSetup +================= +*/ +void VideoDriver_LineSetup(void) +{ + UI_LogFuncBegin(); + char *bufhold; + char *eptr; + int32_t i; + + strcpy(s_videodriver.extensionsString, uis.glconfig.extensions_string); + eptr = s_videodriver.extensionsString; + i = 0; + + s_videodriver.driverCnt = 0; + + while (i < MAX_VID_DRIVERS && *eptr) + { + while (*eptr) + { + bufhold = eptr; + + while (*bufhold != ' ') + { + ++bufhold; + } + *bufhold = 0; + + s_videodriver.drivers[i] = eptr; + + if (i < 24) + { + ((menutext_s *)g_videolines[i])->string = eptr; + } + + bufhold++; + eptr = bufhold; + s_videodriver.driverCnt++; + i++; + } + } + + // Set down arrows + if (i > 24) + { + s_videodriver.activeArrowDwn = qtrue; + } + + s_videodriver.currentDriverLine = 0; + UI_LogFuncEnd(); + +} + +/* +================= +VideoDriver_MenuKey +================= +*/ +sfxHandle_t VideoDriver_MenuKey(int32_t key) +{ + return (Menu_DefaultKey(&s_videodriver.menu, key)); +} + +/* +================= +M_VideoDriverMenu_Graphics +================= +*/ +void M_VideoDriverMenu_Graphics(void) +{ + float labelColor[] = { 0, 1.0, 0, 1.0 }; + float textColor[] = { 1, 1, 1, 1 }; + int32_t x, y, x2; + + UI_LogFuncBegin(); + UI_MenuFrame(&s_videodriver.menu); + + UI_DrawProportionalString(74, 66, "207", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 84, "44909", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 188, "357", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 206, "250624", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 395, "456730-1", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + + UI_Setup_MenuButtons(); + + // Top Frame + UI_DrawHandlePic(178, 136, 32, -32, s_videodriver.corner_ll_8_16); // UL + UI_DrawHandlePic(178, 221, 32, 32, s_videodriver.corner_ll_8_16); // LL + UI_DrawHandlePic(556, 136, -32, -32, s_videodriver.corner_ll_8_16); // UR + UI_DrawHandlePic(556, 221, -32, 32, s_videodriver.corner_ll_8_16); // LR + UI_DrawHandlePic(194, 157, 378, 8, uis.whiteShader); // Top line + UI_DrawHandlePic(178, 165, 16, 60, uis.whiteShader); // Left side + UI_DrawHandlePic(572, 165, 16, 60, uis.whiteShader); // Right side + UI_DrawHandlePic(194, 224, 378, 8, uis.whiteShader); // Bottom line + + + // Lower Frame + UI_DrawHandlePic(178, 226, 32, -32, s_videodriver.corner_ll_16_16); // UL + UI_DrawHandlePic(178, 414, 32, 32, s_videodriver.corner_ll_16_16); // LL + UI_DrawHandlePic(556, 226, -32, -32, s_videodriver.corner_ll_16_16); // UR + UI_DrawHandlePic(556, 414, -32, 32, s_videodriver.corner_ll_16_16); // LR + + UI_DrawHandlePic(194, 237, 378, 16, uis.whiteShader); // Top line + UI_DrawHandlePic(178, 252, 16, 168, uis.whiteShader); // Left side + + UI_DrawHandlePic(572, 261, 16, 15, uis.whiteShader); // Right side + UI_DrawHandlePic(572, 279, 16, 114, uis.whiteShader); // Right side + UI_DrawHandlePic(572, 396, 16, 15, uis.whiteShader); // Right side + + UI_DrawHandlePic(194, 419, 378, 16, uis.whiteShader); // Bottom line + + trap_R_SetColor(colorTable[CT_LTGOLD1]); + if (s_videodriver.activeArrowUp) + { + UI_DrawHandlePic(382, 237, 32, -14, s_videodriver.arrow_dn); + } + + if (s_videodriver.activeArrowDwn) + { + UI_DrawHandlePic(382, 422, 32, 14, s_videodriver.arrow_dn); + } + + x = 204; + x2 = 259; + y = 168; + UI_DrawProportionalString(x, y, menu_normal_text[MNT_VENDOR], UI_LEFT | UI_TINYFONT, labelColor); + UI_DrawProportionalString(x2, y, uis.glconfig.vendor_string, UI_LEFT | UI_TINYFONT, textColor); + y += 14; + UI_DrawProportionalString(x, y, menu_normal_text[MNT_VERSION], UI_LEFT | UI_TINYFONT, labelColor); + UI_DrawProportionalString(x2, y, uis.glconfig.version_string, UI_LEFT | UI_TINYFONT, textColor); + y += 14; + UI_DrawProportionalString(x, y, menu_normal_text[MNT_RENDERER], UI_LEFT | UI_TINYFONT, labelColor); + UI_DrawProportionalString(x2, y, uis.glconfig.renderer_string, UI_LEFT | UI_TINYFONT, textColor); + y += 14; + UI_DrawProportionalString(x, y, menu_normal_text[MNT_PIXELFORMAT], UI_LEFT | UI_TINYFONT, labelColor); + UI_DrawProportionalString(x2, y, va("color(%d-bits) Z(%d-bit) stencil(%d-bits)", uis.glconfig.colorBits, uis.glconfig.depthBits, uis.glconfig.stencilBits), UI_LEFT | UI_TINYFONT, textColor); + + UI_LogFuncEnd(); +} + +/* +================= +VideoDriver_MenuDraw +================= +*/ +static void VideoDriver_MenuDraw(void) +{ + UI_LogFuncBegin(); + M_VideoDriverMenu_Graphics(); + + Menu_Draw(&s_videodriver.menu); + UI_LogFuncEnd(); +} + +/* +================= +UI_VideoDriverMenu_Cache +================= +*/ +void UI_VideoDriverMenu_Cache(void) +{ + UI_LogFuncBegin(); + s_videodriver.corner_ll_16_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_16_16.tga"); + s_videodriver.corner_ll_8_16 = trap_R_RegisterShaderNoMip("menu/common/corner_ll_8_16.tga"); + s_videodriver.arrow_dn = trap_R_RegisterShaderNoMip("menu/common/arrow_dn_16.tga"); + UI_LogFuncEnd(); +} + + +/* +================= +Video_MenuInit +================= +*/ +static void VideoDriver_MenuInit(void) +{ + int32_t i, x, y, x2; + + UI_LogFuncBegin(); + UI_VideoDriverMenu_Cache(); + + s_videodriver.menu.nitems = 0; + s_videodriver.menu.wrapAround = qtrue; + // s_videodriver.menu.opening = NULL; + // s_videodriver.menu.closing = NULL; + s_videodriver.menu.draw = VideoDriver_MenuDraw; + s_videodriver.menu.key = VideoDriver_MenuKey; + s_videodriver.menu.fullscreen = qtrue; + s_videodriver.menu.descX = MENU_DESC_X; + s_videodriver.menu.descY = MENU_DESC_Y; + s_videodriver.menu.listX = 230; + s_videodriver.menu.listY = 188; + s_videodriver.menu.titleX = MENU_TITLE_X; + s_videodriver.menu.titleY = MENU_TITLE_Y; + s_videodriver.menu.titleI = MNT_CONTROLSMENU_TITLE; + s_videodriver.menu.footNoteEnum = MNT_VIDEODRIVER; + + SetupMenu_TopButtons(&s_videodriver.menu, MENU_VIDEO, NULL); + + Video_SideButtons(&s_videodriver.menu, ID_VIDEODRIVERS); + + s_videodriver.arrowup.generic.type = MTYPE_BITMAP; + s_videodriver.arrowup.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodriver.arrowup.generic.x = 572; + s_videodriver.arrowup.generic.y = 262; + s_videodriver.arrowup.generic.name = "menu/common/arrow_up_16.tga"; + s_videodriver.arrowup.generic.id = ID_ARROWUP; + s_videodriver.arrowup.generic.callback = Video_MenuEvent; + s_videodriver.arrowup.width = 16; + s_videodriver.arrowup.height = 16; + s_videodriver.arrowup.color = CT_DKBLUE1; + s_videodriver.arrowup.color2 = CT_LTBLUE1; + s_videodriver.arrowup.textX = 0; + s_videodriver.arrowup.textY = 0; + s_videodriver.arrowup.textEnum = MBT_NONE; + s_videodriver.arrowup.textcolor = CT_BLACK; + s_videodriver.arrowup.textcolor2 = CT_WHITE; + Menu_AddItem(&s_videodriver.menu, (void *)&s_videodriver.arrowup); + + s_videodriver.arrowdwn.generic.type = MTYPE_BITMAP; + s_videodriver.arrowdwn.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodriver.arrowdwn.generic.x = 572; + s_videodriver.arrowdwn.generic.y = 397; + s_videodriver.arrowdwn.generic.name = "menu/common/arrow_dn_16.tga"; + s_videodriver.arrowdwn.generic.id = ID_ARROWDWN; + s_videodriver.arrowdwn.generic.callback = Video_MenuEvent; + s_videodriver.arrowdwn.width = 16; + s_videodriver.arrowdwn.height = 16; + s_videodriver.arrowdwn.color = CT_DKBLUE1; + s_videodriver.arrowdwn.color2 = CT_LTBLUE1; + s_videodriver.arrowdwn.textX = 0; + s_videodriver.arrowdwn.textY = 0; + s_videodriver.arrowdwn.textEnum = MBT_NONE; + s_videodriver.arrowdwn.textcolor = CT_BLACK; + s_videodriver.arrowdwn.textcolor2 = CT_WHITE; + Menu_AddItem(&s_videodriver.menu, (void *)&s_videodriver.arrowdwn); + + s_videodriver.activeArrowDwn = qfalse; + s_videodriver.activeArrowUp = qfalse; + + x = 204; + x2 = 404; + y = 260; + + for (i = 0; i < 24; i++) + { + ((menutext_s *)g_videolines[i])->generic.type = MTYPE_TEXT; + ((menutext_s *)g_videolines[i])->generic.flags = QMF_LEFT_JUSTIFY | QMF_INACTIVE; + ((menutext_s *)g_videolines[i])->generic.y = y; + if ((i % 2) == 0) + { + ((menutext_s *)g_videolines[i])->generic.x = x; + } + else + { + ((menutext_s *)g_videolines[i])->generic.x = x2; + y += 13; + } + + + ((menutext_s *)g_videolines[i])->buttontextEnum = MBT_NONE; + ((menutext_s *)g_videolines[i])->style = UI_TINYFONT | UI_LEFT; + ((menutext_s *)g_videolines[i])->color = colorTable[CT_LTPURPLE1]; + Menu_AddItem(&s_videodriver.menu, (void *)g_videolines[i]); + + } + + // Print extensions + VideoDriver_LineSetup(); + UI_LogFuncEnd(); +} + + +/* +================= +UI_VideoDriverMenu +================= +*/ +void UI_VideoDriverMenu(void) +{ + UI_LogFuncBegin(); + if (!s_videodriver.menu.initialized) + { + VideoDriver_MenuInit(); + } + + UI_PushMenu(&s_videodriver.menu); + UI_LogFuncEnd(); +} + +/* +================= +GammaCallback2 +================= +*/ +void GammaCallback2(void *s, int32_t notification) +{ + UI_LogFuncBegin(); + if (notification != QM_ACTIVATED){ + UI_LogFuncEnd(); + return; + } + + s_videodata2.apply_action2.generic.flags &= ~QMF_GRAYED; + s_videodata2.apply_action2.generic.flags |= QMF_BLINK; + + GammaCallback(s, notification); + UI_LogFuncEnd(); + +} + + +/* +================= +M_VideoData2Menu_Graphics +================= +*/ +void M_VideoData2Menu_Graphics(void) +{ + int32_t y; + + UI_LogFuncBegin(); + UI_MenuFrame(&s_videodata2.menu); + + UI_DrawProportionalString(74, 66, "925", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 84, "88PK", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 188, "8125", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 206, "358677", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + UI_DrawProportionalString(74, 395, "3-679", UI_RIGHT | UI_TINYFONT, colorTable[CT_BLACK]); + + UI_Setup_MenuButtons(); + + y = 191; + if (uis.glconfig.deviceSupportsGamma) + { + trap_R_SetColor(colorTable[CT_DKGREY]); + UI_DrawHandlePic(178, y, 68, 68, uis.whiteShader); // + trap_R_SetColor(colorTable[CT_WHITE]); + UI_DrawHandlePic(180, y + 2, 64, 64, s_videodata2.gamma); // Starfleet graphic + + UI_DrawProportionalString(256, y + 5, menu_normal_text[MNT_GAMMA_LINE1], UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString(256, y + 25, menu_normal_text[MNT_GAMMA_LINE2], UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString(256, y + 45, menu_normal_text[MNT_GAMMA_LINE3], UI_SMALLFONT, colorTable[CT_LTGOLD1]); + } + else + { + UI_DrawProportionalString(178, y + 5, menu_normal_text[MNT_GAMMA2_LINE1], UI_SMALLFONT, colorTable[CT_LTGOLD1]); + UI_DrawProportionalString(178, y + 25, menu_normal_text[MNT_GAMMA2_LINE2], UI_SMALLFONT, colorTable[CT_LTGOLD1]); + } + + + // Brackets around Video Data + trap_R_SetColor(colorTable[CT_LTPURPLE1]); + UI_DrawHandlePic(158, 163, 16, 16, uis.graphicBracket1CornerLU); + UI_DrawHandlePic(158, 179, 8, 233, uis.whiteShader); + UI_DrawHandlePic(158, 412, 16, -16, uis.graphicBracket1CornerLU); //LD + + UI_DrawHandlePic(174, 163, 408, 8, uis.whiteShader); // Top line + + UI_DrawHandlePic(579, 163, 32, 16, s_videodata2.top); // Corner, UR + UI_DrawHandlePic(581, 179, 30, 121, uis.whiteShader); // Top right column + UI_DrawHandlePic(581, 303, 30, 109, uis.whiteShader); // Bottom right column + UI_DrawHandlePic(579, 412, 32, -16, s_videodata2.top); // Corner, LR + + UI_DrawHandlePic(174, 420, 408, 8, uis.whiteShader); // Bottom line + UI_LogFuncEnd(); +} + +/* +================= +VideoData2_MenuDraw +================= +*/ +static void VideoData2_MenuDraw(void) +{ + UI_LogFuncBegin(); + M_VideoData2Menu_Graphics(); + + Menu_Draw(&s_videodata2.menu); + UI_LogFuncEnd(); +} + + +/* +================= +UI_VideoData2Menu_Cache +================= +*/ +void UI_VideoData2Menu_Cache(void) +{ + UI_LogFuncBegin(); + s_videodata2.top = trap_R_RegisterShaderNoMip("menu/common/corner_ur_8_30.tga"); + s_videodata2.gamma = trap_R_RegisterShaderNoMip("menu/special/gamma_test.tga"); + trap_R_RegisterShaderNoMip(PIC_MONBAR2); + trap_R_RegisterShaderNoMip(PIC_SLIDER); + UI_LogFuncEnd(); +} + +/* +================= +VideoData2_MenuInit +================= +*/ +static void VideoData2_MenuInit(void) +{ + int32_t x, y; + + UI_LogFuncBegin(); + UI_VideoData2Menu_Cache(); + + // Menu Data + s_videodata2.menu.nitems = 0; + s_videodata2.menu.wrapAround = qtrue; + // s_videodata2.menu.opening = NULL; + // s_videodata2.menu.closing = NULL; + s_videodata2.menu.draw = VideoData2_MenuDraw; + s_videodata2.menu.fullscreen = qtrue; + s_videodata2.menu.descX = MENU_DESC_X; + s_videodata2.menu.descY = MENU_DESC_Y; + s_videodata2.menu.listX = 230; + s_videodata2.menu.listY = 188; + s_videodata2.menu.titleX = MENU_TITLE_X; + s_videodata2.menu.titleY = MENU_TITLE_Y; + s_videodata2.menu.titleI = MNT_CONTROLSMENU_TITLE; + s_videodata2.menu.footNoteEnum = MNT_VIDEOSETUP; + + SetupMenu_TopButtons(&s_videodata2.menu, MENU_VIDEO, NULL); + + Video_SideButtons(&s_videodata2.menu, ID_VIDEODATA2); + + x = 180; + y = 269; + s_videodata2.gamma_slider.generic.type = MTYPE_SLIDER; + s_videodata2.gamma_slider.generic.x = x + 162; + s_videodata2.gamma_slider.generic.y = y; + s_videodata2.gamma_slider.generic.flags = QMF_SMALLFONT; + s_videodata2.gamma_slider.generic.callback = GammaCallback2; + s_videodata2.gamma_slider.minvalue = 5; + s_videodata2.gamma_slider.maxvalue = 30; + s_videodata2.gamma_slider.color = CT_DKPURPLE1; + s_videodata2.gamma_slider.color2 = CT_LTPURPLE1; + s_videodata2.gamma_slider.generic.name = PIC_MONBAR2; + s_videodata2.gamma_slider.width = 256; + s_videodata2.gamma_slider.height = 32; + s_videodata2.gamma_slider.focusWidth = 145; + s_videodata2.gamma_slider.focusHeight = 18; + s_videodata2.gamma_slider.picName = (char*)GRAPHIC_SQUARE; + s_videodata2.gamma_slider.picX = x; + s_videodata2.gamma_slider.picY = y; + s_videodata2.gamma_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_videodata2.gamma_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_videodata2.gamma_slider.textX = MENU_BUTTON_TEXT_X; + s_videodata2.gamma_slider.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.gamma_slider.textEnum = MBT_BRIGHTNESS; + s_videodata2.gamma_slider.textcolor = CT_BLACK; + s_videodata2.gamma_slider.textcolor2 = CT_WHITE; + s_videodata2.gamma_slider.thumbName = (char*)PIC_SLIDER; + s_videodata2.gamma_slider.thumbHeight = 32; + s_videodata2.gamma_slider.thumbWidth = 16; + s_videodata2.gamma_slider.thumbGraphicWidth = 9; + s_videodata2.gamma_slider.thumbColor = CT_DKBLUE1; + s_videodata2.gamma_slider.thumbColor2 = CT_LTBLUE1; + + s_videodata2.apply_action2.generic.type = MTYPE_ACTION; + s_videodata2.apply_action2.generic.flags = QMF_HIGHLIGHT_IF_FOCUS | QMF_GRAYED; + s_videodata2.apply_action2.generic.x = 490; + s_videodata2.apply_action2.generic.y = 191; + s_videodata2.apply_action2.generic.callback = ApplyChanges2; + s_videodata2.apply_action2.textEnum = MBT_ACCEPT; + s_videodata2.apply_action2.textcolor = CT_BLACK; + s_videodata2.apply_action2.textcolor2 = CT_WHITE; + s_videodata2.apply_action2.textcolor3 = CT_LTGREY; + s_videodata2.apply_action2.color = CT_DKPURPLE1; + s_videodata2.apply_action2.color2 = CT_LTPURPLE1; + s_videodata2.apply_action2.color3 = CT_DKGREY; + s_videodata2.apply_action2.textX = 5; + s_videodata2.apply_action2.textY = 30; + s_videodata2.apply_action2.width = 82; + s_videodata2.apply_action2.height = 70; + + y = 330; + s_videodata2.screensize_slider.generic.type = MTYPE_SLIDER; + s_videodata2.screensize_slider.generic.x = x + 162; + s_videodata2.screensize_slider.generic.y = y; + s_videodata2.screensize_slider.generic.flags = QMF_SMALLFONT; + s_videodata2.screensize_slider.generic.callback = ScreensizeCallback; + s_videodata2.screensize_slider.minvalue = 30; + s_videodata2.screensize_slider.maxvalue = 100; + s_videodata2.screensize_slider.color = CT_DKPURPLE1; + s_videodata2.screensize_slider.color2 = CT_LTPURPLE1; + s_videodata2.screensize_slider.generic.name = PIC_MONBAR2; + s_videodata2.screensize_slider.width = 256; + s_videodata2.screensize_slider.height = 32; + s_videodata2.screensize_slider.focusWidth = 145; + s_videodata2.screensize_slider.focusHeight = 18; + s_videodata2.screensize_slider.picName = (char*)GRAPHIC_SQUARE; + s_videodata2.screensize_slider.picX = x; + s_videodata2.screensize_slider.picY = y; + s_videodata2.screensize_slider.picWidth = MENU_BUTTON_MED_WIDTH + 21; + s_videodata2.screensize_slider.picHeight = MENU_BUTTON_MED_HEIGHT; + s_videodata2.screensize_slider.textX = MENU_BUTTON_TEXT_X; + s_videodata2.screensize_slider.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.screensize_slider.textEnum = MBT_SCREENSIZE; + s_videodata2.screensize_slider.textcolor = CT_BLACK; + s_videodata2.screensize_slider.textcolor2 = CT_WHITE; + s_videodata2.screensize_slider.thumbName = (char*)PIC_SLIDER; + s_videodata2.screensize_slider.thumbHeight = 32; + s_videodata2.screensize_slider.thumbWidth = 16; + s_videodata2.screensize_slider.thumbGraphicWidth = 9; + s_videodata2.screensize_slider.thumbColor = CT_DKBLUE1; + s_videodata2.screensize_slider.thumbColor2 = CT_LTBLUE1; + + y += 34; + s_videodata2.anisotropicfiltering.generic.type = MTYPE_SPINCONTROL; + s_videodata2.anisotropicfiltering.generic.flags = QMF_HIGHLIGHT_IF_FOCUS; + s_videodata2.anisotropicfiltering.generic.x = x; + s_videodata2.anisotropicfiltering.generic.y = y; + s_videodata2.anisotropicfiltering.generic.name = GRAPHIC_BUTTONRIGHT; + s_videodata2.anisotropicfiltering.generic.callback = AnisotropicFilteringCallback; + s_videodata2.anisotropicfiltering.color = CT_DKPURPLE1; + s_videodata2.anisotropicfiltering.color2 = CT_LTPURPLE1; + s_videodata2.anisotropicfiltering.textX = MENU_BUTTON_TEXT_X; + s_videodata2.anisotropicfiltering.textY = MENU_BUTTON_TEXT_Y; + s_videodata2.anisotropicfiltering.textEnum = MBT_ANISOTROPICFILTERING; + s_videodata2.anisotropicfiltering.textcolor = CT_BLACK; + s_videodata2.anisotropicfiltering.textcolor2 = CT_WHITE; + s_videodata2.anisotropicfiltering.listnames = s_OffOnNone_Names; + + + Menu_AddItem(&s_videodata2.menu, (void *)&s_videodata2.gamma_slider); + if (!uis.glconfig.deviceSupportsGamma) + { + Menu_AddItem(&s_videodata2.menu, (void *)&s_videodata2.apply_action2); + } + Menu_AddItem(&s_videodata2.menu, (void *)&s_videodata2.screensize_slider); + Menu_AddItem(&s_videodata2.menu, (void *)&s_videodata2.anisotropicfiltering); + UI_LogFuncEnd(); + +} + +/* +================= +UI_VideoData2SettingsGetCvars +================= +*/ +static void UI_VideoData2SettingsGetCvars(void) +{ + UI_LogFuncBegin(); + s_videodata2.gamma_slider.curvalue = trap_Cvar_VariableValue("r_gamma") * 10.0f; + s_videodata2.screensize_slider.curvalue = trap_Cvar_VariableValue("cg_viewsize"); + s_videodata2.anisotropicfiltering.curvalue = trap_Cvar_VariableValue("r_ext_texture_filter_anisotropic"); + UI_LogFuncEnd(); +} + +/* +================= +UI_VideoData2SettingsMenu +================= +*/ +void UI_VideoData2SettingsMenu(void) +{ + UI_LogFuncBegin(); + UI_VideoData2SettingsGetCvars(); + + if (!s_videodata2.menu.initialized) + { + VideoData2_MenuInit(); + } + + UI_PushMenu(&s_videodata2.menu); + UI_LogFuncEnd(); +} +