21 Dec 2009

This commit is contained in:
g-cont 2009-12-21 00:00:00 +03:00 committed by Alibek Omarov
parent b69d3322d9
commit 9d5ef815e3
15 changed files with 163 additions and 79 deletions

View File

@ -477,7 +477,9 @@ void SCR_Init( void )
SCR_RegisterShaders();
UI_Init();
UI_SetActiveMenu( UI_MAINMENU );
if( host.developer && FS_CheckParm( "-toconsole" ))
Cbuf_AddText( "toggleconsole\n" );
else UI_SetActiveMenu( UI_MAINMENU );
SCR_InitCinematic();
scr_init = true;

View File

@ -353,6 +353,19 @@ SCREEN CONSTS
*/
extern rgba_t g_color_table[8];
// basic console charwidths
#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
#define SMALLCHAR_WIDTH 8
#define SMALLCHAR_HEIGHT 16
#define BIGCHAR_WIDTH 16
#define BIGCHAR_HEIGHT 24
#define GIANTCHAR_WIDTH 32
#define GIANTCHAR_HEIGHT 48
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
//
// cvars
//

View File

@ -23,28 +23,9 @@
#define MAX_ENTNUMBER 99999 // for server and client parsing
#define MAX_HEARTBEAT -99999 // connection time
/*
==============================================================
SCREEN GLOBAL INFO
==============================================================
*/
// basic console charwidths
#define TINYCHAR_WIDTH (SMALLCHAR_WIDTH)
#define TINYCHAR_HEIGHT (SMALLCHAR_HEIGHT/2)
#define SMALLCHAR_WIDTH 8
#define SMALLCHAR_HEIGHT 16
#define BIGCHAR_WIDTH 16
#define BIGCHAR_HEIGHT 24
#define GIANTCHAR_WIDTH 32
#define GIANTCHAR_HEIGHT 48
#define SCREEN_WIDTH 640
#define SCREEN_HEIGHT 480
extern cvar_t *scr_width;
extern cvar_t *scr_height;
extern cvar_t *allow_download;
extern cvar_t *scr_width;
extern cvar_t *scr_height;
extern cvar_t *allow_download;
/*
==============================================================
@ -61,7 +42,7 @@ typedef enum
HOST_ERROR, // host stopped by error
HOST_SLEEP, // sleeped by different reason, e.g. minimize window
HOST_NOFOCUS, // same as HOST_FRAME, but disable mouse
HOST_RESTART, // during the changes video mode
HOST_RESTART // during the changes video mode
} host_state;
typedef enum
@ -212,6 +193,7 @@ void CIN_Init( void );
void CIN_ReadChunk( cinematics_t *cin );
byte *CIN_ReadNextFrame( cinematics_t *cin, bool silent );
// shared calls
int CL_GetServerTime( void );
float CL_GetLerpFrac( void );
void CL_CharEvent( int key );

View File

@ -730,6 +730,7 @@ autocomplete_list_t cmd_list[] =
{ "playsound", Cmd_GetSoundList },
{ "changelevel", Cmd_GetMapList },
{ "playdemo", Cmd_GetDemoList, },
{ "menufont", Cmd_GetFontList, },
{ "setfont", Cmd_GetFontList, },
{ "music", Cmd_GetSoundList, },
{ "movie", Cmd_GetMovieList },

View File

@ -701,6 +701,7 @@ void Host_InitCommon( const int argc, const char **argv )
newcom.error = Host_Error;
// check developer mode
if(FS_CheckParm( "-console" )) host.developer = 1;
if( FS_GetParmFromCmdLine( "-dev", dev_level ))
host.developer = com.atoi( dev_level );

View File

@ -232,6 +232,8 @@ void UI_Bitmap_Draw( menuBitmap_s *b );
// =====================================================================
// Main menu interface
extern cvar_t *ui_mainfont;
extern cvar_t *ui_confont;
extern cvar_t *ui_precache;
extern cvar_t *ui_sensitivity;
extern render_exp_t *re;
@ -256,6 +258,9 @@ typedef struct
bool enterSound;
bool visible;
bool initialized;
shader_t conFont;
shader_t menuFont;
} uiStatic_t;
extern uiStatic_t uiStatic;
@ -298,7 +303,8 @@ bool UI_CursorInRect( int x, int y, int w, int h );
void UI_DrawPic( int x, int y, int w, int h, const rgba_t color, const char *pic );
void UI_FillRect( int x, int y, int w, int h, const rgba_t color );
void UI_DrawRectangle( int in_x, int in_y, int in_w, int in_h, const rgba_t color );
void UI_DrawString( int x, int y, int w, int h, const char *string, const rgba_t color, bool forceColor, int charW, int charH, int justify, bool shadow );
#define UI_DrawString( x, y, w, h, str, col, fcol, cw, ch, j, s ) UI_DrawStringExt( x, y, w, h, str, col, fcol, cw, ch, j, s, uiStatic.menuFont )
void UI_DrawStringExt( int x, int y, int w, int h, const char *str, const rgba_t col, bool forceCol, int charW, int charH, int justify, bool shadow, shader_t font );
void UI_StartSound( const char *sound );
void UI_AddItem ( menuFramework_s *menu, void *item );

View File

@ -366,14 +366,14 @@ static void UI_Main_Init( void )
uiMain.quitMessage.generic.id = ID_MSGBOX;
uiMain.quitMessage.generic.type = QMTYPE_ACTION;
uiMain.quitMessage.generic.flags = QMF_INACTIVE|QMF_HIDDEN;
uiMain.quitMessage.generic.flags = QMF_INACTIVE|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.quitMessage.generic.name = "Are you sure you want to quit?";
uiMain.quitMessage.generic.x = 248;
uiMain.quitMessage.generic.y = 280;
uiMain.yes.generic.id = ID_YES;
uiMain.yes.generic.type = QMTYPE_ACTION;
uiMain.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiMain.yes.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.yes.generic.name = "Ok";
uiMain.yes.generic.x = 380;
uiMain.yes.generic.y = 460;
@ -381,7 +381,7 @@ static void UI_Main_Init( void )
uiMain.no.generic.id = ID_NO;
uiMain.no.generic.type = QMTYPE_ACTION;
uiMain.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_HIDDEN;
uiMain.no.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_HIDDEN;
uiMain.no.generic.name = "Cancel";
uiMain.no.generic.x = 530;
uiMain.no.generic.y = 460;

View File

@ -26,8 +26,10 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "client.h"
#include "input.h"
cvar_t *ui_precache;
cvar_t *ui_sensitivity;
cvar_t *ui_mainfont;
cvar_t *ui_confont;
cvar_t *ui_precache;
cvar_t *ui_sensitivity;
uiStatic_t uiStatic;
@ -168,12 +170,12 @@ void UI_DrawRectangle( int in_x, int in_y, int in_w, int in_h, const rgba_t colo
UI_DrawString
=================
*/
void UI_DrawString( int x, int y, int w, int h, const char *string, const rgba_t color, bool forceColor, int charW, int charH, int justify, bool shadow )
void UI_DrawStringExt( int x, int y, int w, int h, const char *string, const rgba_t color, bool forceColor, int charW, int charH, int justify, bool shadow, shader_t font )
{
rgba_t modulate, shadowModulate;
char line[1024], *l;
int xx, yy, ofsX, ofsY, len, ch;
float col, row;
float col, row, size;
if( !re || !string || !string[0] )
return;
@ -237,16 +239,17 @@ void UI_DrawString( int x, int y, int w, int h, const char *string, const rgba_t
ch &= 255;
if( ch != ' ' )
{
col = (ch & 15) * 0.0625;
row = (ch >> 4) * 0.0625;
col = (ch & 15) * 0.0625 + (0.5f / 256.0f);
row = (ch >> 4) * 0.0625 + (0.5f / 256.0f);
size = 0.0625f - (1.0f / 256.0f);
if( shadow )
{
re->SetColor( shadowModulate );
re->DrawStretchPic( xx + ofsX, yy + ofsY, charW, charH, col, row, col + 0.0625, row + 0.0625, cls.clientFont );
re->DrawStretchPic( xx + ofsX, yy + ofsY, charW, charH, col, row, col + size, row + size, font );
}
re->SetColor( modulate );
re->DrawStretchPic( xx, yy, charW, charH, col, row, col + 0.0625, row + 0.0625, cls.clientFont );
re->DrawStretchPic( xx, yy, charW, charH, col, row, col + size, row + size, font );
}
xx += charW;
}
@ -537,8 +540,8 @@ void UI_DrawMenu( menuFramework_s *menu )
// fade it in, but wait a second
color[3] = bound( 0.0, ((uiStatic.realTime - statusFadeTime) - 1000) * 0.001f, 1.0f ) * 255;
UI_DrawString( 0, 720 * uiStatic.scaleY, 1024 * uiStatic.scaleX, 28 * uiStatic.scaleY, item->statusText, color, true,
UI_SMALL_CHAR_WIDTH * uiStatic.scaleX, UI_SMALL_CHAR_HEIGHT * uiStatic.scaleY, 1, true );
UI_DrawStringExt( 0, 720 * uiStatic.scaleY, 1024 * uiStatic.scaleX, 28 * uiStatic.scaleY, item->statusText, color, true,
UI_SMALL_CHAR_WIDTH * uiStatic.scaleX, UI_SMALL_CHAR_HEIGHT * uiStatic.scaleY, 1, true, uiStatic.conFont );
}
else statusFadeTime = uiStatic.realTime;
}
@ -1033,6 +1036,37 @@ void UI_Precache( void )
UI_Credits_Precache();
}
/*
====================
UI_SetFont_f
menufont <fontname> <con>
====================
*/
void UI_SetFont_f( void )
{
if( Cmd_Argc() < 2 )
{
Msg( "Usage: menufont <fontname> <console>\n" );
return;
}
switch(Cmd_Argc( ))
{
case 2:
Cvar_Set( "ui_mainfont", Cmd_Argv( 1 ));
uiStatic.menuFont = re->RegisterShader( va( "gfx/fonts/%s", ui_mainfont->string ), SHADER_FONT );
break;
case 3:
Cvar_Set( "ui_confont", Cmd_Argv( 1 ));
uiStatic.conFont = re->RegisterShader( va( "gfx/fonts/%s", ui_confont->string ), SHADER_FONT );
break;
default:
Msg( "menufont: invalid aruments\n" );
break;
}
}
/*
=================
UI_Init
@ -1043,7 +1077,10 @@ void UI_Init( void )
// register our cvars and commands
ui_precache = Cvar_Get( "ui_precache", "0", CVAR_ARCHIVE, "enable precache all resources for menu" );
ui_sensitivity = Cvar_Get( "ui_sensitivity", "1", CVAR_ARCHIVE, "mouse sensitivity while in-menu" );
ui_mainfont= Cvar_Get( "ui_mainfont", "default", CVAR_ARCHIVE, "ui primary font (buttons, title, etc)" );
ui_confont = Cvar_Get( "ui_confont", "default", CVAR_ARCHIVE, "ui console font (hints, notify)" );
Cmd_AddCommand( "menufont", UI_SetFont_f, "set menu master/notify font" );
Cmd_AddCommand( "menu_main", UI_Main_Menu, "open the main menu" );
Cmd_AddCommand( "menu_newgame", UI_NewGame_Menu, "open the newgame menu" );
Cmd_AddCommand( "menu_loadgame", UI_LoadGame_Menu, "open the loadgame menu" );
@ -1063,6 +1100,12 @@ void UI_Init( void )
uiStatic.scaleX = scr_width->integer / 1024.0f;
uiStatic.scaleY = scr_height->integer / 768.0f;
if( re )
{
// register ui fonts
uiStatic.conFont = re->RegisterShader( va( "gfx/fonts/%s", ui_confont->string ), SHADER_FONT );
uiStatic.menuFont = re->RegisterShader( va( "gfx/fonts/%s", ui_mainfont->string ), SHADER_FONT );
}
uiStatic.initialized = true;
}
@ -1076,6 +1119,7 @@ void UI_Shutdown( void )
if( !uiStatic.initialized )
return;
Cmd_RemoveCommand( "menufont" );
Cmd_RemoveCommand( "menu_main" );
Cmd_RemoveCommand( "menu_newgame" );
Cmd_RemoveCommand( "menu_loadgame" );
@ -1094,7 +1138,7 @@ void UI_Shutdown( void )
Cmd_RemoveCommand( "menu_defaults" );
Cmd_RemoveCommand( "menu_cinematics" );
Cmd_RemoveCommand( "menu_demos" );
Cmd_RemoveCommand( "menu_mods" );
Cmd_RemoveCommand( "menu_customgame" );
Cmd_RemoveCommand( "menu_quit" );
Mem_Set( &uiStatic, 0, sizeof( uiStatic_t ));

View File

@ -216,7 +216,7 @@ static void UI_CustomGame_Init( void )
uiCustomGame.modList.generic.id = ID_MODLIST;
uiCustomGame.modList.generic.type = QMTYPE_SCROLLLIST;
uiCustomGame.modList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_DROPSHADOW|QMF_SMALLFONT;
uiCustomGame.modList.generic.flags = QMF_HIGHLIGHTIFFOCUS|QMF_SMALLFONT;
uiCustomGame.modList.generic.x = 360;
uiCustomGame.modList.generic.y = 255;
uiCustomGame.modList.generic.width = 640;

View File

@ -23,6 +23,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
#include "ui_local.h"
#include "client.h"
#include "const.h"
#include "input.h"

View File

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "common.h"
#include "ui_local.h"
#include "input.h"
#include "client.h"
rgba_t uiScrollOutlineColor = { 56, 56, 56, 255 };
rgba_t uiScrollSelColor = { 80, 56, 24, 255 };
@ -405,21 +406,21 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
if( sl->generic.flags & QMF_GRAYED )
{
UI_DrawString( x, y, w, h, sl->itemNames[i], uiColorDkGrey, true, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], uiColorDkGrey, true, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
continue; // grayed
}
if( i != sl->curItem )
{
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
continue; // no focus
}
if(!( sl->generic.flags & QMF_FOCUSBEHIND ))
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
if( sl->generic.flags & QMF_HIGHLIGHTIFFOCUS )
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.focusColor, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], sl->generic.focusColor, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
else if( sl->generic.flags & QMF_PULSEIFFOCUS )
{
rgba_t color;
@ -427,16 +428,16 @@ void UI_ScrollList_Draw( menuScrollList_s *sl )
*(uint *)color = *(uint *)sl->generic.color;
color[3] = 255 * (0.5 + 0.5 * com.sin( uiStatic.realTime / UI_PULSE_DIVISOR ));
UI_DrawString( x, y, w, h, sl->itemNames[i], color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
}
else if( sl->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.focusColor, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], sl->generic.focusColor, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
}
if( sl->generic.flags & QMF_FOCUSBEHIND )
UI_DrawString( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sl->itemNames[i], sl->generic.color, false, sl->generic.charWidth, sl->generic.charHeight, justify, shadow, uiStatic.conFont );
}
}
@ -635,7 +636,7 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
if( sc->generic.flags & QMF_GRAYED )
{
UI_DrawString( x, y, w, h, sc->generic.name, uiColorDkGrey, true, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, uiColorDkGrey, true, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, uiColorDkGrey, sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, uiColorDkGrey, sc->rightArrow );
return; // grayed
@ -643,7 +644,7 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
if((menuCommon_s *)sc != (menuCommon_s *)UI_ItemAtCursor(sc->generic.parent ))
{
UI_DrawString(x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt(x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic(leftX, leftY, arrowWidth, arrowHeight, sc->generic.color, sc->leftArrow);
UI_DrawPic(rightX, rightY, arrowWidth, arrowHeight, sc->generic.color, sc->rightArrow);
return; // No focus
@ -655,14 +656,14 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
if( !( sc->generic.flags & QMF_FOCUSBEHIND ))
{
UI_DrawString( x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, sc->generic.color, sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, sc->generic.color, sc->rightArrow );
}
if( sc->generic.flags & QMF_HIGHLIGHTIFFOCUS )
{
UI_DrawString( x, y, w, h, sc->generic.name, sc->generic.focusColor, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, sc->generic.focusColor, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, (leftFocus) ? sc->generic.focusColor : sc->generic.color, (leftFocus) ? sc->leftArrowFocus : sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, (rightFocus) ? sc->generic.focusColor : sc->generic.color, (rightFocus) ? sc->rightArrowFocus : sc->rightArrow );
}
@ -673,7 +674,7 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
*(uint *)color = *(uint *)sc->generic.color;
color[3] = 255 * (0.5 + 0.5 * sin( uiStatic.realTime / UI_PULSE_DIVISOR ));
UI_DrawString( x, y, w, h, sc->generic.name, color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, (leftFocus) ? color : sc->generic.color, (leftFocus) ? sc->leftArrowFocus : sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, (rightFocus) ? color : sc->generic.color, (rightFocus) ? sc->rightArrowFocus : sc->rightArrow );
}
@ -681,7 +682,7 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
{
UI_DrawString( x, y, w, h, sc->generic.name, sc->generic.focusColor, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, sc->generic.focusColor, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, (leftFocus) ? sc->generic.focusColor : sc->generic.color, (leftFocus) ? sc->leftArrowFocus : sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, (rightFocus) ? sc->generic.focusColor : sc->generic.color, (rightFocus) ? sc->rightArrowFocus : sc->rightArrow );
}
@ -689,7 +690,7 @@ void UI_SpinControl_Draw( menuSpinControl_s *sc )
if( sc->generic.flags & QMF_FOCUSBEHIND )
{
UI_DrawString( x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow );
UI_DrawStringExt( x, y, w, h, sc->generic.name, sc->generic.color, false, sc->generic.charWidth, sc->generic.charHeight, justify, shadow, uiStatic.conFont );
UI_DrawPic( leftX, leftY, arrowWidth, arrowHeight, sc->generic.color, sc->leftArrow );
UI_DrawPic( rightX, rightY, arrowWidth, arrowHeight, sc->generic.color, sc->rightArrow );
}
@ -804,7 +805,7 @@ const char *UI_Field_Key( menuField_s *f, int key )
}
// clipboard paste
if( key == K_INS && Key_IsDown( K_SHIFT ))
if(( key == K_INS && Key_IsDown( K_SHIFT )) || ( key == 'v' && Key_IsDown( K_CTRL )))
{
str = Sys_GetClipboardData();
if( !str ) return 0;
@ -986,30 +987,30 @@ void UI_Field_Draw( menuField_s *f )
if( f->generic.flags & QMF_GRAYED )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, uiColorDkGrey, true, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, uiColorDkGrey, true, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
return; // grayed
}
if((menuCommon_s *)f != (menuCommon_s *)UI_ItemAtCursor( f->generic.parent ))
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
return; // no focus
}
if( !( f->generic.flags & QMF_FOCUSBEHIND ))
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawStringExt( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow, uiStatic.conFont );
}
if( f->generic.flags & QMF_HIGHLIGHTIFFOCUS )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawStringExt( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow, uiStatic.conFont );
}
else if( f->generic.flags & QMF_PULSEIFFOCUS )
{
@ -1018,28 +1019,28 @@ void UI_Field_Draw( menuField_s *f )
*(uint *)color = *(uint *)f->generic.color;
color[3] = 255 * (0.5f + 0.5f * com.sin( uiStatic.realTime / UI_PULSE_DIVISOR ));
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawStringExt( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow, uiStatic.conFont );
}
else if( f->generic.flags & QMF_BLINKIFFOCUS )
{
if(( uiStatic.realTime & UI_BLINK_MASK ) < UI_BLINK_TIME )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.focusColor, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawStringExt( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.focusColor, true, f->generic.charWidth, f->generic.charHeight, 0, shadow, uiStatic.conFont );
}
}
if( f->generic.flags & QMF_FOCUSBEHIND )
{
UI_DrawString( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow );
UI_DrawStringExt( f->generic.x, f->generic.y, f->generic.width, f->generic.height, text, f->generic.color, false, f->generic.charWidth, f->generic.charHeight, justify, shadow, uiStatic.conFont );
if(( uiStatic.realTime & 499 ) < 250 )
UI_DrawString( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow );
UI_DrawStringExt( x + (cursor*f->generic.charWidth), f->generic.y, f->generic.charWidth, f->generic.height, "_", f->generic.color, true, f->generic.charWidth, f->generic.charHeight, 0, shadow, uiStatic.conFont );
}
}
@ -1170,7 +1171,7 @@ void UI_Action_Draw( menuAction_s *a )
UI_ScaleCoords( &x, NULL, &w, NULL );
x += a->generic.x;
UI_DrawString( x, a->generic.y, w, a->generic.height, a->generic.statusText, uiColorWhite, true, charW, charH, 0, true );
UI_DrawStringExt( x, a->generic.y, w, a->generic.height, a->generic.statusText, uiColorWhite, true, charW, charH, 0, true, uiStatic.conFont );
}
if((menuCommon_s *)a != (menuCommon_s *)UI_ItemAtCursor( a->generic.parent ))
{

View File

@ -901,6 +901,7 @@ void Sys_Init( void )
// parse and copy args into local array
if(FS_CheckParm( "-log" )) Sys.log_active = true;
if(FS_CheckParm( "-console" )) Sys.developer = 1;
if(FS_GetParmFromCmdLine( "-dev", dev_level, sizeof( dev_level )))
Sys.developer = com_atoi( dev_level );

View File

@ -293,6 +293,7 @@ void R_SetTextureParameters( void )
if( !texture->texnum ) continue; // free slot
GL_Bind( GL_TEXTURE0, texture );
// set texture filter
if( texture->flags & TF_DEPTHMAP )
{
// set texture filter
@ -305,15 +306,29 @@ void R_SetTextureParameters( void )
}
else if( texture->flags & TF_NOMIPMAP )
{
// set texture filter
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, r_textureMagFilter );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
if( texture->flags & TF_NEAREST )
{
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
else
{
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
}
}
else
{
// set texture filter
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, r_textureMinFilter );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
if( texture->flags & TF_NEAREST )
{
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
else
{
pglTexParameteri( texture->target, GL_TEXTURE_MIN_FILTER, r_textureMinFilter );
pglTexParameteri( texture->target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
}
// set texture anisotropy if available
if( GL_Support( R_ANISOTROPY_EXT ))
@ -2816,14 +2831,29 @@ void GL_TexFilter( texture_t *tex )
}
else if( tex->flags & TF_NOMIPMAP )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
if( tex->flags & TF_NEAREST )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
else
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_LINEAR );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_LINEAR );
}
}
else
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, r_textureMinFilter );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
if( tex->flags & TF_NEAREST )
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, GL_NEAREST_MIPMAP_NEAREST );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, GL_NEAREST );
}
else
{
pglTexParameteri( tex->target, GL_TEXTURE_MIN_FILTER, r_textureMinFilter );
pglTexParameteri( tex->target, GL_TEXTURE_MAG_FILTER, r_textureMagFilter );
}
// set texture anisotropy if available
if( GL_Support( R_ANISOTROPY_EXT ))
pglTexParameterf( tex->target, GL_TEXTURE_MAX_ANISOTROPY_EXT, gl_texture_anisotropy->value );

View File

@ -78,6 +78,7 @@ typedef enum
TF_SKYSIDE = BIT(7),
TF_CLAMP = BIT(8),
TF_NOMIPMAP = BIT(9),
TF_NEAREST = BIT(10), // disable texfilter
} texFlags_t;
#define TF_CINEMATIC ( TF_NOPICMIP|TF_UNCOMPRESSED|TF_CLAMP|TF_NOMIPMAP )

View File

@ -634,6 +634,7 @@ void GL_InitBackend( void )
r_temppool = Mem_AllocPool( "Render Memory" );
// check developer mode
if(FS_CheckParm( "-console" )) glw_state.developer = 1;
if(FS_GetParmFromCmdLine( "-dev", dev_level ))
glw_state.developer = com.atoi( dev_level );