summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
Diffstat (limited to 'src')
-rw-r--r--src/renderer/tr_init.c90
-rw-r--r--src/renderer/tr_local.h10
-rw-r--r--src/sdl/sdl_glimp.c49
-rw-r--r--src/ui/ui_local.h11
-rw-r--r--src/ui/ui_main.c83
-rw-r--r--src/ui/ui_shared.c102
-rw-r--r--src/ui/ui_shared.h8
7 files changed, 235 insertions, 118 deletions
diff --git a/src/renderer/tr_init.c b/src/renderer/tr_init.c
index fd230bd2..426579d7 100644
--- a/src/renderer/tr_init.c
+++ b/src/renderer/tr_init.c
@@ -100,7 +100,6 @@ cvar_t *r_vertexLight;
cvar_t *r_uiFullScreen;
cvar_t *r_shadows;
cvar_t *r_flares;
-cvar_t *r_mode;
cvar_t *r_nobind;
cvar_t *r_singleShader;
cvar_t *r_roundImagesDown;
@@ -126,9 +125,9 @@ cvar_t *r_lodCurveError;
cvar_t *r_fullscreen;
-cvar_t *r_customwidth;
-cvar_t *r_customheight;
-cvar_t *r_customPixelAspect;
+cvar_t *r_width;
+cvar_t *r_height;
+cvar_t *r_pixelAspect;
cvar_t *r_overBrightBits;
cvar_t *r_mapOverBrightBits;
@@ -278,7 +277,7 @@ static void InitOpenGL( void )
//
// GLimp_Init directly or indirectly references the following cvars:
// - r_fullscreen
- // - r_mode
+ // - r_(width|height|pixelAspect)
// - r_(color|depth|stencil)bits
// - r_ignorehwgamma
// - r_gamma
@@ -358,77 +357,6 @@ void GL_CheckErrors( void ) {
}
-/*
-** R_GetModeInfo
-*/
-typedef struct vidmode_s
-{
- const char *description;
- int width, height;
- float pixelAspect; // pixel width / height
-} vidmode_t;
-
-vidmode_t r_vidModes[] =
-{
- { "Mode 0: 320x240", 320, 240, 1 },
- { "Mode 1: 400x300", 400, 300, 1 },
- { "Mode 2: 512x384", 512, 384, 1 },
- { "Mode 3: 640x480", 640, 480, 1 },
- { "Mode 4: 800x600", 800, 600, 1 },
- { "Mode 5: 960x720", 960, 720, 1 },
- { "Mode 6: 1024x768", 1024, 768, 1 },
- { "Mode 7: 1152x864", 1152, 864, 1 },
- { "Mode 8: 1280x1024", 1280, 1024, 1 },
- { "Mode 9: 1600x1200", 1600, 1200, 1 },
- { "Mode 10: 2048x1536", 2048, 1536, 1 },
- { "Mode 11: 856x480 (wide)",856, 480, 1 }
-};
-static int s_numVidModes = ( sizeof( r_vidModes ) / sizeof( r_vidModes[0] ) );
-
-qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode ) {
- vidmode_t *vm;
- float pixelAspect;
-
- if ( mode < -1 ) {
- return qfalse;
- }
- if ( mode >= s_numVidModes ) {
- return qfalse;
- }
-
- if ( mode == -1 ) {
- *width = r_customwidth->integer;
- *height = r_customheight->integer;
- pixelAspect = r_customPixelAspect->value;
- } else {
- vm = &r_vidModes[mode];
-
- *width = vm->width;
- *height = vm->height;
- pixelAspect = vm->pixelAspect;
- }
-
- *windowAspect = (float)*width / ( *height * pixelAspect );
-
- return qtrue;
-}
-
-/*
-** R_ModeList_f
-*/
-static void R_ModeList_f( void )
-{
- int i;
-
- ri.Printf( PRINT_ALL, "\n" );
- for ( i = 0; i < s_numVidModes; i++ )
- {
- ri.Printf( PRINT_ALL, "%s\n", r_vidModes[i].description );
- }
- ri.Printf( PRINT_ALL, "\n" );
-}
-
-
/*
==============================================================================
@@ -903,7 +831,7 @@ void GfxInfo_f( void )
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_SIZE: %d\n", glConfig.maxTextureSize );
ri.Printf( PRINT_ALL, "GL_MAX_TEXTURE_UNITS_ARB: %d\n", glConfig.numTextureUnits );
ri.Printf( PRINT_ALL, "\nPIXELFORMAT: color(%d-bits) Z(%d-bit) stencil(%d-bits)\n", glConfig.colorBits, glConfig.depthBits, glConfig.stencilBits );
- ri.Printf( PRINT_ALL, "MODE: %d, %d x %d %s hz:", r_mode->integer, glConfig.vidWidth, glConfig.vidHeight, fsstrings[r_fullscreen->integer == 1] );
+ ri.Printf( PRINT_ALL, "MODE: %d x %d %s hz:", glConfig.vidWidth, glConfig.vidHeight, fsstrings[r_fullscreen->integer == 1] );
if ( glConfig.displayFrequency )
{
ri.Printf( PRINT_ALL, "%d\n", glConfig.displayFrequency );
@@ -1006,11 +934,10 @@ void R_Register( void )
r_depthbits = ri.Cvar_Get( "r_depthbits", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_overBrightBits = ri.Cvar_Get ("r_overBrightBits", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_ignorehwgamma = ri.Cvar_Get( "r_ignorehwgamma", "0", CVAR_ARCHIVE | CVAR_LATCH);
- r_mode = ri.Cvar_Get( "r_mode", "3", CVAR_ARCHIVE | CVAR_LATCH );
r_fullscreen = ri.Cvar_Get( "r_fullscreen", "1", CVAR_ARCHIVE );
- r_customwidth = ri.Cvar_Get( "r_customwidth", "1600", CVAR_ARCHIVE | CVAR_LATCH );
- r_customheight = ri.Cvar_Get( "r_customheight", "1024", CVAR_ARCHIVE | CVAR_LATCH );
- r_customPixelAspect = ri.Cvar_Get( "r_customPixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
+ r_width = ri.Cvar_Get( "r_width", "640", CVAR_ARCHIVE | CVAR_LATCH );
+ r_height = ri.Cvar_Get( "r_height", "480", CVAR_ARCHIVE | CVAR_LATCH );
+ r_pixelAspect = ri.Cvar_Get( "r_pixelAspect", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_simpleMipMaps = ri.Cvar_Get( "r_simpleMipMaps", "1", CVAR_ARCHIVE | CVAR_LATCH );
r_vertexLight = ri.Cvar_Get( "r_vertexLight", "0", CVAR_ARCHIVE | CVAR_LATCH );
r_uiFullScreen = ri.Cvar_Get( "r_uifullscreen", "0", 0);
@@ -1114,7 +1041,6 @@ void R_Register( void )
ri.Cmd_AddCommand( "shaderlist", R_ShaderList_f );
ri.Cmd_AddCommand( "skinlist", R_SkinList_f );
ri.Cmd_AddCommand( "modellist", R_Modellist_f );
- ri.Cmd_AddCommand( "modelist", R_ModeList_f );
ri.Cmd_AddCommand( "screenshot", R_ScreenShot_f );
ri.Cmd_AddCommand( "screenshotJPEG", R_ScreenShotJPEG_f );
ri.Cmd_AddCommand( "gfxinfo", GfxInfo_f );
diff --git a/src/renderer/tr_local.h b/src/renderer/tr_local.h
index 1bbe12fc..d1ca202f 100644
--- a/src/renderer/tr_local.h
+++ b/src/renderer/tr_local.h
@@ -1028,7 +1028,10 @@ extern cvar_t *r_facePlaneCull; // enables culling of planar surfaces with back
extern cvar_t *r_nocurves;
extern cvar_t *r_showcluster;
-extern cvar_t *r_mode; // video mode
+extern cvar_t *r_width;
+extern cvar_t *r_height;
+extern cvar_t *r_pixelAspect;
+
extern cvar_t *r_fullscreen;
extern cvar_t *r_gamma;
extern cvar_t *r_displayRefresh; // optional display refresh option
@@ -1197,9 +1200,8 @@ model_t *R_AllocModel( void );
void R_Init( void );
image_t *R_FindImageFile( const char *name, qboolean mipmap, qboolean allowPicmip, int glWrapClampMode );
-image_t *R_CreateImage( const char *name, const byte *pic, int width, int height, qboolean mipmap
- , qboolean allowPicmip, int wrapClampMode );
-qboolean R_GetModeInfo( int *width, int *height, float *windowAspect, int mode );
+image_t *R_CreateImage( const char *name, const byte *pic, int width, int height, qboolean mipmap,
+ qboolean allowPicmip, int wrapClampMode );
void R_SetColorMappings( void );
void R_GammaCorrect( byte *buffer, int bufSize );
diff --git a/src/sdl/sdl_glimp.c b/src/sdl/sdl_glimp.c
index fac67a54..0c7bace9 100644
--- a/src/sdl/sdl_glimp.c
+++ b/src/sdl/sdl_glimp.c
@@ -189,12 +189,15 @@ static void GLimp_DetectAvailableModes(void)
}
}
+#define R_FAILSAFE_WIDTH 640
+#define R_FAILSAFE_HEIGHT 480
+
/*
===============
GLimp_SetMode
===============
*/
-static int GLimp_SetMode( int mode, qboolean fullscreen )
+static int GLimp_SetMode( qboolean failSafe, qboolean fullscreen )
{
const char* glstring;
int sdlcolorbits;
@@ -225,14 +228,27 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
ri.Printf( PRINT_ALL, "Estimated display aspect: %.3f\n", glConfig.displayAspect );
}
- ri.Printf (PRINT_ALL, "...setting mode %d:", mode );
-
- if ( !R_GetModeInfo( &glConfig.vidWidth, &glConfig.vidHeight, &glConfig.windowAspect, mode ) )
+ if( !failSafe )
{
- ri.Printf( PRINT_ALL, " invalid mode\n" );
- return RSERR_INVALID_MODE;
+ glConfig.vidWidth = r_width->integer;
+ glConfig.vidHeight = r_height->integer;
+ glConfig.windowAspect = r_width->value /
+ ( r_height->value * r_pixelAspect->value );
}
- ri.Printf( PRINT_ALL, " %d %d\n", glConfig.vidWidth, glConfig.vidHeight);
+ else if( glConfig.vidWidth != R_FAILSAFE_WIDTH &&
+ glConfig.vidHeight != R_FAILSAFE_HEIGHT )
+ {
+ ri.Printf( PRINT_ALL, "Setting mode %dx%d failed, falling back on mode %dx%d\n",
+ glConfig.vidWidth, glConfig.vidHeight, R_FAILSAFE_WIDTH, R_FAILSAFE_HEIGHT );
+
+ glConfig.vidWidth = R_FAILSAFE_WIDTH;
+ glConfig.vidHeight = R_FAILSAFE_HEIGHT;
+ glConfig.windowAspect = 1.0f;
+ }
+ else
+ return RSERR_INVALID_MODE;
+
+ ri.Printf (PRINT_ALL, "...setting mode %dx%d\n", glConfig.vidWidth, glConfig.vidHeight);
if (fullscreen)
{
@@ -394,7 +410,7 @@ static int GLimp_SetMode( int mode, qboolean fullscreen )
GLimp_StartDriverAndSetMode
===============
*/
-static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
+static qboolean GLimp_StartDriverAndSetMode( qboolean failSafe, qboolean fullscreen )
{
rserr_t err;
@@ -417,7 +433,7 @@ static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
fullscreen = qfalse;
}
- err = GLimp_SetMode( mode, fullscreen );
+ err = GLimp_SetMode( failSafe, fullscreen );
switch ( err )
{
@@ -425,7 +441,7 @@ static qboolean GLimp_StartDriverAndSetMode( int mode, qboolean fullscreen )
ri.Printf( PRINT_ALL, "...WARNING: fullscreen unavailable in this mode\n" );
return qfalse;
case RSERR_INVALID_MODE:
- ri.Printf( PRINT_ALL, "...WARNING: could not set the given mode (%d)\n", mode );
+ ri.Printf( PRINT_ALL, "...WARNING: could not set the given mode\n" );
return qfalse;
default:
break;
@@ -577,8 +593,6 @@ static void GLimp_InitExtensions( void )
}
}
-#define R_MODE_FALLBACK 3 // 640 * 480
-
/*
===============
GLimp_Init
@@ -594,16 +608,9 @@ void GLimp_Init( void )
r_allowSoftwareGL = ri.Cvar_Get( "r_allowSoftwareGL", "0", CVAR_LATCH );
// create the window and set up the context
- if( !GLimp_StartDriverAndSetMode( r_mode->integer, r_fullscreen->integer ) )
+ if( !GLimp_StartDriverAndSetMode( qfalse, r_fullscreen->integer ) )
{
- if( r_mode->integer != R_MODE_FALLBACK )
- {
- ri.Printf( PRINT_ALL, "Setting r_mode %d failed, falling back on r_mode %d\n",
- r_mode->integer, R_MODE_FALLBACK );
- if( !GLimp_StartDriverAndSetMode( R_MODE_FALLBACK, r_fullscreen->integer ) )
- success = qfalse;
- }
- else
+ if( !GLimp_StartDriverAndSetMode( qtrue, r_fullscreen->integer ) )
success = qfalse;
}
diff --git a/src/ui/ui_local.h b/src/ui/ui_local.h
index 222942cb..e01f1b8f 100644
--- a/src/ui/ui_local.h
+++ b/src/ui/ui_local.h
@@ -58,6 +58,7 @@ void UI_DrawConnectScreen( qboolean overlay );
#define MAX_DEMOS 256
#define MAX_MOVIES 256
#define MAX_HELP_INFOPANES 32
+#define MAX_RESOLUTIONS 32
typedef struct
{
@@ -178,6 +179,13 @@ menuItem_t;
typedef struct
{
+ int w;
+ int h;
+}
+resolution_t;
+
+typedef struct
+{
displayContextDef_t uiDC;
int playerCount;
@@ -267,6 +275,9 @@ typedef struct
int numFoundPlayerServers;
int nextFindPlayerRefresh;
+ resolution_t resolutions[ MAX_RESOLUTIONS ];
+ int numResolutions;
+
qboolean inGameLoad;
qboolean chatTeam;
diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c
index fcc3799d..5144c7c7 100644
--- a/src/ui/ui_main.c
+++ b/src/ui/ui_main.c
@@ -3353,6 +3353,8 @@ static int UI_FeederCount( float feederID )
return uiInfo.alienBuildCount;
else if( feederID == FEEDER_TREMHUMANBUILD )
return uiInfo.humanBuildCount;
+ else if( feederID == FEEDER_RESOLUTIONS )
+ return uiInfo.numResolutions;
return 0;
}
@@ -3382,9 +3384,12 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
static char info[MAX_STRING_CHARS];
static char hostname[1024];
static char clientBuff[32];
+ static char resolution[MAX_STRING_CHARS];
static int lastColumn = -1;
static int lastTime = 0;
- *handle = -1;
+
+ if( handle )
+ *handle = -1;
if( feederID == FEEDER_MAPS )
{
@@ -3571,6 +3576,24 @@ static const char *UI_FeederItemText( float feederID, int index, int column, qha
if( index >= 0 && index < uiInfo.humanBuildCount )
return uiInfo.humanBuildList[ index ].text;
}
+ else if( feederID == FEEDER_RESOLUTIONS )
+ {
+ int i;
+ int w = trap_Cvar_VariableValue( "r_width" );
+ int h = trap_Cvar_VariableValue( "r_height" );
+
+ for( i = 0; i < uiInfo.numResolutions; i++ )
+ {
+ if( w == uiInfo.resolutions[ i ].w && h == uiInfo.resolutions[ i ].h )
+ {
+ Com_sprintf( resolution, sizeof( resolution ), "%dx%d", w, h );
+ return resolution;
+ }
+ }
+
+ Com_sprintf( resolution, sizeof( resolution ), "Custom (%dx%d)", w, h );
+ return resolution;
+ }
return "";
}
@@ -3697,6 +3720,29 @@ static void UI_FeederSelection( float feederID, int index )
uiInfo.alienBuildIndex = index;
else if( feederID == FEEDER_TREMHUMANBUILD )
uiInfo.humanBuildIndex = index;
+ else if( feederID == FEEDER_RESOLUTIONS )
+ {
+ trap_Cvar_Set( "r_width", va( "%d", uiInfo.resolutions[ index ].w ) );
+ trap_Cvar_Set( "r_height", va( "%d", uiInfo.resolutions[ index ].h ) );
+ }
+}
+
+static int UI_FeederInitialise( float feederID )
+{
+ if( feederID == FEEDER_RESOLUTIONS )
+ {
+ int i;
+ int w = trap_Cvar_VariableValue( "r_width" );
+ int h = trap_Cvar_VariableValue( "r_height" );
+
+ for( i = 0; i < uiInfo.numResolutions; i++ )
+ {
+ if( w == uiInfo.resolutions[ i ].w && h == uiInfo.resolutions[ i ].h )
+ return i;
+ }
+ }
+
+ return 0;
}
static void UI_Pause( qboolean b )
@@ -3756,6 +3802,38 @@ static float UI_GetValue( int ownerDraw )
return 0.0f;
}
+/*
+=================
+UI_ParseResolutions
+=================
+*/
+void UI_ParseResolutions( void )
+{
+ char buf[ MAX_STRING_CHARS ];
+ char w[ 16 ], h[ 16 ];
+ char *p;
+ const char *out;
+ char *s = NULL;
+
+ trap_Cvar_VariableStringBuffer( "r_availableModes", buf, sizeof( buf ) );
+ p = buf;
+ uiInfo.numResolutions = 0;
+
+ while( String_Parse( &p, &out ) )
+ {
+ Q_strncpyz( w, out, sizeof( w ) );
+ s = strchr( w, 'x' );
+ if( !s )
+ return;
+
+ *s++ = '\0';
+ Q_strncpyz( h, s, sizeof( h ) );
+
+ uiInfo.resolutions[ uiInfo.numResolutions ].w = atoi( w );
+ uiInfo.resolutions[ uiInfo.numResolutions ].h = atoi( h );
+ uiInfo.numResolutions++;
+ }
+}
/*
=================
@@ -3815,6 +3893,7 @@ void UI_Init( qboolean inGameLoad )
uiInfo.uiDC.feederItemImage = &UI_FeederItemImage;
uiInfo.uiDC.feederItemText = &UI_FeederItemText;
uiInfo.uiDC.feederSelection = &UI_FeederSelection;
+ uiInfo.uiDC.feederInitialise = &UI_FeederInitialise;
uiInfo.uiDC.setBinding = &trap_Key_SetBinding;
uiInfo.uiDC.getBindingBuf = &trap_Key_GetBindingBuf;
uiInfo.uiDC.keynumToStringBuf = &trap_Key_KeynumToStringBuf;
@@ -3858,6 +3937,8 @@ void UI_Init( qboolean inGameLoad )
uiInfo.previewMovie = -1;
trap_Cvar_Register( NULL, "debug_protocol", "", 0 );
+
+ UI_ParseResolutions( );
}
diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c
index 2b06329a..8d6d3635 100644
--- a/src/ui/ui_shared.c
+++ b/src/ui/ui_shared.c
@@ -3320,23 +3320,70 @@ const char *Item_Multi_Setting( itemDef_t *item )
return "";
}
+qboolean Item_Combobox_HandleKey( itemDef_t *item, int key )
+{
+ comboBoxDef_t *comboPtr = (comboBoxDef_t *)item->typeData;
+ qboolean mouseOver = Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory );
+ int count = DC->feederCount( item->special );
+
+ if( comboPtr )
+ {
+ if( item->window.flags & WINDOW_HASFOCUS )
+ {
+ if( ( mouseOver && key == K_MOUSE1 ) ||
+ key == K_ENTER || key == K_RIGHTARROW || key == K_DOWNARROW )
+ {
+ if( count > 0 )
+ comboPtr->cursorPos = ( comboPtr->cursorPos + 1 ) % count;
+
+ DC->feederSelection( item->special, comboPtr->cursorPos );
+
+ return qtrue;
+ }
+ else if( ( mouseOver && key == K_MOUSE2 ) ||
+ key == K_LEFTARROW || key == K_UPARROW )
+ {
+ if( count > 0 )
+ comboPtr->cursorPos = ( count + comboPtr->cursorPos - 1 ) % count;
+
+ DC->feederSelection( item->special, comboPtr->cursorPos );
+
+ return qtrue;
+ }
+ }
+ }
+
+ return qfalse;
+}
+
qboolean Item_Multi_HandleKey( itemDef_t *item, int key )
{
multiDef_t * multiPtr = ( multiDef_t* )item->typeData;
+ qboolean mouseOver = Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory );
+ int max = Item_Multi_CountSettings( item );
+ qboolean changed = qfalse;
if( multiPtr )
{
- if( Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory ) &&
- item->window.flags & WINDOW_HASFOCUS && item->cvar )
+ if( item->window.flags & WINDOW_HASFOCUS && item->cvar && max > 0 )
{
- if( key == K_MOUSE1 || key == K_ENTER || key == K_MOUSE2 || key == K_MOUSE3 )
- {
- int current = Item_Multi_FindCvarByValue( item ) + 1;
- int max = Item_Multi_CountSettings( item );
+ int current;
- if( current < 0 || current >= max )
- current = 0;
+ if( ( mouseOver && key == K_MOUSE1 ) ||
+ key == K_ENTER || key == K_RIGHTARROW || key == K_DOWNARROW )
+ {
+ current = ( Item_Multi_FindCvarByValue( item ) + 1 ) % max;
+ changed = qtrue;
+ }
+ else if( ( mouseOver && key == K_MOUSE2 ) ||
+ key == K_LEFTARROW || key == K_UPARROW )
+ {
+ current = ( Item_Multi_FindCvarByValue( item ) + max - 1 ) % max;
+ changed = qtrue;
+ }
+ if( changed )
+ {
if( multiPtr->strDef )
DC->setCVar( item->cvar, multiPtr->cvarStr[current] );
else
@@ -3820,7 +3867,7 @@ qboolean Item_HandleKey( itemDef_t *item, int key, qboolean down )
break;
case ITEM_TYPE_COMBO:
- return qfalse;
+ return Item_Combobox_HandleKey( item, key );
break;
case ITEM_TYPE_LISTBOX:
@@ -4003,6 +4050,12 @@ void Menus_Activate( menuDef_t *menu )
listPtr->startPos = 0;
DC->feederSelection( menu->items[ i ]->special, 0 );
}
+ else if( menu->items[ i ]->type == ITEM_TYPE_COMBO )
+ {
+ comboBoxDef_t *comboPtr = (comboBoxDef_t *)menu->items[ i ]->typeData;
+
+ comboPtr->cursorPos = DC->feederInitialise( menu->items[ i ]->special );
+ }
}
@@ -4958,6 +5011,31 @@ void Item_Multi_Paint( itemDef_t *item )
UI_Text_Paint( item->textRect.x, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle );
}
+void Item_Combobox_Paint( itemDef_t *item )
+{
+ vec4_t newColor;
+ const char *text = "";
+ menuDef_t *parent = (menuDef_t *)item->parent;
+ comboBoxDef_t *comboPtr = (comboBoxDef_t *)item->typeData;
+
+ if( item->window.flags & WINDOW_HASFOCUS )
+ memcpy( newColor, &parent->focusColor, sizeof( vec4_t ) );
+ else
+ memcpy( &newColor, &item->window.foreColor, sizeof( vec4_t ) );
+
+ if( comboPtr )
+ text = DC->feederItemText( item->special, comboPtr->cursorPos, 0, NULL );
+
+ if( item->text )
+ {
+ Item_Text_Paint( item );
+ UI_Text_Paint( item->textRect.x + item->textRect.w + ITEM_VALUE_OFFSET, item->textRect.y,
+ item->textscale, newColor, text, 0, 0, item->textStyle );
+ }
+ else
+ UI_Text_Paint( item->textRect.x, item->textRect.y, item->textscale, newColor, text, 0, 0, item->textStyle );
+}
+
typedef struct
{
@@ -6064,6 +6142,7 @@ void Item_Paint( itemDef_t *item )
break;
case ITEM_TYPE_COMBO:
+ Item_Combobox_Paint( item );
break;
case ITEM_TYPE_LISTBOX:
@@ -6379,6 +6458,11 @@ void Item_ValidateTypeData( itemDef_t *item )
item->typeData = UI_Alloc( sizeof( listBoxDef_t ) );
memset( item->typeData, 0, sizeof( listBoxDef_t ) );
}
+ else if( item->type == ITEM_TYPE_COMBO )
+ {
+ item->typeData = UI_Alloc( sizeof( comboBoxDef_t ) );
+ memset( item->typeData, 0, sizeof( comboBoxDef_t ) );
+ }
else if( item->type == ITEM_TYPE_EDITFIELD ||
item->type == ITEM_TYPE_NUMERICFIELD ||
item->type == ITEM_TYPE_YESNO ||
diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h
index bbf09234..36d77bf8 100644
--- a/src/ui/ui_shared.h
+++ b/src/ui/ui_shared.h
@@ -203,9 +203,14 @@ typedef struct listBoxDef_s
qboolean notselectable;
qboolean noscrollbar;
}
-
listBoxDef_t;
+typedef struct comboBoxDef_s
+{
+ int cursorPos;
+}
+comboBoxDef_t;
+
typedef struct editFieldDef_s
{
float minVal; // edit field limits
@@ -380,6 +385,7 @@ typedef struct
const char *( *feederItemText )( float feederID, int index, int column, qhandle_t *handle );
qhandle_t ( *feederItemImage )( float feederID, int index );
void ( *feederSelection )( float feederID, int index );
+ int ( *feederInitialise )( float feederID );
void ( *keynumToStringBuf )( int keynum, char *buf, int buflen );
void ( *getBindingBuf )( int keynum, char *buf, int buflen );
void ( *setBinding )( int keynum, const char *binding );