diff options
-rw-r--r-- | assets/ui/loading.menu | 8 | ||||
-rw-r--r-- | src/cgame/cg_draw.c | 63 | ||||
-rw-r--r-- | src/cgame/cg_local.h | 2 | ||||
-rw-r--r-- | src/cgame/cg_main.c | 2 | ||||
-rw-r--r-- | src/ui/ui_main.c | 11 | ||||
-rw-r--r-- | src/ui/ui_shared.c | 69 | ||||
-rw-r--r-- | src/ui/ui_shared.h | 6 |
7 files changed, 85 insertions, 76 deletions
diff --git a/assets/ui/loading.menu b/assets/ui/loading.menu index 2b4af59c..b877ce9c 100644 --- a/assets/ui/loading.menu +++ b/assets/ui/loading.menu @@ -132,7 +132,7 @@ textalign ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 - special 1.0 + borderSize 1.0 } itemDef @@ -161,7 +161,7 @@ textalign ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 - special 1.0 + borderSize 1.0 } itemDef @@ -189,7 +189,7 @@ textalign ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 - special 1.0 + borderSize 1.0 } itemDef @@ -217,7 +217,7 @@ textalign ALIGN_CENTER textstyle ITEM_TEXTSTYLE_NEON textscale 0.5 - special 1.0 + borderSize 1.0 } } } diff --git a/src/cgame/cg_draw.c b/src/cgame/cg_draw.c index 144e6983..c28758d1 100644 --- a/src/cgame/cg_draw.c +++ b/src/cgame/cg_draw.c @@ -239,18 +239,21 @@ void CG_DrawField( float x, float y, int width, float cw, float ch, int value ) static void CG_DrawProgressBar( rectDef_t *rect, vec4_t color, float scale, int align, int textalign, int textStyle, - int special, float progress ) + float borderSize, float progress ) { - float rimWidth = rect->h / 20.0f; + float rimWidth; float doneWidth, leftWidth; float tx, ty; char textBuffer[ 8 ]; - if( rimWidth < 0.6f ) - rimWidth = 0.6f; - - if( special >= 0.0f ) - rimWidth = special; + if( borderSize >= 0.0f ) + rimWidth = borderSize; + else + { + rimWidth = rect->h / 20.0f; + if( rimWidth < 0.6f ) + rimWidth = 0.6f; + } if( progress < 0.0f ) progress = 0.0f; @@ -1033,9 +1036,11 @@ static void CG_DrawProgressLabel( rectDef_t *rect, float text_x, float text_y, v } static void CG_DrawMediaProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textalign, int textStyle, int special ) + int align, int textalign, int textStyle, + float borderSize ) { - CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.mediaFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, + borderSize, cg.mediaFraction ); } static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -1045,10 +1050,12 @@ static void CG_DrawMediaProgressLabel( rectDef_t *rect, float text_x, float text "Map and Textures", cg.mediaFraction ); } -static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textalign, int textStyle, int special ) +static void CG_DrawBuildablesProgress( rectDef_t *rect, vec4_t color, + float scale, int align, int textalign, + int textStyle, float borderSize ) { - CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.buildablesFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, + borderSize, cg.buildablesFraction ); } static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -1058,10 +1065,12 @@ static void CG_DrawBuildablesProgressLabel( rectDef_t *rect, float text_x, float "Buildable Models", cg.buildablesFraction ); } -static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textalign, int textStyle, int special ) +static void CG_DrawCharModelProgress( rectDef_t *rect, vec4_t color, + float scale, int align, int textalign, + int textStyle, float borderSize ) { - CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, cg.charModelFraction ); + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, + borderSize, cg.charModelFraction ); } static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float text_y, @@ -1072,12 +1081,16 @@ static void CG_DrawCharModelProgressLabel( rectDef_t *rect, float text_x, float } static void CG_DrawOverallProgress( rectDef_t *rect, vec4_t color, float scale, - int align, int textalign, int textStyle, int special ) + int align, int textalign, int textStyle, + float borderSize ) { float total; - total = ( cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction ) / 3.0f; - CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, special, total ); + total = cg.charModelFraction + cg.buildablesFraction + cg.mediaFraction; + total /= 3.0f; + + CG_DrawProgressBar( rect, color, scale, align, textalign, textStyle, + borderSize, total ); } static void CG_DrawLevelShot( rectDef_t *rect ) @@ -2283,7 +2296,7 @@ Draw an owner drawn item */ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, - int align, int textalign, int textvalign, float special, + int align, int textalign, int textvalign, float borderSize, float scale, vec4_t foreColor, vec4_t backColor, qhandle_t shader, int textStyle ) { @@ -2405,25 +2418,29 @@ void CG_OwnerDraw( float x, float y, float w, float h, float text_x, CG_DrawLevelShot( &rect ); break; case CG_LOAD_MEDIA: - CG_DrawMediaProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); + CG_DrawMediaProgress( &rect, foreColor, scale, align, textalign, textStyle, + borderSize ); break; case CG_LOAD_MEDIA_LABEL: CG_DrawMediaProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_BUILDABLES: - CG_DrawBuildablesProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); + CG_DrawBuildablesProgress( &rect, foreColor, scale, align, textalign, + textStyle, borderSize ); break; case CG_LOAD_BUILDABLES_LABEL: CG_DrawBuildablesProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_CHARMODEL: - CG_DrawCharModelProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); + CG_DrawCharModelProgress( &rect, foreColor, scale, align, textalign, + textStyle, borderSize ); break; case CG_LOAD_CHARMODEL_LABEL: CG_DrawCharModelProgressLabel( &rect, text_x, text_y, foreColor, scale, textalign, textvalign ); break; case CG_LOAD_OVERALL: - CG_DrawOverallProgress( &rect, foreColor, scale, align, textalign, textStyle, special ); + CG_DrawOverallProgress( &rect, foreColor, scale, align, textalign, textStyle, + borderSize ); break; case CG_LOAD_LEVELNAME: CG_DrawLevelName( &rect, text_x, text_y, foreColor, scale, textalign, textvalign, textStyle ); diff --git a/src/cgame/cg_local.h b/src/cgame/cg_local.h index f1e0ada0..c1e5dada 100644 --- a/src/cgame/cg_local.h +++ b/src/cgame/cg_local.h @@ -1630,7 +1630,7 @@ void CG_DrawActive( stereoFrame_t stereoView ); void CG_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, int textalign, int textvalign, - float special, float scale, vec4_t foreColor, + float borderSize, float scale, vec4_t foreColor, vec4_t backColor, qhandle_t shader, int textStyle ); float CG_GetValue(int ownerDraw); void CG_RunMenuScript(char **args); diff --git a/src/cgame/cg_main.c b/src/cgame/cg_main.c index eb9f2c73..44edf153 100644 --- a/src/cgame/cg_main.c +++ b/src/cgame/cg_main.c @@ -1347,7 +1347,7 @@ void CG_LoadMenus( const char *menuFile ) -static qboolean CG_OwnerDrawHandleKey( int ownerDraw, int flags, float *special, int key ) +static qboolean CG_OwnerDrawHandleKey( int ownerDraw, int key ) { return qfalse; } diff --git a/src/ui/ui_main.c b/src/ui/ui_main.c index 00cc23f2..441ce79a 100644 --- a/src/ui/ui_main.c +++ b/src/ui/ui_main.c @@ -1889,9 +1889,10 @@ static void UI_DrawGLInfo( rectDef_t *rect, float scale, int textalign, int text static void UI_OwnerDraw( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, - int textalign, int textvalign, float special, + int textalign, int textvalign, float borderSize, float scale, vec4_t foreColor, vec4_t backColor, - qhandle_t shader, int textStyle ) + qhandle_t shader, + int textStyle ) { rectDef_t rect; @@ -2065,7 +2066,7 @@ static qboolean UI_OwnerDrawVisible( int flags ) return vis; } -static qboolean UI_NetSource_HandleKey( int flags, float *special, int key ) +static qboolean UI_NetSource_HandleKey( int key ) { if( key == K_MOUSE1 || key == K_MOUSE2 || key == K_ENTER || key == K_KP_ENTER ) { @@ -2101,12 +2102,12 @@ static qboolean UI_NetSource_HandleKey( int flags, float *special, int key ) return qfalse; } -static qboolean UI_OwnerDrawHandleKey( int ownerDraw, int flags, float *special, int key ) +static qboolean UI_OwnerDrawHandleKey( int ownerDraw, int key ) { switch( ownerDraw ) { case UI_NETSOURCE: - UI_NetSource_HandleKey( flags, special, key ); + UI_NetSource_HandleKey( key ); break; default: diff --git a/src/ui/ui_shared.c b/src/ui/ui_shared.c index 4befa326..7868a959 100644 --- a/src/ui/ui_shared.c +++ b/src/ui/ui_shared.c @@ -1775,7 +1775,7 @@ void Script_Reset( itemDef_t *item, char **args ) { resetItem->cursorPos = 0; resetItem->typeData.list->startPos = 0; - DC->feederSelection( resetItem->special, 0 ); + DC->feederSelection( resetItem->feederID, 0 ); } } } @@ -2668,7 +2668,7 @@ qboolean Item_SetFocus( itemDef_t *item, float x, float y ) int Item_ListBox_MaxScroll( itemDef_t *item ) { listBoxDef_t *listPtr = item->typeData.list; - int count = DC->feederCount( item->special ); + int count = DC->feederCount( item->feederID ); int max; if( item->window.flags & WINDOW_HORIZONTAL ) @@ -2806,7 +2806,7 @@ int Item_ListBox_OverLB( itemDef_t *item, float x, float y ) int thumbstart; int count; - count = DC->feederCount( item->special ); + count = DC->feederCount( item->feederID ); if( item->window.flags & WINDOW_HORIZONTAL ) { @@ -3033,7 +3033,7 @@ void Item_SetMouseOver( itemDef_t *item, qboolean focus ) qboolean Item_OwnerDraw_HandleKey( itemDef_t *item, int key ) { if( item && DC->ownerDrawHandleKey ) - return DC->ownerDrawHandleKey( item->window.ownerDraw, item->window.ownerDrawFlags, &item->special, key ); + return DC->ownerDrawHandleKey( item->window.ownerDraw, key ); return qfalse; } @@ -3041,7 +3041,7 @@ qboolean Item_OwnerDraw_HandleKey( itemDef_t *item, int key ) qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboolean force ) { listBoxDef_t *listPtr = item->typeData.list; - int count = DC->feederCount( item->special ); + int count = DC->feederCount( item->feederID ); int max, viewmax; if( force || ( Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory ) && @@ -3069,7 +3069,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3098,7 +3098,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3131,7 +3131,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3160,7 +3160,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3219,7 +3219,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole if( item->cursorPos != listPtr->cursorPos ) { item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } if( DC->realTime < lastListBoxClickTime && listPtr->doubleClick ) @@ -3293,7 +3293,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3324,7 +3324,7 @@ qboolean Item_ListBox_HandleKey( itemDef_t *item, int key, qboolean down, qboole listPtr->startPos = listPtr->cursorPos - viewmax + 1; item->cursorPos = listPtr->cursorPos; - DC->feederSelection( item->special, item->cursorPos ); + DC->feederSelection( item->feederID, item->cursorPos ); } else { @@ -3433,7 +3433,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key ) { comboBoxDef_t *comboPtr = item->typeData.combo; qboolean mouseOver = Rect_ContainsPoint( &item->window.rect, DC->cursorx, DC->cursory ); - int count = DC->feederCount( item->special ); + int count = DC->feederCount( item->feederID ); if( comboPtr ) { @@ -3445,7 +3445,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key ) if( count > 0 ) comboPtr->cursorPos = ( comboPtr->cursorPos + 1 ) % count; - DC->feederSelection( item->special, comboPtr->cursorPos ); + DC->feederSelection( item->feederID, comboPtr->cursorPos ); return qtrue; } @@ -3455,7 +3455,7 @@ qboolean Item_Combobox_HandleKey( itemDef_t *item, int key ) if( count > 0 ) comboPtr->cursorPos = ( count + comboPtr->cursorPos - 1 ) % count; - DC->feederSelection( item->special, comboPtr->cursorPos ); + DC->feederSelection( item->feederID, comboPtr->cursorPos ); return qtrue; } @@ -4144,12 +4144,12 @@ void Menus_Activate( menuDef_t *menu ) { menu->items[ i ]->cursorPos = 0; menu->items[ i ]->typeData.list->startPos = 0; - DC->feederSelection( menu->items[ i ]->special, 0 ); + DC->feederSelection( menu->items[ i ]->feederID, 0 ); } else if( menu->items[ i ]->type == ITEM_TYPE_COMBO ) { menu->items[ i ]->typeData.combo->cursorPos = - DC->feederInitialise( menu->items[ i ]->special ); + DC->feederInitialise( menu->items[ i ]->feederID ); } } @@ -5087,7 +5087,7 @@ void Item_Combobox_Paint( itemDef_t *item ) memcpy( &newColor, &item->window.foreColor, sizeof( vec4_t ) ); if( item->typeData.combo ) - text = DC->feederItemText( item->special, item->typeData.combo->cursorPos, + text = DC->feederItemText( item->feederID, item->typeData.combo->cursorPos, 0, NULL ); if( item->text ) @@ -5659,7 +5659,7 @@ void Item_ListBox_Paint( itemDef_t *item ) // elements are enumerated from the DC and either text or image handles are acquired from the DC as well // textscale is used to size the text, textalignx and textaligny are used to size image elements // there is no clipping available so only the last completely visible item is painted - count = DC->feederCount( item->special ); + count = DC->feederCount( item->feederID ); // default is vertical if horizontal flag is not here if( item->window.flags & WINDOW_HORIZONTAL ) @@ -5703,7 +5703,7 @@ void Item_ListBox_Paint( itemDef_t *item ) { // always draw at least one // which may overdraw the box if it is too small for the element - image = DC->feederItemImage( item->special, i ); + image = DC->feederItemImage( item->feederID, i ); if( image ) DC->drawHandlePic( x + 1, y + 1, listPtr->elementWidth - 2, listPtr->elementHeight - 2, image ); @@ -5765,7 +5765,7 @@ void Item_ListBox_Paint( itemDef_t *item ) { // always draw at least one // which may overdraw the box if it is too small for the element - image = DC->feederItemImage( item->special, i ); + image = DC->feederItemImage( item->feederID, i ); if( image ) DC->drawHandlePic( x + one, y + 1, listPtr->elementWidth - two, listPtr->elementHeight - 2, image ); @@ -5823,7 +5823,7 @@ void Item_ListBox_Paint( itemDef_t *item ) height = listPtr->columnInfo[ j ].width; - Q_strncpyz( text, DC->feederItemText( item->special, i, j, &optionalImage ), sizeof( text ) ); + Q_strncpyz( text, DC->feederItemText( item->feederID, i, j, &optionalImage ), sizeof( text ) ); if( optionalImage >= 0 ) { @@ -5878,7 +5878,7 @@ void Item_ListBox_Paint( itemDef_t *item ) else offset = 4.0f; - Q_strncpyz( text, DC->feederItemText( item->special, i, 0, &optionalImage ), sizeof( text ) ); + Q_strncpyz( text, DC->feederItemText( item->feederID, i, 0, &optionalImage ), sizeof( text ) ); if( optionalImage >= 0 ) DC->drawHandlePic( x + offset, y, listPtr->elementHeight, listPtr->elementHeight, optionalImage ); @@ -5987,7 +5987,7 @@ void Item_OwnerDraw_Paint( itemDef_t *item ) item->textalignx, item->textaligny, item->window.ownerDraw, item->window.ownerDrawFlags, item->alignment, item->textalignment, item->textvalignment, - item->special, item->textscale, color, item->window.backColor, + item->window.borderSize, item->textscale, color, item->window.backColor, item->window.background, item->textStyle ); } } @@ -6288,7 +6288,7 @@ void Menu_ScrollFeeder( menuDef_t *menu, int feeder, qboolean down ) for( i = 0; i < menu->itemCount; i++ ) { - if( menu->items[i]->special == feeder ) + if( menu->items[i]->feederID == feeder ) { Item_ListBox_HandleKey( menu->items[i], ( down ) ? K_DOWNARROW : K_UPARROW, qtrue, qtrue ); return; @@ -6315,16 +6315,16 @@ void Menu_SetFeederSelection( menuDef_t *menu, int feeder, int index, const char for( i = 0; i < menu->itemCount; i++ ) { - if( menu->items[i]->special == feeder ) + if( menu->items[i]->feederID == feeder ) { - if( index == 0 ) + if( menu->items[i]->type == ITEM_TYPE_LISTBOX && index == 0 ) { menu->items[ i ]->typeData.list->cursorPos = 0; menu->items[ i ]->typeData.list->startPos = 0; } menu->items[i]->cursorPos = index; - DC->feederSelection( menu->items[i]->special, menu->items[i]->cursorPos ); + DC->feederSelection( menu->items[i]->feederID, menu->items[i]->cursorPos ); return; } } @@ -6832,10 +6832,10 @@ qboolean ItemParse_elementheight( itemDef_t *item, int handle ) return PC_Float_Parse( handle, &item->typeData.list->elementHeight ); } -// feeder <float> +// feeder <int> qboolean ItemParse_feeder( itemDef_t *item, int handle ) { - if( !PC_Float_Parse( handle, &item->special ) ) + if( !PC_Int_Parse( handle, &item->feederID ) ) return qfalse; return qtrue; @@ -7124,14 +7124,6 @@ qboolean ItemParse_action( itemDef_t *item, int handle ) return qtrue; } -qboolean ItemParse_special( itemDef_t *item, int handle ) -{ - if( !PC_Float_Parse( handle, &item->special ) ) - return qfalse; - - return qtrue; -} - qboolean ItemParse_cvarTest( itemDef_t *item, int handle ) { if( !PC_String_Parse( handle, &item->cvarTest ) ) @@ -7433,7 +7425,6 @@ keywordHash_t itemParseKeywords[] = { {"mouseExitText", ItemParse_mouseExitText, NULL}, {"onTextEntry", ItemParse_onTextEntry, NULL}, {"action", ItemParse_action, NULL}, - {"special", ItemParse_special, NULL}, {"cvar", ItemParse_cvar, NULL}, {"maxChars", ItemParse_maxChars, NULL}, {"maxPaintChars", ItemParse_maxPaintChars, NULL}, diff --git a/src/ui/ui_shared.h b/src/ui/ui_shared.h index 3a8ee74f..3c1472b9 100644 --- a/src/ui/ui_shared.h +++ b/src/ui/ui_shared.h @@ -280,7 +280,7 @@ typedef struct itemDef_s sfxHandle_t focusSound; int numColors; // number of color ranges colorRangeDef_t colorRanges[MAX_COLOR_RANGES]; - float special; // used for feeder id's etc.. diff per type + int feederID; // where to get data for this item int cursorPos; // cursor position in characters union { @@ -382,7 +382,7 @@ typedef struct void ( *ownerDrawItem ) ( float x, float y, float w, float h, float text_x, float text_y, int ownerDraw, int ownerDrawFlags, int align, int textalign, int textvalign, - float special, float scale, vec4_t foreColor, + float borderSize, float scale, vec4_t foreColor, vec4_t backColor, qhandle_t shader, int textStyle ); float ( *getValue ) ( int ownerDraw ); qboolean ( *ownerDrawVisible ) ( int flags ); @@ -394,7 +394,7 @@ typedef struct void ( *setOverstrikeMode )( qboolean b ); qboolean ( *getOverstrikeMode )( void ); void ( *startLocalSound )( sfxHandle_t sfx, int channelNum ); - qboolean ( *ownerDrawHandleKey )( int ownerDraw, int flags, float *special, int key ); + qboolean ( *ownerDrawHandleKey )( int ownerDraw, int key ); int ( *feederCount )( float feederID ); const char *( *feederItemText )( float feederID, int index, int column, qhandle_t *handle ); qhandle_t ( *feederItemImage )( float feederID, int index ); |